diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-20 04:02:56 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-20 13:55:43 +0300 |
commit | d65f51b41a9d84c501bb25bc3849ffd8446fb2e6 (patch) | |
tree | 650a8cbdb4b33643e6465e74d85eb3fca6b428d2 | |
parent | 35efb9eba3a198b1dd2959434e82c8da45af689e (diff) | |
download | plus-d65f51b41a9d84c501bb25bc3849ffd8446fb2e6.tar.gz plus-d65f51b41a9d84c501bb25bc3849ffd8446fb2e6.tar.bz2 plus-d65f51b41a9d84c501bb25bc3849ffd8446fb2e6.tar.xz plus-d65f51b41a9d84c501bb25bc3849ffd8446fb2e6.zip |
Fix palettes loading and using.
-rw-r--r-- | data/graphics/gui/colors.xml | 2 | ||||
-rw-r--r-- | data/themes/blacknblack/colors.xml | 2 | ||||
-rw-r--r-- | data/themes/blackwood/colors.xml | 2 | ||||
-rw-r--r-- | data/themes/enchilado/colors.xml | 2 | ||||
-rw-r--r-- | data/themes/jewelry/colors.xml | 2 | ||||
-rw-r--r-- | data/themes/mana/colors.xml | 2 | ||||
-rw-r--r-- | data/themes/pink/colors.xml | 2 | ||||
-rw-r--r-- | data/themes/unity/colors.xml | 2 | ||||
-rw-r--r-- | data/themes/wood/colors.xml | 2 | ||||
-rw-r--r-- | src/gui/theme.cpp | 8 | ||||
-rw-r--r-- | src/gui/theme.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/widget2.h | 23 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 4 |
14 files changed, 29 insertions, 28 deletions
diff --git a/data/graphics/gui/colors.xml b/data/graphics/gui/colors.xml index 76513b2ce..089ff9429 100644 --- a/data/graphics/gui/colors.xml +++ b/data/graphics/gui/colors.xml @@ -1,5 +1,5 @@ <colors> - <palette id="1"> + <palette id="0"> <color id="BROWSERBOX" color="#000000" /> <color id="TEXT" color="#000000" /> <color id="CARET" color="#000000" /> diff --git a/data/themes/blacknblack/colors.xml b/data/themes/blacknblack/colors.xml index 0f2f243b0..939583dce 100644 --- a/data/themes/blacknblack/colors.xml +++ b/data/themes/blacknblack/colors.xml @@ -1,5 +1,5 @@ <colors> - <palette id="1"> + <palette id="0"> <color id="BROWSERBOX" color="#ffffff" /> <color id="TEXT" color="#ffffff" /> <color id="CARET" color="#ffffff" /> diff --git a/data/themes/blackwood/colors.xml b/data/themes/blackwood/colors.xml index da3a65e54..6e2ccdde5 100644 --- a/data/themes/blackwood/colors.xml +++ b/data/themes/blackwood/colors.xml @@ -1,5 +1,5 @@ <colors> - <palette id="1"> + <palette id="0"> <color id="BROWSERBOX" color="#7a7972" /> <color id="TEXT" color="#7a7972" /> <color id="CARET" color="#7a7972" /> diff --git a/data/themes/enchilado/colors.xml b/data/themes/enchilado/colors.xml index 72924f8c2..97cd521f4 100644 --- a/data/themes/enchilado/colors.xml +++ b/data/themes/enchilado/colors.xml @@ -1,5 +1,5 @@ <colors> - <palette id="1"> + <palette id="0"> <color id="BROWSERBOX" color="#000000" /> <color id="TEXT" color="#000000" /> <color id="CARET" color="#000000" /> diff --git a/data/themes/jewelry/colors.xml b/data/themes/jewelry/colors.xml index 4d4f05ca1..965aba8ae 100644 --- a/data/themes/jewelry/colors.xml +++ b/data/themes/jewelry/colors.xml @@ -1,5 +1,5 @@ <colors> - <palette id="1"> + <palette id="0"> <color id="BROWSERBOX" color="#402600" /> <color id="TEXT" color="#402600" /> <color id="CARET" color="#80561f" /> diff --git a/data/themes/mana/colors.xml b/data/themes/mana/colors.xml index f20b09c0a..f37fce9ad 100644 --- a/data/themes/mana/colors.xml +++ b/data/themes/mana/colors.xml @@ -1,5 +1,5 @@ <colors> - <palette id="1"> + <palette id="0"> <color id="BROWSERBOX" color="#000000" /> <color id="TEXT" color="#000000" /> <color id="CARET" color="#000000" /> diff --git a/data/themes/pink/colors.xml b/data/themes/pink/colors.xml index 74a22f78e..dc7f00f0b 100644 --- a/data/themes/pink/colors.xml +++ b/data/themes/pink/colors.xml @@ -1,5 +1,5 @@ <colors> - <palette id="1"> + <palette id="0"> <color id="BROWSERBOX" color="#FF00FF" /> <color id="TEXT" color="#FF00FF" /> <color id="CARET" color="#FF00FF" /> diff --git a/data/themes/unity/colors.xml b/data/themes/unity/colors.xml index 4fc908ac1..fa1b95e03 100644 --- a/data/themes/unity/colors.xml +++ b/data/themes/unity/colors.xml @@ -1,5 +1,5 @@ <colors> - <palette id="1"> + <palette id="0"> <color id="BROWSERBOX" color="#E0E0E0" /> <color id="TEXT" color="#E0E0E0" /> <color id="CARET" color="#E0E0E0" /> diff --git a/data/themes/wood/colors.xml b/data/themes/wood/colors.xml index 1ee107887..6add6431d 100644 --- a/data/themes/wood/colors.xml +++ b/data/themes/wood/colors.xml @@ -1,5 +1,5 @@ <colors> - <palette id="1"> + <palette id="0"> <color id="BROWSERBOX" color="#000000" /> <color id="TEXT" color="#000000" /> <color id="CARET" color="#000000" /> diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 2178228fc..54946984c 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -924,8 +924,8 @@ void Theme::loadColors(std::string file) continue; } - int paletteId = XML::getProperty(paletteNode, "id", 1); - if (paletteId < 1 || paletteId > THEME_PALETTES) + const int paletteId = XML::getProperty(paletteNode, "id", 1); + if (paletteId < 0 || paletteId >= THEME_PALETTES) continue; for_each_xml_child_node(node, paletteNode) @@ -942,8 +942,8 @@ void Theme::loadColors(std::string file) color = readColor(temp); grad = readColorGradient(XML::getProperty(node, "effect", "")); - - mColors[type * paletteId].set(type, color, grad, 10); + mColors[paletteId * THEME_COLORS_END + type].set( + type, color, grad, 10); } } } diff --git a/src/gui/theme.h b/src/gui/theme.h index 1e91b46ce..e26fee332 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -296,7 +296,7 @@ class Theme final : public Palette, public ConfigListener bool &valid) { return mInstance->getCharColor(c, valid); } - static int getIdByChar(const signed char c, bool &valid) + static int getThemeIdByChar(const signed char c, bool &valid) { return mInstance->getIdByChar(c, valid); } static gcn::Color getProgressColor(const int type, diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 578ddd4a9..23fe456ed 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -500,7 +500,7 @@ int BrowserBox::calcHeight() const signed char c = row.at(start + 2); bool valid; - const gcn::Color col = Theme::getThemeCharColor(c, valid); + const gcn::Color col = getThemeCharColor(c, valid); if (c == '>') { diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h index dd0f0f6fe..ed2533287 100644 --- a/src/gui/widgets/widget2.h +++ b/src/gui/widgets/widget2.h @@ -27,12 +27,12 @@ class Widget2 { public: Widget2() : - mPalette(1) + mPaletteOffset(0) { } Widget2(const Widget2 *const widget) : - mPalette(widget ? widget->mPalette : 1) + mPaletteOffset(widget ? widget->mPaletteOffset : 0) { checkPalette(); } @@ -44,39 +44,42 @@ class Widget2 inline const gcn::Color &getThemeColor(const int type, const int alpha = 255) const { - return Theme::getThemeColor(type * mPalette, alpha); + return Theme::getThemeColor(mPaletteOffset + type, alpha); } inline const gcn::Color &getThemeCharColor(const signed char c, bool &valid) const { - const int colorId = Theme::getIdByChar(c, valid); + const int colorId = Theme::getThemeIdByChar(c, valid); if (valid) - return Theme::getThemeColor(colorId * mPalette); + return Theme::getThemeColor(mPaletteOffset + colorId); else return Palette::BLACK; } virtual void setWidget2(const Widget2 *const widget) { - mPalette = widget ? widget->mPalette : 1; + mPaletteOffset = widget ? widget->mPaletteOffset : 0; } void setPalette(int palette) { - mPalette = palette; + mPaletteOffset = palette * Theme::THEME_COLORS_END; checkPalette(); setWidget2(this); } void checkPalette() { - if (mPalette < 1 || mPalette > THEME_PALETTES) - mPalette = 1; + if (mPaletteOffset < 0 || mPaletteOffset + >= THEME_PALETTES * Theme::THEME_COLORS_END) + { + mPaletteOffset = 0; + } } protected: - int mPalette; + int mPaletteOffset; }; #endif diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index ae47cb001..5495cd310 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -143,9 +143,7 @@ Window::Window(const std::string &caption, const bool modal, addWidgetListener(this); mForegroundColor = getThemeColor(Theme::WINDOW); - logger->log("window palettes: %d, %d", mPalette, childPalette); - if (childPalette != mPalette) - setPalette(childPalette); + setPalette(childPalette); } Window::~Window() |