summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-04-09 18:53:51 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-04-09 18:53:51 +0000
commitbef3ea1adc83945be416f755e08cdea2ecfabf29 (patch)
tree52fbb8075de9a26dcc33a1dca786f2c9dbd3e485 /libs
parent0431309f89dfaf7c17ee65c23a9c694336987098 (diff)
MCP: F1-7 jump to a given view; F8 closes any currently open dialog; in zoom mode, up/down alter vertical track height of all tracks; option-up/down alters selected track heights
git-svn-id: svn://localhost/ardour2/branches/3.0@11858 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/keyboard.h2
-rw-r--r--libs/gtkmm2ext/keyboard.cc17
-rw-r--r--libs/surfaces/control_protocol/control_protocol.cc6
-rw-r--r--libs/surfaces/control_protocol/control_protocol/control_protocol.h6
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.cc170
-rw-r--r--libs/surfaces/mackie/mcp_buttons.cc200
6 files changed, 225 insertions, 176 deletions
diff --git a/libs/gtkmm2ext/gtkmm2ext/keyboard.h b/libs/gtkmm2ext/gtkmm2ext/keyboard.h
index db8100c081..9b083317e3 100644
--- a/libs/gtkmm2ext/gtkmm2ext/keyboard.h
+++ b/libs/gtkmm2ext/gtkmm2ext/keyboard.h
@@ -138,6 +138,8 @@ class Keyboard : public sigc::trackable, PBD::Stateful
static void magic_widget_grab_focus ();
static void magic_widget_drop_focus ();
+ static void close_current_dialog ();
+
static void keybindings_changed ();
static void save_keybindings ();
static bool load_keybindings (std::string path);
diff --git a/libs/gtkmm2ext/keyboard.cc b/libs/gtkmm2ext/keyboard.cc
index 0a3a1f7adc..e8f59af8c9 100644
--- a/libs/gtkmm2ext/keyboard.cc
+++ b/libs/gtkmm2ext/keyboard.cc
@@ -299,11 +299,8 @@ Keyboard::snooper (GtkWidget *widget, GdkEventKey *event)
if (event->type == GDK_KEY_RELEASE && modifier_state_equals (event->state, PrimaryModifier)) {
switch (event->keyval) {
case GDK_w:
- if (current_window) {
- current_window->hide ();
- current_window = 0;
- ret = true;
- }
+ close_current_dialog ();
+ ret = true;
break;
}
}
@@ -311,6 +308,15 @@ Keyboard::snooper (GtkWidget *widget, GdkEventKey *event)
return ret;
}
+void
+Keyboard::close_current_dialog ()
+{
+ if (current_window) {
+ current_window->hide ();
+ current_window = 0;
+ }
+}
+
bool
Keyboard::key_is_down (uint32_t keyval)
{
@@ -556,4 +562,3 @@ Keyboard::load_keybindings (string path)
return true;
}
-
diff --git a/libs/surfaces/control_protocol/control_protocol.cc b/libs/surfaces/control_protocol/control_protocol.cc
index fc98a3845a..debabe5bd7 100644
--- a/libs/surfaces/control_protocol/control_protocol.cc
+++ b/libs/surfaces/control_protocol/control_protocol.cc
@@ -40,6 +40,12 @@ Signal0<void> ControlProtocol::Redo;
Signal1<void,float> ControlProtocol::ScrollTimeline;
Signal1<void,uint32_t> ControlProtocol::SelectByRID;
Signal0<void> ControlProtocol::UnselectTrack;
+Signal1<void,uint32_t> ControlProtocol::GotoView;
+Signal0<void> ControlProtocol::CloseDialog;
+PBD::Signal0<void> ControlProtocol::VerticalZoomInAll;
+PBD::Signal0<void> ControlProtocol::VerticalZoomOutAll;
+PBD::Signal0<void> ControlProtocol::VerticalZoomInSelected;
+PBD::Signal0<void> ControlProtocol::VerticalZoomOutSelected;
ControlProtocol::ControlProtocol (Session& s, string str, EventLoop* evloop)
: BasicUI (s),
diff --git a/libs/surfaces/control_protocol/control_protocol/control_protocol.h b/libs/surfaces/control_protocol/control_protocol/control_protocol.h
index 956f8f814d..abbf73c396 100644
--- a/libs/surfaces/control_protocol/control_protocol/control_protocol.h
+++ b/libs/surfaces/control_protocol/control_protocol/control_protocol.h
@@ -65,6 +65,12 @@ class ControlProtocol : virtual public sigc::trackable, public PBD::Stateful, pu
static PBD::Signal1<void,float> ScrollTimeline;
static PBD::Signal1<void,uint32_t> SelectByRID;
static PBD::Signal0<void> UnselectTrack;
+ static PBD::Signal1<void,uint32_t> GotoView;
+ static PBD::Signal0<void> CloseDialog;
+ static PBD::Signal0<void> VerticalZoomInAll;
+ static PBD::Signal0<void> VerticalZoomOutAll;
+ static PBD::Signal0<void> VerticalZoomInSelected;
+ static PBD::Signal0<void> VerticalZoomOutSelected;
/* the model here is as follows:
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc
index bef36974c7..33809b494a 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.cc
+++ b/libs/surfaces/mackie/mackie_control_protocol.cc
@@ -1276,176 +1276,6 @@ MackieControlProtocol::notify_transport_state_changed()
mcu_port().write (builder.build_led (*rec, record_release (*rec)));
}
-LedState
-MackieControlProtocol::left_press (Button &)
-{
- Sorted sorted = get_sorted_routes();
- if (sorted.size() > route_table.size()) {
- int new_initial = _current_initial_bank - route_table.size();
- if (new_initial < 0) {
- new_initial = 0;
- }
-
- if (new_initial != int (_current_initial_bank)) {
- session->set_dirty();
- switch_banks (new_initial);
- }
-
- return on;
- } else {
- return flashing;
- }
-}
-
-LedState
-MackieControlProtocol::left_release (Button &)
-{
- return off;
-}
-
-LedState
-MackieControlProtocol::right_press (Button &)
-{
- return off;
-}
-
-LedState
-MackieControlProtocol::right_release (Button &)
-{
- if (_zoom_mode) {
-
- }
-
- return off;
-}
-
-LedState
-MackieControlProtocol::cursor_left_press (Button& )
-{
- if (_zoom_mode) {
-
- if (_modifier_state & MODIFIER_OPTION) {
- /* reset selected tracks to default vertical zoom */
- } else {
- ZoomOut (); /* EMIT SIGNAL */
- }
- }
-
- return off;
-}
-
-LedState
-MackieControlProtocol::cursor_left_release (Button&)
-{
- return off;
-}
-
-LedState
-MackieControlProtocol::cursor_right_press (Button& )
-{
- if (_zoom_mode) {
-
- if (_modifier_state & MODIFIER_OPTION) {
- /* reset selected tracks to default vertical zoom */
- } else {
- ZoomIn (); /* EMIT SIGNAL */
- }
- }
-
- return off;
-}
-
-LedState
-MackieControlProtocol::cursor_right_release (Button&)
-{
- return off;
-}
-
-LedState
-MackieControlProtocol::cursor_up_press (Button&)
-{
- return off;
-}
-
-LedState
-MackieControlProtocol::cursor_up_release (Button&)
-{
- return off;
-}
-
-LedState
-MackieControlProtocol::cursor_down_press (Button&)
-{
- return off;
-}
-
-LedState
-MackieControlProtocol::cursor_down_release (Button&)
-{
- return off;
-}
-
-LedState
-MackieControlProtocol::channel_left_press (Button &)
-{
- Sorted sorted = get_sorted_routes();
- if (sorted.size() > route_table.size()) {
- prev_track();
- return on;
- } else {
- return flashing;
- }
-}
-
-LedState
-MackieControlProtocol::channel_left_release (Button &)
-{
- return off;
-}
-
-LedState
-MackieControlProtocol::channel_right_press (Button &)
-{
- Sorted sorted = get_sorted_routes();
- if (sorted.size() > route_table.size()) {
- next_track();
- return on;
- } else {
- return flashing;
- }
-}
-
-LedState
-MackieControlProtocol::channel_right_release (Button &)
-{
- return off;
-}
-
-/////////////////////////////////////
-// Functions
-/////////////////////////////////////
-LedState
-MackieControlProtocol::marker_press (Button &)
-{
- // cut'n'paste from LocationUI::add_new_location()
- string markername;
- framepos_t where = session->audible_frame();
- session->locations()->next_available_name(markername,"mcu");
- Location *location = new Location (*session, where, where, markername, Location::IsMark);
- session->begin_reversible_command (_("add marker"));
- XMLNode &before = session->locations()->get_state();
- session->locations()->add (location, true);
- XMLNode &after = session->locations()->get_state();
- session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
- session->commit_reversible_command ();
- return on;
-}
-
-LedState
-MackieControlProtocol::marker_release (Button &)
-{
- return off;
-}
void
jog_wheel_state_display (JogWheel::State state, SurfacePort & port)
diff --git a/libs/surfaces/mackie/mcp_buttons.cc b/libs/surfaces/mackie/mcp_buttons.cc
index e05104fa32..27c38c472d 100644
--- a/libs/surfaces/mackie/mcp_buttons.cc
+++ b/libs/surfaces/mackie/mcp_buttons.cc
@@ -17,6 +17,8 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include "pbd/memento_command.h"
+
#include "ardour/session.h"
#include "ardour/route.h"
#include "ardour/location.h"
@@ -24,12 +26,15 @@
#include "mackie_control_protocol.h"
+#include "i18n.h"
+
/* handlers for all buttons, broken into a separate file to avoid clutter in
* mackie_control_protocol.cc
*/
using namespace Mackie;
using namespace ARDOUR;
+using std::string;
LedState
MackieControlProtocol::shift_press (Button &)
@@ -80,6 +85,192 @@ MackieControlProtocol::cmd_alt_release (Button &)
return on;
}
+LedState
+MackieControlProtocol::left_press (Button &)
+{
+ Sorted sorted = get_sorted_routes();
+ if (sorted.size() > route_table.size()) {
+ int new_initial = _current_initial_bank - route_table.size();
+ if (new_initial < 0) {
+ new_initial = 0;
+ }
+
+ if (new_initial != int (_current_initial_bank)) {
+ session->set_dirty();
+ switch_banks (new_initial);
+ }
+
+ return on;
+ } else {
+ return flashing;
+ }
+}
+
+LedState
+MackieControlProtocol::left_release (Button &)
+{
+ return off;
+}
+
+LedState
+MackieControlProtocol::right_press (Button &)
+{
+ return off;
+}
+
+LedState
+MackieControlProtocol::right_release (Button &)
+{
+ if (_zoom_mode) {
+
+ }
+
+ return off;
+}
+
+LedState
+MackieControlProtocol::cursor_left_press (Button& )
+{
+ if (_zoom_mode) {
+
+ if (_modifier_state & MODIFIER_OPTION) {
+ /* reset selected tracks to default vertical zoom */
+ } else {
+ ZoomOut (); /* EMIT SIGNAL */
+ }
+ }
+
+ return off;
+}
+
+LedState
+MackieControlProtocol::cursor_left_release (Button&)
+{
+ return off;
+}
+
+LedState
+MackieControlProtocol::cursor_right_press (Button& )
+{
+ if (_zoom_mode) {
+
+ if (_modifier_state & MODIFIER_OPTION) {
+ /* reset selected tracks to default vertical zoom */
+ } else {
+ ZoomIn (); /* EMIT SIGNAL */
+ }
+ }
+
+ return off;
+}
+
+LedState
+MackieControlProtocol::cursor_right_release (Button&)
+{
+ return off;
+}
+
+LedState
+MackieControlProtocol::cursor_up_press (Button&)
+{
+ if (_zoom_mode) {
+ if (_modifier_state & MODIFIER_OPTION) {
+ VerticalZoomOutSelected (); /* EMIT SIGNAL */
+ } else {
+ VerticalZoomOutAll (); /* EMIT SIGNAL */
+ }
+ }
+ return off;
+}
+
+LedState
+MackieControlProtocol::cursor_up_release (Button&)
+{
+ return off;
+}
+
+LedState
+MackieControlProtocol::cursor_down_press (Button&)
+{
+ if (_zoom_mode) {
+
+ if (_modifier_state & MODIFIER_OPTION) {
+ VerticalZoomInSelected (); /* EMIT SIGNAL */
+ } else {
+ VerticalZoomInAll (); /* EMIT SIGNAL */
+ }
+ }
+ return off;
+}
+
+LedState
+MackieControlProtocol::cursor_down_release (Button&)
+{
+ return off;
+}
+
+LedState
+MackieControlProtocol::channel_left_press (Button &)
+{
+ Sorted sorted = get_sorted_routes();
+ if (sorted.size() > route_table.size()) {
+ prev_track();
+ return on;
+ } else {
+ return flashing;
+ }
+}
+
+LedState
+MackieControlProtocol::channel_left_release (Button &)
+{
+ return off;
+}
+
+LedState
+MackieControlProtocol::channel_right_press (Button &)
+{
+ Sorted sorted = get_sorted_routes();
+ if (sorted.size() > route_table.size()) {
+ next_track();
+ return on;
+ } else {
+ return flashing;
+ }
+}
+
+LedState
+MackieControlProtocol::channel_right_release (Button &)
+{
+ return off;
+}
+
+/////////////////////////////////////
+// Functions
+/////////////////////////////////////
+LedState
+MackieControlProtocol::marker_press (Button &)
+{
+ // cut'n'paste from LocationUI::add_new_location()
+ string markername;
+ framepos_t where = session->audible_frame();
+ session->locations()->next_available_name(markername,"mcu");
+ Location *location = new Location (*session, where, where, markername, Location::IsMark);
+ session->begin_reversible_command (_("add marker"));
+ XMLNode &before = session->locations()->get_state();
+ session->locations()->add (location, true);
+ XMLNode &after = session->locations()->get_state();
+ session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
+ session->commit_reversible_command ();
+ return on;
+}
+
+LedState
+MackieControlProtocol::marker_release (Button &)
+{
+ return off;
+}
+
/////////////////////////////////////
// Transport Buttons
/////////////////////////////////////
@@ -432,6 +623,7 @@ MackieControlProtocol::name_value_release (Button &)
LedState
MackieControlProtocol::F1_press (Button &)
{
+ GotoView (0); /* EMIT SIGNAL */
return off;
}
LedState
@@ -442,6 +634,7 @@ MackieControlProtocol::F1_release (Button &)
LedState
MackieControlProtocol::F2_press (Button &)
{
+ GotoView (1); /* EMIT SIGNAL */
return off;
}
LedState
@@ -452,6 +645,7 @@ MackieControlProtocol::F2_release (Button &)
LedState
MackieControlProtocol::F3_press (Button &)
{
+ GotoView (2); /* EMIT SIGNAL */
return off;
}
LedState
@@ -462,6 +656,7 @@ MackieControlProtocol::F3_release (Button &)
LedState
MackieControlProtocol::F4_press (Button &)
{
+ GotoView (3); /* EMIT SIGNAL */
return off;
}
LedState
@@ -472,6 +667,7 @@ MackieControlProtocol::F4_release (Button &)
LedState
MackieControlProtocol::F5_press (Button &)
{
+ GotoView (4); /* EMIT SIGNAL */
return off;
}
LedState
@@ -482,6 +678,7 @@ MackieControlProtocol::F5_release (Button &)
LedState
MackieControlProtocol::F6_press (Button &)
{
+ GotoView (5); /* EMIT SIGNAL */
return off;
}
LedState
@@ -492,6 +689,7 @@ MackieControlProtocol::F6_release (Button &)
LedState
MackieControlProtocol::F7_press (Button &)
{
+ GotoView (6); /* EMIT SIGNAL */
return off;
}
LedState
@@ -502,6 +700,7 @@ MackieControlProtocol::F7_release (Button &)
LedState
MackieControlProtocol::F8_press (Button &)
{
+ CloseDialog (); /* EMIT SIGNAL */
return off;
}
LedState
@@ -512,6 +711,7 @@ MackieControlProtocol::F8_release (Button &)
LedState
MackieControlProtocol::F9_press (Button &)
{
+ GotoView (8); /* EMIT SIGNAL */
return off;
}
LedState