Properly propagate TAV TimeSelection
authorRobin Gareus <robin@gareus.org>
Fri, 21 Jul 2017 13:49:28 +0000 (15:49 +0200)
committerRobin Gareus <robin@gareus.org>
Fri, 21 Jul 2017 13:49:28 +0000 (15:49 +0200)
gtk2_ardour/automation_time_axis.cc
gtk2_ardour/automation_time_axis.h
gtk2_ardour/midi_time_axis.cc
gtk2_ardour/time_axis_view.cc
gtk2_ardour/time_axis_view.h

index 39a312da4b0edaf19fcd29959004b77b6a1d89bd..724809d446e7686688da8a317d72fd0dde769902 100644 (file)
@@ -889,6 +889,19 @@ AutomationTimeAxisView::add_line (boost::shared_ptr<AutomationLine> line)
        line->add_visibility (AutomationLine::Line);
 }
 
+bool
+AutomationTimeAxisView::propagate_time_selection () const
+{
+       /* MIDI automation is part of the MIDI region. It is always
+        * implicily selected with the parent, regardless of TAV selection
+        */
+       if (_parameter.type() >= MidiCCAutomation &&
+           _parameter.type() <= MidiChannelPressureAutomation) {
+               return true;
+       }
+       return false;
+}
+
 void
 AutomationTimeAxisView::entered()
 {
index 573d88a4d5e7e3ff760d978ee5d67aa0046bc6ae..84d2d528c32f908dbb8ed6355ef330c8c633a026 100644 (file)
@@ -189,6 +189,8 @@ protected:
        bool ignore_state_request;
        bool ignore_mode_request;
 
+       bool propagate_time_selection () const;
+
        void automation_state_changed ();
 
        void set_interpolation (ARDOUR::AutomationList::InterpolationStyle);
index 7bd7141c4e6353a86f626bd693841d33a0a57d68..ffff6a96981a7b0e2aea69c6a7eaba673c1b0f43 100644 (file)
@@ -1324,6 +1324,10 @@ MidiTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool
                }
 
                add_automation_child (param, track, show);
+               if (selected ()) {
+                       reshow_selection (_editor.get_selection().time);
+               }
+
                break;
 
        case PanWidthAutomation:
index 58c9d44bc52c99302b613ba325dc111d687561c9..b03a0c03bd3c4585f8898455fd1ff9ab20565176 100644 (file)
@@ -822,6 +822,9 @@ TimeAxisView::show_selection (TimeSelection& ts)
 
 
        for (Children::iterator i = children.begin(); i != children.end(); ++i) {
+               if (!(*i)->selected () && !(*i)->propagate_time_selection ()) {
+                       continue;
+               }
                (*i)->show_selection (ts);
        }
 
@@ -879,6 +882,9 @@ TimeAxisView::reshow_selection (TimeSelection& ts)
        show_selection (ts);
 
        for (Children::iterator i = children.begin(); i != children.end(); ++i) {
+               if (!(*i)->selected () && !(*i)->propagate_time_selection ()) {
+                       continue;
+               }
                (*i)->show_selection (ts);
        }
 }
index 0b3c6ea722482f43c9ee45416b60818a8addbbe3..ac67169a7ead40f4a4579f22206c4d5a84cc5921 100644 (file)
@@ -289,6 +289,7 @@ class TimeAxisView : public virtual AxisView
 
        Children children;
        bool is_child (TimeAxisView*);
+       virtual bool propagate_time_selection () const { return false; }
 
        virtual void remove_child (boost::shared_ptr<TimeAxisView>);
        void add_child (boost::shared_ptr<TimeAxisView>);