]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/XPainter.C
remove defaults stuff, let Qt handle no toolbar
[lyx.git] / src / frontends / xforms / XPainter.C
index 3b11120de3c328df0892eaf53a6060263b7c28f2..a4dd8d6cbc7e7a656c0d4805df71bd15a465b3e7 100644 (file)
@@ -1,17 +1,16 @@
 /**
  * \file XPainter.C
- * Copyright 1998-2002 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
  * \author unknown
- * \author John Levon <moz@compsoc.man.ac.uk>
+ * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include "XPainter.h"
 #include "LString.h"
 #include "encoding.h"
 #include "language.h"
 
-#ifdef USE_XFORMS_IMAGE_LOADER
 #include "xformsImage.h"
-#else
-#include "graphics/GraphicsImageXPM.h"
-#endif
 
 #include "support/LAssert.h"
 #include "support/lstrings.h"
@@ -39,7 +34,7 @@
 using std::endl;
 using std::max;
 
+
 XPainter::XPainter(XWorkArea & xwa)
        : Painter(), owner_(xwa)
 {
@@ -57,7 +52,7 @@ int XPainter::paperHeight() const
        return owner_.workHeight();
 }
 
+
 Painter & XPainter::point(int x, int y, LColor::color c)
 {
        XDrawPoint(fl_get_display(), owner_.getPixmap(),
@@ -66,20 +61,20 @@ Painter & XPainter::point(int x, int y, LColor::color c)
 }
 
 
-Painter & XPainter::line(int x1, int y1, 
+Painter & XPainter::line(int x1, int y1,
        int x2, int y2,
        LColor::color col,
        line_style ls,
        line_width lw)
 {
-       XDrawLine(fl_get_display(), owner_.getPixmap(), 
+       XDrawLine(fl_get_display(), owner_.getPixmap(),
                lyxColorHandler->getGCLinepars(ls, lw, col),
                x1, y1, x2, y2);
        return *this;
 }
 
 
-Painter & XPainter::lines(int const * xp, int const * yp, 
+Painter & XPainter::lines(int const * xp, int const * yp,
        int np,
        LColor::color col,
        line_style ls,
@@ -92,28 +87,28 @@ Painter & XPainter::lines(int const * xp, int const * yp,
                points[i].y = yp[i];
        }
 
-        XDrawLines(fl_get_display(), owner_.getPixmap(),
-               lyxColorHandler->getGCLinepars(ls, lw, col), 
+       XDrawLines(fl_get_display(), owner_.getPixmap(),
+               lyxColorHandler->getGCLinepars(ls, lw, col),
                points.get(), np, CoordModeOrigin);
 
        return *this;
-}      
+}
 
 
-Painter & XPainter::rectangle(int x, int y, 
+Painter & XPainter::rectangle(int x, int y,
        int w, int h,
        LColor::color col,
        line_style ls,
        line_width lw)
 {
        XDrawRectangle(fl_get_display(), owner_.getPixmap(),
-               lyxColorHandler->getGCLinepars(ls, lw, col), 
+               lyxColorHandler->getGCLinepars(ls, lw, col),
                x, y, w, h);
        return *this;
 }
 
 
-Painter & XPainter::fillRectangle(int x, int y, 
+Painter & XPainter::fillRectangle(int x, int y,
        int w, int h,
        LColor::color col)
 {
@@ -123,7 +118,7 @@ Painter & XPainter::fillRectangle(int x, int y,
 }
 
 
-Painter & XPainter::fillPolygon(int const * xp, int const * yp, 
+Painter & XPainter::fillPolygon(int const * xp, int const * yp,
        int np, LColor::color col)
 {
        boost::scoped_array<XPoint> points(new XPoint[np]);
@@ -132,55 +127,52 @@ Painter & XPainter::fillPolygon(int const * xp, int const * yp,
                points[i].x = xp[i];
                points[i].y = yp[i];
        }
+
        XFillPolygon(fl_get_display(), owner_.getPixmap(),
-               lyxColorHandler->getGCForeground(col), points.get(), 
+               lyxColorHandler->getGCForeground(col), points.get(),
                np, Nonconvex, CoordModeOrigin);
+
        return *this;
 }
 
+
 Painter & XPainter::arc(int x, int y,
        unsigned int w, unsigned int h,
        int a1, int a2, LColor::color col)
 {
-        XDrawArc(fl_get_display(), owner_.getPixmap(),
+       XDrawArc(fl_get_display(), owner_.getPixmap(),
                lyxColorHandler->getGCForeground(col),
                x, y, w, h, a1, a2);
-        return *this;
+       return *this;
 }
 
-Painter & XPainter::image(int x, int y, 
+
+Painter & XPainter::image(int x, int y,
        int w, int h,
        grfx::Image const & i)
 {
-#ifdef USE_XFORMS_IMAGE_LOADER
-       grfx::xformsImage const & image = static_cast<grfx::xformsImage const &>(i);
-#else
-       grfx::ImageXPM const & image = static_cast<grfx::ImageXPM const &>(i);
-#endif
-       
+       grfx::xformsImage const & image =
+               static_cast<grfx::xformsImage const &>(i);
+
        XGCValues val;
        val.function = GXcopy;
        GC gc = XCreateGC(fl_get_display(), owner_.getPixmap(),
                GCFunction, &val);
-       XCopyArea(fl_get_display(), image.getPixmap(), owner_.getPixmap(), 
+       XCopyArea(fl_get_display(), image.getPixmap(), owner_.getPixmap(),
                gc, 0, 0, w, h, x, y);
        XFreeGC(fl_get_display(), gc);
        return *this;
 }
 
 
-Painter & XPainter::text(int x, int y, 
+Painter & XPainter::text(int x, int y,
        string const & s, LyXFont const & f)
 {
        return text(x, y, s.data(), s.length(), f);
 }
 
 
-Painter & XPainter::text(int x, int y, 
+Painter & XPainter::text(int x, int y,
        char c, LyXFont const & f)
 {
        char s[2] = { c, '\0' };
@@ -188,7 +180,7 @@ Painter & XPainter::text(int x, int y,
 }
 
 
-Painter & XPainter::text(int x, int y, 
+Painter & XPainter::text(int x, int y,
        char const * s, size_t ls,
        LyXFont const & f)
 {
@@ -239,12 +231,12 @@ Painter & XPainter::text(int x, int y,
        if (f.underbar() == LyXFont::ON) {
                underline(f, x, y, font_metrics::width(s, ls, f));
        }
-       
+
        return *this;
 }
 
 
-Painter & XPainter::text(int x, int y, 
+Painter & XPainter::text(int x, int y,
        XChar2b const * s, size_t ls,
        LyXFont const & f)
 {
@@ -277,10 +269,10 @@ Painter & XPainter::text(int x, int y,
                        }
                }
        }
-       
+
        if (f.underbar() == LyXFont::ON) {
                underline(f, x, y, xfont_metrics::width(s, ls, f));
        }
-       
+
        return *this;
 }