From 2f9800638c897f7f2d0eb18198e7a84c0821f52a Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 11 Mar 2009 17:57:18 +0000 Subject: [PATCH] final (?) fix for editor mixer strip handling when route is removed git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4791 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_route_list.cc | 9 +-------- gtk2_ardour/mixer_strip.cc | 18 +++++++++++++----- gtk2_ardour/route_ui.cc | 9 +++++++-- gtk2_ardour/route_ui.h | 2 ++ 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc index d889348ef7..5a901db6c6 100644 --- a/gtk2_ardour/editor_route_list.cc +++ b/gtk2_ardour/editor_route_list.cc @@ -82,7 +82,6 @@ Editor::handle_new_route (Session::RouteList& routes) } route->gui_changed.connect (mem_fun(*this, &Editor::handle_gui_changes)); - cerr << "Connect to GA for " << tv << " named " << tv->name() << endl; tv->GoingAway.connect (bind (mem_fun(*this, &Editor::remove_route), tv)); } @@ -160,21 +159,15 @@ Editor::remove_route (TimeAxisView *tv) if (current_mixer_strip->route() == route) { - cerr << "CMS is the one being deleted\n"; - if (next_tv) { - cerr << "move to " << next_tv->name() << endl; set_selected_mixer_strip (*next_tv); } else { - cerr << "no next TV, hide editor mixer strip\n"; - /* make the editor mixer strip go away setting the + /* make the editor mixer strip go away by setting the * button to inactive (which also unticks the menu option) */ ActionManager::uncheck_toggleaction ("/Editor/show-editor-mixer"); } - } else { - cerr << "CMS differs from the deleted one\n"; } } diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index b3a73010b1..7287e6fb16 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -102,6 +102,14 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, bool in_mixer) { init (); + + if (!_mixer_owned) { + /* the editor mixer strip: don't destroy it every time + the underlying route goes away. + */ + + self_destruct = false; + } } MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr rt, bool in_mixer) @@ -1177,16 +1185,16 @@ MixerStrip::width_clicked () void MixerStrip::hide_clicked () { - // LAME fix to reset the button status for when it is redisplayed (part 1) - hide_button.set_sensitive(false); - + // LAME fix to reset the button status for when it is redisplayed (part 1) + hide_button.set_sensitive(false); + if (_embedded) { - Hiding(); /* EMIT_SIGNAL */ + Hiding(); /* EMIT_SIGNAL */ } else { _mixer.hide_strip (this); } - // (part 2) + // (part 2) hide_button.set_sensitive(true); } diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index c45aed5c6c..6cbb5290d4 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -70,6 +70,7 @@ RouteUI::RouteUI (boost::shared_ptr rt, void RouteUI::init () { + self_destruct = true; xml_node = 0; mute_menu = 0; solo_menu = 0; @@ -149,7 +150,9 @@ RouteUI::set_route (boost::shared_ptr rp) up when the route is destroyed. */ - new PairedShiva (*_route, *this); + if (self_destruct) { + new PairedShiva (*_route, *this); + } mute_button->set_controllable (&_route->mute_control()); mute_button->set_label (m_name); @@ -189,7 +192,9 @@ RouteUI::set_route (boost::shared_ptr rp) RouteUI::~RouteUI() { - GoingAway (); /* EMIT SIGNAL */ + /* derived classes should emit GoingAway so that they receive the signal + when the object is still a legal derived instance. + */ if (solo_menu) { delete solo_menu; diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index a4bfda2d8e..f58c8f4fe9 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -170,6 +170,8 @@ class RouteUI : public virtual AxisView std::string m_name; std::string r_name; + bool self_destruct; + void init (); void reset (); -- 2.30.2