From ea87429a231cceeced519733a78cf1c08c15f720 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Thu, 6 Sep 2007 12:25:30 +0000 Subject: [PATCH] Nicely align inset buttons with surrounding text. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20101 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetCollapsable.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index fa596d8e7c..ff9472edd5 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -250,18 +250,16 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y) const // Draw button first -- top, left or only Dimension dimc = dimensionCollapsed(); - TextMetrics const & tm = pi.base.bv->textMetrics(&text_); - int const baseline = y - tm.ascent(); if (geometry() == TopButton || geometry() == LeftButton || geometry() == ButtonOnly) { button_dim.x1 = xx + 0; button_dim.x2 = xx + dimc.width(); - button_dim.y1 = baseline; - button_dim.y2 = baseline + dimc.height(); + button_dim.y1 = y - dimc.asc; + button_dim.y2 = y + dimc.des; - pi.pain.buttonText(xx, baseline + dimc.asc, layout_.labelstring, layout_.labelfont, mouse_hover_); + pi.pain.buttonText(xx, y, layout_.labelstring, layout_.labelfont, mouse_hover_); } else { button_dim.x1 = 0; button_dim.y1 = 0; @@ -269,6 +267,8 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y) const button_dim.y2 = 0; } + TextMetrics const & tm = pi.base.bv->textMetrics(&text_); + int const baseline = y - tm.ascent(); int textx, texty; switch (geometry()) { case LeftButton: -- 2.39.2