Removed exportFileXML, and importXML, updated indra/test's
and generally updated cpp's to V-D look(include order, spelling fixes, and whatnot) Also, commented out pointless using namespace std.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
/**
|
||||
* @file llconsole.cpp
|
||||
* @brief a scrolling console output device
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
||||
*
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
@@ -13,17 +13,17 @@
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
@@ -45,8 +45,6 @@
|
||||
#include "llviewerwindow.h"
|
||||
#include "lltextparser.h"
|
||||
#include "llsd.h"
|
||||
#include "llfontgl.h"
|
||||
#include "llmath.h"
|
||||
|
||||
#include "llstartup.h"
|
||||
|
||||
@@ -72,7 +70,7 @@ LLConsole::LLConsole(const std::string& name, const LLRect &rect,
|
||||
{
|
||||
mTimer.reset();
|
||||
|
||||
setFontSize( font_size_index );
|
||||
setFontSize( font_size_index );
|
||||
}
|
||||
|
||||
LLConsole::~LLConsole()
|
||||
@@ -97,10 +95,10 @@ void LLConsole::reshape(S32 width, S32 height, BOOL called_from_parent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
mConsoleWidth = new_width;
|
||||
mConsoleHeight= new_height;
|
||||
|
||||
|
||||
LLView::reshape(new_width, new_height, called_from_parent);
|
||||
|
||||
for(paragraph_t::iterator paragraph_it = mParagraphs.begin(); paragraph_it != mParagraphs.end(); paragraph_it++)
|
||||
@@ -127,7 +125,7 @@ void LLConsole::setFontSize(S32 size_index)
|
||||
{
|
||||
mFont = LLFontGL::getFontSansSerifHuge();
|
||||
}
|
||||
|
||||
|
||||
for(paragraph_t::iterator paragraph_it = mParagraphs.begin(); paragraph_it != mParagraphs.end(); paragraph_it++)
|
||||
{
|
||||
(*paragraph_it)->updateLines((F32)getRect().getWidth(), mFont, true);
|
||||
@@ -156,7 +154,7 @@ void LLConsole::draw()
|
||||
|
||||
// skip lines added more than mLinePersistTime ago
|
||||
F32 cur_time = mTimer.getElapsedTimeF32();
|
||||
|
||||
|
||||
F32 skip_time = cur_time - mLinePersistTime;
|
||||
F32 fade_time = cur_time - mFadeTime;
|
||||
|
||||
@@ -192,7 +190,7 @@ void LLConsole::draw()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// draw remaining lines
|
||||
F32 y_pos = 0.f;
|
||||
|
||||
@@ -207,7 +205,7 @@ void LLConsole::draw()
|
||||
F32 line_height = mFont->getLineHeight();
|
||||
|
||||
S32 message_spacing = 0;
|
||||
|
||||
|
||||
//080813 Spatters: This section makes a single huge black box behind all the text.
|
||||
S32 bkg_height=8;
|
||||
S32 bkg_width=0;
|
||||
@@ -230,7 +228,7 @@ void LLConsole::draw()
|
||||
{
|
||||
S32 target_height = llfloor( (*paragraph_it)->mLines.size() * line_height + message_spacing);
|
||||
S32 target_width = llfloor( (*paragraph_it)->mMaxWidth + CONSOLE_GUTTER_RIGHT);
|
||||
|
||||
|
||||
bkg_height+= target_height;
|
||||
if (target_width > bkg_width)
|
||||
{
|
||||
@@ -323,7 +321,7 @@ void LLConsole::addConsoleLine(const std::string& utf8line, const LLColor4 &colo
|
||||
}
|
||||
|
||||
void LLConsole::addConsoleLine(const LLWString& wline, const LLColor4 &color)
|
||||
{
|
||||
{
|
||||
Paragraph* paragraph = new Paragraph(wline, color, mTimer.getElapsedTimeF32());
|
||||
LLMutexLock lock(&mQueueMutex);
|
||||
mNewParagraphs.push_back ( paragraph );
|
||||
@@ -335,24 +333,24 @@ void LLConsole::Paragraph::makeParagraphColorSegments (const LLColor4 &color)
|
||||
LLTextParser* highlight = LLTextParser::getInstance();
|
||||
LLSD paragraph_color_segments;
|
||||
LLColor4 lcolor=color;
|
||||
|
||||
|
||||
highlight->parseFullLineHighlights(wstring_to_utf8str(mParagraphText), &lcolor);
|
||||
paragraph_color_segments = highlight->parsePartialLineHighlights(
|
||||
wstring_to_utf8str(mParagraphText),
|
||||
lcolor);
|
||||
|
||||
|
||||
for(LLSD::array_const_iterator color_segment_it = paragraph_color_segments.beginArray();
|
||||
color_segment_it != paragraph_color_segments.endArray();
|
||||
++color_segment_it)
|
||||
{
|
||||
{
|
||||
LLSD color_llsd = (*color_segment_it)["color"];
|
||||
std::string color_str = (*color_segment_it)["text"].asString();
|
||||
|
||||
ParagraphColorSegment color_segment;
|
||||
|
||||
|
||||
color_segment.mColor.setValue(color_llsd);
|
||||
color_segment.mNumChars = color_str.length();
|
||||
|
||||
|
||||
mParagraphColorSegments.push_back(color_segment);
|
||||
}
|
||||
}
|
||||
@@ -368,22 +366,22 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, LLFontGL* font, bool fo
|
||||
return; //No resize required.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
screen_width = screen_width - 30; //Margin for small windows.
|
||||
|
||||
|
||||
if ( mParagraphText.empty()
|
||||
|| mParagraphColorSegments.empty()
|
||||
|| font == NULL)
|
||||
{
|
||||
return; //Not enough info to complete.
|
||||
}
|
||||
|
||||
|
||||
mLines.clear(); //Chuck everything.
|
||||
mMaxWidth = 0.0f;
|
||||
|
||||
|
||||
paragraph_color_segments_t::iterator current_color = mParagraphColorSegments.begin();
|
||||
U32 current_color_length = (*current_color).mNumChars;
|
||||
|
||||
U32 current_color_length = (*current_color).mNumChars;
|
||||
|
||||
S32 paragraph_offset = 0; //Offset into the paragraph text.
|
||||
|
||||
// Wrap lines that are longer than the view is wide.
|
||||
@@ -406,13 +404,13 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, LLFontGL* font, bool fo
|
||||
if (drawable != 0 || found_newline)
|
||||
{
|
||||
F32 x_position = 0; //Screen X position of text.
|
||||
|
||||
|
||||
mMaxWidth = llmax( mMaxWidth, (F32)font->getWidth( mParagraphText.substr( paragraph_offset, drawable ).c_str() ) );
|
||||
line_color_segments_t line;
|
||||
|
||||
|
||||
U32 left_to_draw = drawable;
|
||||
U32 drawn = 0;
|
||||
|
||||
|
||||
while (left_to_draw >= current_color_length
|
||||
&& current_color != mParagraphColorSegments.end() )
|
||||
{
|
||||
@@ -420,12 +418,12 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, LLFontGL* font, bool fo
|
||||
line.push_back( LineColorSegment( color_text, //Append segment to line.
|
||||
(*current_color).mColor,
|
||||
x_position ) );
|
||||
|
||||
|
||||
x_position += font->getWidth( color_text.c_str() ); //Set up next screen position.
|
||||
|
||||
|
||||
drawn += current_color_length;
|
||||
left_to_draw -= current_color_length;
|
||||
|
||||
|
||||
current_color++; //Goto next paragraph color record.
|
||||
|
||||
if (current_color != mParagraphColorSegments.end())
|
||||
@@ -433,15 +431,15 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, LLFontGL* font, bool fo
|
||||
current_color_length = (*current_color).mNumChars;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (left_to_draw > 0 && current_color != mParagraphColorSegments.end() )
|
||||
{
|
||||
LLWString color_text = mParagraphText.substr( paragraph_offset + drawn, left_to_draw );
|
||||
|
||||
|
||||
line.push_back( LineColorSegment( color_text, //Append segment to line.
|
||||
(*current_color).mColor,
|
||||
x_position ) );
|
||||
|
||||
|
||||
current_color_length -= left_to_draw;
|
||||
}
|
||||
mLines.push_back(line); //Append line to paragraph line list.
|
||||
@@ -460,7 +458,7 @@ LLConsole::Paragraph::Paragraph (LLWString str, const LLColor4 &color, F32 add_t
|
||||
: mParagraphText(str), mAddTime(add_time), mMaxWidth(-1)
|
||||
{
|
||||
// Only call makeParagraphColorSegments if the user logged in already (we come
|
||||
// here before he logged in when they disabled login/logout screens).
|
||||
// here before they logged in when they disabled login/logout screens).
|
||||
// Otherwise makeParagraphColorSegments calls LLTextParser::getInstance() which
|
||||
// causes a one-time initialization by reading highlights.xml, which fails
|
||||
// when not logged in because it's per account.
|
||||
@@ -469,4 +467,3 @@ LLConsole::Paragraph::Paragraph (LLWString str, const LLColor4 &color, F32 add_t
|
||||
makeParagraphColorSegments(color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user