mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
plugin widgets were written to use Internal values, so use that for now
This commit is contained in:
parent
41f13c0109
commit
ceff2e3a62
5 changed files with 13 additions and 99 deletions
|
|
@ -71,9 +71,9 @@ AutomationController::create(
|
|||
{
|
||||
Gtk::Adjustment* adjustment = manage (
|
||||
new Gtk::Adjustment (
|
||||
ac->internal_to_interface (param.normal()),
|
||||
ac->internal_to_interface (param.min()),
|
||||
ac->internal_to_interface (param.max()),
|
||||
param.normal(),
|
||||
param.min(),
|
||||
param.max(),
|
||||
(param.max() - param.min()) / 100.0,
|
||||
(param.max() - param.min()) / 10.0
|
||||
)
|
||||
|
|
@ -94,7 +94,7 @@ AutomationController::get_label (double& xpos)
|
|||
void
|
||||
AutomationController::display_effective_value()
|
||||
{
|
||||
double const interface_value = _controllable->internal_to_interface (_controllable->get_value());
|
||||
double const interface_value = _controllable->get_value();
|
||||
|
||||
if (_adjustment->get_value () != interface_value) {
|
||||
_ignore_change = true;
|
||||
|
|
@ -107,7 +107,7 @@ void
|
|||
AutomationController::value_adjusted ()
|
||||
{
|
||||
if (!_ignore_change) {
|
||||
_controllable->set_value (_controllable->interface_to_internal (_adjustment->get_value()));
|
||||
_controllable->set_value (_adjustment->get_value());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -625,8 +625,8 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat
|
|||
Adjustment* adj = control_ui->controller->adjustment();
|
||||
boost::shared_ptr<PluginInsert::PluginControl> pc = boost::dynamic_pointer_cast<PluginInsert::PluginControl> (control_ui->control);
|
||||
|
||||
adj->set_lower (pc->internal_to_interface (desc.lower));
|
||||
adj->set_upper (pc->internal_to_interface (desc.upper));
|
||||
adj->set_lower (desc.lower);
|
||||
adj->set_upper (desc.upper);
|
||||
|
||||
adj->set_step_increment (desc.step);
|
||||
adj->set_page_increment (desc.largestep);
|
||||
|
|
@ -644,14 +644,13 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat
|
|||
|
||||
control_ui->controller->set_size_request (200, req.height);
|
||||
control_ui->controller->set_name (X_("ProcessorControlSlider"));
|
||||
control_ui->controller->set_logarithmic (desc.logarithmic);
|
||||
|
||||
control_ui->controller->StartGesture.connect (sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::start_touch), control_ui));
|
||||
control_ui->controller->StopGesture.connect (sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::stop_touch), control_ui));
|
||||
|
||||
}
|
||||
|
||||
adj->set_value (pc->internal_to_interface (plugin->get_parameter (port_index)));
|
||||
adj->set_value (plugin->get_parameter (port_index));
|
||||
|
||||
/* XXX memory leak: SliderController not destroyed by ControlUI
|
||||
destructor, and manage() reports object hierarchy
|
||||
|
|
|
|||
|
|
@ -521,14 +521,14 @@ ProcessorEntry::Control::Control (boost::shared_ptr<AutomationControl> c, string
|
|||
box.add (_slider);
|
||||
_slider.show ();
|
||||
|
||||
double const lo = c->internal_to_interface (c->lower ());
|
||||
double const up = c->internal_to_interface (c->upper ());
|
||||
double const lo = c->lower ();
|
||||
double const up = 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 ()));
|
||||
_slider.set_default_value (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 ());
|
||||
|
|
@ -580,7 +580,7 @@ ProcessorEntry::Control::slider_adjusted ()
|
|||
return;
|
||||
}
|
||||
|
||||
c->set_value (c->interface_to_internal (_adjustment.get_value ()));
|
||||
c->set_value ( _adjustment.get_value () );
|
||||
set_tooltip ();
|
||||
}
|
||||
|
||||
|
|
@ -616,7 +616,7 @@ ProcessorEntry::Control::control_changed ()
|
|||
|
||||
} else {
|
||||
|
||||
_adjustment.set_value (c->internal_to_interface (c->get_value ()));
|
||||
_adjustment.set_value (c->get_value ());
|
||||
|
||||
stringstream s;
|
||||
s.precision (1);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ using namespace Gtkmm2ext;
|
|||
BarController::BarController (Gtk::Adjustment& adj,
|
||||
boost::shared_ptr<PBD::Controllable> mc)
|
||||
: _slider (&adj, 60, 16)
|
||||
, _logarithmic (false)
|
||||
, _switching (false)
|
||||
, _switch_on_release (false)
|
||||
{
|
||||
|
|
@ -59,8 +58,6 @@ BarController::BarController (Gtk::Adjustment& adj,
|
|||
Gtk::SpinButton& spinner = _slider.get_spin_button();
|
||||
spinner.signal_activate().connect (mem_fun (*this, &BarController::entry_activated));
|
||||
spinner.signal_focus_out_event().connect (mem_fun (*this, &BarController::entry_focus_out));
|
||||
spinner.signal_input().connect (mem_fun (*this, &BarController::entry_input));
|
||||
spinner.signal_output().connect (mem_fun (*this, &BarController::entry_output));
|
||||
spinner.set_digits (9);
|
||||
spinner.set_numeric (true);
|
||||
spinner.set_name ("BarControlSpinner");
|
||||
|
|
@ -170,81 +167,3 @@ BarController::set_sensitive (bool yn)
|
|||
Alignment::set_sensitive (yn);
|
||||
_slider.set_sensitive (yn);
|
||||
}
|
||||
|
||||
/*
|
||||
This is called when we need to update the adjustment with the value
|
||||
from the spinner's text entry.
|
||||
|
||||
We need to use Gtk::Entry::get_text to avoid recursive nastiness :)
|
||||
|
||||
If we're not in logarithmic mode we can return false to use the
|
||||
default conversion.
|
||||
|
||||
In theory we should check for conversion errors but set numeric
|
||||
mode to true on the spinner prevents invalid input.
|
||||
*/
|
||||
int
|
||||
BarController::entry_input (double* new_value)
|
||||
{
|
||||
if (!_logarithmic) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// extract a double from the string and take its log
|
||||
Gtk::SpinButton& spinner = _slider.get_spin_button();
|
||||
Entry *entry = dynamic_cast<Entry *>(&spinner);
|
||||
double value;
|
||||
|
||||
{
|
||||
// Switch to user's preferred locale so that
|
||||
// if they use different LC_NUMERIC conventions,
|
||||
// we will honor them.
|
||||
|
||||
PBD::LocaleGuard lg ("");
|
||||
sscanf (entry->get_text().c_str(), "%lf", &value);
|
||||
}
|
||||
|
||||
*new_value = log(value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
This is called when we need to update the spinner's text entry
|
||||
with the value of the adjustment.
|
||||
|
||||
We need to use Gtk::Entry::set_text to avoid recursive nastiness :)
|
||||
|
||||
If we're not in logarithmic mode we can return false to use the
|
||||
default conversion.
|
||||
*/
|
||||
bool
|
||||
BarController::entry_output ()
|
||||
{
|
||||
if (!_logarithmic) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char buf[128];
|
||||
Gtk::SpinButton& spinner = _slider.get_spin_button();
|
||||
|
||||
// generate the exponential and turn it into a string
|
||||
// convert to correct locale.
|
||||
|
||||
stringstream stream;
|
||||
string str;
|
||||
|
||||
{
|
||||
// Switch to user's preferred locale so that
|
||||
// if they use different LC_NUMERIC conventions,
|
||||
// we will honor them.
|
||||
|
||||
PBD::LocaleGuard lg ("");
|
||||
snprintf (buf, sizeof (buf), "%g", exp (spinner.get_adjustment()->get_value()));
|
||||
}
|
||||
|
||||
Entry *entry = dynamic_cast<Entry *>(&spinner);
|
||||
entry->set_text(buf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ class LIBGTKMM2EXT_API BarController : public Gtk::Alignment
|
|||
virtual ~BarController ();
|
||||
|
||||
void set_sensitive (bool yn);
|
||||
void set_logarithmic (bool yn) { _logarithmic = yn; }
|
||||
|
||||
PixFader::Tweaks tweaks() const { return _slider.tweaks (); }
|
||||
void set_tweaks (PixFader::Tweaks t) { _slider.set_tweaks (t);}
|
||||
|
|
@ -65,15 +64,12 @@ class LIBGTKMM2EXT_API BarController : public Gtk::Alignment
|
|||
HSliderController _slider;
|
||||
bool entry_focus_out (GdkEventFocus*);
|
||||
void entry_activated ();
|
||||
int entry_input (double* new_value);
|
||||
bool entry_output ();
|
||||
void before_expose ();
|
||||
|
||||
gint switch_to_bar ();
|
||||
gint switch_to_spinner ();
|
||||
|
||||
bool _grabbed;
|
||||
bool _logarithmic;
|
||||
bool _switching;
|
||||
bool _switch_on_release;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue