]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/Painter.cpp
Move Color::color enum to ColorCode.h
[lyx.git] / src / frontends / Painter.cpp
index 06f46e2d3e5e5ce27557c19ca4796a16ec661937..40930134c19cdf4cc1bda6893f6932c68f58d049 100644 (file)
@@ -15,8 +15,7 @@
 
 #include "frontends/FontMetrics.h"
 
-#include "Color.h"
-#include "LyXFont.h"
+#include "Font.h"
 
 using lyx::docstring;
 
@@ -29,27 +28,27 @@ namespace frontend {
 void Painter::button(int x, int y, int w, int h, bool mouseHover)
 {
        if (mouseHover)
-               fillRectangle(x, y, w, h, Color::buttonhoverbg);
+               fillRectangle(x, y, w, h, Color_buttonhoverbg);
        else
-               fillRectangle(x, y, w, h, Color::buttonbg);
+               fillRectangle(x, y, w, h, Color_buttonbg);
        buttonFrame(x, y, w, h);
 }
 
 
 void Painter::buttonFrame(int x, int y, int w, int h)
 {
-       line(x, y, x, y + h - 1, Color::buttonframe);
-       line(x - 1 + w, y, x - 1 + w, y + h - 1, Color::buttonframe);
-       line(x, y - 1, x - 1 + w, y - 1, Color::buttonframe);
-       line(x, y + h - 1, x - 1 + w, y + h - 1, Color::buttonframe);
+       line(x, y, x, y + h - 1, Color_buttonframe);
+       line(x - 1 + w, y, x - 1 + w, y + h - 1, Color_buttonframe);
+       line(x, y - 1, x - 1 + w, y - 1, Color_buttonframe);
+       line(x, y + h - 1, x - 1 + w, y + h - 1, Color_buttonframe);
 }
 
 
 void Painter::rectText(int x, int y,
        docstring const & str,
-       LyXFont const & font,
-       Color_color back,
-       Color_color frame)
+       Font const & font,
+       ColorCode back,
+       ColorCode frame)
 {
        int width;
        int ascent;
@@ -58,19 +57,19 @@ void Painter::rectText(int x, int y,
        FontMetrics const & fm = theFontMetrics(font);
        fm.rectText(str, width, ascent, descent);
 
-       if (back != Color::none)
+       if (back != Color_none)
                fillRectangle(x + 1, y - ascent + 1, width - 1,
                              ascent + descent - 1, back);
 
-       if (frame != Color::none)
+       if (frame != Color_none)
                rectangle(x, y - ascent, width, ascent + descent, frame);
 
        text(x + 3, y, str, font);
 }
 
 
-void Painter::buttonText(int x, int y, docstring const & str, 
-       LyXFont const & font, bool mouseHover)
+void Painter::buttonText(int x, int y, docstring const & str,
+       Font const & font, bool mouseHover)
 {
        int width;
        int ascent;
@@ -79,15 +78,15 @@ void Painter::buttonText(int x, int y, docstring const & str,
        FontMetrics const & fm = theFontMetrics(font);
        fm.buttonText(str, width, ascent, descent);
 
-       button(x, y - ascent, width, descent + ascent, mouseHover);
-       text(x + 3, y - 1, str, font);
+       button(x + 1, y - ascent, width - 2, descent + ascent, mouseHover);
+       text(x + 4, y - 1, str, font);
 }
 
 
 int Painter::preeditText(int x, int y, char_type c,
-       LyXFont const & font, preedit_style style)
+       Font const & font, preedit_style style)
 {
-       LyXFont temp_font = font;
+       Font temp_font = font;
        FontMetrics const & fm = theFontMetrics(font);
        int ascent = fm.maxAscent();
        int descent = fm.maxDescent();
@@ -97,17 +96,17 @@ int Painter::preeditText(int x, int y, char_type c,
        switch (style) {
                case preedit_default:
                        // default unselecting mode.
-                       fillRectangle(x, y - height + 1, width, height, Color::background);
+                       fillRectangle(x, y - height + 1, width, height, Color_background);
                        dashedUnderline(font, x, y - descent + 1, width);
                        break;
                case preedit_selecting:
                        // We are in selecting mode: white text on black background.
-                       fillRectangle(x, y - height + 1, width, height, Color::black);
-                       temp_font.setColor(Color::white);
+                       fillRectangle(x, y - height + 1, width, height, Color_black);
+                       temp_font.setColor(Color_white);
                        break;
                case preedit_cursor:
                        // The character comes with a cursor.
-                       fillRectangle(x, y - height + 1, width, height, Color::background);
+                       fillRectangle(x, y - height + 1, width, height, Color_background);
                        underline(font, x, y - descent + 1, width);
                        break;
        }
@@ -117,7 +116,7 @@ int Painter::preeditText(int x, int y, char_type c,
 }
 
 
-void Painter::underline(LyXFont const & f, int x, int y, int width)
+void Painter::underline(Font const & f, int x, int y, int width)
 {
        FontMetrics const & fm = theFontMetrics(f);
 
@@ -131,7 +130,7 @@ void Painter::underline(LyXFont const & f, int x, int y, int width)
 }
 
 
-void Painter::dashedUnderline(LyXFont const & f, int x, int y, int width)
+void Painter::dashedUnderline(Font const & f, int x, int y, int width)
 {
        FontMetrics const & fm = theFontMetrics(f);