mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-30 08:53:08 +01:00
allow derived children of BarController to set label position as a width fraction, not an absolute position
git-svn-id: svn://localhost/ardour2/branches/3.0@8597 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
4d1d355720
commit
9a87f854f7
6 changed files with 15 additions and 12 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public:
|
|||
|
||||
private:
|
||||
AutomationController (boost::shared_ptr<ARDOUR::Automatable> parent, boost::shared_ptr<ARDOUR::AutomationControl> ac, Gtk::Adjustment* adj);
|
||||
std::string get_label (int&);
|
||||
std::string get_label (double&);
|
||||
|
||||
void start_touch();
|
||||
void end_touch();
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ static const gchar *_unit_strings[] = {
|
|||
std::vector<std::string> LatencyGUI::unit_strings;
|
||||
|
||||
std::string
|
||||
LatencyBarController::get_label (int&)
|
||||
LatencyBarController::get_label (double&)
|
||||
{
|
||||
double const nframes = _latency_gui->adjustment.get_value();
|
||||
std::stringstream s;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public:
|
|||
private:
|
||||
LatencyGUI* _latency_gui;
|
||||
|
||||
std::string get_label (int&);
|
||||
std::string get_label (double&);
|
||||
};
|
||||
|
||||
class LatencyGUI : public Gtk::VBox
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class BarController : public Gtk::Frame
|
|||
sigc::slot<std::string> _label_slot;
|
||||
bool _use_slot;
|
||||
|
||||
virtual std::string get_label (int& /*x*/) {
|
||||
virtual std::string get_label (double& /*x*/) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue