X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fgeneric_pluginui.cc;h=d1accfdd12539f63b6eadc13f898b000376d4a35;hb=6d0208613db9dc6d93559392d227fa1a600d0030;hp=0b85beffca288cf0e10dce1e3254d6a05b53a8cf;hpb=d26c3d380d8fdd7b9cfef6e8e21aa8ad641b978e;p=ardour.git diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index 0b85beffca..d1accfdd12 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -87,6 +87,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr pi, bool scrol set_latency_label (); smaller_hbox->pack_start (latency_button, false, false, 4); + smaller_hbox->pack_start (pin_management_button, false, false, 4); smaller_hbox->pack_start (_preset_combo, false, false); smaller_hbox->pack_start (_preset_modified, false, false); smaller_hbox->pack_start (add_button, false, false); @@ -315,6 +316,9 @@ GenericPluginUI::build () automation_play_all_button.signal_clicked.connect(sigc::bind (sigc::mem_fun (*this, &GenericPluginUI::set_all_automation), ARDOUR::Play)); automation_write_all_button.signal_clicked.connect(sigc::bind (sigc::mem_fun (*this, &GenericPluginUI::set_all_automation), ARDOUR::Write)); automation_touch_all_button.signal_clicked.connect(sigc::bind (sigc::mem_fun (*this, &GenericPluginUI::set_all_automation), ARDOUR::Touch)); + + /* XXX This is a workaround for AutomationControl not knowing about preset loads */ + plugin->PresetLoaded.connect (*this, invalidator (*this), boost::bind (&GenericPluginUI::update_input_displays, this), gui_context ()); } @@ -696,6 +700,7 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param, return control_ui; } + assert(mcontrol); /* See if there any named values for our input value */ control_ui->scale_points = desc.scale_points; @@ -723,21 +728,6 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param, i->second))); } - mcontrol->Changed.connect(control_connections, invalidator(*this), - boost::bind(&GenericPluginUI::ui_parameter_changed, - this, control_ui), - gui_context()); - - if (use_knob) { - control_ui->knobtable = manage (new Table()); - control_ui->pack_start(*control_ui->knobtable, true, false); - control_ui->knobtable->attach (control_ui->label, 0, 1, 0, 1); - control_ui->knobtable->attach (*control_ui->combo, 0, 1, 1, 2); - } else { - control_ui->pack_start(control_ui->label, true, true); - control_ui->pack_start(*control_ui->combo, false, true); - } - update_control_display(control_ui); } else { @@ -748,9 +738,10 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param, * destructor, and manage() reports object hierarchy * ambiguity. */ - if (mcontrol) { - control_ui->controller = AutomationController::create(insert, mcontrol->parameter(), desc, mcontrol, use_knob); - } + control_ui->controller = AutomationController::create(insert, mcontrol->parameter(), desc, mcontrol, use_knob); + + /* Control UI's don't need the rapid timer workaround */ + control_ui->controller->stop_updating (); /* XXX this code is not right yet, because it doesn't handle the absence of bounds in any sensible fashion. @@ -781,82 +772,89 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param, adj->set_value (mcontrol->internal_to_interface(value)); - if (use_knob) { - set_size_request_to_display_given_text (control_ui->automate_button, "M", 2, 2); + } - control_ui->label.set_alignment (0.5, 0.5); - control_ui->knobtable = manage (new Table()); - control_ui->pack_start(*control_ui->knobtable, true, true); - - if (control_ui->clickbox) { - control_ui->knobtable->attach (*control_ui->clickbox, 0, 2, 0, 1); - control_ui->knobtable->attach (control_ui->label, 0, 1, 1, 2, FILL, SHRINK); - control_ui->knobtable->attach (control_ui->automate_button, 1, 2, 1, 2, SHRINK, SHRINK, 2, 0); - } else if (control_ui->spin_box) { - ArdourKnob* knob = dynamic_cast(control_ui->controller->widget ()); - knob->set_tooltip_prefix (desc.label + ": "); - knob->set_printer (insert); - Alignment *align = manage (new Alignment (.5, .5, 0, 0)); - align->add (*control_ui->controller); - control_ui->knobtable->attach (*align, 0, 1, 0, 1, EXPAND, SHRINK, 1, 2); - control_ui->knobtable->attach (*control_ui->spin_box, 0, 2, 1, 2); - control_ui->knobtable->attach (control_ui->automate_button, 1, 2, 0, 1, SHRINK, SHRINK, 2, 0); - } else if (desc.toggled) { - Alignment *align = manage (new Alignment (.5, .5, 0, 0)); - align->add (*control_ui->controller); - control_ui->knobtable->attach (*align, 0, 2, 0, 1, EXPAND, SHRINK, 2, 2); - control_ui->knobtable->attach (control_ui->label, 0, 1, 1, 2, FILL, SHRINK); - control_ui->knobtable->attach (control_ui->automate_button, 1, 2, 1, 2, SHRINK, SHRINK, 2, 0); - } else { - control_ui->knobtable->attach (*control_ui->controller, 0, 2, 0, 1); - control_ui->knobtable->attach (control_ui->label, 0, 1, 1, 2, FILL, SHRINK); - control_ui->knobtable->attach (control_ui->automate_button, 1, 2, 1, 2, SHRINK, SHRINK, 2, 0); - } + if (use_knob) { + set_size_request_to_display_given_text (control_ui->automate_button, "M", 2, 2); - } else { + control_ui->label.set_alignment (0.5, 0.5); + control_ui->knobtable = manage (new Table()); + control_ui->pack_start(*control_ui->knobtable, true, true); - control_ui->pack_start (control_ui->label, true, true); - if (control_ui->clickbox) { - control_ui->pack_start (*control_ui->clickbox, false, false); - } else if (control_ui->spin_box) { - control_ui->pack_start (*control_ui->spin_box, false, false); - control_ui->pack_start (*control_ui->controller, false, false); - } else { - control_ui->pack_start (*control_ui->controller, false, false); - } - control_ui->pack_start (control_ui->automate_button, false, false); + if (control_ui->combo) { + control_ui->knobtable->attach (control_ui->label, 0, 1, 0, 1); + control_ui->knobtable->attach (*control_ui->combo, 0, 1, 1, 2); + } else if (control_ui->clickbox) { + control_ui->knobtable->attach (*control_ui->clickbox, 0, 2, 0, 1); + control_ui->knobtable->attach (control_ui->label, 0, 1, 1, 2, FILL, SHRINK); + control_ui->knobtable->attach (control_ui->automate_button, 1, 2, 1, 2, SHRINK, SHRINK, 2, 0); + } else if (control_ui->spin_box) { + ArdourKnob* knob = dynamic_cast(control_ui->controller->widget ()); + knob->set_tooltip_prefix (desc.label + ": "); + knob->set_printer (insert); + Alignment *align = manage (new Alignment (.5, .5, 0, 0)); + align->add (*control_ui->controller); + control_ui->knobtable->attach (*align, 0, 1, 0, 1, EXPAND, SHRINK, 1, 2); + control_ui->knobtable->attach (*control_ui->spin_box, 0, 2, 1, 2); + control_ui->knobtable->attach (control_ui->automate_button, 1, 2, 0, 1, SHRINK, SHRINK, 2, 0); + } else if (desc.toggled) { + Alignment *align = manage (new Alignment (.5, .5, 0, 0)); + align->add (*control_ui->controller); + control_ui->knobtable->attach (*align, 0, 2, 0, 1, EXPAND, SHRINK, 2, 2); + control_ui->knobtable->attach (control_ui->label, 0, 1, 1, 2, FILL, SHRINK); + control_ui->knobtable->attach (control_ui->automate_button, 1, 2, 1, 2, SHRINK, SHRINK, 2, 0); + } else { + control_ui->knobtable->attach (*control_ui->controller, 0, 2, 0, 1); + control_ui->knobtable->attach (control_ui->label, 0, 1, 1, 2, FILL, SHRINK); + control_ui->knobtable->attach (control_ui->automate_button, 1, 2, 1, 2, SHRINK, SHRINK, 2, 0); } + } else { - if (mcontrol->flags () & Controllable::NotAutomatable) { - control_ui->automate_button.set_sensitive (false); - set_tooltip(control_ui->automate_button, _("This control cannot be automated")); + control_ui->pack_start (control_ui->label, true, true); + if (control_ui->combo) { + control_ui->pack_start(*control_ui->combo, false, true); + } else if (control_ui->clickbox) { + control_ui->pack_start (*control_ui->clickbox, false, false); + } else if (control_ui->spin_box) { + control_ui->pack_start (*control_ui->spin_box, false, false); + control_ui->pack_start (*control_ui->controller, false, false); } else { - control_ui->automate_button.signal_clicked.connect (sigc::bind ( - sigc::mem_fun(*this, &GenericPluginUI::astate_clicked), - control_ui)); - mcontrol->alist()->automation_state_changed.connect ( - control_connections, - invalidator (*this), - boost::bind (&GenericPluginUI::automation_state_changed, this, control_ui), - gui_context()); - input_controls_with_automation.push_back (control_ui); - } - - if (desc.toggled) { - control_ui->button = true; - ArdourButton* but = dynamic_cast(control_ui->controller->widget ()); - assert (but); - but->set_name ("pluginui toggle"); - update_control_display(control_ui); + control_ui->pack_start (*control_ui->controller, false, false); } + control_ui->pack_start (control_ui->automate_button, false, false); + } - automation_state_changed (control_ui); - input_controls.push_back (control_ui); + if (mcontrol->flags () & Controllable::NotAutomatable) { + control_ui->automate_button.set_sensitive (false); + set_tooltip(control_ui->automate_button, _("This control cannot be automated")); + } else { + control_ui->automate_button.signal_clicked.connect (sigc::bind ( + sigc::mem_fun(*this, &GenericPluginUI::astate_clicked), + control_ui)); + mcontrol->alist()->automation_state_changed.connect ( + control_connections, + invalidator (*this), + boost::bind (&GenericPluginUI::automation_state_changed, this, control_ui), + gui_context()); + input_controls_with_automation.push_back (control_ui); + } + if (desc.toggled) { + control_ui->button = true; + ArdourButton* but = dynamic_cast(control_ui->controller->widget ()); + assert (but); + but->set_name ("pluginui toggle"); + update_control_display(control_ui); } + automation_state_changed (control_ui); + + /* Add to the list of CUIs that need manual update to workaround + * AutomationControl not knowing about preset loads */ + input_controls.push_back (control_ui); + } else { control_ui->display = manage (new EventBox); @@ -925,7 +923,10 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param, } if (mcontrol) { - mcontrol->Changed.connect (control_connections, invalidator (*this), boost::bind (&GenericPluginUI::ui_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; @@ -939,6 +940,7 @@ GenericPluginUI::astate_clicked (ControlUI* cui) if (automation_menu == 0) { automation_menu = manage (new Menu); automation_menu->set_name ("ArdourContextMenu"); + automation_menu->set_reserve_toggle_size(false); } MenuList& items (automation_menu->items()); @@ -953,7 +955,7 @@ GenericPluginUI::astate_clicked (ControlUI* cui) items.push_back (MenuElem (_("Touch"), sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Touch, cui))); - automation_menu->popup (1, gtk_get_current_event_time()); + anchored_menu_popup(automation_menu, &cui->automate_button, "", 1, gtk_get_current_event_time()); } void @@ -1018,6 +1020,18 @@ GenericPluginUI::update_control_display (ControlUI* cui) }*/ } +void +GenericPluginUI::update_input_displays () +{ + /* XXX This is a workaround for AutomationControl not knowing about preset loads */ + for (vector::iterator i = input_controls.begin(); + i != input_controls.end(); + ++i) { + update_control_display(*i); + } + return; +} + void GenericPluginUI::control_combo_changed (ControlUI* cui, float value) { @@ -1039,14 +1053,9 @@ GenericPluginUI::start_updating (GdkEventAny*) bool GenericPluginUI::stop_updating (GdkEventAny*) { - for (vector::iterator i = input_controls.begin(); i != input_controls.end(); ++i) { - (*i)->controller->stop_updating (); - } - if (output_controls.size() > 0 ) { screen_update_connection.disconnect(); } - return false; }