sources/coloredline.cpp

changeset 181
e254398fcc7c
parent 145
d0aedc9be448
child 182
20ca0a6be175
equal deleted inserted replaced
180:2e7225dbd9b2 181:e254398fcc7c
51 { 51 {
52 if (m_activeColor != DEFAULT) 52 if (m_activeColor != DEFAULT)
53 setColor(m_activeColor, false); 53 setColor(m_activeColor, false);
54 54
55 if (m_boldActive) 55 if (m_boldActive)
56 m_data << RLINE_OFF_BOLD; 56 m_data.push_back(RLINE_OFF_BOLD);
57 57
58 m_final = true; 58 m_final = true;
59 } 59 }
60 60
61 // ------------------------------------------------------------------------------------------------- 61 // -------------------------------------------------------------------------------------------------
101 { 101 {
102 if (m_activeColor != DEFAULT) 102 if (m_activeColor != DEFAULT)
103 setColor(m_activeColor, false); 103 setColor(m_activeColor, false);
104 104
105 if (m_boldActive) 105 if (m_boldActive)
106 m_data << RLINE_OFF_BOLD; 106 m_data.push_back(RLINE_OFF_BOLD);
107 107
108 m_boldActive = false; 108 m_boldActive = false;
109 109
110 // Chars may be in uppercase 110 // Chars may be in uppercase
111 if (ch >= 'A' and ch <= 'V') 111 if (ch >= 'A' and ch <= 'V')
149 } 149 }
150 150
151 if (isprint(ch)) 151 if (isprint(ch))
152 { 152 {
153 m_string += ch; 153 m_string += ch;
154 m_data << int(ch); 154 m_data.push_back(static_cast<int>(ch));
155 ++m_length; 155 ++m_length;
156 } 156 }
157 } 157 }
158 158
159 // ------------------------------------------------------------------------------------------------- 159 // -------------------------------------------------------------------------------------------------
160 // 160 //
161 void ColoredLine::activateColor(Color color, bool bold) 161 void ColoredLine::activateColor(Color color, bool bold)
162 { 162 {
163 if (m_boldActive) 163 if (m_boldActive)
164 m_data << RLINE_OFF_BOLD; 164 {
165 165 m_data.push_back(RLINE_OFF_BOLD);
166 }
166 m_activeColor = color; 167 m_activeColor = color;
167 m_boldActive = bold; 168 m_boldActive = bold;
168 assert(m_activeColor < 8); 169 assert(m_activeColor < 8);
169 setColor(m_activeColor, true); 170 setColor(m_activeColor, true);
170
171 if (m_boldActive) 171 if (m_boldActive)
172 m_data << RLINE_ON_BOLD; 172 {
173 m_data.push_back(RLINE_ON_BOLD);
174 }
173 } 175 }
174 176
175 // ------------------------------------------------------------------------------------------------- 177 // -------------------------------------------------------------------------------------------------
176 // 178 //
177 void ColoredLine::addString(const String& text) 179 void ColoredLine::addString(const String& text)
183 // ------------------------------------------------------------------------------------------------- 185 // -------------------------------------------------------------------------------------------------
184 // 186 //
185 void ColoredLine::setColor(Color a, bool on) 187 void ColoredLine::setColor(Color a, bool on)
186 { 188 {
187 assert(a < 8); 189 assert(a < 8);
188 m_data << (a +(on ? RLINE_ON_COLOR : RLINE_OFF_COLOR)); 190 m_data.push_back(a + (on ? RLINE_ON_COLOR : RLINE_OFF_COLOR));
189 } 191 }
190 192
191 // ------------------------------------------------------------------------------------------------- 193 // -------------------------------------------------------------------------------------------------
192 // How many rows does this line take up? 194 // How many rows does this line take up?
193 // 195 //

mercurial