diff --git a/gtk2_ardour/automation_controller.cc b/gtk2_ardour/automation_controller.cc index 540612c8d4..5c00d5a779 100644 --- a/gtk2_ardour/automation_controller.cc +++ b/gtk2_ardour/automation_controller.cc @@ -85,8 +85,9 @@ AutomationController::create( } std::string -AutomationController::get_label (int&) +AutomationController::get_label (double& xpos) { + xpos = 0.5; return _owner->value_as_string (_controllable); } diff --git a/gtk2_ardour/automation_controller.h b/gtk2_ardour/automation_controller.h index 814f716f13..67def61c35 100644 --- a/gtk2_ardour/automation_controller.h +++ b/gtk2_ardour/automation_controller.h @@ -55,7 +55,7 @@ public: private: AutomationController (boost::shared_ptr parent, boost::shared_ptr ac, Gtk::Adjustment* adj); - std::string get_label (int&); + std::string get_label (double&); void start_touch(); void end_touch(); diff --git a/gtk2_ardour/latency_gui.cc b/gtk2_ardour/latency_gui.cc index 73b6bf1a30..d7c0be840f 100644 --- a/gtk2_ardour/latency_gui.cc +++ b/gtk2_ardour/latency_gui.cc @@ -25,7 +25,7 @@ static const gchar *_unit_strings[] = { std::vector LatencyGUI::unit_strings; std::string -LatencyBarController::get_label (int&) +LatencyBarController::get_label (double&) { double const nframes = _latency_gui->adjustment.get_value(); std::stringstream s; diff --git a/gtk2_ardour/latency_gui.h b/gtk2_ardour/latency_gui.h index 96aa6090d7..2adf2d4308 100644 --- a/gtk2_ardour/latency_gui.h +++ b/gtk2_ardour/latency_gui.h @@ -32,7 +32,7 @@ public: private: LatencyGUI* _latency_gui; - std::string get_label (int&); + std::string get_label (double&); }; class LatencyGUI : public Gtk::VBox diff --git a/libs/gtkmm2ext/barcontroller.cc b/libs/gtkmm2ext/barcontroller.cc index 8db8116ed6..fb331cee38 100644 --- a/libs/gtkmm2ext/barcontroller.cc +++ b/libs/gtkmm2ext/barcontroller.cc @@ -391,23 +391,25 @@ BarController::expose (GdkEventExpose* /*event*/) /* draw label */ - int xpos = -1; + double xpos = -1; std::string const label = get_label (xpos); if (!label.empty()) { layout->set_text (label); - int width, height; + int width, height, x; layout->get_pixel_size (width, height); if (xpos == -1) { - xpos = max (3, 1 + (x2 - (width/2))); - xpos = min (darea.get_width() - width - 3, xpos); - } - + x = max (3, 1 + (x2 - (width/2))); + x = min (darea.get_width() - width - 3, (int) lrint (xpos)); + } else { + x = lrint (darea.get_width() * xpos); + } + win->draw_layout (get_style()->get_text_gc (get_state()), - xpos, + x, (darea.get_height()/2) - (height/2), layout); } diff --git a/libs/gtkmm2ext/gtkmm2ext/barcontroller.h b/libs/gtkmm2ext/gtkmm2ext/barcontroller.h index c65d8abe81..b0721fba45 100644 --- a/libs/gtkmm2ext/gtkmm2ext/barcontroller.h +++ b/libs/gtkmm2ext/gtkmm2ext/barcontroller.h @@ -85,7 +85,7 @@ class BarController : public Gtk::Frame sigc::slot _label_slot; bool _use_slot; - virtual std::string get_label (int& /*x*/) { + virtual std::string get_label (double& /*x*/) { return ""; }