summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/editor.h1
-rw-r--r--gtk2_ardour/editor_mixer.cc26
-rw-r--r--gtk2_ardour/editor_route_list.cc48
3 files changed, 42 insertions, 33 deletions
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 5f18d36e67..96c1d1004d 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -1877,6 +1877,7 @@ class Editor : public PublicEditor
MixerStrip *current_mixer_strip;
bool show_editor_mixer_when_tracks_arrive;
Gtk::VBox current_mixer_strip_vbox;
+ void cms_new (boost::shared_ptr<ARDOUR::Route>);
void cms_deleted ();
void current_mixer_strip_hidden ();
void current_mixer_strip_removed ();
diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc
index dee928b62f..669297b6e4 100644
--- a/gtk2_ardour/editor_mixer.cc
+++ b/gtk2_ardour/editor_mixer.cc
@@ -58,6 +58,13 @@ Editor::editor_list_button_toggled ()
}
void
+Editor::cms_new (boost::shared_ptr<ARDOUR::Route> r)
+{
+ current_mixer_strip = new MixerStrip (*ARDOUR_UI::instance()->the_mixer(), *session, r);
+ current_mixer_strip->GoingAway.connect (mem_fun (*this, &Editor::cms_deleted));
+}
+
+void
Editor::cms_deleted ()
{
current_mixer_strip = 0;
@@ -83,12 +90,7 @@ Editor::show_editor_mixer (bool yn)
AudioTimeAxisView* atv;
if ((atv = dynamic_cast<AudioTimeAxisView*> (*i)) != 0) {
-
- current_mixer_strip = new MixerStrip (*ARDOUR_UI::instance()->the_mixer(),
- *session,
- atv->route(), false);
-
- current_mixer_strip->GoingAway.connect (mem_fun(*this, &Editor::cms_deleted));
+ cms_new (atv->route ());
break;
}
}
@@ -101,11 +103,7 @@ Editor::show_editor_mixer (bool yn)
AudioTimeAxisView* atv;
if ((atv = dynamic_cast<AudioTimeAxisView*> (*i)) != 0) {
-
- current_mixer_strip = new MixerStrip (*ARDOUR_UI::instance()->the_mixer(),
- *session,
- atv->route(), false);
- current_mixer_strip->GoingAway.connect (mem_fun(*this, &Editor::cms_deleted));
+ cms_new (atv->route ());
break;
}
}
@@ -175,10 +173,7 @@ Editor::set_selected_mixer_strip (TimeAxisView& view)
current_mixer_strip = 0;
}
- current_mixer_strip = new MixerStrip (*ARDOUR_UI::instance()->the_mixer(),
- *session,
- rt->route());
- current_mixer_strip->GoingAway.connect (mem_fun(*this, &Editor::cms_deleted));
+ cms_new (rt->route ());
if (show) {
show_editor_mixer (true);
@@ -390,3 +385,4 @@ Editor::maybe_add_mixer_strip_width (XMLNode& node)
node.add_property ("mixer-width", enum_2_string (current_mixer_strip->get_width()));
}
}
+
diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc
index 5e10a578f5..e941b4c1ce 100644
--- a/gtk2_ardour/editor_route_list.cc
+++ b/gtk2_ardour/editor_route_list.cc
@@ -155,13 +155,40 @@ Editor::remove_route (TimeAxisView *tv)
{
ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::remove_route), tv));
-
- TrackViewList::iterator i;
TreeModel::Children rows = route_display_model->children();
TreeModel::Children::iterator ri;
- if ((i = find (track_views.begin(), track_views.end(), tv)) != track_views.end()) {
+ /* find the track view that's being deleted */
+ TrackViewList::iterator i = find (track_views.begin(), track_views.end(), tv);
+
+ /* set up `nearby' to be a suitable nearby track to select once
+ this one has gong */
+ TrackViewList::iterator nearby = track_views.end ();
+ if (i != track_views.end()) {
+
+ nearby = i;
+
+ if (nearby != track_views.begin()) {
+ /* go to the previous track if there is one */
+ nearby--;
+ } else {
+ /* otherwise the next track */
+ nearby++;
+ }
+
+ /* and remove the track view that's going */
track_views.erase (i);
+
+ if (nearby != track_views.end()) {
+ /* we've got another track to select, so select it */
+ set_selected_track (**nearby, Selection::Set);
+ } else {
+ /* we've got no other track, so the editor mixer will disappear */
+ editor_mixer_button.set_active (false);
+ ActionManager::uncheck_toggleaction ("<Actions>/Editor/show-editor-mixer");
+ editor_mixer_button.set_sensitive (false);
+ editor_list_button.set_sensitive (false);
+ }
}
for (ri = rows.begin(); ri != rows.end(); ++ri) {
@@ -170,21 +197,6 @@ Editor::remove_route (TimeAxisView *tv)
break;
}
}
- /* since the editor mixer goes away when you remove a route, set the
- * button to inactive and untick the menu option
- */
- editor_mixer_button.set_active(false);
- ActionManager::uncheck_toggleaction ("<Actions>/Editor/show-editor-mixer");
-
- /* and disable if all tracks and/or routes are gone */
-
- if (track_views.size() == 0) {
- editor_mixer_button.set_sensitive(false);
-
- editor_list_button.set_active(false);
- ActionManager::uncheck_toggleaction ("<Actions>/Editor/show-editor-list");
- editor_list_button.set_sensitive(false);
- }
}
void