diff options
author | Robin Gareus <robin@gareus.org> | 2020-03-28 22:43:37 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-03-28 22:43:37 +0100 |
commit | 7e0abc0dbf87cca4a66381eb006bedce91125c39 (patch) | |
tree | 7bd819a98d2a422a8b66f9c25fd191ab90bab07b /gtk2_ardour/control_point_dialog.cc | |
parent | eea697b260a97f0755693a7ec76e259bbf035424 (diff) |
Remove duplicate unit in ctrl-point dialog - #7472
Diffstat (limited to 'gtk2_ardour/control_point_dialog.cc')
-rw-r--r-- | gtk2_ardour/control_point_dialog.cc | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/gtk2_ardour/control_point_dialog.cc b/gtk2_ardour/control_point_dialog.cc index cec9a3dd4c..6f111d45b2 100644 --- a/gtk2_ardour/control_point_dialog.cc +++ b/gtk2_ardour/control_point_dialog.cc @@ -16,11 +16,14 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "control_point_dialog.h" -#include "control_point.h" +#include <string> +#include <gtkmm/stock.h> + #include "automation_line.h" +#include "control_point.h" +#include "control_point_dialog.h" + #include "pbd/i18n.h" -#include <gtkmm/stock.h> /** * ControlPointDialog constructor. @@ -29,14 +32,27 @@ */ ControlPointDialog::ControlPointDialog (ControlPoint* p) - : ArdourDialog (_("Control point")), - point_ (p) + : ArdourDialog (_("Control point")) + , point_ (p) { assert (point_); double const y_fraction = 1.0 - (p->get_y () / p->line().height ()); - value_.set_text (p->line().fraction_to_string (y_fraction)); + /* This effectively calls ARDOUR::value_as_string */ + std::string val (p->line().fraction_to_string (y_fraction)); + + /* Undo desc.toggled special cases */ + if (val == _("on")) { + val = "1"; + } else if (val == _("off")) { + val = "0"; + } + + /* separate quantity and unit (if any) */ + std::size_t sep = val.find_last_of (" "); + + value_.set_text (val.substr (0, sep)); value_.set_activates_default (); Gtk::HBox* b = Gtk::manage (new Gtk::HBox ()); @@ -44,8 +60,8 @@ ControlPointDialog::ControlPointDialog (ControlPoint* p) b->pack_start (*Gtk::manage (new Gtk::Label (_("Value")))); b->pack_start (value_); - if (p->line ().get_uses_gain_mapping ()) { - b->pack_start (*Gtk::manage (new Gtk::Label (_("dB")))); + if (sep != std::string::npos) { + b->pack_start (*Gtk::manage (new Gtk::Label (val.substr (sep + 1)))); } get_vbox ()->pack_end (*b); |