diff options
Diffstat (limited to 'linden/indra/newview/llconsole.cpp')
-rw-r--r-- | linden/indra/newview/llconsole.cpp | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/linden/indra/newview/llconsole.cpp b/linden/indra/newview/llconsole.cpp index b0f1988..3ee11ff 100644 --- a/linden/indra/newview/llconsole.cpp +++ b/linden/indra/newview/llconsole.cpp | |||
@@ -55,8 +55,13 @@ extern void AddNewDebugConsoleToLCD(const LLWString &newLine); | |||
55 | LLConsole* gConsole = NULL; // Created and destroyed in LLViewerWindow. | 55 | LLConsole* gConsole = NULL; // Created and destroyed in LLViewerWindow. |
56 | 56 | ||
57 | const F32 FADE_DURATION = 2.f; | 57 | const F32 FADE_DURATION = 2.f; |
58 | const S32 MIN_CONSOLE_WIDTH = 200; | 58 | const S32 MIN_CONSOLE_WIDTH = 50; |
59 | 59 | ||
60 | // Why don't these match? | ||
61 | const S32 CONSOLE_GUTTER_LEFT = 14; | ||
62 | const S32 CONSOLE_GUTTER_RIGHT = 15; | ||
63 | |||
64 | |||
60 | LLConsole::LLConsole(const std::string& name, const U32 max_lines, const LLRect &rect, | 65 | LLConsole::LLConsole(const std::string& name, const U32 max_lines, const LLRect &rect, |
61 | S32 font_size_index, F32 persist_time ) | 66 | S32 font_size_index, F32 persist_time ) |
62 | : | 67 | : |
@@ -78,7 +83,7 @@ void LLConsole::setLinePersistTime(F32 seconds) | |||
78 | 83 | ||
79 | void LLConsole::reshape(S32 width, S32 height, BOOL called_from_parent) | 84 | void LLConsole::reshape(S32 width, S32 height, BOOL called_from_parent) |
80 | { | 85 | { |
81 | S32 new_width = llmax(50, llmin(getRect().getWidth(), gViewerWindow->getWindowWidth())); | 86 | S32 new_width = llmax(MIN_CONSOLE_WIDTH, llmin(getRect().getWidth(), gViewerWindow->getWindowWidth())); |
82 | S32 new_height = llmax(llfloor(mFont->getLineHeight()) + 15, llmin(getRect().getHeight(), gViewerWindow->getWindowHeight())); | 87 | S32 new_height = llmax(llfloor(mFont->getLineHeight()) + 15, llmin(getRect().getHeight(), gViewerWindow->getWindowHeight())); |
83 | 88 | ||
84 | if ( mConsoleWidth == new_width | 89 | if ( mConsoleWidth == new_width |
@@ -185,15 +190,19 @@ void LLConsole::draw() | |||
185 | for(paragraph_it = mParagraphs.rbegin(); paragraph_it != mParagraphs.rend(); paragraph_it++) | 190 | for(paragraph_it = mParagraphs.rbegin(); paragraph_it != mParagraphs.rend(); paragraph_it++) |
186 | { | 191 | { |
187 | S32 target_height = llfloor( (*paragraph_it).mLines.size() * line_height + message_spacing); | 192 | S32 target_height = llfloor( (*paragraph_it).mLines.size() * line_height + message_spacing); |
188 | S32 target_width = llfloor( (*paragraph_it).mMaxWidth +15); | 193 | S32 target_width = llfloor( (*paragraph_it).mMaxWidth + CONSOLE_GUTTER_RIGHT); |
189 | 194 | ||
190 | bkg_height+= target_height; | 195 | bkg_height+= target_height; |
191 | if (target_width > bkg_width) bkg_width=target_width; | 196 | if (target_width > bkg_width) |
197 | { | ||
198 | bkg_width=target_width; | ||
199 | } | ||
192 | 200 | ||
201 | // Why is this not using llfloor as above? | ||
193 | y_pos += ((*paragraph_it).mLines.size()) * line_height; | 202 | y_pos += ((*paragraph_it).mLines.size()) * line_height; |
194 | y_pos += message_spacing; //Extra spacing between messages. | 203 | y_pos += message_spacing; //Extra spacing between messages. |
195 | } | 204 | } |
196 | imagep->drawSolid(-14, (S32)(y_pos + line_height - bkg_height - message_spacing), bkg_width, bkg_height, color); | 205 | imagep->drawSolid(-CONSOLE_GUTTER_LEFT, (S32)(y_pos + line_height - bkg_height - message_spacing), bkg_width, bkg_height, color); |
197 | y_pos = 0.f; | 206 | y_pos = 0.f; |
198 | //End screen-eating black void | 207 | //End screen-eating black void |
199 | 208 | ||
@@ -201,7 +210,7 @@ void LLConsole::draw() | |||
201 | { | 210 | { |
202 | //080813 Spatters: Dainty per-message block boxes | 211 | //080813 Spatters: Dainty per-message block boxes |
203 | // S32 target_height = llfloor( (*paragraph_it).mLines.size() * line_height + 8); | 212 | // S32 target_height = llfloor( (*paragraph_it).mLines.size() * line_height + 8); |
204 | S32 target_width = llfloor( (*paragraph_it).mMaxWidth +15); | 213 | S32 target_width = llfloor( (*paragraph_it).mMaxWidth + CONSOLE_GUTTER_RIGHT); |
205 | 214 | ||
206 | y_pos += ((*paragraph_it).mLines.size()) * line_height; | 215 | y_pos += ((*paragraph_it).mLines.size()) * line_height; |
207 | //080813 Spatters: Dainty per-message block boxes | 216 | //080813 Spatters: Dainty per-message block boxes |
@@ -325,22 +334,21 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, LLFontGL* font, bool fo | |||
325 | // Wrap lines that are longer than the view is wide. | 334 | // Wrap lines that are longer than the view is wide. |
326 | while( paragraph_offset < (S32)mParagraphText.length() ) | 335 | while( paragraph_offset < (S32)mParagraphText.length() ) |
327 | { | 336 | { |
328 | S32 skip_chars; // skip '\n' | 337 | bool found_newline = false; // skip '\n' |
329 | // Figure out if a word-wrapped line fits here. | 338 | // Figure out if a word-wrapped line fits here. |
330 | LLWString::size_type line_end = mParagraphText.find_first_of(llwchar('\n'), paragraph_offset); | 339 | LLWString::size_type line_end = mParagraphText.find_first_of(llwchar('\n'), paragraph_offset); |
331 | if (line_end != LLWString::npos) | 340 | if (line_end != LLWString::npos) |
332 | { | 341 | { |
333 | skip_chars = 1; // skip '\n' | 342 | found_newline = true; // skip '\n' |
334 | } | 343 | } |
335 | else | 344 | else |
336 | { | 345 | { |
337 | line_end = mParagraphText.size(); | 346 | line_end = mParagraphText.size(); |
338 | skip_chars = 0; | ||
339 | } | 347 | } |
340 | 348 | ||
341 | U32 drawable = font->maxDrawableChars(mParagraphText.c_str()+paragraph_offset, screen_width, line_end - paragraph_offset, TRUE); | 349 | U32 drawable = font->maxDrawableChars(mParagraphText.c_str()+paragraph_offset, screen_width, line_end - paragraph_offset, TRUE); |
342 | 350 | ||
343 | if (drawable != 0) | 351 | if (drawable != 0 || found_newline) |
344 | { | 352 | { |
345 | F32 x_position = 0; //Screen X position of text. | 353 | F32 x_position = 0; //Screen X position of text. |
346 | 354 | ||
@@ -387,7 +395,8 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, LLFontGL* font, bool fo | |||
387 | { | 395 | { |
388 | break; // Nothing more to print | 396 | break; // Nothing more to print |
389 | } | 397 | } |
390 | paragraph_offset += (drawable + skip_chars); | 398 | |
399 | paragraph_offset += (drawable + ( found_newline ? 1 : 0 ) ); | ||
391 | } | 400 | } |
392 | } | 401 | } |
393 | 402 | ||