mackie: catch data on what presentation info aspects changed; don't change banks...
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 1 Feb 2017 09:27:13 +0000 (10:27 +0100)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 1 Feb 2017 09:27:34 +0000 (10:27 +0100)
libs/surfaces/mackie/mackie_control_protocol.cc
libs/surfaces/mackie/mackie_control_protocol.h

index 3038685f27cc9869560dcb0a877fc6ba2a1b92c8..2a5d710eafe52d968abe591b808b64f8342d14a4 100644 (file)
@@ -138,7 +138,7 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
                _last_bank[i] = 0;
        }
 
-       PresentationInfo::Change.connect (gui_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_presentation_info_changed, this), this);
+       PresentationInfo::Change.connect (gui_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_presentation_info_changed, this, _1), this);
 
        _instance = this;
 
@@ -1298,8 +1298,17 @@ MackieControlProtocol::notify_solo_active_changed (bool active)
 }
 
 void
-MackieControlProtocol::notify_presentation_info_changed ()
+MackieControlProtocol::notify_presentation_info_changed (PBD::PropertyChange const & what_changed)
 {
+       PBD::PropertyChange order_or_hidden;
+
+       order_or_hidden.add (Properties::hidden);
+       order_or_hidden.add (Properties::order);
+
+       if (!what_changed.contains (order_or_hidden)) {
+               return;
+       }
+
        {
                Glib::Threads::Mutex::Lock lm (surfaces_lock);
 
@@ -1308,23 +1317,7 @@ MackieControlProtocol::notify_presentation_info_changed ()
                }
        }
 
-       Sorted sorted = get_sorted_stripables();
-       uint32_t sz = n_strips();
-
-       // if a remote id has been moved off the end, we need to shift
-       // the current bank backwards.
-
-       if (sorted.size() - _current_initial_bank < sz) {
-               // but don't shift backwards past the zeroth channel
-               if (sorted.size() < sz) {  // avoid unsigned math mistake below
-                       (void) switch_banks(0, true);
-               } else {
-                       (void) switch_banks (max((Sorted::size_type) 0, sorted.size() - sz), true);
-               }
-       } else {
-               // Otherwise just refresh the current bank
-               refresh_current_bank();
-       }
+       refresh_current_bank();
 }
 
 ///////////////////////////////////////////
index 8d63162ffcea806fe8ac278dbe4993be51891111..943ccf0850995b808b129e606860b9509029f59b 100644 (file)
@@ -190,7 +190,7 @@ class MackieControlProtocol
        void notify_routes_added (ARDOUR::RouteList &);
        void notify_vca_added (ARDOUR::VCAList &);
 
-       void notify_presentation_info_changed();
+       void notify_presentation_info_changed(PBD::PropertyChange const &);
 
        void recalibrate_faders ();
        void toggle_backlight ();