From 28999e7571b66733dcf0ddbc7e376c2c3fc1bfae Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 9 Dec 2013 13:57:30 +0300 Subject: Add text colors for mp bar. New theme colors: MP_BAR, MP_BAR_OUTLINE, NO_MP_BAR, NO_MP_BAR_OUTLINE --- data/graphics/gui/colors.xml | 4 ++++ data/themes/blacknblack/colors.xml | 4 ++++ data/themes/blackwood/colors.xml | 4 ++++ data/themes/enchilado/colors.xml | 4 ++++ data/themes/jewelry/colors.xml | 12 ++++++++++++ data/themes/mana/colors.xml | 4 ++++ data/themes/pink/colors.xml | 4 ++++ data/themes/unity/colors.xml | 4 ++++ data/themes/wood/colors.xml | 4 ++++ src/gui/theme.cpp | 4 ++++ src/gui/theme.h | 4 ++++ src/gui/windows/ministatuswindow.cpp | 3 ++- src/gui/windows/statuswindow.cpp | 22 ++++++++++++++++++++-- 13 files changed, 74 insertions(+), 3 deletions(-) diff --git a/data/graphics/gui/colors.xml b/data/graphics/gui/colors.xml index 2e8cd6d5c..cf5a37fbf 100644 --- a/data/graphics/gui/colors.xml +++ b/data/graphics/gui/colors.xml @@ -103,6 +103,10 @@ + + + + diff --git a/data/themes/blacknblack/colors.xml b/data/themes/blacknblack/colors.xml index 1dd0d8176..18879b319 100644 --- a/data/themes/blacknblack/colors.xml +++ b/data/themes/blacknblack/colors.xml @@ -93,6 +93,10 @@ + + + + diff --git a/data/themes/blackwood/colors.xml b/data/themes/blackwood/colors.xml index f744eef7d..9d066891d 100644 --- a/data/themes/blackwood/colors.xml +++ b/data/themes/blackwood/colors.xml @@ -92,6 +92,10 @@ + + + + diff --git a/data/themes/enchilado/colors.xml b/data/themes/enchilado/colors.xml index a20f8c240..821ca0f23 100644 --- a/data/themes/enchilado/colors.xml +++ b/data/themes/enchilado/colors.xml @@ -93,6 +93,10 @@ + + + + diff --git a/data/themes/jewelry/colors.xml b/data/themes/jewelry/colors.xml index 0258326db..587088a29 100644 --- a/data/themes/jewelry/colors.xml +++ b/data/themes/jewelry/colors.xml @@ -90,6 +90,10 @@ + + + + @@ -257,6 +261,10 @@ + + + + @@ -348,6 +356,10 @@ + + + + diff --git a/data/themes/mana/colors.xml b/data/themes/mana/colors.xml index 6dbbb95f8..b3140fdae 100644 --- a/data/themes/mana/colors.xml +++ b/data/themes/mana/colors.xml @@ -93,6 +93,10 @@ + + + + diff --git a/data/themes/pink/colors.xml b/data/themes/pink/colors.xml index 851890e30..af840806a 100644 --- a/data/themes/pink/colors.xml +++ b/data/themes/pink/colors.xml @@ -93,6 +93,10 @@ + + + + diff --git a/data/themes/unity/colors.xml b/data/themes/unity/colors.xml index 8346794fc..8086ea7d5 100644 --- a/data/themes/unity/colors.xml +++ b/data/themes/unity/colors.xml @@ -92,6 +92,10 @@ + + + + diff --git a/data/themes/wood/colors.xml b/data/themes/wood/colors.xml index e7e02e93d..bba2e9cd6 100644 --- a/data/themes/wood/colors.xml +++ b/data/themes/wood/colors.xml @@ -93,6 +93,10 @@ + + + + diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 274be10df..5935442c0 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -955,6 +955,10 @@ static int readColorType(const std::string &type) "SLOTS_BAR_OUTLINE", "HP_BAR", "HP_BAR_OUTLINE" + "MP_BAR", + "MP_BAR_OUTLINE" + "NO_MP_BAR", + "NO_MP_BAR_OUTLINE" }; if (type.empty()) diff --git a/src/gui/theme.h b/src/gui/theme.h index 58a194d63..bd3db6f66 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -398,6 +398,10 @@ class Theme final : public Palette, public ConfigListener SLOTS_BAR_OUTLINE, HP_BAR, HP_BAR_OUTLINE, + MP_BAR, + MP_BAR_OUTLINE, + NO_MP_BAR, + NO_MP_BAR_OUTLINE, THEME_COLORS_END }; diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 0141354ee..8186f1e04 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -65,7 +65,8 @@ MiniStatusWindow::MiniStatusWindow() : mHpBar(createBar(0, 100, 0, Theme::HP_BAR, Theme::PROG_HP, "hp bar", _("health bar"))), mMpBar(Net::getGameHandler()->canUseMagicBar() - ? createBar(0, 100, 0, Theme::PROGRESS_BAR, + ? createBar(0, 100, 0, Net::getPlayerHandler()->canUseMagic() + ? Theme::MP_BAR : Theme::NO_MP_BAR, Net::getPlayerHandler()->canUseMagic() // TRANSLATORS: status bar name ? Theme::PROG_MP : Theme::PROG_NO_MP, "mp bar", _("mana bar")) diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 19d862443..bf93efbee 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -209,11 +209,21 @@ StatusWindow::StatusWindow() : max = PlayerInfo::getAttribute(PlayerInfo::MAX_MP); // TRANSLATORS: status window label mMpLabel = new Label(this, _("MP:")); + const bool useMagic = Net::getPlayerHandler()->canUseMagic(); mMpBar = new ProgressBar(this, max ? static_cast( PlayerInfo::getAttribute(PlayerInfo::MAX_MP)) / static_cast(max) : static_cast(0), - 80, 0, Net::getPlayerHandler()->canUseMagic() ? - Theme::PROG_MP : Theme::PROG_NO_MP); + 80, 0, useMagic ? Theme::PROG_MP : Theme::PROG_NO_MP); + if (useMagic) + { + mMpBar->setColor(Theme::getThemeColor(Theme::MP_BAR), + Theme::getThemeColor(Theme::MP_BAR_OUTLINE)); + } + else + { + mMpBar->setColor(Theme::getThemeColor(Theme::NO_MP_BAR), + Theme::getThemeColor(Theme::NO_MP_BAR_OUTLINE)); + } } else { @@ -523,9 +533,17 @@ void StatusWindow::updateMPBar(ProgressBar *const bar, const bool showMax) prog = static_cast(mp) / static_cast(maxMp); if (Net::getPlayerHandler()->canUseMagic()) + { + bar->setColor(Theme::getThemeColor(Theme::MP_BAR), + Theme::getThemeColor(Theme::MP_BAR_OUTLINE)); bar->setProgressPalette(Theme::PROG_MP); + } else + { + bar->setColor(Theme::getThemeColor(Theme::NO_MP_BAR), + Theme::getThemeColor(Theme::NO_MP_BAR_OUTLINE)); bar->setProgressPalette(Theme::PROG_NO_MP); + } bar->setProgress(prog); } -- cgit v1.2.3-60-g2f50