From 087576e8e9e7c1555f6cabe9d34317bdddff2c78 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 4 Dec 2013 20:39:27 +0300 Subject: add ability to set text colors on ministatus window bars. Also add PROGRESSBAR_OUTLINE color. --- data/graphics/gui/colors.xml | 1 + data/themes/blacknblack/colors.xml | 1 + data/themes/blackwood/colors.xml | 1 + data/themes/enchilado/colors.xml | 1 + data/themes/jewelry/colors.xml | 3 +++ data/themes/mana/colors.xml | 1 + data/themes/pink/colors.xml | 1 + data/themes/unity/colors.xml | 1 + data/themes/wood/colors.xml | 1 + src/gui/theme.cpp | 1 + src/gui/theme.h | 1 + src/gui/widgets/progressbar.cpp | 2 +- src/gui/windows/ministatuswindow.cpp | 30 ++++++++++++++++++------------ src/gui/windows/ministatuswindow.h | 5 +++-- 14 files changed, 35 insertions(+), 15 deletions(-) diff --git a/data/graphics/gui/colors.xml b/data/graphics/gui/colors.xml index d751f2046..3cf91bc5d 100644 --- a/data/graphics/gui/colors.xml +++ b/data/graphics/gui/colors.xml @@ -9,6 +9,7 @@ + diff --git a/data/themes/blacknblack/colors.xml b/data/themes/blacknblack/colors.xml index 63c14a9a3..88cd13b4f 100644 --- a/data/themes/blacknblack/colors.xml +++ b/data/themes/blacknblack/colors.xml @@ -9,6 +9,7 @@ + diff --git a/data/themes/blackwood/colors.xml b/data/themes/blackwood/colors.xml index d7a813658..00ad3c41e 100644 --- a/data/themes/blackwood/colors.xml +++ b/data/themes/blackwood/colors.xml @@ -9,6 +9,7 @@ + diff --git a/data/themes/enchilado/colors.xml b/data/themes/enchilado/colors.xml index 7f871030f..43a52a4e2 100644 --- a/data/themes/enchilado/colors.xml +++ b/data/themes/enchilado/colors.xml @@ -9,6 +9,7 @@ + diff --git a/data/themes/jewelry/colors.xml b/data/themes/jewelry/colors.xml index f66625b8f..aaffe0525 100644 --- a/data/themes/jewelry/colors.xml +++ b/data/themes/jewelry/colors.xml @@ -9,6 +9,7 @@ + @@ -97,6 +98,7 @@ + @@ -261,6 +263,7 @@ + diff --git a/data/themes/mana/colors.xml b/data/themes/mana/colors.xml index e7ef15f09..ba79829c6 100644 --- a/data/themes/mana/colors.xml +++ b/data/themes/mana/colors.xml @@ -9,6 +9,7 @@ + diff --git a/data/themes/pink/colors.xml b/data/themes/pink/colors.xml index 423e05e44..d86901085 100644 --- a/data/themes/pink/colors.xml +++ b/data/themes/pink/colors.xml @@ -9,6 +9,7 @@ + diff --git a/data/themes/unity/colors.xml b/data/themes/unity/colors.xml index 58bab3eab..2ba699379 100644 --- a/data/themes/unity/colors.xml +++ b/data/themes/unity/colors.xml @@ -8,6 +8,7 @@ + diff --git a/data/themes/wood/colors.xml b/data/themes/wood/colors.xml index 1566ab5e6..2a76648d1 100644 --- a/data/themes/wood/colors.xml +++ b/data/themes/wood/colors.xml @@ -9,6 +9,7 @@ + diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 8f5d49bfa..cfbe26d03 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -781,6 +781,7 @@ static int readColorType(const std::string &type) "OUTLINE", "BORDER", "PROGRESS_BAR", + "PROGRESS_BAR_OUTLINE", "BUTTON", "BUTTON_OUTLINE", "BUTTON_DISABLED", diff --git a/src/gui/theme.h b/src/gui/theme.h index 0ed7c2fb1..08d912430 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -224,6 +224,7 @@ class Theme final : public Palette, public ConfigListener OUTLINE, BORDER, PROGRESS_BAR, + PROGRESS_BAR_OUTLINE, BUTTON, BUTTON_OUTLINE, BUTTON_DISABLED, diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index dd44a3b9c..71a7c641f 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -47,7 +47,7 @@ ProgressBar::ProgressBar(const Widget2 *const widget, float progress, mBackgroundColor(Theme::getProgressColor(backColor >= 0 ? backColor : 0, mProgress)), mBackgroundColorToGo(mBackgroundColor), - mForegroundColor2(getThemeColor(Theme::OUTLINE)), + mForegroundColor2(getThemeColor(Theme::PROGRESS_BAR_OUTLINE)), mText(), mVertexes(new ImageCollection), mProgressPalette(backColor), diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index cc666f614..d2ff6b0bb 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -62,30 +62,33 @@ MiniStatusWindow::MiniStatusWindow() : mIconSpacing(mSkin ? mSkin->getOption("iconSpacing", 2) : 2), mMaxX(0), // TRANSLATORS: status bar name - mHpBar(createBar(0, 100, 0, Theme::PROG_HP, "hp bar", _("health bar"))), + mHpBar(createBar(0, 100, 0, Theme::PROGRESS_BAR, Theme::PROG_HP, + "hp bar", _("health bar"))), mMpBar(Net::getGameHandler()->canUseMagicBar() - ? createBar(0, 100, 0, Net::getPlayerHandler()->canUseMagic() + ? createBar(0, 100, 0, Theme::PROGRESS_BAR, + Net::getPlayerHandler()->canUseMagic() // TRANSLATORS: status bar name ? Theme::PROG_MP : Theme::PROG_NO_MP, "mp bar", _("mana bar")) : nullptr), - mXpBar(createBar(0, 100, 0, Theme::PROG_EXP, + mXpBar(createBar(0, 100, 0, Theme::PROGRESS_BAR, Theme::PROG_EXP, // TRANSLATORS: status bar name "xp bar", _("experience bar"))), mJobBar(nullptr), - mWeightBar(createBar(0, 140, 0, Theme::PROG_WEIGHT, + mWeightBar(createBar(0, 140, 0, Theme::PROGRESS_BAR, Theme::PROG_WEIGHT, // TRANSLATORS: status bar name "weight bar", _("weight bar"))), - mInvSlotsBar(createBar(0, 45, 0, Theme::PROG_INVY_SLOTS, + mInvSlotsBar(createBar(0, 45, 0, + Theme::SLOTS_BAR, Theme::PROG_INVY_SLOTS, // TRANSLATORS: status bar name "inventory slots bar", _("inventory slots bar"))), - mMoneyBar(createBar(0, 130, 0, Theme::PROG_INVY_SLOTS, + mMoneyBar(createBar(0, 130, 0, Theme::SLOTS_BAR, Theme::PROG_INVY_SLOTS, // TRANSLATORS: status bar name "money bar", _("money bar"))), - mArrowsBar(createBar(0, 50, 0, Theme::PROG_INVY_SLOTS, + mArrowsBar(createBar(0, 50, 0, Theme::SLOTS_BAR, Theme::PROG_INVY_SLOTS, // TRANSLATORS: status bar name "arrows bar", _("arrows bar"))), mStatusBar(createBar(100, (config.getIntValue("fontSize") > 16 - ? 250 : 165), 0, Theme::PROG_EXP, + ? 250 : 165), 0, Theme::PROGRESS_BAR, Theme::PROG_EXP, // TRANSLATORS: status bar name "status bar", _("status bar"))), mTextPopup(new TextPopup), @@ -108,9 +111,9 @@ MiniStatusWindow::MiniStatusWindow() : if (job) { - mJobBar = createBar(0, 100, 0, Theme::PROG_JOB, "job bar", + mJobBar = createBar(0, 100, 0, Theme::PROGRESS_BAR, Theme::PROG_JOB, // TRANSLATORS: status bar name - _("job bar")); + "job bar", _("job bar")); StatusWindow::updateJobBar(mJobBar); } @@ -154,14 +157,17 @@ MiniStatusWindow::~MiniStatusWindow() ProgressBar *MiniStatusWindow::createBar(const float progress, const int width, const int height, - const int color, + const int textColor, + const int backColor, const std::string &name, const std::string &description) { ProgressBar *const bar = new ProgressBar(this, - progress, width, height, color); + progress, width, height, backColor); bar->setActionEventId(name); bar->setId(description); + bar->setColor(Theme::getThemeColor(textColor), + Theme::getThemeColor(textColor + 1)); mBars.push_back(bar); mBarNames[name] = bar; return bar; diff --git a/src/gui/windows/ministatuswindow.h b/src/gui/windows/ministatuswindow.h index 82ba64034..2ec31ef25 100644 --- a/src/gui/windows/ministatuswindow.h +++ b/src/gui/windows/ministatuswindow.h @@ -96,8 +96,9 @@ class MiniStatusWindow final : public Popup, private: bool isInBar(ProgressBar *bar, int x, int y) const; - ProgressBar *createBar(const float progress, const int width, - const int height, const int color, + ProgressBar *createBar(const float progress, + const int width, const int height, + const int textColor, const int backColor, const std::string &name, const std::string &description) A_WARN_UNUSED; -- cgit v1.2.3-60-g2f50