13
0

Update key-bindings for all Lua action scripts #8034

This commit is contained in:
Robin Gareus 2020-04-24 02:31:30 +02:00
parent dbcbfd7b5b
commit 2d50c3f907
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 12 additions and 9 deletions

View File

@ -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 ();
};

View File

@ -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,17 +424,20 @@ 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 (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);
Glib::RefPtr<Action> act = ActionManager::get_action(X_("LuaAction"), a.c_str());