#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>
#define USE_PIXMAP_CACHE 1
#endif
-using std::endl;
-using std::string;
-
+using namespace std;
namespace lyx {
namespace frontend {
// Here we use the font width cache instead of
// textwidth = fontMetrics().width(str);
// because the above is awfully expensive on MacOSX
- textwidth = fi.metrics->width(s);
+ textwidth = fi.metrics.width(s);
if (f.underbar() == FONT_ON)
underline(f, x, y, textwidth);
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;
}
// 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 mA = fi.metrics->maxAscent();
+ 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
// important as we always write from left to right,
// even for right-to-left languages.
- int const rb = fi.metrics->rbearing(s[s.size()-1]);
+ int const rb = fi.metrics.rbearing(s[s.size()-1]);
int const w = textwidth + rb - lb;
- int const mD = fi.metrics->maxDescent();
+ int const mD = fi.metrics.maxDescent();
int const h = mA + mD;
pm = QPixmap(w, h);
pm.fill(Qt::transparent);
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);
}
if (height >= 2)
height += below;
- for (int n = 0; n < height; ++n)
+ for (int n = 0; n != height; ++n)
line(x, y + below + n, x + width, y + below + n, f.color(), line_onoffdash);
}