mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
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
5 changed files with 85 additions and 27 deletions
|
|
@ -191,6 +191,22 @@
|
||||||
<Option name="processor postfader: text" value="aaaaa3ff"/>
|
<Option name="processor postfader: text" value="aaaaa3ff"/>
|
||||||
<Option name="processor postfader: text active" value="eeeeecff"/>
|
<Option name="processor postfader: text active" value="eeeeecff"/>
|
||||||
<Option name="processor postfader: text mid" value="aaaaa3ff"/>
|
<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 start" value="b7b7d2ff"/>
|
||||||
<Option name="monitor: border end" value="000000ff"/>
|
<Option name="monitor: border end" value="000000ff"/>
|
||||||
<Option name="monitor: border start selected" value="9a908eff"/>
|
<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(ProcessorPreFader, "processor prefader")
|
||||||
BUTTON_VARS(ProcessorFader, "processor fader")
|
BUTTON_VARS(ProcessorFader, "processor fader")
|
||||||
BUTTON_VARS(ProcessorPostFader, "processor postfader")
|
BUTTON_VARS(ProcessorPostFader, "processor postfader")
|
||||||
|
BUTTON_VARS(ProcessorControlButton, "processor control button")
|
||||||
BUTTON_VARS(MonitorButton, "monitor")
|
BUTTON_VARS(MonitorButton, "monitor")
|
||||||
BUTTON_VARS(SoloIsolateButton, "solo isolate")
|
BUTTON_VARS(SoloIsolateButton, "solo isolate")
|
||||||
BUTTON_VARS(SoloSafeButton, "solo safe")
|
BUTTON_VARS(SoloSafeButton, "solo safe")
|
||||||
|
|
|
||||||
|
|
@ -412,16 +412,29 @@ ProcessorEntry::Control::Control (Glib::RefPtr<Gdk::Pixbuf> s, boost::shared_ptr
|
||||||
: _control (c)
|
: _control (c)
|
||||||
, _adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0, 1, 0.01, 0.1)
|
, _adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0, 1, 0.01, 0.1)
|
||||||
, _slider (s, &_adjustment, 0, false)
|
, _slider (s, &_adjustment, 0, false)
|
||||||
, _ignore_slider_adjustment (false)
|
, _button (ArdourButton::Element (ArdourButton::Text | ArdourButton::Indicator))
|
||||||
|
, _ignore_ui_adjustment (false)
|
||||||
, _visible (false)
|
, _visible (false)
|
||||||
, _name (n)
|
, _name (n)
|
||||||
{
|
{
|
||||||
_slider.set_controllable (c);
|
_slider.set_controllable (c);
|
||||||
|
|
||||||
|
if (c->toggled()) {
|
||||||
|
_button.set_text (_name);
|
||||||
|
_button.set_led_left (true);
|
||||||
|
_button.set_name ("processor control button");
|
||||||
|
box.pack_start (_button);
|
||||||
|
_button.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 ());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
box.pack_start (_label);
|
box.pack_start (_label);
|
||||||
_label.show ();
|
_label.show ();
|
||||||
_label.set_text (_name);
|
_label.set_text (_name);
|
||||||
|
|
||||||
box.pack_start (_slider);
|
box.pack_start (_slider);
|
||||||
_slider.show ();
|
_slider.show ();
|
||||||
|
|
||||||
|
|
@ -436,6 +449,7 @@ ProcessorEntry::Control::Control (Glib::RefPtr<Gdk::Pixbuf> s, boost::shared_ptr
|
||||||
|
|
||||||
_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &Control::slider_adjusted));
|
_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 ());
|
c->Changed.connect (_connection, MISSING_INVALIDATOR, boost::bind (&Control::control_changed, this), gui_context ());
|
||||||
|
}
|
||||||
|
|
||||||
control_changed ();
|
control_changed ();
|
||||||
}
|
}
|
||||||
|
|
@ -449,7 +463,7 @@ ProcessorEntry::Control::set_pixel_width (int p)
|
||||||
void
|
void
|
||||||
ProcessorEntry::Control::slider_adjusted ()
|
ProcessorEntry::Control::slider_adjusted ()
|
||||||
{
|
{
|
||||||
if (_ignore_slider_adjustment) {
|
if (_ignore_ui_adjustment) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -462,6 +476,21 @@ ProcessorEntry::Control::slider_adjusted ()
|
||||||
c->set_value (c->interface_to_internal (_adjustment.get_value ()));
|
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
|
void
|
||||||
ProcessorEntry::Control::control_changed ()
|
ProcessorEntry::Control::control_changed ()
|
||||||
{
|
{
|
||||||
|
|
@ -470,7 +499,13 @@ ProcessorEntry::Control::control_changed ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ignore_slider_adjustment = true;
|
_ignore_ui_adjustment = true;
|
||||||
|
|
||||||
|
if (c->toggled ()) {
|
||||||
|
|
||||||
|
_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 ()));
|
_adjustment.set_value (c->internal_to_interface (c->get_value ()));
|
||||||
|
|
||||||
|
|
@ -480,8 +515,9 @@ ProcessorEntry::Control::control_changed ()
|
||||||
s << c->internal_to_user (c->get_value ());
|
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
|
void
|
||||||
|
|
|
||||||
|
|
@ -178,14 +178,18 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void slider_adjusted ();
|
void slider_adjusted ();
|
||||||
|
void button_clicked ();
|
||||||
void control_changed ();
|
void control_changed ();
|
||||||
std::string state_id () const;
|
std::string state_id () const;
|
||||||
|
|
||||||
boost::weak_ptr<ARDOUR::AutomationControl> _control;
|
boost::weak_ptr<ARDOUR::AutomationControl> _control;
|
||||||
|
/* things for a slider */
|
||||||
Gtk::Adjustment _adjustment;
|
Gtk::Adjustment _adjustment;
|
||||||
Gtkmm2ext::HSliderController _slider;
|
Gtkmm2ext::HSliderController _slider;
|
||||||
Gtk::Label _label;
|
Gtk::Label _label;
|
||||||
bool _ignore_slider_adjustment;
|
/* things for a button */
|
||||||
|
ArdourButton _button;
|
||||||
|
bool _ignore_ui_adjustment;
|
||||||
PBD::ScopedConnection _connection;
|
PBD::ScopedConnection _connection;
|
||||||
bool _visible;
|
bool _visible;
|
||||||
std::string _name;
|
std::string _name;
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ public:
|
||||||
double lower() const { return parameter().min(); }
|
double lower() const { return parameter().min(); }
|
||||||
double upper() const { return parameter().max(); }
|
double upper() const { return parameter().max(); }
|
||||||
double normal() const { return parameter().normal(); }
|
double normal() const { return parameter().normal(); }
|
||||||
|
bool toggled() const { return parameter().toggled(); }
|
||||||
|
|
||||||
const ARDOUR::Session& session() const { return _session; }
|
const ARDOUR::Session& session() const { return _session; }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue