diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-30 16:28:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-30 16:29:31 +0300 |
commit | 2b8e0b02338400b215b73cec900ffa1fddbac60a (patch) | |
tree | 0920d2980bf60aeeb5b9a44140f4537353ced0d9 /src/gui | |
parent | dc8422dbac2c45a082153240138d699c1bfc3b88 (diff) | |
download | manaverse-2b8e0b02338400b215b73cec900ffa1fddbac60a.tar.gz manaverse-2b8e0b02338400b215b73cec900ffa1fddbac60a.tar.bz2 manaverse-2b8e0b02338400b215b73cec900ffa1fddbac60a.tar.xz manaverse-2b8e0b02338400b215b73cec900ffa1fddbac60a.zip |
Move user defined colors enum into separate file.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/userpalette.cpp | 106 | ||||
-rw-r--r-- | src/gui/userpalette.h | 50 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_colors.cpp | 84 | ||||
-rw-r--r-- | src/gui/windows/minimap.cpp | 24 |
5 files changed, 111 insertions, 157 deletions
diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp index 38cf4cfe1..d0e6c2c9a 100644 --- a/src/gui/userpalette.cpp +++ b/src/gui/userpalette.cpp @@ -23,6 +23,8 @@ #include "gui/userpalette.h" +#include "enums/gui/usercolorid.h" + #include "configuration.h" #include "utils/gettext.h" @@ -103,126 +105,126 @@ std::string UserPalette::getConfigName(const std::string &typeName) } UserPalette::UserPalette() : - Palette(USER_COLOR_LAST) + Palette(UserColorId::USER_COLOR_LAST) { - mColors[BEING] = ColorElem(); - mColors[PC] = ColorElem(); - mColors[SELF] = ColorElem(); - mColors[GM] = ColorElem(); - mColors[NPC] = ColorElem(); - mColors[MONSTER] = ColorElem(); + mColors[UserColorId::BEING] = ColorElem(); + mColors[UserColorId::PC] = ColorElem(); + mColors[UserColorId::SELF] = ColorElem(); + mColors[UserColorId::GM] = ColorElem(); + mColors[UserColorId::NPC] = ColorElem(); + mColors[UserColorId::MONSTER] = ColorElem(); // TRANSLATORS: palette color - addColor(BEING, 0xffffff, GradientType::STATIC, _("Being")); + addColor(UserColorId::BEING, 0xffffff, GradientType::STATIC, _("Being")); // TRANSLATORS: palette color - addColor(FRIEND, 0xb0ffb0, GradientType::STATIC, _("Friend names")); + addColor(UserColorId::FRIEND, 0xb0ffb0, GradientType::STATIC, _("Friend names")); // TRANSLATORS: palette color - addColor(DISREGARDED, 0xa00000, GradientType::STATIC, _("Disregarded names")); + addColor(UserColorId::DISREGARDED, 0xa00000, GradientType::STATIC, _("Disregarded names")); // TRANSLATORS: palette color - addColor(IGNORED, 0xff0000, GradientType::STATIC, _("Ignored names")); + addColor(UserColorId::IGNORED, 0xff0000, GradientType::STATIC, _("Ignored names")); // TRANSLATORS: palette color - addColor(ERASED, 0xff0000, GradientType::STATIC, _("Erased names")); + addColor(UserColorId::ERASED, 0xff0000, GradientType::STATIC, _("Erased names")); // TRANSLATORS: palette color - addColor(PC, 0xffffff, GradientType::STATIC, _("Other players names")); + addColor(UserColorId::PC, 0xffffff, GradientType::STATIC, _("Other players names")); // TRANSLATORS: palette color - addColor(SELF, 0xff8040, GradientType::STATIC, _("Own name")); + addColor(UserColorId::SELF, 0xff8040, GradientType::STATIC, _("Own name")); // TRANSLATORS: palette color - addColor(GM, 0x00ff00, GradientType::STATIC, _("GM names")); + addColor(UserColorId::GM, 0x00ff00, GradientType::STATIC, _("GM names")); // TRANSLATORS: palette color - addColor(NPC, 0xc8c8ff, GradientType::STATIC, _("NPCs")); + addColor(UserColorId::NPC, 0xc8c8ff, GradientType::STATIC, _("NPCs")); // TRANSLATORS: palette color - addColor(MONSTER, 0xff4040, GradientType::STATIC, _("Monsters")); + addColor(UserColorId::MONSTER, 0xff4040, GradientType::STATIC, _("Monsters")); // TRANSLATORS: palette color - addColor(MONSTER_HP, 0x00ff00, GradientType::STATIC, _("Monster HP bar"), 50); - addColor(MONSTER_HP2, 0xff0000, GradientType::STATIC, + addColor(UserColorId::MONSTER_HP, 0x00ff00, GradientType::STATIC, _("Monster HP bar"), 50); + addColor(UserColorId::MONSTER_HP2, 0xff0000, GradientType::STATIC, // TRANSLATORS: palette color _("Monster HP bar (second color)"), 50); // TRANSLATORS: palette color - addColor(PARTY, 0xff00d8, GradientType::STATIC, _("Party members")); + addColor(UserColorId::PARTY, 0xff00d8, GradientType::STATIC, _("Party members")); // TRANSLATORS: palette color - addColor(GUILD, 0xff00d8, GradientType::STATIC, _("Guild members")); + addColor(UserColorId::GUILD, 0xff00d8, GradientType::STATIC, _("Guild members")); // TRANSLATORS: palette color - addColor(PARTICLE, 0xffffff, GradientType::STATIC, _("Particle effects")); + addColor(UserColorId::PARTICLE, 0xffffff, GradientType::STATIC, _("Particle effects")); // TRANSLATORS: palette color - addColor(PICKUP_INFO, 0x28dc28, GradientType::STATIC, _("Pickup notification")); + addColor(UserColorId::PICKUP_INFO, 0x28dc28, GradientType::STATIC, _("Pickup notification")); // TRANSLATORS: palette color - addColor(EXP_INFO, 0xffff00, GradientType::STATIC, _("Exp notification")); + addColor(UserColorId::EXP_INFO, 0xffff00, GradientType::STATIC, _("Exp notification")); // TRANSLATORS: palette color - addColor(PLAYER_HP, 0x00ff00, GradientType::STATIC, _("Player HP bar"), 50); + addColor(UserColorId::PLAYER_HP, 0x00ff00, GradientType::STATIC, _("Player HP bar"), 50); // TRANSLATORS: palette color - addColor(PLAYER_HP2, 0xff0000, GradientType::STATIC, + addColor(UserColorId::PLAYER_HP2, 0xff0000, GradientType::STATIC, // TRANSLATORS: palette color _("Player HP bar (second color)"), 50); // TRANSLATORS: palette color - addColor(HIT_PLAYER_MONSTER, 0x0064ff, GradientType::STATIC, _("Player hits monster")); + addColor(UserColorId::HIT_PLAYER_MONSTER, 0x0064ff, GradientType::STATIC, _("Player hits monster")); // TRANSLATORS: palette color - addColor(HIT_MONSTER_PLAYER, 0xff3232, GradientType::STATIC, _("Monster hits player")); + addColor(UserColorId::HIT_MONSTER_PLAYER, 0xff3232, GradientType::STATIC, _("Monster hits player")); // TRANSLATORS: palette color - addColor(HIT_PLAYER_PLAYER, 0xff5050, GradientType::STATIC, + addColor(UserColorId::HIT_PLAYER_PLAYER, 0xff5050, GradientType::STATIC, // TRANSLATORS: palette color _("Other player hits local player")); // TRANSLATORS: palette color - addColor(HIT_CRITICAL, 0xff0000, GradientType::RAINBOW, _("Critical Hit")); + addColor(UserColorId::HIT_CRITICAL, 0xff0000, GradientType::RAINBOW, _("Critical Hit")); // TRANSLATORS: palette color - addColor(HIT_LOCAL_PLAYER_MONSTER, 0x00ff00, GradientType::STATIC, + addColor(UserColorId::HIT_LOCAL_PLAYER_MONSTER, 0x00ff00, GradientType::STATIC, // TRANSLATORS: palette color _("Local player hits monster")); - addColor(HIT_LOCAL_PLAYER_CRITICAL, 0xff0000, GradientType::RAINBOW, + addColor(UserColorId::HIT_LOCAL_PLAYER_CRITICAL, 0xff0000, GradientType::RAINBOW, // TRANSLATORS: palette color _("Local player critical hit")); - addColor(HIT_LOCAL_PLAYER_MISS, 0x00ffa6, GradientType::STATIC, + addColor(UserColorId::HIT_LOCAL_PLAYER_MISS, 0x00ffa6, GradientType::STATIC, // TRANSLATORS: palette color _("Local player miss")); // TRANSLATORS: palette color - addColor(MISS, 0xffff00, GradientType::STATIC, _("Misses")); + addColor(UserColorId::MISS, 0xffff00, GradientType::STATIC, _("Misses")); // TRANSLATORS: palette color - addColor(PORTAL_HIGHLIGHT, 0xC80000, GradientType::STATIC, _("Portal highlight")); - addColor(COLLISION_HIGHLIGHT, 0x0000C8, GradientType::STATIC, + addColor(UserColorId::PORTAL_HIGHLIGHT, 0xC80000, GradientType::STATIC, _("Portal highlight")); + addColor(UserColorId::COLLISION_HIGHLIGHT, 0x0000C8, GradientType::STATIC, // TRANSLATORS: palette color _("Default collision highlight"), 64); - addColor(AIR_COLLISION_HIGHLIGHT, 0xe0e0ff, GradientType::STATIC, + addColor(UserColorId::AIR_COLLISION_HIGHLIGHT, 0xe0e0ff, GradientType::STATIC, // TRANSLATORS: palette color _("Air collision highlight"), 64); - addColor(WATER_COLLISION_HIGHLIGHT, 0x2050e0, GradientType::STATIC, + addColor(UserColorId::WATER_COLLISION_HIGHLIGHT, 0x2050e0, GradientType::STATIC, // TRANSLATORS: palette color _("Water collision highlight"), 64); - addColor(GROUNDTOP_COLLISION_HIGHLIGHT, 0xffff00, GradientType::STATIC, + addColor(UserColorId::GROUNDTOP_COLLISION_HIGHLIGHT, 0xffff00, GradientType::STATIC, // TRANSLATORS: palette color _("Special ground collision highlight"), 20); - addColor(WALKABLE_HIGHLIGHT, 0x00D000, GradientType::STATIC, + addColor(UserColorId::WALKABLE_HIGHLIGHT, 0x00D000, GradientType::STATIC, // TRANSLATORS: palette color _("Walkable highlight"), 255); - addColor(ATTACK_RANGE, 0xffffff, GradientType::STATIC, + addColor(UserColorId::ATTACK_RANGE, 0xffffff, GradientType::STATIC, // TRANSLATORS: palette color _("Local player attack range"), 5); - addColor(ATTACK_RANGE_BORDER, 0x0, GradientType::STATIC, + addColor(UserColorId::ATTACK_RANGE_BORDER, 0x0, GradientType::STATIC, // TRANSLATORS: palette color _("Local player attack range border"), 76); - addColor(MONSTER_ATTACK_RANGE, 0xff0000, GradientType::STATIC, + addColor(UserColorId::MONSTER_ATTACK_RANGE, 0xff0000, GradientType::STATIC, // TRANSLATORS: palette color _("Monster attack range"), 20); - addColor(FLOOR_ITEM_TEXT, 0xffffff, GradientType::STATIC, + addColor(UserColorId::FLOOR_ITEM_TEXT, 0xffffff, GradientType::STATIC, // TRANSLATORS: palette color _("Floor item amount color"), 100); - addColor(HOME_PLACE, 0xffffff, GradientType::STATIC, + addColor(UserColorId::HOME_PLACE, 0xffffff, GradientType::STATIC, // TRANSLATORS: palette color _("Home place"), 20); - addColor(HOME_PLACE_BORDER, 0xffff00, GradientType::STATIC, + addColor(UserColorId::HOME_PLACE_BORDER, 0xffff00, GradientType::STATIC, // TRANSLATORS: palette color _("Home place border"), 200); - addColor(ROAD_POINT, 0x000000, GradientType::STATIC, + addColor(UserColorId::ROAD_POINT, 0x000000, GradientType::STATIC, // TRANSLATORS: palette color _("Road point"), 100); - addColor(NET, 0x000000, GradientType::STATIC, + addColor(UserColorId::NET, 0x000000, GradientType::STATIC, // TRANSLATORS: palette color _("Tiles border"), 64); // TRANSLATORS: palette color - addColor(PET, 0xffffff, GradientType::STATIC, _("Pets")); + addColor(UserColorId::PET, 0xffffff, GradientType::STATIC, _("Pets")); // TRANSLATORS: palette color - addColor(MERCENARY, 0xffffff, GradientType::STATIC, _("Mercenary")); + addColor(UserColorId::MERCENARY, 0xffffff, GradientType::STATIC, _("Mercenary")); // TRANSLATORS: palette color - addColor(HOMUNCULUS, 0xffffff, GradientType::STATIC, _("Homunculus")); + addColor(UserColorId::HOMUNCULUS, 0xffffff, GradientType::STATIC, _("Homunculus")); commit(true); } @@ -329,7 +331,7 @@ void UserPalette::rollback() int UserPalette::getColorTypeAt(const int i) { if (i < 0 || i >= getNumberOfElements()) - return BEING; + return UserColorId::BEING; return mColors[i].type; } diff --git a/src/gui/userpalette.h b/src/gui/userpalette.h index 61f4a1799..3b3bd9d67 100644 --- a/src/gui/userpalette.h +++ b/src/gui/userpalette.h @@ -34,56 +34,6 @@ class UserPalette final : public Palette, public ListModel { public: - /** List of all colors that are configurable. */ - enum - { - BEING = 0, - FRIEND, - DISREGARDED, - IGNORED, - ERASED, - PC, - SELF, - GM, - NPC, - MONSTER, - MONSTER_HP, - MONSTER_HP2, - PARTY, - GUILD, - PARTICLE, - PICKUP_INFO, - EXP_INFO, - PLAYER_HP, - PLAYER_HP2, - HIT_PLAYER_MONSTER, - HIT_MONSTER_PLAYER, - HIT_PLAYER_PLAYER, - HIT_CRITICAL, - HIT_LOCAL_PLAYER_MONSTER, - HIT_LOCAL_PLAYER_CRITICAL, - HIT_LOCAL_PLAYER_MISS, - MISS, - PORTAL_HIGHLIGHT, - COLLISION_HIGHLIGHT, - AIR_COLLISION_HIGHLIGHT, - WATER_COLLISION_HIGHLIGHT, - GROUNDTOP_COLLISION_HIGHLIGHT, - WALKABLE_HIGHLIGHT, - ATTACK_RANGE, - ATTACK_RANGE_BORDER, - MONSTER_ATTACK_RANGE, - FLOOR_ITEM_TEXT, - HOME_PLACE, - HOME_PLACE_BORDER, - ROAD_POINT, - NET, - PET, - MERCENARY, - HOMUNCULUS, - USER_COLOR_LAST - }; - /** * Constructor */ diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 5a91f24b9..78b66b930 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -330,7 +330,7 @@ void Viewport::drawDebugPath(Graphics *const graphics) lastMouseDestination = mouseDestination; } drawPath(graphics, debugPath, userPalette->getColorWithAlpha( - UserPalette::ROAD_POINT)); + UserColorId::ROAD_POINT)); const ActorSprites &actors = actorManager->getAll(); FOR_EACH (ActorSpritesConstIterator, it, actors) @@ -340,7 +340,7 @@ void Viewport::drawDebugPath(Graphics *const graphics) { const Path &beingPath = being->getPath(); drawPath(graphics, beingPath, userPalette->getColorWithAlpha( - UserPalette::ROAD_POINT)); + UserColorId::ROAD_POINT)); } } } diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp index b511a1446..ce567bfa7 100644 --- a/src/gui/widgets/tabs/setup_colors.cpp +++ b/src/gui/widgets/tabs/setup_colors.cpp @@ -21,6 +21,8 @@ #include "gui/widgets/tabs/setup_colors.h" +#include "enums/gui/usercolorid.h" + #include "gui/gui.h" #include "gui/userpalette.h" @@ -265,40 +267,40 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED) switch (type) { - case UserPalette::AIR_COLLISION_HIGHLIGHT: - case UserPalette::WATER_COLLISION_HIGHLIGHT: - case UserPalette::GROUNDTOP_COLLISION_HIGHLIGHT: - case UserPalette::COLLISION_HIGHLIGHT: - case UserPalette::PORTAL_HIGHLIGHT: - case UserPalette::HOME_PLACE: - case UserPalette::ROAD_POINT: - case UserPalette::NET: + case UserColorId::AIR_COLLISION_HIGHLIGHT: + case UserColorId::WATER_COLLISION_HIGHLIGHT: + case UserColorId::GROUNDTOP_COLLISION_HIGHLIGHT: + case UserColorId::COLLISION_HIGHLIGHT: + case UserColorId::PORTAL_HIGHLIGHT: + case UserColorId::HOME_PLACE: + case UserColorId::ROAD_POINT: + case UserColorId::NET: mTextPreview->setBGColor(col); mTextPreview->setOpaque(true); mTextPreview->setOutline(false); mTextPreview->setShadow(false); break; - case UserPalette::ATTACK_RANGE_BORDER: - case UserPalette::HOME_PLACE_BORDER: + case UserColorId::ATTACK_RANGE_BORDER: + case UserColorId::HOME_PLACE_BORDER: if (gui) mTextPreview->setFont(gui->getFont()); mTextPreview->setTextColor(col); mTextPreview->setOutline(false); mTextPreview->setShadow(false); break; - case UserPalette::PARTICLE: - case UserPalette::EXP_INFO: - case UserPalette::PICKUP_INFO: - case UserPalette::HIT_PLAYER_MONSTER: - case UserPalette::HIT_MONSTER_PLAYER: - case UserPalette::HIT_CRITICAL: - case UserPalette::MISS: - case UserPalette::HIT_LOCAL_PLAYER_MONSTER: - case UserPalette::HIT_LOCAL_PLAYER_CRITICAL: - case UserPalette::HIT_LOCAL_PLAYER_MISS: - case UserPalette::ATTACK_RANGE: - case UserPalette::MONSTER_ATTACK_RANGE: - case UserPalette::FLOOR_ITEM_TEXT: + case UserColorId::PARTICLE: + case UserColorId::EXP_INFO: + case UserColorId::PICKUP_INFO: + case UserColorId::HIT_PLAYER_MONSTER: + case UserColorId::HIT_MONSTER_PLAYER: + case UserColorId::HIT_CRITICAL: + case UserColorId::MISS: + case UserColorId::HIT_LOCAL_PLAYER_MONSTER: + case UserColorId::HIT_LOCAL_PLAYER_CRITICAL: + case UserColorId::HIT_LOCAL_PLAYER_MISS: + case UserColorId::ATTACK_RANGE: + case UserColorId::MONSTER_ATTACK_RANGE: + case UserColorId::FLOOR_ITEM_TEXT: mTextPreview->setShadow(false); break; default: @@ -307,24 +309,24 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED) switch (type) { - case UserPalette::PORTAL_HIGHLIGHT: - case UserPalette::ATTACK_RANGE: - case UserPalette::ATTACK_RANGE_BORDER: - case UserPalette::MONSTER_ATTACK_RANGE: - case UserPalette::HOME_PLACE: - case UserPalette::HOME_PLACE_BORDER: - case UserPalette::AIR_COLLISION_HIGHLIGHT: - case UserPalette::WATER_COLLISION_HIGHLIGHT: - case UserPalette::GROUNDTOP_COLLISION_HIGHLIGHT: - case UserPalette::COLLISION_HIGHLIGHT: - case UserPalette::WALKABLE_HIGHLIGHT: - case UserPalette::ROAD_POINT: - case UserPalette::MONSTER_HP: - case UserPalette::MONSTER_HP2: - case UserPalette::PLAYER_HP: - case UserPalette::PLAYER_HP2: - case UserPalette::FLOOR_ITEM_TEXT: - case UserPalette::NET: + case UserColorId::PORTAL_HIGHLIGHT: + case UserColorId::ATTACK_RANGE: + case UserColorId::ATTACK_RANGE_BORDER: + case UserColorId::MONSTER_ATTACK_RANGE: + case UserColorId::HOME_PLACE: + case UserColorId::HOME_PLACE_BORDER: + case UserColorId::AIR_COLLISION_HIGHLIGHT: + case UserColorId::WATER_COLLISION_HIGHLIGHT: + case UserColorId::GROUNDTOP_COLLISION_HIGHLIGHT: + case UserColorId::COLLISION_HIGHLIGHT: + case UserColorId::WALKABLE_HIGHLIGHT: + case UserColorId::ROAD_POINT: + case UserColorId::MONSTER_HP: + case UserColorId::MONSTER_HP2: + case UserColorId::PLAYER_HP: + case UserColorId::PLAYER_HP2: + case UserColorId::FLOOR_ITEM_TEXT: + case UserColorId::NET: // TRANSLATORS: colors tab. label. mGradDelayLabel->setCaption(_("Alpha:")); mGradDelayText->setRange(0, 255); diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index 279b3e840..2f73d50e6 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -312,51 +312,51 @@ void Minimap::draw2(Graphics *const graphics) continue; int dotSize = 2; - int type = UserPalette::PC; + int type = UserColorId::PC; if (being == localPlayer) { - type = UserPalette::SELF; + type = UserColorId::SELF; dotSize = 3; } else if (being->isGM()) { - type = UserPalette::GM; + type = UserColorId::GM; } else if (being->getGuild() == localPlayer->getGuild() || being->getGuildName() == localPlayer->getGuildName()) { - type = UserPalette::GUILD; + type = UserColorId::GUILD; } else { switch (being->getType()) { case ActorType::Monster: - type = UserPalette::MONSTER; + type = UserColorId::MONSTER; break; case ActorType::Npc: - type = UserPalette::NPC; + type = UserColorId::NPC; break; case ActorType::Portal: - type = UserPalette::PORTAL_HIGHLIGHT; + type = UserColorId::PORTAL_HIGHLIGHT; break; case ActorType::LocalPet: #ifdef EATHENA_SUPPORT case ActorType::Pet: #endif - type = UserPalette::PET; + type = UserColorId::PET; break; #ifdef EATHENA_SUPPORT case ActorType::Mercenary: - type = UserPalette::MERCENARY; + type = UserColorId::MERCENARY; break; case ActorType::Homunculus: - type = UserPalette::HOMUNCULUS; + type = UserColorId::HOMUNCULUS; break; #endif case ActorType::Avatar: @@ -407,7 +407,7 @@ void Minimap::draw2(Graphics *const graphics) if (userPalette) { graphics->setColor(userPalette->getColor( - UserPalette::PARTY)); + UserColorId::PARTY)); } const int offsetHeight = static_cast<int>( @@ -459,7 +459,7 @@ void Minimap::draw2(Graphics *const graphics) y = a.height - h; } - graphics->setColor(userPalette->getColor(UserPalette::PC)); + graphics->setColor(userPalette->getColor(UserColorId::PC)); graphics->drawRectangle(Rect(x, y, w, h)); graphics->popClipArea(); BLOCK_END("Minimap::draw") |