From 555fcb89e541a8aaf1beb3df234e60569a667876 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 19 Jun 2017 12:33:43 +0200 Subject: GUI: prepare for API changes remove use of - unbound_min/max - list->default_value and min/max_y --- gtk2_ardour/automation_line.cc | 4 ++-- gtk2_ardour/editor_ops.cc | 2 +- gtk2_ardour/generic_pluginui.cc | 31 +++++-------------------------- gtk2_ardour/plugin_ui.h | 9 --------- 4 files changed, 8 insertions(+), 38 deletions(-) diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 98b87ee6e6..388d817c39 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -1225,7 +1225,7 @@ AutomationLine::view_to_model_coord_y (double& y) const y = max ((double) _desc.lower, y); y = min ((double) _desc.upper, y); } else { - y = y * (double)(alist->get_max_y() - alist->get_min_y()) + alist->get_min_y(); + y = y * (double)(_desc.upper - _desc.lower) + _desc.lower; if (_desc.integer_step) { y = round(y); } else if (_desc.toggled) { @@ -1255,7 +1255,7 @@ AutomationLine::model_to_view_coord_y (double& y) const } else if (alist->parameter().type() == PanWidthAutomation) { y = .5 + y * .5; } else { - y = (y - alist->get_min_y()) / (double)(alist->get_max_y() - alist->get_min_y()); + y = (y - _desc.lower) / (double)(_desc.upper - _desc.lower); } } diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 1005dc72b4..e7a1a74610 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -4949,7 +4949,7 @@ Editor::reset_point_selection () { for (PointSelection::iterator i = selection->points.begin(); i != selection->points.end(); ++i) { ARDOUR::AutomationList::iterator j = (*i)->model (); - (*j)->value = (*i)->line().the_list()->default_value (); + (*j)->value = (*i)->line().the_list()->descriptor ().normal; } } diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index a655203920..4267d30a43 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -902,12 +902,6 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param, UIConfiguration::instance().color ("meter background top") ); - info->min_unbound = desc.min_unbound; - info->max_unbound = desc.max_unbound; - - info->min = desc.lower; - info->max = desc.upper; - control_ui->label.set_angle(90); HBox* center = manage (new HBox); @@ -1094,27 +1088,12 @@ GenericPluginUI::output_update () buf[len] = '\0'; (*i)->display_label->set_text (buf); - /* autoscaling for the meter */ if ((*i)->meterinfo && (*i)->meterinfo->packed) { - - if (val < (*i)->meterinfo->min) { - if ((*i)->meterinfo->min_unbound) - (*i)->meterinfo->min = val; - else - val = (*i)->meterinfo->min; - } - - if (val > (*i)->meterinfo->max) { - if ((*i)->meterinfo->max_unbound) - (*i)->meterinfo->max = val; - else - val = (*i)->meterinfo->max; - } - - if ((*i)->meterinfo->max > (*i)->meterinfo->min ) { - float lval = (val - (*i)->meterinfo->min) / ((*i)->meterinfo->max - (*i)->meterinfo->min) ; - (*i)->meterinfo->meter->set (lval ); - } + const float upper = c->desc().upper; + const float lower = c->desc().lower; + val = std::min (upper, std::max (lower, val)); + float lval = (val - lower / (upper - lower)); + (*i)->meterinfo->meter->set (lval); } } } diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index ad800e284d..8bdc4deec2 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -206,20 +206,11 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox struct MeterInfo { Gtkmm2ext::FastMeter *meter; - - float min; - float max; - bool min_unbound; - bool max_unbound; bool packed; MeterInfo () { meter = 0; packed = false; - min = 1.0e10; - max = -1.0e10; - min_unbound = false; - max_unbound = false; } }; -- cgit v1.2.3