summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/editor.cc37
-rw-r--r--gtk2_ardour/editor.h6
-rw-r--r--gtk2_ardour/editor_ops.cc44
-rw-r--r--gtk2_ardour/time_axis_view.cc10
-rw-r--r--gtk2_ardour/time_axis_view.h1
-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
11 files changed, 309 insertions, 190 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index d331b6aee1..eb262ffb24 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -714,6 +714,13 @@ Editor::Editor ()
ControlProtocol::ScrollTimeline.connect (*this, invalidator (*this), ui_bind (&Editor::control_scroll, this, _1), gui_context());
ControlProtocol::SelectByRID.connect (*this, invalidator (*this), ui_bind (&Editor::control_select, this, _1), gui_context());
ControlProtocol::UnselectTrack.connect (*this, invalidator (*this), ui_bind (&Editor::control_unselect, this), gui_context());
+ ControlProtocol::GotoView.connect (*this, invalidator (*this), ui_bind (&Editor::control_view, this, _1), gui_context());
+ ControlProtocol::CloseDialog.connect (*this, invalidator (*this), Keyboard::close_current_dialog, gui_context());
+ ControlProtocol::VerticalZoomInAll.connect (*this, invalidator (*this), ui_bind (&Editor::control_vertical_zoom_in_all, this), gui_context());
+ ControlProtocol::VerticalZoomOutAll.connect (*this, invalidator (*this), ui_bind (&Editor::control_vertical_zoom_out_all, this), gui_context());
+ ControlProtocol::VerticalZoomInSelected.connect (*this, invalidator (*this), ui_bind (&Editor::control_vertical_zoom_in_selected, this), gui_context());
+ ControlProtocol::VerticalZoomOutSelected.connect (*this, invalidator (*this), ui_bind (&Editor::control_vertical_zoom_out_selected, this), gui_context());
+
BasicUI::AccessAction.connect (*this, invalidator (*this), ui_bind (&Editor::access_action, this, _1, _2), gui_context());
/* problematic: has to return a value and thus cannot be x-thread */
@@ -923,6 +930,36 @@ Editor::zoom_adjustment_changed ()
}
void
+Editor::control_vertical_zoom_in_all ()
+{
+ tav_zoom_smooth (false, true);
+}
+
+void
+Editor::control_vertical_zoom_out_all ()
+{
+ tav_zoom_smooth (true, true);
+}
+
+void
+Editor::control_vertical_zoom_in_selected ()
+{
+ tav_zoom_smooth (false, false);
+}
+
+void
+Editor::control_vertical_zoom_out_selected ()
+{
+ tav_zoom_smooth (true, false);
+}
+
+void
+Editor::control_view (uint32_t view)
+{
+ goto_visual_state (view);
+}
+
+void
Editor::control_unselect ()
{
selection->clear_tracks ();
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 92675edb4e..a3315b6c19 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -318,6 +318,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void temporal_zoom_step (bool coarser);
void tav_zoom_step (bool coarser);
+ void tav_zoom_smooth (bool coarser, bool force_all);
/* stuff that AudioTimeAxisView and related classes use */
@@ -987,6 +988,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
Gtk::VBox edit_controls_vbox;
Gtk::HBox edit_controls_hbox;
+ void control_vertical_zoom_in_all ();
+ void control_vertical_zoom_out_all ();
+ void control_vertical_zoom_in_selected ();
+ void control_vertical_zoom_out_selected ();
+ void control_view (uint32_t);
void control_scroll (float);
void control_select (uint32_t rid);
void control_unselect ();
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 1dbad3ac2e..92d4ed63f5 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -1278,11 +1278,17 @@ Editor::scroll_tracks_up_line ()
void
Editor::tav_zoom_step (bool coarser)
{
- ENSURE_GUI_THREAD (*this, &Editor::temporal_zoom_step, coarser)
-
_routes->suspend_redisplay ();
- for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
+ TrackViewList* ts;
+
+ if (selection->tracks.empty()) {
+ ts = &track_views;
+ } else {
+ ts = &selection->tracks;
+ }
+
+ for (TrackViewList::iterator i = ts->begin(); i != ts->end(); ++i) {
TimeAxisView *tv = (static_cast<TimeAxisView*>(*i));
tv->step_height (coarser);
}
@@ -1291,6 +1297,38 @@ Editor::tav_zoom_step (bool coarser)
}
void
+Editor::tav_zoom_smooth (bool coarser, bool force_all)
+{
+ _routes->suspend_redisplay ();
+
+ TrackViewList* ts;
+
+ if (selection->tracks.empty() || force_all) {
+ ts = &track_views;
+ } else {
+ ts = &selection->tracks;
+ }
+
+ for (TrackViewList::iterator i = ts->begin(); i != ts->end(); ++i) {
+ TimeAxisView *tv = (static_cast<TimeAxisView*>(*i));
+ uint32_t h = tv->current_height ();
+
+ if (coarser) {
+ if (h > 5) {
+ h -= 5; // pixels
+ if (h >= TimeAxisView::preset_height (HeightSmall)) {
+ tv->set_height (h);
+ }
+ }
+ } else {
+ tv->set_height (h + 5);
+ }
+ }
+
+ _routes->resume_redisplay ();
+}
+
+void
Editor::temporal_zoom_step (bool coarser)
{
ENSURE_GUI_THREAD (*this, &Editor::temporal_zoom_step, coarser)
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc
index 104209d884..52013a5747 100644
--- a/gtk2_ardour/time_axis_view.cc
+++ b/gtk2_ardour/time_axis_view.cc
@@ -496,16 +496,6 @@ TimeAxisView::step_height (bool coarser)
}
void
-TimeAxisView::set_heights (uint32_t h)
-{
- TrackSelection& ts (_editor.get_selection().tracks);
-
- for (TrackSelection::iterator i = ts.begin(); i != ts.end(); ++i) {
- (*i)->set_height (h);
- }
-}
-
-void
TimeAxisView::set_height_enum (Height h, bool apply_to_selection)
{
if (apply_to_selection) {
diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h
index 52385b17aa..03c50e7ccb 100644
--- a/gtk2_ardour/time_axis_view.h
+++ b/gtk2_ardour/time_axis_view.h
@@ -286,7 +286,6 @@ class TimeAxisView : public virtual AxisView
bool in_destructor;
NamePackingBits name_packing;
- void set_heights (uint32_t h);
void color_handler ();
void conditionally_add_to_selection ();
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