allow AutomatoinContoller to render as Knob instead of Slider.

This commit is contained in:
Robin Gareus 2016-07-04 00:18:45 +02:00
parent 1343f33706
commit 1f2d1b586e
3 changed files with 18 additions and 5 deletions

View File

@ -30,6 +30,7 @@
#include "ardour/tempo.h"
#include "ardour_button.h"
#include "ardour_knob.h"
#include "automation_controller.h"
#include "gui_thread.h"
#include "note_select_dialog.h"
@ -65,7 +66,8 @@ AutomationBarController::~AutomationBarController()
AutomationController::AutomationController(boost::shared_ptr<Automatable> printer,
boost::shared_ptr<AutomationControl> ac,
Adjustment* adj)
Adjustment* adj,
bool use_knob)
: _widget(NULL)
, _printer (printer)
, _controllable(ac)
@ -89,6 +91,11 @@ AutomationController::AutomationController(boost::shared_ptr<Automatable>
but->signal_clicked.connect(
sigc::mem_fun(*this, &AutomationController::toggled));
_widget = but;
} else if (use_knob) {
ArdourKnob* knob = manage (new ArdourKnob (ArdourKnob::default_elements, ArdourKnob::Detent));
knob->set_controllable (ac);
knob->set_name("processor control knob");
_widget = knob;
} else {
AutomationBarController* bar = manage(new AutomationBarController(_printer, ac, adj));
@ -123,7 +130,8 @@ boost::shared_ptr<AutomationController>
AutomationController::create(boost::shared_ptr<Automatable> printer,
const Evoral::Parameter& param,
const ParameterDescriptor& desc,
boost::shared_ptr<AutomationControl> ac)
boost::shared_ptr<AutomationControl> ac,
bool use_knob)
{
const double lo = ac->internal_to_interface(desc.lower);
const double up = ac->internal_to_interface(desc.upper);
@ -136,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));
return boost::shared_ptr<AutomationController>(new AutomationController(printer, ac, adjustment, use_knob));
}
void

View File

@ -61,7 +61,8 @@ public:
boost::shared_ptr<ARDOUR::Automatable> parent,
const Evoral::Parameter& param,
const ARDOUR::ParameterDescriptor& desc,
boost::shared_ptr<ARDOUR::AutomationControl> ac);
boost::shared_ptr<ARDOUR::AutomationControl> ac,
bool use_knob = false);
~AutomationController();
@ -80,7 +81,8 @@ public:
private:
AutomationController (boost::shared_ptr<ARDOUR::Automatable> printer,
boost::shared_ptr<ARDOUR::AutomationControl> ac,
Gtk::Adjustment* adj);
Gtk::Adjustment* adj,
bool use_knob);
void start_touch();
void end_touch();

View File

@ -341,6 +341,9 @@
<ColorAlias name="processor control button: fill" alias="color 29"/>
<ColorAlias name="processor control button: fill active" alias="color 46"/>
<ColorAlias name="processor control button: led active" alias="color 62"/>
<ColorAlias name="processor control knob" alias="color 60"/>
<ColorAlias name="processor control knob: arc end" alias="color 70"/>
<ColorAlias name="processor control knob: arc start" alias="color 16"/>
<ColorAlias name="processor fader: fill" alias="color 16"/>
<ColorAlias name="processor fader: fill active" alias="color 78"/>
<ColorAlias name="processor fader: led active" alias="color 37"/>