X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor_actions.cc;h=79900b35174c3db546564b035700bc9c7a596b1f;hb=5583929a3491075df4e1862579e8df7318dc7370;hp=046d9b94e111e1a825f9ac1d1dea024946039075;hpb=2532911b18ff8b1c92c053a542fbd1d7eeed31de;p=ardour.git diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 046d9b94e1..79900b3517 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -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" @@ -153,8 +153,6 @@ Editor::register_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. */ @@ -367,7 +365,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)); @@ -475,12 +474,12 @@ Editor::register_actions () myactions.register_action (editor_actions, X_("cycle-zoom-focus"), _("Next Zoom Focus"), sigc::mem_fun (*this, &Editor::cycle_zoom_focus)); - act = reg_sens (editor_actions, "manage-action-scripts", _("Manage"), - sigc::mem_fun(*this, &Editor::manage_action_scripts)); 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); - reg_sens (editor_actions, a.c_str(), n.c_str(), sigc::bind (sigc::mem_fun (*this, &Editor::trigger_script), i - 1)); + 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 mouse_mode_actions = myactions.create_action_group (X_("MouseMode")); @@ -646,7 +645,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); @@ -752,7 +751,7 @@ Editor::register_actions () 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); } @@ -1712,19 +1711,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 act = ActionManager::get_action (X_("Editor"), X_("toggle-skip-playback")); @@ -1739,9 +1725,40 @@ Editor::parameter_changed (std::string p) } void -Editor::reset_focus () +Editor::reset_focus (Gtk::Widget* w) { - _track_canvas->grab_focus(); + /* this resets focus to the first focusable parent of the given widget, + * or, if there is no focusable parent, cancels focus in the toplevel + * window that the given widget is packed into (if there is one). + */ + + if (!w) { + return; + } + + Gtk::Widget* top = w->get_toplevel(); + + if (!top || !top->is_toplevel()) { + return; + } + + w = w->get_parent (); + + while (w) { + if (w->get_can_focus ()) { + Window* win = dynamic_cast (top); + win->set_focus (*w); + return; + } + w = w->get_parent (); + } + + /* no focusable parent found, cancel focus in top level window. + C++ API cannot be used for this. Thanks, references. + */ + + gtk_window_set_focus (GTK_WINDOW(top->gobj()), 0); + } void @@ -1924,7 +1941,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)); @@ -2031,6 +2049,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); }