From 966e09677d74be7d54ac253a6c244882d6efaffd Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 26 Nov 2009 03:02:16 +0000 Subject: Fix #2926 and #2927; presence and behaviour of solo/mute icons in the editor list. git-svn-id: svn://localhost/ardour2/branches/3.0@6185 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_routes.cc | 46 +++++++++----------- gtk2_ardour/editor_routes.h | 1 + gtk2_ardour/route_ui.cc | 99 +++++++++++++++++++++++++++----------------- gtk2_ardour/route_ui.h | 3 ++ 4 files changed, 83 insertions(+), 66 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc index ed3f1790a8..32dfa77f48 100644 --- a/gtk2_ardour/editor_routes.cc +++ b/gtk2_ardour/editor_routes.cc @@ -92,7 +92,6 @@ EditorRoutes::EditorRoutes (Editor* e) Gtk::TreeViewColumn* mute_state_column = manage (new TreeViewColumn("M", *mute_col_renderer)); mute_state_column->add_attribute(mute_col_renderer->property_state(), _columns.mute_state); - mute_state_column->add_attribute(mute_col_renderer->property_visible(), _columns.is_track); // Solo enable toggle CellRendererPixbufMulti* solo_col_renderer = manage (new CellRendererPixbufMulti()); @@ -104,8 +103,6 @@ EditorRoutes::EditorRoutes (Editor* e) Gtk::TreeViewColumn* solo_state_column = manage (new TreeViewColumn("S", *solo_col_renderer)); solo_state_column->add_attribute(solo_col_renderer->property_state(), _columns.solo_state); - solo_state_column->add_attribute(solo_col_renderer->property_visible(), _columns.is_track); - _display.append_column (*rec_state_column); _display.append_column (*mute_state_column); @@ -157,6 +154,8 @@ EditorRoutes::connect_to_session (Session* s) EditorComponent::connect_to_session (s); initial_display (); + + _session->SoloChanged.connect (mem_fun (*this, &EditorRoutes::solo_changed_so_update_mute)); } void @@ -184,8 +183,8 @@ EditorRoutes::on_tv_mute_enable_toggled (Glib::ustring const & path_string) TimeAxisView *tv = row[_columns.tv]; AudioTimeAxisView *atv = dynamic_cast (tv); - if (atv != 0 && atv->is_audio_track()){ - atv->reversibly_apply_track_boolean ("mute-enable change", &Track::set_mute, !atv->track()->muted(), this); + if (atv != 0) { + atv->reversibly_apply_route_boolean ("mute-enable change", &Route::set_mute, !atv->route()->muted(), this); } } @@ -198,8 +197,8 @@ EditorRoutes::on_tv_solo_enable_toggled (Glib::ustring const & path_string) TimeAxisView *tv = row[_columns.tv]; AudioTimeAxisView *atv = dynamic_cast (tv); - if (atv != 0 && atv->is_audio_track()){ - atv->reversibly_apply_track_boolean ("solo-enable change", &Track::set_solo, !atv->track()->soloed(), this); + if (atv != 0) { + atv->reversibly_apply_route_boolean ("solo-enable change", &Route::set_solo, !atv->route()->soloed(), this); } } @@ -354,9 +353,10 @@ EditorRoutes::routes_added (list routes) if ((*x)->is_track()) { boost::shared_ptr t = boost::dynamic_pointer_cast ((*x)->route()); t->diskstream()->RecordEnableChanged.connect (mem_fun (*this, &EditorRoutes::update_rec_display)); - t->mute_changed.connect (mem_fun (*this, &EditorRoutes::update_mute_display)); - t->solo_changed.connect (mem_fun (*this, &EditorRoutes::update_solo_display)); } + + (*x)->route()->mute_changed.connect (mem_fun (*this, &EditorRoutes::update_mute_display)); + (*x)->route()->solo_changed.connect (mem_fun (*this, &EditorRoutes::update_solo_display)); } update_rec_display (); @@ -911,15 +911,7 @@ EditorRoutes::update_mute_display (void* /*src*/) for (i = rows.begin(); i != rows.end(); ++i) { boost::shared_ptr route = (*i)[_columns.route]; - - if (boost::dynamic_pointer_cast(route)) { - - if (route->muted()){ - (*i)[_columns.mute_state] = 1; - } else { - (*i)[_columns.mute_state] = 0; - } - } + (*i)[_columns.mute_state] = RouteUI::mute_visual_state (*_session, route) > 0 ? 1 : 0; } } @@ -931,15 +923,7 @@ EditorRoutes::update_solo_display (void* /*src*/) for (i = rows.begin(); i != rows.end(); ++i) { boost::shared_ptr route = (*i)[_columns.route]; - - if (boost::dynamic_pointer_cast(route)) { - - if (route->soloed()){ - (*i)[_columns.solo_state] = 1; - } else { - (*i)[_columns.solo_state] = 0; - } - } + (*i)[_columns.solo_state] = RouteUI::solo_visual_state (route) > 0 ? 1 : 0; } } @@ -976,3 +960,11 @@ EditorRoutes::name_edit (Glib::ustring const & path, Glib::ustring const & new_t route->set_name (new_text); } } + +void +EditorRoutes::solo_changed_so_update_mute () +{ + ENSURE_GUI_THREAD (mem_fun (*this, &EditorRoutes::solo_changed_so_update_mute)); + + update_mute_display (this); +} diff --git a/gtk2_ardour/editor_routes.h b/gtk2_ardour/editor_routes.h index 880845ce38..454f850c52 100644 --- a/gtk2_ardour/editor_routes.h +++ b/gtk2_ardour/editor_routes.h @@ -83,6 +83,7 @@ private: void track_list_reorder (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const & iter, int* new_order); bool selection_filter (Glib::RefPtr const &, Gtk::TreeModel::Path const &, bool); void name_edit (Glib::ustring const &, Glib::ustring const &); + void solo_changed_so_update_mute (); struct ModelColumns : public Gtk::TreeModel::ColumnRecord { ModelColumns() { diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 2de7c6964e..9e682573ca 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -658,11 +658,36 @@ RouteUI::listen_changed(void* /*src*/) Gtkmm2ext::UI::instance()->call_slot (mem_fun (*this, &RouteUI::update_solo_display)); } +int +RouteUI::solo_visual_state (boost::shared_ptr r) +{ + if (Config->get_solo_control_is_listen_control()) { + + if (r->listening()) { + return 1; + } else { + return 0; + } + + } else { + + if (r->solo_isolated()) { + return 2; + } else if (r->soloed()) { + return 1; + } else { + return 0; + } + } + + return 0; +} + void RouteUI::update_solo_display () { bool x; - + if (Config->get_solo_control_is_listen_control()) { if (solo_button->get_active() != (x = _route->listening())) { @@ -671,29 +696,17 @@ RouteUI::update_solo_display () ignore_toggle = false; } - if (x) { - solo_button->set_visual_state (1); - } else { - solo_button->set_visual_state (0); - } - - } else { - if (solo_button->get_active() != (x = _route->soloed())){ + if (solo_button->get_active() != (x = _route->soloed())) { ignore_toggle = true; solo_button->set_active (x); ignore_toggle = false; } - if (_route->solo_isolated()) { - solo_button->set_visual_state (2); - } else if (x) { - solo_button->set_visual_state (1); - } else { - solo_button->set_visual_state (0); - } } + + solo_button->set_visual_state (solo_visual_state (_route)); } void @@ -708,6 +721,36 @@ RouteUI::mute_changed(void* /*src*/) Gtkmm2ext::UI::instance()->call_slot (mem_fun (*this, &RouteUI::update_mute_display)); } +int +RouteUI::mute_visual_state (Session& s, boost::shared_ptr r) +{ + if (Config->get_show_solo_mutes()) { + + if (r->muted ()) { + /* full mute */ + return 2; + } else if (s.soloing() && !r->soloed() && !r->solo_isolated()) { + /* mute-because-not-soloed */ + return 1; + } else { + /* no mute at all */ + return 0; + } + + } else { + + if (r->muted()) { + /* full mute */ + return 2; + } else { + /* no mute at all */ + return 0; + } + } + + return 0; +} + void RouteUI::update_mute_display () { @@ -724,29 +767,7 @@ RouteUI::update_mute_display () ignore_toggle = false; } - /* now attend to visual state */ - - if (Config->get_show_solo_mutes()) { - if (_route->muted()) { - /* full mute */ - mute_button->set_visual_state (2); - } else if (_session.soloing() && !_route->soloed() && !_route->solo_isolated()) { - /* mute-because-not-soloed */ - mute_button->set_visual_state (1); - } else { - /* no mute at all */ - mute_button->set_visual_state (0); - } - } else { - if (_route->muted()) { - /* full mute */ - mute_button->set_visual_state (2); - } else { - /* no mute at all */ - mute_button->set_visual_state (0); - } - } - + mute_button->set_visual_state (mute_visual_state (_session, _route)); } void diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 53dd810541..ebc686b438 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -195,6 +195,9 @@ class RouteUI : public virtual AxisView void save_as_template (); void open_remote_control_id_dialog (); + static int solo_visual_state (boost::shared_ptr); + static int mute_visual_state (ARDOUR::Session &, boost::shared_ptr); + protected: std::vector connections; bool self_destruct; -- cgit v1.2.3