diff options
author | Ben Loftis <ben@glw.com> | 2010-04-26 21:47:58 +0000 |
---|---|---|
committer | Ben Loftis <ben@glw.com> | 2010-04-26 21:47:58 +0000 |
commit | 507f22c7cda1eac54cd2952fd50f188e722bf6eb (patch) | |
tree | d5fa4c346815b82f8415eeff1a8505f4333ac16f | |
parent | ed4970a20308b4a03bb0a96f8c6580a84312fb79 (diff) |
change automation track selection model slightly so that auto tracks are highlighted as expected. only show range boxes when the automation will actually get edited. clicking an automation track should show the editor-mixer for the parent track
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6997 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/editor_mixer.cc | 35 | ||||
-rw-r--r-- | gtk2_ardour/editor_selection.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.cc | 33 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.h | 3 |
4 files changed, 36 insertions, 41 deletions
diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc index 6d2a882091..d6fa49a132 100644 --- a/gtk2_ardour/editor_mixer.cc +++ b/gtk2_ardour/editor_mixer.cc @@ -30,6 +30,7 @@ #include "ardour_ui.h" #include "selection.h" #include "audio_time_axis.h" +#include "automation_time_axis.h" #include "actions.h" #include "i18n.h" @@ -162,13 +163,11 @@ Editor::create_editor_mixer () void Editor::set_selected_mixer_strip (TimeAxisView& view) { - AudioTimeAxisView* at; bool show = false; bool created; - if (!session || (at = dynamic_cast<AudioTimeAxisView*>(&view)) == 0) { + if (!session) return; - } Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer")); if (act) { @@ -186,9 +185,21 @@ Editor::set_selected_mixer_strip (TimeAxisView& view) created = false; } - /* might be nothing to do */ + //if this is an automation track then we should show the parent + boost::shared_ptr<ARDOUR::Route> route; + AutomationTimeAxisView *auto_tav; + if ( (auto_tav = dynamic_cast<AutomationTimeAxisView*>(&view)) == 0 ) { + AudioTimeAxisView* at = dynamic_cast<AudioTimeAxisView*>(&view); + if (at != NULL) + route = at->route(); + } else { + AudioTimeAxisView *parent = dynamic_cast<AudioTimeAxisView*>( view.get_parent() ); + if (parent != NULL) { + route = parent->route(); + } + } - if (current_mixer_strip->route() == at->route()) { + if (current_mixer_strip->route() == route) { return; } @@ -196,7 +207,7 @@ Editor::set_selected_mixer_strip (TimeAxisView& view) show = true; } - current_mixer_strip->set_route (at->route()); + current_mixer_strip->set_route (route); if (created) { current_mixer_strip->set_width (editor_mixer_strip_width, (void*) this); @@ -315,18 +326,6 @@ Editor::current_mixer_strip_removed () void Editor::current_mixer_strip_hidden () { - for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { - - AudioTimeAxisView* tmp; - - if ((tmp = dynamic_cast<AudioTimeAxisView*>(*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")); if (act) { Glib::RefPtr<Gtk::ToggleAction> tact = Glib::RefPtr<Gtk::ToggleAction>::cast_dynamic(act); diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index baaca99850..40f98b11e9 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -829,11 +829,7 @@ Editor::track_selection_changed () } for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { - if (find (selection->tracks.begin(), selection->tracks.end(), *i) != selection->tracks.end()) { - (*i)->set_selected (true); - } else { - (*i)->set_selected (false); - } + (*i)->set_selected ( *selection ); } ActionManager::set_sensitive (ActionManager::track_selection_sensitive_actions, !selection->tracks.empty()); diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index c0b6a697ad..14a30bab47 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -588,20 +588,32 @@ TimeAxisView::popup_size_menu (guint32 when) } void -TimeAxisView::set_selected (bool yn) +TimeAxisView::set_selected (Selection &selection) { - if (yn == _selected) { + //give children a chance to be selected + for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) { + (*i)->set_selected (selection); + } + + //determine if I am in the selection + bool selected = false; + if (find (selection.tracks.begin(), selection.tracks.end(), this) != selection.tracks.end()) { + selected = true; + } + + //bail out here if my state is unchanged + if (selected == _selected) { return; } - Selectable::set_selected (yn); + Selectable::set_selected (selected); if (_selected) { controls_ebox.set_name (controls_base_selected_name); controls_frame.set_name (controls_base_selected_name); controls_vbox.set_name (controls_base_selected_name); - /* propagate any existing selection, if the mode is right */ + /* propagate any existing selection, if the mode is right */ if (editor.current_mouse_mode() == Editing::MouseRange && !editor.get_selection().time.empty()) { show_selection (editor.get_selection().time); } @@ -611,15 +623,6 @@ TimeAxisView::set_selected (bool yn) controls_frame.set_name (controls_base_unselected_name); controls_vbox.set_name (controls_base_unselected_name); hide_selection (); - - /* children will be set for the yn=true case. but when deselecting - the editor only has a list of top-level trackviews, so we - have to do this here. - */ - - for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) { - (*i)->set_selected (false); - } } resizer.queue_draw (); @@ -693,10 +696,6 @@ TimeAxisView::show_selection (TimeSelection& ts) double y2; SelectionRect *rect; - for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) { - (*i)->show_selection (ts); - } - if (canvas_item_visible (selection_group)) { while (!used_selection_rects.empty()) { free_selection_rects.push_front (used_selection_rects.front()); diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index b624bda73a..86721a55e2 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -155,7 +155,7 @@ class TimeAxisView : public virtual AxisView, public Stateful virtual void hide (); bool hidden() const { return _hidden; } - virtual void set_selected (bool); + virtual void set_selected (Selection&); /** * potential handler for entered events @@ -225,6 +225,7 @@ class TimeAxisView : public virtual AxisView, public Stateful /* state/serialization management */ void set_parent (TimeAxisView& p); + TimeAxisView *get_parent () {return parent;} bool has_state () const; /* call this on the parent */ |