--- a/sources/coloredline.cpp Wed May 27 21:44:42 2015 +0300 +++ b/sources/coloredline.cpp Thu Jul 23 00:16:47 2015 +0300 @@ -30,35 +30,11 @@ #include "coloredline.h" -static const struct +struct ColorCodeInfo { const char* name; Color color; bool bold; -} g_colorCodes['v' - 'a' + 1] = -{ - { "Brick", RED, true }, // a - { "Tan", YELLOW, true }, // b - { "Gray", WHITE, false }, // c - { "Green", GREEN, true }, // d - { "Brown", YELLOW, false }, // e - { "Gold", YELLOW, true }, // f - { "Red", RED, true }, // g - { "Blue", BLUE, false }, // h - { "Orange", YELLOW, false }, // i - { "White", WHITE, true }, // j - { "Yellow", YELLOW, true }, // k - { "Untranslated", DEFAULT, false }, // l - { "Black", BLACK, false }, // m - { "Blue", BLUE, true }, // n - { "Cream", YELLOW, true }, // o - { "Olive", GREEN, true }, // p - { "Dark Green", GREEN, false }, // q - { "Dark Red", RED, false }, // r - { "Dark Brown", YELLOW, false }, // s - { "Purple", MAGENTA, false }, // t - { "Dark Gray", BLACK, true }, // u - { "Cyan", CYAN, true }, // v }; // ------------------------------------------------------------------------------------------------- @@ -78,6 +54,32 @@ // void ColoredLine::add_char (char ch) { + static const ColorCodeInfo colorCodes[] = + { + { "Brick", RED, true }, // a + { "Tan", YELLOW, true }, // b + { "Gray", WHITE, false }, // c + { "Green", GREEN, true }, // d + { "Brown", YELLOW, false }, // e + { "Gold", YELLOW, true }, // f + { "Red", RED, true }, // g + { "Blue", BLUE, false }, // h + { "Orange", YELLOW, false }, // i + { "White", WHITE, true }, // j + { "Yellow", YELLOW, true }, // k + { "Untranslated", DEFAULT, false }, // l + { "Black", BLACK, false }, // m + { "Blue", BLUE, true }, // n + { "Cream", YELLOW, true }, // o + { "Olive", GREEN, true }, // p + { "Dark Green", GREEN, false }, // q + { "Dark Red", RED, false }, // r + { "Dark Brown", YELLOW, false }, // s + { "Purple", MAGENTA, false }, // t + { "Dark Gray", BLACK, true }, // u + { "Cyan", CYAN, true }, // v + }; + if (m_final) return; // Don't touch finalized lines. @@ -101,7 +103,7 @@ if (ch >= 'a' and ch <= 'v' and ch != 'l') { - auto colorInfo = g_colorCodes[ch - 'a']; + auto colorInfo = colorCodes[ch - 'a']; m_activeColor = colorInfo.color; m_boldActive = colorInfo.bold; assert (m_activeColor < 8);