Use a button in the processor box for toggle parameters.
git-svn-id: svn://localhost/ardour2/branches/3.0@11297 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
4bb517279c
commit
c95b34642f
|
@ -191,6 +191,22 @@
|
|||
<Option name="processor postfader: text" value="aaaaa3ff"/>
|
||||
<Option name="processor postfader: text active" value="eeeeecff"/>
|
||||
<Option name="processor postfader: text mid" value="aaaaa3ff"/>
|
||||
<Option name="processor control button: border start" value="000000ff"/>
|
||||
<Option name="processor control button: border end" value="000000ff"/>
|
||||
<Option name="processor control button: border start selected" value="000000ff"/>
|
||||
<Option name="processor control button: border end selected" value="000000ff"/>
|
||||
<Option name="processor control button: fill start" value="000000ff"/>
|
||||
<Option name="processor control button: fill end" value="000000ff"/>
|
||||
<Option name="processor control button: fill start active" value="000000ff"/>
|
||||
<Option name="processor control button: fill end active" value="000000ff"/>
|
||||
<Option name="processor control button: fill start mid" value="000000ff"/>
|
||||
<Option name="processor control button: fill end mid" value="000000ff"/>
|
||||
<Option name="processor control button: led" value="000000ff"/>
|
||||
<Option name="processor control button: led active" value="ff0000ff"/>
|
||||
<Option name="processor control button: led mid" value="000000ff"/>
|
||||
<Option name="processor control button: text" value="ffffffff"/>
|
||||
<Option name="processor control button: text active" value="ffffffff"/>
|
||||
<Option name="processor control button: text mid" value="ffffffff"/>
|
||||
<Option name="monitor: border start" value="b7b7d2ff"/>
|
||||
<Option name="monitor: border end" value="000000ff"/>
|
||||
<Option name="monitor: border start selected" value="9a908eff"/>
|
||||
|
|
|
@ -159,6 +159,7 @@ CANVAS_VARIABLE(canvasvar_ ## root ## TextMid, name ": text mid")
|
|||
BUTTON_VARS(ProcessorPreFader, "processor prefader")
|
||||
BUTTON_VARS(ProcessorFader, "processor fader")
|
||||
BUTTON_VARS(ProcessorPostFader, "processor postfader")
|
||||
BUTTON_VARS(ProcessorControlButton, "processor control button")
|
||||
BUTTON_VARS(MonitorButton, "monitor")
|
||||
BUTTON_VARS(SoloIsolateButton, "solo isolate")
|
||||
BUTTON_VARS(SoloSafeButton, "solo safe")
|
||||
|
|
|
@ -412,30 +412,44 @@ ProcessorEntry::Control::Control (Glib::RefPtr<Gdk::Pixbuf> s, boost::shared_ptr
|
|||
: _control (c)
|
||||
, _adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0, 1, 0.01, 0.1)
|
||||
, _slider (s, &_adjustment, 0, false)
|
||||
, _ignore_slider_adjustment (false)
|
||||
, _button (ArdourButton::Element (ArdourButton::Text | ArdourButton::Indicator))
|
||||
, _ignore_ui_adjustment (false)
|
||||
, _visible (false)
|
||||
, _name (n)
|
||||
{
|
||||
_slider.set_controllable (c);
|
||||
|
||||
box.pack_start (_label);
|
||||
_label.show ();
|
||||
_label.set_text (_name);
|
||||
if (c->toggled()) {
|
||||
_button.set_text (_name);
|
||||
_button.set_led_left (true);
|
||||
_button.set_name ("processor control button");
|
||||
box.pack_start (_button);
|
||||
_button.show ();
|
||||
|
||||
box.pack_start (_slider);
|
||||
_slider.show ();
|
||||
_button.signal_clicked.connect (sigc::mem_fun (*this, &Control::button_clicked));
|
||||
_button.signal_led_clicked.connect (sigc::mem_fun (*this, &Control::button_clicked));
|
||||
c->Changed.connect (_connection, MISSING_INVALIDATOR, boost::bind (&Control::control_changed, this), gui_context ());
|
||||
|
||||
double const lo = c->internal_to_interface (c->lower ());
|
||||
double const up = c->internal_to_interface (c->upper ());
|
||||
} else {
|
||||
|
||||
box.pack_start (_label);
|
||||
_label.show ();
|
||||
_label.set_text (_name);
|
||||
box.pack_start (_slider);
|
||||
_slider.show ();
|
||||
|
||||
_adjustment.set_lower (lo);
|
||||
_adjustment.set_upper (up);
|
||||
_adjustment.set_step_increment ((up - lo) / 100);
|
||||
_adjustment.set_page_increment ((up - lo) / 10);
|
||||
_slider.set_default_value (c->internal_to_interface (c->normal ()));
|
||||
|
||||
_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &Control::slider_adjusted));
|
||||
c->Changed.connect (_connection, MISSING_INVALIDATOR, boost::bind (&Control::control_changed, this), gui_context ());
|
||||
double const lo = c->internal_to_interface (c->lower ());
|
||||
double const up = c->internal_to_interface (c->upper ());
|
||||
|
||||
_adjustment.set_lower (lo);
|
||||
_adjustment.set_upper (up);
|
||||
_adjustment.set_step_increment ((up - lo) / 100);
|
||||
_adjustment.set_page_increment ((up - lo) / 10);
|
||||
_slider.set_default_value (c->internal_to_interface (c->normal ()));
|
||||
|
||||
_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &Control::slider_adjusted));
|
||||
c->Changed.connect (_connection, MISSING_INVALIDATOR, boost::bind (&Control::control_changed, this), gui_context ());
|
||||
}
|
||||
|
||||
control_changed ();
|
||||
}
|
||||
|
@ -449,7 +463,7 @@ ProcessorEntry::Control::set_pixel_width (int p)
|
|||
void
|
||||
ProcessorEntry::Control::slider_adjusted ()
|
||||
{
|
||||
if (_ignore_slider_adjustment) {
|
||||
if (_ignore_ui_adjustment) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -462,6 +476,21 @@ ProcessorEntry::Control::slider_adjusted ()
|
|||
c->set_value (c->interface_to_internal (_adjustment.get_value ()));
|
||||
}
|
||||
|
||||
void
|
||||
ProcessorEntry::Control::button_clicked ()
|
||||
{
|
||||
boost::shared_ptr<AutomationControl> c = _control.lock ();
|
||||
|
||||
if (!c) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool const n = _button.active_state() == Gtkmm2ext::Active ? false : true;
|
||||
|
||||
c->set_value (n ? 1 : 0);
|
||||
_button.set_active_state (n ? Gtkmm2ext::Active : Gtkmm2ext::ActiveState (0));
|
||||
}
|
||||
|
||||
void
|
||||
ProcessorEntry::Control::control_changed ()
|
||||
{
|
||||
|
@ -470,18 +499,25 @@ ProcessorEntry::Control::control_changed ()
|
|||
return;
|
||||
}
|
||||
|
||||
_ignore_slider_adjustment = true;
|
||||
_ignore_ui_adjustment = true;
|
||||
|
||||
_adjustment.set_value (c->internal_to_interface (c->get_value ()));
|
||||
if (c->toggled ()) {
|
||||
|
||||
stringstream s;
|
||||
s.precision (1);
|
||||
s.setf (ios::fixed, ios::floatfield);
|
||||
s << c->internal_to_user (c->get_value ());
|
||||
_button.set_active_state (c->get_value() > 0.5 ? Gtkmm2ext::Active : Gtkmm2ext::ActiveState (0));
|
||||
|
||||
} else {
|
||||
|
||||
_adjustment.set_value (c->internal_to_interface (c->get_value ()));
|
||||
|
||||
stringstream s;
|
||||
s.precision (1);
|
||||
s.setf (ios::fixed, ios::floatfield);
|
||||
s << c->internal_to_user (c->get_value ());
|
||||
|
||||
_slider.set_tooltip_text (s.str ());
|
||||
}
|
||||
|
||||
_slider.set_tooltip_text (s.str ());
|
||||
|
||||
_ignore_slider_adjustment = false;
|
||||
_ignore_ui_adjustment = false;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -178,14 +178,18 @@ private:
|
|||
|
||||
private:
|
||||
void slider_adjusted ();
|
||||
void button_clicked ();
|
||||
void control_changed ();
|
||||
std::string state_id () const;
|
||||
|
||||
boost::weak_ptr<ARDOUR::AutomationControl> _control;
|
||||
/* things for a slider */
|
||||
Gtk::Adjustment _adjustment;
|
||||
Gtkmm2ext::HSliderController _slider;
|
||||
Gtk::Label _label;
|
||||
bool _ignore_slider_adjustment;
|
||||
/* things for a button */
|
||||
ArdourButton _button;
|
||||
bool _ignore_ui_adjustment;
|
||||
PBD::ScopedConnection _connection;
|
||||
bool _visible;
|
||||
std::string _name;
|
||||
|
|
|
@ -92,6 +92,7 @@ public:
|
|||
double lower() const { return parameter().min(); }
|
||||
double upper() const { return parameter().max(); }
|
||||
double normal() const { return parameter().normal(); }
|
||||
bool toggled() const { return parameter().toggled(); }
|
||||
|
||||
const ARDOUR::Session& session() const { return _session; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue