]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/XPainter.C
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / xforms / XPainter.C
index a40e3342f3b20be0d55143644b67c6eeae0cbe48..7bfbca941dc1e750d3fdbbd6d1a1c20e2920c14e 100644 (file)
@@ -6,35 +6,35 @@
  * \author Lars Gullik Bjønnes
  * \author John Levon
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
 #include "XPainter.h"
-#include "LString.h"
-#include "debug.h"
-#include "XWorkArea.h"
-#include "xfont_metrics.h"
+
 #include "ColorHandler.h"
-#include "lyxrc.h"
+#include "xfont_metrics.h"
+#include "xformsImage.h"
+#include "XWorkArea.h"
+
+#include "font_metrics.h"
+
 #include "encoding.h"
 #include "language.h"
+#include "LColor.h"
+#include "lyxfont.h"
+#include "lyxrc.h"
 
-#include "xformsImage.h"
-
-#include "support/LAssert.h"
 #include "support/lstrings.h"
 
-#include <boost/scoped_array.hpp>
-
-#include <cmath>
+using std::string;
 
-using namespace lyx::support;
+namespace lyx {
 
-using std::endl;
-using std::max;
+using support::uppercase;
 
+namespace frontend {
 
 XPainter::XPainter(XWorkArea & xwa)
        : Painter(), owner_(xwa)
@@ -54,30 +54,28 @@ int XPainter::paperHeight() const
 }
 
 
-Painter & XPainter::point(int x, int y, LColor::color c)
+void XPainter::point(int x, int y, LColor_color c)
 {
        XDrawPoint(fl_get_display(), owner_.getPixmap(),
                lyxColorHandler->getGCForeground(c), x, y);
-       return *this;
 }
 
 
-Painter & XPainter::line(int x1, int y1,
+void XPainter::line(int x1, int y1,
        int x2, int y2,
-       LColor::color col,
+       LColor_color col,
        line_style ls,
        line_width lw)
 {
        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,
+void XPainter::lines(int const * xp, int const * yp,
        int np,
-       LColor::color col,
+       LColor_color col,
        line_style ls,
        line_width lw)
 {
@@ -91,36 +89,32 @@ Painter & XPainter::lines(int const * xp, int const * yp,
        XDrawLines(fl_get_display(), owner_.getPixmap(),
                lyxColorHandler->getGCLinepars(ls, lw, col),
                points.get(), np, CoordModeOrigin);
-
-       return *this;
 }
 
 
-Painter & XPainter::rectangle(int x, int y,
+void XPainter::rectangle(int x, int y,
        int w, int h,
-       LColor::color col,
+       LColor_color col,
        line_style ls,
        line_width lw)
 {
        XDrawRectangle(fl_get_display(), owner_.getPixmap(),
                lyxColorHandler->getGCLinepars(ls, lw, col),
                x, y, w, h);
-       return *this;
 }
 
 
-Painter & XPainter::fillRectangle(int x, int y,
+void XPainter::fillRectangle(int x, int y,
        int w, int h,
-       LColor::color col)
+       LColor_color col)
 {
        XFillRectangle(fl_get_display(), owner_.getPixmap(),
                lyxColorHandler->getGCForeground(col), x, y, w, h);
-       return *this;
 }
 
 
-Painter & XPainter::fillPolygon(int const * xp, int const * yp,
-       int np, LColor::color col)
+void XPainter::fillPolygon(int const * xp, int const * yp,
+       int np, LColor_color col)
 {
        boost::scoped_array<XPoint> points(new XPoint[np]);
 
@@ -132,28 +126,25 @@ Painter & XPainter::fillPolygon(int const * xp, int const * yp,
        XFillPolygon(fl_get_display(), owner_.getPixmap(),
                lyxColorHandler->getGCForeground(col), points.get(),
                np, Nonconvex, CoordModeOrigin);
-
-       return *this;
 }
 
 
-Painter & XPainter::arc(int x, int y,
+void XPainter::arc(int x, int y,
        unsigned int w, unsigned int h,
-       int a1, int a2, LColor::color col)
+       int a1, int a2, LColor_color col)
 {
        XDrawArc(fl_get_display(), owner_.getPixmap(),
                lyxColorHandler->getGCForeground(col),
                x, y, w, h, a1, a2);
-       return *this;
 }
 
 
-Painter & XPainter::image(int x, int y,
-       int w, int h,
-       grfx::Image const & i)
+void XPainter::image(int x, int y,
+                    int w, int h,
+                    graphics::Image const & i)
 {
-       grfx::xformsImage const & image =
-               static_cast<grfx::xformsImage const &>(i);
+       graphics::xformsImage const & image =
+               static_cast<graphics::xformsImage const &>(i);
 
        XGCValues val;
        val.function = GXcopy;
@@ -162,18 +153,17 @@ Painter & XPainter::image(int x, int y,
        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,
+void 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,
+void XPainter::text(int x, int y,
        char c, LyXFont const & f)
 {
        char s[2] = { c, '\0' };
@@ -181,7 +171,7 @@ Painter & XPainter::text(int x, int y,
 }
 
 
-Painter & XPainter::text(int x, int y,
+void XPainter::text(int x, int y,
        char const * s, size_t ls,
        LyXFont const & f)
 {
@@ -202,7 +192,7 @@ Painter & XPainter::text(int x, int y,
                        xs[i].byte2 = c & 0xff;
                }
                text(x, y, xs.get(), ls, font);
-               return *this;
+               return;
        }
 
        GC gc = lyxColorHandler->getGCForeground(f.realColor());
@@ -232,12 +222,10 @@ 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,
+void XPainter::text(int x, int y,
        XChar2b const * s, size_t ls,
        LyXFont const & f)
 {
@@ -274,6 +262,7 @@ Painter & XPainter::text(int x, int y,
        if (f.underbar() == LyXFont::ON) {
                underline(f, x, y, xfont_metrics::width(s, ls, f));
        }
-
-       return *this;
 }
+
+} // namespace frontend
+} // namespace lyx