From 585c3ced7b2c28bfb975af95b15e3011784d7731 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sun, 8 Jan 2012 01:40:34 +0100 Subject: [PATCH] Added optional classic console draw mode (renders the background as single block instead of separate blocks for each paragraph) --- indra/llui/llconsole.cpp | 148 +++++++++++++----- indra/newview/app_settings/settings.xml | 11 ++ .../newview/app_settings/settings_phoenix.xml | 12 ++ .../default/xui/de/panel_preferences_chat.xml | 1 + .../default/xui/en/panel_preferences_chat.xml | 15 +- 5 files changed, 145 insertions(+), 42 deletions(-) diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index 7614c5024f..e1641b9cac 100644 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -202,56 +202,124 @@ void LLConsole::draw() color.mV[VALPHA] *= console_opacity; F32 line_height = mFont->getLineHeight(); + BOOL classic_draw_mode = LLUI::sSettingGroups["config"]->getBOOL("FSConsoleClassicDrawMode"); - for(paragraph_it = mParagraphs.rbegin(); paragraph_it != mParagraphs.rend(); paragraph_it++) + // Ansariel: Classic draw mode for console (Single block over all lines and with width of the longest line) + if (classic_draw_mode) { - S32 target_height = llfloor( (*paragraph_it).mLines.size() * line_height + padding_vertical); - S32 target_width = llfloor( (*paragraph_it).mMaxWidth + padding_horizontal); + static const F32 padding_vert = 5; + S32 total_width = 0; + S32 total_height = 0; + F32 y_pos_paragraph = y_pos; - y_pos += ((*paragraph_it).mLines.size()) * line_height; - imagep->drawSolid(-14, (S32)(y_pos + line_height - target_height), target_width, target_height, color); - - F32 y_off=0; - - F32 alpha; - - if ((mLinePersistTime > 0.f) && ((*paragraph_it).mAddTime < fade_time)) + for (paragraph_it = mParagraphs.rbegin(); paragraph_it != mParagraphs.rend(); paragraph_it++) { - alpha = ((*paragraph_it).mAddTime - skip_time)/(mLinePersistTime - mFadeTime); - } - else - { - alpha = 1.0f; + total_height += llfloor( (*paragraph_it).mLines.size() * line_height + padding_vert); + S32 target_width = llfloor( (*paragraph_it).mMaxWidth + padding_horizontal); + total_width = llmax(total_width, target_width); + + y_pos_paragraph += ((*paragraph_it).mLines.size()) * line_height + padding_vert; } + imagep->drawSolid(-14, (S32)(y_pos + line_height / 2), total_width, total_height + (line_height - padding_vert) / 2, color); - if( alpha > 0.f ) + for (paragraph_it = mParagraphs.rbegin(); paragraph_it != mParagraphs.rend(); paragraph_it++) { - for (lines_t::iterator line_it=(*paragraph_it).mLines.begin(); - line_it != (*paragraph_it).mLines.end(); - line_it ++) + F32 y_off=0; + F32 alpha; + S32 target_width = llfloor( (*paragraph_it).mMaxWidth + padding_horizontal); + y_pos += ((*paragraph_it).mLines.size()) * line_height; + + if ((mLinePersistTime > 0.f) && ((*paragraph_it).mAddTime < fade_time)) { - for (line_color_segments_t::iterator seg_it = (*line_it).mLineColorSegments.begin(); - seg_it != (*line_it).mLineColorSegments.end(); - seg_it++) - { - mFont->render((*seg_it).mText, 0, (*seg_it).mXPosition - 8, y_pos - y_off, - LLColor4( - (*seg_it).mColor.mV[VRED], - (*seg_it).mColor.mV[VGREEN], - (*seg_it).mColor.mV[VBLUE], - (*seg_it).mColor.mV[VALPHA]*alpha), - LLFontGL::LEFT, - LLFontGL::BASELINE, - (*line_it).mStyleFlags, // Ansariel: Custom style flags for the font - LLFontGL::DROP_SHADOW, - S32_MAX, - target_width - ); - } - y_off += line_height; + alpha = ((*paragraph_it).mAddTime - skip_time)/(mLinePersistTime - mFadeTime); } + else + { + alpha = 1.0f; + } + + if( alpha > 0.f ) + { + for (lines_t::iterator line_it=(*paragraph_it).mLines.begin(); + line_it != (*paragraph_it).mLines.end(); + line_it ++) + { + for (line_color_segments_t::iterator seg_it = (*line_it).mLineColorSegments.begin(); + seg_it != (*line_it).mLineColorSegments.end(); + seg_it++) + { + mFont->render((*seg_it).mText, 0, (*seg_it).mXPosition - 8, y_pos - y_off, + LLColor4( + (*seg_it).mColor.mV[VRED], + (*seg_it).mColor.mV[VGREEN], + (*seg_it).mColor.mV[VBLUE], + (*seg_it).mColor.mV[VALPHA]*alpha), + LLFontGL::LEFT, + LLFontGL::BASELINE, + (*line_it).mStyleFlags, // Ansariel: Custom style flags for the font + LLFontGL::DROP_SHADOW, + S32_MAX, + target_width + ); + } + y_off += line_height; + } + } + y_pos += padding_vert; + } + } + else + { + for(paragraph_it = mParagraphs.rbegin(); paragraph_it != mParagraphs.rend(); paragraph_it++) + { + S32 target_height = llfloor( (*paragraph_it).mLines.size() * line_height + padding_vertical); + S32 target_width = llfloor( (*paragraph_it).mMaxWidth + padding_horizontal); + + y_pos += ((*paragraph_it).mLines.size()) * line_height; + imagep->drawSolid(-14, (S32)(y_pos + line_height - target_height), target_width, target_height, color); + + F32 y_off=0; + + F32 alpha; + + if ((mLinePersistTime > 0.f) && ((*paragraph_it).mAddTime < fade_time)) + { + alpha = ((*paragraph_it).mAddTime - skip_time)/(mLinePersistTime - mFadeTime); + } + else + { + alpha = 1.0f; + } + + if( alpha > 0.f ) + { + for (lines_t::iterator line_it=(*paragraph_it).mLines.begin(); + line_it != (*paragraph_it).mLines.end(); + line_it ++) + { + for (line_color_segments_t::iterator seg_it = (*line_it).mLineColorSegments.begin(); + seg_it != (*line_it).mLineColorSegments.end(); + seg_it++) + { + mFont->render((*seg_it).mText, 0, (*seg_it).mXPosition - 8, y_pos - y_off, + LLColor4( + (*seg_it).mColor.mV[VRED], + (*seg_it).mColor.mV[VGREEN], + (*seg_it).mColor.mV[VBLUE], + (*seg_it).mColor.mV[VALPHA]*alpha), + LLFontGL::LEFT, + LLFontGL::BASELINE, + (*line_it).mStyleFlags, // Ansariel: Custom style flags for the font + LLFontGL::DROP_SHADOW, + S32_MAX, + target_width + ); + } + y_off += line_height; + } + } + y_pos += padding_vertical; } - y_pos += padding_vertical; } } diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index e45a24cacf..d78f8d4486 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16946,5 +16946,16 @@ Change of this parameter will affect the layout of buttons in notification toast Value 1 + FSConsoleClassicDrawMode + + Comment + Enables classic console draw mode (single background block over all lines with width of the longest line) + Persist + 1 + Type + Boolean + Value + 0 + diff --git a/indra/newview/app_settings/settings_phoenix.xml b/indra/newview/app_settings/settings_phoenix.xml index b837339cdd..dcda0ed9fa 100644 --- a/indra/newview/app_settings/settings_phoenix.xml +++ b/indra/newview/app_settings/settings_phoenix.xml @@ -250,5 +250,17 @@ Value 1 + + FSConsoleClassicDrawMode + + Comment + Enables classic console draw mode (single background block over all lines with width of the longest line) + Persist + 1 + Type + Boolean + Value + 1 + diff --git a/indra/newview/skins/default/xui/de/panel_preferences_chat.xml b/indra/newview/skins/default/xui/de/panel_preferences_chat.xml index d7b382b6bd..e732706c86 100644 --- a/indra/newview/skins/default/xui/de/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/de/panel_preferences_chat.xml @@ -128,6 +128,7 @@ Konsole: + (Erfordert Neustart) diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml index 55aa594a6c..270dc1bdc0 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml @@ -493,7 +493,7 @@ label="Auto-close ((OOC)) parentheses" layout="topleft" top_pad="0" - left="30" + left="30" height="18" width="400" /> @@ -501,7 +501,7 @@ Console: +