13
0

mackie: ensure that the strip where select was pressed ends up as the first_selected_stripable

This commit is contained in:
Paul Davis 2016-07-06 21:40:29 -04:00
parent 77a8da9010
commit 44fcbd988c
3 changed files with 27 additions and 13 deletions

View File

@ -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) {

View File

@ -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 &);

View File

@ -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",