summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrichard <none@none>2010-02-10 18:13:41 -0800
committerrichard <none@none>2010-02-10 18:13:41 -0800
commit92ee1045f289cc2783b3e7e6f17e0682ced31560 (patch)
tree581e92d36f6f9285fad8389b380d3339d3810a02
parent41b1b2849f397428d19f82f108146cb62a476cab (diff)
parent8bc4dcc85524a23924d3a810502503cc946ce1c1 (diff)
merge
-rw-r--r--indra/llui/llconsole.cpp57
-rw-r--r--indra/llui/llconsole.h11
-rw-r--r--indra/newview/llviewerwindow.cpp2
3 files changed, 39 insertions, 31 deletions
diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp
index 0237c80efa..331d78da8c 100644
--- a/indra/llui/llconsole.cpp
+++ b/indra/llui/llconsole.cpp
@@ -244,23 +244,6 @@ void LLConsole::draw()
}
}
-void LLConsole::addLine(const std::string& utf8line)
-{
- LLWString wline = utf8str_to_wstring(utf8line);
- addLine(wline, 0.f, LLColor4(1.f, 1.f, 1.f, 1.f));
-}
-
-void LLConsole::addLine(const LLWString& wline)
-{
- addLine(wline, 0.f, LLColor4(1.f, 1.f, 1.f, 1.f));
-}
-
-void LLConsole::addLine(const std::string& utf8line, F32 size, const LLColor4 &color)
-{
- LLWString wline = utf8str_to_wstring(utf8line);
- addLine(wline, size, color);
-}
-
//Generate highlight color segments for this paragraph. Pass in default color of paragraph.
void LLConsole::Paragraph::makeParagraphColorSegments (const LLColor4 &color)
{
@@ -383,21 +366,43 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, const LLFontGL* font, b
//Pass in the string and the default color for this block of text.
LLConsole::Paragraph::Paragraph (LLWString str, const LLColor4 &color, F32 add_time, const LLFontGL* font, F32 screen_width)
- : mParagraphText(str), mAddTime(add_time), mMaxWidth(-1)
+: mParagraphText(str), mAddTime(add_time), mMaxWidth(-1)
{
makeParagraphColorSegments(color);
updateLines( screen_width, font );
}
-void LLConsole::addLine(const LLWString& wline, F32 size, const LLColor4 &color)
+// called once per frame regardless of console visibility
+// static
+void LLConsole::updateClass()
{
- Paragraph paragraph(wline, color, mTimer.getElapsedTimeF32(), mFont, (F32)getRect().getWidth() );
-
- mParagraphs.push_back ( paragraph );
+ for (instance_iter it = beginInstances(); it != endInstances(); ++it)
+ {
+ it->update();
+ }
+}
+
+void LLConsole::update()
+{
+ {
+ LLMutexLock lock(&mMutex);
+
+ while (!mLines.empty())
+ {
+ mParagraphs.push_back(
+ Paragraph( mLines.front(),
+ LLColor4::white,
+ mTimer.getElapsedTimeF32(),
+ mFont,
+ (F32)getRect().getWidth()));
+ mLines.pop_front();
+ }
+ }
// remove old paragraphs which can't possibly be visible any more. ::draw() will do something similar but more conservative - we do this here because ::draw() isn't guaranteed to ever be called! (i.e. the console isn't visible)
- while ((S32)mParagraphs.size() > llmax((S32)0, (S32)(mMaxLines)))
- {
- mParagraphs.pop_front();
- }
+ while ((S32)mParagraphs.size() > llmax((S32)0, (S32)(mMaxLines)))
+ {
+ mParagraphs.pop_front();
+ }
}
+
diff --git a/indra/llui/llconsole.h b/indra/llui/llconsole.h
index 4719950f28..f38e2bc9c2 100644
--- a/indra/llui/llconsole.h
+++ b/indra/llui/llconsole.h
@@ -40,7 +40,7 @@
class LLSD;
-class LLConsole : public LLFixedBuffer, public LLUICtrl
+class LLConsole : public LLFixedBuffer, public LLUICtrl, public LLInstanceTracker<LLConsole>
{
public:
typedef enum e_font_size
@@ -68,6 +68,9 @@ protected:
friend class LLUICtrlFactory;
public:
+ // call once per frame to pull data out of LLFixedBuffer
+ static void updateClass();
+
//A paragraph color segment defines the color of text in a line
//of text that was received for console display. It has no
//notion of line wraps, screen position, or the text it contains.
@@ -139,14 +142,12 @@ public:
// -1 = monospace, 0 means small, font size = 1 means big
void setFontSize(S32 size_index);
- void addLine(const std::string& utf8line, F32 size, const LLColor4 &color);
- void addLine(const LLWString& wline, F32 size, const LLColor4 &color);
// Overrides
/*virtual*/ void draw();
- /*virtual*/ void addLine(const std::string& utf8line);
- /*virtual*/ void addLine(const LLWString& line);
private:
+ void update();
+
F32 mLinePersistTime; // Age at which to stop drawing.
F32 mFadeTime; // Age at which to start fading
const LLFontGL* mFont;
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 4a86e1ca41..b76a2e150f 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2463,6 +2463,8 @@ void LLViewerWindow::updateUI()
{
static std::string last_handle_msg;
+ LLConsole::updateClass();
+
// animate layout stacks so we have up to date rect for world view
LLLayoutStack::updateClass();