tweak time axis view item text positioning; allow ArdourCanvas::Text to have its width clamped, and use this as TAVI's get narrow so that text doesn't overflow

This commit is contained in:
Paul Davis 2013-04-15 14:45:22 -04:00
parent 7e19053b88
commit 393ba98422
3 changed files with 19 additions and 10 deletions

View file

@ -21,6 +21,7 @@ Text::Text (Group* parent)
, _width (0)
, _height (0)
, _need_redraw (false)
, _clamped_width (COORD_MAX)
{
}
@ -80,6 +81,12 @@ Text::redraw (Cairo::RefPtr<Cairo::Context> context) const
_need_redraw = false;
}
void
Text::clamp_width (double w)
{
_clamped_width = w;
}
void
Text::compute_bounding_box () const
{
@ -120,7 +127,7 @@ Text::render (Rect const & /*area*/, Cairo::RefPtr<Cairo::Context> context) cons
}
context->set_source (_image, 0, 0);
context->rectangle (0, 0, _width, _height);
context->rectangle (0, 0, min (_clamped_width, _width), _height);
context->fill ();
}