From d0df8c76bcd0a5920a9ef1861d978ff52d021a02 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 16 Mar 2010 14:38:27 -0600 Subject: Fix some color issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Colors in BrowserBoxes generally didn't work. Also simplify much palette control detail. Reviewed-by: Thorbjørn Lindeijer --- src/gui/palette.h | 5 +---- src/gui/theme.cpp | 17 ++++++++++++++--- src/gui/userpalette.cpp | 8 ++++---- src/gui/userpalette.h | 3 +-- 4 files changed, 20 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gui/palette.h b/src/gui/palette.h index 6a5917c2..ee748e74 100644 --- a/src/gui/palette.h +++ b/src/gui/palette.h @@ -153,14 +153,11 @@ class Palette int delay; int committedDelay; - void set(int type, gcn::Color& color, GradientType grad, - const std::string &text, char c, int delay) + void set(int type, gcn::Color& color, GradientType grad, int delay) { ColorElem::type = type; ColorElem::color = color; ColorElem::testColor = color; - ColorElem::text = text; - ColorElem::ch = c; ColorElem::grad = grad; ColorElem::delay = delay; ColorElem::gradientIndex = rand(); diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 4e0090e9..8d447c2f 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -101,6 +101,18 @@ Theme::Theme(): { config.addListener("guialpha", this); loadColors(); + + mColors[HIGHLIGHT].ch = 'H'; + mColors[CHAT].ch = 'C'; + mColors[GM].ch = 'G'; + mColors[PLAYER].ch = 'Y'; + mColors[WHISPER].ch = 'W'; + mColors[IS].ch = 'I'; + mColors[PARTY].ch = 'P'; + mColors[GUILD].ch = 'U'; + mColors[SERVER].ch = 'S'; + mColors[LOGGER].ch = 'L'; + mColors[HYPERLINK].ch = '<'; } Theme::~Theme() @@ -532,10 +544,9 @@ void Theme::loadColors(std::string file) color = readColor(temp); grad = readColorGradient(XML::getProperty(node, "effect", "")); - mColors[type].set(type, color, grad, "", 0, 10); + mColors[type].set(type, color, grad, 10); } - - if (xmlStrEqual(node->name, BAD_CAST "progressbar")) + else if (xmlStrEqual(node->name, BAD_CAST "progressbar")) { type = readProgressType(XML::getProperty(node, "id", "")); if (type < 0) // invalid or no type given diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp index 71cb054c..0f30b752 100644 --- a/src/gui/userpalette.cpp +++ b/src/gui/userpalette.cpp @@ -213,9 +213,8 @@ int UserPalette::getColorTypeAt(int i) return mColors[i].type; } -void UserPalette::addColor(int type, int rgb, - Palette::GradientType grad, const std::string &text, - char c, int delay) +void UserPalette::addColor(int type, int rgb, Palette::GradientType grad, + const std::string &text, int delay) { const std::string &configName = ColorTypeNames[type]; char buffer[20]; @@ -230,7 +229,8 @@ void UserPalette::addColor(int type, int rgb, gcn::Color trueCol = rgbValue; grad = (GradientType) config.getValue(configName + "Gradient", grad); delay = (int) config.getValue(configName + "Delay", delay); - mColors[type].set(type, trueCol, grad, text, c, delay); + mColors[type].set(type, trueCol, grad, delay); + mColors[type].text = text; if (grad != STATIC) mGradVector.push_back(&mColors[type]); diff --git a/src/gui/userpalette.h b/src/gui/userpalette.h index 7863f8cd..82bcea1c 100644 --- a/src/gui/userpalette.h +++ b/src/gui/userpalette.h @@ -199,8 +199,7 @@ class UserPalette : public Palette, public gcn::ListModel * @param text identifier of color */ void addColor(int type, int rgb, GradientType grad, - const std::string &text, char c = 0, - int delay = GRADIENT_DELAY); + const std::string &text, int delay = GRADIENT_DELAY); }; extern UserPalette *userPalette; -- cgit v1.2.3-60-g2f50