summaryrefslogtreecommitdiff
path: root/gtk2_ardour/marker.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-01-13 09:49:09 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2014-01-13 09:49:09 -0500
commit38ff5bb7caeae088283825e17c70e20800400868 (patch)
tree5dfdf4b11d021fc223a1ee90f6f15250ed23470c /gtk2_ardour/marker.cc
parentb9c389eac5d686aaa943562d51bad615006dfe27 (diff)
clamp marker name text appropriately
Diffstat (limited to 'gtk2_ardour/marker.cc')
-rw-r--r--gtk2_ardour/marker.cc34
1 files 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);