From: Carl Hetherington Date: Sun, 8 Aug 2010 02:19:20 +0000 (+0000) Subject: Label panner automation sliders the same as panners. X-Git-Tag: 3.0-alpha5~1698 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=606a65321d72fe354db49f0c74a5c6968eb87a53;p=ardour.git Label panner automation sliders the same as panners. git-svn-id: svn://localhost/ardour2/branches/3.0@7563 d708f5d6-7413-0410-9779-e7cbd77b26cf --- diff --git a/gtk2_ardour/automation_controller.cc b/gtk2_ardour/automation_controller.cc index ae727cd98f..f63f2ed70c 100644 --- a/gtk2_ardour/automation_controller.cc +++ b/gtk2_ardour/automation_controller.cc @@ -24,6 +24,7 @@ #include "ardour/automation_control.h" #include "ardour/event_type_map.h" #include "ardour/automatable.h" +#include "ardour/panner.h" #include "ardour_ui.h" #include "utils.h" #include "automation_controller.h" @@ -85,6 +86,8 @@ AutomationController::get_label (int&) // Hack to display CC rounded to int if (_controllable->parameter().type() == MidiCCAutomation) { s << (int)_controllable->get_value(); + } else if (_controllable->parameter().type() == PanAutomation) { + s << Panner::value_as_string (_controllable->get_value ()); } else { s << std::fixed << std::setprecision(3) << _controllable->get_value(); } diff --git a/gtk2_ardour/panner.cc b/gtk2_ardour/panner.cc index 8c5524b414..145ef020e3 100644 --- a/gtk2_ardour/panner.cc +++ b/gtk2_ardour/panner.cc @@ -164,32 +164,10 @@ bool PannerBar::entry_output () { Entry* e = dynamic_cast (&spinner); - e->set_text (value_as_string (spinner.get_adjustment()->get_value())); + e->set_text (ARDOUR::Panner::value_as_string (spinner.get_adjustment()->get_value())); return true; } -string -PannerBar::value_as_string (double v) const -{ - if (ARDOUR::Panner::equivalent (v, 0.5)) { - return _("C"); - } else if (ARDOUR::Panner::equivalent (v, 0)) { - return _("L"); - } else if (ARDOUR::Panner::equivalent (v, 1)) { - return _("R"); - } else if (v < 0.5) { - std::stringstream s; - s << fixed << setprecision (0) << _("L") << ((0.5 - v) * 200) << "%"; - return s.str(); - } else if (v > 0.5) { - std::stringstream s; - s << fixed << setprecision (0) << _("R") << ((v -0.5) * 200) << "%"; - return s.str (); - } - - return ""; -} - std::string PannerBar::get_label (int& x) { @@ -209,7 +187,7 @@ PannerBar::get_label (int& x) Glib::RefPtr p = get_pango_context (); Glib::RefPtr l = Pango::Layout::create (p); - l->set_text (value_as_string (value)); + l->set_text (ARDOUR::Panner::value_as_string (value)); Pango::Rectangle const ext = l->get_ink_extents (); @@ -220,5 +198,5 @@ PannerBar::get_label (int& x) } } - return value_as_string (value); + return ARDOUR::Panner::value_as_string (value); } diff --git a/gtk2_ardour/panner.h b/gtk2_ardour/panner.h index 61d63dd762..298e866c3d 100644 --- a/gtk2_ardour/panner.h +++ b/gtk2_ardour/panner.h @@ -38,7 +38,6 @@ class PannerBar : public Gtkmm2ext::BarController private: std::string get_label (int&); - std::string value_as_string (double v) const; }; #endif /* __gtk_ardour_panner_h__ */ diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index abee3431ce..62512f6181 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -303,6 +303,8 @@ public: return automation_control (Evoral::Parameter (PanAutomation, chan, id)); } + static std::string value_as_string (double); + private: /* disallow copy construction */ Panner (Panner const &); diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc index b224bf558e..c400199943 100644 --- a/libs/ardour/panner.cc +++ b/libs/ardour/panner.cc @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -1640,3 +1641,25 @@ Panner::set_mono (bool yn) (*i)->set_mono (yn); } } + +string +Panner::value_as_string (double v) +{ + if (Panner::equivalent (v, 0.5)) { + return _("C"); + } else if (equivalent (v, 0)) { + return _("L"); + } else if (equivalent (v, 1)) { + return _("R"); + } else if (v < 0.5) { + stringstream s; + s << fixed << setprecision (0) << _("L") << ((0.5 - v) * 200) << "%"; + return s.str(); + } else { + stringstream s; + s << fixed << setprecision (0) << _("R") << ((v -0.5) * 200) << "%"; + return s.str (); + } + + return ""; +}