allow sending OSC from inline display UIs
[ardour.git] / gtk2_ardour / editor_actions.cc
index 663ed9468bfd19c73b6e9ea2e97f3c1dbff72c56..b493529b24737f38b1e2e9e15487a6b7644f1626 100644 (file)
@@ -41,7 +41,7 @@
 #include "time_axis_view.h"
 #include "ui_config.h"
 #include "utils.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
 #include "audio_time_axis.h"
 #include "editor_group_tabs.h"
 #include "editor_routes.h"
@@ -147,13 +147,12 @@ Editor::register_actions ()
        myactions.register_action (editor_menu_actions, X_("View"), _("View"));
        myactions.register_action (editor_menu_actions, X_("ZoomFocus"), _("Zoom Focus"));
        myactions.register_action (editor_menu_actions, X_("ZoomMenu"), _("Zoom"));
+       myactions.register_action (editor_menu_actions, X_("ActionScripts"), _("Scripted Actions"));
 
        register_region_actions ();
 
        /* add named actions for the editor */
 
-       myactions.register_action (editor_actions, "escape", _("Break drag or deselect all"), sigc::mem_fun (*this, &Editor::escape));
-
        /* We don't bother registering "unlock" because it would be insensitive
           when required. Editor::unlock() must be invoked directly.
        */
@@ -246,6 +245,7 @@ Editor::register_actions ()
                reg_sens (editor_actions, a.c_str(), n.c_str(), sigc::bind (sigc::mem_fun (*this, &Editor::goto_nth_marker), i - 1));
        }
 
+
        reg_sens (editor_actions, "jump-forward-to-mark", _("Jump to Next Mark"), sigc::mem_fun(*this, &Editor::jump_forward_to_mark));
        reg_sens (editor_actions, "alternate-jump-forward-to-mark", _("Jump to Next Mark"), sigc::mem_fun(*this, &Editor::jump_forward_to_mark));
        reg_sens (editor_actions, "jump-backward-to-mark", _("Jump to Previous Mark"), sigc::mem_fun(*this, &Editor::jump_backward_to_mark));
@@ -254,6 +254,7 @@ Editor::register_actions ()
        reg_sens (editor_actions, "set-session-start-from-playhead", _("Set Session Start from Playhead"), sigc::mem_fun(*this, &Editor::set_session_start_from_playhead));
        reg_sens (editor_actions, "set-session-end-from-playhead", _("Set Session End from Playhead"), sigc::mem_fun(*this, &Editor::set_session_end_from_playhead));
 
+       reg_sens (editor_actions, "toggle-location-at-playhead", _("Toggle Mark at Playhead"), sigc::mem_fun(*this, &Editor::toggle_location_at_playhead_cursor));
        reg_sens (editor_actions, "add-location-from-playhead", _("Add Mark from Playhead"), sigc::mem_fun(*this, &Editor::add_location_from_playhead_cursor));
        reg_sens (editor_actions, "alternate-add-location-from-playhead", _("Add Mark from Playhead"), sigc::mem_fun(*this, &Editor::add_location_from_playhead_cursor));
 
@@ -329,6 +330,7 @@ Editor::register_actions ()
 
        reg_sens (editor_actions, "set-playhead", _("Playhead to Mouse"), sigc::mem_fun(*this, &Editor::set_playhead_cursor));
        reg_sens (editor_actions, "set-edit-point", _("Active Marker to Mouse"), sigc::mem_fun(*this, &Editor::set_edit_point));
+       reg_sens (editor_actions, "set-auto-punch-range", _("Set Auto Punch In/Out from Playhead"), sigc::mem_fun(*this, &Editor::set_auto_punch_range));
 
        reg_sens (editor_actions, "duplicate-range", _("Duplicate Range"), sigc::bind (sigc::mem_fun(*this, &Editor::duplicate_range), false));
 
@@ -365,7 +367,8 @@ Editor::register_actions ()
 
        reg_sens (editor_actions, "editor-fade-range", _("Fade Range Selection"), sigc::mem_fun(*this, &Editor::fade_range));
 
-       reg_sens (editor_actions, "set-tempo-from-edit-range", _("Set Tempo from Edit Range = Bar"), sigc::mem_fun(*this, &Editor::use_range_as_bar));
+       act = myactions.register_action (editor_actions, "set-tempo-from-edit-range", _("Set Tempo from Edit Range = Bar"), sigc::mem_fun(*this, &Editor::use_range_as_bar));
+       ActionManager::time_selection_sensitive_actions.push_back (act);
 
        toggle_reg_sens (editor_actions, "toggle-log-window", _("Log"),
                        sigc::mem_fun (ARDOUR_UI::instance(), &ARDOUR_UI::toggle_errors));
@@ -473,6 +476,13 @@ Editor::register_actions ()
 
        myactions.register_action (editor_actions, X_("cycle-zoom-focus"), _("Next Zoom Focus"), sigc::mem_fun (*this, &Editor::cycle_zoom_focus));
 
