summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-05-04 16:17:21 +0300
committerAndrei Karas <akaras@inbox.ru>2013-05-04 16:17:21 +0300
commit7dec8e169a09513e9bd7f840fea52491b6d17828 (patch)
treefbc6d4f886fa85c312e361ad243ddcc1e00e6bec /src
parentfee1c7eb49c61afdab1ddb64bc2dfa7a22d6cf35 (diff)
downloadmv-7dec8e169a09513e9bd7f840fea52491b6d17828.tar.gz
mv-7dec8e169a09513e9bd7f840fea52491b6d17828.tar.bz2
mv-7dec8e169a09513e9bd7f840fea52491b6d17828.tar.xz
mv-7dec8e169a09513e9bd7f840fea52491b6d17828.zip
add outline color TEXT color.
Diffstat (limited to 'src')
-rw-r--r--src/gui/skilldialog.cpp3
-rw-r--r--src/gui/theme.cpp1
-rw-r--r--src/gui/theme.h1
-rw-r--r--src/gui/widgets/avatarlistbox.cpp3
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp9
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.h3
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp5
-rw-r--r--src/gui/widgets/itemshortcutcontainer.h1
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp7
-rw-r--r--src/gui/widgets/spellshortcutcontainer.h5
-rw-r--r--src/gui/widgets/textpreview.cpp28
-rw-r--r--src/gui/widgets/textpreview.h9
12 files changed, 49 insertions, 26 deletions
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index 093db57bc..d5487fa66 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -106,6 +106,7 @@ class SkillListBox final : public ListBox
mPopup(new TextPopup),
mHighlightColor(getThemeColor(Theme::HIGHLIGHT)),
mTextColor(getThemeColor(Theme::TEXT)),
+ mTextColor2(getThemeColor(Theme::TEXT_OUTLINE)),
mTextPadding(mSkin ? mSkin->getOption("textPadding", 34) : 34),
mSpacing(mSkin ? mSkin->getOption("spacing", 0) : 0),
mRowHeight(getFont()->getHeight() * 2 + mSpacing + 2 * mPadding)
@@ -159,6 +160,7 @@ class SkillListBox final : public ListBox
// Draw the list elements
graphics->setColor(mTextColor);
+ graphics->setColor2(mTextColor2);
gcn::Font *const font = getFont();
const int space = font->getHeight() + mSpacing;
const int width2 = getWidth() - mPadding;
@@ -222,6 +224,7 @@ class SkillListBox final : public ListBox
TextPopup *mPopup;
gcn::Color mHighlightColor;
gcn::Color mTextColor;
+ gcn::Color mTextColor2;
int mTextPadding;
int mSpacing;
int mRowHeight;
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 1f31b1089..76b5e5c7b 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -774,6 +774,7 @@ static int readColorType(const std::string &type)
"SELFNICK",
"SELFNICK_OUTLINE",
"TEXT",
+ "TEXT_OUTLINE",
"CARET",
"SHADOW",
"OUTLINE",
diff --git a/src/gui/theme.h b/src/gui/theme.h
index 2cb6fec22..87e5dbef2 100644
--- a/src/gui/theme.h
+++ b/src/gui/theme.h
@@ -214,6 +214,7 @@ class Theme final : public Palette, public ConfigListener
SELFNICK,
SELFNICK_OUTLINE,
TEXT,
+ TEXT_OUTLINE,
CARET,
SHADOW,
OUTLINE,
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index fe46feba2..3202a1e21 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -64,6 +64,7 @@ AvatarListBox::AvatarListBox(const Widget2 *const widget,
config.addListener("showlevel", this);
mForegroundColor = getThemeColor(Theme::TEXT);
+ mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE);
}
AvatarListBox::~AvatarListBox()
@@ -110,6 +111,7 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics)
// Draw the list elements
graphics->setColor(mForegroundColor);
+ graphics->setColor2(mForegroundColor2);
for (int i = 0, y = 0;
i < model->getNumberOfElements();
++i, y += fontHeight)
@@ -259,6 +261,7 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics)
}
graphics->setColor(mForegroundColor);
+ graphics->setColor2(mForegroundColor2);
// Draw Name
if (a->getDisplayBold())
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index 9366a9e36..9629384a4 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -48,9 +48,9 @@ static const int MAX_ITEMS = 48;
EmoteShortcutContainer::EmoteShortcutContainer():
ShortcutContainer(),
mEmoteImg(),
+ mEmotePopup(new TextPopup),
mEmoteClicked(false),
- mEmoteMoved(0),
- mEmotePopup(new TextPopup)
+ mEmoteMoved(0)
{
addMouseListener(this);
addWidgetListener(this);
@@ -82,6 +82,7 @@ EmoteShortcutContainer::EmoteShortcutContainer():
mBoxWidth = 1;
}
mForegroundColor = getThemeColor(Theme::TEXT);
+ mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE);
}
EmoteShortcutContainer::~EmoteShortcutContainer()
@@ -99,6 +100,7 @@ void EmoteShortcutContainer::setWidget2(const Widget2 *const widget)
{
Widget2::setWidget2(widget);
mForegroundColor = getThemeColor(Theme::TEXT);
+ mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE);
}
void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
@@ -115,7 +117,8 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
gcn::Font *const font = getFont();
drawBackground(g);
- graphics->setColor(mForegroundColor);
+ g->setColor(mForegroundColor);
+ g->setColor2(mForegroundColor2);
for (unsigned i = 0; i < mMaxItems; i++)
{
const int emoteX = (i % mGridWidth) * mBoxWidth;
diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h
index 58b2d4d59..f10d1b67f 100644
--- a/src/gui/widgets/emoteshortcutcontainer.h
+++ b/src/gui/widgets/emoteshortcutcontainer.h
@@ -83,9 +83,10 @@ class EmoteShortcutContainer final : public ShortcutContainer
private:
std::vector<const EmoteSprite*> mEmoteImg;
+ TextPopup *mEmotePopup;
+ gcn::Color mForegroundColor2;
bool mEmoteClicked;
unsigned char mEmoteMoved;
- TextPopup *mEmotePopup;
};
#endif
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 560374271..deb0c7c86 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -77,6 +77,7 @@ ItemShortcutContainer::ItemShortcutContainer(const unsigned number) :
mBoxWidth = 1;
}
mForegroundColor = getThemeColor(Theme::TEXT);
+ mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE);
}
ItemShortcutContainer::~ItemShortcutContainer()
@@ -98,6 +99,7 @@ void ItemShortcutContainer::setWidget2(const Widget2 *const widget)
mEquipedColor = getThemeColor(Theme::ITEM_EQUIPPED);
mUnEquipedColor = getThemeColor(Theme::ITEM_NOT_EQUIPPED);
mForegroundColor = getThemeColor(Theme::TEXT);
+ mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE);
}
void ItemShortcutContainer::draw(gcn::Graphics *graphics)
@@ -136,7 +138,8 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics)
// Draw item keyboard shortcut.
std::string key = inputManager.getKeyValueString(
Input::KEY_SHORTCUT_1 + i);
- graphics->setColor(mForegroundColor);
+ g->setColor(mForegroundColor);
+ g->setColor2(mForegroundColor);
font->drawString(g, key, itemX + 2, itemY + 2);
diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h
index a416f52c4..cab8756b4 100644
--- a/src/gui/widgets/itemshortcutcontainer.h
+++ b/src/gui/widgets/itemshortcutcontainer.h
@@ -89,6 +89,7 @@ class ItemShortcutContainer final : public ShortcutContainer
SpellPopup *mSpellPopup;
gcn::Color mEquipedColor;
gcn::Color mUnEquipedColor;
+ gcn::Color mForegroundColor2;
};
#endif
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index a6e3a73ee..262f49f58 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -46,10 +46,10 @@
SpellShortcutContainer::SpellShortcutContainer(const unsigned number) :
ShortcutContainer(),
- mSpellClicked(false),
mSpellMoved(nullptr),
mSpellPopup(new SpellPopup),
- mNumber(number)
+ mNumber(number),
+ mSpellClicked(false)
{
addMouseListener(this);
addWidgetListener(this);
@@ -73,6 +73,7 @@ SpellShortcutContainer::SpellShortcutContainer(const unsigned number) :
mBoxWidth = 1;
}
mForegroundColor = getThemeColor(Theme::TEXT);
+ mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE);
}
SpellShortcutContainer::~SpellShortcutContainer()
@@ -88,6 +89,7 @@ void SpellShortcutContainer::setWidget2(const Widget2 *const widget)
{
Widget2::setWidget2(widget);
mForegroundColor = getThemeColor(Theme::TEXT);
+ mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE);
}
void SpellShortcutContainer::draw(gcn::Graphics *graphics)
@@ -108,6 +110,7 @@ void SpellShortcutContainer::draw(gcn::Graphics *graphics)
const int selectedId = spellShortcut->getSelectedItem();
g->setColor(mForegroundColor);
+ g->setColor2(mForegroundColor2);
drawBackground(g);
for (unsigned i = 0; i < mMaxItems; i++)
diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h
index 62a970c79..81d6d5d73 100644
--- a/src/gui/widgets/spellshortcutcontainer.h
+++ b/src/gui/widgets/spellshortcutcontainer.h
@@ -80,10 +80,11 @@ class SpellShortcutContainer final : public ShortcutContainer
void setWidget2(const Widget2 *const widget);
private:
- bool mSpellClicked;
TextCommand *mSpellMoved;
SpellPopup *mSpellPopup;
- unsigned mNumber;
+ unsigned int mNumber;
+ gcn::Color mForegroundColor2;
+ bool mSpellClicked;
};
#endif
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index d7885930d..ceede7133 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -41,6 +41,7 @@ TextPreview::TextPreview(const Widget2 *const widget,
mFont(gui->getFont()),
mText(text),
mTextColor(&getThemeColor(Theme::TEXT)),
+ mTextColor2(&getThemeColor(Theme::TEXT_OUTLINE)),
mBGColor(&getThemeColor(Theme::BACKGROUND)),
mTextBGColor(nullptr),
mTextAlpha(false),
@@ -83,16 +84,17 @@ void TextPreview::draw(gcn::Graphics* graphics)
BLOCK_START("TextPreview::draw")
if (Client::getGuiAlpha() != mAlpha)
mAlpha = Client::getGuiAlpha();
+ Graphics *const g = static_cast<Graphics*>(graphics);
const int alpha = mTextAlpha ? static_cast<int>(mAlpha * 255.0f) : 255;
if (mOpaque)
{
- graphics->setColor(gcn::Color(static_cast<int>(mBGColor->r),
- static_cast<int>(mBGColor->g),
- static_cast<int>(mBGColor->b),
- static_cast<int>(mAlpha * 255.0f)));
- graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight()));
+ g->setColor(gcn::Color(static_cast<int>(mBGColor->r),
+ static_cast<int>(mBGColor->g),
+ static_cast<int>(mBGColor->b),
+ static_cast<int>(mAlpha * 255.0f)));
+ g->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight()));
}
if (mTextBGColor)
@@ -104,18 +106,20 @@ void TextPreview::draw(gcn::Graphics* graphics)
+ 2 * ((mOutline || mShadow) ? 1 :0);
const int y = font->getHeight() + 1
+ 2 * ((mOutline || mShadow) ? 1 : 0);
- graphics->setColor(gcn::Color(static_cast<int>(mTextBGColor->r),
- static_cast<int>(mTextBGColor->g),
- static_cast<int>(mTextBGColor->b),
- static_cast<int>(mAlpha * 255.0f)));
- graphics->fillRectangle(gcn::Rectangle(mPadding, mPadding, x, y));
+ g->setColor(gcn::Color(static_cast<int>(mTextBGColor->r),
+ static_cast<int>(mTextBGColor->g),
+ static_cast<int>(mTextBGColor->b),
+ static_cast<int>(mAlpha * 255.0f)));
+ g->fillRectangle(gcn::Rectangle(mPadding, mPadding, x, y));
}
}
- graphics->setColor(gcn::Color(mTextColor->r, mTextColor->g,
+ g->setColor(gcn::Color(mTextColor->r, mTextColor->g,
mTextColor->b, alpha));
+ g->setColor2(gcn::Color(mTextColor2->r, mTextColor2->g,
+ mTextColor2->b, alpha));
- if (mOutline)
+ if (mOutline && mTextColor != mTextColor2)
{
Graphics *const g = static_cast<Graphics *const>(graphics);
g->setColor2(Theme::getThemeColor(Theme::OUTLINE));
diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h
index e3712a934..782fcc2e0 100644
--- a/src/gui/widgets/textpreview.h
+++ b/src/gui/widgets/textpreview.h
@@ -44,14 +44,12 @@ class TextPreview final : public gcn::Widget,
~TextPreview();
- /**
- * Sets the color the text is printed in.
- *
- * @param color the color to set
- */
inline void setTextColor(const gcn::Color *color)
{ mTextColor = color; adjustSize(); }
+ inline void setTextColor2(const gcn::Color *color)
+ { mTextColor2 = color; adjustSize(); }
+
/**
* Sets the text to use the set alpha value.
*
@@ -130,6 +128,7 @@ class TextPreview final : public gcn::Widget,
gcn::Font *mFont;
std::string mText;
const gcn::Color *mTextColor;
+ const gcn::Color *mTextColor2;
const gcn::Color *mBGColor;
const gcn::Color *mTextBGColor;
bool mTextAlpha;