diff options
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 3 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui2.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_dependents.cc | 13 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_options.cc | 10 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_actions.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/rc_option_editor.cc | 74 | ||||
-rw-r--r-- | gtk2_ardour/ui_config_vars.h | 1 |
8 files changed, 108 insertions, 2 deletions
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 0b61619eff..224b85bd13 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -519,6 +519,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr ArdourButton feedback_alert_button; ArdourButton error_alert_button; + ArdourButton action_script_call_btn[10]; + Gtk::Table action_script_table; + Gtk::VBox alert_box; Gtk::VBox meter_box; LevelMeterHBox * editor_meter; diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 1395037347..f251ccdfa3 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -431,6 +431,7 @@ ARDOUR_UI::setup_transport () window_button_box->pack_start (prefs_visibility_button, true, false); transport_hbox.pack_end (*window_button_box, false, false); + transport_hbox.pack_end (action_script_table, false, false); /* desensitize */ diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index b67b3a83bb..55d352bd0b 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -303,6 +303,19 @@ ARDOUR_UI::setup_windows () main_vpacker.pack_start (status_bar_hpacker, false, false); #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(); build_menu_bar (); setup_tooltips (); diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index 7e098cab38..a0e6384b23 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -424,6 +424,16 @@ ARDOUR_UI::parameter_changed (std::string p) } else if (p == "waveform-cache-size") { /* 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); + } 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(); + } + } } } diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 2ee4793736..959cdd4e5c 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -5746,8 +5746,10 @@ Editor::set_script_action_name (int i, const std::string& n) assert (act); if (n.empty ()) { act->set_label (string_compose (_("Unset #%1"), i + 1)); + act->set_tooltip (_("(no action bound")); } else { act->set_label (n); + act->set_tooltip (n); } KeyEditor::UpdateBindings (); } diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index da1a9159aa..d79e382f9f 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -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)); - 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)); + for (int i = 1; i <= 9; ++i) { string const a = string_compose (X_("script-action-%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")); diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 8f80c473b7..f729c98d48 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -1718,6 +1718,72 @@ private: 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 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) )); + 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"))); ComboOption<float>* mht = new ComboOption<float> ( diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index f93a9968a4..1efbfdf77f 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -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, 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 (uint32_t, action_table_columns, "action-table-columns", 0) |