mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
add optional buttons to trigger lua scripted actions.
This commit is contained in:
parent
55fb20f491
commit
9c622e3c99
8 changed files with 108 additions and 2 deletions
|
|
@ -519,6 +519,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
||||||
ArdourButton feedback_alert_button;
|
ArdourButton feedback_alert_button;
|
||||||
ArdourButton error_alert_button;
|
ArdourButton error_alert_button;
|
||||||
|
|
||||||
|
ArdourButton action_script_call_btn[10];
|
||||||
|
Gtk::Table action_script_table;
|
||||||
|
|
||||||
Gtk::VBox alert_box;
|
Gtk::VBox alert_box;
|
||||||
Gtk::VBox meter_box;
|
Gtk::VBox meter_box;
|
||||||
LevelMeterHBox * editor_meter;
|
LevelMeterHBox * editor_meter;
|
||||||
|
|
|
||||||
|
|
@ -431,6 +431,7 @@ ARDOUR_UI::setup_transport ()
|
||||||
window_button_box->pack_start (prefs_visibility_button, true, false);
|
window_button_box->pack_start (prefs_visibility_button, true, false);
|
||||||
|
|
||||||
transport_hbox.pack_end (*window_button_box, false, false);
|
transport_hbox.pack_end (*window_button_box, false, false);
|
||||||
|
transport_hbox.pack_end (action_script_table, false, false);
|
||||||
|
|
||||||
/* desensitize */
|
/* desensitize */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -303,6 +303,19 @@ ARDOUR_UI::setup_windows ()
|
||||||
main_vpacker.pack_start (status_bar_hpacker, false, false);
|
main_vpacker.pack_start (status_bar_hpacker, false, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
for (int i = 0; i < 9; ++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());
|
||||||
|
assert (act);
|
||||||
|
action_script_call_btn[i].set_text (string_compose ("%1", i+1));
|
||||||
|
action_script_call_btn[i].set_related_action (act);
|
||||||
|
const int row = i % 3;
|
||||||
|
const int col = i / 3;
|
||||||
|
action_script_table.attach (action_script_call_btn[i], col, col + 1, row, row + 1, EXPAND, EXPAND, 1, 1);
|
||||||
|
action_script_call_btn[i].set_no_show_all ();
|
||||||
|
}
|
||||||
|
action_script_table.show ();
|
||||||
|
|
||||||
setup_transport();
|
setup_transport();
|
||||||
build_menu_bar ();
|
build_menu_bar ();
|
||||||
setup_tooltips ();
|
setup_tooltips ();
|
||||||
|
|
|
||||||
|
|
@ -424,6 +424,16 @@ ARDOUR_UI::parameter_changed (std::string p)
|
||||||
} else if (p == "waveform-cache-size") {
|
} else if (p == "waveform-cache-size") {
|
||||||
/* GUI option has units of megabytes; image cache uses units of bytes */
|
/* GUI option has units of megabytes; image cache uses units of bytes */
|
||||||
ArdourCanvas::WaveView::set_image_cache_size (UIConfiguration::instance().get_waveform_cache_size() * 1048576);
|
ArdourCanvas::WaveView::set_image_cache_size (UIConfiguration::instance().get_waveform_cache_size() * 1048576);
|
||||||
|
} else if (p == "action-table-columns") {
|
||||||
|
const uint32_t cols = UIConfiguration::instance().get_action_table_columns ();
|
||||||
|
for (int i = 0; i < 9; ++i) {
|
||||||
|
const int col = i / 3;
|
||||||
|
if (cols & (1<<col)) {
|
||||||
|
action_script_call_btn[i].show();
|
||||||
|
} else {
|
||||||
|
action_script_call_btn[i].hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5746,8 +5746,10 @@ Editor::set_script_action_name (int i, const std::string& n)
|
||||||
assert (act);
|
assert (act);
|
||||||
if (n.empty ()) {
|
if (n.empty ()) {
|
||||||
act->set_label (string_compose (_("Unset #%1"), i + 1));
|
act->set_label (string_compose (_("Unset #%1"), i + 1));
|
||||||
|
act->set_tooltip (_("(no action bound"));
|
||||||
} else {
|
} else {
|
||||||
act->set_label (n);
|
act->set_label (n);
|
||||||
|
act->set_tooltip (n);
|
||||||
}
|
}
|
||||||
KeyEditor::UpdateBindings ();
|
KeyEditor::UpdateBindings ();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -475,12 +475,14 @@ Editor::register_actions ()
|
||||||
|
|
||||||
myactions.register_action (editor_actions, X_("cycle-zoom-focus"), _("Next Zoom Focus"), sigc::mem_fun (*this, &Editor::cycle_zoom_focus));
|
myactions.register_action (editor_actions, X_("cycle-zoom-focus"), _("Next Zoom Focus"), sigc::mem_fun (*this, &Editor::cycle_zoom_focus));
|
||||||
|
|
||||||
act = reg_sens (editor_actions, "manage-action-scripts", _("Manage"),
|
reg_sens (editor_actions, "manage-action-scripts", _("Manage"),
|
||||||
sigc::mem_fun(*this, &Editor::manage_action_scripts));
|
sigc::mem_fun(*this, &Editor::manage_action_scripts));
|
||||||
|
|
||||||
for (int i = 1; i <= 9; ++i) {
|
for (int i = 1; i <= 9; ++i) {
|
||||||
string const a = string_compose (X_("script-action-%1"), i);
|
string const a = string_compose (X_("script-action-%1"), i);
|
||||||
string const n = string_compose (_("Unset #%1"), i);
|
string const n = string_compose (_("Unset #%1"), i);
|
||||||
reg_sens (editor_actions, a.c_str(), n.c_str(), sigc::bind (sigc::mem_fun (*this, &Editor::trigger_script), i - 1));
|
act = reg_sens (editor_actions, a.c_str(), n.c_str(), sigc::bind (sigc::mem_fun (*this, &Editor::trigger_script), i - 1));
|
||||||
|
act->set_tooltip (_("(no action bound"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::RefPtr<ActionGroup> mouse_mode_actions = myactions.create_action_group (X_("MouseMode"));
|
Glib::RefPtr<ActionGroup> mouse_mode_actions = myactions.create_action_group (X_("MouseMode"));
|
||||||
|
|
|
||||||
|
|
@ -1718,6 +1718,72 @@ private:
|
||||||
Button _xjadeo_browse_button;
|
Button _xjadeo_browse_button;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ColumVisibilityOption : public Option
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ColumVisibilityOption (string id, string name, uint32_t n_col, sigc::slot<uint32_t> get, sigc::slot<bool, uint32_t> set)
|
||||||
|
: Option (id, name)
|
||||||
|
, _heading (name)
|
||||||
|
, _n_col (n_col)
|
||||||
|
, _get (get)
|
||||||
|
, _set (set)
|
||||||
|
{
|
||||||
|
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)));
|
||||||
|
col->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &ColumVisibilityOption::column_toggled), i));
|
||||||
|
_hbox.pack_start (*col);
|
||||||
|
cb[i] = col;
|
||||||
|
}
|
||||||
|
parameter_changed (id);
|
||||||
|
}
|
||||||
|
|
||||||
|
~ColumVisibilityOption () {
|
||||||
|
free (cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
Gtk::Widget& tip_widget() { return _hbox; }
|
||||||
|
|
||||||
|
void set_state_from_config ()
|
||||||
|
{
|
||||||
|
uint32_t c = _get();
|
||||||
|
for (uint32_t i = 0; i < _n_col; ++i) {
|
||||||
|
bool en = (c & (1<<i)) ? true : false;
|
||||||
|
if (cb[i]->get_active () != en) {
|
||||||
|
cb[i]->set_active (en);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void add_to_page (OptionEditorPage* p)
|
||||||
|
{
|
||||||
|
_heading.add_to_page (p);
|
||||||
|
add_widget_to_page (p, &_hbox);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
|
||||||
|
void column_toggled (int b) {
|
||||||
|
uint32_t c = _get();
|
||||||
|
uint32_t cc = c;
|
||||||
|
if (cb[b]->get_active ()) {
|
||||||
|
c |= (1<<b);
|
||||||
|
} else {
|
||||||
|
c &= ~(1<<b);
|
||||||
|
}
|
||||||
|
if (cc != c) {
|
||||||
|
_set (c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HBox _hbox;
|
||||||
|
OptionEditorHeading _heading;
|
||||||
|
|
||||||
|
CheckButton** cb;
|
||||||
|
uint32_t _n_col;
|
||||||
|
sigc::slot<uint32_t> _get;
|
||||||
|
sigc::slot<bool, uint32_t> _set;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/** A class which allows control of visibility of some editor components usign
|
/** A class which allows control of visibility of some editor components usign
|
||||||
* a VisibilityGroup. The caller should pass in a `dummy' VisibilityGroup
|
* a VisibilityGroup. The caller should pass in a `dummy' VisibilityGroup
|
||||||
|
|
@ -3073,6 +3139,14 @@ if (!ARDOUR::Profile->get_mixbus()) {
|
||||||
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_default_narrow_ms)
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_default_narrow_ms)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
add_option (S_("Preferences|GUI"),
|
||||||
|
new ColumVisibilityOption (
|
||||||
|
"action-table-columns", _("Action Script Button Visibility"), 3,
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_action_table_columns),
|
||||||
|
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_action_table_columns)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
add_option (S_("Preferences|Metering"), new OptionEditorHeading (_("Metering")));
|
add_option (S_("Preferences|Metering"), new OptionEditorHeading (_("Metering")));
|
||||||
|
|
||||||
ComboOption<float>* mht = new ComboOption<float> (
|
ComboOption<float>* mht = new ComboOption<float> (
|
||||||
|
|
|
||||||
|
|
@ -80,3 +80,4 @@ UI_CONFIG_VARIABLE (std::string, xjadeo_binary, "xjadeo-binary", "")
|
||||||
UI_CONFIG_VARIABLE (bool, open_gui_after_adding_plugin, "open-gui-after-adding-plugin", true)
|
UI_CONFIG_VARIABLE (bool, open_gui_after_adding_plugin, "open-gui-after-adding-plugin", true)
|
||||||
UI_CONFIG_VARIABLE (bool, show_inline_display_by_default, "show-inline-display-by-default", true)
|
UI_CONFIG_VARIABLE (bool, show_inline_display_by_default, "show-inline-display-by-default", true)
|
||||||
UI_CONFIG_VARIABLE (bool, prefer_inline_over_gui, "prefer-inline-over-gui", true)
|
UI_CONFIG_VARIABLE (bool, prefer_inline_over_gui, "prefer-inline-over-gui", true)
|
||||||
|
UI_CONFIG_VARIABLE (uint32_t, action_table_columns, "action-table-columns", 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue