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 */
temporal_zoom (fpu);
}
+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 ()
{
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 */
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 ();
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);
}
_routes->resume_redisplay ();
}
+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)
{
}
}
-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)
{
bool in_destructor;
NamePackingBits name_packing;
- void set_heights (uint32_t h);
void color_handler ();
void conditionally_add_to_selection ();
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);
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;
}
}
return ret;
}
+void
+Keyboard::close_current_dialog ()
+{
+ if (current_window) {
+ current_window->hide ();
+ current_window = 0;
+ }
+}
+
bool
Keyboard::key_is_down (uint32_t keyval)
{
return true;
}
-
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),
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:
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)
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"
#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 &)
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
/////////////////////////////////////
LedState
MackieControlProtocol::F1_press (Button &)
{
+ GotoView (0); /* EMIT SIGNAL */
return off;
}
LedState
LedState
MackieControlProtocol::F2_press (Button &)
{
+ GotoView (1); /* EMIT SIGNAL */
return off;
}
LedState
LedState
MackieControlProtocol::F3_press (Button &)
{
+ GotoView (2); /* EMIT SIGNAL */
return off;
}
LedState
LedState
MackieControlProtocol::F4_press (Button &)
{
+ GotoView (3); /* EMIT SIGNAL */
return off;
}
LedState
LedState
MackieControlProtocol::F5_press (Button &)
{
+ GotoView (4); /* EMIT SIGNAL */
return off;
}
LedState
LedState
MackieControlProtocol::F6_press (Button &)
{
+ GotoView (5); /* EMIT SIGNAL */
return off;
}
LedState
LedState
MackieControlProtocol::F7_press (Button &)
{
+ GotoView (6); /* EMIT SIGNAL */
return off;
}
LedState
LedState
MackieControlProtocol::F8_press (Button &)
{
+ CloseDialog (); /* EMIT SIGNAL */
return off;
}
LedState
LedState
MackieControlProtocol::F9_press (Button &)
{
+ GotoView (8); /* EMIT SIGNAL */
return off;
}
LedState