From 38ff5bb7caeae088283825e17c70e20800400868 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 13 Jan 2014 09:49:09 -0500 Subject: [PATCH] clamp marker name text appropriately --- gtk2_ardour/marker.cc | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index 0da7598172..0242ab98b7 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -410,24 +410,24 @@ Marker::setup_name_display () int name_width = min ((double) pixel_width (_name, name_font) + 2, limit); if (name_width == 0) { - name_width = 1; - } - - if (label_on_left ()) { - _name_item->set_x_position (-name_width); - } - - _name_item->set (_name); - - // CAIROCANVAS - // need to "clip" name to name_width and name_height - - if (label_on_left ()) { - _name_background->set_x0 (_name_item->position().x - 2); - _name_background->set_x1 (_name_item->position().x + name_width + _shift); + _name_item->hide (); } else { - _name_background->set_x0 (_name_item->position().x - _label_offset + 2); - _name_background->set_x1 (_name_item->position().x + name_width); + _name_item->show (); + + if (label_on_left ()) { + _name_item->set_x_position (-name_width); + } + + _name_item->clamp_width (name_width); + _name_item->set (_name); + + if (label_on_left ()) { + _name_background->set_x0 (_name_item->position().x - 2); + _name_background->set_x1 (_name_item->position().x + name_width + _shift); + } else { + _name_background->set_x0 (_name_item->position().x - _label_offset + 2); + _name_background->set_x1 (_name_item->position().x + name_width); + } } _name_background->set_y0 (0);