diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index f7b30e2d18..14d05df344 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -664,8 +664,6 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param, control_ui->label.set_name ("PluginParameterLabel"); control_ui->set_spacing (5); - Gtk::Requisition req (control_ui->automate_button.size_request()); - if (is_input) { if (desc.datatype == Variant::PATH) { @@ -764,7 +762,9 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param, assert(but); but->set_tweaks(ArdourButton::Square); } else if (use_knob) { - control_ui->controller->set_size_request (req.height * 1.5, req.height * 1.5); + /* Delay size request so that styles are gotten right */ + control_ui->controller->widget()->signal_size_request().connect( + sigc::bind (sigc::mem_fun (*this, &GenericPluginUI::knob_size_request), control_ui)); } else { control_ui->controller->set_size_request (200, -1); control_ui->controller->set_name (X_("ProcessorControlSlider")); @@ -937,6 +937,15 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param, return control_ui; } +void +GenericPluginUI::knob_size_request(Gtk::Requisition* req, ControlUI* cui) { + Gtk::Requisition astate_req (cui->automate_button.size_request()); + const int size = (int) (astate_req.height * 1.5); + req->width = max(req->width, size); + req->height = max(req->height, size); +} + + bool GenericPluginUI::astate_button_event (GdkEventButton* ev, ControlUI* cui) { diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index 57aa138af7..4fb052b5f5 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -292,6 +292,8 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox void set_automation_state (ARDOUR::AutoState state, ControlUI* cui); void set_all_automation (ARDOUR::AutoState state); + void knob_size_request(Gtk::Requisition* req, ControlUI* cui); + /* XXX: remove */ void print_parameter (char *buf, uint32_t len, uint32_t param); bool integer_printer (char* buf, Gtk::Adjustment &, ControlUI *);