version of 6997 from 2.x: if selecting an automation track, show its parent in the editor mixer strip, plus don't deselect a track when the editor mixer strip is hidden

git-svn-id: svn://localhost/ardour2/branches/3.0@7660 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2010-08-20 21:34:18 +00:00
parent da4dee659b
commit c2e491b8fc
2 changed files with 49 additions and 32 deletions

View File

@ -23,16 +23,18 @@
#include "pbd/enumwriter.h"
#include "editor.h"
#include "mixer_strip.h"
#include "ardour_ui.h"
#include "selection.h"
#include "audio_time_axis.h"
#include "actions.h"
#include "ardour_ui.h"
#include "audio_time_axis.h"
#include "automation_time_axis.h"
#include "editor.h"
#include "editor_routes.h"
#include "editor_route_groups.h"
#include "editor_regions.h"
#include "gui_thread.h"
#include "midi_time_axis.h"
#include "mixer_strip.h"
#include "selection.h"
#include "i18n.h"
@ -160,9 +162,7 @@ Editor::create_editor_mixer ()
void
Editor::set_selected_mixer_strip (TimeAxisView& view)
{
RouteTimeAxisView* at;
if (!_session || (at = dynamic_cast<RouteTimeAxisView*>(&view)) == 0) {
if (!_session) {
return;
}
@ -180,32 +180,49 @@ Editor::set_selected_mixer_strip (TimeAxisView& view)
create_editor_mixer ();
}
/* might be nothing to do */
if (current_mixer_strip->route() == at->route()) {
// if this is an automation track, then we shold the mixer strip should
// show the parent
boost::shared_ptr<ARDOUR::Route> route;
AutomationTimeAxisView* atv;
if ((atv = dynamic_cast<AutomationTimeAxisView*>(&view)) != 0) {
AudioTimeAxisView *parent = dynamic_cast<AudioTimeAxisView*>(view.get_parent());
if (parent) {
route = parent->route ();
}
} else {
AudioTimeAxisView* at = dynamic_cast<AudioTimeAxisView*> (&view);
if (at) {
route = at->route();
} else {
MidiTimeAxisView* mt = dynamic_cast<MidiTimeAxisView*> (&view);
if (mt) {
route = mt->route();
}
}
}
if (current_mixer_strip->route() == route) {
return;
}
current_mixer_strip->set_route (at->route());
current_mixer_strip->set_width_enum (editor_mixer_strip_width, (void*) this);
if (route) {
current_mixer_strip->set_route (route);
current_mixer_strip->set_width_enum (editor_mixer_strip_width, (void*) this);
}
}
void
Editor::current_mixer_strip_hidden ()
{
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
RouteTimeAxisView* tmp;
if ((tmp = dynamic_cast<RouteTimeAxisView*>(*i)) != 0) {
if (tmp->route() == current_mixer_strip->route()) {
(*i)->set_selected (false);
break;
}
}
}
Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
if (act) {
Glib::RefPtr<Gtk::ToggleAction> tact = Glib::RefPtr<Gtk::ToggleAction>::cast_dynamic(act);
tact->set_active (false);

View File

@ -797,13 +797,13 @@ Editor::track_selection_changed ()
}
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
(*i)->set_selected (find (selection->tracks.begin(), selection->tracks.end(), *i) != selection->tracks.end());
TimeAxisView::Children c = (*i)->get_child_list ();
for (TimeAxisView::Children::iterator j = c.begin(); j != c.end(); ++j) {
(*j)->set_selected (find (selection->tracks.begin(), selection->tracks.end(), j->get()) != selection->tracks.end());
}
}
(*i)->set_selected (find (selection->tracks.begin(), selection->tracks.end(), *i) != selection->tracks.end());
TimeAxisView::Children c = (*i)->get_child_list ();
for (TimeAxisView::Children::iterator j = c.begin(); j != c.end(); ++j) {
(*j)->set_selected (find (selection->tracks.begin(), selection->tracks.end(), j->get()) != selection->tracks.end());
}
}
ActionManager::set_sensitive (ActionManager::track_selection_sensitive_actions, !selection->tracks.empty());
}