X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fgeneric_pluginui.cc;h=2a8738f8188cdd7ab40aa7e1ba9738fee0ca3b31;hb=49a9fa20a56c6f5607e7bcf209985a67972c3f31;hp=dfff196a5f2d285344836a56466c131451ac2483;hpb=ea41f0f37b709f6d5e0b8fe66dd1335f9a8a0b2f;p=ardour.git diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index dfff196a5f..2a8738f818 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -73,8 +73,6 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr pi, bool scrol set_border_width (10); set_homogeneous (false); - settings_box.set_homogeneous (false); - HBox* constraint_hbox = manage (new HBox); HBox* smaller_hbox = manage (new HBox); Label* combo_label = manage (new Label (_("Presets"))); @@ -83,14 +81,21 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr pi, bool scrol smaller_hbox->pack_start (*combo_label, false, false, 10); smaller_hbox->pack_start (preset_combo, false, false); smaller_hbox->pack_start (save_button, false, false); + smaller_hbox->pack_start (bypass_button, false, true); constraint_hbox->set_spacing (5); - constraint_hbox->pack_start (*smaller_hbox, true, false); - constraint_hbox->pack_end (bypass_button, false, false); + constraint_hbox->set_homogeneous (false); + + VBox* v1_box = manage (new VBox); + VBox* v2_box = manage (new VBox); + + v1_box->pack_start (*smaller_hbox, false, true); + v2_box->pack_start (focus_button, false, true); - settings_box.pack_end (*constraint_hbox, false, false); + constraint_hbox->pack_end (*v2_box, false, false); + constraint_hbox->pack_end (*v1_box, false, false); - pack_start (settings_box, false, false); + pack_start (*constraint_hbox, false, false); if ( is_scrollable ) { scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); @@ -106,9 +111,6 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr pi, bool scrol pack_start (hpacker, false, false); } - insert->active_changed.connect (mem_fun(*this, &GenericPluginUI::redirect_active_changed)); - bypass_button.set_active (!insert->active()); - build (); } @@ -189,7 +191,7 @@ GenericPluginUI::build () /* if we are scrollable, just use one long column */ if (!is_scrollable) { - if (x++ > 7){ + if (x++ > 20){ frame = manage (new Frame); frame->set_name ("BaseFrame"); box = manage (new VBox); @@ -302,7 +304,7 @@ GenericPluginUI::ControlUI::ControlUI () below). be sure to include a descender. */ - set_size_request_to_display_given_text (*automate_button.get_child(), _("Mgnual"), 5, 5); + set_size_request_to_display_given_text (automate_button, _("Mgnual"), 15, 10); ignore_change = 0; display = 0; @@ -448,12 +450,19 @@ GenericPluginUI::build_control_ui (guint32 port_index, PBD::Controllable* mcontr control_ui->pack_start (*control_ui->button, false, true); control_ui->pack_start (control_ui->automate_button, false, false); - control_ui->button->signal_clicked().connect (bind (mem_fun(*this, &GenericPluginUI::control_port_toggled), control_ui)); - - if(plugin->get_parameter (port_index) == 1){ + if(plugin->get_parameter (port_index) > 0.5){ control_ui->button->set_active(true); } + control_ui->button->signal_clicked().connect (bind (mem_fun(*this, &GenericPluginUI::control_port_toggled), control_ui)); + + plugin->ParameterChanged.connect (bind (mem_fun(*this, &GenericPluginUI::toggle_parameter_changed), control_ui)); + + control_ui->automate_button.signal_clicked().connect (bind (mem_fun(*this, &GenericPluginUI::astate_clicked), control_ui, (uint32_t) port_index)); + automation_state_changed (control_ui); + insert->automation_list (port_index).automation_state_changed.connect + (bind (mem_fun(*this, &GenericPluginUI::automation_state_changed), control_ui)); + return control_ui; } @@ -475,9 +484,6 @@ GenericPluginUI::build_control_ui (guint32 port_index, PBD::Controllable* mcontr control_ui->adjustment->set_lower (log(control_ui->adjustment->get_lower())); } - float delta = desc.upper - desc.lower; - - control_ui->adjustment->set_page_size (delta/100.0); control_ui->adjustment->set_step_increment (desc.step); control_ui->adjustment->set_page_increment (desc.largestep); @@ -493,6 +499,7 @@ GenericPluginUI::build_control_ui (guint32 port_index, PBD::Controllable* mcontr control_ui->control->set_name (X_("PluginSlider")); control_ui->control->set_style (BarController::LeftToRight); control_ui->control->set_use_parent (true); + control_ui->control->set_logarithmic (control_ui->logarithmic); control_ui->control->StartGesture.connect (bind (mem_fun(*this, &GenericPluginUI::start_touch), control_ui)); control_ui->control->StopGesture.connect (bind (mem_fun(*this, &GenericPluginUI::stop_touch), control_ui)); @@ -572,9 +579,10 @@ GenericPluginUI::build_control_ui (guint32 port_index, PBD::Controllable* mcontr control_ui->meterinfo->packed = true; output_controls.push_back (control_ui); + + plugin->ParameterChanged.connect (bind (mem_fun(*this, &GenericPluginUI::parameter_changed), control_ui)); } - plugin->ParameterChanged.connect (bind (mem_fun(*this, &GenericPluginUI::parameter_changed), control_ui)); return control_ui; } @@ -637,6 +645,18 @@ GenericPluginUI::control_adjustment_changed (ControlUI* cui) insert->set_parameter (cui->port_index, (float) value); } +void +GenericPluginUI::toggle_parameter_changed (uint32_t abs_port_id, float val, ControlUI* cui) +{ + if (!cui->ignore_change && cui->port_index == abs_port_id) { + if (val > 0.5) { + cui->button->set_active (true); + } else { + cui->button->set_active (false); + } + } +} + void GenericPluginUI::parameter_changed (uint32_t abs_port_id, float val, ControlUI* cui) { @@ -666,14 +686,6 @@ GenericPluginUI::update_control_display (ControlUI* cui) break; } } - } else if (cui->adjustment == 0) { - - if (val > 0.5) { - cui->button->set_active (true); - } else { - cui->button->set_active (false); - } - } else { if (cui->logarithmic) { val = log(val); @@ -688,9 +700,9 @@ GenericPluginUI::update_control_display (ControlUI* cui) void GenericPluginUI::control_port_toggled (ControlUI* cui) { - if (!cui->ignore_change) { - insert->set_parameter (cui->port_index, cui->button->get_active()); - } + cui->ignore_change++; + insert->set_parameter (cui->port_index, cui->button->get_active()); + cui->ignore_change--; } void @@ -704,14 +716,6 @@ GenericPluginUI::control_combo_changed (ControlUI* cui) } -void -GenericPluginUI::redirect_active_changed (Redirect* r, void* src) -{ - ENSURE_GUI_THREAD(bind (mem_fun(*this, &GenericPluginUI::redirect_active_changed), r, src)); - - bypass_button.set_active (!r->active()); -} - bool GenericPluginUI::start_updating (GdkEventAny* ignored) {