Update GUI, drop Automatable::value_as_string() API
This commit is contained in:
parent
17fb5bfb49
commit
99b064274f
|
@ -485,12 +485,7 @@ ArdourKnob::controllable_changed (bool force_update)
|
|||
_val = val;
|
||||
if (!_tooltip_prefix.empty()) {
|
||||
boost::shared_ptr<ARDOUR::AutomationControl> ac = boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (c);
|
||||
if (_printer && ac) {
|
||||
|
||||
_tooltip.set_tip (_tooltip_prefix + _printer->value_as_string (ac));
|
||||
} else {
|
||||
_tooltip.set_tip (_tooltip_prefix + c->get_user_string());
|
||||
}
|
||||
_tooltip.set_tip (_tooltip_prefix + c->get_user_string());
|
||||
}
|
||||
set_dirty();
|
||||
}
|
||||
|
|
|
@ -86,8 +86,6 @@ public:
|
|||
bool on_scroll_event (GdkEventScroll* ev);
|
||||
bool on_motion_notify_event (GdkEventMotion *ev) ;
|
||||
|
||||
void set_printer (boost::shared_ptr<ARDOUR::Automatable> p) { _printer = p; controllable_changed (true); }
|
||||
|
||||
void color_handler ();
|
||||
|
||||
protected:
|
||||
|
@ -108,7 +106,6 @@ public:
|
|||
private:
|
||||
Element _elements;
|
||||
BindingProxy binding_proxy;
|
||||
boost::shared_ptr<ARDOUR::Automatable> _printer;
|
||||
|
||||
bool _hovering;
|
||||
float _grabbed_x;
|
||||
|
|
|
@ -29,8 +29,7 @@ using namespace ARDOUR;
|
|||
|
||||
ArdourSpinner::ArdourSpinner (
|
||||
boost::shared_ptr<ARDOUR::AutomationControl> c,
|
||||
Gtk::Adjustment* adj,
|
||||
boost::shared_ptr<ARDOUR::Automatable> p)
|
||||
Gtk::Adjustment* adj)
|
||||
: _btn (ArdourButton::Text)
|
||||
, _ctrl_adj (adj)
|
||||
, _spin_adj (0, c->lower (), c->upper (), .1, .01)
|
||||
|
@ -40,7 +39,6 @@ ArdourSpinner::ArdourSpinner (
|
|||
, _ctrl_ignore (false)
|
||||
, _spin_ignore (false)
|
||||
, _controllable (c)
|
||||
, _printer (p)
|
||||
{
|
||||
add_events (Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);
|
||||
set (.5, .5, 1.0, 1.0);
|
||||
|
@ -204,10 +202,6 @@ ArdourSpinner::spin_adjusted ()
|
|||
void
|
||||
ArdourSpinner::controllable_changed ()
|
||||
{
|
||||
if (_printer) {
|
||||
_btn.set_text (_printer->value_as_string (_controllable));
|
||||
} else {
|
||||
_btn.set_text (_controllable->get_user_string());
|
||||
}
|
||||
_btn.set_text (_controllable->get_user_string());
|
||||
_btn.set_dirty();
|
||||
}
|
||||
|
|
|
@ -32,8 +32,7 @@ class ArdourSpinner : public Gtk::Alignment
|
|||
public:
|
||||
ArdourSpinner (
|
||||
boost::shared_ptr<ARDOUR::AutomationControl>,
|
||||
Gtk::Adjustment* adj,
|
||||
boost::shared_ptr<ARDOUR::Automatable>);
|
||||
Gtk::Adjustment* adj);
|
||||
|
||||
virtual ~ArdourSpinner ();
|
||||
|
||||
|
@ -65,7 +64,6 @@ class ArdourSpinner : public Gtk::Alignment
|
|||
bool _spin_ignore;
|
||||
|
||||
boost::shared_ptr<ARDOUR::AutomationControl> _controllable;
|
||||
boost::shared_ptr<ARDOUR::Automatable> _printer;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -44,11 +44,9 @@ using namespace Gtk;
|
|||
using PBD::Controllable;
|
||||
|
||||
AutomationBarController::AutomationBarController (
|
||||
boost::shared_ptr<Automatable> printer,
|
||||
boost::shared_ptr<AutomationControl> ac,
|
||||
Adjustment* adj)
|
||||
: Gtkmm2ext::BarController(*adj, ac)
|
||||
, _printer(printer)
|
||||
, _controllable(ac)
|
||||
{
|
||||
}
|
||||
|
@ -56,26 +54,22 @@ AutomationBarController::AutomationBarController (
|
|||
std::string
|
||||
AutomationBarController::get_label (double& xpos)
|
||||
{
|
||||
xpos = 0.5;
|
||||
return _printer->value_as_string (_controllable);
|
||||
xpos = 0.5;
|
||||
return _controllable->get_user_string();
|
||||
}
|
||||
|
||||
AutomationBarController::~AutomationBarController()
|
||||
{
|
||||
}
|
||||
|
||||
AutomationController::AutomationController(boost::shared_ptr<Automatable> printer,
|
||||
boost::shared_ptr<AutomationControl> ac,
|
||||
AutomationController::AutomationController(boost::shared_ptr<AutomationControl> ac,
|
||||
Adjustment* adj,
|
||||
bool use_knob)
|
||||
: _widget(NULL)
|
||||
, _printer (printer)
|
||||
, _controllable(ac)
|
||||
, _adjustment(adj)
|
||||
, _ignore_change(false)
|
||||
{
|
||||
assert (_printer);
|
||||
|
||||
if (ac->toggled()) {
|
||||
ArdourButton* but = manage(new ArdourButton());
|
||||
|
||||
|
@ -104,7 +98,7 @@ AutomationController::AutomationController(boost::shared_ptr<Automatable>
|
|||
knob->set_name("processor control knob");
|
||||
_widget = knob;
|
||||
} else {
|
||||
AutomationBarController* bar = manage(new AutomationBarController(_printer, ac, adj));
|
||||
AutomationBarController* bar = manage(new AutomationBarController(ac, adj));
|
||||
|
||||
bar->set_name(X_("ProcessorControlSlider"));
|
||||
bar->StartGesture.connect(
|
||||
|
@ -134,8 +128,7 @@ AutomationController::~AutomationController()
|
|||
}
|
||||
|
||||
boost::shared_ptr<AutomationController>
|
||||
AutomationController::create(boost::shared_ptr<Automatable> printer,
|
||||
const Evoral::Parameter& param,
|
||||
AutomationController::create(const Evoral::Parameter& param,
|
||||
const ParameterDescriptor& desc,
|
||||
boost::shared_ptr<AutomationControl> ac,
|
||||
bool use_knob)
|
||||
|
@ -151,7 +144,7 @@ AutomationController::create(boost::shared_ptr<Automatable> printer,
|
|||
|
||||
assert (ac);
|
||||
assert(ac->parameter() == param);
|
||||
return boost::shared_ptr<AutomationController>(new AutomationController(printer, ac, adjustment, use_knob));
|
||||
return boost::shared_ptr<AutomationController>(new AutomationController(ac, adjustment, use_knob));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -39,26 +39,22 @@ namespace ARDOUR {
|
|||
class Session;
|
||||
class AutomationList;
|
||||
class AutomationControl;
|
||||
class Automatable;
|
||||
}
|
||||
|
||||
class AutomationBarController : public Gtkmm2ext::BarController {
|
||||
public:
|
||||
AutomationBarController(boost::shared_ptr<ARDOUR::Automatable> printer,
|
||||
boost::shared_ptr<ARDOUR::AutomationControl> ac,
|
||||
AutomationBarController(boost::shared_ptr<ARDOUR::AutomationControl> ac,
|
||||
Gtk::Adjustment* adj);
|
||||
~AutomationBarController();
|
||||
private:
|
||||
std::string get_label (double&);
|
||||
boost::shared_ptr<ARDOUR::Automatable> _printer;
|
||||
boost::shared_ptr<ARDOUR::AutomationControl> _controllable;
|
||||
};
|
||||
|
||||
/** A BarController which displays the value and allows control of an AutomationControl */
|
||||
class AutomationController : public Gtk::Alignment {
|
||||
public:
|
||||
static boost::shared_ptr<AutomationController> create(
|
||||
boost::shared_ptr<ARDOUR::Automatable> parent,
|
||||
static boost::shared_ptr<AutomationController> create (
|
||||
const Evoral::Parameter& param,
|
||||
const ARDOUR::ParameterDescriptor& desc,
|
||||
boost::shared_ptr<ARDOUR::AutomationControl> ac,
|
||||
|
@ -79,8 +75,7 @@ public:
|
|||
void stop_updating ();
|
||||
|
||||
private:
|
||||
AutomationController (boost::shared_ptr<ARDOUR::Automatable> printer,
|
||||
boost::shared_ptr<ARDOUR::AutomationControl> ac,
|
||||
AutomationController (boost::shared_ptr<ARDOUR::AutomationControl> ac,
|
||||
Gtk::Adjustment* adj,
|
||||
bool use_knob);
|
||||
|
||||
|
@ -95,7 +90,6 @@ private:
|
|||
bool on_button_release(GdkEventButton* ev);
|
||||
|
||||
Gtk::Widget* _widget;
|
||||
boost::shared_ptr<ARDOUR::Automatable> _printer;
|
||||
boost::shared_ptr<ARDOUR::AutomationControl> _controllable;
|
||||
Gtk::Adjustment* _adjustment;
|
||||
sigc::connection _screen_update_connection;
|
||||
|
|
|
@ -122,8 +122,8 @@ AutomationTimeAxisView::AutomationTimeAxisView (
|
|||
have_name_font = true;
|
||||
}
|
||||
|
||||
if (_automatable && _control) {
|
||||
_controller = AutomationController::create (_automatable, _control->parameter(), _control->desc(), _control);
|
||||
if (_control) {
|
||||
_controller = AutomationController::create (_control->parameter(), _control->desc(), _control);
|
||||
}
|
||||
|
||||
const std::string fill_color_name = (dynamic_cast<MidiTimeAxisView*>(&parent)
|
||||
|
|
|
@ -740,7 +740,7 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param,
|
|||
* destructor, and manage() reports object hierarchy
|
||||
* ambiguity.
|
||||
*/
|
||||
control_ui->controller = AutomationController::create(insert, mcontrol->parameter(), desc, mcontrol, use_knob);
|
||||
control_ui->controller = AutomationController::create(mcontrol->parameter(), desc, mcontrol, use_knob);
|
||||
|
||||
/* Control UI's don't need the rapid timer workaround */
|
||||
control_ui->controller->stop_updating ();
|
||||
|
@ -773,7 +773,7 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param,
|
|||
}
|
||||
|
||||
if (!desc.integer_step && !desc.toggled && use_knob) {
|
||||
control_ui->spin_box = manage (new ArdourSpinner (mcontrol, adj, insert));
|
||||
control_ui->spin_box = manage (new ArdourSpinner (mcontrol, adj));
|
||||
}
|
||||
|
||||
adj->set_value (mcontrol->internal_to_interface(value));
|
||||
|
@ -797,7 +797,6 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param,
|
|||
} 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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user