change zoom and scrub handling to use modifier bits
This commit is contained in:
parent
d28c8c9bb4
commit
a4fced6d63
@ -84,6 +84,12 @@ const int MackieControlProtocol::MODIFIER_OPTION = 0x1;
|
||||
const int MackieControlProtocol::MODIFIER_CONTROL = 0x2;
|
||||
const int MackieControlProtocol::MODIFIER_SHIFT = 0x4;
|
||||
const int MackieControlProtocol::MODIFIER_CMDALT = 0x8;
|
||||
const int MackieControlProtocol::MODIFIER_ZOOM = 0x10;
|
||||
const int MackieControlProtocol::MODIFIER_SCRUB = 0x20;
|
||||
const int MackieControlProtocol::MAIN_MODIFIER_MASK = (MackieControlProtocol::MODIFIER_OPTION|
|
||||
MackieControlProtocol::MODIFIER_CONTROL|
|
||||
MackieControlProtocol::MODIFIER_SHIFT|
|
||||
MackieControlProtocol::MODIFIER_CMDALT);
|
||||
|
||||
MackieControlProtocol* MackieControlProtocol::_instance = 0;
|
||||
|
||||
@ -98,7 +104,6 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
|
||||
, _current_initial_bank (0)
|
||||
, _timecode_type (ARDOUR::AnyTime::BBT)
|
||||
, _gui (0)
|
||||
, _zoom_mode (false)
|
||||
, _scrub_mode (false)
|
||||
, _flip_mode (Normal)
|
||||
, _view_mode (Mixer)
|
||||
@ -1465,7 +1470,7 @@ MackieControlProtocol::select_range ()
|
||||
if (!routes.empty()) {
|
||||
for (RouteList::iterator r = routes.begin(); r != routes.end(); ++r) {
|
||||
|
||||
if (_modifier_state == MODIFIER_CONTROL) {
|
||||
if (main_modifier_state() == MODIFIER_CONTROL) {
|
||||
ToggleRouteSelection ((*r)->remote_control_id ());
|
||||
} else {
|
||||
if (r == routes.begin()) {
|
||||
|
@ -96,6 +96,9 @@ class MackieControlProtocol
|
||||
static const int MODIFIER_CONTROL;
|
||||
static const int MODIFIER_SHIFT;
|
||||
static const int MODIFIER_CMDALT;
|
||||
static const int MODIFIER_ZOOM;
|
||||
static const int MODIFIER_SCRUB;
|
||||
static const int MAIN_MODIFIER_MASK;
|
||||
|
||||
enum ViewMode {
|
||||
Mixer,
|
||||
@ -132,7 +135,7 @@ class MackieControlProtocol
|
||||
|
||||
FlipMode flip_mode () const { return _flip_mode; }
|
||||
ViewMode view_mode () const { return _view_mode; }
|
||||
bool zoom_mode () const { return _zoom_mode; }
|
||||
bool zoom_mode () const { return modifier_state() & MODIFIER_ZOOM; }
|
||||
bool metering_active () const { return _metering_active; }
|
||||
|
||||
void set_view_mode (ViewMode);
|
||||
@ -195,6 +198,7 @@ class MackieControlProtocol
|
||||
framepos_t transport_frame() const;
|
||||
|
||||
int modifier_state() const { return _modifier_state; }
|
||||
int main_modifier_state() const { return _modifier_state & MAIN_MODIFIER_MASK; }
|
||||
|
||||
typedef std::list<boost::shared_ptr<ARDOUR::AutomationControl> > ControlList;
|
||||
|
||||
@ -289,7 +293,6 @@ class MackieControlProtocol
|
||||
// Bundle to represent our output ports
|
||||
boost::shared_ptr<ARDOUR::Bundle> _output_bundle;
|
||||
void* _gui;
|
||||
bool _zoom_mode;
|
||||
bool _scrub_mode;
|
||||
FlipMode _flip_mode;
|
||||
ViewMode _view_mode;
|
||||
|
@ -144,7 +144,7 @@ MackieControlProtocol::right_press (Button &)
|
||||
LedState
|
||||
MackieControlProtocol::right_release (Button &)
|
||||
{
|
||||
if (_zoom_mode) {
|
||||
if (zoom_mode()) {
|
||||
|
||||
}
|
||||
|
||||
@ -154,20 +154,20 @@ MackieControlProtocol::right_release (Button &)
|
||||
LedState
|
||||
MackieControlProtocol::cursor_left_press (Button& )
|
||||
{
|
||||
if (_zoom_mode) {
|
||||
if (zoom_mode()) {
|
||||
|
||||
if (_modifier_state & MODIFIER_OPTION) {
|
||||
if (main_modifier_state() & MODIFIER_OPTION) {
|
||||
/* reset selected tracks to default vertical zoom */
|
||||
} else {
|
||||
ZoomOut (); /* EMIT SIGNAL */
|
||||
}
|
||||
} else {
|
||||
float page_fraction;
|
||||
if (_modifier_state == MODIFIER_CONTROL) {
|
||||
if (main_modifier_state() == MODIFIER_CONTROL) {
|
||||
page_fraction = 1.0;
|
||||
} else if (_modifier_state == MODIFIER_OPTION) {
|
||||
} else if (main_modifier_state() == MODIFIER_OPTION) {
|
||||
page_fraction = 0.1;
|
||||
} else if (_modifier_state == MODIFIER_SHIFT) {
|
||||
} else if (main_modifier_state() == MODIFIER_SHIFT) {
|
||||
page_fraction = 2.0;
|
||||
} else {
|
||||
page_fraction = 0.25;
|
||||
@ -188,20 +188,20 @@ MackieControlProtocol::cursor_left_release (Button&)
|
||||
LedState
|
||||
MackieControlProtocol::cursor_right_press (Button& )
|
||||
{
|
||||
if (_zoom_mode) {
|
||||
if (zoom_mode()) {
|
||||
|
||||
if (_modifier_state & MODIFIER_OPTION) {
|
||||
if (main_modifier_state() & MODIFIER_OPTION) {
|
||||
/* reset selected tracks to default vertical zoom */
|
||||
} else {
|
||||
ZoomIn (); /* EMIT SIGNAL */
|
||||
}
|
||||
} else {
|
||||
float page_fraction;
|
||||
if (_modifier_state == MODIFIER_CONTROL) {
|
||||
if (main_modifier_state() == MODIFIER_CONTROL) {
|
||||
page_fraction = 1.0;
|
||||
} else if (_modifier_state == MODIFIER_OPTION) {
|
||||
} else if (main_modifier_state() == MODIFIER_OPTION) {
|
||||
page_fraction = 0.1;
|
||||
} else if (_modifier_state == MODIFIER_SHIFT) {
|
||||
} else if (main_modifier_state() == MODIFIER_SHIFT) {
|
||||
page_fraction = 2.0;
|
||||
} else {
|
||||
page_fraction = 0.25;
|
||||
@ -222,9 +222,9 @@ MackieControlProtocol::cursor_right_release (Button&)
|
||||
LedState
|
||||
MackieControlProtocol::cursor_up_press (Button&)
|
||||
{
|
||||
if (_zoom_mode) {
|
||||
if (zoom_mode()) {
|
||||
|
||||
if (_modifier_state & MODIFIER_CONTROL) {
|
||||
if (main_modifier_state() & MODIFIER_CONTROL) {
|
||||
VerticalZoomInSelected (); /* EMIT SIGNAL */
|
||||
} else {
|
||||
VerticalZoomInAll (); /* EMIT SIGNAL */
|
||||
@ -244,8 +244,8 @@ MackieControlProtocol::cursor_up_release (Button&)
|
||||
LedState
|
||||
MackieControlProtocol::cursor_down_press (Button&)
|
||||
{
|
||||
if (_zoom_mode) {
|
||||
if (_modifier_state & MODIFIER_OPTION) {
|
||||
if (zoom_mode()) {
|
||||
if (main_modifier_state() & MODIFIER_OPTION) {
|
||||
VerticalZoomOutSelected (); /* EMIT SIGNAL */
|
||||
} else {
|
||||
VerticalZoomOutAll (); /* EMIT SIGNAL */
|
||||
@ -301,14 +301,19 @@ MackieControlProtocol::channel_right_release (Button &)
|
||||
Mackie::LedState
|
||||
MackieControlProtocol::zoom_press (Mackie::Button &)
|
||||
{
|
||||
_zoom_mode = !_zoom_mode;
|
||||
return (_zoom_mode ? on : off);
|
||||
return none;
|
||||
}
|
||||
|
||||
Mackie::LedState
|
||||
MackieControlProtocol::zoom_release (Mackie::Button &)
|
||||
{
|
||||
return (_zoom_mode ? on : off);
|
||||
if (_modifier_state & MODIFIER_ZOOM) {
|
||||
_modifier_state &= ~MODIFIER_ZOOM;
|
||||
} else {
|
||||
_modifier_state |= MODIFIER_ZOOM;
|
||||
}
|
||||
|
||||
return (zoom_mode() ? on : off);
|
||||
}
|
||||
|
||||
Mackie::LedState
|
||||
@ -330,7 +335,7 @@ MackieControlProtocol::scrub_release (Mackie::Button &)
|
||||
LedState
|
||||
MackieControlProtocol::undo_press (Button&)
|
||||
{
|
||||
if (_modifier_state & MODIFIER_SHIFT) {
|
||||
if (main_modifier_state() & MODIFIER_SHIFT) {
|
||||
Redo(); /* EMIT SIGNAL */
|
||||
} else {
|
||||
Undo(); /* EMIT SIGNAL */
|
||||
@ -465,7 +470,7 @@ MackieControlProtocol::record_release (Button &)
|
||||
LedState
|
||||
MackieControlProtocol::rewind_press (Button &)
|
||||
{
|
||||
if (_modifier_state == MODIFIER_CONTROL) {
|
||||
if (main_modifier_state() == MODIFIER_CONTROL) {
|
||||
goto_start ();
|
||||
} else {
|
||||
rewind ();
|
||||
@ -482,7 +487,7 @@ MackieControlProtocol::rewind_release (Button &)
|
||||
LedState
|
||||
MackieControlProtocol::ffwd_press (Button &)
|
||||
{
|
||||
if (_modifier_state == MODIFIER_CONTROL) {
|
||||
if (main_modifier_state() == MODIFIER_CONTROL) {
|
||||
goto_end();
|
||||
} else {
|
||||
ffwd ();
|
||||
@ -499,7 +504,7 @@ MackieControlProtocol::ffwd_release (Button &)
|
||||
LedState
|
||||
MackieControlProtocol::loop_press (Button &)
|
||||
{
|
||||
if (_modifier_state & MODIFIER_CONTROL) {
|
||||
if (main_modifier_state() & MODIFIER_CONTROL) {
|
||||
set_view_mode (Loop);
|
||||
return on;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user