diff options
author | richard <none@none> | 2010-01-22 17:40:28 -0800 |
---|---|---|
committer | richard <none@none> | 2010-01-22 17:40:28 -0800 |
commit | 947398563e8082fae2583d2749b69ad16611eae5 (patch) | |
tree | 61aab38a32e6822d96cc8efe094d41f89b378861 | |
parent | fa891c062ef66410123c66de1ef67b7dcef327db (diff) | |
parent | 955c0cc5a9ab8fb9eda7a6c20cd7bd09c2fd9369 (diff) |
merge
-rw-r--r-- | indra/llcommon/llpointer.h | 1 | ||||
-rw-r--r-- | indra/llcommon/llrefcount.cpp | 11 | ||||
-rw-r--r-- | indra/llcommon/llrefcount.h | 14 | ||||
-rw-r--r-- | indra/llui/llspinctrl.cpp | 16 | ||||
-rw-r--r-- | indra/llui/llspinctrl.h | 5 | ||||
-rw-r--r-- | indra/llui/llstyle.h | 4 | ||||
-rw-r--r-- | indra/llui/lltextbase.cpp | 49 | ||||
-rw-r--r-- | indra/llui/lltextbase.h | 19 | ||||
-rw-r--r-- | indra/llui/lltexteditor.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llui.cpp | 18 | ||||
-rw-r--r-- | indra/llui/lluicolortable.h | 2 | ||||
-rw-r--r-- | indra/llui/lluiimage.cpp | 4 | ||||
-rw-r--r-- | indra/llxuixml/llinitparam.cpp | 12 | ||||
-rw-r--r-- | indra/llxuixml/llinitparam.h | 3 | ||||
-rw-r--r-- | indra/llxuixml/lluicolor.cpp | 14 | ||||
-rw-r--r-- | indra/llxuixml/lluicolor.h | 8 | ||||
-rw-r--r-- | indra/newview/llavatarlist.h | 10 | ||||
-rw-r--r-- | indra/newview/llavatarlistitem.cpp | 88 | ||||
-rw-r--r-- | indra/newview/llavatarlistitem.h | 15 | ||||
-rw-r--r-- | indra/newview/llexpandabletextbox.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llviewertexteditor.cpp | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/widgets/avatar_list_item.xml | 44 |
22 files changed, 195 insertions, 158 deletions
diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index 2c37eadcc6..e6c736a263 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -95,7 +95,6 @@ public: bool notNull() const { return (mPointer != NULL); } operator Type*() const { return mPointer; } - operator const Type*() const { return mPointer; } bool operator !=(Type* ptr) const { return (mPointer != ptr); } bool operator ==(Type* ptr) const { return (mPointer == ptr); } bool operator ==(const LLPointer<Type>& ptr) const { return (mPointer == ptr.mPointer); } diff --git a/indra/llcommon/llrefcount.cpp b/indra/llcommon/llrefcount.cpp index 33b6875fb0..c90b52f482 100644 --- a/indra/llcommon/llrefcount.cpp +++ b/indra/llcommon/llrefcount.cpp @@ -35,6 +35,17 @@ #include "llerror.h" +LLRefCount::LLRefCount(const LLRefCount& other) +: mRef(0) +{ +} + +LLRefCount& LLRefCount::operator=(const LLRefCount&) +{ + // do nothing, since ref count is specific to *this* reference + return *this; +} + LLRefCount::LLRefCount() : mRef(0) { diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h index 9ab844eb22..a18f6706a9 100644 --- a/indra/llcommon/llrefcount.h +++ b/indra/llcommon/llrefcount.h @@ -41,22 +41,20 @@ class LL_COMMON_API LLRefCount { -private: - LLRefCount(const LLRefCount& other); // no implementation -private: - LLRefCount& operator=(const LLRefCount&); // no implementation protected: + LLRefCount(const LLRefCount& other); + LLRefCount& operator=(const LLRefCount&); virtual ~LLRefCount(); // use unref() public: LLRefCount(); - void ref() + void ref() const { mRef++; } - S32 unref() + S32 unref() const { llassert(mRef >= 1); if (0 == --mRef) @@ -67,13 +65,15 @@ public: return mRef; } + //NOTE: when passing around a const LLRefCount object, this can return different results + // at different types, since mRef is mutable S32 getNumRefs() const { return mRef; } private: - S32 mRef; + mutable S32 mRef; }; #endif diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index 20a1ab7af3..28f3788817 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -270,13 +270,19 @@ void LLSpinCtrl::clear() mbHasBeenSet = FALSE; } - +void LLSpinCtrl::updateLabelColor() +{ + if( mLabelBox ) + { + mLabelBox->setColor( getEnabled() ? mTextEnabledColor.get() : mTextDisabledColor.get() ); + } +} void LLSpinCtrl::updateEditor() { LLLocale locale(LLLocale::USER_LOCALE); - // Don't display very small negative values as -0.000 + // Don't display very small negative valu es as -0.000 F32 displayed_value = clamp_precision((F32)getValue().asReal(), mPrecision); // if( S32( displayed_value * pow( 10, mPrecision ) ) == 0 ) @@ -339,10 +345,7 @@ void LLSpinCtrl::setEnabled(BOOL b) { LLView::setEnabled( b ); mEditor->setEnabled( b ); - if( mLabelBox ) - { - mLabelBox->setColor( b ? mTextEnabledColor.get() : mTextDisabledColor.get() ); - } + updateLabelColor(); } @@ -390,6 +393,7 @@ void LLSpinCtrl::setLabel(const LLStringExplicit& label) { llwarns << "Attempting to set label on LLSpinCtrl constructed without one " << getName() << llendl; } + updateLabelColor(); } void LLSpinCtrl::setAllowEdit(BOOL allow_edit) diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h index 0e610b7741..00d6f86f83 100644 --- a/indra/llui/llspinctrl.h +++ b/indra/llui/llspinctrl.h @@ -81,8 +81,8 @@ public: virtual void setPrecision(S32 precision); void setLabel(const LLStringExplicit& label); - void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; } - void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; } + void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; updateLabelColor(); } + void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; updateLabelColor();} void setAllowEdit(BOOL allow_edit); virtual void onTabInto(); @@ -103,6 +103,7 @@ public: void onDownBtn(const LLSD& data); private: + void updateLabelColor(); void updateEditor(); void reportInvalidData(); diff --git a/indra/llui/llstyle.h b/indra/llui/llstyle.h index ee9ca730e9..2067e8e8be 100644 --- a/indra/llui/llstyle.h +++ b/indra/llui/llstyle.h @@ -59,11 +59,12 @@ public: void setColor(const LLColor4 &color) { mColor = color; } const LLColor4& getReadOnlyColor() const { return mReadOnlyColor; } + void setReadOnlyColor(const LLColor4& color) { mReadOnlyColor = color; } BOOL isVisible() const; void setVisible(BOOL is_visible); - LLFontGL::ShadowType getShadowType() { return mDropShadow; } + LLFontGL::ShadowType getShadowType() const { return mDropShadow; } void setFont(const LLFontGL* font); const LLFontGL* getFont() const; @@ -116,5 +117,6 @@ private: }; typedef LLPointer<LLStyle> LLStyleSP; +typedef LLPointer<const LLStyle> LLStyleConstSP; #endif // LL_LLSTYLE_H diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 17aecaf32f..885a830c9f 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -291,9 +291,13 @@ bool LLTextBase::truncate() return did_truncate; } -LLStyle::Params LLTextBase::getDefaultStyle() +LLStyle::Params LLTextBase::getDefaultStyleParams() { - return LLStyle::Params().color(mFgColor.get()).readonly_color(mReadOnlyFgColor.get()).font(mDefaultFont).drop_shadow(mFontShadow); + return LLStyle::Params() + .color(LLUIColor(&mFgColor)) + .readonly_color(LLUIColor(&mReadOnlyFgColor)) + .font(mDefaultFont) + .drop_shadow(mFontShadow); } void LLTextBase::onValueChange(S32 start, S32 end) @@ -619,7 +623,7 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s else { // create default editable segment to hold new text - default_segment = new LLNormalTextSegment( new LLStyle(getDefaultStyle()), pos, pos + insert_len, *this); + default_segment = new LLNormalTextSegment( LLStyleConstSP(new LLStyle(getDefaultStyleParams())), pos, pos + insert_len, *this); } // shift remaining segments to right @@ -743,7 +747,7 @@ void LLTextBase::createDefaultSegment() // ensures that there is always at least one segment if (mSegments.empty()) { - LLTextSegmentPtr default_segment = new LLNormalTextSegment( new LLStyle(getDefaultStyle()), 0, getLength() + 1, *this); + LLTextSegmentPtr default_segment = new LLNormalTextSegment( LLStyleConstSP(new LLStyle(getDefaultStyleParams())), 0, getLength() + 1, *this); mSegments.insert(default_segment); default_segment->linkToDocument(this); } @@ -1510,16 +1514,7 @@ std::string LLTextBase::getText() const void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, const LLStyle::Params& input_params) { LLStyle::Params style_params(input_params); - style_params.fillFrom(getDefaultStyle()); - - if (!style_params.font.isProvided()) - { - style_params.font = mDefaultFont; - } - if (!style_params.drop_shadow.isProvided()) - { - style_params.drop_shadow = mFontShadow; - } + style_params.fillFrom(getDefaultStyleParams()); S32 part = (S32)LLTextParser::WHOLE; if(mParseHTML) @@ -1536,13 +1531,7 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c LLStyle::Params link_params = style_params; link_params.color = match.getColor(); link_params.readonly_color = match.getColor(); - // apply font name from requested style_params - std::string font_name = LLFontGL::nameFromFont(style_params.font()); - std::string font_size = LLFontGL::sizeFromFont(style_params.font()); - link_params.font.name(font_name); - link_params.font.size(font_size); link_params.font.style("UNDERLINE"); - link_params.link_href = match.getUrl(); // output the text before the Url @@ -1611,9 +1600,9 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c } } -void LLTextBase::appendAndHighlightText(const std::string &new_text, bool prepend_newline, S32 highlight_part, const LLStyle::Params& stylep) +void LLTextBase::appendAndHighlightText(const std::string &new_text, bool prepend_newline, S32 highlight_part, const LLStyle::Params& style_params) { - if (new_text.empty()) return; + if (new_text.empty()) return; // Save old state S32 selection_start = mSelectionStart; @@ -1631,7 +1620,7 @@ void LLTextBase::appendAndHighlightText(const std::string &new_text, bool prepen if (mParseHighlights && highlight) { - LLStyle::Params highlight_params = stylep; + LLStyle::Params highlight_params(style_params); LLSD pieces = highlight->parsePartialLineHighlights(new_text, highlight_params.color(), (LLTextParser::EHighlightPosition)highlight_part); for (S32 i = 0; i < pieces.size(); i++) @@ -1651,7 +1640,7 @@ void LLTextBase::appendAndHighlightText(const std::string &new_text, bool prepen wide_text = utf8str_to_wstring(pieces[i]["text"].asString()); } S32 cur_length = getLength(); - LLTextSegmentPtr segmentp = new LLNormalTextSegment(new LLStyle(highlight_params), cur_length, cur_length + wide_text.size(), *this); + LLTextSegmentPtr segmentp = new LLNormalTextSegment(LLStyleConstSP(new LLStyle(highlight_params)), cur_length, cur_length + wide_text.size(), *this); segment_vec_t segments; segments.push_back(segmentp); insertStringNoUndo(cur_length, wide_text, &segments); @@ -1675,7 +1664,7 @@ void LLTextBase::appendAndHighlightText(const std::string &new_text, bool prepen segment_vec_t segments; S32 segment_start = old_length; S32 segment_end = old_length + wide_text.size(); - segments.push_back(new LLNormalTextSegment(new LLStyle(stylep), segment_start, segment_end, *this )); + segments.push_back(new LLNormalTextSegment(LLStyleConstSP(new LLStyle(style_params)), segment_start, segment_end, *this )); insertStringNoUndo(getLength(), wide_text, &segments); } @@ -1719,7 +1708,7 @@ void LLTextBase::replaceUrlLabel(const std::string &url, for (it = mSegments.begin(); it != mSegments.end(); ++it) { LLTextSegment *seg = *it; - const LLStyleSP style = seg->getStyle(); + LLStyleConstSP style = seg->getStyle(); // update segment start/end length in case we replaced text earlier S32 seg_length = seg->getEnd() - seg->getStart(); @@ -2212,9 +2201,9 @@ bool LLTextSegment::canEdit() const { return false; } void LLTextSegment::unlinkFromDocument(LLTextBase*) {} void LLTextSegment::linkToDocument(LLTextBase*) {} const LLColor4& LLTextSegment::getColor() const { return LLColor4::white; } -void LLTextSegment::setColor(const LLColor4 &color) {} -const LLStyleSP LLTextSegment::getStyle() const {static LLStyleSP sp(new LLStyle()); return sp; } -void LLTextSegment::setStyle(const LLStyleSP &style) {} +//void LLTextSegment::setColor(const LLColor4 &color) {} +LLStyleConstSP LLTextSegment::getStyle() const {static LLStyleConstSP sp(new LLStyle()); return sp; } +void LLTextSegment::setStyle(LLStyleConstSP &style) {} void LLTextSegment::setToken( LLKeywordToken* token ) {} LLKeywordToken* LLTextSegment::getToken() const { return NULL; } void LLTextSegment::setToolTip( const std::string &msg ) {} @@ -2239,7 +2228,7 @@ BOOL LLTextSegment::hasMouseCapture() { return FALSE; } // LLNormalTextSegment // -LLNormalTextSegment::LLNormalTextSegment( const LLStyleSP& style, S32 start, S32 end, LLTextBase& editor ) +LLNormalTextSegment::LLNormalTextSegment( LLStyleConstSP& style, S32 start, S32 end, LLTextBase& editor ) : LLTextSegment(start, end), mStyle( style ), mToken(NULL), diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 038b9eaa62..5526667166 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -184,7 +184,6 @@ public: bool scrolledToEnd(); const LLFontGL* getDefaultFont() const { return mDefaultFont; } - LLStyle::Params getDefaultStyle(); public: // Fired when a URL link is clicked @@ -281,7 +280,8 @@ protected: void createDefaultSegment(); virtual void updateSegments(); void insertSegment(LLTextSegmentPtr segment_to_insert); - + LLStyle::Params getDefaultStyleParams(); + // manage lines S32 getLineStart( S32 line ) const; S32 getLineEnd( S32 line ) const; @@ -388,9 +388,9 @@ public: virtual void linkToDocument(class LLTextBase* editor); virtual const LLColor4& getColor() const; - virtual void setColor(const LLColor4 &color); - virtual const LLStyleSP getStyle() const; - virtual void setStyle(const LLStyleSP &style); + //virtual void setColor(const LLColor4 &color); + virtual LLStyleConstSP getStyle() const; + virtual void setStyle(LLStyleConstSP &style); virtual void setToken( LLKeywordToken* token ); virtual LLKeywordToken* getToken() const; virtual void setToolTip(const std::string& tooltip); @@ -426,7 +426,7 @@ protected: class LLNormalTextSegment : public LLTextSegment { public: - LLNormalTextSegment( const LLStyleSP& style, S32 start, S32 end, LLTextBase& editor ); + LLNormalTextSegment( LLStyleConstSP& style, S32 start, S32 end, LLTextBase& editor ); LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE); ~LLNormalTextSegment(); @@ -436,9 +436,8 @@ public: /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect); /*virtual*/ bool canEdit() const { return true; } /*virtual*/ const LLColor4& getColor() const { return mStyle->getColor(); } - /*virtual*/ void setColor(const LLColor4 &color) { mStyle->setColor(color); } - /*virtual*/ const LLStyleSP getStyle() const { return mStyle; } - /*virtual*/ void setStyle(const LLStyleSP &style) { mStyle = style; } + /*virtual*/ LLStyleConstSP getStyle() const { return mStyle; } + /*virtual*/ void setStyle(LLStyleConstSP &style) { mStyle = style; } /*virtual*/ void setToken( LLKeywordToken* token ) { mToken = token; } /*virtual*/ LLKeywordToken* getToken() const { return mToken; } /*virtual*/ BOOL getToolTip( std::string& msg ) const; @@ -456,7 +455,7 @@ protected: protected: class LLTextBase& mEditor; - LLStyleSP mStyle; + LLStyleConstSP mStyle; S32 mFontHeight; LLKeywordToken* mToken; std::string mTooltip; diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index f2c3879a6c..93ce7a4bea 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2390,7 +2390,7 @@ void LLTextEditor::replaceUrlLabel(const std::string &url, for (it = mSegments.begin(); it != mSegments.end(); ++it) { LLTextSegment *seg = *it; - const LLStyleSP style = seg->getStyle(); + LLStyleConstSP style = seg->getStyle(); // update segment start/end length in case we replaced text earlier S32 seg_length = seg->getEnd() - seg->getStart(); @@ -2559,13 +2559,15 @@ void LLTextEditor::updateLinkSegments() // if the link's label (what the user can edit) is a valid Url, // then update the link's HREF to be the same as the label text. // This lets users edit Urls in-place. - LLStyleSP style = static_cast<LLStyleSP>(segment->getStyle()); + LLStyleConstSP style = segment->getStyle(); + LLStyle* new_style = new LLStyle(*style); LLWString url_label = wtext.substr(segment->getStart(), segment->getEnd()-segment->getStart()); if (LLUrlRegistry::instance().hasUrl(url_label)) { std::string new_url = wstring_to_utf8str(url_label); LLStringUtil::trim(new_url); - style->setLinkHREF(new_url); + new_style->setLinkHREF(new_url); + segment->setStyle(LLStyleConstSP(new_style)); } } } diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index d0ed3b6fca..76f07373b4 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1911,10 +1911,10 @@ namespace LLInitParam void TypedParam<LLUIColor>::setBlockFromValue() { LLColor4 color = mData.mValue.get(); - red = color.mV[VRED]; - green = color.mV[VGREEN]; - blue = color.mV[VBLUE]; - alpha = color.mV[VALPHA]; + red.set(color.mV[VRED], false); + green.set(color.mV[VGREEN], false); + blue.set(color.mV[VBLUE], false); + alpha.set(color.mV[VALPHA], false); control.set("", false); } @@ -1965,9 +1965,9 @@ namespace LLInitParam { if (mData.mValue) { - name = LLFontGL::nameFromFont(mData.mValue); - size = LLFontGL::sizeFromFont(mData.mValue); - style = LLFontGL::getStringFromStyle(mData.mValue->getFontDesc().getStyle()); + name.set(LLFontGL::nameFromFont(mData.mValue), false); + size.set(LLFontGL::sizeFromFont(mData.mValue), false); + style.set(LLFontGL::getStringFromStyle(mData.mValue->getFontDesc().getStyle()), false); } } @@ -2073,8 +2073,8 @@ namespace LLInitParam void TypedParam<LLCoordGL>::setBlockFromValue() { - x = mData.mValue.mX; - y = mData.mValue.mY; + x.set(mData.mValue.mX, false); + y.set(mData.mValue.mY, false); } diff --git a/indra/llui/lluicolortable.h b/indra/llui/lluicolortable.h index 59be0c4f9a..c87695f456 100644 --- a/indra/llui/lluicolortable.h +++ b/indra/llui/lluicolortable.h @@ -94,7 +94,7 @@ private: bool loadFromFilename(const std::string& filename); // consider using sorted vector, can be much faster - typedef std::map<std::string, LLColor4> string_color_map_t; + typedef std::map<std::string, LLUIColor> string_color_map_t; void clearTable(string_color_map_t& table); void setColor(const std::string& name, const LLColor4& color, string_color_map_t& table); diff --git a/indra/llui/lluiimage.cpp b/indra/llui/lluiimage.cpp index 966d919dc7..8cd6460b66 100644 --- a/indra/llui/lluiimage.cpp +++ b/indra/llui/lluiimage.cpp @@ -182,11 +182,11 @@ namespace LLInitParam { if (mData.mValue == NULL) { - name = "none"; + name.set("none", false); } else { - name = mData.mValue->getName(); + name.set(mData.mValue->getName(), false); } } diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llxuixml/llinitparam.cpp index 4c050844f8..424a9fae8e 100644 --- a/indra/llxuixml/llinitparam.cpp +++ b/indra/llxuixml/llinitparam.cpp @@ -84,8 +84,7 @@ namespace LLInitParam // BaseBlock // BaseBlock::BaseBlock() - : mLastChangedParam(0), - mChangeVersion(0) + : mChangeVersion(0) {} BaseBlock::~BaseBlock() @@ -347,7 +346,6 @@ namespace LLInitParam if (deserialize_func && deserialize_func(*paramp, p, name_stack, name_stack.first == name_stack.second ? -1 : name_stack.first->second)) { - mLastChangedParam = (*it)->mParamHandle; return true; } } @@ -416,8 +414,10 @@ namespace LLInitParam void BaseBlock::setLastChangedParam(const Param& last_param, bool user_provided) { - mLastChangedParam = getHandleFromParam(&last_param); - mChangeVersion++; + if (user_provided) + { + mChangeVersion++; + } } const std::string& BaseBlock::getParamName(const BlockDescriptor& block_data, const Param* paramp) const @@ -471,7 +471,6 @@ namespace LLInitParam { Param* paramp = getParamFromHandle(it->mParamHandle); param_changed |= merge_func(*paramp, *other_paramp, true); - mLastChangedParam = it->mParamHandle; } } return param_changed; @@ -492,7 +491,6 @@ namespace LLInitParam { Param* paramp = getParamFromHandle(it->mParamHandle); param_changed |= merge_func(*paramp, *other_paramp, false); - mLastChangedParam = it->mParamHandle; } } return param_changed; diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 7e1e4a3d21..529fae18c0 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -470,7 +470,6 @@ namespace LLInitParam // Blocks can override this to do custom tracking of changes virtual void setLastChangedParam(const Param& last_param, bool user_provided); - const Param* getLastChangedParam() const { return mLastChangedParam ? getParamFromHandle(mLastChangedParam) : NULL; } S32 getLastChangeVersion() const { return mChangeVersion; } bool isDefault() const { return mChangeVersion == 0; } @@ -505,7 +504,6 @@ namespace LLInitParam bool fillFromImpl(BlockDescriptor& block_data, const BaseBlock& other); // can be updated in getters - mutable param_handle_t mLastChangedParam; mutable S32 mChangeVersion; BlockDescriptor* mBlockDescriptor; // most derived block descriptor @@ -1732,6 +1730,7 @@ namespace LLInitParam void set(value_assignment_t val, bool flag_as_provided = true) { Param::enclosingBlock().setLastChangedParam(*this, flag_as_provided); + // set param version number to be up to date, so we ignore block contents mData.mLastParamVersion = BaseBlock::getLastChangeVersion(); diff --git a/indra/llxuixml/lluicolor.cpp b/indra/llxuixml/lluicolor.cpp index 424d878a6b..0049ec055c 100644 --- a/indra/llxuixml/lluicolor.cpp +++ b/indra/llxuixml/lluicolor.cpp @@ -16,13 +16,15 @@ LLUIColor::LLUIColor() { } -LLUIColor::LLUIColor(const LLColor4* color) - :mColorPtr(color) + +LLUIColor::LLUIColor(const LLColor4& color) +: mColor(color), + mColorPtr(NULL) { } -LLUIColor::LLUIColor(const LLColor4& color) - :mColor(color), mColorPtr(NULL) +LLUIColor::LLUIColor(const LLUIColor* color) +: mColorPtr(color) { } @@ -32,14 +34,14 @@ void LLUIColor::set(const LLColor4& color) mColorPtr = NULL; } -void LLUIColor::set(const LLColor4* color) +void LLUIColor::set(const LLUIColor* color) { mColorPtr = color; } const LLColor4& LLUIColor::get() const { - return (mColorPtr == NULL ? mColor : *mColorPtr); + return (mColorPtr == NULL ? mColor : mColorPtr->get()); } LLUIColor::operator const LLColor4& () const diff --git a/indra/llxuixml/lluicolor.h b/indra/llxuixml/lluicolor.h index bb0f786326..0ef2f78b24 100644 --- a/indra/llxuixml/lluicolor.h +++ b/indra/llxuixml/lluicolor.h @@ -22,11 +22,11 @@ class LLUIColor { public: LLUIColor(); - LLUIColor(const LLColor4* color); LLUIColor(const LLColor4& color); + LLUIColor(const LLUIColor* color); void set(const LLColor4& color); - void set(const LLColor4* color); + void set(const LLUIColor* color); const LLColor4& get() const; @@ -38,7 +38,7 @@ public: private: friend struct LLInitParam::ParamCompare<LLUIColor, false>; - const LLColor4* mColorPtr; + const LLUIColor* mColorPtr; LLColor4 mColor; }; @@ -47,7 +47,7 @@ namespace LLInitParam template<> struct ParamCompare<LLUIColor, false> { - static bool equals(const class LLUIColor& a, const class LLUIColor& b); + static bool equals(const LLUIColor& a, const LLUIColor& b); }; } diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h index a58a562378..aeed4fee08 100644 --- a/indra/newview/llavatarlist.h +++ b/indra/newview/llavatarlist.h @@ -57,11 +57,11 @@ public: struct Params : public LLInitParam::Block<Params, LLFlatListView::Params> { - Optional<bool> ignore_online_status; // show all items as online - Optional<bool> show_last_interaction_time; // show most recent interaction time. *HACK: move this to a derived class - Optional<bool> show_info_btn; - Optional<bool> show_profile_btn; - Optional<bool> show_speaking_indicator; + Optional<bool> ignore_online_status, // show all items as online + show_last_interaction_time, // show most recent interaction time. *HACK: move this to a derived class + show_info_btn, + show_profile_btn, + show_speaking_indicator; Params(); }; diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 66ab32f3e8..26a39532dd 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -48,6 +48,17 @@ S32 LLAvatarListItem::sLeftPadding = 0; S32 LLAvatarListItem::sRightNamePadding = 0; S32 LLAvatarListItem::sChildrenWidths[LLAvatarListItem::ALIC_COUNT]; +static LLWidgetNameRegistry::StaticRegistrar sRegisterAvatarListItemParams(&typeid(LLAvatarListItem::Params), "avatar_list_item"); + +LLAvatarListItem::Params::Params() +: default_style("default_style"), + voice_call_invited_style("voice_call_invited_style"), + voice_call_joined_style("voice_call_joined_style"), + voice_call_left_style("voice_call_left_style"), + online_style("online_style"), + offline_style("offline_style") +{}; + LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/) : LLPanel(), @@ -166,9 +177,30 @@ void LLAvatarListItem::setHighlight(const std::string& highlight) void LLAvatarListItem::setState(EItemState item_style) { - item_style_map_t& item_styles_params_map = getItemStylesParams(); + const LLAvatarListItem::Params& params = LLUICtrlFactory::getDefaultParams<LLAvatarListItem>(); - mAvatarNameStyle = item_styles_params_map[item_style]; + switch(item_style) + { + default: + case IS_DEFAULT: + mAvatarNameStyle = params.default_style(); + break; + case IS_VOICE_INVITED: + mAvatarNameStyle = params.voice_call_invited_style(); + break; + case IS_VOICE_JOINED: + mAvatarNameStyle = params.voice_call_joined_style(); + break; + case IS_VOICE_LEFT: + mAvatarNameStyle = params.voice_call_left_style(); + break; + case IS_ONLINE: + mAvatarNameStyle = params.online_style(); + break; + case IS_OFFLINE: + mAvatarNameStyle = params.offline_style(); + break; + } // *NOTE: You cannot set the style on a text box anymore, you must // rebuild the text. This will cause problems if the text contains @@ -353,58 +385,6 @@ std::string LLAvatarListItem::formatSeconds(U32 secs) } // static -LLAvatarListItem::item_style_map_t& LLAvatarListItem::getItemStylesParams() -{ - static item_style_map_t item_styles_params_map; - if (!item_styles_params_map.empty()) return item_styles_params_map; - - LLPanel::Params params = LLUICtrlFactory::getDefaultParams<LLPanel>(); - LLPanel* params_panel = LLUICtrlFactory::create<LLPanel>(params); - - BOOL sucsess = LLUICtrlFactory::instance().buildPanel(params_panel, "panel_avatar_list_item_params.xml"); - - if (sucsess) - { - - item_styles_params_map.insert( - std::make_pair(IS_DEFAULT, - params_panel->getChild<LLTextBox>("default_style")->getDefaultStyle())); - - item_styles_params_map.insert( - std::make_pair(IS_VOICE_INVITED, - params_panel->getChild<LLTextBox>("voice_call_invited_style")->getDefaultStyle())); - - item_styles_params_map.insert( - std::make_pair(IS_VOICE_JOINED, - params_panel->getChild<LLTextBox>("voice_call_joined_style")->getDefaultStyle())); - - item_styles_params_map.insert( - std::make_pair(IS_VOICE_LEFT, - params_panel->getChild<LLTextBox>("voice_call_left_style")->getDefaultStyle())); - - item_styles_params_map.insert( - std::make_pair(IS_ONLINE, - params_panel->getChild<LLTextBox>("online_style")->getDefaultStyle())); - - item_styles_params_map.insert( - std::make_pair(IS_OFFLINE, - params_panel->getChild<LLTextBox>("offline_style")->getDefaultStyle())); - } - else - { - item_styles_params_map.insert(std::make_pair(IS_DEFAULT, LLStyle::Params())); - item_styles_params_map.insert(std::make_pair(IS_VOICE_INVITED, LLStyle::Params())); - item_styles_params_map.insert(std::make_pair(IS_VOICE_JOINED, LLStyle::Params())); - item_styles_params_map.insert(std::make_pair(IS_VOICE_LEFT, LLStyle::Params())); - item_styles_params_map.insert(std::make_pair(IS_ONLINE, LLStyle::Params())); - item_styles_params_map.insert(std::make_pair(IS_OFFLINE, LLStyle::Params())); - } - if (params_panel) params_panel->die(); - - return item_styles_params_map; -} - -// static LLAvatarListItem::icon_color_map_t& LLAvatarListItem::getItemIconColorMap() { static icon_color_map_t item_icon_color_map; diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index 479a4833cb..9f81aa0804 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -46,6 +46,18 @@ class LLAvatarIconCtrl; class LLAvatarListItem : public LLPanel, public LLFriendObserver { public: + struct Params : public LLInitParam::Block<Params, LLPanel::Params> + { + Optional<LLStyle::Params> default_style, + voice_call_invited_style, + voice_call_joined_style, + voice_call_left_style, + online_style, + offline_style; + + Params(); + }; + typedef enum e_item_state_type { IS_DEFAULT, IS_VOICE_INVITED, @@ -143,9 +155,6 @@ private: std::string formatSeconds(U32 secs); - typedef std::map<EItemState, LLStyle::Params> item_style_map_t; - static item_style_map_t& getItemStylesParams(); - typedef std::map<EItemState, LLColor4> icon_color_map_t; static icon_color_map_t& getItemIconColorMap(); diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp index 9f6412c0ab..77b3a48cef 100644 --- a/indra/newview/llexpandabletextbox.cpp +++ b/indra/newview/llexpandabletextbox.cpp @@ -169,8 +169,7 @@ void LLExpandableTextBox::LLTextBoxEx::showExpandText() std::pair<S32, S32> visible_lines = getVisibleLines(true); S32 last_line = visible_lines.second - 1; - LLStyle::Params expander_style = getDefaultStyle(); - expander_style.font.name(LLFontGL::nameFromFont(expander_style.font)); + LLStyle::Params expander_style(getDefaultStyleParams()); expander_style.font.style = "UNDERLINE"; expander_style.color = LLUIColorTable::instance().getColor("HTMLLinkColor"); LLExpanderSegment* expanderp = new LLExpanderSegment(new LLStyle(expander_style), getLineStart(last_line), getLength() + 1, mExpanderLabel, *this); @@ -186,8 +185,7 @@ void LLExpandableTextBox::LLTextBoxEx::hideExpandText() if (mExpanderVisible) { // this will overwrite the expander segment and all text styling with a single style - LLNormalTextSegment* segmentp = new LLNormalTextSegment( - new LLStyle(getDefaultStyle()), 0, getLength() + 1, *this); + LLNormalTextSegment* segmentp = new LLNormalTextSegment(LLStyleConstSP(new LLStyle(getDefaultStyleParams())), 0, getLength() + 1, *this); insertSegment(segmentp); mExpanderVisible = false; diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 2e92512b31..ea8af223c3 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -246,7 +246,7 @@ public: return FALSE; } - /*virtual*/ const LLStyleSP getStyle() const { return mStyle; } + /*virtual*/ LLStyleConstSP getStyle() const { return mStyle; } private: LLUIImagePtr mImage; diff --git a/indra/newview/skins/default/xui/en/widgets/avatar_list_item.xml b/indra/newview/skins/default/xui/en/widgets/avatar_list_item.xml new file mode 100644 index 0000000000..ed8df69bf4 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/avatar_list_item.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<avatar_list_item + height="0" + layout="topleft" + left="0" + name="avatar_list_item" + top="0" + width="0"> + <!-- DEFAULT styles for avatar item --> + <default_style + font="SansSerifSmall" + font.style="NORMAL" + color="DkGray"/> + + <!-- styles for avatar item INVITED to voice call --> + <voice_call_invited_style + font="SansSerifSmall" + font.style="NORMAL" + color="0.5 0.5 0.5 0.5"/> + + <!-- styles for avatar item JOINED to voice call --> + <voice_call_joined_style + font="SansSerifSmall" + font.style="NORMAL" + color="white"/> + + <!-- styles for avatar item which HAS LEFT voice call --> + <voice_call_left_style + font="SansSerifSmall" + font.style="ITALIC" + color="LtGray_50"/> + + <!-- styles for ONLINE avatar item --> + <online_style + font="SansSerifSmall" + font.style="NORMAL" + color="white"/> + + <!-- styles for OFFLINE avatar item --> + <offline_style + font="SansSerifSmall" + font.style="NORMAL" + color="0.5 0.5 0.5 1.0"/> +</avatar_list_item> |