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 /src/gui/widgets | |
parent | 35efb9eba3a198b1dd2959434e82c8da45af689e (diff) | |
download | manaplus-d65f51b41a9d84c501bb25bc3849ffd8446fb2e6.tar.gz manaplus-d65f51b41a9d84c501bb25bc3849ffd8446fb2e6.tar.bz2 manaplus-d65f51b41a9d84c501bb25bc3849ffd8446fb2e6.tar.xz manaplus-d65f51b41a9d84c501bb25bc3849ffd8446fb2e6.zip |
Fix palettes loading and using.
Diffstat (limited to 'src/gui/widgets')
-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 |
3 files changed, 15 insertions, 14 deletions
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() |