aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llconsole.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llconsole.cpp73
1 files changed, 47 insertions, 26 deletions
diff --git a/linden/indra/newview/llconsole.cpp b/linden/indra/newview/llconsole.cpp
index 1ed0e17..ce092a7 100644
--- a/linden/indra/newview/llconsole.cpp
+++ b/linden/indra/newview/llconsole.cpp
@@ -118,6 +118,8 @@ void LLConsole::draw()
118{ 118{
119 LLGLSUIDefault gls_ui; 119 LLGLSUIDefault gls_ui;
120 120
121 addQueuedLines();
122
121 // skip lines added more than mLinePersistTime ago 123 // skip lines added more than mLinePersistTime ago
122 F32 cur_time = mTimer.getElapsedTimeF32(); 124 F32 cur_time = mTimer.getElapsedTimeF32();
123 125
@@ -243,38 +245,57 @@ void LLConsole::addLine(const LLString& utf8line, F32 size, const LLColor4 &colo
243 245
244void LLConsole::addLine(const LLWString& wline, F32 size, const LLColor4 &color) 246void LLConsole::addLine(const LLWString& wline, F32 size, const LLColor4 &color)
245{ 247{
246 if (!wline.empty() && mFont != NULL) 248 while (mLineQueue.size() >= mMaxLines)
249 {
250 mLineQueue.pop_front();
251 }
252 mLineQueue.push_back(LineInfo(wline, size, color, mTimer.getElapsedTimeF32()));
253}
254
255void LLConsole::addQueuedLines()
256{
257 for (line_queue_t::iterator iter = mLineQueue.begin();
258 iter != mLineQueue.end(); ++iter)
247 { 259 {
248 // Wrap lines that are longer than the view is wide. 260 LineInfo& line_info = *iter;
249 S32 offset = 0; 261 LLWString wline = line_info.wline;
250 while( offset < (S32)wline.length() ) 262 //F32 size = line_info.size;
263 LLColor4 color = line_info.color;
264 if (!wline.empty() && mFont != NULL)
251 { 265 {
252 S32 skip_chars; // skip '\n' 266 // Wrap lines that are longer than the view is wide.
253 // Figure out if a word-wrapped line fits here. 267 S32 offset = 0;
254 LLWString::size_type line_end = wline.find_first_of(llwchar('\n'), offset); 268 while( offset < (S32)wline.length() )
255 if (line_end != LLWString::npos)
256 {
257 skip_chars = 1; // skip '\n'
258 }
259 else
260 {
261 line_end = wline.size();
262 skip_chars = 0;
263 }
264 U32 drawable = mFont->maxDrawableChars(wline.c_str()+offset, (F32)mRect.getWidth(), line_end-offset, TRUE);
265 if (drawable != 0)
266 {
267 LLFixedBuffer::addLine(wline.substr(offset, drawable));
268 }
269 else
270 { 269 {
271 // force a blank line 270 S32 skip_chars; // skip '\n'
272 LLFixedBuffer::addLine(" "); 271 // Figure out if a word-wrapped line fits here.
272 LLWString::size_type line_end = wline.find_first_of(llwchar('\n'), offset);
273 if (line_end != LLWString::npos)
274 {
275 skip_chars = 1; // skip '\n'
276 }
277 else
278 {
279 line_end = wline.size();
280 skip_chars = 0;
281 }
282 U32 drawable = mFont->maxDrawableChars(wline.c_str()+offset, (F32)mRect.getWidth(), line_end-offset, TRUE);
283 if (drawable != 0)
284 {
285 LLFixedBuffer::addLine(wline.substr(offset, drawable));
286 mAddTimes[mAddTimes.size()-1] = line_info.add_time;
287 }
288 else
289 {
290 // force a blank line
291 LLFixedBuffer::addLine(" ");
292 }
293 mColors.push_back(color);
294 offset += (drawable + skip_chars);
273 } 295 }
274 mColors.push_back(color);
275 offset += (drawable + skip_chars);
276 } 296 }
277 } 297 }
298 mLineQueue.clear();
278} 299}
279 300
280void LLConsole::removeExtraLines() 301void LLConsole::removeExtraLines()