]> git.lyx.org Git - features.git/commitdiff
* buttonText(): painting tweaks.
authorAbdelrazak Younes <younes@lyx.org>
Thu, 14 Feb 2008 08:49:45 +0000 (08:49 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 14 Feb 2008 08:49:45 +0000 (08:49 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22999 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiFontMetrics.cpp
src/frontends/qt4/GuiPainter.cpp

index a64e21184e5cd30aa0a0b569eb39af267657cad5..d71c0b034bfb40049f5c10dc095aabf4656863de 100644 (file)
@@ -18,6 +18,8 @@
 #include "Language.h"
 #include "Dimension.h"
 
+#include "insets/Inset.h"
+
 #include <boost/assert.hpp>
 
 using namespace std;
@@ -175,11 +177,12 @@ int GuiFontMetrics::signedWidth(docstring const & s) const
 }
 
 
+static int const d = Inset::TEXT_TO_INSET_OFFSET / 2;
+
 void GuiFontMetrics::rectText(docstring const & str,
        int & w, int & ascent, int & descent) const
 {
-       static int const d = 2;
-       w = width(str) + d * 2 + 2;
+       w = width(str) + Inset::TEXT_TO_INSET_OFFSET;
        ascent = metrics_.ascent() + d;
        descent = metrics_.descent() + d;
 }
@@ -189,8 +192,7 @@ void GuiFontMetrics::rectText(docstring const & str,
 void GuiFontMetrics::buttonText(docstring const & str,
        int & w, int & ascent, int & descent) const
 {
-       static int const d = 3;
-       w = width(str) + d * 2 + 2;
+       w = width(str) + 2 * Inset::TEXT_TO_INSET_OFFSET;
        ascent = metrics_.ascent() + d;
        descent = metrics_.descent() + d;
 }
index f104abc58438ea1ec2cc29bdb1a35247793f2849..9b06147d2c9068df9acbad6fbd98d655f810ce71 100644 (file)
@@ -433,6 +433,7 @@ void GuiPainter::buttonFrame(int x, int y, int w, int h)
        line(x, y + h - 1, x - 1 + w, y + h - 1, Color_buttonframe);
 }
 
+static int const d = Inset::TEXT_TO_INSET_OFFSET / 2;
 
 void GuiPainter::rectText(int x, int y, docstring const & str,
        FontInfo const & font, ColorCode back, ColorCode frame)
@@ -465,8 +466,8 @@ void GuiPainter::buttonText(int x, int y, docstring const & str,
        FontMetrics const & fm = theFontMetrics(font);
        fm.buttonText(str, width, ascent, descent);
 
-       button(x + 1, y - ascent, width - 2, descent + ascent, mouseHover);
-       text(x + 4, y - 1, str, font);
+       button(x + d, y - ascent, width - d, descent + ascent, mouseHover);
+       text(x + Inset::TEXT_TO_INSET_OFFSET, y, str, font);
 }