]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiPainter.cpp
do what the FIXME suggested
[lyx.git] / src / frontends / qt4 / GuiPainter.cpp
index dae8eda5eaf82b1527527876a09ddb6fc5dc8b5c..275c8d3eeac774334b6a67f1008acd4ee595cff2 100644 (file)
 #include "GuiApplication.h"
 #include "GuiFontMetrics.h"
 #include "GuiImage.h"
-
-#include "GuiApplication.h"
 #include "qt_helpers.h"
 
-#include "support/debug.h"
 #include "Language.h"
 #include "LyXRC.h"
 
-#include "support/unicode.h"
+#include "support/debug.h"
 
 #include <QPixmapCache>
 #include <QTextLayout>
@@ -37,9 +34,7 @@
 #define USE_PIXMAP_CACHE 1
 #endif
 
-using std::endl;
-using std::string;
-
+using namespace std;
 
 namespace lyx {
 namespace frontend {
@@ -369,10 +364,8 @@ int GuiPainter::text(int x, int y, docstring const & s,
                        setFont(fi.font);
                // We need to draw the text as LTR as we use our own bidi code.
                setLayoutDirection(Qt::LeftToRight);
-               // We need to draw the text as LTR as we use our own bidi code.
-               setLayoutDirection(Qt::LeftToRight);
                drawText(x, y, str);
-               //LYXERR(Debug::PAINTING, "draw " << std::string(str.toUtf8())
+               //LYXERR(Debug::PAINTING, "draw " << string(str.toUtf8())
                //      << " at " << x << "," << y);
                return textwidth;
        }
@@ -385,7 +378,7 @@ int GuiPainter::text(int x, int y, docstring const & s,
        // Only the left bearing of the first character is important
        // as we always write from left to right, even for
        // right-to-left languages.
-       int const lb = std::min(fi.metrics.lbearing(s[0]), 0);
+       int const lb = min(fi.metrics.lbearing(s[0]), 0);
        int const mA = fi.metrics.maxAscent();
        if (!QPixmapCache::find(key, pm)) {
                // Only the right bearing of the last character is
@@ -469,8 +462,10 @@ 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);
+       static int const d = Inset::TEXT_TO_INSET_OFFSET / 2;
+
+       button(x + d, y - ascent, width - d, descent + ascent, mouseHover);
+       text(x + Inset::TEXT_TO_INSET_OFFSET, y, str, font);
 }