diff options
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/enums/gui/progresscolorid.h | 48 | ||||
-rw-r--r-- | src/gui/theme.cpp | 7 | ||||
-rw-r--r-- | src/gui/theme.h | 17 | ||||
-rw-r--r-- | src/gui/widgets/avatarlistbox.cpp | 10 | ||||
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 12 | ||||
-rw-r--r-- | src/gui/windows/ministatuswindow.cpp | 24 | ||||
-rw-r--r-- | src/gui/windows/statuswindow.cpp | 18 | ||||
-rw-r--r-- | src/gui/windows/updaterwindow.cpp | 4 |
10 files changed, 93 insertions, 49 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 124ed3d7b..22f03e4e5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1127,6 +1127,7 @@ SET(SRCS gui/color.h gui/colorpair.h enums/gui/dialogtype.h + enums/gui/progresscolorid.h enums/gui/themecolorid.h listeners/errorlistener.cpp listeners/errorlistener.h diff --git a/src/Makefile.am b/src/Makefile.am index 07e8bcd28..e589af516 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -192,6 +192,7 @@ manaplus_SOURCES += events/actionevent.h \ gui/cliprect.h \ gui/color.h \ enums/gui/dialogtype.h \ + enums/gui/progresscolorid.h \ enums/gui/themecolorid.h \ listeners/errorlistener.cpp \ listeners/errorlistener.h \ diff --git a/src/enums/gui/progresscolorid.h b/src/enums/gui/progresscolorid.h new file mode 100644 index 000000000..a7e6b74a3 --- /dev/null +++ b/src/enums/gui/progresscolorid.h @@ -0,0 +1,48 @@ +/* + * The ManaPlus Client + * Copyright (C) 2008 The Legend of Mazzeroth Development Team + * Copyright (C) 2009 Aethyra Development Team + * Copyright (C) 2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef ENUMS_GUI_PROGRESSCOLORID_H +#define ENUMS_GUI_PROGRESSCOLORID_H + +namespace ProgressColorId +{ + enum T + { + PROG_HP = 0, + PROG_HP_POISON, + PROG_MP, + PROG_NO_MP, + PROG_EXP, + PROG_INVY_SLOTS, + PROG_WEIGHT, + PROG_JOB, + PROG_UPDATE, + PROG_MONEY, + PROG_ARROWS, + PROG_STATUS, + THEME_PROG_END + }; +} // namespace ProgressColorId + +#endif // ENUMS_GUI_PROGRESSCOLORID_H diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index ab6255a68..477da5fb0 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -27,6 +27,7 @@ #include "configuration.h" #include "graphicsmanager.h" +#include "enums/gui/progresscolorid.h" #include "enums/gui/themecolorid.h" #include "gui/skin.h" @@ -72,7 +73,7 @@ Theme::Theme() : Palette(ThemeColorId::THEME_COLORS_END * THEME_PALETTES), mSkins(), mMinimumOpacity(-1.0F), - mProgressColors(ProgressColors(THEME_PROG_END)) + mProgressColors(ProgressColors(ProgressColorId::THEME_PROG_END)) { initDefaultThemePath(); @@ -936,7 +937,7 @@ static Palette::GradientType readColorGradient(const std::string &grad) static int readProgressType(const std::string &type) { - static const std::string colors[Theme::THEME_PROG_END] = + static const std::string colors[ProgressColorId::THEME_PROG_END] = { "HP", "HP_POISON", @@ -955,7 +956,7 @@ static int readProgressType(const std::string &type) if (type.empty()) return -1; - for (int i = 0; i < Theme::THEME_PROG_END; i++) + for (int i = 0; i < ProgressColorId::THEME_PROG_END; i++) { if (compareStrI(type, colors[i]) == 0) return i; diff --git a/src/gui/theme.h b/src/gui/theme.h index 8d439bd0a..3d0c21998 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -91,23 +91,6 @@ class Theme final : public Palette, const int w, const int h)A_WARN_UNUSED; - enum ProgressPalette - { - PROG_HP = 0, - PROG_HP_POISON, - PROG_MP, - PROG_NO_MP, - PROG_EXP, - PROG_INVY_SLOTS, - PROG_WEIGHT, - PROG_JOB, - PROG_UPDATE, - PROG_MONEY, - PROG_ARROWS, - PROG_STATUS, - THEME_PROG_END - }; - static Color getProgressColor(const int type, const float progress) A_WARN_UNUSED; diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index b2ee21937..5c2f0a65d 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -25,6 +25,8 @@ #include "configuration.h" #include "graphicsvertexes.h" +#include "enums/gui/progresscolorid.h" + #include "being/localplayer.h" #include "gui/gui.h" @@ -178,7 +180,7 @@ void AvatarListBox::draw(Graphics *graphics) if (a->getMaxHp()) { const int themeColor = (isPoison - ? Theme::PROG_HP_POISON : Theme::PROG_HP); + ? ProgressColorId::PROG_HP_POISON : ProgressColorId::PROG_HP); Color color = Theme::getProgressColor( themeColor, static_cast<float>(a->getHp()) / static_cast<float>(a->getMaxHp())); @@ -203,7 +205,7 @@ void AvatarListBox::draw(Graphics *graphics) } const int themeColor = (a->getPoison() - ? Theme::PROG_HP_POISON : Theme::PROG_HP); + ? ProgressColorId::PROG_HP_POISON : ProgressColorId::PROG_HP); Color color = Theme::getProgressColor(themeColor, 1); color.a = 80; graphics->setColor(color); @@ -415,7 +417,7 @@ void AvatarListBox::safeDraw(Graphics *graphics) if (a->getMaxHp()) { const int themeColor = (isPoison - ? Theme::PROG_HP_POISON : Theme::PROG_HP); + ? ProgressColorId::PROG_HP_POISON : ProgressColorId::PROG_HP); Color color = Theme::getProgressColor( themeColor, static_cast<float>(a->getHp()) / static_cast<float>(a->getMaxHp())); @@ -440,7 +442,7 @@ void AvatarListBox::safeDraw(Graphics *graphics) } const int themeColor = (a->getPoison() - ? Theme::PROG_HP_POISON : Theme::PROG_HP); + ? ProgressColorId::PROG_HP_POISON : ProgressColorId::PROG_HP); Color color = Theme::getProgressColor(themeColor, 1); color.a = 80; graphics->setColor(color); diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 8b46f5e55..ed3742c9b 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -26,10 +26,12 @@ #include "item.h" #include "units.h" -#include "being/playerinfo.h" - #include "enums/being/attributes.h" +#include "enums/gui/progresscolorid.h" + +#include "being/playerinfo.h" + #include "input/inputmanager.h" #include "gui/gui.h" @@ -92,7 +94,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : mRetrieveButton(nullptr), mInvCloseButton(nullptr), mWeightBar(nullptr), - mSlotsBar(new ProgressBar(this, 0.0F, 100, 0, Theme::PROG_INVY_SLOTS, + mSlotsBar(new ProgressBar(this, 0.0F, 100, 0, ProgressColorId::PROG_INVY_SLOTS, "slotsprogressbar.xml", "slotsprogressbar_fill.xml")), mFilter(nullptr), mSortModel(new SortListModelInv), @@ -215,7 +217,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : // TRANSLATORS: inventory equipment button mEquipmentButton = new Button(this, _("E"), "equipment", this); mWeightBar = new ProgressBar(this, 0.0F, 100, 0, - Theme::PROG_WEIGHT, + ProgressColorId::PROG_WEIGHT, "weightprogressbar.xml", "weightprogressbar_fill.xml"); mWeightBar->setColor(getThemeColor(ThemeColorId::WEIGHT_BAR), getThemeColor(ThemeColorId::WEIGHT_BAR_OUTLINE)); @@ -284,7 +286,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : mInvCloseButton = new Button(this, _("Close"), "close", this); mWeightBar = new ProgressBar(this, 0.0F, 100, 0, - Theme::PROG_WEIGHT, + ProgressColorId::PROG_WEIGHT, "weightprogressbar.xml", "weightprogressbar_fill.xml"); mWeightBar->setColor(getThemeColor(ThemeColorId::WEIGHT_BAR), getThemeColor(ThemeColorId::WEIGHT_BAR_OUTLINE)); diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 4af6467fb..96901249e 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -26,11 +26,13 @@ #include "configuration.h" #include "inventory.h" +#include "enums/being/attributes.h" + +#include "enums/gui/progresscolorid.h" + #include "being/localplayer.h" #include "being/playerinfo.h" -#include "enums/being/attributes.h" - #include "gui/popupmanager.h" #include "gui/skin.h" @@ -67,45 +69,45 @@ MiniStatusWindow::MiniStatusWindow() : mBarNames(), mIcons(), // TRANSLATORS: status bar name - mHpBar(createBar(0, 100, 0, ThemeColorId::HP_BAR, Theme::PROG_HP, + mHpBar(createBar(0, 100, 0, ThemeColorId::HP_BAR, ProgressColorId::PROG_HP, "hpprogressbar.xml", "hpprogressbar_fill.xml", "hp bar", _("health bar"))), mMpBar(gameHandler->canUseMagicBar() ? createBar(0, 100, 0, playerHandler->canUseMagic() ? ThemeColorId::MP_BAR : ThemeColorId::NO_MP_BAR, playerHandler->canUseMagic() - ? Theme::PROG_MP : Theme::PROG_NO_MP, + ? ProgressColorId::PROG_MP : ProgressColorId::PROG_NO_MP, playerHandler->canUseMagic() ? "mpprogressbar.xml" : "nompprogressbar.xml", playerHandler->canUseMagic() ? "mpprogressbar_fill.xml" : "nompprogressbar_fill.xml", // TRANSLATORS: status bar name "mp bar", _("mana bar")) : nullptr), - mXpBar(createBar(0, 100, 0, ThemeColorId::XP_BAR, Theme::PROG_EXP, + mXpBar(createBar(0, 100, 0, ThemeColorId::XP_BAR, ProgressColorId::PROG_EXP, "xpprogressbar.xml", "xpprogressbar_fill.xml", // TRANSLATORS: status bar name "xp bar", _("experience bar"))), mJobBar(nullptr), - mWeightBar(createBar(0, 140, 0, ThemeColorId::WEIGHT_BAR, Theme::PROG_WEIGHT, + mWeightBar(createBar(0, 140, 0, ThemeColorId::WEIGHT_BAR, ProgressColorId::PROG_WEIGHT, "weightprogressbar.xml", "weightprogressbar_fill.xml", // TRANSLATORS: status bar name "weight bar", _("weight bar"))), mInvSlotsBar(createBar(0, 45, 0, - ThemeColorId::SLOTS_BAR, Theme::PROG_INVY_SLOTS, + ThemeColorId::SLOTS_BAR, ProgressColorId::PROG_INVY_SLOTS, "slotsprogressbar.xml", "slotsprogressbar_fill.xml", "inventory slots bar", // TRANSLATORS: status bar name _("inventory slots bar"))), - mMoneyBar(createBar(0, 130, 0, ThemeColorId::MONEY_BAR, Theme::PROG_MONEY, + mMoneyBar(createBar(0, 130, 0, ThemeColorId::MONEY_BAR, ProgressColorId::PROG_MONEY, "moneyprogressbar.xml", "moneyprogressbar_fill.xml", // TRANSLATORS: status bar name "money bar", _("money bar"))), - mArrowsBar(createBar(0, 50, 0, ThemeColorId::ARROWS_BAR, Theme::PROG_ARROWS, + mArrowsBar(createBar(0, 50, 0, ThemeColorId::ARROWS_BAR, ProgressColorId::PROG_ARROWS, "arrowsprogressbar.xml", "arrowsprogressbar_fill.xml", // TRANSLATORS: status bar name "arrows bar", _("arrows bar"))), mStatusBar(createBar(100, (config.getIntValue("fontSize") > 16 - ? 250 : 165), 0, ThemeColorId::STATUS_BAR, Theme::PROG_STATUS, + ? 250 : 165), 0, ThemeColorId::STATUS_BAR, ProgressColorId::PROG_STATUS, "statusprogressbar.xml", "statusprogressbar_fill.xml", // TRANSLATORS: status bar name "status bar", _("status bar"))), @@ -128,7 +130,7 @@ MiniStatusWindow::MiniStatusWindow() : if (job) { - mJobBar = createBar(0, 100, 0, ThemeColorId::JOB_BAR, Theme::PROG_JOB, + mJobBar = createBar(0, 100, 0, ThemeColorId::JOB_BAR, ProgressColorId::PROG_JOB, // TRANSLATORS: status bar name "jobprogressbar.xml", "jobprogressbar_fill.xml", "job bar", _("job bar")); diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 5e5dcff33..39dfaa7e2 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -28,12 +28,14 @@ #include "settings.h" #include "units.h" -#include "gui/windows/chatwindow.h" +#include "enums/being/attributes.h" + +#include "enums/gui/progresscolorid.h" #include "being/localplayer.h" #include "being/playerinfo.h" -#include "enums/being/attributes.h" +#include "gui/windows/chatwindow.h" #include "gui/windows/equipmentwindow.h" #include "gui/windows/setupwindow.h" @@ -111,7 +113,7 @@ StatusWindow::StatusWindow() : max = 1; mHpBar = new ProgressBar(this, static_cast<float>(PlayerInfo::getAttribute( - Attributes::HP)) / static_cast<float>(max), 80, 0, Theme::PROG_HP, + Attributes::HP)) / static_cast<float>(max), 80, 0, ProgressColorId::PROG_HP, "hpprogressbar.xml", "hpprogressbar_fill.xml"); mHpBar->setColor(getThemeColor(ThemeColorId::HP_BAR), getThemeColor(ThemeColorId::HP_BAR_OUTLINE)); @@ -120,7 +122,7 @@ StatusWindow::StatusWindow() : mXpBar = new ProgressBar(this, max ? static_cast<float>(PlayerInfo::getAttribute(Attributes::EXP)) / static_cast<float>(max) : static_cast<float>(0), 80, 0, - Theme::PROG_EXP, "xpprogressbar.xml", "xpprogressbar_fill.xml"); + ProgressColorId::PROG_EXP, "xpprogressbar.xml", "xpprogressbar_fill.xml"); mXpBar->setColor(getThemeColor(ThemeColorId::XP_BAR), getThemeColor(ThemeColorId::XP_BAR_OUTLINE)); @@ -136,7 +138,7 @@ StatusWindow::StatusWindow() : mMpBar = new ProgressBar(this, max ? static_cast<float>( PlayerInfo::getAttribute(Attributes::MAX_MP)) / static_cast<float>(max) : static_cast<float>(0), - 80, 0, useMagic ? Theme::PROG_MP : Theme::PROG_NO_MP, + 80, 0, useMagic ? ProgressColorId::PROG_MP : ProgressColorId::PROG_NO_MP, useMagic ? "mpprogressbar.xml" : "nompprogressbar.xml", useMagic ? "mpprogressbar_fill.xml" : "nompprogressbar_fill.xml"); if (useMagic) @@ -177,7 +179,7 @@ StatusWindow::StatusWindow() : mJobLvlLabel = new Label(this, strprintf(_("Job: %d"), 0)); // TRANSLATORS: status window label mJobLabel = new Label(this, _("Job:")); - mJobBar = new ProgressBar(this, 0.0F, 80, 0, Theme::PROG_JOB, + mJobBar = new ProgressBar(this, 0.0F, 80, 0, ProgressColorId::PROG_JOB, "jobprogressbar.xml", "jobprogressbar_fill.xml"); mJobBar->setColor(getThemeColor(ThemeColorId::JOB_BAR), getThemeColor(ThemeColorId::JOB_BAR_OUTLINE)); @@ -468,13 +470,13 @@ void StatusWindow::updateMPBar(ProgressBar *const bar, { bar->setColor(getThemeColor(ThemeColorId::MP_BAR), getThemeColor(ThemeColorId::MP_BAR_OUTLINE)); - bar->setProgressPalette(Theme::PROG_MP); + bar->setProgressPalette(ProgressColorId::PROG_MP); } else { bar->setColor(getThemeColor(ThemeColorId::NO_MP_BAR), getThemeColor(ThemeColorId::NO_MP_BAR_OUTLINE)); - bar->setProgressPalette(Theme::PROG_NO_MP); + bar->setProgressPalette(ProgressColorId::PROG_NO_MP); } bar->setProgress(prog); diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 48a3b4ebe..4f8b4dc48 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -26,6 +26,8 @@ #include "configuration.h" #include "settings.h" +#include "enums/gui/progresscolorid.h" + #include "enums/net/updatetype.h" #include "input/inputaction.h" @@ -190,7 +192,7 @@ UpdaterWindow::UpdaterWindow(const std::string &restrict updateHost, mCancelButton(new Button(this, _("Cancel"), "cancel", this)), // TRANSLATORS: updater window button mPlayButton(new Button(this, _("Play"), "play", this)), - mProgressBar(new ProgressBar(this, 0.0, 310, 0, Theme::PROG_UPDATE, + mProgressBar(new ProgressBar(this, 0.0, 310, 0, ProgressColorId::PROG_UPDATE, "updateprogressbar.xml", "updateprogressbar_fill.xml")), mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, true, "browserbox.xml")), |