13
0

Add option to only show controls in generic plugin UI

The intention here is to show a minimal UI in the
Route Property Box
This commit is contained in:
Robin Gareus 2024-11-19 17:18:59 +01:00
parent 4a966d5015
commit 3c5681b2c9
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 14 additions and 8 deletions

View File

@ -84,10 +84,11 @@ using namespace ArdourWidgets;
using namespace Gtk;
using namespace ARDOUR_UI_UTILS;
GenericPluginUI::GenericPluginUI (std::shared_ptr<PlugInsertBase> pib, bool scrollable)
GenericPluginUI::GenericPluginUI (std::shared_ptr<PlugInsertBase> 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<PlugInsertBase> 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<PlugInsertBase> 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<PlugInsertBase> pib, bool scro
settings_box.pack_start (*automation_hbox, false, false, 6);
}
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<Processor>(_pi)), gui_context());
@ -498,7 +503,7 @@ GenericPluginUI::automatic_layout (const std::vector<ControlUI*>& 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<ControlUI*>& 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);
}

View File

@ -219,7 +219,7 @@ private:
class GenericPluginUI : public PlugUIBase, public Gtk::VBox
{
public:
GenericPluginUI (std::shared_ptr<ARDOUR::PlugInsertBase> plug, bool scrollable=false);
GenericPluginUI (std::shared_ptr<ARDOUR::PlugInsertBase> 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;