French translation update
[ardour.git] / libs / gtkmm2ext / click_box.cc
index 383fa6e583373ebe0ba253f1caa14cd666e742d5..876c68f665240a6800d356eaef1c08738b46ade3 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 1999 Paul Barton-Davis 
+    Copyright (C) 1999 Paul Barton-Davis
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -88,6 +88,7 @@ void
 ClickBox::set_label ()
 {
        char buf[32];
+       int width, height;
 
        bool const h = _printer (buf, get_adjustment());
        if (!h) {
@@ -96,7 +97,17 @@ ClickBox::set_label ()
        }
 
        layout->set_text (buf);
-       layout->get_pixel_size (twidth, theight);
+       layout->get_pixel_size (width, height);
+
+       if (twidth < width && (width > 50))  {
+               /* override GenericPluginUI::build_control_ui()
+                * Gtkmm2ext::set_size_request_to_display_given_text ("g9999999")
+                * see http://tracker.ardour.org/view.php?id=6499
+                */
+               set_size_request (std::min (300, width + 6), height + 4);
+       }
+
+       twidth = width; theight = height;
 
        queue_draw ();
 }
@@ -104,7 +115,7 @@ ClickBox::set_label ()
 void
 ClickBox::style_changed (const Glib::RefPtr<Gtk::Style>&)
 {
-       layout->context_changed (); 
+       layout->context_changed ();
        layout->get_pixel_size (twidth, theight);
 }
 
@@ -124,21 +135,21 @@ ClickBox::on_expose_event (GdkEventExpose *ev)
        Glib::RefPtr<Gdk::GC> fg_gc (style->get_fg_gc (Gtk::STATE_NORMAL));
        Glib::RefPtr<Gdk::GC> bg_gc (style->get_bg_gc (Gtk::STATE_NORMAL));
        Glib::RefPtr<Gdk::Window> win (get_window());
-       
+
        GdkRectangle base_rect;
        GdkRectangle draw_rect;
        gint x, y, width, height, depth;
-       
+
        win->get_geometry (x, y, width, height, depth);
-       
+
        base_rect.width = width;
        base_rect.height = height;
        base_rect.x = 0;
        base_rect.y = 0;
-       
+
        gdk_rectangle_intersect (&ev->area, &base_rect, &draw_rect);
        win->draw_rectangle (bg_gc, true, draw_rect.x, draw_rect.y, draw_rect.width, draw_rect.height);
-       
+
        if (twidth && theight) {
                win->draw_layout (fg_gc, (width - twidth) / 2, (height - theight) / 2, layout);
        }