mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 16:24:57 +01:00
GenericUI: replace early return by an else
This commit is contained in:
parent
535814cf98
commit
d26c3d380d
1 changed files with 105 additions and 105 deletions
|
|
@ -740,124 +740,124 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param,
|
||||||
|
|
||||||
update_control_display(control_ui);
|
update_control_display(control_ui);
|
||||||
|
|
||||||
return control_ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* create the controller */
|
|
||||||
|
|
||||||
/* XXX memory leak: SliderController not destroyed by ControlUI
|
|
||||||
* destructor, and manage() reports object hierarchy
|
|
||||||
* ambiguity.
|
|
||||||
*/
|
|
||||||
if (mcontrol) {
|
|
||||||
control_ui->controller = AutomationController::create(insert, mcontrol->parameter(), desc, mcontrol, use_knob);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX this code is not right yet, because it doesn't handle
|
|
||||||
the absence of bounds in any sensible fashion.
|
|
||||||
*/
|
|
||||||
|
|
||||||
Adjustment* adj = control_ui->controller->adjustment();
|
|
||||||
|
|
||||||
if (desc.integer_step && !desc.toggled) {
|
|
||||||
control_ui->clickbox = new ClickBox (adj, "PluginUIClickBox", true);
|
|
||||||
Gtkmm2ext::set_size_request_to_display_given_text (*control_ui->clickbox, "g9999999", 2, 2);
|
|
||||||
if (desc.unit == ParameterDescriptor::MIDI_NOTE) {
|
|
||||||
control_ui->clickbox->set_printer (sigc::bind (sigc::mem_fun (*this, &GenericPluginUI::midinote_printer), control_ui));
|
|
||||||
} else {
|
|
||||||
control_ui->clickbox->set_printer (sigc::bind (sigc::mem_fun (*this, &GenericPluginUI::integer_printer), control_ui));
|
|
||||||
}
|
|
||||||
} else if (desc.toggled) {
|
|
||||||
control_ui->controller->set_size_request (req.height, req.height);
|
|
||||||
} else if (use_knob) {
|
|
||||||
control_ui->controller->set_size_request (req.height * 1.5, req.height * 1.5);
|
|
||||||
} else {
|
} else {
|
||||||
control_ui->controller->set_size_request (200, req.height);
|
|
||||||
control_ui->controller->set_name (X_("ProcessorControlSlider"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!desc.integer_step && !desc.toggled && use_knob) {
|
/* create the controller */
|
||||||
control_ui->spin_box = manage (new ArdourSpinner (mcontrol, adj, insert));
|
|
||||||
}
|
|
||||||
|
|
||||||
adj->set_value (mcontrol->internal_to_interface(value));
|
/* XXX memory leak: SliderController not destroyed by ControlUI
|
||||||
|
* destructor, and manage() reports object hierarchy
|
||||||
|
* ambiguity.
|
||||||
|
*/
|
||||||
|
if (mcontrol) {
|
||||||
|
control_ui->controller = AutomationController::create(insert, mcontrol->parameter(), desc, mcontrol, use_knob);
|
||||||
|
}
|
||||||
|
|
||||||
if (use_knob) {
|
/* XXX this code is not right yet, because it doesn't handle
|
||||||
set_size_request_to_display_given_text (control_ui->automate_button, "M", 2, 2);
|
the absence of bounds in any sensible fashion.
|
||||||
|
*/
|
||||||
|
|
||||||
control_ui->label.set_alignment (0.5, 0.5);
|
Adjustment* adj = control_ui->controller->adjustment();
|
||||||
control_ui->knobtable = manage (new Table());
|
|
||||||
control_ui->pack_start(*control_ui->knobtable, true, true);
|
|
||||||
|
|
||||||
if (control_ui->clickbox) {
|
if (desc.integer_step && !desc.toggled) {
|
||||||
control_ui->knobtable->attach (*control_ui->clickbox, 0, 2, 0, 1);
|
control_ui->clickbox = new ClickBox (adj, "PluginUIClickBox", true);
|
||||||
control_ui->knobtable->attach (control_ui->label, 0, 1, 1, 2, FILL, SHRINK);
|
Gtkmm2ext::set_size_request_to_display_given_text (*control_ui->clickbox, "g9999999", 2, 2);
|
||||||
control_ui->knobtable->attach (control_ui->automate_button, 1, 2, 1, 2, SHRINK, SHRINK, 2, 0);
|
if (desc.unit == ParameterDescriptor::MIDI_NOTE) {
|
||||||
} else if (control_ui->spin_box) {
|
control_ui->clickbox->set_printer (sigc::bind (sigc::mem_fun (*this, &GenericPluginUI::midinote_printer), control_ui));
|
||||||
ArdourKnob* knob = dynamic_cast<ArdourKnob*>(control_ui->controller->widget ());
|
} else {
|
||||||
knob->set_tooltip_prefix (desc.label + ": ");
|
control_ui->clickbox->set_printer (sigc::bind (sigc::mem_fun (*this, &GenericPluginUI::integer_printer), control_ui));
|
||||||
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) {
|
} else if (desc.toggled) {
|
||||||
Alignment *align = manage (new Alignment (.5, .5, 0, 0));
|
control_ui->controller->set_size_request (req.height, req.height);
|
||||||
align->add (*control_ui->controller);
|
} else if (use_knob) {
|
||||||
control_ui->knobtable->attach (*align, 0, 2, 0, 1, EXPAND, SHRINK, 2, 2);
|
control_ui->controller->set_size_request (req.height * 1.5, req.height * 1.5);
|
||||||
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 {
|
} else {
|
||||||
control_ui->knobtable->attach (*control_ui->controller, 0, 2, 0, 1);
|
control_ui->controller->set_size_request (200, req.height);
|
||||||
control_ui->knobtable->attach (control_ui->label, 0, 1, 1, 2, FILL, SHRINK);
|
control_ui->controller->set_name (X_("ProcessorControlSlider"));
|
||||||
control_ui->knobtable->attach (control_ui->automate_button, 1, 2, 1, 2, SHRINK, SHRINK, 2, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
if (!desc.integer_step && !desc.toggled && use_knob) {
|
||||||
|
control_ui->spin_box = manage (new ArdourSpinner (mcontrol, adj, insert));
|
||||||
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);
|
|
||||||
|
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<ArdourKnob*>(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 {
|
||||||
|
|
||||||
|
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 (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<ArdourButton*>(control_ui->controller->widget ());
|
||||||
|
assert (but);
|
||||||
|
but->set_name ("pluginui toggle");
|
||||||
|
update_control_display(control_ui);
|
||||||
|
}
|
||||||
|
|
||||||
|
automation_state_changed (control_ui);
|
||||||
|
|
||||||
|
input_controls.push_back (control_ui);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
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<ArdourButton*>(control_ui->controller->widget ());
|
|
||||||
assert (but);
|
|
||||||
but->set_name ("pluginui toggle");
|
|
||||||
update_control_display(control_ui);
|
|
||||||
}
|
|
||||||
|
|
||||||
automation_state_changed (control_ui);
|
|
||||||
|
|
||||||
input_controls.push_back (control_ui);
|
|
||||||
|
|
||||||
} else if (!is_input) {
|
|
||||||
|
|
||||||
control_ui->display = manage (new EventBox);
|
control_ui->display = manage (new EventBox);
|
||||||
control_ui->display->set_name ("ParameterValueDisplay");
|
control_ui->display->set_name ("ParameterValueDisplay");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue