diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-02-22 14:21:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-02-22 14:21:27 +0300 |
commit | 48646db55005a0da079bd2c945875dc8225e2f86 (patch) | |
tree | 4d7b18cb201682cbb32f1f1677a0935a8e7928a4 /src/gui | |
parent | 9c12fcdfe590f34543fcecc2691b625c408f1746 (diff) | |
download | plus-48646db55005a0da079bd2c945875dc8225e2f86.tar.gz plus-48646db55005a0da079bd2c945875dc8225e2f86.tar.bz2 plus-48646db55005a0da079bd2c945875dc8225e2f86.tar.xz plus-48646db55005a0da079bd2c945875dc8225e2f86.zip |
Move color into gui dir.
Diffstat (limited to 'src/gui')
48 files changed, 387 insertions, 398 deletions
diff --git a/src/gui/base/widget.hpp b/src/gui/base/widget.hpp index dd872d9a1..31d61312e 100644 --- a/src/gui/base/widget.hpp +++ b/src/gui/base/widget.hpp @@ -68,7 +68,8 @@ #include <set> #include <string> -#include "gui/base/color.hpp" +#include "gui/color.h" + #include "gui/base/rectangle.hpp" #include "gui/widgets/widget2.h" diff --git a/src/gui/base/color.cpp b/src/gui/color.cpp index 485367e6d..9a0034257 100644 --- a/src/gui/base/color.cpp +++ b/src/gui/color.cpp @@ -65,104 +65,101 @@ * For comments regarding functions please see the header file. */ -#include "gui/base/color.hpp" +#include "gui/color.h" #include "debug.h" -namespace gcn +Color::Color() : + r(0U), + g(0U), + b(0U), + a(255U) { - Color::Color() : - r(0U), - g(0U), - b(0U), - a(255U) - { - } - - Color::Color(const unsigned int color) : - r((color >> 16) & 0xFF), - g((color >> 8) & 0xFF), - b(color & 0xFF), - a(255U) - { - } - - Color::Color(const unsigned int ar, - const unsigned int ag, - const unsigned int ab, - const unsigned int aa) : - r(ar), - g(ag), - b(ab), - a(aa) - { - } - - Color Color::operator+(const Color& color) const - { - Color result(r + color.r, - g + color.g, - b + color.b, - 255U); - - result.r = (result.r > 255U ? 255U : result.r); - result.g = (result.g > 255U ? 255U : result.g); - result.b = (result.b > 255U ? 255U : result.b); - - return result; - } - - Color Color::operator-(const Color& color) const - { - Color result(r - color.r, - g - color.g, - b - color.b, - 255U); - - result.r = (result.r > 255U ? 255U : result.r); - result.g = (result.g > 255U ? 255U : result.g); - result.b = (result.b > 255U ? 255U : result.b); - - return result; - } - - Color Color::operator*(const float value) const - { - Color result(static_cast<int>(static_cast<float>(r) * value), - static_cast<int>(static_cast<float>(g) * value), - static_cast<int>(static_cast<float>(b) * value), - a); - - result.r = (result.r > 255U ? 255U : result.r); - result.g = (result.g > 255U ? 255U : result.g); - result.b = (result.b > 255U ? 255U : result.b); - - return result; - } - - bool Color::operator==(const Color& color) const - { - return r == color.r && g == color.g && b == color.b && a == color.a; - } - - bool Color::operator!=(const Color& color) const - { - return !(r == color.r && g == color.g && b == color.b && a == color.a); - } - - std::ostream& operator<<(std::ostream& out, - const Color& color) - { - out << "Color [r = " - << color.r - << ", g = " - << color.g - << ", b = " - << color.b - << ", a = " - << color.a - << "]"; - - return out; - } -} // namespace gcn +} + +Color::Color(const unsigned int color) : + r((color >> 16) & 0xFF), + g((color >> 8) & 0xFF), + b(color & 0xFF), + a(255U) +{ +} + +Color::Color(const unsigned int ar, + const unsigned int ag, + const unsigned int ab, + const unsigned int aa) : + r(ar), + g(ag), + b(ab), + a(aa) +{ +} + +Color Color::operator+(const Color& color) const +{ + Color result(r + color.r, + g + color.g, + b + color.b, + 255U); + + result.r = (result.r > 255U ? 255U : result.r); + result.g = (result.g > 255U ? 255U : result.g); + result.b = (result.b > 255U ? 255U : result.b); + + return result; +} + +Color Color::operator-(const Color& color) const +{ + Color result(r - color.r, + g - color.g, + b - color.b, + 255U); + + result.r = (result.r > 255U ? 255U : result.r); + result.g = (result.g > 255U ? 255U : result.g); + result.b = (result.b > 255U ? 255U : result.b); + + return result; +} + +Color Color::operator*(const float value) const +{ + Color result(static_cast<int>(static_cast<float>(r) * value), + static_cast<int>(static_cast<float>(g) * value), + static_cast<int>(static_cast<float>(b) * value), + a); + + result.r = (result.r > 255U ? 255U : result.r); + result.g = (result.g > 255U ? 255U : result.g); + result.b = (result.b > 255U ? 255U : result.b); + + return result; +} + +bool Color::operator==(const Color& color) const +{ + return r == color.r && g == color.g && b == color.b && a == color.a; +} + +bool Color::operator!=(const Color& color) const +{ + return !(r == color.r && g == color.g && b == color.b && a == color.a); +} + +std::ostream& operator<<(std::ostream& out, + const Color& color) +{ + out << "Color [r = " + << color.r + << ", g = " + << color.g + << ", b = " + << color.b + << ", a = " + << color.a + << "]"; + + return out; +} diff --git a/src/gui/base/color.hpp b/src/gui/color.h index 781b2cb60..646680d96 100644 --- a/src/gui/base/color.hpp +++ b/src/gui/color.h @@ -61,135 +61,132 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GCN_COLOR_HPP -#define GCN_COLOR_HPP +#ifndef GUI_COLOR_H +#define GUI_COLOR_H #include <iostream> #include "localconsts.h" -namespace gcn +/** + * Represents a color with red, green, blue and alpha components. + */ +class Color final { - /** - * Represents a color with red, green, blue and alpha components. - */ - class Color final - { public: /** - * Constructor. Initializes the color to black. - */ + * Constructor. Initializes the color to black. + */ Color(); /** - * Constructor. Constructs a color from the bytes in an integer. - * Call it with a hexadecimal constant for HTML-style color representation. - * The alpha component is 255 by default. - * - * EXAMPLE: Color(0xff50a0) constructs a very nice pinkish color. - * - * NOTE: Because of this constructor, integers will be automatically - * casted to a color by your compiler. - * - * @param color The color to initialise the object with. - */ + * Constructor. Constructs a color from the bytes in an integer. + * Call it with a hexadecimal constant for HTML-style color representation. + * The alpha component is 255 by default. + * + * EXAMPLE: Color(0xff50a0) constructs a very nice pinkish color. + * + * NOTE: Because of this constructor, integers will be automatically + * casted to a color by your compiler. + * + * @param color The color to initialise the object with. + */ explicit Color(const unsigned int color); /** - * Constructor. The default alpha value is 255. - * - * @param r Red color component (range 0-255). - * @param g Green color component (range 0-255). - * @param b Blue color component (range 0-255). - * @param a Alpha, used for transparency. A value of 0 means - * totaly transparent, 255 is totaly opaque. - */ + * Constructor. The default alpha value is 255. + * + * @param r Red color component (range 0-255). + * @param g Green color component (range 0-255). + * @param b Blue color component (range 0-255). + * @param a Alpha, used for transparency. A value of 0 means + * totaly transparent, 255 is totaly opaque. + */ Color(const unsigned int r, const unsigned int g, const unsigned int b, const unsigned int a = 255); /** - * Adds the RGB values of two colors together. The values will be - * clamped if they go out of range. - * - * WARNING: This function will reset the alpha value of the - * returned color to 255. - * - * @param color A color to add to this color. - * @return The added colors with an alpha value set to 255. - */ + * Adds the RGB values of two colors together. The values will be + * clamped if they go out of range. + * + * WARNING: This function will reset the alpha value of the + * returned color to 255. + * + * @param color A color to add to this color. + * @return The added colors with an alpha value set to 255. + */ Color operator+(const Color& color) const; /** - * Subtracts the RGB values of one color from another. - * The values will be clamped if they go out of range. - * - * WARNING: This function will reset the alpha value of the - * returned color to 255. - * - * @param color A color to subtract from this color. - * @return The subtracted colors with an alpha value set to 255. - */ + * Subtracts the RGB values of one color from another. + * The values will be clamped if they go out of range. + * + * WARNING: This function will reset the alpha value of the + * returned color to 255. + * + * @param color A color to subtract from this color. + * @return The subtracted colors with an alpha value set to 255. + */ Color operator-(const Color& color) const; /** - * Multiplies the RGB values of a color with a float value. - * The values will be clamped if they go out of range. - * - * @param value The value to multiply the color with. - * @return The multiplied colors. The alpha value will, unlike - * the add and subtract operations, be multiplied as - * well. - */ + * Multiplies the RGB values of a color with a float value. + * The values will be clamped if they go out of range. + * + * @param value The value to multiply the color with. + * @return The multiplied colors. The alpha value will, unlike + * the add and subtract operations, be multiplied as + * well. + */ Color operator*(const float value) const; /** - * Compares two colors. - * - * @return True if the two colors have the same RGBA components - * false otherwise. - */ + * Compares two colors. + * + * @return True if the two colors have the same RGBA components + * false otherwise. + */ bool operator==(const Color& color) const; /** - * Compares two colors. - * - * @return True if the two colors have different RGBA components, - * false otherwise. - */ + * Compares two colors. + * + * @return True if the two colors have different RGBA components, + * false otherwise. + */ bool operator!=(const Color& color) const; /** - * Output operator for output. - * - * @param out The stream to output to. - * @param color The color to output. - */ + * Output operator for output. + * + * @param out The stream to output to. + * @param color The color to output. + */ friend std::ostream& operator<<(std::ostream& out, const Color& Color); /** - * Holds the red color component (range 0-255). - */ + * Holds the red color component (range 0-255). + */ unsigned int r; /** - * Holds the green color component (range 0-255). - */ + * Holds the green color component (range 0-255). + */ unsigned int g; /** - * Holds the blue color component (range 0-255). - */ + * Holds the blue color component (range 0-255). + */ unsigned int b; /** - * Holds the alpha color component. A value of 0 means totally - * transparent while a value of 255 is considered opaque. - */ + * Holds the alpha color component. A value of 0 means totally + * transparent while a value of 255 is considered opaque. + */ unsigned int a; - }; -} // namespace gcn +}; -#endif // end GCN_COLOR_HPP +#endif // GUI_COLOR_H diff --git a/src/gui/font.cpp b/src/gui/font.cpp index fcc8e8344..e1d793ce1 100644 --- a/src/gui/font.cpp +++ b/src/gui/font.cpp @@ -99,8 +99,8 @@ int sdlTextChunkCnt = 0; #endif SDLTextChunkSmall::SDLTextChunkSmall(const std::string &text0, - const gcn::Color &color0, - const gcn::Color &color1) : + const Color &color0, + const Color &color1) : text(text0), color(color0), color2(color1) @@ -125,7 +125,7 @@ bool SDLTextChunkSmall::operator<(const SDLTextChunkSmall &chunk) const if (chunk.text != text) return chunk.text > text; - const gcn::Color &c = chunk.color; + const Color &c = chunk.color; if (c.r != color.r) return c.r > color.r; if (c.g != color.g) @@ -133,7 +133,7 @@ bool SDLTextChunkSmall::operator<(const SDLTextChunkSmall &chunk) const if (c.b != color.b) return c.b > color.b; - const gcn::Color &c2 = chunk.color2; + const Color &c2 = chunk.color2; if (c2.r != color2.r) return c2.r > color2.r; if (c2.g != color2.g) @@ -147,8 +147,8 @@ bool SDLTextChunkSmall::operator<(const SDLTextChunkSmall &chunk) const return false; } -SDLTextChunk::SDLTextChunk(const std::string &text0, const gcn::Color &color0, - const gcn::Color &color1) : +SDLTextChunk::SDLTextChunk(const std::string &text0, const Color &color0, + const Color &color1) : img(nullptr), text(text0), color(color0), @@ -499,8 +499,8 @@ void Font::drawString(Graphics *const graphics, if (!g) return; - gcn::Color col = g->getColor(); - const gcn::Color &col2 = g->getColor2(); + Color col = g->getColor(); + const Color &col2 = g->getColor2(); const float alpha = static_cast<float>(col.a) / 255.0F; /* The alpha value is ignored at string generation so avoid caching the diff --git a/src/gui/font.h b/src/gui/font.h index 8740b4f3b..bdf81dadc 100644 --- a/src/gui/font.h +++ b/src/gui/font.h @@ -67,7 +67,7 @@ #ifndef GUI_FONT_H #define GUI_FONT_H -#include "gui/base/color.hpp" +#include "gui/color.h" #include <SDL_ttf.h> @@ -84,8 +84,8 @@ const unsigned int CACHES_NUMBER = 256; class SDLTextChunkSmall { public: - SDLTextChunkSmall(const std::string &text0, const gcn::Color &color0, - const gcn::Color &color1); + SDLTextChunkSmall(const std::string &text0, const Color &color0, + const Color &color1); SDLTextChunkSmall(const SDLTextChunkSmall &old); @@ -93,15 +93,15 @@ class SDLTextChunkSmall bool operator<(const SDLTextChunkSmall &chunk) const; std::string text; - gcn::Color color; - gcn::Color color2; + Color color; + Color color2; }; class SDLTextChunk final { public: - SDLTextChunk(const std::string &text0, const gcn::Color &color0, - const gcn::Color &color1); + SDLTextChunk(const std::string &text0, const Color &color0, + const Color &color1); A_DELETE_COPY(SDLTextChunk) @@ -113,8 +113,8 @@ class SDLTextChunk final Image *img; std::string text; - gcn::Color color; - gcn::Color color2; + Color color; + Color color2; SDLTextChunk *prev; SDLTextChunk *next; }; diff --git a/src/gui/gui.h b/src/gui/gui.h index f6b4fbbf6..232d47a22 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -23,7 +23,8 @@ #ifndef GUI_GUI_H #define GUI_GUI_H -#include "gui/base/color.hpp" +#include "gui/color.h" + #include "gui/base/gui.hpp" #include "localconsts.h" @@ -198,8 +199,8 @@ class Gui final : public gcn::Gui typedef std::list<FocusListener*> FocusListenerList; typedef FocusListenerList::iterator FocusListenerIterator; FocusListenerList mFocusListeners; - gcn::Color mForegroundColor; - gcn::Color mForegroundColor2; + Color mForegroundColor; + Color mForegroundColor2; int mTime; bool mCustomCursor; /**< Show custom cursor */ bool mDoubleClick; diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp index 9d6c19095..21e027d82 100644 --- a/src/gui/palette.cpp +++ b/src/gui/palette.cpp @@ -29,18 +29,18 @@ #include "debug.h" -const gcn::Color Palette::BLACK = gcn::Color(0, 0, 0); +const Color Palette::BLACK = Color(0, 0, 0); Palette::Palettes Palette::mInstances; -const gcn::Color Palette::RAINBOW_COLORS[7] = +const Color Palette::RAINBOW_COLORS[7] = { - gcn::Color(255, 0, 0), - gcn::Color(255, 153, 0), - gcn::Color(255, 255, 0), - gcn::Color(0, 153, 0), - gcn::Color(0, 204, 204), - gcn::Color(51, 0, 153), - gcn::Color(153, 0, 153) + Color(255, 0, 0), + Color(255, 153, 0), + Color(255, 255, 0), + Color(0, 153, 0), + Color(0, 204, 204), + Color(51, 0, 153), + Color(153, 0, 153) }; const int Palette::RAINBOW_COLOR_COUNT = 7; @@ -59,7 +59,7 @@ Palette::~Palette() mInstances.erase(this); } -const gcn::Color& Palette::getCharColor(const signed char c, bool &valid) const +const Color& Palette::getCharColor(const signed char c, bool &valid) const { const CharColors::const_iterator it = mCharColors.find(c); if (it != mCharColors.end()) @@ -128,7 +128,7 @@ void Palette::advanceGradient() else colIndex = gradIndex; - gcn::Color &color = elem->color; + Color &color = elem->color; int colVal; if (grad == PULSE) @@ -136,7 +136,7 @@ void Palette::advanceGradient() colVal = static_cast<int>(255.0 * sin(M_PI * colIndex / numOfColors)); - const gcn::Color &col = elem->testColor; + const Color &col = elem->testColor; color.r = ((colVal * col.r) / 255) % (col.r + 1); color.g = ((colVal * col.g) / 255) % (col.g + 1); @@ -180,9 +180,9 @@ void Palette::advanceGradient() } else if (elem->grad == RAINBOW) { - const gcn::Color &startCol = RAINBOW_COLORS[colIndex]; - const gcn::Color &destCol = - RAINBOW_COLORS[(colIndex + 1) % numOfColors]; + const Color &startCol = RAINBOW_COLORS[colIndex]; + const Color &destCol + = RAINBOW_COLORS[(colIndex + 1) % numOfColors]; double startColVal; double destColVal; diff --git a/src/gui/palette.h b/src/gui/palette.h index 1377822ca..0dbb5d3ad 100644 --- a/src/gui/palette.h +++ b/src/gui/palette.h @@ -26,7 +26,7 @@ #include "logger.h" -#include "gui/base/color.hpp" +#include "gui/color.h" #if defined __native_client__ #include <stdlib.h> @@ -49,7 +49,7 @@ class Palette { public: /** Black Color Constant */ - static const gcn::Color BLACK; + static const Color BLACK; /** Colors can be static or can alter over time. */ enum GradientType @@ -71,8 +71,8 @@ class Palette * * @return the requested color or Palette::BLACK */ - const gcn::Color &getCharColor(const signed char c, - bool &valid) const A_WARN_UNUSED; + const Color &getCharColor(const signed char c, + bool &valid) const A_WARN_UNUSED; int getIdByChar(const signed char c, bool &valid) const A_WARN_UNUSED; @@ -85,8 +85,8 @@ class Palette * * @return the requested color */ - inline const gcn::Color &getColor(int type, - const int alpha = 255) A_WARN_UNUSED + inline const Color &getColor(int type, + const int alpha = 255) A_WARN_UNUSED { if (type >= static_cast<signed>(mColors.size()) || type < 0) { @@ -94,15 +94,14 @@ class Palette type, static_cast<unsigned int>(mColors.size())); type = 0; } - gcn::Color* col = &mColors[type].color; + Color* col = &mColors[type].color; col->a = alpha; return *col; } - inline const gcn::Color &getColorWithAlpha(const int type) - A_WARN_UNUSED + inline const Color &getColorWithAlpha(const int type) A_WARN_UNUSED { - gcn::Color* col = &mColors[type].color; + Color* col = &mColors[type].color; col->a = mColors[type].delay; return *col; } @@ -144,7 +143,7 @@ class Palette protected: /** Colors used for the rainbow gradient */ - static const gcn::Color RAINBOW_COLORS[7]; + static const Color RAINBOW_COLORS[7]; static const int RAINBOW_COLOR_COUNT; /** Time tick, that gradient-type colors were updated the last time. */ @@ -183,9 +182,9 @@ class Palette } int type; - gcn::Color color; - gcn::Color testColor; - gcn::Color committedColor; + Color color; + Color testColor; + Color committedColor; std::string text; signed char ch; GradientType grad; @@ -194,7 +193,7 @@ class Palette int delay; int committedDelay; - void set(const int type0, const gcn::Color &color0, + void set(const int type0, const Color &color0, const GradientType grad0, const int delay0) { type = type0; diff --git a/src/gui/popups/speechbubble.cpp b/src/gui/popups/speechbubble.cpp index 9bb6157bc..3d0250a78 100644 --- a/src/gui/popups/speechbubble.cpp +++ b/src/gui/popups/speechbubble.cpp @@ -57,8 +57,8 @@ void SpeechBubble::postInit() } void SpeechBubble::setCaption(const std::string &name, - const gcn::Color *const color1, - const gcn::Color *const color2) + const Color *const color1, + const Color *const color2) { mCaption->setCaption(name); mCaption->adjustSize(); diff --git a/src/gui/popups/speechbubble.h b/src/gui/popups/speechbubble.h index 62da9b146..1bc5385a4 100644 --- a/src/gui/popups/speechbubble.h +++ b/src/gui/popups/speechbubble.h @@ -47,9 +47,9 @@ class SpeechBubble final : public Popup * Sets the name displayed for the speech bubble, and in what color. */ void setCaption(const std::string &name, - const gcn::Color *const color1 = + const Color *const color1 = &Theme::getThemeColor(Theme::BUBBLE_NAME), - const gcn::Color *const color2 = + const Color *const color2 = &Theme::getThemeColor(Theme::BUBBLE_NAME_OUTLINE)); /** diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 2a1b0d624..1a504f680 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -259,7 +259,7 @@ void Theme::deleteInstance() mInstance = nullptr; } -gcn::Color Theme::getProgressColor(const int type, const float progress) +Color Theme::getProgressColor(const int type, const float progress) { int color[3] = {0, 0, 0}; @@ -273,7 +273,7 @@ gcn::Color Theme::getProgressColor(const int type, const float progress) logger->log("color not found: " + toString(type)); } - return gcn::Color(color[0], color[1], color[2]); + return Color(color[0], color[1], color[2]); } Skin *Theme::load(const std::string &filename, const std::string &filename2, @@ -972,7 +972,7 @@ static int readColorType(const std::string &type) return -1; } -static gcn::Color readColor(const std::string &description) +static Color readColor(const std::string &description) { const int size = static_cast<const int>(description.length()); if (size < 7 || description[0] != '#') @@ -1010,7 +1010,7 @@ static gcn::Color readColor(const std::string &description) v = (v << 4) | n; } - return gcn::Color(v); + return Color(v); } static Palette::GradientType readColorGradient(const std::string &grad) @@ -1084,7 +1084,7 @@ void Theme::loadColors(std::string file) int type; std::string temp; - gcn::Color color; + Color color; GradientType grad; for_each_xml_child_node(paletteNode, root) diff --git a/src/gui/theme.h b/src/gui/theme.h index 826902004..86543ea64 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -450,21 +450,21 @@ class Theme final : public Palette, public ConfigListener * * @return the requested color */ - inline static const gcn::Color &getThemeColor(const int type, - const int alpha = 255) - A_WARN_UNUSED + inline static const Color &getThemeColor(const int type, + const int alpha = 255) + A_WARN_UNUSED { return mInstance->getColor(type, alpha); } - static const gcn::Color &getThemeCharColor(const signed char c, - bool &valid) A_WARN_UNUSED + static const Color &getThemeCharColor(const signed char c, + bool &valid) A_WARN_UNUSED { return mInstance->getCharColor(c, valid); } static int getThemeIdByChar(const signed char c, bool &valid) A_WARN_UNUSED { return mInstance->getIdByChar(c, valid); } - static gcn::Color getProgressColor(const int type, - const float progress) A_WARN_UNUSED; + static Color getProgressColor(const int type, + const float progress) A_WARN_UNUSED; /** * Loads a skin. diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp index 69125f8e2..74d47203f 100644 --- a/src/gui/userpalette.cpp +++ b/src/gui/userpalette.cpp @@ -237,7 +237,7 @@ UserPalette::~UserPalette() void UserPalette::setColor(const int type, const int r, const int g, const int b) { - gcn::Color &color = mColors[type].color; + Color &color = mColors[type].color; color.r = r; color.g = g; color.b = b; @@ -296,14 +296,14 @@ void UserPalette::rollback() if (i->grad != i->committedGrad) setGradient(i->type, i->committedGrad); - const gcn::Color &committedColor = i->committedColor; + const Color &committedColor = i->committedColor; setGradientDelay(i->type, i->committedDelay); setColor(i->type, committedColor.r, committedColor.g, committedColor.b); if (i->grad == PULSE) { - gcn::Color &testColor = i->testColor; + Color &testColor = i->testColor; testColor.r = committedColor.r; testColor.g = committedColor.g; testColor.b = committedColor.b; @@ -342,7 +342,7 @@ void UserPalette::addColor(const unsigned type, const unsigned rgb, rgbValue = atox(rgbString); else rgbValue = atoi(rgbString.c_str()); - const gcn::Color &trueCol = gcn::Color(rgbValue); + const Color &trueCol = Color(rgbValue); grad = static_cast<GradientType>(config.getValue(configName + "Gradient", static_cast<int>(grad))); delay = config.getValueInt(configName + "Delay", delay); diff --git a/src/gui/userpalette.h b/src/gui/userpalette.h index fbba415b8..e37eee0ca 100644 --- a/src/gui/userpalette.h +++ b/src/gui/userpalette.h @@ -100,8 +100,8 @@ class UserPalette final : public Palette, public gcn::ListModel * * @return the requested committed color */ - inline const gcn::Color &getCommittedColor(const int type) - const A_WARN_UNUSED + inline const Color &getCommittedColor(const int type) + const A_WARN_UNUSED { return mColors[type].committedColor; } @@ -113,8 +113,7 @@ class UserPalette final : public Palette, public gcn::ListModel * * @return the requested test color */ - inline const gcn::Color &getTestColor(const int type) - const A_WARN_UNUSED + inline const Color &getTestColor(const int type) const A_WARN_UNUSED { return mColors[type].testColor; } /** @@ -123,7 +122,7 @@ class UserPalette final : public Palette, public gcn::ListModel * @param type the color type requested * @param color the color that should be tested */ - inline void setTestColor(const int type, const gcn::Color &color) + inline void setTestColor(const int type, const Color &color) { mColors[type].testColor = color; } /** diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index ee64736eb..54619c3e6 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -121,7 +121,7 @@ void Viewport::draw(Graphics *graphics) if (!mMap || !player_node) { - graphics->setColor(gcn::Color(64, 64, 64)); + graphics->setColor(Color(64, 64, 64)); graphics->fillRectangle( gcn::Rectangle(0, 0, getWidth(), getHeight())); BLOCK_END("Viewport::draw 1") @@ -338,7 +338,7 @@ void Viewport::_drawDebugPath(Graphics *const graphics) } void Viewport::_drawPath(Graphics *const graphics, const Path &path, - const gcn::Color &color) const + const Color &color) const { graphics->setColor(color); Font *const font = getFont(); diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 2b297de37..16d0e4e34 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -298,7 +298,7 @@ class Viewport final : public WindowContainer, * Draws the given path. */ void _drawPath(Graphics *const graphics, const Path &path, - const gcn::Color &color = gcn::Color(255, 0, 0)) const; + const Color &color = Color(255, 0, 0)) const; /** * Make the player go to the mouse position. diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 298ab657a..a71051b5d 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -154,7 +154,7 @@ void AvatarListBox::draw(Graphics *graphics) } if (parent && a->getMaxHp()) { - gcn::Color color = Theme::getProgressColor( + Color color = Theme::getProgressColor( Theme::PROG_HP, static_cast<float>(a->getHp()) / static_cast<float>(a->getMaxHp())); color.a = 80; @@ -180,8 +180,7 @@ void AvatarListBox::draw(Graphics *graphics) if (parent) { - gcn::Color color = Theme::getProgressColor(Theme::PROG_HP, - 1); + Color color = Theme::getProgressColor(Theme::PROG_HP, 1); color.a = 80; graphics->setColor(color); diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index cc83d2b83..b6644cbc1 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -534,8 +534,8 @@ int BrowserBox::calcHeight() const char *const hyphen = "~"; const int hyphenWidth = font->getWidth(hyphen); - gcn::Color selColor[2] = {mForegroundColor, mForegroundColor2}; - const gcn::Color textColor[2] = {mForegroundColor, mForegroundColor2}; + Color selColor[2] = {mForegroundColor, mForegroundColor2}; + const Color textColor[2] = {mForegroundColor, mForegroundColor2}; ResourceManager *const resman = ResourceManager::getInstance(); mLineParts.clear(); @@ -581,7 +581,7 @@ int BrowserBox::calcHeight() continue; } - gcn::Color prevColor[2]; + Color prevColor[2]; prevColor[0] = selColor[0]; prevColor[1] = selColor[1]; bold = false; @@ -621,7 +621,7 @@ int BrowserBox::calcHeight() const signed char c = row.at(start + 2); bool valid(false); - const gcn::Color col[2] = + const Color col[2] = { getThemeCharColor(c, valid), getThemeCharColor(c | 0x80, valid) @@ -897,8 +897,8 @@ std::string BrowserBox::getTextAtPos(const int x, const int y) const return str; } -void BrowserBox::setForegroundColorAll(const gcn::Color &color1, - const gcn::Color &color2) +void BrowserBox::setForegroundColorAll(const Color &color1, + const Color &color2) { mForegroundColor = color1; mForegroundColor2 = color2; diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index 1f09dd0b1..a33c69698 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -58,8 +58,8 @@ struct BrowserLink final class LinePart final { public: - LinePart(const int x, const int y, const gcn::Color &color, - const gcn::Color &color2, const std::string &text, + LinePart(const int x, const int y, const Color &color, + const Color &color2, const std::string &text, const bool bold) : mX(x), mY(y), @@ -72,8 +72,8 @@ class LinePart final { } - LinePart(const int x, const int y, const gcn::Color &color, - const gcn::Color &color2, Image *const image) : + LinePart(const int x, const int y, const Color &color, + const Color &color2, Image *const image) : mX(x), mY(y), mColor(color), @@ -88,8 +88,8 @@ class LinePart final ~LinePart(); int mX, mY; - gcn::Color mColor; - gcn::Color mColor2; + Color mColor; + Color mColor2; std::string mText; unsigned char mType; Image *mImage; @@ -228,8 +228,8 @@ class BrowserBox final : public gcn::Widget, int getPadding() const A_WARN_UNUSED { return mPadding; } - void setForegroundColorAll(const gcn::Color &color1, - const gcn::Color &color2); + void setForegroundColorAll(const Color &color1, + const Color &color2); int getDataWidth() const { return mDataWidth; } @@ -266,9 +266,9 @@ class BrowserBox final : public gcn::Widget, int mItemPadding; unsigned int mDataWidth; - gcn::Color mHighlightColor; - gcn::Color mHyperLinkColor; - gcn::Color mColors[2][COLORS_MAX]; + Color mHighlightColor; + Color mHyperLinkColor; + Color mColors[2][COLORS_MAX]; bool mOpaque; bool mUseLinksAndUserColors; diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index 4f2e9fd89..039475150 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -165,14 +165,14 @@ class Button final : public gcn::Button, std::string mDescription; ImageCollection *mVertexes2; - gcn::Color mEnabledColor; - gcn::Color mEnabledColor2; - gcn::Color mDisabledColor; - gcn::Color mDisabledColor2; - gcn::Color mHighlightedColor; - gcn::Color mHighlightedColor2; - gcn::Color mPressedColor; - gcn::Color mPressedColor2; + Color mEnabledColor; + Color mEnabledColor2; + Color mDisabledColor; + Color mDisabledColor2; + Color mHighlightedColor; + Color mHighlightedColor2; + Color mPressedColor; + Color mPressedColor2; Image **mImages; ImageSet *mImageSet; unsigned mClickCount; diff --git a/src/gui/widgets/colormodel.cpp b/src/gui/widgets/colormodel.cpp index 7e59553e3..3a71a93cc 100644 --- a/src/gui/widgets/colormodel.cpp +++ b/src/gui/widgets/colormodel.cpp @@ -56,8 +56,8 @@ const ColorPair *ColorModel::getColorAt(const int i) const return &mColors[i]; } -void ColorModel::add(const std::string &name, const gcn::Color *const color1, - const gcn::Color *const color2) +void ColorModel::add(const std::string &name, const Color *const color1, + const Color *const color2) { mNames.push_back(name); mColors.push_back(ColorPair(color1, color2)); diff --git a/src/gui/widgets/colormodel.h b/src/gui/widgets/colormodel.h index c019d9aac..7386a856b 100644 --- a/src/gui/widgets/colormodel.h +++ b/src/gui/widgets/colormodel.h @@ -27,23 +27,19 @@ #include "localconsts.h" +class Color; class Widget2; -namespace gcn -{ - class Color; -} - struct ColorPair { - ColorPair(const gcn::Color* c1, const gcn::Color* c2) : + ColorPair(const Color* c1, const Color* c2) : color1(c1), color2(c2) { } - const gcn::Color* color1; - const gcn::Color* color2; + const Color* color1; + const Color* color2; }; class ColorModel : public gcn::ListModel @@ -67,8 +63,8 @@ class ColorModel : public gcn::ListModel size_t size() A_WARN_UNUSED { return mNames.size(); } - void add(const std::string &name, const gcn::Color *const color1, - const gcn::Color *const color2); + void add(const std::string &name, const Color *const color1, + const Color *const color2); static ColorModel *createDefault(const Widget2 *const widget); diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h index ad07b0ff8..f0fd500ea 100644 --- a/src/gui/widgets/desktop.h +++ b/src/gui/widgets/desktop.h @@ -72,8 +72,8 @@ class Desktop final : public Container, Image *mWallpaper; Label *mVersionLabel; Skin *mSkin; - gcn::Color mBackgroundColor; - gcn::Color mBackgroundGrayColor; + Color mBackgroundColor; + Color mBackgroundGrayColor; bool mShowBackground; }; diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index 9bb459d45..815e4a85d 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -144,8 +144,8 @@ class DropDown final : public ActionListener, void drawButton(Graphics *graphics); PopupList *mPopup; - gcn::Color mShadowColor; - gcn::Color mHighlightColor; + Color mShadowColor; + Color mHighlightColor; int mPadding; int mImagePadding; int mSpacing; diff --git a/src/gui/widgets/dropshortcutcontainer.h b/src/gui/widgets/dropshortcutcontainer.h index 236415b32..1888292de 100644 --- a/src/gui/widgets/dropshortcutcontainer.h +++ b/src/gui/widgets/dropshortcutcontainer.h @@ -79,10 +79,10 @@ class DropShortcutContainer final : public ShortcutContainer bool mItemClicked; ItemPopup *mItemPopup; - gcn::Color mEquipedColor; - gcn::Color mEquipedColor2; - gcn::Color mUnEquipedColor; - gcn::Color mUnEquipedColor2; + Color mEquipedColor; + Color mEquipedColor2; + Color mUnEquipedColor; + Color mUnEquipedColor2; }; #endif // GUI_WIDGETS_DROPSHORTCUTCONTAINER_H diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index 96f2a9532..b2c7c5620 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -188,7 +188,7 @@ private: /** * Holds the background color of the table. */ - gcn::Color mHighlightColor; + Color mHighlightColor; int mSelectedRow; int mSelectedColumn; diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h index ab813b08f..32daa459b 100644 --- a/src/gui/widgets/itemcontainer.h +++ b/src/gui/widgets/itemcontainer.h @@ -181,10 +181,10 @@ class ItemContainer final : public gcn::Widget, ItemPopup *mItemPopup; int *mShowMatrix; Skin *mSkin; - gcn::Color mEquipedColor; - gcn::Color mEquipedColor2; - gcn::Color mUnEquipedColor; - gcn::Color mUnEquipedColor2; + Color mEquipedColor; + Color mEquipedColor2; + Color mUnEquipedColor; + Color mUnEquipedColor2; typedef std::list<SelectionListener*> SelectionListenerList; typedef SelectionListenerList::iterator SelectionListenerIterator; SelectionListenerList mSelectionListeners; diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h index dd95851a6..07c3ef822 100644 --- a/src/gui/widgets/itemshortcutcontainer.h +++ b/src/gui/widgets/itemshortcutcontainer.h @@ -83,10 +83,10 @@ class ItemShortcutContainer final : public ShortcutContainer ItemPopup *mItemPopup; SpellPopup *mSpellPopup; - gcn::Color mEquipedColor; - gcn::Color mEquipedColor2; - gcn::Color mUnEquipedColor; - gcn::Color mUnEquipedColor2; + Color mEquipedColor; + Color mEquipedColor2; + Color mUnEquipedColor; + Color mUnEquipedColor2; }; #endif // GUI_WIDGETS_ITEMSHORTCUTCONTAINER_H diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index 0c19d03c3..c02f37adb 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -114,14 +114,14 @@ void Label::adjustSize() setHeight(font->getHeight() + pad2); } -void Label::setForegroundColor(const gcn::Color &color) +void Label::setForegroundColor(const Color &color) { mForegroundColor = color; mForegroundColor2 = color; } -void Label::setForegroundColorAll(const gcn::Color &color1, - const gcn::Color &color2) +void Label::setForegroundColorAll(const Color &color1, + const Color &color2) { mForegroundColor = color1; mForegroundColor2 = color2; diff --git a/src/gui/widgets/label.h b/src/gui/widgets/label.h index b63c9b10e..616f6cc79 100644 --- a/src/gui/widgets/label.h +++ b/src/gui/widgets/label.h @@ -62,10 +62,10 @@ class Label final : public gcn::Label void adjustSize(); - void setForegroundColor(const gcn::Color &color); + void setForegroundColor(const Color &color); - void setForegroundColorAll(const gcn::Color &color1, - const gcn::Color &color2); + void setForegroundColorAll(const Color &color1, + const Color &color2); void resizeTo(const int maxSize, const int minSize); diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index 625f21085..61e1596f7 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -23,7 +23,7 @@ #ifndef GUI_WIDGETS_LISTBOX_H #define GUI_WIDGETS_LISTBOX_H -#include "gui/base/color.hpp" +#include "gui/color.h" #include "gui/base/widgets/listbox.hpp" @@ -115,9 +115,9 @@ class ListBox : public gcn::ListBox { mRowHeight = n; } protected: - gcn::Color mHighlightColor; - gcn::Color mForegroundSelectedColor; - gcn::Color mForegroundSelectedColor2; + Color mHighlightColor; + Color mForegroundSelectedColor; + Color mForegroundSelectedColor2; int mOldSelected; int mPadding; int mPressedIndex; diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index b44b6a1a0..7d2d00ad4 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -184,7 +184,7 @@ void ProgressBar::setProgressPalette(const int progressPalette) } } -void ProgressBar::setBackgroundColor(const gcn::Color &color) +void ProgressBar::setBackgroundColor(const Color &color) { mRedraw = true; mBackgroundColorToGo = color; @@ -193,7 +193,7 @@ void ProgressBar::setBackgroundColor(const gcn::Color &color) mBackgroundColor = color; } -void ProgressBar::setColor(const gcn::Color &color1, const gcn::Color &color2) +void ProgressBar::setColor(const Color &color1, const Color &color2) { mForegroundColor = color1; mForegroundColor2 = color2; @@ -269,7 +269,7 @@ void ProgressBar::render(Graphics *graphics) // The label if (!mText.empty()) { - const gcn::Color oldColor = graphics->getColor(); + const Color oldColor = graphics->getColor(); Font *const font = gui->getFont(); const int textX = mDimension.width / 2; diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h index a2c55e077..a4862882e 100644 --- a/src/gui/widgets/progressbar.h +++ b/src/gui/widgets/progressbar.h @@ -93,14 +93,14 @@ class ProgressBar final : public gcn::Widget, /** * Change the color of the progress bar. */ - void setBackgroundColor(const gcn::Color &color); + void setBackgroundColor(const Color &color); - void setColor(const gcn::Color &color1, const gcn::Color &color2); + void setColor(const Color &color1, const Color &color2); /** * Returns the color of the progress bar. */ - const gcn::Color &getBackgroundColor() const A_WARN_UNUSED + const Color &getBackgroundColor() const A_WARN_UNUSED { return mBackgroundColor; } /** @@ -145,7 +145,7 @@ class ProgressBar final : public gcn::Widget, float mProgress; float mProgressToGo; - gcn::Color mBackgroundColorToGo; + Color mBackgroundColorToGo; std::string mText; ImageCollection *mVertexes; diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 85ff90261..59ae1059e 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -106,8 +106,8 @@ void ShopListBox::draw(Graphics *graphics) ++i, y += mRowHeight) { bool needDraw(false); - gcn::Color temp; - gcn::Color* backgroundColor = &mBackgroundColor; + Color temp; + Color* backgroundColor = &mBackgroundColor; ShopItem *const item = mShopItems->at(i); if (item && ((mShopItems && mPlayerMoney < item->getPrice() diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h index 1cf628cca..38e209c33 100644 --- a/src/gui/widgets/shoplistbox.h +++ b/src/gui/widgets/shoplistbox.h @@ -94,8 +94,8 @@ class ShopListBox final : public ListBox ItemPopup *mItemPopup; - gcn::Color mBackgroundColor; - gcn::Color mWarningColor; + Color mBackgroundColor; + Color mWarningColor; bool mPriceCheck; bool mProtectItems; diff --git a/src/gui/widgets/skillinfo.h b/src/gui/widgets/skillinfo.h index a201f3274..f9baec6cc 100644 --- a/src/gui/widgets/skillinfo.h +++ b/src/gui/widgets/skillinfo.h @@ -23,7 +23,7 @@ #ifndef GUI_WIDGETS_SKILLINFO_H #define GUI_WIDGETS_SKILLINFO_H -#include "gui/base/color.hpp" +#include "gui/color.h" #include <vector> #include <map> @@ -43,7 +43,7 @@ struct SkillInfo final std::string skillLevel; std::string skillExp; float progress; - gcn::Color color; + Color color; SkillDataMap dataMap; SkillModel *model; SkillData *data; diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp index 9e78133f5..61219fa98 100644 --- a/src/gui/widgets/tabs/setup_colors.cpp +++ b/src/gui/widgets/tabs/setup_colors.cpp @@ -253,7 +253,7 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED) mSelected = mColorBox->getSelected(); const int type = userPalette->getColorTypeAt(mSelected); - const gcn::Color *col = &userPalette->getColor(type); + const Color *col = &userPalette->getColor(type); const Palette::GradientType grad = userPalette->getGradientType(type); const int delay = userPalette->getGradientDelay(type); @@ -383,7 +383,7 @@ void Setup_Colors::cancel() userPalette->rollback(); const int type = userPalette->getColorTypeAt(mSelected); - const gcn::Color *const col = &userPalette->getColor(type); + const Color *const col = &userPalette->getColor(type); mGradTypeSlider->setValue2(userPalette->getGradientType(type)); const int delay = userPalette->getGradientDelay(type); setEntry(mGradDelaySlider, mGradDelayText, delay); @@ -444,7 +444,7 @@ void Setup_Colors::updateColor() } else if (grad == Palette::PULSE) { - userPalette->setTestColor(type, gcn::Color( + userPalette->setTestColor(type, Color( static_cast<int>(mRedSlider->getValue()), static_cast<int>(mGreenSlider->getValue()), static_cast<int>(mBlueSlider->getValue()))); diff --git a/src/gui/widgets/tabs/tab.h b/src/gui/widgets/tabs/tab.h index 463a6b668..1f52cde88 100644 --- a/src/gui/widgets/tabs/tab.h +++ b/src/gui/widgets/tabs/tab.h @@ -114,8 +114,8 @@ class Tab : public gcn::BasicContainer, /** * Set the normal color for the tab's text. */ - void setTabColor(const gcn::Color *const color1, - const gcn::Color *const color2) + void setTabColor(const Color *const color1, + const Color *const color2) { mTabColor = color1; mTabOutlineColor = color2; @@ -124,8 +124,8 @@ class Tab : public gcn::BasicContainer, /** * Set the highlighted color for the tab's text. */ - void setHighlightedTabColor(const gcn::Color *const color1, - const gcn::Color *const color2) + void setHighlightedTabColor(const Color *const color1, + const Color *const color2) { mTabHighlightedColor = color1; mTabHighlightedOutlineColor = color2; @@ -134,8 +134,8 @@ class Tab : public gcn::BasicContainer, /** * Set the selected color for the tab's text. */ - void setSelectedTabColor(const gcn::Color *const color1, - const gcn::Color *const color2) + void setSelectedTabColor(const Color *const color1, + const Color *const color2) { mTabSelectedColor = color1; mTabSelectedOutlineColor = color2; @@ -144,8 +144,8 @@ class Tab : public gcn::BasicContainer, /** * Set the flash color for the tab's text. */ - void setFlashTabColor(const gcn::Color *const color1, - const gcn::Color *const color2) + void setFlashTabColor(const Color *const color1, + const Color *const color2) { mFlashColor = color1; mFlashOutlineColor = color2; @@ -154,8 +154,8 @@ class Tab : public gcn::BasicContainer, /** * Set the player flash color for the tab's text. */ - void setPlayerFlashTabColor(const gcn::Color *const color1, - const gcn::Color *const color2) + void setPlayerFlashTabColor(const Color *const color1, + const Color *const color2) { mPlayerFlashColor = color1; mPlayerFlashOutlineColor = color2; @@ -214,16 +214,16 @@ class Tab : public gcn::BasicContainer, static int mInstances; /**< Number of tab instances */ static float mAlpha; - const gcn::Color *mTabColor; - const gcn::Color *mTabOutlineColor; - const gcn::Color *mTabHighlightedColor; - const gcn::Color *mTabHighlightedOutlineColor; - const gcn::Color *mTabSelectedColor; - const gcn::Color *mTabSelectedOutlineColor; - const gcn::Color *mFlashColor; - const gcn::Color *mFlashOutlineColor; - const gcn::Color *mPlayerFlashColor; - const gcn::Color *mPlayerFlashOutlineColor; + const Color *mTabColor; + const Color *mTabOutlineColor; + const Color *mTabHighlightedColor; + const Color *mTabHighlightedOutlineColor; + const Color *mTabSelectedColor; + const Color *mTabSelectedOutlineColor; + const Color *mFlashColor; + const Color *mFlashOutlineColor; + const Color *mPlayerFlashColor; + const Color *mPlayerFlashOutlineColor; int mFlash; ImageCollection *mVertexes; Image *mImage; diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index ec0d09a26..e0327e670 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -379,14 +379,14 @@ void TextBox::draw(Graphics* graphics) BLOCK_END("TextBox::draw") } -void TextBox::setForegroundColor(const gcn::Color &color) +void TextBox::setForegroundColor(const Color &color) { mForegroundColor = color; mForegroundColor2 = color; } -void TextBox::setForegroundColorAll(const gcn::Color &color1, - const gcn::Color &color2) +void TextBox::setForegroundColorAll(const Color &color1, + const Color &color2) { mForegroundColor = color1; mForegroundColor2 = color2; diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h index 24dd57adb..3f78fd247 100644 --- a/src/gui/widgets/textbox.h +++ b/src/gui/widgets/textbox.h @@ -61,10 +61,10 @@ class TextBox final : public gcn::TextBox void draw(Graphics* graphics) override final; - void setForegroundColor(const gcn::Color &color); + void setForegroundColor(const Color &color); - void setForegroundColorAll(const gcn::Color &color1, - const gcn::Color &color2); + void setForegroundColorAll(const Color &color1, + const Color &color2); private: int mMinWidth; diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index b05a498dc..ccc1b16d6 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -159,7 +159,7 @@ class TextField : public gcn::TextField, static Skin *mSkin; private: - const gcn::Color *mCaretColor; + const Color *mCaretColor; PopupMenu *mPopupMenu; static int instances; static float mAlpha; diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index 1344c647a..462ba17d9 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -89,7 +89,7 @@ void TextPreview::draw(Graphics* graphics) if (mOpaque) { - graphics->setColor(gcn::Color(static_cast<int>(mBGColor->r), + graphics->setColor(Color(static_cast<int>(mBGColor->r), static_cast<int>(mBGColor->g), static_cast<int>(mBGColor->b), static_cast<int>(mAlpha * 255.0F))); @@ -105,7 +105,7 @@ void TextPreview::draw(Graphics* graphics) + 2 * ((mOutline || mShadow) ? 1 :0); const int y = mFont->getHeight() + 1 + 2 * ((mOutline || mShadow) ? 1 : 0); - graphics->setColor(gcn::Color(static_cast<int>(mTextBGColor->r), + graphics->setColor(Color(static_cast<int>(mTextBGColor->r), static_cast<int>(mTextBGColor->g), static_cast<int>(mTextBGColor->b), intAlpha)); @@ -113,9 +113,9 @@ void TextPreview::draw(Graphics* graphics) } } - graphics->setColorAll(gcn::Color(mTextColor->r, + graphics->setColorAll(Color(mTextColor->r, mTextColor->g, mTextColor->b, alpha), - gcn::Color(mTextColor2->r, mTextColor2->g, mTextColor2->b, alpha)); + Color(mTextColor2->r, mTextColor2->g, mTextColor2->b, alpha)); if (mOutline && mTextColor != mTextColor2) graphics->setColor2(Theme::getThemeColor(Theme::OUTLINE)); diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h index 31f64f545..31768fa66 100644 --- a/src/gui/widgets/textpreview.h +++ b/src/gui/widgets/textpreview.h @@ -40,10 +40,10 @@ class TextPreview final : public gcn::Widget ~TextPreview(); - inline void setTextColor(const gcn::Color *color) + inline void setTextColor(const Color *color) { mTextColor = color; adjustSize(); } - inline void setTextColor2(const gcn::Color *color) + inline void setTextColor2(const Color *color) { mTextColor2 = color; adjustSize(); } /** @@ -60,7 +60,7 @@ class TextPreview final : public gcn::Widget * * @param color the color to set */ - inline void setTextBGColor(const gcn::Color *color) + inline void setTextBGColor(const Color *color) { mTextBGColor = color; } /** @@ -68,7 +68,7 @@ class TextPreview final : public gcn::Widget * * @param color the color to set */ - inline void setBGColor(const gcn::Color *color) + inline void setBGColor(const Color *color) { mBGColor = color; } /** @@ -123,10 +123,10 @@ class TextPreview final : public gcn::Widget private: Font *mFont; std::string mText; - const gcn::Color *mTextColor; - const gcn::Color *mTextColor2; - const gcn::Color *mBGColor; - const gcn::Color *mTextBGColor; + const Color *mTextColor; + const Color *mTextColor2; + const Color *mBGColor; + const Color *mTextBGColor; int mPadding; static int instances; static float mAlpha; diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h index c6317702f..ff565815f 100644 --- a/src/gui/widgets/widget2.h +++ b/src/gui/widgets/widget2.h @@ -32,16 +32,16 @@ class Widget2 { } - inline const gcn::Color &getThemeColor(const int type, - const int alpha = 255) - const A_WARN_UNUSED + inline const Color &getThemeColor(const int type, + const int alpha = 255) + const A_WARN_UNUSED { return Theme::getThemeColor(mPaletteOffset + type, alpha); } - inline const gcn::Color &getThemeCharColor(const signed char c, - bool &valid) - const A_WARN_UNUSED + inline const Color &getThemeCharColor(const signed char c, + bool &valid) + const A_WARN_UNUSED { const int colorId = Theme::getThemeIdByChar(c, valid); if (valid) @@ -71,7 +71,7 @@ class Widget2 } } - void setForegroundColor2(const gcn::Color &color) + void setForegroundColor2(const Color &color) { mForegroundColor2 = color; } @@ -85,7 +85,7 @@ class Widget2 } int mPaletteOffset; - gcn::Color mForegroundColor2; + Color mForegroundColor2; }; extern RenderType openGLMode; diff --git a/src/gui/windows/equipmentwindow.h b/src/gui/windows/equipmentwindow.h index c9ca12bbd..0ab4ca462 100644 --- a/src/gui/windows/equipmentwindow.h +++ b/src/gui/windows/equipmentwindow.h @@ -136,10 +136,10 @@ class EquipmentWindow final : public Window, ImageSet *mImageSet; Being *mBeing; std::vector<EquipmentBox*> mBoxes; - gcn::Color mHighlightColor; - gcn::Color mBorderColor; - gcn::Color mLabelsColor; - gcn::Color mLabelsColor2; + Color mHighlightColor; + Color mBorderColor; + Color mLabelsColor; + Color mLabelsColor2; Image *mSlotBackground; Image *mSlotHighlightedBackground; ImageCollection *mVertexes; diff --git a/src/gui/windows/outfitwindow.h b/src/gui/windows/outfitwindow.h index 909b84a41..55948f834 100644 --- a/src/gui/windows/outfitwindow.h +++ b/src/gui/windows/outfitwindow.h @@ -115,8 +115,8 @@ class OutfitWindow final : public Window, int mItems[OUTFITS_COUNT + 1][OUTFIT_ITEM_COUNT]; int mAwayOutfit; - gcn::Color mBorderColor; - gcn::Color mBackgroundColor; + Color mBorderColor; + Color mBackgroundColor; unsigned char mItemColors[OUTFITS_COUNT + 1][OUTFIT_ITEM_COUNT]; bool mItemClicked; bool mItemsUnequip[OUTFITS_COUNT]; diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index a06257b10..cbab4710d 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -236,8 +236,8 @@ public: return 2 * getFont()->getHeight() + 5; } private: - gcn::Color mNotSupportedColor; - gcn::Color mNotSupportedColor2; + Color mNotSupportedColor; + Color mNotSupportedColor2; }; diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 9cc952ec6..2e9a8be10 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -231,8 +231,8 @@ class SkillListBox final : public ListBox private: SkillModel *mModel; TextPopup *mPopup; - gcn::Color mTextColor; - gcn::Color mTextColor2; + Color mTextColor; + Color mTextColor2; int mTextPadding; int mSpacing; bool mSkillClicked; |