summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-01-27 18:20:59 +0300
committerAndrei Karas <akaras@inbox.ru>2017-01-27 18:20:59 +0300
commit19e3c0f6b80b41e1dca65899053590f59952e3fb (patch)
tree547cdc99ec11ce74d674b22003ca8927891d67a4
parent6917c126fbee146183433367be9a3d8fef94a1dd (diff)
downloadmv-19e3c0f6b80b41e1dca65899053590f59952e3fb.tar.gz
mv-19e3c0f6b80b41e1dca65899053590f59952e3fb.tar.bz2
mv-19e3c0f6b80b41e1dca65899053590f59952e3fb.tar.xz
mv-19e3c0f6b80b41e1dca65899053590f59952e3fb.zip
Move color names into separate file.
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/enums/gui/colorname.h45
-rw-r--r--src/gui/widgets/browserbox.cpp44
-rw-r--r--src/gui/widgets/browserbox.h18
5 files changed, 71 insertions, 38 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8faf6f2a2..79fe1aee5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1351,6 +1351,7 @@ SET(SRCS
enums/gui/browserboxmode.h
enums/gui/chatmsgtype.h
enums/gui/chattabtype.h
+ enums/gui/colorname.h
gui/cliprect.h
gui/color.h
gui/colorpair.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 4cabb17b9..dcadc4cc4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -123,6 +123,7 @@ SRC += events/actionevent.h \
enums/gui/browserboxmode.h \
enums/gui/chatmsgtype.h \
enums/gui/chattabtype.h \
+ enums/gui/colorname.h \
gui/cliprect.h \
gui/color.h \
enums/gui/dialogtype.h \
diff --git a/src/enums/gui/colorname.h b/src/enums/gui/colorname.h
new file mode 100644
index 000000000..41636e62e
--- /dev/null
+++ b/src/enums/gui/colorname.h
@@ -0,0 +1,45 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2004-2009 The Mana World Development Team
+ * Copyright (C) 2009-2010 The Mana Developers
+ * Copyright (C) 2011-2017 The ManaPlus Developers
+ * Copyright (C) 2009 Aethyra Development Team
+ *
+ * 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_COLORNAME_H
+#define ENUMS_GUI_COLORNAME_H
+
+namespace ColorName
+{
+ enum Type
+ {
+ RED = 0,
+ BLACK,
+ GREEN,
+ BLUE,
+ ORANGE,
+ YELLOW,
+ PINK,
+ PURPLE,
+ GRAY,
+ BROWN,
+ COLORS_MAX
+ };
+}
+
+#endif // ENUMS_GUI_COLORNAME_H
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index e1bb330e4..c57a9bf4c 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -96,8 +96,8 @@ ImageSet *BrowserBox::mEmotes = nullptr;
int BrowserBox::mInstances = 0;
#define readColor(color) \
- mColors[0][color] = getThemeColor(ThemeColorId::color); \
- mColors[1][color] = getThemeColor(ThemeColorId::color##_OUTLINE)
+ mColors[0][ColorName::color] = getThemeColor(ThemeColorId::color); \
+ mColors[1][ColorName::color] = getThemeColor(ThemeColorId::color##_OUTLINE)
BrowserBox::BrowserBox(const Widget2 *const widget,
const BrowserBoxModeT mode,
@@ -778,44 +778,44 @@ int BrowserBox::calcHeight()
switch (c)
{
case '0':
- selColor[0] = mColors[0][BLACK];
- selColor[1] = mColors[1][BLACK];
+ selColor[0] = mColors[0][ColorName::BLACK];
+ selColor[1] = mColors[1][ColorName::BLACK];
break;
case '1':
- selColor[0] = mColors[0][RED];
- selColor[1] = mColors[1][RED];
+ selColor[0] = mColors[0][ColorName::RED];
+ selColor[1] = mColors[1][ColorName::RED];
break;
case '2':
- selColor[0] = mColors[0][GREEN];
- selColor[1] = mColors[1][GREEN];
+ selColor[0] = mColors[0][ColorName::GREEN];
+ selColor[1] = mColors[1][ColorName::GREEN];
break;
case '3':
- selColor[0] = mColors[0][BLUE];
- selColor[1] = mColors[1][BLUE];
+ selColor[0] = mColors[0][ColorName::BLUE];
+ selColor[1] = mColors[1][ColorName::BLUE];
break;
case '4':
- selColor[0] = mColors[0][ORANGE];
- selColor[1] = mColors[1][ORANGE];
+ selColor[0] = mColors[0][ColorName::ORANGE];
+ selColor[1] = mColors[1][ColorName::ORANGE];
break;
case '5':
- selColor[0] = mColors[0][YELLOW];
- selColor[1] = mColors[1][YELLOW];
+ selColor[0] = mColors[0][ColorName::YELLOW];
+ selColor[1] = mColors[1][ColorName::YELLOW];
break;
case '6':
- selColor[0] = mColors[0][PINK];
- selColor[1] = mColors[1][PINK];
+ selColor[0] = mColors[0][ColorName::PINK];
+ selColor[1] = mColors[1][ColorName::PINK];
break;
case '7':
- selColor[0] = mColors[0][PURPLE];
- selColor[1] = mColors[1][PURPLE];
+ selColor[0] = mColors[0][ColorName::PURPLE];
+ selColor[1] = mColors[1][ColorName::PURPLE];
break;
case '8':
- selColor[0] = mColors[0][GRAY];
- selColor[1] = mColors[1][GRAY];
+ selColor[0] = mColors[0][ColorName::GRAY];
+ selColor[1] = mColors[1][ColorName::GRAY];
break;
case '9':
- selColor[0] = mColors[0][BROWN];
- selColor[1] = mColors[1][BROWN];
+ selColor[0] = mColors[0][ColorName::BROWN];
+ selColor[1] = mColors[1][ColorName::BROWN];
break;
default:
selColor[0] = textColor[0];
diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h
index fe0c0c36d..aa5a70b0e 100644
--- a/src/gui/widgets/browserbox.h
+++ b/src/gui/widgets/browserbox.h
@@ -29,6 +29,7 @@
#include "enums/simpletypes/opaque.h"
#include "enums/gui/browserboxmode.h"
+#include "enums/gui/colorname.h"
#include "gui/browserlink.h"
@@ -114,21 +115,6 @@ class BrowserBox final : public Widget,
void updateHeight();
- enum
- {
- RED = 0,
- BLACK,
- GREEN,
- BLUE,
- ORANGE,
- YELLOW,
- PINK,
- PURPLE,
- GRAY,
- BROWN,
- COLORS_MAX
- };
-
typedef std::list<std::string> TextRows;
TextRows &getRows() noexcept2 A_WARN_UNUSED
@@ -203,7 +189,7 @@ class BrowserBox final : public Widget,
Color mHighlightColor;
Color mHyperLinkColor;
- Color mColors[2][COLORS_MAX];
+ Color mColors[2][ColorName::COLORS_MAX];
Opaque mOpaque;
bool mUseLinksAndUserColors;