]> git.lyx.org Git - features.git/commitdiff
Use the new Color class (see r28420) in the Painter code.
authorVincent van Ravesteijn <vfr@lyx.org>
Mon, 9 Feb 2009 20:10:11 +0000 (20:10 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Mon, 9 Feb 2009 20:10:11 +0000 (20:10 +0000)
See:
http://thread.gmane.org/gmane.editors.lyx.devel/114189

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28421 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/Painter.h
src/frontends/qt4/GuiPainter.cpp
src/frontends/qt4/GuiPainter.h

index ab65b55adb2194be3df0ab14cb05a72e7fd95573..6bc46ec241b2caf6f632fdd3e83cc72cb0098334 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef PAINTER_H
 #define PAINTER_H
 
-#include "ColorCode.h"
+#include "Color.h"
 
 #include "support/strfwd.h"
 
@@ -78,7 +78,7 @@ public:
        virtual ~Painter() {}
 
        /// draw a line from point to point
-       virtual void line(int x1, int y1, int x2, int y2, ColorCode,
+       virtual void line(int x1, int y1, int x2, int y2, Color,
                line_style = line_solid, line_width = line_thin) = 0;
 
        /**
@@ -87,22 +87,22 @@ public:
         * @param yp array of points' y co-ords
         * @param np size of the points array
         */
-       virtual void lines(int const * xp, int const * yp, int np, ColorCode,
+       virtual void lines(int const * xp, int const * yp, int np, Color,
                line_style = line_solid, line_width = line_thin) = 0;
 
        /// draw a rectangle
-       virtual void rectangle(int x, int y, int w, int h, ColorCode,
+       virtual void rectangle(int x, int y, int w, int h, Color,
                line_style = line_solid, line_width = line_thin) = 0;
 
        /// draw a filled rectangle
-       virtual void fillRectangle(int x, int y, int w, int h, ColorCode) = 0;
+       virtual void fillRectangle(int x, int y, int w, int h, Color) = 0;
 
        /// draw an arc
        virtual void arc(int x, int y, unsigned int w, unsigned int h,
-               int a1, int a2, ColorCode) = 0;
+               int a1, int a2, Color) = 0;
 
        /// draw a pixel
-       virtual void point(int x, int y, ColorCode) = 0;
+       virtual void point(int x, int y, Color) = 0;
 
        /// draw a filled rectangle with the shape of a 3D button
        virtual void button(int x, int y, int w, int h, bool mouseHover) = 0;
@@ -136,7 +136,7 @@ public:
         * around the text with the given color.
         */
        virtual void rectText(int x, int baseline, docstring const & str,
-               FontInfo const & font, ColorCode back, ColorCode frame) = 0;
+               FontInfo const & font, Color back, Color frame) = 0;
 
        /// draw a string and enclose it inside a button frame
        virtual void buttonText(int x, int baseline, docstring const & s,
@@ -147,8 +147,8 @@ public:
                char_type c, FontInfo const & f, preedit_style style) = 0;
 
        /// start monochrome painting mode, i.e. map every color into [min,max]
-       virtual void enterMonochromeMode(ColorCode const & min, 
-               ColorCode const & max) = 0;
+       virtual void enterMonochromeMode(Color const & min, 
+               Color const & max) = 0;
        /// leave monochrome painting mode
        virtual void leaveMonochromeMode() = 0;
 
index 0122475a7f05a83ad0d57225716498e319112000..f4bd49587c5445aad8c4d0c85f08dcb8bf6b0e8d 100644 (file)
@@ -112,7 +112,7 @@ QString GuiPainter::generateStringSignature(QString const & str, FontInfo const
 }
 
 
-QColor GuiPainter::computeColor(ColorCode col)
+QColor GuiPainter::computeColor(Color col)
 {
        return filterColor(guiApp->colorCache().get(col));
 }
@@ -144,7 +144,7 @@ QColor GuiPainter::filterColor(QColor const & col)
 }
 
 
-void GuiPainter::enterMonochromeMode(ColorCode const & min, ColorCode const & max)
+void GuiPainter::enterMonochromeMode(Color const & min, Color const & max)
 {
        QColor qmin = filterColor(guiApp->colorCache().get(min));
        QColor qmax = filterColor(guiApp->colorCache().get(max));
@@ -161,7 +161,7 @@ void GuiPainter::leaveMonochromeMode()
 }
 
 
-void GuiPainter::point(int x, int y, ColorCode col)
+void GuiPainter::point(int x, int y, Color col)
 {
        if (!isDrawingEnabled())
                return;
@@ -172,7 +172,7 @@ void GuiPainter::point(int x, int y, ColorCode col)
 
 
 void GuiPainter::line(int x1, int y1, int x2, int y2,
-       ColorCode col,
+       Color col,
        line_style ls,
        line_width lw)
 {
@@ -189,7 +189,7 @@ void GuiPainter::line(int x1, int y1, int x2, int y2,
 
 
 void GuiPainter::lines(int const * xp, int const * yp, int np,
-       ColorCode col,
+       Color col,
        line_style ls,
        line_width lw)
 {
@@ -217,7 +217,7 @@ void GuiPainter::lines(int const * xp, int const * yp, int np,
 
 
 void GuiPainter::rectangle(int x, int y, int w, int h,
-       ColorCode col,
+       Color col,
        line_style ls,
        line_width lw)
 {
@@ -229,7 +229,7 @@ void GuiPainter::rectangle(int x, int y, int w, int h,
 }
 
 
-void GuiPainter::fillRectangle(int x, int y, int w, int h, ColorCode col)
+void GuiPainter::fillRectangle(int x, int y, int w, int h, Color col)
 {
        if (!isDrawingEnabled())
                return;
@@ -239,7 +239,7 @@ void GuiPainter::fillRectangle(int x, int y, int w, int h, ColorCode col)
 
 
 void GuiPainter::arc(int x, int y, unsigned int w, unsigned int h,
-       int a1, int a2, ColorCode col)
+       int a1, int a2, Color col)
 {
        if (!isDrawingEnabled())
                return;
@@ -450,7 +450,7 @@ void GuiPainter::buttonFrame(int x, int y, int w, int h)
 
 
 void GuiPainter::rectText(int x, int y, docstring const & str,
-       FontInfo const & font, ColorCode back, ColorCode frame)
+       FontInfo const & font, Color back, Color frame)
 {
        int width;
        int ascent;
index c28857e68f77214e09732da4aafd21796366b278..fa87940d45ed0174d26ef158642b15ab55e82155 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef GUIPAINTER_H
 #define GUIPAINTER_H
 
+#include "Color.h"
+
 #include "frontends/Painter.h"
 
 #include <QPainter>
@@ -38,7 +40,7 @@ public:
        virtual void line(
                int x1, int y1,
                int x2, int y2,
-               ColorCode,
+               Color,
                line_style = line_solid,
                line_width = line_thin);
 
@@ -52,7 +54,7 @@ public:
                int const * xp,
                int const * yp,
                int np,
-               ColorCode,
+               Color,
                line_style = line_solid,
                line_width = line_thin);
 
@@ -60,7 +62,7 @@ public:
        virtual void rectangle(
                int x, int y,
                int w, int h,
-               ColorCode,
+               Color,
                line_style = line_solid,
                line_width = line_thin);
 
@@ -68,17 +70,17 @@ public:
        virtual void fillRectangle(
                int x, int y,
                int w, int h,
-               ColorCode);
+               Color);
 
        /// draw an arc
        virtual void arc(
                int x, int y,
                unsigned int w, unsigned int h,
                int a1, int a2,
-               ColorCode);
+               Color);
 
        /// draw a pixel
-       virtual void point(int x, int y, ColorCode);
+       virtual void point(int x, int y, Color);
 
        /// draw an image from the image cache
        virtual void image(int x, int y, int w, int h,
@@ -96,8 +98,8 @@ public:
                FontInfo const & font, bool mouseHover);
 
        /// start monochrome painting mode, i.e. map every color into [min,max]
-       virtual void enterMonochromeMode(ColorCode const & min, 
-               ColorCode const & max);
+       virtual void enterMonochromeMode(Color const & min, 
+               Color const & max);
        /// leave monochrome painting mode
        virtual void leaveMonochromeMode();
        
@@ -108,7 +110,7 @@ public:
         * around the text with the given color.
         */
        virtual void rectText(int x, int baseline, docstring const & str,
-               FontInfo const & font, ColorCode back, ColorCode frame);
+               FontInfo const & font, Color back, Color frame);
 
        /// draw a filled rectangle with the shape of a 3D button
        virtual void button(int x, int y, int w, int h, bool mouseHover);
@@ -150,7 +152,7 @@ private:
        ///
        std::stack<QColor> monochrome_max_;
        /// convert into Qt color, possibly applying the monochrome mode
-       QColor computeColor(ColorCode col);
+       QColor computeColor(Color col);
        /// possibly apply monochrome mode
        QColor filterColor(QColor const & col);
        ///