summaryrefslogtreecommitdiff
path: root/gtk2_ardour/ardour_button.cc
diff options
context:
space:
mode:
authorBen Loftis <ben@harrisonconsoles.com>2014-08-13 10:56:00 -0500
committerBen Loftis <ben@harrisonconsoles.com>2014-08-13 10:57:04 -0500
commitf3d524deb7c51c8b95d54630d66781b85e1e241b (patch)
tree173f90159b9110444c073dbd0b8e3469029dfa80 /gtk2_ardour/ardour_button.cc
parentaed4ab6ec95d674503d580ea99a7a343255d33e3 (diff)
Yet another attempt to standardize button heights.
Use the same string for all ArdourButtons to define the height. Height can still vary if you use a different font, though.
Diffstat (limited to 'gtk2_ardour/ardour_button.cc')
-rw-r--r--gtk2_ardour/ardour_button.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc
index 768eafa3d3..1337bb9eeb 100644
--- a/gtk2_ardour/ardour_button.cc
+++ b/gtk2_ardour/ardour_button.cc
@@ -512,7 +512,17 @@ ArdourButton::on_size_request (Gtk::Requisition* req)
CairoWidget::on_size_request (req);
if ((_elements & Text) && !_text.empty()) {
- _layout->get_pixel_size (_text_width, _text_height);
+
+ //calc our real width for our string (but ignore the height, because that results in inconsistent button heights)
+ int ignored;
+ _layout->get_pixel_size (_text_width, ignored);
+
+ //calc the height using some text with both ascenders and descenders
+ std::string t = _layout->get_text();
+ _layout->set_text ("WjgO"); //what we put here probably doesn't matter, as long as its the same for everyone
+ _layout->get_pixel_size (ignored, _text_height);
+ _layout->set_text (t);
+
if (_text_width + _diameter < 75) {
xpad = 7;
} else {