diff options
author | Carl Hetherington <carl@carlh.net> | 2009-05-20 13:28:30 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2009-05-20 13:28:30 +0000 |
commit | 64524c0ba40b9f69f06a395f8763615700244fda (patch) | |
tree | 35178c663851a00069c6f3c3a7fbe4ee99f17d5d /gtk2_ardour/automation_controller.cc | |
parent | dbe20bd3a9d23e1e49556a1f47a31c5b8144dfda (diff) |
Make pan double-click entry work in percentage left or right. Write pan position to the panner as text (except when centered). Use a virtual function rather than a signal for BarController labels.
git-svn-id: svn://localhost/ardour2/branches/3.0@5104 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/automation_controller.cc')
-rw-r--r-- | gtk2_ardour/automation_controller.cc | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/gtk2_ardour/automation_controller.cc b/gtk2_ardour/automation_controller.cc index cf79eb4d48..90c6279f17 100644 --- a/gtk2_ardour/automation_controller.cc +++ b/gtk2_ardour/automation_controller.cc @@ -18,6 +18,7 @@ */ +#include <iomanip> #include "pbd/error.h" #include "ardour/automation_list.h" #include "ardour/automation_control.h" @@ -35,7 +36,7 @@ using namespace Gtk; AutomationController::AutomationController(boost::shared_ptr<AutomationControl> ac, Adjustment* adj) - : BarController(*adj, ac) + : BarController (*adj, ac) , _ignore_change(false) , _controllable(ac) , _adjustment(adj) @@ -44,8 +45,6 @@ AutomationController::AutomationController(boost::shared_ptr<AutomationControl> set_style (BarController::LeftToRight); set_use_parent (true); - label_callback = sigc::mem_fun(this, &AutomationController::update_label); - StartGesture.connect (mem_fun(*this, &AutomationController::start_touch)); StopGesture.connect (mem_fun(*this, &AutomationController::end_touch)); @@ -78,16 +77,19 @@ AutomationController::create( return boost::shared_ptr<AutomationController>(new AutomationController(ac, adjustment)); } -void -AutomationController::update_label(char* label, int label_len) +std::string +AutomationController::get_label (int&) { - if (label && label_len) { - // Hack to display CC rounded to int - if (_controllable->parameter().type() == MidiCCAutomation) - snprintf(label, label_len, "%d", (int)_controllable->get_value()); - else - snprintf(label, label_len, "%.3f", _controllable->get_value()); + std::stringstream s; + + // Hack to display CC rounded to int + if (_controllable->parameter().type() == MidiCCAutomation) { + s << (int)_controllable->get_value(); + } else { + s << std::fixed << std::setprecision(3) << _controllable->get_value(); } + + return s.str (); } void |