summaryrefslogtreecommitdiff
path: root/src/curses
diff options
context:
space:
mode:
authorAndrzej Rybczak <electricityispower@gmail.com>2017-03-26 10:02:26 +0200
committerAndrzej Rybczak <electricityispower@gmail.com>2017-03-26 10:05:34 +0200
commit55d2f4c70d5bac48d28b1de6d3f62405002fc04a (patch)
tree0d22cc6b511aeb2a66cde1b2793b1df05b6fa1e3 /src/curses
parent554895f0f1f07d034be9d5bb93b1a638783ef6c0 (diff)
Change 'previous' background color to 'current' and add some documentation
Diffstat (limited to 'src/curses')
-rw-r--r--src/curses/window.cpp32
-rw-r--r--src/curses/window.h4
2 files changed, 18 insertions, 18 deletions
diff --git a/src/curses/window.cpp b/src/curses/window.cpp
index 17f3ca5c..7fc20eab 100644
--- a/src/curses/window.cpp
+++ b/src/curses/window.cpp
@@ -199,17 +199,17 @@ std::vector<int> color_pair_map;
namespace NC {
const short Color::transparent = -1;
-const short Color::previous = -2;
+const short Color::current = -2;
Color Color::Default(0, 0, true, false);
-Color Color::Black(COLOR_BLACK, Color::previous);
-Color Color::Red(COLOR_RED, Color::previous);
-Color Color::Green(COLOR_GREEN, Color::previous);
-Color Color::Yellow(COLOR_YELLOW, Color::previous);
-Color Color::Blue(COLOR_BLUE, Color::previous);
-Color Color::Magenta(COLOR_MAGENTA, Color::previous);
-Color Color::Cyan(COLOR_CYAN, Color::previous);
-Color Color::White(COLOR_WHITE, Color::previous);
+Color Color::Black(COLOR_BLACK, Color::current);
+Color Color::Red(COLOR_RED, Color::current);
+Color Color::Green(COLOR_GREEN, Color::current);
+Color Color::Yellow(COLOR_YELLOW, Color::current);
+Color Color::Blue(COLOR_BLUE, Color::current);
+Color Color::Magenta(COLOR_MAGENTA, Color::current);
+Color Color::Cyan(COLOR_CYAN, Color::current);
+Color Color::White(COLOR_WHITE, Color::current);
Color Color::End(0, 0, false, true);
int Color::pairNumber() const
@@ -219,7 +219,7 @@ int Color::pairNumber() const
throw std::logic_error("'end' doesn't have a corresponding pair number");
else if (!isDefault())
{
- if (!previousBackground())
+ if (!currentBackground())
result = (background() + 1) % COLORS;
result *= 256;
result += foreground() % COLORS;
@@ -270,8 +270,8 @@ std::istream &operator>>(std::istream &is, Color &c)
result = COLOR_WHITE;
else if (background && s == "transparent")
result = NC::Color::transparent;
- else if (background && s == "previous")
- result = NC::Color::previous;
+ else if (background && s == "current")
+ result = NC::Color::current;
else if (std::all_of(s.begin(), s.end(), isdigit))
{
result = atoi(s.c_str());
@@ -313,7 +313,7 @@ std::istream &operator>>(std::istream &is, Color &c)
c = Color(fg, bg);
}
else
- c = Color(fg, NC::Color::previous);
+ c = Color(fg, NC::Color::current);
}
return is;
}
@@ -571,7 +571,7 @@ void Window::setColor(Color c)
c = m_base_color;
if (c != Color::Default)
{
- assert(!c.previousBackground());
+ assert(!c.currentBackground());
wcolor_set(m_window, c.pairNumber(), nullptr);
}
else
@@ -581,7 +581,7 @@ void Window::setColor(Color c)
void Window::setBaseColor(const Color &color)
{
- if (color.previousBackground())
+ if (color.currentBackground())
m_base_color = Color(color.foreground(), Color::transparent);
else
m_base_color = color;
@@ -1316,7 +1316,7 @@ Window &Window::operator<<(const Color &c)
}
else
{
- if (c.previousBackground())
+ if (c.currentBackground())
{
short background = m_color.isDefault()
? Color::transparent
diff --git a/src/curses/window.h b/src/curses/window.h
index d748a1e3..f53fc4b2 100644
--- a/src/curses/window.h
+++ b/src/curses/window.h
@@ -149,7 +149,7 @@ struct Color
friend struct Window;
static const short transparent;
- static const short previous;
+ static const short current;
Color() : m_impl(0, 0, true, false) { }
Color(short foreground_value, short background_value,
@@ -183,7 +183,7 @@ struct Color
private:
short foreground() const { return std::get<0>(m_impl); }
short background() const { return std::get<1>(m_impl); }
- bool previousBackground() const { return background() == previous; }
+ bool currentBackground() const { return background() == current; }
std::tuple<short, short, bool, bool> m_impl;
};