aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llconsole.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llconsole.h')
-rw-r--r--linden/indra/newview/llconsole.h85
1 files changed, 65 insertions, 20 deletions
diff --git a/linden/indra/newview/llconsole.h b/linden/indra/newview/llconsole.h
index 04d8600..ec5cd31 100644
--- a/linden/indra/newview/llconsole.h
+++ b/linden/indra/newview/llconsole.h
@@ -38,39 +38,86 @@
38#include <deque> 38#include <deque>
39 39
40class LLFontGL; 40class LLFontGL;
41class LLSD;
41 42
42class LLConsole : public LLFixedBuffer, public LLView 43class LLConsole : public LLFixedBuffer, public LLView
43{ 44{
44private: 45private:
45 F32 mLinePersistTime; // Age at which to stop drawing. 46 F32 mLinePersistTime; // Age at which to stop drawing.
46 F32 mFadeTime; // Age at which to start fading 47 F32 mFadeTime; // Age at which to start fading
47 std::deque<LLColor4> mColors;
48 LLFontGL* mFont; 48 LLFontGL* mFont;
49 S32 mLastBoxHeight; 49 S32 mLastBoxHeight;
50 S32 mLastBoxWidth; 50 S32 mLastBoxWidth;
51 S32 mConsoleWidth;
52 S32 mConsoleHeight;
51 53
52 struct LineInfo 54public:
55 //A paragraph color segment defines the color of text in a line
56 //of text that was received for console display. It has no
57 //notion of line wraps, screen position, or the text it contains.
58 //It is only the number of characters that are a color and the
59 //color.
60 struct ParagraphColorSegment
53 { 61 {
54 LineInfo(const LLWString &wln, F32 sz, const LLColor4& clr, F32 time) 62 S32 mNumChars;
55 : wline(wln), size(sz), color(clr), add_time(time) 63 LLColor4 mColor;
56 {
57
58 }
59 LLWString wline;
60 F32 size;
61 LLColor4 color;
62 F32 add_time;
63 }; 64 };
64 typedef std::list<LineInfo> line_queue_t;
65 line_queue_t mLineQueue;
66 65
67public: 66 //A line color segment is a chunk of text, the color associated
67 //with it, and the X Position it was calculated to begin at
68 //on the screen. X Positions are re-calculated if the
69 //screen changes size.
70 class LineColorSegment
71 {
72 public:
73 LineColorSegment(LLWString text, LLColor4 color, F32 xpos) : mText(text), mColor(color), mXPosition(xpos) {}
74 public:
75 LLWString mText;
76 LLColor4 mColor;
77 F32 mXPosition;
78 };
79
80 typedef std::list<LineColorSegment> line_color_segments_t;
81
82 //A line is composed of one or more color segments.
83 class Line
84 {
85 public:
86 line_color_segments_t mLineColorSegments;
87 };
88
89 typedef std::list<Line> lines_t;
90 typedef std::list<ParagraphColorSegment> paragraph_color_segments_t;
91
92 //A paragraph is a processed element containing the entire text of the
93 //message (used for recalculating positions on screen resize)
94 //The time this message was added to the console output
95 //The visual screen width of the longest line in this block
96 //And a list of one or more lines which are used to display this message.
97 class Paragraph
98 {
99 public:
100 Paragraph (LLWString str, const LLColor4 &color, F32 add_time, LLFontGL* font, F32 screen_width);
101 void makeParagraphColorSegments ( const LLColor4 &color);
102 void updateLines ( F32 screen_width, LLFontGL* font, bool force_resize=false );
103 public:
104 LLWString mParagraphText; //The entire text of the paragraph
105 paragraph_color_segments_t mParagraphColorSegments;
106 F32 mAddTime; //Time this paragraph was added to the display.
107 F32 mMaxWidth; //Width of the widest line of text in this paragraph.
108 lines_t mLines;
109
110 };
111
112 //The console contains a deque of paragraphs which represent the individual messages.
113 typedef std::deque<Paragraph> paragraph_t;
114 paragraph_t mParagraphs;
115
68 // Font size: 116 // Font size:
69 // -1 = monospace, 0 means small, font size = 1 means big 117 // -1 = monospace, 0 means small, font size = 1 means big
70 LLConsole(const std::string& name, const U32 max_lines, const LLRect &rect, 118 LLConsole(const std::string& name, const U32 max_lines, const LLRect &rect,
71 S32 font_size_index, F32 persist_time ); 119 S32 font_size_index, F32 persist_time );
72 virtual ~LLConsole(); 120 ~LLConsole(){};
73
74 121
75 // each line lasts this long after being added 122 // each line lasts this long after being added
76 void setLinePersistTime(F32 seconds); 123 void setLinePersistTime(F32 seconds);
@@ -80,15 +127,13 @@ public:
80 // -1 = monospace, 0 means small, font size = 1 means big 127 // -1 = monospace, 0 means small, font size = 1 means big
81 void setFontSize(S32 size_index); 128 void setFontSize(S32 size_index);
82 129
83 void addLine(const LLString& utf8line, F32 size, const LLColor4 &color); 130 void addLine(const std::string& utf8line, F32 size, const LLColor4 &color);
84 void addLine(const LLWString& wline, F32 size, const LLColor4 &color); 131 void addLine(const LLWString& wline, F32 size, const LLColor4 &color);
85 void addQueuedLines();
86 132
87 // Overrides 133 // Overrides
88 /*virtual*/ void draw(); 134 /*virtual*/ void draw();
89 /*virtual*/ void addLine(const LLString& utf8line); 135 /*virtual*/ void addLine(const std::string& utf8line);
90 /*virtual*/ void addLine(const LLWString& line); 136 /*virtual*/ void addLine(const LLWString& line);
91 /*virtual*/ void removeExtraLines();
92}; 137};
93 138
94extern LLConsole* gConsole; 139extern LLConsole* gConsole;