summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/enums/gui/gradienttype.h3
-rw-r--r--src/enums/gui/usercolorid.h3
-rw-r--r--src/gui/userpalette.cpp24
-rw-r--r--src/gui/userpalette.h3
-rw-r--r--src/gui/widgets/tabs/setup_colors.cpp19
5 files changed, 50 insertions, 2 deletions
diff --git a/src/enums/gui/gradienttype.h b/src/enums/gui/gradienttype.h
index fb1042aa5..36ae7e703 100644
--- a/src/enums/gui/gradienttype.h
+++ b/src/enums/gui/gradienttype.h
@@ -31,7 +31,8 @@ enumStart(GradientType)
STATIC = 0,
PULSE,
SPECTRUM,
- RAINBOW
+ RAINBOW,
+ LABEL
}
enumEnd(GradientType);
diff --git a/src/enums/gui/usercolorid.h b/src/enums/gui/usercolorid.h
index 675bec7fa..6bd8116f3 100644
--- a/src/enums/gui/usercolorid.h
+++ b/src/enums/gui/usercolorid.h
@@ -29,7 +29,8 @@
enumStart(UserColorId)
{
NO_COLOR = -1,
- BEING = 0,
+ LABEL_BEING = 0,
+ BEING,
FRIEND,
DISREGARDED,
IGNORED,
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);
diff --git a/src/gui/userpalette.h b/src/gui/userpalette.h
index e5e9465f9..1cfc28cde 100644
--- a/src/gui/userpalette.h
+++ b/src/gui/userpalette.h
@@ -250,6 +250,9 @@ class UserPalette final : public Palette, public ListModel
GradientTypeT grad,
const std::string &text,
int delay = GRADIENT_DELAY);
+
+ void addLabel(const UserColorIdT type,
+ const std::string &text);
};
extern UserPalette *userPalette;
diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp
index 6581959b6..2ae5db874 100644
--- a/src/gui/widgets/tabs/setup_colors.cpp
+++ b/src/gui/widgets/tabs/setup_colors.cpp
@@ -252,6 +252,25 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED)
const Color *col = &userPalette->getColor(type);
const GradientTypeT grad = userPalette->getGradientType(type);
const int delay = userPalette->getGradientDelay(type);
+ const Visible showControls = fromBool(grad != GradientType::LABEL, Visible);
+ mPreview->setVisible(showControls);
+ mPreviewBox->setVisible(showControls);
+ mTextPreview->setVisible(showControls);
+ mGradTypeLabel->setVisible(showControls);
+ mGradTypeSlider->setVisible(showControls);
+ mGradTypeText->setVisible(showControls);
+ mGradDelayLabel->setVisible(showControls);
+ mGradDelaySlider->setVisible(showControls);
+ mGradDelayText->setVisible(showControls);
+ mRedLabel->setVisible(showControls);
+ mRedSlider->setVisible(showControls);
+ mRedText->setVisible(showControls);
+ mGreenLabel->setVisible(showControls);
+ mGreenSlider->setVisible(showControls);
+ mGreenText->setVisible(showControls);
+ mBlueLabel->setVisible(showControls);
+ mBlueSlider->setVisible(showControls);
+ mBlueText->setVisible(showControls);
mPreview->clearRows();
mPreviewBox->setContent(mTextPreview);