X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Froute_time_axis.cc;h=d3b28bd04218b28b9d3d170cb420a9dc9d5ffa88;hb=a2fd790252b651fae8ccf2a3d7e35c3d7cf65a30;hp=e480485d8496f192f026b16ae0d1257caababef2;hpb=17ace643e4edbec1e5bd7b446d039f8c94beef75;p=ardour.git diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index e480485d84..d3b28bd042 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -95,8 +95,7 @@ using namespace std; using std::list; RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, ArdourCanvas::Canvas& canvas) - : AxisView(sess) - , RouteUI(sess) + : RouteUI(sess) , TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas) , _view (0) , parent_canvas (canvas) @@ -129,6 +128,14 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, ArdourCan parameter_changed ("editor-stereo-only-meters"); } +void +RouteTimeAxisView::route_property_changed (const PBD::PropertyChange& what_changed) +{ + if (what_changed.contains (ARDOUR::Properties::name)) { + label_view (); + } +} + void RouteTimeAxisView::set_route (boost::shared_ptr rt) { @@ -171,7 +178,7 @@ RouteTimeAxisView::set_route (boost::shared_ptr rt) playlist_button.set_name ("route button"); automation_button.set_name ("route button"); - route_group_button.signal_button_release_event().connect (sigc::mem_fun(*this, &RouteTimeAxisView::route_group_click), false); + route_group_button.signal_button_release_event().connect (sigc::mem_fun(*this, &RouteTimeAxisView::route_group_click), false); playlist_button.signal_clicked.connect (sigc::mem_fun(*this, &RouteTimeAxisView::playlist_click)); automation_button.signal_clicked.connect (sigc::mem_fun(*this, &RouteTimeAxisView::automation_click)); @@ -191,8 +198,6 @@ RouteTimeAxisView::set_route (boost::shared_ptr rt) gm.set_fader_name ("AudioTrackFader"); } - rec_enable_button->set_sensitive (_session->writable()); - /* set playlist button tip to the current playlist, and make it update when it changes */ update_playlist_tip (); track()->PlaylistChanged.connect (*this, invalidator (*this), ui_bind(&RouteTimeAxisView::update_playlist_tip, this), gui_context()); @@ -294,7 +299,6 @@ RouteTimeAxisView::set_route (boost::shared_ptr rt) _y_position = -1; _route->processors_changed.connect (*this, invalidator (*this), boost::bind (&RouteTimeAxisView::processors_changed, this, _1), gui_context()); - _route->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&RouteTimeAxisView::route_property_changed, this, _1), gui_context()); if (is_track()) { @@ -316,8 +320,8 @@ RouteTimeAxisView::set_route (boost::shared_ptr rt) PropertyList* plist = new PropertyList(); - plist->add (ARDOUR::Properties::mute, true); - plist->add (ARDOUR::Properties::solo, true); + plist->add (ARDOUR::Properties::group_mute, true); + plist->add (ARDOUR::Properties::group_solo, true); route_group_menu = new RouteGroupMenu (_session, plist); @@ -344,6 +348,15 @@ RouteTimeAxisView::~RouteTimeAxisView () CatchDeletion (this); } +string +RouteTimeAxisView::name() const +{ + if (_route) { + return _route->name(); + } + return string(); +} + void RouteTimeAxisView::post_construct () { @@ -432,10 +445,8 @@ RouteTimeAxisView::update_track_number_visibility () if (tnw & 1) --tnw; number_label.set_size_request(tnw, -1); number_label.show (); - name_hbox.set_size_request(TimeAxisView::name_width_px - 2 - tnw, -1); // -2 = cellspacing } else { number_label.hide (); - name_hbox.set_size_request(TimeAxisView::name_width_px, -1); } } @@ -453,14 +464,6 @@ RouteTimeAxisView::parameter_changed (string const & p) } } -void -RouteTimeAxisView::route_property_changed (const PropertyChange& what_changed) -{ - if (what_changed.contains (ARDOUR::Properties::name)) { - label_view (); - } -} - void RouteTimeAxisView::take_name_changed (void *src) { @@ -472,7 +475,7 @@ RouteTimeAxisView::take_name_changed (void *src) void RouteTimeAxisView::playlist_click () { - build_playlist_menu (); + build_playlist_menu (); conditionally_add_to_selection (); playlist_action_menu->popup (1, gtk_get_current_event_time()); } @@ -594,11 +597,6 @@ RouteTimeAxisView::build_display_menu () } build_size_menu (); items.push_back (MenuElem (_("Height"), *_size_menu)); - - items.push_back (SeparatorElem()); - - items.push_back (MenuElem (_("Remote Control ID..."), sigc::mem_fun (*this, &RouteUI::open_remote_control_id_dialog))); - items.back().set_sensitive (_editor.get_selection().tracks.size() <= 1); items.push_back (SeparatorElem()); // Hook for derived classes to add type specific stuff @@ -1177,7 +1175,7 @@ RouteTimeAxisView::use_copy_playlist (bool prompt, vectorname(); - if (route_group() && route_group()->is_active() && route_group()->enabled_property (ARDOUR::Properties::select.property_id)) { + if (route_group() && route_group()->is_active() && route_group()->enabled_property (ARDOUR::Properties::group_select.property_id)) { name = resolve_new_group_playlist_name(name, playlists_before_op); } @@ -1232,7 +1230,7 @@ RouteTimeAxisView::use_new_playlist (bool prompt, vectorname(); - if (route_group() && route_group()->is_active() && route_group()->enabled_property (ARDOUR::Properties::select.property_id)) { + if (route_group() && route_group()->is_active() && route_group()->enabled_property (ARDOUR::Properties::group_select.property_id)) { name = resolve_new_group_playlist_name(name,playlists_before_op); } @@ -1412,12 +1410,6 @@ RouteTimeAxisView::route_group () const return _route->route_group(); } -string -RouteTimeAxisView::name() const -{ - return _route->name(); -} - boost::shared_ptr RouteTimeAxisView::playlist () const { @@ -1430,33 +1422,30 @@ RouteTimeAxisView::playlist () const } } -void -RouteTimeAxisView::name_entry_changed () +bool +RouteTimeAxisView::name_entry_changed (string const& str) { - TimeAxisView::name_entry_changed (); - - string x = name_entry->get_text (); - - if (x == _route->name()) { - return; + if (str == _route->name()) { + return true; } + string x = str; + strip_whitespace_edges (x); - if (x.length() == 0) { - name_entry->set_text (_route->name()); - return; + if (x.empty()) { + return false; } if (_session->route_name_internal (x)) { - ARDOUR_UI::instance()->popup_error (string_compose (_("You cannot create a track with that name as it is reserved for %1"), - PROGRAM_NAME)); - name_entry->grab_focus (); + ARDOUR_UI::instance()->popup_error (string_compose (_("The name \"%1\" is reserved for %2"), x, PROGRAM_NAME)); + return false; } else if (RouteUI::verify_new_route_name (x)) { _route->set_name (x); - } else { - name_entry->grab_focus (); + return true; } + + return false; } boost::shared_ptr @@ -1690,7 +1679,7 @@ RouteTimeAxisView::build_playlist_menu () playlist_items.push_back (MenuElem (_("Rename..."), sigc::mem_fun(*this, &RouteTimeAxisView::rename_current_playlist))); playlist_items.push_back (SeparatorElem()); - if (!route_group() || !route_group()->is_active() || !route_group()->enabled_property (ARDOUR::Properties::select.property_id)) { + if (!route_group() || !route_group()->is_active() || !route_group()->enabled_property (ARDOUR::Properties::group_select.property_id)) { playlist_items.push_back (MenuElem (_("New..."), sigc::bind(sigc::mem_fun(_editor, &PublicEditor::new_playlists), this))); playlist_items.push_back (MenuElem (_("New Copy..."), sigc::bind(sigc::mem_fun(_editor, &PublicEditor::copy_playlists), this))); @@ -1734,7 +1723,7 @@ RouteTimeAxisView::use_playlist (RadioMenuItem *item, boost::weak_ptr RouteGroup* rg = route_group(); - if (rg && rg->is_active() && rg->enabled_property (ARDOUR::Properties::select.property_id)) { + if (rg && rg->is_active() && rg->enabled_property (ARDOUR::Properties::group_select.property_id)) { std::string group_string = "." + rg->name() + "."; std::string take_name = pl->name(); @@ -1780,7 +1769,7 @@ void RouteTimeAxisView::update_playlist_tip () { RouteGroup* rg = route_group (); - if (rg && rg->is_active() && rg->enabled_property (ARDOUR::Properties::select.property_id)) { + if (rg && rg->is_active() && rg->enabled_property (ARDOUR::Properties::group_select.property_id)) { string group_string = "." + rg->name() + "."; string take_name = track()->playlist()->name(); @@ -1825,13 +1814,12 @@ RouteTimeAxisView::map_frozen () switch (track()->freeze_state()) { case Track::Frozen: playlist_button.set_sensitive (false); - rec_enable_button->set_sensitive (false); break; default: playlist_button.set_sensitive (true); - rec_enable_button->set_sensitive (true); break; } + RouteUI::map_frozen (); } void @@ -2088,7 +2076,7 @@ RouteTimeAxisView::show_existing_automation (bool apply_to_selection) for (list::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) { for (vector::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) { - if ((*ii)->view != 0 && (*i)->processor->control((*ii)->what)->list()->size() > 0) { + if ((*i)->processor->control((*ii)->what)->list()->size() > 0) { (*ii)->menu_item->set_active (true); } } @@ -2496,7 +2484,11 @@ RouteTimeAxisView::can_edit_name () const { /* we do not allow track name changes if it is record enabled */ - return !_route->record_enabled(); + boost::shared_ptr trk (boost::dynamic_pointer_cast (_route)); + if (!trk) { + return true; + } + return !trk->rec_enable_control()->get_value(); } void @@ -2727,7 +2719,7 @@ RouteTimeAxisView::remove_underlay (StreamView* v) void RouteTimeAxisView::set_button_names () { - if (_route && _route->solo_safe()) { + if (_route && _route->solo_safe_control()->solo_safe()) { solo_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() | Gtkmm2ext::Insensitive)); } else { solo_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() & ~Gtkmm2ext::Insensitive)); @@ -2928,3 +2920,34 @@ RouteTimeAxisView::remove_child (boost::shared_ptr c) } } } + +PresentationInfo const & +RouteTimeAxisView::presentation_info () const +{ + return _route->presentation_info(); +} + +boost::shared_ptr +RouteTimeAxisView::stripable () const +{ + return _route; +} + +Gdk::Color +RouteTimeAxisView::color () const +{ + return route_color (); +} + +bool +RouteTimeAxisView::marked_for_display () const +{ + return !_route->presentation_info().hidden(); +} + +bool +RouteTimeAxisView::set_marked_for_display (bool yn) +{ + return RouteUI::mark_hidden (!yn); +} +