summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-07-06 21:40:29 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-07-06 21:40:29 -0400
commit44fcbd988ccb0f8dc8bdecc71bf8baf820e0bad4 (patch)
treebac53cc1d11ca0cf4ca0dd7a9b6f624bd3dfef07 /libs
parent77a8da9010320469d184a9e7e36957f9cb8880a5 (diff)
mackie: ensure that the strip where select was pressed ends up as the first_selected_stripable
Diffstat (limited to 'libs')
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.cc28
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.h7
-rw-r--r--libs/surfaces/mackie/strip.cc5
3 files changed, 27 insertions, 13 deletions
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc
index c1786756a4..224590aa54 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.cc
+++ b/libs/surfaces/mackie/mackie_control_protocol.cc
@@ -2027,13 +2027,13 @@ MackieControlProtocol::remove_down_select_button (int surface, int strip)
}
void
-MackieControlProtocol::select_range ()
+MackieControlProtocol::select_range (uint32_t pressed)
{
StripableList stripables;
- pull_stripable_range (_down_select_buttons, stripables);
+ pull_stripable_range (_down_select_buttons, stripables, pressed);
- DEBUG_TRACE (DEBUG::MackieControl, string_compose ("select range: found %1 stripables\n", stripables.size()));
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("select range: found %1 stripables, first = %2\n", stripables.size(), stripables.front()->name()));
if (stripables.empty()) {
return;
@@ -2093,7 +2093,7 @@ MackieControlProtocol::remove_down_button (AutomationType a, int surface, int st
}
MackieControlProtocol::ControlList
-MackieControlProtocol::down_controls (AutomationType p)
+MackieControlProtocol::down_controls (AutomationType p, uint32_t pressed)
{
ControlList controls;
StripableList stripables;
@@ -2107,7 +2107,7 @@ MackieControlProtocol::down_controls (AutomationType p)
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("looking for down buttons for %1, got %2\n",
p, m->second.size()));
- pull_stripable_range (m->second, stripables);
+ pull_stripable_range (m->second, stripables, pressed);
switch (p) {
case GainAutomation:
@@ -2150,7 +2150,7 @@ struct ButtonRangeSorter {
};
void
-MackieControlProtocol::pull_stripable_range (DownButtonList& down, StripableList& selected)
+MackieControlProtocol::pull_stripable_range (DownButtonList& down, StripableList& selected, uint32_t pressed)
{
ButtonRangeSorter cmp;
@@ -2200,13 +2200,19 @@ MackieControlProtocol::pull_stripable_range (DownButtonList& down, StripableList
(*s)->number(), fs, ls));
for (uint32_t n = fs; n < ls; ++n) {
- boost::shared_ptr<Stripable> r = (*s)->nth_strip (n)->stripable();
+ Strip* strip = (*s)->nth_strip (n);
+ boost::shared_ptr<Stripable> r = strip->stripable();
if (r) {
- selected.push_back (r);
+ if (global_index_locked (*strip) == pressed) {
+ selected.push_front (r);
+ } else {
+ selected.push_back (r);
+ }
}
}
}
}
+
}
void
@@ -2415,6 +2421,12 @@ uint32_t
MackieControlProtocol::global_index (Strip& strip)
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
+ return global_index_locked (strip);
+}
+
+uint32_t
+MackieControlProtocol::global_index_locked (Strip& strip)
+{
uint32_t global = 0;
for (Surfaces::const_iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h
index 56ead71b50..8d63162ffc 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.h
+++ b/libs/surfaces/mackie/mackie_control_protocol.h
@@ -170,6 +170,7 @@ class MackieControlProtocol
boost::shared_ptr<Mackie::Surface> nth_surface (uint32_t) const;
uint32_t global_index (Mackie::Strip&);
+ uint32_t global_index_locked (Mackie::Strip&);
std::list<boost::shared_ptr<ARDOUR::Bundle> > bundles ();
@@ -228,11 +229,11 @@ class MackieControlProtocol
void add_down_button (ARDOUR::AutomationType, int surface, int strip);
void remove_down_button (ARDOUR::AutomationType, int surface, int strip);
- ControlList down_controls (ARDOUR::AutomationType);
+ ControlList down_controls (ARDOUR::AutomationType, uint32_t pressed);
void add_down_select_button (int surface, int strip);
void remove_down_select_button (int surface, int strip);
- void select_range ();
+ void select_range (uint32_t pressed);
int16_t ipmidi_base() const { return _ipmidi_base; }
void set_ipmidi_base (int16_t);
@@ -378,7 +379,7 @@ class MackieControlProtocol
DownButtonMap _down_buttons;
DownButtonList _down_select_buttons;
- void pull_stripable_range (DownButtonList&, ARDOUR::StripableList&);
+ void pull_stripable_range (DownButtonList&, ARDOUR::StripableList&, uint32_t pressed);
/* implemented button handlers */
Mackie::LedState stop_press(Mackie::Button &);
diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc
index 08f4b489c6..1c2fe8d1b9 100644
--- a/libs/surfaces/mackie/strip.cc
+++ b/libs/surfaces/mackie/strip.cc
@@ -683,7 +683,7 @@ Strip::select_event (Button&, ButtonState bs)
DEBUG_TRACE (DEBUG::MackieControl, "add select button on press\n");
_surface->mcp().add_down_select_button (_surface->number(), _index);
- _surface->mcp().select_range ();
+ _surface->mcp().select_range (_surface->mcp().global_index (*this));
} else {
DEBUG_TRACE (DEBUG::MackieControl, "remove select button on release\n");
@@ -882,7 +882,8 @@ Strip::handle_button (Button& button, ButtonState bs)
* several down buttons
*/
- MackieControlProtocol::ControlList controls = _surface->mcp().down_controls ((AutomationType) control->parameter().type());
+ MackieControlProtocol::ControlList controls = _surface->mcp().down_controls ((AutomationType) control->parameter().type(),
+ _surface->mcp().global_index(*this));
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("there are %1 buttons down for control type %2, new value = %3\n",