use, or mostly use PresentationInfo for selection status of Routes.
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 6 Jun 2016 00:50:40 +0000 (20:50 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 6 Jun 2016 00:50:57 +0000 (20:50 -0400)
Needs extension to Surfaces, replacing GuiSelectionChanged signal concept

gtk2_ardour/axis_view.h
gtk2_ardour/meter_strip.h
gtk2_ardour/mixer_strip.cc
gtk2_ardour/mixer_strip.h
gtk2_ardour/mixer_ui.cc
gtk2_ardour/monitor_section.cc
gtk2_ardour/route_time_axis.cc
gtk2_ardour/route_ui.cc
gtk2_ardour/route_ui.h
gtk2_ardour/time_axis_view.cc
gtk2_ardour/time_axis_view.h

index 7a2a0fb07960136b9cf9bdeda45865eb61949460..bc16aed06b7ce58b68d29957e8c69f131134be21 100644 (file)
@@ -43,7 +43,7 @@ namespace ARDOUR {
  * AxisView defines the abstract base class for time-axis trackviews and routes.
  *
  */
-class AxisView : public virtual Selectable, public virtual PBD::ScopedConnectionList, public virtual ARDOUR::SessionHandlePtr
+class AxisView : public virtual PBD::ScopedConnectionList, public virtual ARDOUR::SessionHandlePtr, public virtual Selectable
 {
   public:
        ARDOUR::Session* session() const { return _session; }
@@ -97,4 +97,3 @@ class AxisView : public virtual Selectable, public virtual PBD::ScopedConnection
 }; /* class AxisView */
 
 #endif /* __ardour_gtk_axis_view_h__ */
-
index 2f0924e9091cc913f11230a9379518c529fdfa82..00a2c4089d8a2897ad2bbf3f02ce3bcb6751cee7 100644 (file)
@@ -75,6 +75,8 @@ class MeterStrip : public Gtk::VBox, public AxisView, public RouteUI
        bool is_metric_display() { return _strip_type == 0; }
        ARDOUR::MeterType meter_type();
 
+       bool selected() const { return false; }
+
   protected:
        boost::shared_ptr<ARDOUR::Route> _route;
        PBD::ScopedConnectionList meter_route_connections;
index 30859c8d5e8472678bf6b3165bbec32c9f89e5b3..ada9730b3b285b01c968cde52f92d82750d3fd77 100644 (file)
@@ -1732,16 +1732,16 @@ MixerStrip::list_route_operations ()
 }
 
 void
-MixerStrip::set_selected (bool yn)
+MixerStrip::show_selected ()
 {
-       AxisView::set_selected (yn);
-       if (_selected) {
+       if (selected()) {
                global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
                global_frame.set_name ("MixerStripSelectedFrame");
        } else {
                global_frame.set_shadow_type (Gtk::SHADOW_IN);
                global_frame.set_name ("MixerStripFrame");
        }
+
        global_frame.queue_draw ();
 
 //     if (!yn)
@@ -2623,16 +2623,6 @@ MixerStrip::update_track_number_visibility ()
        }
 }
 
-bool
-MixerStrip::is_selected () const
-{
-       if (!_route) {
-               return false;
-       }
-
-       return _route->presentation_info().selected();
-}
-
 Gdk::Color
 MixerStrip::color () const
 {
@@ -2650,4 +2640,3 @@ MixerStrip::set_marked_for_display (bool yn)
 {
        return RouteUI::mark_hidden (!yn);
 }
-
index 369f634033f3b76258c890141bbf6ef6b7cca81c..408315dbb5b5ad83a7904e231f3e0bdea2549d55 100644 (file)
@@ -140,8 +140,7 @@ class MixerStrip : public AxisView, public RouteUI, public Gtk::EventBox
        void vca_assign (boost::shared_ptr<ARDOUR::VCA>);
        void vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
 
-       void set_selected (bool yn);
-       bool is_selected() const;
+       void show_selected ();
 
        static MixerStrip* entered_mixer_strip() { return _entered_mixer_strip; }
 
index 55bfbf8589ac0959369c412b5aa36213266eab0d..776e711fbd4f496e2472695024ed1baf439d1943 100644 (file)
@@ -815,53 +815,49 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip)
                                _selection.add (strip);
                        } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::RangeSelectModifier)) {
 
-                               if (!_selection.selected(strip)) {
-
-                                       /* extend selection */
-
-                                       vector<MixerStrip*> tmp;
-                                       bool accumulate = false;
-                                       bool found_another = false;
-
-                                       tmp.push_back (strip);
-
-                                       for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
-                                               if ((*i) == strip) {
-                                                       /* hit clicked strip, start accumulating till we hit the first
-                                                          selected strip
-                                                       */
-                                                       if (accumulate) {
-                                                               /* done */
-                                                               break;
-                                                       } else {
-                                                               accumulate = true;
-                                                       }
-                                               } else if (_selection.selected (*i)) {
-                                                       /* hit selected strip. if currently accumulating others,
-                                                          we're done. if not accumulating others, start doing so.
-                                                       */
-                                                       found_another = true;
-                                                       if (accumulate) {
-                                                               /* done */
-                                                               break;
-                                                       } else {
-                                                               accumulate = true;
-                                                       }
+                               /* extend selection */
+
+                               vector<MixerStrip*> tmp;
+                               bool accumulate = false;
+                               bool found_another = false;
+
+                               tmp.push_back (strip);
+
+                               for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
+                                       if ((*i) == strip) {
+                                               /* hit clicked strip, start accumulating till we hit the first
+                                                  selected strip
+                                               */
+                                               if (accumulate) {
+                                                       /* done */
+                                                       break;
                                                } else {
-                                                       if (accumulate) {
-                                                               tmp.push_back (*i);
-                                                       }
+                                                       accumulate = true;
                                                }
-                                       }
-
-                                       if (found_another) {
-                                               for (vector<MixerStrip*>::iterator i = tmp.begin(); i != tmp.end(); ++i) {
-                                                       _selection.add (*i);
+                                       } else if (_selection.selected (*i)) {
+                                               /* hit selected strip. if currently accumulating others,
+                                                  we're done. if not accumulating others, start doing so.
+                                               */
+                                               found_another = true;
+                                               if (accumulate) {
+                                                       /* done */
+                                                       break;
+                                               } else {
+                                                       accumulate = true;
+                                               }
+                                       } else {
+                                               if (accumulate) {
+                                                       tmp.push_back (*i);
                                                }
-                                       } else
-                                               _selection.set (strip);  //user wants to start a range selection, but there aren't any others selected yet
+                                       }
                                }
 
+                               if (found_another) {
+                                       for (vector<MixerStrip*>::iterator i = tmp.begin(); i != tmp.end(); ++i) {
+                                               _selection.add (*i);
+                                       }
+                               } else
+                                       _selection.set (strip);  //user wants to start a range selection, but there aren't any others selected yet
                        } else {
                                _selection.set (strip);
                        }
index 4399c8a3644526555e10b8f399e58638c0436cf9..eb131a7d3c9731066dfb2c9d4a40c30c3fa185fd 100644 (file)
@@ -1701,3 +1701,4 @@ MonitorSection::processors_changed (ARDOUR::RouteProcessorChange)
 {
        update_processor_box ();
 }
+
index f8a87245ae861ea0da494d0b8e45c0e20b7b6021..d3b28bd04218b28b9d3d170cb420a9dc9d5ffa88 100644 (file)
@@ -2950,3 +2950,4 @@ RouteTimeAxisView::set_marked_for_display (bool yn)
 {
        return RouteUI::mark_hidden (!yn);
 }
+
index c6a1677cc0e0c552b5ca8c97175c929d7b39d8ab..3cb96c29f4a70e1eaaf15e2e6e705d2c17bd27fe 100644 (file)
@@ -2172,6 +2172,33 @@ RouteUI::route_gui_changed (PropertyChange const& what_changed)
                        route_color_changed ();
                }
        }
