summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-09-03 04:31:35 +0200
committerRobin Gareus <robin@gareus.org>2019-09-03 04:31:35 +0200
commitb340dc7282a3629929cd91223fe3505b2ad92c58 (patch)
treef55c77ca15fc393324a3d8a60536bf48abdb0f20 /gtk2_ardour
parentab68ed413117ae6ae08a33d453f98f42857433dc (diff)
Increase available Lua action script slots
* Reserve 32 dedicated editor actions for scripts * Limit number of toolbar buttons * Use dedicated binding-group for keyboard-shortcuts * Tweak Preferences layout of toolbar pane
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/ardour_ui.h5
-rw-r--r--gtk2_ardour/ardour_ui_dependents.cc9
-rw-r--r--gtk2_ardour/ardour_ui_options.cc2
-rw-r--r--gtk2_ardour/editor_actions.cc4
-rw-r--r--gtk2_ardour/rc_option_editor.cc12
5 files changed, 19 insertions, 13 deletions
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h
index 39c0546a7e..5425311e7c 100644
--- a/gtk2_ardour/ardour_ui.h
+++ b/gtk2_ardour/ardour_ui.h
@@ -178,7 +178,8 @@ namespace ArdourWidgets {
class Tabbable;
}
-#define MAX_LUA_ACTION_SCRIPTS 12
+#define MAX_LUA_ACTION_SCRIPTS 32
+#define MAX_LUA_ACTION_BUTTONS 12
class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr, public TransportControlProvider
{
@@ -527,7 +528,7 @@ private:
ArdourWidgets::ArdourButton feedback_alert_button;
ArdourWidgets::ArdourButton error_alert_button;
- ArdourWidgets::ArdourButton action_script_call_btn[MAX_LUA_ACTION_SCRIPTS];
+ ArdourWidgets::ArdourButton action_script_call_btn[MAX_LUA_ACTION_BUTTONS];
Gtk::Table action_script_table;
Gtk::VBox alert_box;
diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc
index 5e5d379e27..7ff9281a70 100644
--- a/gtk2_ardour/ardour_ui_dependents.cc
+++ b/gtk2_ardour/ardour_ui_dependents.cc
@@ -299,9 +299,9 @@ ARDOUR_UI::setup_windows ()
LuaInstance::instance()->ActionChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::update_action_script_btn));
- for (int i = 0; i < MAX_LUA_ACTION_SCRIPTS; ++i) {
+ for (int i = 0; i < MAX_LUA_ACTION_BUTTONS; ++i) {
std::string const a = string_compose (X_("script-action-%1"), i + 1);
- Glib::RefPtr<Action> act = ActionManager::get_action(X_("Editor"), a.c_str());
+ Glib::RefPtr<Action> act = ActionManager::get_action(X_("LuaAction"), a.c_str());
assert (act);
action_script_call_btn[i].set_text (string_compose ("%1", i+1));
action_script_call_btn[i].set_related_action (act);
@@ -414,6 +414,9 @@ ARDOUR_UI::bind_lua_action_script (GdkEventButton*ev, int i)
void
ARDOUR_UI::update_action_script_btn (int i, const std::string& n)
{
+ if (i < 0 || i >= MAX_LUA_ACTION_BUTTONS) {
+ 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);
@@ -422,7 +425,7 @@ ARDOUR_UI::update_action_script_btn (int i, const std::string& n)
}
std::string const a = string_compose (X_("script-action-%1"), i + 1);
- Glib::RefPtr<Action> act = ActionManager::get_action(X_("Editor"), a.c_str());
+ Glib::RefPtr<Action> act = ActionManager::get_action(X_("LuaAction"), a.c_str());
assert (act);
if (n.empty ()) {
act->set_label (string_compose (_("Unset #%1"), i + 1));
diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc
index 4be71ebb97..c11d71796d 100644
--- a/gtk2_ardour/ardour_ui_options.cc
+++ b/gtk2_ardour/ardour_ui_options.cc
@@ -449,7 +449,7 @@ ARDOUR_UI::parameter_changed (std::string p)
VisibilityTracker::set_use_window_manager_visibility (UIConfiguration::instance().get_use_wm_visibility());
} else if (p == "action-table-columns") {
const uint32_t cols = UIConfiguration::instance().get_action_table_columns ();
- for (int i = 0; i < MAX_LUA_ACTION_SCRIPTS; ++i) {
+ for (int i = 0; i < MAX_LUA_ACTION_BUTTONS; ++i) {
const int col = i / 2;
if (cols & (1<<col)) {
action_script_call_btn[i].show();
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index 76dba12ff7..1e9b4c46ef 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -482,10 +482,12 @@ Editor::register_actions ()
ActionManager::register_action (editor_actions, X_("cycle-zoom-focus"), _("Next Zoom Focus"), sigc::mem_fun (*this, &Editor::cycle_zoom_focus));
+ Glib::RefPtr<ActionGroup> lua_script_actions = ActionManager::create_action_group (bindings, X_("LuaAction"));
+
for (int i = 1; i <= MAX_LUA_ACTION_SCRIPTS; ++i) {
string const a = string_compose (X_("script-action-%1"), i);
string const n = string_compose (_("Unset #%1"), i);
- act = ActionManager::register_action (editor_actions, a.c_str(), n.c_str(), sigc::bind (sigc::mem_fun (*this, &Editor::trigger_script), i - 1));
+ act = ActionManager::register_action (lua_script_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);
}
diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc
index de2e24f7e3..1e81186424 100644
--- a/gtk2_ardour/rc_option_editor.cc
+++ b/gtk2_ardour/rc_option_editor.cc
@@ -1688,9 +1688,9 @@ class ColumVisibilityOption : public Option
{
cb = (CheckButton**) malloc (sizeof (CheckButton*) * n_col);
for (uint32_t i = 0; i < n_col; ++i) {
- CheckButton* col = manage (new CheckButton (string_compose (_("Column %1"), i + 1)));
+ CheckButton* col = manage (new CheckButton (string_compose (_("Column %1 (Actions %2 + %3)"), i + 1, i * 2 + 1, i * 2 + 2)));
col->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &ColumVisibilityOption::column_toggled), i));
- _hbox.pack_start (*col);
+ _vbox.pack_start (*col);
cb[i] = col;
}
parameter_changed (id);
@@ -1700,7 +1700,7 @@ class ColumVisibilityOption : public Option
free (cb);
}
- Gtk::Widget& tip_widget() { return _hbox; }
+ Gtk::Widget& tip_widget() { return _vbox; }
void set_state_from_config ()
{
@@ -1716,7 +1716,7 @@ class ColumVisibilityOption : public Option
void add_to_page (OptionEditorPage* p)
{
_heading.add_to_page (p);
- add_widget_to_page (p, &_hbox);
+ add_widget_to_page (p, &_vbox);
}
private:
@@ -1733,7 +1733,7 @@ class ColumVisibilityOption : public Option
}
}
- HBox _hbox;
+ VBox _vbox;
OptionEditorHeading _heading;
CheckButton** cb;
@@ -3911,7 +3911,7 @@ RCOptionEditor::RCOptionEditor ()
add_option (_("Appearance/Toolbar"),
new ColumVisibilityOption (
- "action-table-columns", _("Display Action-Buttons"), 4,
+ "action-table-columns", _("Display Action-Buttons"), MAX_LUA_ACTION_BUTTONS / 2,
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_action_table_columns),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_action_table_columns)
)