summaryrefslogtreecommitdiff
path: root/gtk2_ardour/ardour_button.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-12-10 02:21:36 +0100
committerRobin Gareus <robin@gareus.org>2016-12-10 15:54:37 +0100
commit6a429cfb7c14d008bb56bd4da81fd2c78858a017 (patch)
treef0185163b5a9cd0b0a3c3e74163290c2e83d6d4e /gtk2_ardour/ardour_button.cc
parente97404c5de8f55c0a0e763f941c31af657a6a269 (diff)
Consistent ArdourButton sizing for elements with LED
Diffstat (limited to 'gtk2_ardour/ardour_button.cc')
-rw-r--r--gtk2_ardour/ardour_button.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc
index 922ba84d2c..096cf4842d 100644
--- a/gtk2_ardour/ardour_button.cc
+++ b/gtk2_ardour/ardour_button.cc
@@ -172,6 +172,8 @@ ArdourButton::set_layout_font (const Pango::FontDescription& fd)
if (_layout) {
_layout->set_font_description (fd);
queue_resize ();
+ _char_pixel_width = 0;
+ _char_pixel_height = 0;
}
}
@@ -406,7 +408,7 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *)
cairo_save (cr);
cairo_rotate(cr, _angle * M_PI / 180.0);
cairo_device_to_user(cr, &ww, &wh);
- xa = (ww - _text_width) * _xalign;
+ xa = text_margin + (ww - _text_width - 2 * text_margin) * _xalign;
ya = (wh - _text_height) * _yalign;
/* quick hack for left/bottom alignment at -90deg
@@ -649,7 +651,7 @@ ArdourButton::on_size_request (Gtk::Requisition* req)
req->width = req->height;
if (req->height < req->width)
req->height = req->width;
- } else if (_sizing_text.empty() && _text_width > 0 && !(_elements & (Menu | Indicator))) {
+ } else if (_sizing_text.empty() && _text_width > 0 && !(_elements & Menu)) {
// properly centered text for those elements that are centered
// (no sub-pixel offset)
if ((req->width - _text_width) & 1) { ++req->width; }
@@ -1189,7 +1191,7 @@ ArdourButton::recalc_char_pixel_geometry ()
// NB. this is not static, since the geometry is different
// depending on the font used.
int w, h;
- std::string x = _("ABCDEFGHIJLKMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
+ std::string x = _("@ABCDEFGHIJLKMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
_layout->set_text (x);
_layout->get_pixel_size (w, h);
_char_pixel_height = std::max(4, h);