X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Froute_time_axis.cc;h=63abdc2516d647dbf42ea4da4ca333d9b5cca1b4;hb=965c295451916cf7f04d33fbf41ff2beb573439b;hp=cab6262706c5bd0949db3c754c983ee755ef007b;hpb=3043b68bfbcd70ba13d132c8b833cdf3ba199266;p=ardour.git diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index cab6262706..63abdc2516 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -130,6 +130,13 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh visual_button.set_name ("TrackVisualButton"); hide_button.set_name ("TrackRemoveButton"); + edit_group_button.unset_flags (Gtk::CAN_FOCUS); + playlist_button.unset_flags (Gtk::CAN_FOCUS); + automation_button.unset_flags (Gtk::CAN_FOCUS); + size_button.unset_flags (Gtk::CAN_FOCUS); + visual_button.unset_flags (Gtk::CAN_FOCUS); + hide_button.unset_flags (Gtk::CAN_FOCUS); + hide_button.add (*(manage (new Image (::get_icon("hide"))))); hide_button.show_all (); @@ -389,13 +396,9 @@ RouteTimeAxisView::playlist_click () void RouteTimeAxisView::automation_click () { - if (automation_action_menu == 0) { - /* this seems odd, but the automation action - menu is built as part of the display menu. - */ - build_display_menu (); - } conditionally_add_to_selection (); + if (!automation_action_menu) + build_automation_action_menu (); automation_action_menu->popup (1, gtk_get_current_event_time()); } @@ -443,11 +446,11 @@ RouteTimeAxisView::build_display_menu () items.push_back (SeparatorElem()); - build_remote_control_menu (); - build_automation_action_menu (); - if (!Profile->get_sae()) { + build_remote_control_menu (); items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu)); + /* rebuild this every time */ + build_automation_action_menu (); items.push_back (MenuElem (_("Automation"), *automation_action_menu)); items.push_back (SeparatorElem()); } @@ -751,6 +754,18 @@ RouteTimeAxisView::set_height (uint32_t h) } else { hide_meter (); + + /* don't allow name_entry to be hidden while + it has focus, otherwise the GUI becomes unusable. + */ + + if (name_entry.has_focus()) { + if (name_entry.get_text() != _route->name()) { + name_entry_changed (); + } + controls_ebox.grab_focus (); + } + hide_name_entry (); show_name_label (); @@ -1339,6 +1354,12 @@ RouteTimeAxisView::get_child_list() } +struct PlaylistSorter { + bool operator() (boost::shared_ptr a, boost::shared_ptr b) const { + return a->sort_id() < b->sort_id(); + } +}; + void RouteTimeAxisView::build_playlist_menu (Gtk::Menu * menu) { @@ -1352,33 +1373,32 @@ RouteTimeAxisView::build_playlist_menu (Gtk::Menu * menu) menu->set_name ("ArdourContextMenu"); playlist_items.clear(); - if (playlist_menu) { - delete playlist_menu; - } - - playlist_menu = new Menu; - playlist_menu->set_name ("ArdourContextMenu"); - - vector > playlists; + vector > playlists, playlists_ds; boost::shared_ptr ds = get_diskstream(); RadioMenuItem::Group playlist_group; - - _session.get_playlists (playlists); - for (vector >::iterator i = playlists.begin(); i != playlists.end(); ++i) { + _session.get_playlists (playlists); - if ((*i)->get_orig_diskstream_id() == ds->id()) { - playlist_items.push_back (RadioMenuElem (playlist_group, (*i)->name(), bind (mem_fun (*this, &RouteTimeAxisView::use_playlist), - boost::weak_ptr (*i)))); + /* find the playlists for this diskstream */ + for (vector >::iterator i = playlists.begin(); i != playlists.end(); ++i) { + if (((*i)->get_orig_diskstream_id() == ds->id()) || (ds->playlist()->id() == (*i)->id())) { + playlists_ds.push_back(*i); + } + } + + /* sort the playlists */ + PlaylistSorter cmp; + sort(playlists_ds.begin(), playlists_ds.end(), cmp); + + /* add the playlists to the menu */ + for (vector >::iterator i = playlists_ds.begin(); i != playlists_ds.end(); ++i) { + playlist_items.push_back (RadioMenuElem (playlist_group, (*i)->name())); + RadioMenuItem *item = static_cast(&playlist_items.back()); - if (ds->playlist()->id() == (*i)->id()) { - static_cast(&playlist_items.back())->set_active(); - } - } else if (ds->playlist()->id() == (*i)->id()) { - playlist_items.push_back (RadioMenuElem (playlist_group, (*i)->name(), bind (mem_fun (*this, &RouteTimeAxisView::use_playlist), - boost::weak_ptr(*i)))); - static_cast(&playlist_items.back())->set_active(); - + item->signal_toggled().connect(bind (mem_fun (*this, &RouteTimeAxisView::use_playlist), item, boost::weak_ptr (*i))); + + if (ds->playlist()->id() == (*i)->id()) { + item->set_active(); } } @@ -1389,26 +1409,28 @@ RouteTimeAxisView::build_playlist_menu (Gtk::Menu * menu) if (!edit_group() || !edit_group()->is_active()) { playlist_items.push_back (MenuElem (_("New"), bind(mem_fun(editor, &PublicEditor::new_playlists), this))); playlist_items.push_back (MenuElem (_("New Copy"), bind(mem_fun(editor, &PublicEditor::copy_playlists), this))); - } else { // Use a label which tells the user what is happening playlist_items.push_back (MenuElem (_("New Take"), bind(mem_fun(editor, &PublicEditor::new_playlists), this))); playlist_items.push_back (MenuElem (_("Copy Take"), bind(mem_fun(editor, &PublicEditor::copy_playlists), this))); - } playlist_items.push_back (SeparatorElem()); playlist_items.push_back (MenuElem (_("Clear Current"), bind(mem_fun(editor, &PublicEditor::clear_playlists), this))); playlist_items.push_back (SeparatorElem()); - playlist_items.push_back (MenuElem(_("Select from all ..."), mem_fun(*this, &RouteTimeAxisView::show_playlist_selector))); } void -RouteTimeAxisView::use_playlist (boost::weak_ptr wpl) +RouteTimeAxisView::use_playlist (RadioMenuItem *item, boost::weak_ptr wpl) { assert (is_track()); + // exit if we were triggered by deactivating the old playlist + if (!item->get_active()) { + return; + } + boost::shared_ptr pl (wpl.lock()); if (!pl) { @@ -1419,13 +1441,13 @@ RouteTimeAxisView::use_playlist (boost::weak_ptr wpl) if (apl) { if (get_diskstream()->playlist() == apl) { - // radio button cotnrols mean this function is called for both the - // old and new playlist + // exit when use_playlist is called by the creation of the playlist menu + // or the playlist choice is unchanged return; } + get_diskstream()->use_playlist (apl); - if (edit_group() && edit_group()->is_active()) { //PBD::stacktrace(cerr, 20); std::string group_string = "."+edit_group()->name()+"."; @@ -1447,7 +1469,6 @@ RouteTimeAxisView::use_playlist (boost::weak_ptr wpl) Track *track = dynamic_cast(*i); if (!track) { - std::cerr << "route " << (*i)->name() << " is not a Track" << std::endl; continue; } @@ -1826,9 +1847,12 @@ RouteTimeAxisView::redirect_menu_item_toggled (RouteTimeAxisView::RedirectAutoma if (showit != ran->view->marked_for_display()) { if (showit) { + ran->menu_item->set_active(true); ran->view->set_marked_for_display (true); ran->view->canvas_display->show(); + ran->view->canvas_background->show(); } else { + ran->menu_item->set_active(false); rai->redirect->mark_automation_visible (ran->what, true); ran->view->set_marked_for_display (false); ran->view->hide (); @@ -1869,7 +1893,7 @@ RouteTimeAxisView::redirects_changed (void *src) ++tmp; if (!(*i)->valid) { - + delete *i; redirect_automation.erase (i);