+       for (int i = 1; i <= 9; ++i) {
+               string const a = string_compose (X_("script-action-%1"), i);
+               string const n = string_compose (_("Unset #%1"), i);
+               act = myactions.register_action (editor_actions, a.c_str(), n.c_str(), sigc::bind (sigc::mem_fun (*this, &Editor::trigger_script), i - 1));
+               act->set_tooltip (_("no action bound"));
+               act->set_sensitive (false);
+       }
 
        Glib::RefPtr<ActionGroup> mouse_mode_actions = myactions.create_action_group (X_("MouseMode"));
        RadioAction::Group mouse_mode_group;
@@ -637,7 +647,7 @@ Editor::register_actions ()
                ruler_range_action->set_active (true);
                ruler_loop_punch_action->set_active (true);
                ruler_loop_punch_action->set_active (true);
-               ruler_bbt_action->set_active (false);
+               ruler_bbt_action->set_active (true);
                ruler_cd_marker_action->set_active (true);
                ruler_timecode_action->set_active (true);
                ruler_minsec_action->set_active (false);
@@ -738,12 +748,17 @@ Editor::register_actions ()
 
        myactions.register_action (editor_actions, X_("toggle-midi-input-active"), _("Toggle MIDI Input Active for Editor-Selected Tracks/Busses"),
                                   sigc::bind (sigc::mem_fun (*this, &Editor::toggle_midi_input_active), false));
+
+
+       /* MIDI stuff */
+       reg_sens (editor_actions, "quantize", _("Quantize"), sigc::mem_fun (*this, &Editor::quantize_region));
+
 }
 
 void
 Editor::load_bindings ()
 {
-       bindings = Bindings::get_bindings (X_("editor"), myactions);
+       bindings = Bindings::get_bindings (X_("Editor"), myactions);
        global_hpacker.set_data ("ardour-bindings", bindings);
 }
 
@@ -1703,19 +1718,6 @@ Editor::parameter_changed (std::string p)
                }
        } else if (p == "show-region-gain") {
                set_gain_envelope_visibility ();
-       } else if (p == "remote-model") {
-               if (_routes) {
-                       _routes->reset_remote_control_ids ();
-               }
-       } else if (p == "use-tooltips") {
-
-               /* this doesn't really belong here but it has to go somewhere */
-
-               if (UIConfiguration::instance().get_use_tooltips()) {
-                       Gtkmm2ext::enable_tooltips ();
-               } else {
-                       Gtkmm2ext::disable_tooltips ();
-               }
        } else if (p == "skip-playback") {
                Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-skip-playback"));
 
@@ -1729,12 +1731,6 @@ Editor::parameter_changed (std::string p)
        }
 }
 
-void
-Editor::reset_focus ()
-{
-       _track_canvas->grab_focus();
-}
-
 void
 Editor::reset_canvas_action_sensitivity (bool onoff)
 {
@@ -1834,7 +1830,7 @@ Editor::register_region_actions ()
                );
 
        /* Duplicate selected regions */
-       reg_sens (_region_actions, "duplicate-region", _("Duplicate"), sigc::bind (sigc::mem_fun (*this, &Editor::duplicate_range), false));
+       reg_sens (_region_actions, "duplicate-region", _("Duplicate"), sigc::bind (sigc::mem_fun (*this, &Editor::duplicate_regions), 1));
 
        /* Open the dialogue to duplicate selected regions multiple times */
        reg_sens (
@@ -1915,7 +1911,8 @@ Editor::register_region_actions ()
        reg_sens (_region_actions, "combine-regions", _("Combine"), sigc::mem_fun (*this, &Editor::combine_regions));
        reg_sens (_region_actions, "uncombine-regions", _("Uncombine"), sigc::mem_fun (*this, &Editor::uncombine_regions));
 
-       reg_sens (_region_actions, "analyze-region", _("Spectral Analysis..."), sigc::mem_fun (*this, &Editor::analyze_region_selection));
+       reg_sens (_region_actions, "loudness-analyze-region", _("Loudness Analysis..."), sigc::mem_fun (*this, &Editor::loudness_analyze_region_selection));
+       reg_sens (_region_actions, "spectral-analyze-region", _("Spectral Analysis..."), sigc::mem_fun (*this, &Editor::spectral_analyze_region_selection));
 
        reg_sens (_region_actions, "reset-region-gain-envelopes", _("Reset Envelope"), sigc::mem_fun (*this, &Editor::reset_region_gain_envelopes));
 
@@ -2022,6 +2019,6 @@ Editor::register_region_actions ()
        reg_sens (_region_actions, "choose-top-region", _("Choose Top..."), sigc::bind (sigc::mem_fun (*this, &Editor::change_region_layering_order), false));
        reg_sens (_region_actions, "choose-top-region-context-menu", _("Choose Top..."), sigc::bind (sigc::mem_fun (*this, &Editor::change_region_layering_order), true));
 
-       _all_region_actions_sensitized = true;
-
+       /* desensitize them all by default. region selection will change this */
+       sensitize_all_region_actions (false);
 }