From 14b95116e176983fc37d82215634ec4844d27d14 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 14 Feb 2024 17:10:56 -0700 Subject: [PATCH] move various action registry stuff into EditingContext --- gtk2_ardour/editing_context.cc | 67 +++++++++++++++++++++++++++++++++- gtk2_ardour/editing_context.h | 7 +++- gtk2_ardour/editor.h | 2 - gtk2_ardour/editor_actions.cc | 45 ++--------------------- gtk2_ardour/editor_drag.cc | 5 +-- gtk2_ardour/editor_drag.h | 10 ++--- gtk2_ardour/editor_mouse.cc | 17 --------- gtk2_ardour/midi_cue_editor.cc | 14 ++++++- gtk2_ardour/midi_cue_editor.h | 2 + gtk2_ardour/public_editor.h | 1 - 10 files changed, 95 insertions(+), 75 deletions(-) diff --git a/gtk2_ardour/editing_context.cc b/gtk2_ardour/editing_context.cc index ea4f22254b..f104d34396 100644 --- a/gtk2_ardour/editing_context.cc +++ b/gtk2_ardour/editing_context.cc @@ -42,6 +42,7 @@ #include "midi_region_view.h" #include "note_base.h" #include "quantize_dialog.h" +#include "rc_option_editor.h" #include "selection.h" #include "selection_memento.h" #include "transform_dialog.h" @@ -141,6 +142,7 @@ EditingContext::EditingContext (std::string const & name) snap_mode_button.set_text (_("Snap")); snap_mode_button.set_name ("mouse mode button"); + snap_mode_button.signal_button_press_event().connect (sigc::mem_fun (*this, &EditingContext::snap_mode_button_clicked), false); if (!_cursors) { _cursors = new MouseCursors; @@ -461,7 +463,8 @@ EditingContext::grid_type_action (GridType type) abort(); /*NOTREACHED*/ } - act = ActionManager::get_action (X_("Snap"), action); + std::string action_name = editor_name() + X_("Snap"); + act = ActionManager::get_action (action_name.c_str(), action); if (act) { RefPtr ract = RefPtr::cast_dynamic(act); @@ -2297,3 +2300,65 @@ EditingContext::get_common_editing_state (XMLNode& node) const node.set_property ("draw-channel", _draw_channel); node.set_property ("left-frame", _leftmost_sample); } + +bool +EditingContext::snap_mode_button_clicked (GdkEventButton* ev) +{ + if (ev->button != 3) { + cycle_snap_mode(); + return true; + } + + RCOptionEditor* rc_option_editor = ARDOUR_UI::instance()->get_rc_option_editor(); + if (rc_option_editor) { + ARDOUR_UI::instance()->show_tabbable (rc_option_editor); + rc_option_editor->set_current_page (_("Editor/Snap")); + } + + return true; +} + +void +EditingContext::register_grid_actions () +{ + std::cerr << "REGISTER GRID ACTIONS for " << editor_name() << std::endl; + + ActionManager::register_action (editor_actions, X_("GridChoice"), _("Snap & Grid")); + + RadioAction::Group snap_mode_group; + /* deprecated */ ActionManager::register_radio_action (editor_actions, snap_mode_group, X_("snap-off"), _("No Grid"), (sigc::bind (sigc::mem_fun(*this, &EditingContext::snap_mode_chosen), Editing::SnapOff))); + /* deprecated */ ActionManager::register_radio_action (editor_actions, snap_mode_group, X_("snap-normal"), _("Grid"), (sigc::bind (sigc::mem_fun(*this, &EditingContext::snap_mode_chosen), Editing::SnapNormal))); //deprecated + /* deprecated */ ActionManager::register_radio_action (editor_actions, snap_mode_group, X_("snap-magnetic"), _("Magnetic"), (sigc::bind (sigc::mem_fun(*this, &EditingContext::snap_mode_chosen), Editing::SnapMagnetic))); + + ActionManager::register_action (editor_actions, X_("cycle-snap-mode"), _("Toggle Snap"), sigc::mem_fun (*this, &EditingContext::cycle_snap_mode)); + ActionManager::register_action (editor_actions, X_("next-grid-choice"), _("Next Quantize Grid Choice"), sigc::mem_fun (*this, &EditingContext::next_grid_choice)); + ActionManager::register_action (editor_actions, X_("prev-grid-choice"), _("Previous Quantize Grid Choice"), sigc::mem_fun (*this, &EditingContext::prev_grid_choice)); + + Glib::RefPtr snap_actions = ActionManager::create_action_group (bindings, editor_name() + X_("Snap")); + RadioAction::Group grid_choice_group; + + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-thirtyseconds"), grid_type_strings[(int)GridTypeBeatDiv32].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBeatDiv32))); + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-twentyeighths"), grid_type_strings[(int)GridTypeBeatDiv28].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBeatDiv28))); + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-twentyfourths"), grid_type_strings[(int)GridTypeBeatDiv24].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBeatDiv24))); + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-twentieths"), grid_type_strings[(int)GridTypeBeatDiv20].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBeatDiv20))); + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-asixteenthbeat"), grid_type_strings[(int)GridTypeBeatDiv16].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBeatDiv16))); + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-fourteenths"), grid_type_strings[(int)GridTypeBeatDiv14].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBeatDiv14))); + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-twelfths"), grid_type_strings[(int)GridTypeBeatDiv12].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBeatDiv12))); + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-tenths"), grid_type_strings[(int)GridTypeBeatDiv10].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBeatDiv10))); + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-eighths"), grid_type_strings[(int)GridTypeBeatDiv8].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBeatDiv8))); + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-sevenths"), grid_type_strings[(int)GridTypeBeatDiv7].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBeatDiv7))); + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-sixths"), grid_type_strings[(int)GridTypeBeatDiv6].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBeatDiv6))); + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-fifths"), grid_type_strings[(int)GridTypeBeatDiv5].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBeatDiv5))); + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-quarters"), grid_type_strings[(int)GridTypeBeatDiv4].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBeatDiv4))); + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-thirds"), grid_type_strings[(int)GridTypeBeatDiv3].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBeatDiv3))); + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-halves"), grid_type_strings[(int)GridTypeBeatDiv2].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBeatDiv2))); + + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-timecode"), grid_type_strings[(int)GridTypeTimecode].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeTimecode))); + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-minsec"), grid_type_strings[(int)GridTypeMinSec].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeMinSec))); + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-cdframe"), grid_type_strings[(int)GridTypeCDFrame].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeCDFrame))); + + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-beat"), grid_type_strings[(int)GridTypeBeat].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBeat))); + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-bar"), grid_type_strings[(int)GridTypeBar].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBar))); + + ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-none"), grid_type_strings[(int)GridTypeNone].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeNone))); +} diff --git a/gtk2_ardour/editing_context.h b/gtk2_ardour/editing_context.h index 390162dae6..8bc7208232 100644 --- a/gtk2_ardour/editing_context.h +++ b/gtk2_ardour/editing_context.h @@ -411,6 +411,7 @@ public: DragManager* _drags; ArdourWidgets::ArdourButton snap_mode_button; + bool snap_mode_button_clicked (GdkEventButton*); virtual void mark_region_boundary_cache_dirty () {} virtual void update_tempo_based_rulers () {}; @@ -535,13 +536,15 @@ public: ArdourWidgets::ArdourButton mouse_draw_button; ArdourWidgets::ArdourButton mouse_content_button; + Glib::RefPtr editor_actions; + virtual void register_actions() = 0; + void register_grid_actions (); + Glib::RefPtr get_mouse_mode_action (Editing::MouseMode m) const; void register_mouse_mode_actions (); void bind_mouse_mode_buttons (); virtual void add_mouse_mode_actions (Glib::RefPtr) {} - ArdourWidgets::ArdourButton* snap_button; - Gtk::HBox snap_box; Gtk::HBox grid_box; Gtk::HBox draw_box; diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index d24f30537f..831cbc2411 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1840,8 +1840,6 @@ private: return stretch_marker_cb.get_active (); } - bool snap_mode_button_clicked (GdkEventButton*); - Gtk::HBox ebox_hpacker; Gtk::VBox ebox_vpacker; diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index d57f5e09df..089c40c928 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -118,7 +118,7 @@ Editor::register_actions () { RefPtr act; - editor_actions = ActionManager::create_action_group (bindings, X_("Editor")); + editor_actions = ActionManager::create_action_group (bindings, editor_name()); editor_menu_actions = ActionManager::create_action_group (bindings, X_("EditorMenu")); /* non-operative menu items for menu bar */ @@ -597,46 +597,7 @@ Editor::register_actions () ActionManager::register_action (editor_actions, "set-ripple-all", _("All"), sigc::bind (sigc::mem_fun (*this, &Editor::set_ripple_mode), RippleAll)); ActionManager::register_action (editor_actions, "set-ripple-interview", S_("Interview"), sigc::bind (sigc::mem_fun (*this, &Editor::set_ripple_mode), RippleInterview)); - ActionManager::register_action (editor_actions, X_("GridChoice"), _("Snap & Grid")); - - RadioAction::Group snap_mode_group; - /* deprecated */ ActionManager::register_radio_action (editor_actions, snap_mode_group, X_("snap-off"), _("No Grid"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_chosen), Editing::SnapOff))); - /* deprecated */ ActionManager::register_radio_action (editor_actions, snap_mode_group, X_("snap-normal"), _("Grid"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_chosen), Editing::SnapNormal))); //deprecated - /* deprecated */ ActionManager::register_radio_action (editor_actions, snap_mode_group, X_("snap-magnetic"), _("Magnetic"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_chosen), Editing::SnapMagnetic))); - - snap_mode_button.signal_button_press_event().connect (sigc::mem_fun (*this, &Editor::snap_mode_button_clicked), false); - - ActionManager::register_action (editor_actions, X_("cycle-snap-mode"), _("Toggle Snap"), sigc::mem_fun (*this, &Editor::cycle_snap_mode)); - ActionManager::register_action (editor_actions, X_("next-grid-choice"), _("Next Quantize Grid Choice"), sigc::mem_fun (*this, &Editor::next_grid_choice)); - ActionManager::register_action (editor_actions, X_("prev-grid-choice"), _("Previous Quantize Grid Choice"), sigc::mem_fun (*this, &Editor::prev_grid_choice)); - - Glib::RefPtr snap_actions = ActionManager::create_action_group (bindings, X_("Snap")); - RadioAction::Group grid_choice_group; - - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-thirtyseconds"), grid_type_strings[(int)GridTypeBeatDiv32].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeBeatDiv32))); - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-twentyeighths"), grid_type_strings[(int)GridTypeBeatDiv28].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeBeatDiv28))); - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-twentyfourths"), grid_type_strings[(int)GridTypeBeatDiv24].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeBeatDiv24))); - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-twentieths"), grid_type_strings[(int)GridTypeBeatDiv20].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeBeatDiv20))); - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-asixteenthbeat"), grid_type_strings[(int)GridTypeBeatDiv16].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeBeatDiv16))); - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-fourteenths"), grid_type_strings[(int)GridTypeBeatDiv14].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeBeatDiv14))); - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-twelfths"), grid_type_strings[(int)GridTypeBeatDiv12].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeBeatDiv12))); - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-tenths"), grid_type_strings[(int)GridTypeBeatDiv10].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeBeatDiv10))); - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-eighths"), grid_type_strings[(int)GridTypeBeatDiv8].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeBeatDiv8))); - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-sevenths"), grid_type_strings[(int)GridTypeBeatDiv7].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeBeatDiv7))); - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-sixths"), grid_type_strings[(int)GridTypeBeatDiv6].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeBeatDiv6))); - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-fifths"), grid_type_strings[(int)GridTypeBeatDiv5].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeBeatDiv5))); - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-quarters"), grid_type_strings[(int)GridTypeBeatDiv4].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeBeatDiv4))); - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-thirds"), grid_type_strings[(int)GridTypeBeatDiv3].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeBeatDiv3))); - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-halves"), grid_type_strings[(int)GridTypeBeatDiv2].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeBeatDiv2))); - - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-timecode"), grid_type_strings[(int)GridTypeTimecode].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeTimecode))); - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-minsec"), grid_type_strings[(int)GridTypeMinSec].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeMinSec))); - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-cdframe"), grid_type_strings[(int)GridTypeCDFrame].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeCDFrame))); - - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-beat"), grid_type_strings[(int)GridTypeBeat].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeBeat))); - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-bar"), grid_type_strings[(int)GridTypeBar].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeBar))); - - ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-none"), grid_type_strings[(int)GridTypeNone].c_str(), (sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_chosen), Editing::GridTypeNone))); + register_grid_actions (); ActionManager::register_toggle_action (editor_actions, X_("show-marker-lines"), _("Show Marker Lines"), sigc::mem_fun (*this, &Editor::toggle_marker_lines)); @@ -822,7 +783,7 @@ Editor::trigger_script_by_name (const std::string script_name, const std::string void Editor::load_bindings () { - bindings = Bindings::get_bindings (X_("Editor")); + bindings = Bindings::get_bindings (editor_name()); global_hpacker.set_data ("ardour-bindings", bindings); /* This set of bindings may expand in the future to include things diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 2b20eed421..b79cecf3bc 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -2386,14 +2386,12 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*ignored*/) Drag::start_grab (event, cursor); -#warning paul fix me MRV/MV -#if 0 region = &cnote->region_view (); double temp; temp = region->snap_to_pixel (cnote->x0 (), true); _snap_delta = temp - cnote->x0 (); -#endif + _item->grab (); if (event->motion.state & ArdourKeyboard::note_size_relative_modifier ()) { @@ -5297,6 +5295,7 @@ RubberbandSelectDrag::do_select_things (GdkEvent* event, bool drag_in_progress) void RubberbandSelectDrag::finished (GdkEvent* event, bool movement_occurred) { + std::cerr << "RBSD::finished (moved ? " << movement_occurred << ")\n"; if (movement_occurred) { motion (event, false); do_select_things (event, false); diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h index 9addf81d50..2c03fa6603 100644 --- a/gtk2_ardour/editor_drag.h +++ b/gtk2_ardour/editor_drag.h @@ -615,11 +615,11 @@ public: } private: - MidiRegionView* region; - bool relative; - bool at_front; - bool _was_selected; - double _snap_delta; + MidiView* region; + bool relative; + bool at_front; + bool _was_selected; + double _snap_delta; }; /** Drags to move MIDI notes */ diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 33b70cd499..4aa0b35212 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -197,23 +197,6 @@ Editor::mouse_mode_object_range_toggled() set_mouse_mode (mouse_mode, true); /* updates set-mouse-mode-range */ } -bool -Editor::snap_mode_button_clicked (GdkEventButton* ev) -{ - if (ev->button != 3) { - cycle_snap_mode(); - return true; - } - - RCOptionEditor* rc_option_editor = ARDOUR_UI::instance()->get_rc_option_editor(); - if (rc_option_editor) { - ARDOUR_UI::instance()->show_tabbable (rc_option_editor); - rc_option_editor->set_current_page (_("Editor/Snap")); - } - - return true; -} - void Editor::mouse_mode_toggled (MouseMode m) { diff --git a/gtk2_ardour/midi_cue_editor.cc b/gtk2_ardour/midi_cue_editor.cc index 5876fafb89..10b04f061c 100644 --- a/gtk2_ardour/midi_cue_editor.cc +++ b/gtk2_ardour/midi_cue_editor.cc @@ -62,8 +62,9 @@ MidiCueEditor::MidiCueEditor() { mouse_mode = Editing::MouseContent; - register_mouse_mode_actions (); - bind_mouse_mode_buttons (); + bindings = Bindings::get_bindings (editor_name()); + + register_actions (); build_grid_type_menu (); build_draw_midi_menus(); @@ -87,6 +88,15 @@ MidiCueEditor::~MidiCueEditor () { } +void +MidiCueEditor::register_actions () +{ + editor_actions = ActionManager::create_action_group (bindings, editor_name()); + register_mouse_mode_actions (); + bind_mouse_mode_buttons (); + register_grid_actions (); +} + ArdourCanvas::GtkCanvasViewport* MidiCueEditor::get_canvas_viewport() const { diff --git a/gtk2_ardour/midi_cue_editor.h b/gtk2_ardour/midi_cue_editor.h index d887703deb..d3fa967a47 100644 --- a/gtk2_ardour/midi_cue_editor.h +++ b/gtk2_ardour/midi_cue_editor.h @@ -91,6 +91,8 @@ class MidiCueEditor : public CueEditor XMLNode& get_state () const; protected: + void register_actions (); + Temporal::timepos_t snap_to_grid (Temporal::timepos_t const & start, Temporal::RoundMode direction, ARDOUR::SnapPref gpref) const; diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 2b96c418ec..ae7cf59e77 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -365,7 +365,6 @@ public: std::map region_action_map; - Glib::RefPtr editor_actions; Glib::RefPtr editor_menu_actions; Glib::RefPtr _region_actions;