enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h
[ardour.git] / gtk2_ardour / ardour_button.cc
index 0fa53c53728175152b7f0b98ed8bee37d34fa4f9..56854880d851c69285d5008e4099cfc67c99c132 100644 (file)
@@ -39,7 +39,7 @@
 #include "tooltips.h"
 #include "ui_config.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 #define BASELINESTRETCH (1.25)
 #define TRACKHEADERBTNW (3.10)
@@ -290,7 +290,7 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *)
        }
 
        //show the "convex" or "concave" gradient
-       if (!_flat_buttons) {
+       if (!_flat_buttons && (_elements & Body)==Body) {
                if ( active_state() == Gtkmm2ext::ExplicitActive && ( !((_elements & Indicator)==Indicator) || use_custom_led_color) ) {
                        //concave
                        cairo_set_source (cr, concave_pattern);
@@ -541,14 +541,30 @@ ArdourButton::on_size_request (Gtk::Requisition* req)
                }
        }
 
-       if ((_elements & Text) && !_text.empty()) {
-               // if _layout does not exist, char_pixel_height() creates it,
-               req->height = std::max(req->height, (int) ceil(char_pixel_height() * BASELINESTRETCH + 1.0));
-               assert (_layout);
-               _layout->get_pixel_size (_text_width, _text_height);
+       if (_elements & Text) {
+
+               if (_tweaks & OccasionalText) {
 
-               req->width += rint(1.75 * char_pixel_width()); // padding
-               req->width += _text_width;
+                       /* size should not change based on presence or absence
+                        * of text.
+                        */
+
+                       if (!_text.empty()) {
+                               ensure_layout ();
+                               _layout->set_text (_text);
+                               _layout->get_pixel_size (_text_width, _text_height);
+                       }
+
+               } else if (!_text.empty()) {
+
+                       //if _layout does not exist, char_pixel_height() creates it,
+
+                       req->height = std::max(req->height, (int) ceil(char_pixel_height() * BASELINESTRETCH + 1.0));
+                       assert (_layout);
+                       _layout->get_pixel_size (_text_width, _text_height);
+                       req->width += rint(1.75 * char_pixel_width()); // padding
+                       req->width += _text_width;
+               }
 
                /* XXX hack (surprise). Deal with two common rotation angles */