X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fgeneric_pluginui.cc;h=fdf0d62482d86cd7a85a806afbf31935e6fb3d77;hb=d08e3b94c5ef75ce5d4d28f3636faa8af4661e17;hp=30a12aeb0e64923114f5db0034151f0dde92c052;hpb=6e904b1e1600f4ccc0338d0b0864f7e02d417b13;p=ardour.git diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index 30a12aeb0e..fdf0d62482 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -78,11 +78,12 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr pi, bool scrol set_border_width (10); //set_homogeneous (false); - pack_start(main_contents); + pack_start (main_contents, false, false); settings_box.set_homogeneous (false); HBox* constraint_hbox = manage (new HBox); HBox* smaller_hbox = manage (new HBox); + smaller_hbox->set_spacing (4); Label* combo_label = manage (new Label (_("Presets"))); combo_label->set_use_markup (true); @@ -91,8 +92,10 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr pi, bool scrol set_latency_label (); smaller_hbox->pack_start (latency_button, false, false, 10); - smaller_hbox->pack_start (preset_combo, false, false); + smaller_hbox->pack_start (_preset_box, false, false); + smaller_hbox->pack_start (add_button, false, false); smaller_hbox->pack_start (save_button, false, false); + smaller_hbox->pack_start (delete_button, false, false); smaller_hbox->pack_start (bypass_button, false, true); constraint_hbox->set_spacing (5); @@ -100,7 +103,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr pi, bool scrol VBox* v1_box = manage (new VBox); VBox* v2_box = manage (new VBox); - pack_end(plugin_analysis_expander); + pack_end (plugin_analysis_expander, true, true); v1_box->pack_start (*smaller_hbox, false, true); v2_box->pack_start (focus_button, false, true); @@ -422,7 +425,7 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptrcombo->set_value_in_list(true, false); set_popdown_strings (*control_ui->combo, setup_scale_values(port_index, control_ui)); control_ui->combo->signal_changed().connect (sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::control_combo_changed), control_ui)); - mcontrol->Changed.connect (control_connections, invalidator (*this), boost::bind (&GenericPluginUI::parameter_changed, this, control_ui), gui_context()); + mcontrol->Changed.connect (control_connections, invalidator (*this), boost::bind (&GenericPluginUI::ui_parameter_changed, this, control_ui), gui_context()); control_ui->pack_start(control_ui->label, true, true); control_ui->pack_start(*control_ui->combo, false, true); @@ -443,7 +446,7 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptrcombo->set_value_in_list(true, false); set_popdown_strings (*control_ui->combo, setup_scale_values(port_index, control_ui)); control_ui->combo->signal_changed().connect (sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::control_combo_changed), control_ui)); - mcontrol->Changed.connect (control_connections, invalidator (*this), boost::bind (&GenericPluginUI::parameter_changed, this, control_ui), gui_context()); + mcontrol->Changed.connect (control_connections, invalidator (*this), boost::bind (&GenericPluginUI::ui_parameter_changed, this, control_ui), gui_context()); control_ui->pack_start(control_ui->label, true, true); control_ui->pack_start(*control_ui->combo, false, true); @@ -491,19 +494,10 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptrcontroller->adjustment(); + boost::shared_ptr pc = boost::dynamic_pointer_cast (control_ui->control); - adj->set_lower (desc.lower); - adj->set_upper (desc.upper); - - control_ui->logarithmic = desc.logarithmic; - - if (control_ui->logarithmic) { - if (adj->get_lower() == 0.0) { - adj->set_lower (adj->get_upper()/10000); - } - adj->set_upper (log(adj->get_upper())); - adj->set_lower (log(adj->get_lower())); - } + adj->set_lower (pc->user_to_ui (desc.lower)); + adj->set_upper (pc->user_to_ui (desc.upper)); adj->set_step_increment (desc.step); adj->set_page_increment (desc.largestep); @@ -519,18 +513,14 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptrcontroller->set_name (X_("PluginSlider")); control_ui->controller->set_style (BarController::LeftToRight); control_ui->controller->set_use_parent (true); - control_ui->controller->set_logarithmic (control_ui->logarithmic); + control_ui->controller->set_logarithmic (desc.logarithmic); control_ui->controller->StartGesture.connect (sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::start_touch), control_ui)); control_ui->controller->StopGesture.connect (sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::stop_touch), control_ui)); } - if (control_ui->logarithmic) { - adj->set_value(log(plugin->get_parameter(port_index))); - } else{ - adj->set_value(plugin->get_parameter(port_index)); - } + adj->set_value (pc->plugin_to_ui (plugin->get_parameter (port_index))); /* XXX memory leak: SliderController not destroyed by ControlUI destructor, and manage() reports object hierarchy @@ -549,7 +539,7 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptrChanged.connect (control_connections, invalidator (*this), boost::bind (&GenericPluginUI::parameter_changed, this, control_ui), gui_context()); + mcontrol->Changed.connect (control_connections, invalidator (*this), boost::bind (&GenericPluginUI::ui_parameter_changed, this, control_ui), gui_context()); mcontrol->alist()->automation_state_changed.connect (control_connections, invalidator (*this), boost::bind (&GenericPluginUI::automation_state_changed, this, control_ui), gui_context()); input_controls.push_back (control_ui); @@ -601,7 +591,7 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptrChanged.connect (control_connections, invalidator (*this), boost::bind (&GenericPluginUI::parameter_changed, this, control_ui), gui_context()); + mcontrol->Changed.connect (control_connections, invalidator (*this), boost::bind (&GenericPluginUI::ui_parameter_changed, this, control_ui), gui_context()); return control_ui; } @@ -664,7 +654,7 @@ GenericPluginUI::toggle_parameter_changed (ControlUI* cui) } void -GenericPluginUI::parameter_changed (ControlUI* cui) +GenericPluginUI::ui_parameter_changed (ControlUI* cui) { if (!cui->update_pending) { cui->update_pending = true;