Label panner automation sliders the same as panners.
authorCarl Hetherington <carl@carlh.net>
Sun, 8 Aug 2010 02:19:20 +0000 (02:19 +0000)
committerCarl Hetherington <carl@carlh.net>
Sun, 8 Aug 2010 02:19:20 +0000 (02:19 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7563 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/automation_controller.cc
gtk2_ardour/panner.cc
gtk2_ardour/panner.h
libs/ardour/ardour/panner.h
libs/ardour/panner.cc

index ae727cd98f9216b74e47dfd15242e0a209e7e210..f63f2ed70c4fb48bc92c3ab38ce5c9d5f12b90ea 100644 (file)
@@ -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();
        }
index 8c5524b414325c8db1b8a55a97588716d473b9c3..145ef020e3fc1deeecda716ecd1c22e24d208be5 100644 (file)
@@ -164,32 +164,10 @@ bool
 PannerBar::entry_output ()
 {
        Entry* e = dynamic_cast<Entry*> (&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<Pango::Context> p = get_pango_context ();
                Glib::RefPtr<Pango::Layout> 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);
 }
index 61d63dd7625f06330d85ae1c900459e52947fda0..298e866c3d50ba9fbbe7919694a9494a91d3a516 100644 (file)
@@ -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__ */
index abee3431ce351e24568645f4cf7e43e059a45e6d..62512f6181c1b0f8211525ff22944e43bde6e9c8 100644 (file)
@@ -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 &);
index b224bf558eca395c22a85491517e4a463c06960d..c400199943c3bf9d89cb0b03f967b027576231f3 100644 (file)
@@ -29,6 +29,7 @@
 #include <locale.h>
 #include <unistd.h>
 #include <float.h>
+#include <iomanip>
 
 #include <glibmm.h>
 
@@ -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 "";
+}