From 3c5681b2c93ca2a880e642ba1a689dd42e632c59 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 19 Nov 2024 17:18:59 +0100 Subject: [PATCH] Add option to only show controls in generic plugin UI The intention here is to show a minimal UI in the Route Property Box --- gtk2_ardour/generic_pluginui.cc | 19 ++++++++++++------- gtk2_ardour/plugin_ui.h | 3 ++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index e90d3b2502..d1a52ef813 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -84,10 +84,11 @@ using namespace ArdourWidgets; using namespace Gtk; using namespace ARDOUR_UI_UTILS; -GenericPluginUI::GenericPluginUI (std::shared_ptr pib, bool scrollable) +GenericPluginUI::GenericPluginUI (std::shared_ptr pib, bool scrollable, bool ctrls_only) : PlugUIBase (pib) , automation_menu (0) , is_scrollable(scrollable) + , want_ctrl_only(ctrls_only) , _plugin_pianokeyboard_expander (_("MIDI Keyboard (audition only)")) , _piano (0) , _piano_velocity (*manage (new Adjustment (100, 1, 127, 1, 16))) @@ -121,7 +122,9 @@ GenericPluginUI::GenericPluginUI (std::shared_ptr pib, bool scro automation_latch_all_button.set_text (GainMeterBase::astate_string (ARDOUR::Latch)); automation_latch_all_button.set_name (X_("generic button")); - if (_pib->ui_elements () & PlugInsertBase::MIDIKeyboard) { + if (ctrls_only) { + // relax + } else if (_pib->ui_elements () & PlugInsertBase::MIDIKeyboard) { _piano = new APianoKeyboard (); _piano->set_can_focus (); @@ -149,11 +152,11 @@ GenericPluginUI::GenericPluginUI (std::shared_ptr pib, bool scro pack_end (plugin_analysis_expander, false, false); } - if (_pib->provides_stats ()) { + if (!ctrls_only && _pib->provides_stats ()) { pack_end (cpuload_expander, false, false); } - if (!plugin->get_docs().empty()) { + if (!ctrls_only && !plugin->get_docs().empty()) { pack_end (description_expander, false, false); } @@ -175,7 +178,9 @@ GenericPluginUI::GenericPluginUI (std::shared_ptr pib, bool scro settings_box.pack_start (*automation_hbox, false, false, 6); } - main_contents.pack_start (settings_box, false, false); + if (!ctrls_only) { + main_contents.pack_start (settings_box, false, false); + } if (_pi) { _pi->ActiveChanged.connect (active_connection, invalidator (*this), std::bind (&GenericPluginUI::processor_active_changed, this, std::weak_ptr(_pi)), gui_context()); @@ -498,7 +503,7 @@ GenericPluginUI::automatic_layout (const std::vector& control_uis) // we can lay them out a bit more nicely later. cui_controls_list.push_back(cui); - } else if (cui->display) { + } else if (cui->display && !want_ctrl_only) { output_table->attach (*cui, output_col, output_col + 1, output_row, output_row+1, FILL|EXPAND, FILL); @@ -619,7 +624,7 @@ GenericPluginUI::automatic_layout (const std::vector& control_uis) delete output_table; } - if (plugin->has_inline_display () && plugin->inline_display_in_gui ()) { + if (!want_ctrl_only && plugin->has_inline_display () && plugin->inline_display_in_gui ()) { PluginDisplay* pd = manage (new PluginDisplay (plugin, 300)); hpacker.pack_end (*pd, true, true); } diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index 4503c30bd8..8a4e1dc80c 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -219,7 +219,7 @@ private: class GenericPluginUI : public PlugUIBase, public Gtk::VBox { public: - GenericPluginUI (std::shared_ptr plug, bool scrollable=false); + GenericPluginUI (std::shared_ptr plug, bool scrollable = false, bool ctrls_only = false); ~GenericPluginUI (); gint get_preferred_height () { return prefheight; } @@ -236,6 +236,7 @@ private: gint prefheight; bool is_scrollable; + bool want_ctrl_only; struct MeterInfo { ArdourWidgets::FastMeter* meter;