--- a/sources/coloredline.h Sat Jan 09 02:35:00 2016 +0200 +++ b/sources/coloredline.h Sat Jan 09 17:41:21 2016 +0200 @@ -30,29 +30,33 @@ #pragma once #include "main.h" +BEGIN_ZFC_NAMESPACE + +// The order of these colors appears to differ between curses distributions (PDCurses and its +// win32a for instance have blue and red swapped). So we need to explicitly define the values +// of the enumerators based on their curses values. +enum Color +{ + BLACK = COLOR_BLACK, + RED = COLOR_RED, + GREEN = COLOR_GREEN, + YELLOW = COLOR_YELLOW, + BLUE = COLOR_BLUE, + MAGENTA = COLOR_MAGENTA, + CYAN = COLOR_CYAN, + WHITE = COLOR_WHITE, + DEFAULT = 8, + NUM_COLORS +}; // ------------------------------------------------------------------------------------------------- // enum { - RLINE_ON_BLACK = 256, - RLINE_ON_RED, - RLINE_ON_GREEN, - RLINE_ON_YELLOW, - RLINE_ON_BLUE, - RLINE_ON_MAGENTA, - RLINE_ON_CYAN, - RLINE_ON_WHITE, - RLINE_ON_BOLD, - RLINE_OFF_BLACK, - RLINE_OFF_RED, - RLINE_OFF_GREEN, - RLINE_OFF_YELLOW, - RLINE_OFF_BLUE, - RLINE_OFF_MAGENTA, - RLINE_OFF_CYAN, - RLINE_OFF_WHITE, - RLINE_OFF_BOLD, + RLINE_ON_COLOR = 256, + RLINE_OFF_COLOR = 264, + RLINE_ON_BOLD = 272, + RLINE_OFF_BOLD }; // ------------------------------------------------------------------------------------------------- @@ -60,7 +64,7 @@ class ColoredLine { public: - ColoredLine() {} + ColoredLine(); const Vector<int>& data() const { return m_data; } int length() const { return m_length; } @@ -73,10 +77,12 @@ void set_color (Color a, bool on); Vector<int> m_data; - int m_length = 0; - bool m_final = false; - Color m_activeColor = DEFAULT; - bool m_boldActive = false; - int m_colorCodeStage = 0; + int m_length; + bool m_final; + Color m_activeColor; + bool m_boldActive; + int m_colorCodeStage; String m_string; }; + +END_ZFC_NAMESPACE