From d6b5c23579dc02d2f98fc1f48bf038c1070057fb Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 5 Dec 2018 20:18:56 +0100 Subject: [PATCH] Fix generic plugin UI for plugins with only properties e.g. reMID.lv2 has only a atom/file-property and no control-inputs. --- gtk2_ardour/generic_pluginui.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index b930c14b85..e2a4daefdb 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -199,7 +199,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr pi, bool scrol main_contents.pack_start (scroller, true, true); - prefheight = 0; + prefheight = -1; build (); if (insert->plugin()->has_midnam() && insert->plugin()->knows_bank_patch()) { @@ -317,7 +317,8 @@ void GenericPluginUI::build () { std::vector control_uis; - bool grid = plugin->parameter_count() > 0; + bool grid_avail = false; + bool grid_veto = false; // Build a ControlUI for each control port for (size_t i = 0; i < plugin->parameter_count(); ++i) { @@ -340,8 +341,10 @@ GenericPluginUI::build () ControlUI* cui; Plugin::UILayoutHint hint; - if (!plugin->get_layout(i, hint)) { - grid = false; + if (plugin->get_layout(i, hint)) { + grid_avail = true; + } else { + grid_veto = true; } boost::shared_ptr c @@ -355,7 +358,7 @@ GenericPluginUI::build () continue; } - if (grid) { + if (grid_avail && !grid_veto) { cui->x0 = hint.x0; cui->x1 = hint.x1; cui->y0 = hint.y0; @@ -371,6 +374,8 @@ GenericPluginUI::build () } } + bool grid = grid_avail && !grid_veto; + // Build a ControlUI for each property const Plugin::PropertyDescriptors& descs = plugin->get_supported_properties(); for (Plugin::PropertyDescriptors::const_iterator d = descs.begin(); d != descs.end(); ++d) { @@ -605,7 +610,7 @@ GenericPluginUI::automatic_layout (const std::vector& control_uis) box->pack_start (*cui, false, false); } - if (is_scrollable) { + if (is_scrollable && i > 0) { prefheight = 30 * i; }