summaryrefslogtreecommitdiff
path: root/src/gui/userpalette.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/userpalette.cpp')
-rw-r--r--src/gui/userpalette.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp
index 7fe8074b0..c4ce7fae2 100644
--- a/src/gui/userpalette.cpp
+++ b/src/gui/userpalette.cpp
@@ -33,6 +33,7 @@ UserPalette *userPalette = nullptr;
const std::string ColorTypeNames[] =
{
+ "",
"ColorBeing",
"ColorFriend",
"ColorDisregarded",
@@ -113,6 +114,9 @@ UserPalette::UserPalette() :
mColors[static_cast<size_t>(UserColorId::NPC)] = ColorElem();
mColors[static_cast<size_t>(UserColorId::MONSTER)] = ColorElem();
+ addLabel(UserColorId::LABEL_BEING,
+ // TRANSLATORS: palette label
+ _("Being colors"));
addColor(UserColorId::BEING,
0xffffff,
GradientType::STATIC,
@@ -358,6 +362,8 @@ UserPalette::~UserPalette()
{
FOR_EACH (Colors::const_iterator, col, mColors)
{
+ if (col->grad == GradientType::LABEL)
+ continue;
const std::string &configName = ColorTypeNames[col->type];
config.setValue(configName + "Gradient",
static_cast<int>(col->committedGrad));
@@ -503,6 +509,24 @@ void UserPalette::addColor(const UserColorIdT type,
mGradVector.push_back(&mColors[static_cast<size_t>(type)]);
}
+void UserPalette::addLabel(const UserColorIdT type,
+ const std::string &text)
+{
+ const unsigned maxType = sizeof(ColorTypeNames)
+ / sizeof(ColorTypeNames[0]);
+
+ if (static_cast<unsigned>(type) >= maxType)
+ return;
+
+
+ mColors[static_cast<size_t>(type)] = ColorElem();
+ const std::string str(" \342\200\225\342\200\225\342\200\225"
+ "\342\200\225\342\200\225 ");
+ mColors[static_cast<size_t>(type)].grad = GradientTypeT::LABEL;
+ mColors[static_cast<size_t>(type)].text =
+ std::string(str).append(text).append(str);
+}
+
int UserPalette::getIdByChar(const signed char c, bool &valid) const
{
const CharColors::const_iterator it = mCharColors.find(c);