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
This commit is contained in:
parent
ab68ed4131
commit
b340dc7282
@ -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;
|
||||
|
@ -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));
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user