diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llconsole.cpp | 59 | ||||
-rw-r--r-- | indra/llui/llconsole.h | 11 | ||||
-rw-r--r-- | indra/llui/llmultisliderctrl.cpp | 4 | ||||
-rw-r--r-- | indra/llui/lltabcontainer.cpp | 1 | ||||
-rw-r--r-- | indra/llui/lltexteditor.cpp | 2 | ||||
-rw-r--r-- | indra/llui/lltexteditor.h | 2 | ||||
-rw-r--r-- | indra/llui/lluicolortable.cpp | 29 | ||||
-rw-r--r-- | indra/llui/lluicolortable.h | 9 |
8 files changed, 67 insertions, 50 deletions
diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index 0237c80efa..a4f69e7ac1 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,45 @@ 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 ); + LLInstanceTrackerScopedGuard guard; + + for (instance_iter it = guard.beginInstances(); it != guard.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/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index cb81c39103..50942e55ca 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -331,6 +331,10 @@ void LLMultiSliderCtrl::updateText() void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata) { LLMultiSliderCtrl* self = dynamic_cast<LLMultiSliderCtrl*>(ctrl->getParent()); + llassert(self); + if (!self) // cast failed - wrong type! :O + return; + if (!ctrl) return; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 2ec56d6089..fe699cfa01 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -119,6 +119,7 @@ protected: LLCustomButtonIconCtrl(const Params& p): LLButton(p), mIcon(NULL), + mIconAlignment(LLFontGL::HCENTER), mIconCtrlPad(p.icon_ctrl_pad) {} diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index ad9f066539..ce5f1bd082 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -737,7 +737,7 @@ BOOL LLTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) } if (!LLTextBase::handleRightMouseDown(x, y, mask)) { - if(getChowContextMenu()) + if(getShowContextMenu()) { showContextMenu(x, y); } diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 00c6a8b68a..71d937b2c4 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -204,7 +204,7 @@ public: void getSelectedSegments(segment_vec_t& segments) const; void setShowContextMenu(bool show) { mShowContextMenu = show; } - bool getChowContextMenu() const { return mShowContextMenu; } + bool getShowContextMenu() const { return mShowContextMenu; } protected: void showContextMenu(S32 x, S32 y); diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp index 9be33483d0..1b64ef3abe 100644 --- a/indra/llui/lluicolortable.cpp +++ b/indra/llui/lluicolortable.cpp @@ -56,7 +56,7 @@ LLUIColorTable::Params::Params() { } -void LLUIColorTable::insertFromParams(const Params& p) +void LLUIColorTable::insertFromParams(const Params& p, string_color_map_t& table) { // this map will contain all color references after the following loop typedef std::map<std::string, std::string> string_string_map_t; @@ -69,14 +69,7 @@ void LLUIColorTable::insertFromParams(const Params& p) ColorEntryParams color_entry = *it; if(color_entry.color.value.isChosen()) { - if(mUserSetColors.find(color_entry.name)!=mUserSetColors.end()) - { - setColor(color_entry.name, color_entry.color.value); - } - else - { - setColor(color_entry.name, color_entry.color.value, mLoadedColors); - } + setColor(color_entry.name, color_entry.color.value, table); } else { @@ -220,16 +213,16 @@ bool LLUIColorTable::loadFromSettings() bool result = false; std::string default_filename = gDirUtilp->getExpandedFilename(LL_PATH_DEFAULT_SKIN, "colors.xml"); - result |= loadFromFilename(default_filename); + result |= loadFromFilename(default_filename, mLoadedColors); std::string current_filename = gDirUtilp->getExpandedFilename(LL_PATH_TOP_SKIN, "colors.xml"); if(current_filename != default_filename) { - result |= loadFromFilename(current_filename); + result |= loadFromFilename(current_filename, mLoadedColors); } std::string user_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "colors.xml"); - loadFromFilename(user_filename); + loadFromFilename(user_filename, mUserSetColors); return result; } @@ -299,7 +292,7 @@ void LLUIColorTable::setColor(const std::string& name, const LLColor4& color, st } } -bool LLUIColorTable::loadFromFilename(const std::string& filename) +bool LLUIColorTable::loadFromFilename(const std::string& filename, string_color_map_t& table) { LLXMLNodePtr root; @@ -320,7 +313,7 @@ bool LLUIColorTable::loadFromFilename(const std::string& filename) if(params.validateBlock()) { - insertFromParams(params); + insertFromParams(params, table); } else { @@ -330,3 +323,11 @@ bool LLUIColorTable::loadFromFilename(const std::string& filename) return true; } + +void LLUIColorTable::insertFromParams(const Params& p) +{ + insertFromParams(p, mUserSetColors); +} + +// EOF + diff --git a/indra/llui/lluicolortable.h b/indra/llui/lluicolortable.h index c87695f456..d401e5e724 100644 --- a/indra/llui/lluicolortable.h +++ b/indra/llui/lluicolortable.h @@ -45,6 +45,10 @@ class LLUIColor; class LLUIColorTable : public LLSingleton<LLUIColorTable> { LOG_CLASS(LLUIColorTable); + + // consider using sorted vector, can be much faster + typedef std::map<std::string, LLUIColor> string_color_map_t; + public: struct ColorParams : LLInitParam::Choice<ColorParams> { @@ -91,10 +95,9 @@ public: void saveUserSettings() const; private: - bool loadFromFilename(const std::string& filename); + bool loadFromFilename(const std::string& filename, string_color_map_t& table); - // consider using sorted vector, can be much faster - typedef std::map<std::string, LLUIColor> string_color_map_t; + void insertFromParams(const Params& p, string_color_map_t& table); void clearTable(string_color_map_t& table); void setColor(const std::string& name, const LLColor4& color, string_color_map_t& table); |