#include "QLPainter.h"
#include "GuiApplication.h"
-#include "GuiWorkArea.h"
+#include "GuiFontMetrics.h"
#include "QLImage.h"
#include "GuiApplication.h"
#include "language.h"
#include "LColor.h"
-#include "frontends/FontMetrics.h"
-
#include "support/unicode.h"
-#include <QPainter>
-#include <QPicture>
-#include <QPixmap>
-#include <QImage>
-
+#include <QWidget>
using std::endl;
using std::string;
}
-int QLPainter::paperWidth() const
-{
- return qwa_->width();
-}
-
-
-int QLPainter::paperHeight() const
-{
- return qwa_->height();
-}
-
-
void QLPainter::setQPainterPen(LColor_color col,
Painter::line_style ls, Painter::line_width lw)
{
void QLPainter::point(int x, int y, LColor_color col)
{
+ if (!isDrawingEnabled())
+ return;
+
setQPainterPen(col);
drawPoint(x, y);
}
line_style ls,
line_width lw)
{
+ if (!isDrawingEnabled())
+ return;
+
setQPainterPen(col, ls, lw);
drawLine(x1, y1, x2, y2);
}
points[i].setY(yp[i]);
}
+ if (!isDrawingEnabled())
+ return;
+
setQPainterPen(col, ls, lw);
drawPolyline(points.get(), np);
}
line_style ls,
line_width lw)
{
+ if (!isDrawingEnabled())
+ return;
+
setQPainterPen(col, ls, lw);
drawRect(x, y, w, h);
}
void QLPainter::arc(int x, int y, unsigned int w, unsigned int h,
int a1, int a2, LColor_color col)
{
+ if (!isDrawingEnabled())
+ return;
+
// LyX usings 1/64ths degree, Qt usings 1/16th
setQPainterPen(col);
drawArc(x, y, w, h, a1 / 4, a2 / 4);
fillRectangle(x, y, w, h, LColor::graphicsbg);
+ if (!isDrawingEnabled())
+ return;
+
drawImage(x, y, qlimage.qimage(), 0, 0, w, h);
}
} else {
setFont(qfont);
}
- drawText(x + textwidth, y, c);
+ if (isDrawingEnabled())
+ drawText(x + textwidth, y, c);
textwidth += fontMetrics().width(c);
}
return textwidth;
setFont(fi.font);
// We need to draw the text as LTR as we use our own bidi code.
setLayoutDirection(Qt::LeftToRight);
- drawText(x, y, str);
- textwidth = fontMetrics().width(str);
+ if (isDrawingEnabled())
+ drawText(x, y, str);
+ // 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(str);
} else {
textwidth = smallCapsText(x, y, str, f);
}