From 2d50c3f907d2ad621bd175a3b91849980aec117a Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 24 Apr 2020 02:31:30 +0200 Subject: [PATCH] Update key-bindings for all Lua action scripts #8034 --- gtk2_ardour/ardour_ui.h | 2 +- gtk2_ardour/ardour_ui_dependents.cc | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 54cdb2a6eb..f91dc03b54 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -900,7 +900,7 @@ private: void close_current_dialog (); bool bind_lua_action_script (GdkEventButton*, int); - void update_action_script_btn (int i, const std::string&); + void action_script_changed (int i, const std::string&); void ask_about_scratch_deletion (); }; diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index 64640e369e..d427a489aa 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -302,7 +302,7 @@ ARDOUR_UI::setup_windows () main_vpacker.pack_start (transport_frame, false, false); main_vpacker.pack_start (_tabs, true, true); - LuaInstance::instance()->ActionChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::update_action_script_btn)); + LuaInstance::instance()->ActionChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::action_script_changed)); for (int i = 0; i < MAX_LUA_ACTION_BUTTONS; ++i) { std::string const a = string_compose (X_("script-action-%1"), i + 1); @@ -424,16 +424,19 @@ ARDOUR_UI::bind_lua_action_script (GdkEventButton*ev, int i) } void -ARDOUR_UI::update_action_script_btn (int i, const std::string& n) +ARDOUR_UI::action_script_changed (int i, const std::string& n) { - if (i < 0 || i >= MAX_LUA_ACTION_BUTTONS) { + if (i < 0 || i >= MAX_LUA_ACTION_SCRIPTS) { return; } - if (LuaInstance::instance()->lua_action_has_icon (i)) { - uintptr_t ii = i; - action_script_call_btn[i].set_icon (&LuaInstance::render_action_icon, (void*)ii); - } else { - action_script_call_btn[i].set_icon (0, 0); + + if (i < MAX_LUA_ACTION_BUTTONS) { + if (LuaInstance::instance()->lua_action_has_icon (i)) { + uintptr_t ii = i; + action_script_call_btn[i].set_icon (&LuaInstance::render_action_icon, (void*)ii); + } else { + action_script_call_btn[i].set_icon (0, 0); + } } std::string const a = string_compose (X_("script-action-%1"), i + 1);