+
+       if (what_changed.contains (Properties::selected)) {
+               show_selected ();
+       }
+}
+
+void
+RouteUI::set_selected (bool yn)
+{
+       Selectable::set_selected (yn);
+       if (_route) {
+               _route->presentation_info().set_selected (yn);
+       }
+}
+
+bool
+RouteUI::selected () const
+{
+       /* XXX not sure if this is a wise design. Probably don't really want
+        * the cached _selected value from Selectable.
+        */
+
+       if (!_route) {
+               return _selected;
+       }
+
+       return _route->presentation_info().selected();
 }
 
 void
@@ -2322,12 +2349,6 @@ RouteUI::manage_pins ()
        }
 }
 
-void
-RouteUI::set_selected (bool yn)
-{
-       _route->presentation_info().set_selected (yn);
-}
-
 bool
 RouteUI::mark_hidden (bool yn)
 {
index aedea7380b2d1296efe607bb3e5ed2b9c8c72a04..d8e50ed8c26ef5ab43909ff30961f4b877d6769a 100644 (file)
@@ -73,7 +73,7 @@ class RoutePinWindowProxy : public WM::ProxyBase
        PBD::ScopedConnection going_away_connection;
 };
 
-class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual sigc::trackable, public virtual PBD::ScopedConnectionList
+class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual Selectable, public virtual PBD::ScopedConnectionList
 {
   public:
        RouteUI (ARDOUR::Session*);
@@ -105,6 +105,7 @@ class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual sigc::tr
        Gdk::Color route_color () const;
        void choose_color ();
 
+       bool selected () const;
        void set_selected (bool);
 
        bool ignore_toggle;
@@ -307,7 +308,7 @@ class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual sigc::tr
 
        std::string route_state_id () const;
 
-protected:
+  protected:
        struct SoloMuteRelease {
            SoloMuteRelease (bool was_active)
            : active (was_active)
index 4885c58b547589570487f62799277f6b6769916d..de8c17f4566898a0ca91eda9458efccc075b134e 100644 (file)
@@ -742,22 +742,9 @@ TimeAxisView::popup_display_menu (guint32 when)
 }
 
 void
-TimeAxisView::set_selected (bool yn)
+TimeAxisView::show_selected ()
 {
-#if 0
-       /* end any name edit in progress */
-       if (can_edit_name()) {
-               end_name_edit (string(), 0);
-       }
-#endif
-
-       if (yn == _selected) {
-               return;
-       }
-
-       Selectable::set_selected (yn);
-
-       if (_selected) {
+       if (selected()) {
                time_axis_frame.set_shadow_type (Gtk::SHADOW_IN);
                time_axis_frame.set_name ("MixerStripSelectedFrame");
                controls_ebox.set_name (controls_base_selected_name);
@@ -783,7 +770,6 @@ TimeAxisView::set_selected (bool yn)
        }
 
        time_axis_frame.show();
-
 }
 
 void
index 9ab2d3596b0e044ed91a7a598c8cf67cd3815715..1920d668a72e40f7b25f3b698bdbeb20a8720c43 100644 (file)
@@ -139,7 +139,6 @@ class TimeAxisView : public virtual AxisView
        /** @return true if hidden, otherwise false */
        bool hidden () const { return _hidden; }
 
-       void set_selected (bool);
        virtual bool selectable() const { return true; }
 
        /**
@@ -307,7 +306,10 @@ class TimeAxisView : public virtual AxisView
 
        void build_size_menu ();
 
-private:
+  protected:
+       void show_selected ();
+
+  private:
        Gtk::VBox*            control_parent;
        int                  _order;
        uint32_t             _effective_height;