]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/QLPainter.C
Remove unused symbol encoding
[lyx.git] / src / frontends / qt4 / QLPainter.C
index 281365c8ebed584322e2a2b70179f0685764f7d6..4ac6a84c7065e6a88ed0c4bf6c939966665b86e9 100644 (file)
@@ -15,7 +15,6 @@
 
 #include "GuiApplication.h"
 #include "GuiFontMetrics.h"
-#include "GuiWorkArea.h"
 #include "QLImage.h"
 
 #include "GuiApplication.h"
 #include "language.h"
 #include "LColor.h"
 
-
 #include "support/unicode.h"
 
-#include <QPainter>
-#include <QPicture>
-#include <QPixmap>
-#include <QImage>
-
-
 using std::endl;
 using std::string;
 
 namespace lyx {
 namespace frontend {
 
-QLPainter::QLPainter(QWidget * qwa)
-       : qwa_(qwa)
+QLPainter::QLPainter(QPaintDevice * device)
+       : QPainter(device), Painter()
 {
-       //lyxerr << "QLPainter::start()" << endl;
-       QPainter::begin(qwa_);
-       setRenderHint(QPainter::TextAntialiasing);
        // new QPainter has default QPen:
        current_color_ = LColor::black;
        current_ls_ = line_solid;
@@ -60,18 +49,6 @@ QLPainter::~QLPainter()
 }
 
 
-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)
 {
@@ -102,6 +79,9 @@ void QLPainter::setQPainterPen(LColor_color col,
 
 void QLPainter::point(int x, int y, LColor_color col)
 {
+       if (!isDrawingEnabled())
+               return;
+
        setQPainterPen(col);
        drawPoint(x, y);
 }
@@ -112,6 +92,9 @@ void QLPainter::line(int x1, int y1, int x2, int y2,
        line_style ls,
        line_width lw)
 {
+       if (!isDrawingEnabled())
+               return;
+
        setQPainterPen(col, ls, lw);
        drawLine(x1, y1, x2, y2);
 }
@@ -132,6 +115,9 @@ void QLPainter::lines(int const * xp, int const * yp, int np,
                points[i].setY(yp[i]);
        }
 
+       if (!isDrawingEnabled())
+               return;
+
        setQPainterPen(col, ls, lw);
        drawPolyline(points.get(), np);
 }
@@ -142,6 +128,9 @@ void QLPainter::rectangle(int x, int y, int w, int h,
        line_style ls,
        line_width lw)
 {
+       if (!isDrawingEnabled())
+               return;
+
        setQPainterPen(col, ls, lw);
        drawRect(x, y, w, h);
 }
@@ -156,6 +145,9 @@ void QLPainter::fillRectangle(int x, int y, int w, int h, LColor_color col)
 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);
@@ -169,6 +161,9 @@ void QLPainter::image(int x, int y, int w, int h, graphics::Image const & i)
 
        fillRectangle(x, y, w, h, LColor::graphicsbg);
 
+       if (!isDrawingEnabled())
+               return;
+
        drawImage(x, y, qlimage.qimage(), 0, 0, w, h);
 }
 
@@ -205,7 +200,8 @@ int QLPainter::smallCapsText(int x, int y,
                } else {
                        setFont(qfont);
                }
-               drawText(x + textwidth, y, c);
+               if (isDrawingEnabled())
+                       drawText(x + textwidth, y, c);
                textwidth += fontMetrics().width(c);
        }
        return textwidth;
@@ -215,12 +211,6 @@ int QLPainter::smallCapsText(int x, int y,
 int QLPainter::text(int x, int y, char_type const * s, size_t ls,
        LyXFont const & f)
 {
-#if 0
-       Encoding const * encoding = f.language()->encoding();
-       if (f.isSymbolFont())
-               encoding = encodings.symbol_encoding();
-#endif
-
        QString str;
        ucs4_to_qstring(s, ls, str);
 
@@ -241,7 +231,11 @@ int QLPainter::text(int x, int y, char_type const * s, size_t ls,
                        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);
+               if (isDrawingEnabled()) {
+                       lyxerr[Debug::PAINTING] << "draw " << std::string(str.toUtf8())
+                               << " at " << x << "," << y << std::endl;
+                       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