13
0

Select another track when one is deleted, thereby allowing the editor mixer to stick around if it's displayed. Should fix #1542.

git-svn-id: svn://localhost/ardour2/trunk@2588 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2007-11-04 23:18:15 +00:00
parent 39bdbf5db9
commit 5bf892728c
3 changed files with 42 additions and 33 deletions

View File

@ -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 ();

View File

@ -57,6 +57,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 ()
{
@ -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()));
}
}

View File

@ -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