Add API to report if plugin UI has any controls

This commit is contained in:
Robin Gareus 2024-11-27 00:50:00 +01:00
parent 9095f2fde3
commit 09216ef5d5
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 12 additions and 0 deletions

View file

@ -89,6 +89,7 @@ GenericPluginUI::GenericPluginUI (std::shared_ptr<PlugInsertBase> pib, bool scro
, automation_menu (0)
, is_scrollable(scrollable)
, want_ctrl_only(ctrls_only)
, _empty (true)
, _plugin_pianokeyboard_expander (_("MIDI Keyboard (audition only)"))
, _piano (0)
, _piano_velocity (*manage (new Adjustment (100, 1, 127, 1, 16)))
@ -401,6 +402,7 @@ GenericPluginUI::build ()
if (has_descriptive_presets ()) {
preset_gui = new PluginPresetsUI (_pi); // XXX
hpacker.pack_start (*preset_gui, true, true);
_empty = false;
if (is_scrollable) {
preset_gui->show_all ();
GtkRequisition request = preset_gui->size_request();
@ -624,6 +626,9 @@ GenericPluginUI::automatic_layout (const std::vector<ControlUI*>& control_uis)
box->pack_start (*cui, false, false);
}
if (i > 0) {
_empty = false;
}
if (is_scrollable && i > 0) {
prefheight = 30 * i * UIConfiguration::instance().get_ui_scale();
}
@ -637,6 +642,7 @@ GenericPluginUI::automatic_layout (const std::vector<ControlUI*>& control_uis)
delete button_table;
} else {
button_table->show_all ();
_empty = false;
}
if (!output_table->children().empty()) {
@ -646,6 +652,7 @@ GenericPluginUI::automatic_layout (const std::vector<ControlUI*>& control_uis)
frame->add (*output_table);
hpacker.pack_end (*frame, true, true);
output_table->show_all ();
_empty = false;
} else {
delete output_table;
}
@ -653,6 +660,7 @@ GenericPluginUI::automatic_layout (const std::vector<ControlUI*>& control_uis)
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);
_empty = false;
}
show_all();
@ -691,6 +699,8 @@ GenericPluginUI::build_midi_table ()
pgm_table->attach (*cui, col + 1, col + 2, row, row+1, SHRINK, SHRINK);
}
_empty = false;
if (is_scrollable) {
frame->show_all ();
GtkRequisition request = frame->size_request();

View file

@ -223,6 +223,7 @@ public:
gint get_preferred_height () { return prefheight; }
gint get_preferred_width () { return -1; }
bool empty () const { return _empty; }
bool start_updating(GdkEventAny*);
bool stop_updating(GdkEventAny*);
@ -236,6 +237,7 @@ private:
gint prefheight;
bool is_scrollable;
bool want_ctrl_only;
bool _empty;
struct MeterInfo {
ArdourWidgets::FastMeter* meter;