From 92e203a19e55c445a7051c7148a659c3507c2770 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 18 Feb 2017 16:14:41 +0100 Subject: Consolidate ActionChanged callbacks, add tooltips --- gtk2_ardour/ardour_ui_dependents.cc | 17 ++++++++++++++++- gtk2_ardour/editor.cc | 21 --------------------- gtk2_ardour/editor.h | 2 -- 3 files changed, 16 insertions(+), 24 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index 0971952d26..0c052924bd 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -41,6 +41,7 @@ #include "luawindow.h" #include "mixer_ui.h" #include "keyboard.h" +#include "keyeditor.h" #include "splash.h" #include "rc_option_editor.h" #include "route_params_ui.h" @@ -419,7 +420,7 @@ ARDOUR_UI::bind_lua_action_script (GdkEventButton*ev, int i) } void -ARDOUR_UI::update_action_script_btn (int i, const std::string&) +ARDOUR_UI::update_action_script_btn (int i, const std::string& n) { if (LuaInstance::instance()->lua_action_has_icon (i)) { uintptr_t ii = i; @@ -427,4 +428,18 @@ ARDOUR_UI::update_action_script_btn (int i, const std::string&) } else { action_script_call_btn[i].set_icon (0, 0); } + + std::string const a = string_compose (X_("script-action-%1"), i + 1); + Glib::RefPtr act = ActionManager::get_action(X_("Editor"), a.c_str()); + assert (act); + if (n.empty ()) { + act->set_label (string_compose (_("Unset #%1"), i + 1)); + act->set_tooltip (_("No action bound\nRight-click to assign")); + act->set_sensitive (false); + } else { + act->set_label (n); + act->set_tooltip (string_compose (_("%1\n\nClick to run\nRight-click to re-assign\nShift+right-click to unassign"), n)); + act->set_sensitive (true); + } + KeyEditor::UpdateBindings (); } diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 512e9ef58e..bb769e30ef 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -112,7 +112,6 @@ #include "gui_object.h" #include "gui_thread.h" #include "keyboard.h" -#include "keyeditor.h" #include "luainstance.h" #include "marker.h" #include "midi_region_view.h" @@ -869,8 +868,6 @@ Editor::Editor () setup_fade_images (); - LuaInstance::instance()->ActionChanged.connect (sigc::mem_fun (*this, &Editor::set_script_action_name)); - instant_save (); } @@ -5876,24 +5873,6 @@ Editor::trigger_script (int i) LuaInstance::instance()-> call_action (i); } -void -Editor::set_script_action_name (int i, const std::string& n) -{ - string const a = string_compose (X_("script-action-%1"), i + 1); - Glib::RefPtr act = ActionManager::get_action(X_("Editor"), a.c_str()); - assert (act); - if (n.empty ()) { - act->set_label (string_compose (_("Unset #%1"), i + 1)); - act->set_tooltip (_("no action bound")); - act->set_sensitive (false); - } else { - act->set_label (n); - act->set_tooltip (n); - act->set_sensitive (true); - } - KeyEditor::UpdateBindings (); -} - void Editor::show_editor_list (bool yn) { diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index fb1e4b4bdc..458753d638 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1640,8 +1640,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void initialize_canvas (); - void set_script_action_name (int i, const std::string&); - /* display control */ bool _show_measures; -- cgit v1.2.3