From 337716d946cf4ece8ba59cce82bd51b3c2148f75 Mon Sep 17 00:00:00 2001 From: richard Date: Fri, 22 Jan 2010 16:51:13 -0800 Subject: LLPointer cleanup and fix for EXT-4413 reviewed by Rick --- indra/llui/llspinctrl.cpp | 16 +++++++++------ indra/llui/llspinctrl.h | 5 +++-- indra/llui/llstyle.h | 4 +++- indra/llui/lltextbase.cpp | 49 ++++++++++++++++++--------------------------- indra/llui/lltextbase.h | 19 +++++++++--------- indra/llui/lltexteditor.cpp | 8 +++++--- indra/llui/llui.cpp | 18 ++++++++--------- indra/llui/lluicolortable.h | 2 +- indra/llui/lluiimage.cpp | 4 ++-- 9 files changed, 61 insertions(+), 64 deletions(-) (limited to 'indra/llui') 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 LLStyleSP; +typedef LLPointer 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(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::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::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 string_color_map_t; + typedef std::map 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); } } -- cgit v1.2.3 From 9f44c4df7963b4ae06f4dd86a2078ebe704201f1 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 25 Jan 2010 10:30:57 -0800 Subject: Fix some Linux build breakage - can't treat the return of a constructor call as a ref with gcc, have to use intermediate variable. --- indra/llui/lltextbase.cpp | 15 ++++++++++----- indra/llui/lltexteditor.cpp | 3 ++- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 885a830c9f..a6e410d3e1 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -623,7 +623,8 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s else { // create default editable segment to hold new text - default_segment = new LLNormalTextSegment( LLStyleConstSP(new LLStyle(getDefaultStyleParams())), pos, pos + insert_len, *this); + LLStyleConstSP sp(new LLStyle(getDefaultStyleParams())); + default_segment = new LLNormalTextSegment( sp, pos, pos + insert_len, *this); } // shift remaining segments to right @@ -747,7 +748,8 @@ void LLTextBase::createDefaultSegment() // ensures that there is always at least one segment if (mSegments.empty()) { - LLTextSegmentPtr default_segment = new LLNormalTextSegment( LLStyleConstSP(new LLStyle(getDefaultStyleParams())), 0, getLength() + 1, *this); + LLStyleConstSP sp(new LLStyle(getDefaultStyleParams())); + LLTextSegmentPtr default_segment = new LLNormalTextSegment( sp, 0, getLength() + 1, *this); mSegments.insert(default_segment); default_segment->linkToDocument(this); } @@ -777,7 +779,8 @@ void LLTextBase::insertSegment(LLTextSegmentPtr segment_to_insert) cur_segmentp->setEnd(segment_to_insert->getStart()); // advance to next segment // insert remainder of old segment - LLTextSegmentPtr remainder_segment = new LLNormalTextSegment( cur_segmentp->getStyle(), segment_to_insert->getStart(), old_segment_end, *this); + LLStyleConstSP sp = cur_segmentp->getStyle(); + LLTextSegmentPtr remainder_segment = new LLNormalTextSegment( sp, segment_to_insert->getStart(), old_segment_end, *this); mSegments.insert(cur_seg_iter, remainder_segment); remainder_segment->linkToDocument(this); // insert new segment before remainder of old segment @@ -1640,7 +1643,8 @@ 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(LLStyleConstSP(new LLStyle(highlight_params)), cur_length, cur_length + wide_text.size(), *this); + LLStyleConstSP sp(new LLStyle(highlight_params)); + LLTextSegmentPtr segmentp = new LLNormalTextSegment(sp, cur_length, cur_length + wide_text.size(), *this); segment_vec_t segments; segments.push_back(segmentp); insertStringNoUndo(cur_length, wide_text, &segments); @@ -1664,7 +1668,8 @@ 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(LLStyleConstSP(new LLStyle(style_params)), segment_start, segment_end, *this )); + LLStyleConstSP sp(new LLStyle(style_params)); + segments.push_back(new LLNormalTextSegment(sp, segment_start, segment_end, *this )); insertStringNoUndo(getLength(), wide_text, &segments); } diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 93ce7a4bea..3ea33d5f6a 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2567,7 +2567,8 @@ void LLTextEditor::updateLinkSegments() std::string new_url = wstring_to_utf8str(url_label); LLStringUtil::trim(new_url); new_style->setLinkHREF(new_url); - segment->setStyle(LLStyleConstSP(new_style)); + LLStyleConstSP sp(new_style); + segment->setStyle(sp); } } } -- cgit v1.2.3 From 66e7c2ce7715873bc29437878c5bce1ca0bee27b Mon Sep 17 00:00:00 2001 From: angela Date: Tue, 26 Jan 2010 06:48:42 +0800 Subject: fix mac build failure -- richard --- indra/llui/lltextbase.cpp | 4 ++-- indra/llui/lltextbase.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 885a830c9f..ddbe81a6d4 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2203,7 +2203,7 @@ void LLTextSegment::linkToDocument(LLTextBase*) {} const LLColor4& LLTextSegment::getColor() const { return LLColor4::white; } //void LLTextSegment::setColor(const LLColor4 &color) {} LLStyleConstSP LLTextSegment::getStyle() const {static LLStyleConstSP sp(new LLStyle()); return sp; } -void LLTextSegment::setStyle(LLStyleConstSP &style) {} +void LLTextSegment::setStyle(LLStyleConstSP style) {} void LLTextSegment::setToken( LLKeywordToken* token ) {} LLKeywordToken* LLTextSegment::getToken() const { return NULL; } void LLTextSegment::setToolTip( const std::string &msg ) {} @@ -2228,7 +2228,7 @@ BOOL LLTextSegment::hasMouseCapture() { return FALSE; } // LLNormalTextSegment // -LLNormalTextSegment::LLNormalTextSegment( LLStyleConstSP& 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 5526667166..9fff910173 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -390,7 +390,7 @@ public: virtual const LLColor4& getColor() const; //virtual void setColor(const LLColor4 &color); virtual LLStyleConstSP getStyle() const; - virtual void setStyle(LLStyleConstSP &style); + 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( LLStyleConstSP& 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(); @@ -437,7 +437,7 @@ public: /*virtual*/ bool canEdit() const { return true; } /*virtual*/ const LLColor4& getColor() const { return mStyle->getColor(); } /*virtual*/ LLStyleConstSP getStyle() const { return mStyle; } - /*virtual*/ void setStyle(LLStyleConstSP &style) { mStyle = style; } + /*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; -- cgit v1.2.3 From 20cef655398fa82b99a1b95fec204d209a5672ca Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Tue, 2 Feb 2010 15:27:19 +0200 Subject: changed password's circles to bullets - EXT-4499 Replace "*" glyph in password fields with a proper circle [PATCH INCLUDED] --HG-- branch : product-engine --- indra/llui/lllineeditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index cb5aea272d..eb2b4f7705 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -70,7 +70,7 @@ const S32 SCROLL_INCREMENT_DEL = 4; // make space for baskspacing const F32 AUTO_SCROLL_TIME = 0.05f; const F32 TRIPLE_CLICK_INTERVAL = 0.3f; // delay between double and triple click. *TODO: make this equal to the double click interval? -const std::string PASSWORD_ASTERISK( "\xE2\x97\x8F" ); // U+25CF BLACK CIRCLE +const std::string PASSWORD_ASTERISK( "\xE2\x80\xA2" ); // U+2022 BULLET static LLDefaultChildRegistry::Register r1("line_editor"); -- cgit v1.2.3 From ec5ad98abe0dde6f314bcd8c67a193a672c53aca Mon Sep 17 00:00:00 2001 From: "Eric M. Tulla (BigPapi)" Date: Mon, 1 Feb 2010 15:47:16 -0500 Subject: EXT-4848 - Crash when trying to view chicklet(?). Bug in word wrap logic. Added a clamp to >= 0 for num pixels so we don't hit the assert. -Reviewed by Nyx --- indra/llui/lltextbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 978bd317e2..dfe3e9b61e 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2512,7 +2512,7 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin LLUIImagePtr image = mStyle->getImage(); if( image.notNull()) { - num_pixels -= image->getWidth(); + num_pixels = llmax(0, num_pixels - image->getWidth()); } // search for newline and if found, truncate there -- cgit v1.2.3 From 8dbb2c6fd12bf86492ed1cf08e89fa064a23057b Mon Sep 17 00:00:00 2001 From: richard Date: Mon, 1 Feb 2010 13:50:15 -0800 Subject: removed redundant code --- indra/llui/lltextbase.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 255a95c8eb..0312802b44 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1017,16 +1017,6 @@ void LLTextBase::draw() void LLTextBase::setColor( const LLColor4& c ) { mFgColor = c; - //textsegments have own style property , - //so we have to update it also to apply changes, EXT-4433 - for(segment_set_t::iterator it = mSegments.begin(); it != mSegments.end(); it++) - { - LLTextSegment* segment = it->get(); - if(segment) - { - segment->setColor(mFgColor); - } - } } //virtual -- cgit v1.2.3 From 4ad357ec70e15afdfe78816990cb23c7ba17619c Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Mon, 1 Feb 2010 17:51:30 -0800 Subject: Fixes for EXT-4689 (Long-word chat spam cripples fps and/or disconnects client) Removed some unnecessary string copies in LLTextBase and LLNormalTextSegment by changing getWText() to return const LLWString& (instead of LLWString), and storing the result in a const LLWString& instead of an LLWString in places where the string doesn't need to be modified. Made LLTextViewModel::getDisplay() also return const LLWString& instead of LLWString. Removed a couple of unused local string variables in LLTextBase (the compiler flagged these after converting the local copies to const LLWString&). --- indra/llui/lltextbase.cpp | 13 +++++-------- indra/llui/lltextbase.h | 2 +- indra/llui/llviewmodel.h | 3 ++- 3 files changed, 8 insertions(+), 10 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index a12b7793f7..259522a932 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -312,7 +312,6 @@ void LLTextBase::drawSelectionBackground() // Draw selection even if we don't have keyboard focus for search/replace if( hasSelection() && !mLineInfoList.empty()) { - LLWString text = getWText(); std::vector selection_rects; S32 selection_left = llmin( mSelectionStart, mSelectionEnd ); @@ -411,7 +410,7 @@ void LLTextBase::drawCursor() && gFocusMgr.getAppHasFocus() && !mReadOnly) { - LLWString wtext = getWText(); + const LLWString &wtext = getWText(); const llwchar* text = wtext.c_str(); LLRect cursor_rect = getLocalRectFromDocIndex(mCursorPos); @@ -497,7 +496,6 @@ void LLTextBase::drawCursor() void LLTextBase::drawText() { - LLWString text = getWText(); const S32 text_len = getLength(); if( text_len <= 0 ) { @@ -1116,7 +1114,6 @@ void LLTextBase::reflow(S32 start_index) S32 line_start_index = 0; const S32 text_available_width = mVisibleTextRect.getWidth() - mHPad; // reserve room for margin S32 remaining_pixels = text_available_width; - LLWString text(getWText()); S32 line_count = 0; // find and erase line info structs starting at start_index and going to end of document @@ -1759,7 +1756,7 @@ void LLTextBase::setWText(const LLWString& text) setText(wstring_to_utf8str(text)); } -LLWString LLTextBase::getWText() const +const LLWString& LLTextBase::getWText() const { return getViewModel()->getDisplay(); } @@ -2454,7 +2451,7 @@ bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& widt if (num_chars > 0) { height = mFontHeight; - LLWString text = mEditor.getWText(); + const LLWString &text = mEditor.getWText(); // if last character is a newline, then return true, forcing line break llwchar last_char = text[mStart + first_char + num_chars - 1]; if (last_char == '\n') @@ -2481,7 +2478,7 @@ bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& widt S32 LLNormalTextSegment::getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const { - LLWString text = mEditor.getWText(); + const LLWString &text = mEditor.getWText(); return mStyle->getFont()->charFromPixelOffset(text.c_str(), mStart + start_offset, (F32)segment_local_x_coord, F32_MAX, @@ -2491,7 +2488,7 @@ S32 LLNormalTextSegment::getOffset(S32 segment_local_x_coord, S32 start_offset, S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const { - LLWString text = mEditor.getWText(); + const LLWString &text = mEditor.getWText(); LLUIImagePtr image = mStyle->getImage(); if( image.notNull()) diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 48d5478088..b5c7fab67a 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -145,7 +145,7 @@ public: // wide-char versions void setWText(const LLWString& text); - LLWString getWText() const; + const LLWString& getWText() const; void appendText(const std::string &new_text, bool prepend_newline, const LLStyle::Params& input_params = LLStyle::Params()); // force reflow of text diff --git a/indra/llui/llviewmodel.h b/indra/llui/llviewmodel.h index c8a9b52cca..992365d44d 100644 --- a/indra/llui/llviewmodel.h +++ b/indra/llui/llviewmodel.h @@ -107,7 +107,8 @@ public: // New functions /// Get the stored value in string form - LLWString getDisplay() const { return mDisplay; } + const LLWString& getDisplay() const { return mDisplay; } + /** * Set the display string directly (see LLTextEditor). What the user is * editing is actually the LLWString value rather than the underlying -- cgit v1.2.3 From 38315a063d83bf4dbf90569dbe37a344d91349a7 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 2 Feb 2010 14:25:31 +0200 Subject: Fixed normal bug EXT-4740 - Object inspector hides however context menu present --HG-- branch : product-engine --- indra/llui/lltextbase.cpp | 10 ++++++++++ indra/llui/lltextbase.h | 1 + 2 files changed, 11 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 259522a932..b977e50bc1 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1023,6 +1023,16 @@ void LLTextBase::setReadOnlyColor(const LLColor4 &c) mReadOnlyFgColor = c; } +//virtual +void LLTextBase::handleVisibilityChange( BOOL new_visibility ) +{ + if(!new_visibility && mPopupMenu) + { + mPopupMenu->hide(); + } + LLUICtrl::handleVisibilityChange(new_visibility); +} + //virtual void LLTextBase::setValue(const LLSD& value ) { diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index b5c7fab67a..ed2f239476 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -122,6 +122,7 @@ public: /*virtual*/ BOOL acceptsTextInput() const { return !mReadOnly; } /*virtual*/ void setColor( const LLColor4& c ); virtual void setReadOnlyColor(const LLColor4 &c); + virtual void handleVisibilityChange( BOOL new_visibility ); /*virtual*/ void setValue(const LLSD& value ); /*virtual*/ LLTextViewModel* getViewModel() const; -- cgit v1.2.3 From 371885c37311a772ff76bf2259306c2e58100f36 Mon Sep 17 00:00:00 2001 From: Ychebotarev ProductEngine Date: Tue, 2 Feb 2010 14:35:37 +0200 Subject: fix for normal EXT-4810 Block hot-keys in mouse-look mode --HG-- branch : product-engine --- indra/llui/llfloater.cpp | 4 ++++ indra/llui/llfloaterreg.cpp | 4 ++++ indra/llui/llfloaterreg.h | 3 +++ 3 files changed, 11 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index de46d89d6f..3b3e644d10 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2579,6 +2579,8 @@ void LLFloaterView::pushVisibleAll(BOOL visible, const skip_list_t& skip_list) view->pushVisible(visible); } } + + LLFloaterReg::blockShowFloaters(true); } void LLFloaterView::popVisibleAll(const skip_list_t& skip_list) @@ -2596,6 +2598,8 @@ void LLFloaterView::popVisibleAll(const skip_list_t& skip_list) view->popVisible(); } } + + LLFloaterReg::blockShowFloaters(false); } void LLFloater::setInstanceName(const std::string& name) diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index eb67e3a561..5de3934c8a 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -34,6 +34,7 @@ #include "llfloaterreg.h" +//#include "llagent.h" #include "llfloater.h" #include "llmultifloater.h" #include "llfloaterreglistener.h" @@ -45,6 +46,7 @@ LLFloaterReg::instance_list_t LLFloaterReg::sNullInstanceList; LLFloaterReg::instance_map_t LLFloaterReg::sInstanceMap; LLFloaterReg::build_map_t LLFloaterReg::sBuildMap; std::map LLFloaterReg::sGroupMap; +bool LLFloaterReg::sBlockShowFloaters = false; static LLFloaterRegListener sFloaterRegListener; @@ -217,6 +219,8 @@ LLFloaterReg::const_instance_list_t& LLFloaterReg::getFloaterList(const std::str //static LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, BOOL focus) { + if( sBlockShowFloaters ) + return 0;// LLFloater* instance = getInstance(name, key); if (instance) { diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h index 634a235926..8a11d5c3f2 100644 --- a/indra/llui/llfloaterreg.h +++ b/indra/llui/llfloaterreg.h @@ -75,6 +75,7 @@ private: static instance_map_t sInstanceMap; static build_map_t sBuildMap; static std::map sGroupMap; + static bool sBlockShowFloaters; public: // Registration @@ -152,6 +153,8 @@ public: { return dynamic_cast(showInstance(name, key, focus)); } + + static void blockShowFloaters(bool value) { sBlockShowFloaters = value;} }; -- cgit v1.2.3 From 47162acede25dadae52fb43bd36f57fa26988aa5 Mon Sep 17 00:00:00 2001 From: Denis Serdjuk Date: Tue, 2 Feb 2010 14:49:58 +0200 Subject: no ticket. Removing the hack from llfloater.This code is dangerous. It involved losing of topctrl in focusmgr and can cause strange bugs and problems. --HG-- branch : product-engine --- indra/llui/llfloater.cpp | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 3b3e644d10..a55915af35 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1650,24 +1650,8 @@ void LLFloater::draw() } else { - //FIXME: get rid of this hack - // draw children - LLView* focused_child = dynamic_cast(gFocusMgr.getKeyboardFocus()); - BOOL focused_child_visible = FALSE; - if (focused_child && focused_child->getParent() == this) - { - focused_child_visible = focused_child->getVisible(); - focused_child->setVisible(FALSE); - } - // don't call LLPanel::draw() since we've implemented custom background rendering LLView::draw(); - - if (focused_child_visible) - { - focused_child->setVisible(TRUE); - } - drawChild(focused_child); } // update tearoff button for torn off floaters -- cgit v1.2.3 From e563a07659b74b2dca850834a44c3b92ff993b44 Mon Sep 17 00:00:00 2001 From: Lynx Linden Date: Tue, 2 Feb 2010 17:19:14 +0000 Subject: DEV-32540: Lots of object IM and SLurl improvements - Don't let object names that are URLs override links to display the remote object inspector - Don't hyperlink the object name in the remote object inspector - Made the ... regex more robust and made it support non-URLs between the tags, so that we don't get random tags when trying to disable URLs in user-typed text. - Improved the llurlentry unit test and added some more test cases. - Hooked up another LLViewerMessage code path to objectim SLapps to pass down the owner and slurl information. - Made a few LLUrlEntryBase methods be const methods, because they are - Fixed a bug in the remote object inspector where it would never show the teleport URL. --- indra/llui/llurlentry.cpp | 20 ++- indra/llui/llurlentry.h | 13 +- indra/llui/llurlregistry.cpp | 3 +- indra/llui/tests/llurlentry_test.cpp | 305 +++++++++++++++++++---------------- 4 files changed, 183 insertions(+), 158 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 58148ad2aa..b20de914a0 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -49,7 +49,7 @@ LLUrlEntryBase::~LLUrlEntryBase() { } -std::string LLUrlEntryBase::getUrl(const std::string &string) +std::string LLUrlEntryBase::getUrl(const std::string &string) const { return escapeUrl(string); } @@ -89,7 +89,7 @@ std::string LLUrlEntryBase::escapeUrl(const std::string &url) const return LLURI::escape(url, no_escape_chars, true); } -std::string LLUrlEntryBase::getLabelFromWikiLink(const std::string &url) +std::string LLUrlEntryBase::getLabelFromWikiLink(const std::string &url) const { // return the label part from [http://www.example.org Label] const char *text = url.c_str(); @@ -105,7 +105,7 @@ std::string LLUrlEntryBase::getLabelFromWikiLink(const std::string &url) return unescapeUrl(url.substr(start, url.size()-start-1)); } -std::string LLUrlEntryBase::getUrlFromWikiLink(const std::string &string) +std::string LLUrlEntryBase::getUrlFromWikiLink(const std::string &string) const { // return the url part from [http://www.example.org Label] const char *text = string.c_str(); @@ -192,7 +192,7 @@ std::string LLUrlEntryHTTPLabel::getLabel(const std::string &url, const LLUrlLab return getLabelFromWikiLink(url); } -std::string LLUrlEntryHTTPLabel::getUrl(const std::string &string) +std::string LLUrlEntryHTTPLabel::getUrl(const std::string &string) const { return getUrlFromWikiLink(string); } @@ -217,7 +217,7 @@ std::string LLUrlEntryHTTPNoProtocol::getLabel(const std::string &url, const LLU return unescapeUrl(url); } -std::string LLUrlEntryHTTPNoProtocol::getUrl(const std::string &string) +std::string LLUrlEntryHTTPNoProtocol::getUrl(const std::string &string) const { if (string.find("://") == std::string::npos) { @@ -597,7 +597,7 @@ std::string LLUrlEntrySLLabel::getLabel(const std::string &url, const LLUrlLabel return getLabelFromWikiLink(url); } -std::string LLUrlEntrySLLabel::getUrl(const std::string &string) +std::string LLUrlEntrySLLabel::getUrl(const std::string &string) const { return getUrlFromWikiLink(string); } @@ -648,14 +648,18 @@ std::string LLUrlEntryWorldMap::getLocation(const std::string &url) const // LLUrlEntryNoLink::LLUrlEntryNoLink() { - mPattern = boost::regex("[^[:space:]<]+", + mPattern = boost::regex("[^<]*", boost::regex::perl|boost::regex::icase); mDisabledLink = true; } -std::string LLUrlEntryNoLink::getLabel(const std::string &url, const LLUrlLabelCallback &cb) +std::string LLUrlEntryNoLink::getUrl(const std::string &url) const { // return the text between the and tags return url.substr(8, url.size()-8-9); } +std::string LLUrlEntryNoLink::getLabel(const std::string &url, const LLUrlLabelCallback &cb) +{ + return getUrl(url); +} diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 94455ac247..3abada0f24 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -71,7 +71,7 @@ public: boost::regex getPattern() const { return mPattern; } /// Return the url from a string that matched the regex - virtual std::string getUrl(const std::string &string); + virtual std::string getUrl(const std::string &string) const; /// Given a matched Url, return a label for the Url virtual std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb) { return url; } @@ -98,8 +98,8 @@ protected: std::string getIDStringFromUrl(const std::string &url) const; std::string escapeUrl(const std::string &url) const; std::string unescapeUrl(const std::string &url) const; - std::string getLabelFromWikiLink(const std::string &url); - std::string getUrlFromWikiLink(const std::string &string); + std::string getLabelFromWikiLink(const std::string &url) const; + std::string getUrlFromWikiLink(const std::string &string) const; void addObserver(const std::string &id, const std::string &url, const LLUrlLabelCallback &cb); void callObservers(const std::string &id, const std::string &label); @@ -135,7 +135,7 @@ class LLUrlEntryHTTPLabel : public LLUrlEntryBase public: LLUrlEntryHTTPLabel(); /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); - /*virtual*/ std::string getUrl(const std::string &string); + /*virtual*/ std::string getUrl(const std::string &string) const; }; /// @@ -146,7 +146,7 @@ class LLUrlEntryHTTPNoProtocol : public LLUrlEntryBase public: LLUrlEntryHTTPNoProtocol(); /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); - /*virtual*/ std::string getUrl(const std::string &string); + /*virtual*/ std::string getUrl(const std::string &string) const; }; /// @@ -256,7 +256,7 @@ class LLUrlEntrySLLabel : public LLUrlEntryBase public: LLUrlEntrySLLabel(); /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); - /*virtual*/ std::string getUrl(const std::string &string); + /*virtual*/ std::string getUrl(const std::string &string) const; }; /// @@ -279,6 +279,7 @@ class LLUrlEntryNoLink : public LLUrlEntryBase public: LLUrlEntryNoLink(); /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); + /*virtual*/ std::string getUrl(const std::string &string) const; }; #endif diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index 55eb8950e9..722dbe41b3 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -132,7 +132,8 @@ static bool stringHasUrl(const std::string &text) text.find(".com") != std::string::npos || text.find(".net") != std::string::npos || text.find(".edu") != std::string::npos || - text.find(".org") != std::string::npos); + text.find(".org") != std::string::npos || + text.find("") != std::string::npos); } bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LLUrlLabelCallback &cb) diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp index bc97cf3df2..cbb303a059 100644 --- a/indra/llui/tests/llurlentry_test.cpp +++ b/indra/llui/tests/llurlentry_test.cpp @@ -52,9 +52,10 @@ namespace namespace tut { - void testRegex(const std::string &testname, boost::regex regex, + void testRegex(const std::string &testname, LLUrlEntryBase &entry, const char *text, const std::string &expected) { + boost::regex regex = entry.getPattern(); std::string url = ""; boost::cmatch result; bool found = boost::regex_search(text, result, regex); @@ -62,7 +63,7 @@ namespace tut { S32 start = static_cast(result[0].first - text); S32 end = static_cast(result[0].second - text); - url = std::string(text+start, end-start); + url = entry.getUrl(std::string(text+start, end-start)); } ensure_equals(testname, url, expected); } @@ -74,74 +75,73 @@ namespace tut // test LLUrlEntryHTTP - standard http Urls // LLUrlEntryHTTP url; - boost::regex r = url.getPattern(); - testRegex("no valid url", r, + testRegex("no valid url", url, "htp://slurl.com/", ""); - testRegex("simple http (1)", r, + testRegex("simple http (1)", url, "http://slurl.com/", "http://slurl.com/"); - testRegex("simple http (2)", r, + testRegex("simple http (2)", url, "http://slurl.com", "http://slurl.com"); - testRegex("simple http (3)", r, + testRegex("simple http (3)", url, "http://slurl.com/about.php", "http://slurl.com/about.php"); - testRegex("simple https", r, + testRegex("simple https", url, "https://slurl.com/about.php", "https://slurl.com/about.php"); - testRegex("http in text (1)", r, + testRegex("http in text (1)", url, "XX http://slurl.com/ XX", "http://slurl.com/"); - testRegex("http in text (2)", r, + testRegex("http in text (2)", url, "XX http://slurl.com/about.php XX", "http://slurl.com/about.php"); - testRegex("https in text", r, + testRegex("https in text", url, "XX https://slurl.com/about.php XX", "https://slurl.com/about.php"); - testRegex("two http urls", r, + testRegex("two http urls", url, "XX http://slurl.com/about.php http://secondlife.com/ XX", "http://slurl.com/about.php"); - testRegex("http url with port and username", r, + testRegex("http url with port and username", url, "XX http://nobody@slurl.com:80/about.php http://secondlife.com/ XX", "http://nobody@slurl.com:80/about.php"); - testRegex("http url with port, username, and query string", r, + testRegex("http url with port, username, and query string", url, "XX http://nobody@slurl.com:80/about.php?title=hi%20there http://secondlife.com/ XX", "http://nobody@slurl.com:80/about.php?title=hi%20there"); // note: terminating commas will be removed by LLUrlRegistry:findUrl() - testRegex("http url with commas in middle and terminating", r, + testRegex("http url with commas in middle and terminating", url, "XX http://slurl.com/?title=Hi,There, XX", "http://slurl.com/?title=Hi,There,"); // note: terminating periods will be removed by LLUrlRegistry:findUrl() - testRegex("http url with periods in middle and terminating", r, + testRegex("http url with periods in middle and terminating", url, "XX http://slurl.com/index.php. XX", "http://slurl.com/index.php."); // DEV-19842: Closing parenthesis ")" breaks urls - testRegex("http url with brackets (1)", r, + testRegex("http url with brackets (1)", url, "XX http://en.wikipedia.org/wiki/JIRA_(software) XX", "http://en.wikipedia.org/wiki/JIRA_(software)"); // DEV-19842: Closing parenthesis ")" breaks urls - testRegex("http url with brackets (2)", r, + testRegex("http url with brackets (2)", url, "XX http://jira.secondlife.com/secure/attachment/17990/eggy+avs+in+1.21.0+(93713)+public+nightly.jpg XX", "http://jira.secondlife.com/secure/attachment/17990/eggy+avs+in+1.21.0+(93713)+public+nightly.jpg"); // DEV-10353: URLs in chat log terminated incorrectly when newline in chat - testRegex("http url with newlines", r, + testRegex("http url with newlines", url, "XX\nhttp://www.secondlife.com/\nXX", "http://www.secondlife.com/"); } @@ -153,39 +153,38 @@ namespace tut // test LLUrlEntryHTTPLabel - wiki-style http Urls with labels // LLUrlEntryHTTPLabel url; - boost::regex r = url.getPattern(); - testRegex("invalid wiki url [1]", r, + testRegex("invalid wiki url [1]", url, "[http://www.example.org]", ""); - testRegex("invalid wiki url [2]", r, + testRegex("invalid wiki url [2]", url, "[http://www.example.org", ""); - testRegex("invalid wiki url [3]", r, + testRegex("invalid wiki url [3]", url, "[http://www.example.org Label", ""); - testRegex("example.org with label (spaces)", r, + testRegex("example.org with label (spaces)", url, "[http://www.example.org Text]", - "[http://www.example.org Text]"); + "http://www.example.org"); - testRegex("example.org with label (tabs)", r, + testRegex("example.org with label (tabs)", url, "[http://www.example.org\t Text]", - "[http://www.example.org\t Text]"); + "http://www.example.org"); - testRegex("SL http URL with label", r, + testRegex("SL http URL with label", url, "[http://www.secondlife.com/ Second Life]", - "[http://www.secondlife.com/ Second Life]"); + "http://www.secondlife.com/"); - testRegex("SL https URL with label", r, + testRegex("SL https URL with label", url, "XXX [https://www.secondlife.com/ Second Life] YYY", - "[https://www.secondlife.com/ Second Life]"); + "https://www.secondlife.com/"); - testRegex("SL http URL with label", r, + testRegex("SL http URL with label", url, "[http://www.secondlife.com/?test=Hi%20There Second Life]", - "[http://www.secondlife.com/?test=Hi%20There Second Life]"); + "http://www.secondlife.com/?test=Hi%20There"); } template<> template<> @@ -195,69 +194,68 @@ namespace tut // test LLUrlEntrySLURL - second life URLs // LLUrlEntrySLURL url; - boost::regex r = url.getPattern(); - testRegex("no valid slurl [1]", r, + testRegex("no valid slurl [1]", url, "htp://slurl.com/secondlife/Ahern/50/50/50/", ""); - testRegex("no valid slurl [2]", r, + testRegex("no valid slurl [2]", url, "http://slurl.com/secondlife/", ""); - testRegex("no valid slurl [3]", r, + testRegex("no valid slurl [3]", url, "hhtp://slurl.com/secondlife/Ahern/50/FOO/50/", ""); - testRegex("Ahern (50,50,50) [1]", r, + testRegex("Ahern (50,50,50) [1]", url, "http://slurl.com/secondlife/Ahern/50/50/50/", "http://slurl.com/secondlife/Ahern/50/50/50/"); - testRegex("Ahern (50,50,50) [2]", r, + testRegex("Ahern (50,50,50) [2]", url, "XXX http://slurl.com/secondlife/Ahern/50/50/50/ XXX", "http://slurl.com/secondlife/Ahern/50/50/50/"); - testRegex("Ahern (50,50,50) [3]", r, + testRegex("Ahern (50,50,50) [3]", url, "XXX http://slurl.com/secondlife/Ahern/50/50/50 XXX", "http://slurl.com/secondlife/Ahern/50/50/50"); - testRegex("Ahern (50,50,50) multicase", r, + testRegex("Ahern (50,50,50) multicase", url, "XXX http://SLUrl.com/SecondLife/Ahern/50/50/50/ XXX", "http://SLUrl.com/SecondLife/Ahern/50/50/50/"); - testRegex("Ahern (50,50) [1]", r, + testRegex("Ahern (50,50) [1]", url, "XXX http://slurl.com/secondlife/Ahern/50/50/ XXX", "http://slurl.com/secondlife/Ahern/50/50/"); - testRegex("Ahern (50,50) [2]", r, + testRegex("Ahern (50,50) [2]", url, "XXX http://slurl.com/secondlife/Ahern/50/50 XXX", "http://slurl.com/secondlife/Ahern/50/50"); - testRegex("Ahern (50)", r, + testRegex("Ahern (50)", url, "XXX http://slurl.com/secondlife/Ahern/50 XXX", "http://slurl.com/secondlife/Ahern/50"); - testRegex("Ahern", r, + testRegex("Ahern", url, "XXX http://slurl.com/secondlife/Ahern/ XXX", "http://slurl.com/secondlife/Ahern/"); - testRegex("Ahern SLURL with title", r, + testRegex("Ahern SLURL with title", url, "XXX http://slurl.com/secondlife/Ahern/50/50/50/?title=YOUR%20TITLE%20HERE! XXX", "http://slurl.com/secondlife/Ahern/50/50/50/?title=YOUR%20TITLE%20HERE!"); - testRegex("Ahern SLURL with msg", r, + testRegex("Ahern SLURL with msg", url, "XXX http://slurl.com/secondlife/Ahern/50/50/50/?msg=Your%20text%20here. XXX", "http://slurl.com/secondlife/Ahern/50/50/50/?msg=Your%20text%20here."); // DEV-21577: In-world SLURLs containing "(" or ")" are not treated as a hyperlink in chat - testRegex("SLURL with brackets", r, + testRegex("SLURL with brackets", url, "XXX http://slurl.com/secondlife/Burning%20Life%20(Hyper)/27/210/30 XXX", "http://slurl.com/secondlife/Burning%20Life%20(Hyper)/27/210/30"); // DEV-35459: SLURLs and teleport Links not parsed properly - testRegex("SLURL with quote", r, + testRegex("SLURL with quote", url, "XXX http://slurl.com/secondlife/A'ksha%20Oasis/41/166/701 XXX", - "http://slurl.com/secondlife/A'ksha%20Oasis/41/166/701"); + "http://slurl.com/secondlife/A%27ksha%20Oasis/41/166/701"); } template<> template<> @@ -267,25 +265,24 @@ namespace tut // test LLUrlEntryAgent - secondlife://app/agent Urls // LLUrlEntryAgent url; - boost::regex r = url.getPattern(); - testRegex("Invalid Agent Url", r, + testRegex("Invalid Agent Url", url, "secondlife:///app/agent/0e346d8b-4433-4d66-XXXX-fd37083abc4c/about", ""); - testRegex("Agent Url ", r, + testRegex("Agent Url ", url, "secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about", "secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about"); - testRegex("Agent Url in text", r, + testRegex("Agent Url in text", url, "XXX secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about XXX", "secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about"); - testRegex("Agent Url multicase", r, + testRegex("Agent Url multicase", url, "XXX secondlife:///App/AGENT/0E346D8B-4433-4d66-a6b0-fd37083abc4c/About XXX", "secondlife:///App/AGENT/0E346D8B-4433-4d66-a6b0-fd37083abc4c/About"); - testRegex("Agent Url alternate command", r, + testRegex("Agent Url alternate command", url, "XXX secondlife:///App/AGENT/0E346D8B-4433-4d66-a6b0-fd37083abc4c/foobar", "secondlife:///App/AGENT/0E346D8B-4433-4d66-a6b0-fd37083abc4c/foobar"); @@ -298,25 +295,24 @@ namespace tut // test LLUrlEntryGroup - secondlife://app/group Urls // LLUrlEntryGroup url; - boost::regex r = url.getPattern(); - testRegex("Invalid Group Url", r, + testRegex("Invalid Group Url", url, "secondlife:///app/group/00005ff3-4044-c79f-XXXX-fb28ae0df991/about", ""); - testRegex("Group Url ", r, + testRegex("Group Url ", url, "secondlife:///app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/about", "secondlife:///app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/about"); - testRegex("Group Url ", r, + testRegex("Group Url ", url, "secondlife:///app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/inspect", "secondlife:///app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/inspect"); - testRegex("Group Url in text", r, + testRegex("Group Url in text", url, "XXX secondlife:///app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/about XXX", "secondlife:///app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/about"); - testRegex("Group Url multicase", r, + testRegex("Group Url multicase", url, "XXX secondlife:///APP/Group/00005FF3-4044-c79f-9de8-fb28ae0df991/About XXX", "secondlife:///APP/Group/00005FF3-4044-c79f-9de8-fb28ae0df991/About"); } @@ -328,45 +324,44 @@ namespace tut // test LLUrlEntryPlace - secondlife:// URLs // LLUrlEntryPlace url; - boost::regex r = url.getPattern(); - testRegex("no valid slurl [1]", r, + testRegex("no valid slurl [1]", url, "secondlife://Ahern/FOO/50/", ""); - testRegex("Ahern (50,50,50) [1]", r, + testRegex("Ahern (50,50,50) [1]", url, "secondlife://Ahern/50/50/50/", "secondlife://Ahern/50/50/50/"); - testRegex("Ahern (50,50,50) [2]", r, + testRegex("Ahern (50,50,50) [2]", url, "XXX secondlife://Ahern/50/50/50/ XXX", "secondlife://Ahern/50/50/50/"); - testRegex("Ahern (50,50,50) [3]", r, + testRegex("Ahern (50,50,50) [3]", url, "XXX secondlife://Ahern/50/50/50 XXX", "secondlife://Ahern/50/50/50"); - testRegex("Ahern (50,50,50) multicase", r, + testRegex("Ahern (50,50,50) multicase", url, "XXX SecondLife://Ahern/50/50/50/ XXX", "SecondLife://Ahern/50/50/50/"); - testRegex("Ahern (50,50) [1]", r, + testRegex("Ahern (50,50) [1]", url, "XXX secondlife://Ahern/50/50/ XXX", "secondlife://Ahern/50/50/"); - testRegex("Ahern (50,50) [2]", r, + testRegex("Ahern (50,50) [2]", url, "XXX secondlife://Ahern/50/50 XXX", "secondlife://Ahern/50/50"); // DEV-21577: In-world SLURLs containing "(" or ")" are not treated as a hyperlink in chat - testRegex("SLURL with brackets", r, + testRegex("SLURL with brackets", url, "XXX secondlife://Burning%20Life%20(Hyper)/27/210/30 XXX", "secondlife://Burning%20Life%20(Hyper)/27/210/30"); // DEV-35459: SLURLs and teleport Links not parsed properly - testRegex("SLURL with quote", r, + testRegex("SLURL with quote", url, "XXX secondlife://A'ksha%20Oasis/41/166/701 XXX", - "secondlife://A'ksha%20Oasis/41/166/701"); + "secondlife://A%27ksha%20Oasis/41/166/701"); } template<> template<> @@ -376,21 +371,20 @@ namespace tut // test LLUrlEntryParcel - secondlife://app/parcel Urls // LLUrlEntryParcel url; - boost::regex r = url.getPattern(); - testRegex("Invalid Classified Url", r, + testRegex("Invalid Classified Url", url, "secondlife:///app/parcel/0000060e-4b39-e00b-XXXX-d98b1934e3a8/about", ""); - testRegex("Classified Url ", r, + testRegex("Classified Url ", url, "secondlife:///app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about", "secondlife:///app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about"); - testRegex("Classified Url in text", r, + testRegex("Classified Url in text", url, "XXX secondlife:///app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about XXX", "secondlife:///app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about"); - testRegex("Classified Url multicase", r, + testRegex("Classified Url multicase", url, "XXX secondlife:///APP/Parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/About XXX", "secondlife:///APP/Parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/About"); } @@ -401,73 +395,72 @@ namespace tut // test LLUrlEntryTeleport - secondlife://app/teleport URLs // LLUrlEntryTeleport url; - boost::regex r = url.getPattern(); - testRegex("no valid teleport [1]", r, + testRegex("no valid teleport [1]", url, "http://slurl.com/secondlife/Ahern/50/50/50/", ""); - testRegex("no valid teleport [2]", r, + testRegex("no valid teleport [2]", url, "secondlife:///app/teleport/", ""); - testRegex("no valid teleport [3]", r, + testRegex("no valid teleport [3]", url, "second-life:///app/teleport/Ahern/50/50/50/", ""); - testRegex("no valid teleport [3]", r, + testRegex("no valid teleport [3]", url, "hhtp://slurl.com/secondlife/Ahern/50/FOO/50/", ""); - testRegex("Ahern (50,50,50) [1]", r, + testRegex("Ahern (50,50,50) [1]", url, "secondlife:///app/teleport/Ahern/50/50/50/", "secondlife:///app/teleport/Ahern/50/50/50/"); - testRegex("Ahern (50,50,50) [2]", r, + testRegex("Ahern (50,50,50) [2]", url, "XXX secondlife:///app/teleport/Ahern/50/50/50/ XXX", "secondlife:///app/teleport/Ahern/50/50/50/"); - testRegex("Ahern (50,50,50) [3]", r, + testRegex("Ahern (50,50,50) [3]", url, "XXX secondlife:///app/teleport/Ahern/50/50/50 XXX", "secondlife:///app/teleport/Ahern/50/50/50"); - testRegex("Ahern (50,50,50) multicase", r, + testRegex("Ahern (50,50,50) multicase", url, "XXX secondlife:///app/teleport/Ahern/50/50/50/ XXX", "secondlife:///app/teleport/Ahern/50/50/50/"); - testRegex("Ahern (50,50) [1]", r, + testRegex("Ahern (50,50) [1]", url, "XXX secondlife:///app/teleport/Ahern/50/50/ XXX", "secondlife:///app/teleport/Ahern/50/50/"); - testRegex("Ahern (50,50) [2]", r, + testRegex("Ahern (50,50) [2]", url, "XXX secondlife:///app/teleport/Ahern/50/50 XXX", "secondlife:///app/teleport/Ahern/50/50"); - testRegex("Ahern (50)", r, + testRegex("Ahern (50)", url, "XXX secondlife:///app/teleport/Ahern/50 XXX", "secondlife:///app/teleport/Ahern/50"); - testRegex("Ahern", r, + testRegex("Ahern", url, "XXX secondlife:///app/teleport/Ahern/ XXX", "secondlife:///app/teleport/Ahern/"); - testRegex("Ahern teleport with title", r, + testRegex("Ahern teleport with title", url, "XXX secondlife:///app/teleport/Ahern/50/50/50/?title=YOUR%20TITLE%20HERE! XXX", "secondlife:///app/teleport/Ahern/50/50/50/?title=YOUR%20TITLE%20HERE!"); - testRegex("Ahern teleport with msg", r, + testRegex("Ahern teleport with msg", url, "XXX secondlife:///app/teleport/Ahern/50/50/50/?msg=Your%20text%20here. XXX", "secondlife:///app/teleport/Ahern/50/50/50/?msg=Your%20text%20here."); // DEV-21577: In-world SLURLs containing "(" or ")" are not treated as a hyperlink in chat - testRegex("Teleport with brackets", r, + testRegex("Teleport with brackets", url, "XXX secondlife:///app/teleport/Burning%20Life%20(Hyper)/27/210/30 XXX", "secondlife:///app/teleport/Burning%20Life%20(Hyper)/27/210/30"); // DEV-35459: SLURLs and teleport Links not parsed properly - testRegex("Teleport url with quote", r, + testRegex("Teleport url with quote", url, "XXX secondlife:///app/teleport/A'ksha%20Oasis/41/166/701 XXX", - "secondlife:///app/teleport/A'ksha%20Oasis/41/166/701"); + "secondlife:///app/teleport/A%27ksha%20Oasis/41/166/701"); } template<> template<> @@ -477,33 +470,32 @@ namespace tut // test LLUrlEntrySL - general secondlife:// URLs // LLUrlEntrySL url; - boost::regex r = url.getPattern(); - testRegex("no valid slapp [1]", r, + testRegex("no valid slapp [1]", url, "http:///app/", ""); - testRegex("valid slapp [1]", r, + testRegex("valid slapp [1]", url, "secondlife:///app/", "secondlife:///app/"); - testRegex("valid slapp [2]", r, + testRegex("valid slapp [2]", url, "secondlife:///app/teleport/Ahern/50/50/50/", "secondlife:///app/teleport/Ahern/50/50/50/"); - testRegex("valid slapp [3]", r, + testRegex("valid slapp [3]", url, "secondlife:///app/foo", "secondlife:///app/foo"); - testRegex("valid slapp [4]", r, + testRegex("valid slapp [4]", url, "secondlife:///APP/foo?title=Hi%20There", "secondlife:///APP/foo?title=Hi%20There"); - testRegex("valid slapp [5]", r, + testRegex("valid slapp [5]", url, "secondlife://host/app/", "secondlife://host/app/"); - testRegex("valid slapp [6]", r, + testRegex("valid slapp [6]", url, "secondlife://host:8080/foo/bar", "secondlife://host:8080/foo/bar"); } @@ -515,35 +507,34 @@ namespace tut // test LLUrlEntrySLLabel - general secondlife:// URLs with labels // LLUrlEntrySLLabel url; - boost::regex r = url.getPattern(); - testRegex("invalid wiki url [1]", r, + testRegex("invalid wiki url [1]", url, "[secondlife:///app/]", ""); - testRegex("invalid wiki url [2]", r, + testRegex("invalid wiki url [2]", url, "[secondlife:///app/", ""); - testRegex("invalid wiki url [3]", r, + testRegex("invalid wiki url [3]", url, "[secondlife:///app/ Label", ""); - testRegex("agent slurl with label (spaces)", r, + testRegex("agent slurl with label (spaces)", url, "[secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about Text]", - "[secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about Text]"); + "secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about"); - testRegex("agent slurl with label (tabs)", r, + testRegex("agent slurl with label (tabs)", url, "[secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about\t Text]", - "[secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about\t Text]"); + "secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about"); - testRegex("agent slurl with label", r, + testRegex("agent slurl with label", url, "[secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about FirstName LastName]", - "[secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about FirstName LastName]"); + "secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about"); - testRegex("teleport slurl with label", r, + testRegex("teleport slurl with label", url, "XXX [secondlife:///app/teleport/Ahern/50/50/50/ Teleport to Ahern] YYY", - "[secondlife:///app/teleport/Ahern/50/50/50/ Teleport to Ahern]"); + "secondlife:///app/teleport/Ahern/50/50/50/"); } template<> template<> @@ -553,70 +544,98 @@ namespace tut // test LLUrlEntryHTTPNoProtocol - general URLs without a protocol // LLUrlEntryHTTPNoProtocol url; - boost::regex r = url.getPattern(); - testRegex("naked .com URL", r, + testRegex("naked .com URL", url, "see google.com", - "google.com"); + "http://google.com"); - testRegex("naked .org URL", r, + testRegex("naked .org URL", url, "see en.wikipedia.org for details", - "en.wikipedia.org"); + "http://en.wikipedia.org"); - testRegex("naked .net URL", r, + testRegex("naked .net URL", url, "example.net", - "example.net"); + "http://example.net"); - testRegex("naked .edu URL (2 instances)", r, + testRegex("naked .edu URL (2 instances)", url, "MIT web site is at web.mit.edu and also www.mit.edu", - "web.mit.edu"); + "http://web.mit.edu"); - testRegex("don't match e-mail addresses", r, + testRegex("don't match e-mail addresses", url, "test@lindenlab.com", ""); - testRegex(".com URL with path", r, + testRegex(".com URL with path", url, "see secondlife.com/status for grid status", - "secondlife.com/status"); + "http://secondlife.com/status"); - testRegex(".com URL with port", r, + testRegex(".com URL with port", url, "secondlife.com:80", - "secondlife.com:80"); + "http://secondlife.com:80"); - testRegex(".com URL with port and path", r, + testRegex(".com URL with port and path", url, "see secondlife.com:80/status", - "secondlife.com:80/status"); + "http://secondlife.com:80/status"); - testRegex("www.*.com URL with port and path", r, + testRegex("www.*.com URL with port and path", url, "see www.secondlife.com:80/status", - "www.secondlife.com:80/status"); + "http://www.secondlife.com:80/status"); - testRegex("invalid .com URL [1]", r, + testRegex("invalid .com URL [1]", url, "..com", ""); - testRegex("invalid .com URL [2]", r, + testRegex("invalid .com URL [2]", url, "you.come", ""); - testRegex("invalid .com URL [3]", r, + testRegex("invalid .com URL [3]", url, "recommended", ""); - testRegex("invalid .edu URL", r, + testRegex("invalid .edu URL", url, "hi there scheduled maitenance has begun", ""); - testRegex("invalid .net URL", r, + testRegex("invalid .net URL", url, "foo.netty", ""); - testRegex("XML tags around URL [1]", r, + testRegex("XML tags around URL [1]", url, "secondlife.com", - "secondlife.com"); + "http://secondlife.com"); - testRegex("XML tags around URL [2]", r, + testRegex("XML tags around URL [2]", url, "secondlife.com/status?bar=1", - "secondlife.com/status?bar=1"); + "http://secondlife.com/status?bar=1"); + } + + template<> template<> + void object::test<12>() + { + // + // test LLUrlEntryNoLink - turn off hyperlinking + // + LLUrlEntryNoLink url; + + testRegex(" [1]", url, + "google.com", + "google.com"); + + testRegex(" [2]", url, + "google.com", + ""); + + testRegex(" [3]", url, + "google.com", + ""); + + testRegex(" [4]", url, + "Hello World", + "Hello World"); + + testRegex(" [5]", url, + "My Object", + "My Object"); } } -- cgit v1.2.3 From 5491dd6e983f8fccbd687c7c45ef43125dfc0f6c Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Tue, 2 Feb 2010 18:24:11 -0800 Subject: Further fixes for EXT-4689 (Long-word chat spam cripples fps and/or disconnects client). This should fix the inefficiencies in the append path that made viewer FPS drop severely when addinglarge amounts of text to the nearby chat floater. Resizing the floater with a huge amount of text in it is still pretty bad, but fixing that will require some bigger architectural changes. Changed LLTextBase::needsReflow() to take an offset at which to start reflow processing. Changed most needsReflow() calls in LLTextBase to supply a proper index. Changed LLTextBase::reflow() to use the reflow index maintained by needsReflow(). Removed all needsReflow() calls from LLTextEditor (the only way for it to manipulate the text is through functions in LLTextBase that already manage reflowing internally). Removed LLTextEditor::replaceUrlLabel(), since it was identical to the inherited version LLTextBase::replaceUrlLabel(). Reviewed by Richard. --- indra/llui/lltextbase.cpp | 28 ++++++++++++------ indra/llui/lltextbase.h | 6 ++-- indra/llui/lltexteditor.cpp | 69 --------------------------------------------- indra/llui/lltexteditor.h | 1 - 4 files changed, 22 insertions(+), 82 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index b977e50bc1..75ca6d8895 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -185,7 +185,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mWriteableBgColor(p.bg_writeable_color), mReadOnlyBgColor(p.bg_readonly_color), mFocusBgColor(p.bg_focus_color), - mReflowNeeded(FALSE), + mReflowIndex(S32_MAX), mCursorPos( 0 ), mScrollNeeded(FALSE), mDesiredXPixel(-1), @@ -660,7 +660,7 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s } onValueChange(pos, pos + insert_len); - needsReflow(); + needsReflow(pos); return insert_len; } @@ -720,7 +720,7 @@ S32 LLTextBase::removeStringNoUndo(S32 pos, S32 length) createDefaultSegment(); onValueChange(pos, pos); - needsReflow(); + needsReflow(pos); return -length; // This will be wrong if someone calls removeStringNoUndo with an excessive length } @@ -736,7 +736,7 @@ S32 LLTextBase::overwriteCharNoUndo(S32 pos, llwchar wc) getViewModel()->setDisplay(text); onValueChange(pos, pos + 1); - needsReflow(); + needsReflow(pos); return 1; } @@ -762,15 +762,18 @@ void LLTextBase::insertSegment(LLTextSegmentPtr segment_to_insert) } segment_set_t::iterator cur_seg_iter = getSegIterContaining(segment_to_insert->getStart()); + S32 reflow_start_index = 0; if (cur_seg_iter == mSegments.end()) { mSegments.insert(segment_to_insert); segment_to_insert->linkToDocument(this); + reflow_start_index = segment_to_insert->getStart(); } else { LLTextSegmentPtr cur_segmentp = *cur_seg_iter; + reflow_start_index = cur_segmentp->getStart(); if (cur_segmentp->getStart() < segment_to_insert->getStart()) { S32 old_segment_end = cur_segmentp->getEnd(); @@ -829,7 +832,7 @@ void LLTextBase::insertSegment(LLTextSegmentPtr segment_to_insert) } // layout potentially changed - needsReflow(); + needsReflow(reflow_start_index); } BOOL LLTextBase::handleMouseDown(S32 x, S32 y, MASK mask) @@ -1084,15 +1087,16 @@ S32 LLTextBase::getLeftOffset(S32 width) static LLFastTimer::DeclareTimer FTM_TEXT_REFLOW ("Text Reflow"); -void LLTextBase::reflow(S32 start_index) +void LLTextBase::reflow() { LLFastTimer ft(FTM_TEXT_REFLOW); updateSegments(); - while(mReflowNeeded) + while(mReflowIndex < S32_MAX) { - mReflowNeeded = false; + S32 start_index = mReflowIndex; + mReflowIndex = S32_MAX; // shrink document to minimum size (visible portion of text widget) // to force inlined widgets with follows set to shrink @@ -1619,6 +1623,12 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c } } +void LLTextBase::needsReflow(S32 index) +{ + lldebugs << "reflow on object " << (void*)this << " index = " << mReflowIndex << ", new index = " << index << llendl; + mReflowIndex = llmin(mReflowIndex, index); +} + void LLTextBase::appendAndHighlightText(const std::string &new_text, bool prepend_newline, S32 highlight_part, const LLStyle::Params& style_params) { if (new_text.empty()) return; @@ -2260,7 +2270,7 @@ LLNormalTextSegment::LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 e LLUIImagePtr image = mStyle->getImage(); if (image.notNull()) { - mImageLoadedConnection = image->addLoadedCallback(boost::bind(&LLTextBase::needsReflow, &mEditor)); + mImageLoadedConnection = image->addLoadedCallback(boost::bind(&LLTextBase::needsReflow, &mEditor, start)); } } diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index ed2f239476..3dda6f4cc8 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -150,7 +150,7 @@ public: void appendText(const std::string &new_text, bool prepend_newline, const LLStyle::Params& input_params = LLStyle::Params()); // force reflow of text - void needsReflow() { mReflowNeeded = TRUE; } + void needsReflow(S32 index = 0); S32 getLength() const { return getWText().length(); } S32 getLineCount() const { return mLineInfoList.size(); } @@ -292,7 +292,7 @@ protected: S32 getFirstVisibleLine() const; std::pair getVisibleLines(bool fully_visible = false); S32 getLeftOffset(S32 width); - void reflow(S32 start_index = 0); + void reflow(); // cursor void updateCursorXPos(); @@ -362,7 +362,7 @@ protected: class LLScrollContainer* mScroller; // transient state - bool mReflowNeeded; // need to reflow text because of change to text contents or display region + S32 mReflowIndex; // index at which to start reflow. S32_MAX indicates no reflow needed. bool mScrollNeeded; // need to change scroll region because of change to cursor position S32 mScrollIndex; // index of first character to keep visible in scroll region diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index e76fee9f17..7a19b7427c 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1285,8 +1285,6 @@ void LLTextEditor::cut() gClipboard.copyFromSubstring( getWText(), left_pos, length, mSourceID ); deleteSelection( FALSE ); - needsReflow(); - onKeyStroke(); } @@ -1391,8 +1389,6 @@ void LLTextEditor::pasteHelper(bool is_primary) setCursorPos(mCursorPos + insert(mCursorPos, clean_string, FALSE, LLTextSegmentPtr())); deselect(); - needsReflow(); - onKeyStroke(); } @@ -1787,8 +1783,6 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask ) if(text_may_have_changed) { - needsReflow(); - onKeyStroke(); } needsScroll(); @@ -1831,8 +1825,6 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char) // Most keystrokes will make the selection box go away, but not all will. deselect(); - needsReflow(); - onKeyStroke(); } @@ -1891,8 +1883,6 @@ void LLTextEditor::doDelete() } onKeyStroke(); - - needsReflow(); } //---------------------------------------------------------------------------- @@ -1935,8 +1925,6 @@ void LLTextEditor::undo() setCursorPos(pos); - needsReflow(); - onKeyStroke(); } @@ -1979,8 +1967,6 @@ void LLTextEditor::redo() setCursorPos(pos); - needsReflow(); - onKeyStroke(); } @@ -2339,8 +2325,6 @@ void LLTextEditor::insertText(const std::string &new_text) setCursorPos(mCursorPos + insert( mCursorPos, utf8str_to_wstring(new_text), FALSE, LLTextSegmentPtr() )); - needsReflow(); - setEnabled( enabled ); } @@ -2363,8 +2347,6 @@ void LLTextEditor::appendWidget(const LLInlineViewSegment::Params& params, const LLTextSegmentPtr segment = new LLInlineViewSegment(params, old_length, old_length + widget_wide_text.size()); insert(getLength(), widget_wide_text, FALSE, segment); - needsReflow(); - // Set the cursor and scroll position if( selection_start != selection_end ) { @@ -2389,52 +2371,6 @@ void LLTextEditor::appendWidget(const LLInlineViewSegment::Params& params, const } } - -void LLTextEditor::replaceUrlLabel(const std::string &url, - const std::string &label) -{ - // get the full (wide) text for the editor so we can change it - LLWString text = getWText(); - LLWString wlabel = utf8str_to_wstring(label); - bool modified = false; - S32 seg_start = 0; - - // iterate through each segment looking for ones styled as links - segment_set_t::iterator it; - for (it = mSegments.begin(); it != mSegments.end(); ++it) - { - LLTextSegment *seg = *it; - LLStyleConstSP style = seg->getStyle(); - - // update segment start/end length in case we replaced text earlier - S32 seg_length = seg->getEnd() - seg->getStart(); - seg->setStart(seg_start); - seg->setEnd(seg_start + seg_length); - - // if we find a link with our Url, then replace the label - if (style->isLink() && style->getLinkHREF() == url) - { - S32 start = seg->getStart(); - S32 end = seg->getEnd(); - text = text.substr(0, start) + wlabel + text.substr(end, text.size() - end + 1); - seg->setEnd(start + wlabel.size()); - modified = true; - } - - // work out the character offset for the next segment - seg_start = seg->getEnd(); - } - - // update the editor with the new (wide) text string - if (modified) - { - getViewModel()->setDisplay(text); - deselect(); - setCursorPos(mCursorPos); - needsReflow(); - } -} - void LLTextEditor::removeTextFromEnd(S32 num_chars) { if (num_chars <= 0) return; @@ -2446,7 +2382,6 @@ void LLTextEditor::removeTextFromEnd(S32 num_chars) mSelectionStart = llclamp(mSelectionStart, 0, len); mSelectionEnd = llclamp(mSelectionEnd, 0, len); - needsReflow(); needsScroll(); } @@ -2505,8 +2440,6 @@ BOOL LLTextEditor::tryToRevertToPristineState() i--; } } - - needsReflow(); } return isPristine(); // TRUE => success @@ -2681,7 +2614,6 @@ BOOL LLTextEditor::importBuffer(const char* buffer, S32 length ) startOfDoc(); deselect(); - needsReflow(); return success; } @@ -2785,7 +2717,6 @@ void LLTextEditor::updatePreedit(const LLWString &preedit_string, mPreeditStandouts = preedit_standouts; - needsReflow(); setCursorPos(insert_preedit_at + caret_position); // Update of the preedit should be caused by some key strokes. diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 043dda8fa6..a136f9ccce 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -149,7 +149,6 @@ public: void selectNext(const std::string& search_text_in, BOOL case_insensitive, BOOL wrap = TRUE); BOOL replaceText(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive, BOOL wrap = TRUE); void replaceTextAll(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive); - void replaceUrlLabel(const std::string &url, const std::string &label); // Undo/redo stack void blockUndo(); -- cgit v1.2.3 From 8c1618ca5ae81eec0a5fa6229e89cd0f1a072a27 Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Wed, 3 Feb 2010 19:38:12 +0200 Subject: Fixed major bug EXT-4876 (Switch from slurl.com to maps.secondlife.com) --HG-- branch : product-engine --- indra/llui/llurlentry.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index b20de914a0..92b7816bdd 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -232,7 +232,7 @@ std::string LLUrlEntryHTTPNoProtocol::getUrl(const std::string &string) const LLUrlEntrySLURL::LLUrlEntrySLURL() { // see http://slurl.com/about.php for details on the SLURL format - mPattern = boost::regex("http://slurl.com/secondlife/\\S+/?(\\d+)?/?(\\d+)?/?(\\d+)?/?\\S*", + mPattern = boost::regex("http://(maps.secondlife.com|slurl.com)/secondlife/\\S+/?(\\d+)?/?(\\d+)?/?(\\d+)?/?\\S*", boost::regex::perl|boost::regex::icase); mMenuName = "menu_url_slurl.xml"; mTooltip = LLTrans::getString("TooltipSLURL"); -- cgit v1.2.3 From 18af41157d64962fff10b0697c632a5d2a38539e Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 3 Feb 2010 17:54:59 +0000 Subject: CID-342 UNINIT_CTOR --HG-- branch : product-engine --- indra/llui/llnotifications.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index d55e0f4043..8d993b71d7 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -371,7 +371,7 @@ private: // this is just for making it easy to look things up in a set organized by UUID -- DON'T USE IT // for anything real! - LLNotification(LLUUID uuid) : mId(uuid), mCancelled(false), mRespondedTo(false), mIgnored(false), mTemporaryResponder(false) {} + LLNotification(LLUUID uuid) : mId(uuid), mCancelled(false), mRespondedTo(false), mIgnored(false), mPriority(NOTIFICATION_PRIORITY_UNSPECIFIED), mTemporaryResponder(false) {} void cancel(); -- cgit v1.2.3 From 011673de5a73eefbd59e29056851e160338be714 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 3 Feb 2010 18:22:25 +0000 Subject: CID-419 Checker: RESOURCE_LEAK File: /indra/llui/llstyle.h --HG-- branch : product-engine --- indra/llui/lltexteditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index e76fee9f17..a4c802bd26 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2574,7 +2574,7 @@ void LLTextEditor::updateLinkSegments() // then update the link's HREF to be the same as the label text. // This lets users edit Urls in-place. LLStyleConstSP style = segment->getStyle(); - LLStyle* new_style = new LLStyle(*style); + LLStyleSP new_style(new LLStyle(*style)); LLWString url_label = wtext.substr(segment->getStart(), segment->getEnd()-segment->getStart()); if (LLUrlRegistry::instance().hasUrl(url_label)) { -- cgit v1.2.3 From bf18e798c5ca2e238bb5f4affec7182c8e30dcd4 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 3 Feb 2010 21:13:37 +0000 Subject: CID-405 Checker: UNUSED_VALUE Function: LLNormalTextSegment::drawClippedSegment(int, int, int, int, LLRectBase) File: /indra/llui/lltextbase.cpp --- indra/llui/lltextbase.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 75ca6d8895..2b1e2b8226 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2333,8 +2333,6 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele LLColor4 color = (mEditor.getReadOnly() ? mStyle->getReadOnlyColor() : mStyle->getColor()) % alpha; - font = mStyle->getFont(); - if( selection_start > seg_start ) { // Draw normally -- cgit v1.2.3 From 667ae0b9a31318d43d36cb6c8cb73a83e1470009 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 4 Feb 2010 15:54:56 +0200 Subject: Fixed critical bug EXT-4845 (Create padding around text messages in the side tray panels) - moved "No Items" textbox params to widget (flat_list_view.xml) - set default vertical/horizontal padding to 10 px - they can be overridden in panel's xml if necessary. --HG-- branch : product-engine --- indra/llui/llflatlistview.cpp | 47 +++++++++++++++++++++++++++---------------- indra/llui/llflatlistview.h | 5 ++++- 2 files changed, 34 insertions(+), 18 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index 92993650a7..2481249f91 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -42,8 +42,6 @@ static const LLDefaultChildRegistry::Register flat_list_view("fl const LLSD SELECTED_EVENT = LLSD().with("selected", true); const LLSD UNSELECTED_EVENT = LLSD().with("selected", false); -static const std::string COMMENT_TEXTBOX = "comment_text"; - //forward declaration bool llsds_are_equal(const LLSD& llsd_1, const LLSD& llsd_2); @@ -51,7 +49,8 @@ LLFlatListView::Params::Params() : item_pad("item_pad"), allow_select("allow_select"), multi_select("multi_select"), - keep_one_selected("keep_one_selected") + keep_one_selected("keep_one_selected"), + no_items_text("no_items_text") {}; void LLFlatListView::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */) @@ -295,19 +294,6 @@ void LLFlatListView::resetSelection(bool no_commit_on_deselection /*= false*/) void LLFlatListView::setNoItemsCommentText(const std::string& comment_text) { - if (NULL == mNoItemsCommentTextbox) - { - LLRect comment_rect = getRect(); - comment_rect.setOriginAndSize(0, 0, comment_rect.getWidth(), comment_rect.getHeight()); - comment_rect.stretch(-getBorderWidth()); - LLTextBox::Params text_p; - text_p.name(COMMENT_TEXTBOX); - text_p.border_visible(false); - text_p.rect(comment_rect); - text_p.follows.flags(FOLLOWS_ALL); - mNoItemsCommentTextbox = LLUICtrlFactory::create(text_p, this); - } - mNoItemsCommentTextbox->setValue(comment_text); } @@ -361,7 +347,6 @@ bool LLFlatListView::updateValue(const LLSD& old_value, const LLSD& new_value) // PROTECTED STUFF ////////////////////////////////////////////////////////////////////////// - LLFlatListView::LLFlatListView(const LLFlatListView::Params& p) : LLScrollContainer(p) , mItemComparator(NULL) @@ -398,6 +383,25 @@ LLFlatListView::LLFlatListView(const LLFlatListView::Params& p) params.bevel_style(LLViewBorder::BEVEL_IN); mSelectedItemsBorder = LLUICtrlFactory::create (params); mItemsPanel->addChild( mSelectedItemsBorder ); + + { + // create textbox for "No Items" comment text + LLTextBox::Params text_p = p.no_items_text; + if (!text_p.rect.isProvided()) + { + LLRect comment_rect = getRect(); + comment_rect.setOriginAndSize(0, 0, comment_rect.getWidth(), comment_rect.getHeight()); + comment_rect.stretch(-getBorderWidth()); + text_p.rect(comment_rect); + } + text_p.border_visible(false); + + if (!text_p.follows.isProvided()) + { + text_p.follows.flags(FOLLOWS_ALL); + } + mNoItemsCommentTextbox = LLUICtrlFactory::create(text_p, this); + } }; // virtual @@ -861,7 +865,11 @@ void LLFlatListView::notifyParentItemsRectChanged() // take into account comment text height if exists if (mNoItemsCommentTextbox && mNoItemsCommentTextbox->getVisible()) { + // top text padding inside the textbox is included into the height comment_height = mNoItemsCommentTextbox->getTextPixelHeight(); + + // take into account a distance from parent's top border to textbox's top + comment_height += getRect().getHeight() - mNoItemsCommentTextbox->getRect().mTop; } LLRect req_rect = getItemsRect(); @@ -892,6 +900,10 @@ void LLFlatListView::setNoItemsCommentVisible(bool visible) const { if (visible) { +/* +// *NOTE: MA 2010-02-04 +// Deprecated after params of the comment text box were moved into widget (flat_list_view.xml) +// can be removed later if nothing happened. // We have to update child rect here because of issues with rect after reshaping while creating LLTextbox // It is possible to have invalid LLRect if Flat List is in LLAccordionTab LLRect comment_rect = getLocalRect(); @@ -903,6 +915,7 @@ void LLFlatListView::setNoItemsCommentVisible(bool visible) const LLViewBorder* scroll_border = getChild("scroll border"); comment_rect.stretch(-scroll_border->getBorderWidth()); mNoItemsCommentTextbox->setRect(comment_rect); +*/ } mNoItemsCommentTextbox->setVisible(visible); } diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index 949a731507..92cb40332e 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -35,8 +35,8 @@ #include "llpanel.h" #include "llscrollcontainer.h" +#include "lltextbox.h" -class LLTextBox; /** * LLFlatListView represents a flat list ui control that operates on items in a form of LLPanel's. @@ -108,6 +108,9 @@ public: /** padding between items */ Optional item_pad; + /** textbox with info message when list is empty*/ + Optional no_items_text; + Params(); }; -- cgit v1.2.3 From 79bcb8dc723d093e92bb5897e42c48e26b0bbf4e Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Thu, 4 Feb 2010 15:44:45 +0200 Subject: Fixed low bug EXT-4951 - Redundant edit box context menu in list items in Panel Picks/Classifieds --HG-- branch : product-engine --- indra/llui/lltexteditor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 62aeb50011..3fdb48b3ca 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -720,7 +720,10 @@ BOOL LLTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) } if (!LLTextBase::handleRightMouseDown(x, y, mask)) { - showContextMenu(x, y); + if(getMouseOpaque()) + { + showContextMenu(x, y); + } } return TRUE; } -- cgit v1.2.3 From 1bc67a9d725b88a0ebdde77cef928abd33fa9cf6 Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 4 Feb 2010 10:25:31 -0800 Subject: EXT-4625 - Chat bar doesn't display trailing character on some strings reviewed by Leyla --- indra/llui/lllineeditor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index cb5aea272d..2cdcd3345e 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -422,12 +422,16 @@ void LLLineEditor::setCursor( S32 pos ) S32 old_cursor_pos = getCursor(); mCursorPos = llclamp( pos, 0, mText.length()); + // position of end of next character after cursor S32 pixels_after_scroll = findPixelNearestPos(); if( pixels_after_scroll > mTextRightEdge ) { S32 width_chars_to_left = mGLFont->getWidth(mText.getWString().c_str(), 0, mScrollHPos); S32 last_visible_char = mGLFont->maxDrawableChars(mText.getWString().c_str(), llmax(0.f, (F32)(mTextRightEdge - mTextLeftEdge + width_chars_to_left))); - S32 min_scroll = mGLFont->firstDrawableChar(mText.getWString().c_str(), (F32)(mTextRightEdge - mTextLeftEdge), mText.length(), getCursor()); + // character immediately to left of cursor should be last one visible (SCROLL_INCREMENT_ADD will scroll in more characters) + // or first character if cursor is at beginning + S32 new_last_visible_char = llmax(0, getCursor() - 1); + S32 min_scroll = mGLFont->firstDrawableChar(mText.getWString().c_str(), (F32)(mTextRightEdge - mTextLeftEdge), mText.length(), new_last_visible_char); if (old_cursor_pos == last_visible_char) { mScrollHPos = llmin(mText.length(), llmax(min_scroll, mScrollHPos + SCROLL_INCREMENT_ADD)); -- cgit v1.2.3 From 3f0762f65ad8ba9d4f854378ca2d2dd826470f4e Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Thu, 4 Feb 2010 20:40:30 +0200 Subject: Fixed normal bug EXT-4307 (There are no text context menues for Search text field and for IM text field) --HG-- branch : product-engine --- indra/llui/lllineeditor.cpp | 42 +++++++++++++++++++++++++++++++++++++++++- indra/llui/lllineeditor.h | 9 ++++++++- 2 files changed, 49 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index eb2b4f7705..00376cc4dd 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -55,6 +55,7 @@ #include "llui.h" #include "lluictrlfactory.h" #include "llclipboard.h" +#include "llmenugl.h" // // Imported globals @@ -164,7 +165,8 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mTentativeFgColor(p.text_tentative_color()), mHighlightColor(p.highlight_color()), mPreeditBgColor(p.preedit_bg_color()), - mGLFont(p.font) + mGLFont(p.font), + mContextMenuHandle() { llassert( mMaxLengthBytes > 0 ); @@ -191,6 +193,12 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) setCursor(mText.length()); setPrevalidate(p.prevalidate_callback()); + + LLContextMenu* menu = LLUICtrlFactory::instance().createFromFile + ("menu_text_editor.xml", + LLMenuGL::sMenuContainer, + LLMenuHolderGL::child_registry_t::instance()); + setContextMenu(menu); } LLLineEditor::~LLLineEditor() @@ -663,6 +671,16 @@ BOOL LLLineEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) return TRUE; } +BOOL LLLineEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + setFocus(TRUE); + if (!LLUICtrl::handleRightMouseDown(x, y, mask)) + { + showContextMenu(x, y); + } + return TRUE; +} + BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; @@ -2560,3 +2578,25 @@ LLWString LLLineEditor::getConvertedText() const } return text; } + +void LLLineEditor::showContextMenu(S32 x, S32 y) +{ + LLContextMenu* menu = static_cast(mContextMenuHandle.get()); + + if (menu) + { + gEditMenuHandler = this; + + S32 screen_x, screen_y; + localPointToScreen(x, y, &screen_x, &screen_y); + menu->show(screen_x, screen_y); + } +} + +void LLLineEditor::setContextMenu(LLContextMenu* new_context_menu) +{ + if (new_context_menu) + mContextMenuHandle = new_context_menu->getHandle(); + else + mContextMenuHandle.markDead(); +} diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 49e9539b16..a06a317f76 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -56,6 +56,7 @@ class LLFontGL; class LLLineEditorRollback; class LLButton; +class LLContextMenu; typedef boost::function LLLinePrevalidateFunc; @@ -113,6 +114,7 @@ protected: LLLineEditor(const Params&); friend class LLUICtrlFactory; friend class LLFloaterEditUI; + void showContextMenu(S32 x, S32 y); public: virtual ~LLLineEditor(); @@ -122,6 +124,7 @@ public: /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleDoubleClick(S32 x,S32 y,MASK mask); /*virtual*/ BOOL handleMiddleMouseDown(S32 x,S32 y,MASK mask); + /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask ); /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); /*virtual*/ void onMouseCaptureLost(); @@ -249,7 +252,9 @@ public: void updateHistory(); // stores current line in history void setReplaceNewlinesWithSpaces(BOOL replace); - + + void setContextMenu(LLContextMenu* new_context_menu); + private: // private helper methods @@ -348,6 +353,8 @@ protected: std::vector mPreeditPositions; LLPreeditor::standouts_t mPreeditStandouts; + LLHandle mContextMenuHandle; + private: // Instances that by default point to the statics but can be overidden in XML. LLPointer mBgImage; -- cgit v1.2.3 From 8eba0c4029a58616e82600e4a6b866c0b76096b3 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 8 Feb 2010 13:20:03 +0000 Subject: Add some asserts to catch some null derefs that, at least, the render-pipeline code seems to be hitting. --- indra/llui/llview.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index f1b08c380b..63e627ceb5 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1720,6 +1720,7 @@ LLView* LLView::findChildView(const std::string& name, BOOL recurse) const for ( child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) { LLView* childp = *child_it; + llassert(childp); if (childp->getName() == name) { return childp; @@ -1731,6 +1732,7 @@ LLView* LLView::findChildView(const std::string& name, BOOL recurse) const for ( child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) { LLView* childp = *child_it; + llassert(childp); LLView* viewp = childp->findChildView(name, recurse); if ( viewp ) { -- cgit v1.2.3 From 92ac9932878b4cd0b0369746482c6e1f47d76994 Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 4 Feb 2010 22:19:15 -0800 Subject: Fix placement of icon next to linked agent/group names. Suppresses rendering of text in LLNormalTextSegment that represent an icon, properly computes vertical spacing based on font height, and adds padding to the right of the icon. (transplanted from 33be702e47c359ccaeb47f251e10753fd173cc09) --- indra/llui/lltextbase.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index a83cc19d36..99c3179884 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1575,8 +1575,10 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c { LLStyle::Params icon; icon.image = image; - // HACK: fix spacing of images and remove the fixed char spacing - appendAndHighlightText(" ", prepend_newline, part, icon); + // Text will be replaced during rendering with the icon, + // but string cannot be empty or the segment won't be + // added (or drawn). + appendAndHighlightText(" ", prepend_newline, part, icon); prepend_newline = false; } } @@ -2297,14 +2299,21 @@ F32 LLNormalTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selec { if ( mStyle->isImage() && (start >= 0) && (end <= mEnd - mStart)) { + // ...for images, only render the image, not the underlying text, + // which is only a placeholder space LLColor4 color = LLColor4::white % mEditor.getDrawContext().mAlpha; LLUIImagePtr image = mStyle->getImage(); S32 style_image_height = image->getHeight(); S32 style_image_width = image->getWidth(); - // Center the image vertically - S32 image_bottom = draw_rect.getCenterY() - (style_image_height/2); + // Text is drawn from the top of the draw_rect downward + S32 text_center = draw_rect.mTop - (mFontHeight / 2); + // Align image to center of text + S32 image_bottom = text_center - (style_image_height / 2); image->draw(draw_rect.mLeft, image_bottom, style_image_width, style_image_height, color); + + const S32 IMAGE_HPAD = 2; + return draw_rect.mLeft + style_image_width + IMAGE_HPAD; } return drawClippedSegment( getStart() + start, getStart() + end, selection_start, selection_end, draw_rect); -- cgit v1.2.3 From bc5ad04d6164d186cf504212ea559405b8608811 Mon Sep 17 00:00:00 2001 From: Ychebotarev ProductEngine Date: Fri, 5 Feb 2010 09:41:54 +0200 Subject: applying patch for EXT-2357 --HG-- branch : product-engine --- indra/llui/lltabcontainer.cpp | 152 +++++++++++++++++++++++++++++++++++++++--- indra/llui/lltabcontainer.h | 26 +++++++- 2 files changed, 169 insertions(+), 9 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 6be76605fd..52fc2adb25 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -35,7 +35,6 @@ #include "lltabcontainer.h" #include "llfocusmgr.h" -#include "llbutton.h" #include "lllocalcliprect.h" #include "llrect.h" #include "llresizehandle.h" @@ -96,6 +95,92 @@ public: //---------------------------------------------------------------------------- +//============================================================================ +/* + * @file lltabcontainer.cpp + * @brief class implements LLButton with LLIconCtrl on it + */ +class LLCustomButtonIconCtrl : public LLButton +{ +public: + struct Params + : public LLInitParam::Block + { + // LEFT, RIGHT, TOP, BOTTOM paddings of LLIconCtrl in this class has same value + Optional icon_ctrl_pad; + + Optional icon_ctrl_width, + icon_ctrl_height; + Params(): + icon_ctrl_pad("icon_ctrl_pad", 0), + icon_ctrl_width("icon_ctrl_width", 16), + icon_ctrl_height("icon_ctrl_height", 16) + {} + }; + +protected: + friend class LLUICtrlFactory; + LLCustomButtonIconCtrl(const Params& p): + LLButton(p), + mIcon(NULL), + mIconCtrlPad(p.icon_ctrl_pad), + mIconCtrlWidht(p.icon_ctrl_width), + mIconCtrlHeight(p.icon_ctrl_height) + {} + +public: + + void updateLayout() + { + LLRect button_rect = getRect(); + LLRect icon_rect = mIcon->getRect(); + S32 pad = mIconCtrlPad * 2; + + switch(mIconAlignment) + { + case LLFontGL::LEFT: + icon_rect.setLeftTopAndSize(button_rect.mLeft + mIconCtrlPad, button_rect.mTop - mIconCtrlPad, mIconCtrlWidht - pad, mIconCtrlHeight - pad); + setLeftHPad(mIconCtrlWidht + pad); + break; + case LLFontGL::HCENTER: + //*TODO implement for HCENTER icon alignment + break; + case LLFontGL::RIGHT: + //*TODO implement for RIGHT icon alignment + break; + default: + break; + } + mIcon->setRect(icon_rect); + } + + void setIcon(LLIconCtrl* icon, LLFontGL::HAlign alignment = LLFontGL::LEFT) + { + if(icon) + { + if(mIcon) + { + removeChild(mIcon); + mIcon->die(); + } + mIcon = icon; + mIconAlignment = alignment; + + addChild(mIcon); + updateLayout(); + } + } + + +private: + LLIconCtrl* mIcon; + LLFontGL::HAlign mIconAlignment; + S32 mIconCtrlPad; + S32 mIconCtrlWidht; + S32 mIconCtrlHeight; +}; +//============================================================================ + struct LLPlaceHolderPanel : public LLPanel { // create dummy param block to register with "placeholder" nane @@ -127,7 +212,12 @@ LLTabContainer::Params::Params() tab_padding_right("tab_padding_right"), first_tab("first_tab"), middle_tab("middle_tab"), - last_tab("last_tab") + last_tab("last_tab"), + use_custom_icon_ctrl("use_custom_icon_ctrl", false), + tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0), + tab_icon_ctrl_width("tab_icon_ctrl_width"), + tab_icon_ctrl_height("tab_icon_ctrl_height") + { name(std::string("tab_container")); mouse_opaque = false; @@ -162,7 +252,11 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p) mFont(p.font), mFirstTabParams(p.first_tab), mMiddleTabParams(p.middle_tab), - mLastTabParams(p.last_tab) + mLastTabParams(p.last_tab), + mCustomIconCtrlUsed(p.use_custom_icon_ctrl), + mTabIconCtrlPad(p.tab_icon_ctrl_pad), + mTabIconCtrlWidth(p.tab_icon_ctrl_width), + mTabIconCtrlHeight(p.tab_icon_ctrl_height) { static LLUICachedControl tabcntr_vert_tab_min_width ("UITabCntrVertTabMinWidth", 0); @@ -942,7 +1036,14 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) { p.pad_left(indent); } - btn = LLUICtrlFactory::create(p); + if(mCustomIconCtrlUsed) + { + btn = createCustomButton(p); + } + else + { + btn = LLUICtrlFactory::create(p); + } } else { @@ -980,7 +1081,14 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) p.follows.flags = p.follows.flags() | FOLLOWS_BOTTOM; } -++ btn = LLUICtrlFactory::create(p); + if(mCustomIconCtrlUsed) + { + btn = createCustomButton(p); + } + else + { + btn = LLUICtrlFactory::create(p); + } } } @@ -1043,6 +1151,19 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) updateMaxScrollPos(); } +LLButton* LLTabContainer::createCustomButton(const LLButton::Params& p) +{ + LLCustomButtonIconCtrl::Params custom_btn_params; + LLButton::Params* btn_params_p = dynamic_cast(&custom_btn_params); + + btn_params_p->overwriteFrom(p); + custom_btn_params.icon_ctrl_pad(mTabIconCtrlPad); + custom_btn_params.icon_ctrl_width(mTabIconCtrlWidth); + custom_btn_params.icon_ctrl_height(mTabIconCtrlHeight); + + return LLUICtrlFactory::create(custom_btn_params); +} + void LLTabContainer::addPlaceholder(LLPanel* child, const std::string& label) { addTabPanel(TabPanelParams().panel(child).label(label).is_placeholder(true)); @@ -1484,7 +1605,7 @@ void LLTabContainer::setTabImage(LLPanel* child, std::string image_name, const L if( tuple ) { tuple->mButton->setImageOverlay(image_name, LLFontGL::LEFT, color); - reshape_tuple(tuple); + reshapeTuple(tuple); } } @@ -1494,11 +1615,26 @@ void LLTabContainer::setTabImage(LLPanel* child, const LLUUID& image_id, const L if( tuple ) { tuple->mButton->setImageOverlay(image_id, LLFontGL::LEFT, color); - reshape_tuple(tuple); + reshapeTuple(tuple); + } +} + +void LLTabContainer::setTabImage(LLPanel* child, LLIconCtrl* icon) +{ + LLTabTuple* tuple = getTabByPanel(child); + LLCustomButtonIconCtrl* button; + + if(tuple) + { + button = dynamic_cast(tuple->mButton); + if(button) + { + button->setIcon(icon); + } } } -void LLTabContainer::reshape_tuple(LLTabTuple* tuple) +void LLTabContainer::reshapeTuple(LLTabTuple* tuple) { static LLUICachedControl tab_padding ("UITabPadding", 0); static LLUICachedControl image_left_padding ("UIButtonImageLeftPadding", 4); diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index 2a55877d3c..278cf01375 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -36,6 +36,8 @@ #include "llpanel.h" #include "lltextbox.h" #include "llframetimer.h" +#include "lliconctrl.h" +#include "llbutton.h" class LLTabTuple; @@ -90,6 +92,21 @@ public: middle_tab, last_tab; + /** + * Use LLCustomButtonIconCtrl or LLButton in LLTabTuple + */ + Optional use_custom_icon_ctrl; + + /** + * Paddings for LLIconCtrl in case of LLCustomButtonIconCtrl usage(use_custom_icon_ctrl = true) + */ + Optional tab_icon_ctrl_pad; + /** + * LLIconCtrl size + */ + Optional tab_icon_ctrl_width, + tab_icon_ctrl_height; + Params(); }; @@ -173,6 +190,7 @@ public: void setTabPanelFlashing(LLPanel* child, BOOL state); void setTabImage(LLPanel* child, std::string img_name, const LLColor4& color = LLColor4::white); void setTabImage(LLPanel* child, const LLUUID& img_id, const LLColor4& color = LLColor4::white); + void setTabImage(LLPanel* child, LLIconCtrl* icon); void setTitle( const std::string& title ); const std::string getPanelTitle(S32 index); @@ -228,7 +246,8 @@ private: // updates tab button images given the tuple, tab position and the corresponding params void update_images(LLTabTuple* tuple, TabParams params, LLTabContainer::TabPosition pos); - void reshape_tuple(LLTabTuple* tuple); + void reshapeTuple(LLTabTuple* tuple); + LLButton* createCustomButton(const LLButton::Params& p); // Variables @@ -278,6 +297,11 @@ private: TabParams mFirstTabParams; TabParams mMiddleTabParams; TabParams mLastTabParams; + + bool mCustomIconCtrlUsed; + S32 mTabIconCtrlPad; + S32 mTabIconCtrlHeight; + S32 mTabIconCtrlWidth; }; #endif // LL_TABCONTAINER_H -- cgit v1.2.3 From 553cf40d136e70f4819cb2b72d0483287db81b17 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Fri, 5 Feb 2010 12:25:18 +0200 Subject: Updated low bug EXT-4951 - Redundant edit box context menu in list items in Panel Picks/Classifieds. Reverted changeset 8956:930bef051fee. Added new parameter to control context menu visibility. --HG-- branch : product-engine --- indra/llui/lltexteditor.cpp | 8 +++++--- indra/llui/lltexteditor.h | 7 ++++++- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 3fdb48b3ca..ac5a0376fc 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -242,7 +242,8 @@ LLTextEditor::Params::Params() handle_edit_keys_directly("handle_edit_keys_directly", false), show_line_numbers("show_line_numbers", false), default_color("default_color"), - commit_on_focus_lost("commit_on_focus_lost", false) + commit_on_focus_lost("commit_on_focus_lost", false), + show_context_menu("show_context_menu") {} LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) : @@ -258,7 +259,8 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) : mMouseDownX(0), mMouseDownY(0), mTabsToNextField(p.ignore_tab), - mContextMenu(NULL) + mContextMenu(NULL), + mShowContextMenu(p.show_context_menu) { mDefaultFont = p.font; @@ -720,7 +722,7 @@ BOOL LLTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) } if (!LLTextBase::handleRightMouseDown(x, y, mask)) { - if(getMouseOpaque()) + if(getChowContextMenu()) { showContextMenu(x, y); } diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index a136f9ccce..d96198d9ce 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -68,7 +68,8 @@ public: ignore_tab, handle_edit_keys_directly, show_line_numbers, - commit_on_focus_lost; + commit_on_focus_lost, + show_context_menu; //colors Optional default_color; @@ -200,6 +201,9 @@ public: const LLTextSegmentPtr getPreviousSegment() const; void getSelectedSegments(segment_vec_t& segments) const; + void setShowContextMenu(bool show) { mShowContextMenu = show; } + bool getChowContextMenu() const { return mShowContextMenu; } + protected: void showContextMenu(S32 x, S32 y); void drawPreeditMarker(); @@ -319,6 +323,7 @@ private: BOOL mTakesFocus; BOOL mAllowEmbeddedItems; + bool mShowContextMenu; LLUUID mSourceID; -- cgit v1.2.3 From b79b8f87a37888decd3f82e9e255cce641a3955f Mon Sep 17 00:00:00 2001 From: Ychebotarev ProductEngine Date: Fri, 5 Feb 2010 13:03:26 +0200 Subject: finished with EXT-2753 - Implement Avatar icons on IM multifloater tabs add floater flashing, fix group icon sizes, fix click,some code cleanup, ect. also I remove mIconCtrlWidth/Height since its kinda useless - mIconCtrlPad do the same thing... IconSize will be btn_height-2*mIconCtrlPad - simple and good enough. --HG-- branch : product-engine --- indra/llui/lltabcontainer.cpp | 65 ++++++++++++++++++------------------------- indra/llui/lltabcontainer.h | 8 ------ 2 files changed, 27 insertions(+), 46 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 52fc2adb25..d959d3099c 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -109,12 +109,8 @@ public: // LEFT, RIGHT, TOP, BOTTOM paddings of LLIconCtrl in this class has same value Optional icon_ctrl_pad; - Optional icon_ctrl_width, - icon_ctrl_height; Params(): - icon_ctrl_pad("icon_ctrl_pad", 0), - icon_ctrl_width("icon_ctrl_width", 16), - icon_ctrl_height("icon_ctrl_height", 16) + icon_ctrl_pad("icon_ctrl_pad", 1) {} }; @@ -123,9 +119,7 @@ protected: LLCustomButtonIconCtrl(const Params& p): LLButton(p), mIcon(NULL), - mIconCtrlPad(p.icon_ctrl_pad), - mIconCtrlWidht(p.icon_ctrl_width), - mIconCtrlHeight(p.icon_ctrl_height) + mIconCtrlPad(p.icon_ctrl_pad) {} public: @@ -134,19 +128,23 @@ public: { LLRect button_rect = getRect(); LLRect icon_rect = mIcon->getRect(); - S32 pad = mIconCtrlPad * 2; + + S32 icon_size = button_rect.getHeight() - 2*mIconCtrlPad; switch(mIconAlignment) { case LLFontGL::LEFT: - icon_rect.setLeftTopAndSize(button_rect.mLeft + mIconCtrlPad, button_rect.mTop - mIconCtrlPad, mIconCtrlWidht - pad, mIconCtrlHeight - pad); - setLeftHPad(mIconCtrlWidht + pad); + icon_rect.setLeftTopAndSize(button_rect.mLeft + mIconCtrlPad, button_rect.mTop - mIconCtrlPad, + icon_size, icon_size); + setLeftHPad(icon_size + mIconCtrlPad * 2); break; case LLFontGL::HCENTER: //*TODO implement for HCENTER icon alignment break; case LLFontGL::RIGHT: - //*TODO implement for RIGHT icon alignment + icon_rect.setLeftTopAndSize(button_rect.mRight - mIconCtrlPad - icon_size, button_rect.mTop - mIconCtrlPad, + icon_size, icon_size); + setRightHPad(icon_size + mIconCtrlPad * 2); break; default: break; @@ -176,8 +174,6 @@ private: LLIconCtrl* mIcon; LLFontGL::HAlign mIconAlignment; S32 mIconCtrlPad; - S32 mIconCtrlWidht; - S32 mIconCtrlHeight; }; //============================================================================ @@ -214,10 +210,7 @@ LLTabContainer::Params::Params() middle_tab("middle_tab"), last_tab("last_tab"), use_custom_icon_ctrl("use_custom_icon_ctrl", false), - tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0), - tab_icon_ctrl_width("tab_icon_ctrl_width"), - tab_icon_ctrl_height("tab_icon_ctrl_height") - + tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0) { name(std::string("tab_container")); mouse_opaque = false; @@ -254,9 +247,7 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p) mMiddleTabParams(p.middle_tab), mLastTabParams(p.last_tab), mCustomIconCtrlUsed(p.use_custom_icon_ctrl), - mTabIconCtrlPad(p.tab_icon_ctrl_pad), - mTabIconCtrlWidth(p.tab_icon_ctrl_width), - mTabIconCtrlHeight(p.tab_icon_ctrl_height) + mTabIconCtrlPad(p.tab_icon_ctrl_pad) { static LLUICachedControl tabcntr_vert_tab_min_width ("UITabCntrVertTabMinWidth", 0); @@ -999,6 +990,11 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) LLTextBox* textbox = NULL; LLButton* btn = NULL; + LLCustomButtonIconCtrl::Params custom_btn_params; + { + custom_btn_params.icon_ctrl_pad(mTabIconCtrlPad); + } + LLButton::Params normal_btn_params; if (placeholder) { @@ -1018,7 +1014,9 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) { if (mIsVertical) { - LLButton::Params p; + LLButton::Params& p = (mCustomIconCtrlUsed)? + custom_btn_params:normal_btn_params; + p.name(std::string("vert tab button")); p.rect(btn_rect); p.follows.flags(FOLLOWS_TOP | FOLLOWS_LEFT); @@ -1036,9 +1034,12 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) { p.pad_left(indent); } + + if(mCustomIconCtrlUsed) { - btn = createCustomButton(p); + btn = LLUICtrlFactory::create(custom_btn_params); + } else { @@ -1047,7 +1048,8 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) } else { - LLButton::Params p; + LLButton::Params& p = (mCustomIconCtrlUsed)? + custom_btn_params:normal_btn_params; p.name(std::string(child->getName()) + " tab"); p.rect(btn_rect); p.click_callback.function(boost::bind(&LLTabContainer::onTabBtn, this, _2, child)); @@ -1083,7 +1085,7 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) if(mCustomIconCtrlUsed) { - btn = createCustomButton(p); + btn = LLUICtrlFactory::create(custom_btn_params); } else { @@ -1151,19 +1153,6 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) updateMaxScrollPos(); } -LLButton* LLTabContainer::createCustomButton(const LLButton::Params& p) -{ - LLCustomButtonIconCtrl::Params custom_btn_params; - LLButton::Params* btn_params_p = dynamic_cast(&custom_btn_params); - - btn_params_p->overwriteFrom(p); - custom_btn_params.icon_ctrl_pad(mTabIconCtrlPad); - custom_btn_params.icon_ctrl_width(mTabIconCtrlWidth); - custom_btn_params.icon_ctrl_height(mTabIconCtrlHeight); - - return LLUICtrlFactory::create(custom_btn_params); -} - void LLTabContainer::addPlaceholder(LLPanel* child, const std::string& label) { addTabPanel(TabPanelParams().panel(child).label(label).is_placeholder(true)); diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index 278cf01375..4b5d45fb73 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -101,11 +101,6 @@ public: * Paddings for LLIconCtrl in case of LLCustomButtonIconCtrl usage(use_custom_icon_ctrl = true) */ Optional tab_icon_ctrl_pad; - /** - * LLIconCtrl size - */ - Optional tab_icon_ctrl_width, - tab_icon_ctrl_height; Params(); }; @@ -247,7 +242,6 @@ private: // updates tab button images given the tuple, tab position and the corresponding params void update_images(LLTabTuple* tuple, TabParams params, LLTabContainer::TabPosition pos); void reshapeTuple(LLTabTuple* tuple); - LLButton* createCustomButton(const LLButton::Params& p); // Variables @@ -300,8 +294,6 @@ private: bool mCustomIconCtrlUsed; S32 mTabIconCtrlPad; - S32 mTabIconCtrlHeight; - S32 mTabIconCtrlWidth; }; #endif // LL_TABCONTAINER_H -- cgit v1.2.3 From cc0895b90039a6446f7c9a0ab71518d445175c0f Mon Sep 17 00:00:00 2001 From: Ychebotarev ProductEngine Date: Fri, 5 Feb 2010 13:20:12 +0200 Subject: a bit more on EXT-2753. --HG-- branch : product-engine --- indra/llui/lltabcontainer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index d959d3099c..19408989a5 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -139,7 +139,9 @@ public: setLeftHPad(icon_size + mIconCtrlPad * 2); break; case LLFontGL::HCENTER: - //*TODO implement for HCENTER icon alignment + icon_rect.setLeftTopAndSize(button_rect.mRight - (button_rect.getWidth() + mIconCtrlPad - icon_size)/2, button_rect.mTop - mIconCtrlPad, + icon_size, icon_size); + setRightHPad(icon_size + mIconCtrlPad * 2); break; case LLFontGL::RIGHT: icon_rect.setLeftTopAndSize(button_rect.mRight - mIconCtrlPad - icon_size, button_rect.mTop - mIconCtrlPad, -- cgit v1.2.3 From 782cb6ee87f1180101fbcb5b6403871dea345fd0 Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Fri, 5 Feb 2010 17:09:22 +0200 Subject: Fixed normal bug EXT-4702 (Elements of type context_menu cannot have font set in XUI xml) --HG-- branch : product-engine --- indra/llui/llmenugl.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 7fa9a88059..d18abbfb2f 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3941,7 +3941,6 @@ BOOL LLContextMenu::appendContextSubMenu(LLContextMenu *menu) item = LLUICtrlFactory::create(p); LLMenuGL::sMenuContainer->addChild(item->getBranch()); - item->setFont( LLFontGL::getFontSansSerif() ); return append( item ); } -- cgit v1.2.3 From 77b5a39cc1daa79ceea599aea3f680127c9949b1 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Fri, 5 Feb 2010 17:34:50 +0200 Subject: Fixed normal bug EXT - 3232 (Make button image overlay placement adjustable via xml) --HG-- branch : product-engine --- indra/llui/llbutton.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 4944ed4fe7..14b77925f2 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -771,12 +771,7 @@ void LLButton::draw() center_x++; } - S32 text_width_delta = overlay_width + 1; - // if image paddings set, they should participate in scaling process - S32 image_size_delta = mImageOverlayTopPad + mImageOverlayBottomPad; - overlay_width = overlay_width - image_size_delta; - overlay_height = overlay_height - image_size_delta; - + center_y += (mImageOverlayBottomPad - mImageOverlayTopPad); // fade out overlay images on disabled buttons LLColor4 overlay_color = mImageOverlayColor.get(); if (!enabled) @@ -788,10 +783,9 @@ void LLButton::draw() switch(mImageOverlayAlignment) { case LLFontGL::LEFT: - text_left += overlay_width + mImageOverlayRightPad + 1; - text_width -= text_width_delta; + text_left += overlay_width + 1; mImageOverlay->draw( - mLeftHPad, + mImageOverlayLeftPad, center_y - (overlay_height / 2), overlay_width, overlay_height, @@ -806,10 +800,9 @@ void LLButton::draw() overlay_color); break; case LLFontGL::RIGHT: - text_right -= overlay_width + mImageOverlayLeftPad+ 1; - text_width -= text_width_delta; + text_right -= overlay_width + 1; mImageOverlay->draw( - getRect().getWidth() - mRightHPad - overlay_width, + getRect().getWidth() - mImageOverlayRightPad - overlay_width, center_y - (overlay_height / 2), overlay_width, overlay_height, -- cgit v1.2.3 From 95147c4529f6effcd1ed0a1d427f8ddeb033670d Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Fri, 5 Feb 2010 19:15:12 +0200 Subject: Implemented critical task (EXT-4703) Add maturity icons to the Viewer 2 toolbar. - Added maturity icons to location bar. - Added getting font used in LLLineEditor. --HG-- branch : product-engine --- indra/llui/lllineeditor.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index a06a317f76..f275dfc45a 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -207,6 +207,8 @@ public: const LLColor4& getReadOnlyFgColor() const { return mReadOnlyFgColor.get(); } const LLColor4& getTentativeFgColor() const { return mTentativeFgColor.get(); } + const LLFontGL* getFont() const { return mGLFont; } + void setIgnoreArrowKeys(BOOL b) { mIgnoreArrowKeys = b; } void setIgnoreTab(BOOL b) { mIgnoreTab = b; } void setPassDelete(BOOL b) { mPassDelete = b; } -- cgit v1.2.3 From ddfc6efbeeda5d2b08888a7ae0f04df242326e26 Mon Sep 17 00:00:00 2001 From: richard Date: Fri, 5 Feb 2010 11:32:33 -0800 Subject: EXT-5025 - Tooltips block mouse clicks EXT-4547 [BSI] it is possible to highlight multiple layers of chat EXT-3844 Mouse wheel camera zoom is not reflected on View popup slider EXT-3103 Add an option to restrict entering non-ascii symbols in text editor. reviewed by Leyla --- indra/llui/CMakeLists.txt | 2 + indra/llui/lllineeditor.cpp | 271 +---------------------------------- indra/llui/lllineeditor.h | 27 +--- indra/llui/llmultisliderctrl.cpp | 2 +- indra/llui/llpanel.cpp | 2 +- indra/llui/llpanel.h | 2 +- indra/llui/llsliderctrl.cpp | 2 +- indra/llui/llspinctrl.cpp | 2 +- indra/llui/lltexteditor.cpp | 48 ++++++- indra/llui/lltexteditor.h | 3 + indra/llui/lltextvalidate.cpp | 302 +++++++++++++++++++++++++++++++++++++++ indra/llui/lltextvalidate.h | 63 ++++++++ indra/llui/lltooltip.h | 3 +- 13 files changed, 428 insertions(+), 301 deletions(-) create mode 100644 indra/llui/lltextvalidate.cpp create mode 100644 indra/llui/lltextvalidate.h (limited to 'indra/llui') diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index ce068618e2..853f6f173d 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -90,6 +90,7 @@ set(llui_SOURCE_FILES lltextbox.cpp lltexteditor.cpp lltextparser.cpp + lltextvalidate.cpp lltransutil.cpp lltoggleablemenu.cpp lltooltip.cpp @@ -182,6 +183,7 @@ set(llui_HEADER_FILES lltextbox.h lltexteditor.h lltextparser.h + lltextvalidate.h lltoggleablemenu.h lltooltip.h lltransutil.h diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 3e277f47b5..0c3d50ef4e 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -82,19 +82,6 @@ template class LLLineEditor* LLView::getChild( // Member functions // -void LLLineEditor::PrevalidateNamedFuncs::declareValues() -{ - declare("ascii", LLLineEditor::prevalidateASCII); - declare("float", LLLineEditor::prevalidateFloat); - declare("int", LLLineEditor::prevalidateInt); - declare("positive_s32", LLLineEditor::prevalidatePositiveS32); - declare("non_negative_s32", LLLineEditor::prevalidateNonNegativeS32); - declare("alpha_num", LLLineEditor::prevalidateAlphaNum); - declare("alpha_num_space", LLLineEditor::prevalidateAlphaNumSpace); - declare("ascii_printable_no_pipe", LLLineEditor::prevalidateASCIIPrintableNoPipe); - declare("ascii_printable_no_space", LLLineEditor::prevalidateASCIIPrintableNoSpace); -} - LLLineEditor::Params::Params() : max_length_bytes("max_length", 254), keystroke_callback("keystroke_callback"), @@ -1966,51 +1953,12 @@ void LLLineEditor::setRect(const LLRect& rect) } } -void LLLineEditor::setPrevalidate(LLLinePrevalidateFunc func) +void LLLineEditor::setPrevalidate(LLTextValidate::validate_func_t func) { mPrevalidateFunc = func; updateAllowingLanguageInput(); } -// Limits what characters can be used to [1234567890.-] with [-] only valid in the first position. -// Does NOT ensure that the string is a well-formed number--that's the job of post-validation--for -// the simple reasons that intermediate states may be invalid even if the final result is valid. -// -// static -BOOL LLLineEditor::prevalidateFloat(const LLWString &str) -{ - LLLocale locale(LLLocale::USER_LOCALE); - - BOOL success = TRUE; - LLWString trimmed = str; - LLWStringUtil::trim(trimmed); - S32 len = trimmed.length(); - if( 0 < len ) - { - // May be a comma or period, depending on the locale - llwchar decimal_point = (llwchar)LLResMgr::getInstance()->getDecimalPoint(); - - S32 i = 0; - - // First character can be a negative sign - if( '-' == trimmed[0] ) - { - i++; - } - - for( ; i < len; i++ ) - { - if( (decimal_point != trimmed[i] ) && !LLStringOps::isDigit( trimmed[i] ) ) - { - success = FALSE; - break; - } - } - } - - return success; -} - // static BOOL LLLineEditor::postvalidateFloat(const std::string &str) { @@ -2070,223 +2018,6 @@ BOOL LLLineEditor::postvalidateFloat(const std::string &str) return success; } -// Limits what characters can be used to [1234567890-] with [-] only valid in the first position. -// Does NOT ensure that the string is a well-formed number--that's the job of post-validation--for -// the simple reasons that intermediate states may be invalid even if the final result is valid. -// -// static -BOOL LLLineEditor::prevalidateInt(const LLWString &str) -{ - LLLocale locale(LLLocale::USER_LOCALE); - - BOOL success = TRUE; - LLWString trimmed = str; - LLWStringUtil::trim(trimmed); - S32 len = trimmed.length(); - if( 0 < len ) - { - S32 i = 0; - - // First character can be a negative sign - if( '-' == trimmed[0] ) - { - i++; - } - - for( ; i < len; i++ ) - { - if( !LLStringOps::isDigit( trimmed[i] ) ) - { - success = FALSE; - break; - } - } - } - - return success; -} - -// static -BOOL LLLineEditor::prevalidatePositiveS32(const LLWString &str) -{ - LLLocale locale(LLLocale::USER_LOCALE); - - LLWString trimmed = str; - LLWStringUtil::trim(trimmed); - S32 len = trimmed.length(); - BOOL success = TRUE; - if(0 < len) - { - if(('-' == trimmed[0]) || ('0' == trimmed[0])) - { - success = FALSE; - } - S32 i = 0; - while(success && (i < len)) - { - if(!LLStringOps::isDigit(trimmed[i++])) - { - success = FALSE; - } - } - } - if (success) - { - S32 val = strtol(wstring_to_utf8str(trimmed).c_str(), NULL, 10); - if (val <= 0) - { - success = FALSE; - } - } - return success; -} - -BOOL LLLineEditor::prevalidateNonNegativeS32(const LLWString &str) -{ - LLLocale locale(LLLocale::USER_LOCALE); - - LLWString trimmed = str; - LLWStringUtil::trim(trimmed); - S32 len = trimmed.length(); - BOOL success = TRUE; - if(0 < len) - { - if('-' == trimmed[0]) - { - success = FALSE; - } - S32 i = 0; - while(success && (i < len)) - { - if(!LLStringOps::isDigit(trimmed[i++])) - { - success = FALSE; - } - } - } - if (success) - { - S32 val = strtol(wstring_to_utf8str(trimmed).c_str(), NULL, 10); - if (val < 0) - { - success = FALSE; - } - } - return success; -} - -BOOL LLLineEditor::prevalidateAlphaNum(const LLWString &str) -{ - LLLocale locale(LLLocale::USER_LOCALE); - - BOOL rv = TRUE; - S32 len = str.length(); - if(len == 0) return rv; - while(len--) - { - if( !LLStringOps::isAlnum((char)str[len]) ) - { - rv = FALSE; - break; - } - } - return rv; -} - -// static -BOOL LLLineEditor::prevalidateAlphaNumSpace(const LLWString &str) -{ - LLLocale locale(LLLocale::USER_LOCALE); - - BOOL rv = TRUE; - S32 len = str.length(); - if(len == 0) return rv; - while(len--) - { - if(!(LLStringOps::isAlnum((char)str[len]) || (' ' == str[len]))) - { - rv = FALSE; - break; - } - } - return rv; -} - -// Used for most names of things stored on the server, due to old file-formats -// that used the pipe (|) for multiline text storage. Examples include -// inventory item names, parcel names, object names, etc. -// static -BOOL LLLineEditor::prevalidateASCIIPrintableNoPipe(const LLWString &str) -{ - BOOL rv = TRUE; - S32 len = str.length(); - if(len == 0) return rv; - while(len--) - { - llwchar wc = str[len]; - if (wc < 0x20 - || wc > 0x7f - || wc == '|') - { - rv = FALSE; - break; - } - if(!(wc == ' ' - || LLStringOps::isAlnum((char)wc) - || LLStringOps::isPunct((char)wc) ) ) - { - rv = FALSE; - break; - } - } - return rv; -} - - -// Used for avatar names -// static -BOOL LLLineEditor::prevalidateASCIIPrintableNoSpace(const LLWString &str) -{ - BOOL rv = TRUE; - S32 len = str.length(); - if(len == 0) return rv; - while(len--) - { - llwchar wc = str[len]; - if (wc < 0x20 - || wc > 0x7f - || LLStringOps::isSpace(wc)) - { - rv = FALSE; - break; - } - if( !(LLStringOps::isAlnum((char)str[len]) || - LLStringOps::isPunct((char)str[len]) ) ) - { - rv = FALSE; - break; - } - } - return rv; -} - - -// static -BOOL LLLineEditor::prevalidateASCII(const LLWString &str) -{ - BOOL rv = TRUE; - S32 len = str.length(); - while(len--) - { - if (str[len] < 0x20 || str[len] > 0x7f) - { - rv = FALSE; - break; - } - } - return rv; -} - void LLLineEditor::onMouseCaptureLost() { endSelection(); diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 49e9539b16..9216e47490 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -51,26 +51,17 @@ #include "llviewborder.h" #include "llpreeditor.h" -#include +#include "lltextvalidate.h" class LLFontGL; class LLLineEditorRollback; class LLButton; -typedef boost::function LLLinePrevalidateFunc; - class LLLineEditor : public LLUICtrl, public LLEditMenuHandler, protected LLPreeditor { public: - struct PrevalidateNamedFuncs - : public LLInitParam::TypeValuesHelper - - { - static void declareValues(); - }; - typedef boost::function keystroke_callback_t; struct Params : public LLInitParam::Block @@ -80,7 +71,7 @@ public: Optional keystroke_callback; - Optional prevalidate_callback; + Optional prevalidate_callback; Optional border; @@ -231,17 +222,7 @@ public: void setTextPadding(S32 left, S32 right); // Prevalidation controls which keystrokes can affect the editor - void setPrevalidate( LLLinePrevalidateFunc func ); - static BOOL prevalidateFloat(const LLWString &str ); - static BOOL prevalidateInt(const LLWString &str ); - static BOOL prevalidatePositiveS32(const LLWString &str); - static BOOL prevalidateNonNegativeS32(const LLWString &str); - static BOOL prevalidateAlphaNum(const LLWString &str ); - static BOOL prevalidateAlphaNumSpace(const LLWString &str ); - static BOOL prevalidateASCIIPrintableNoPipe(const LLWString &str); - static BOOL prevalidateASCIIPrintableNoSpace(const LLWString &str); - static BOOL prevalidateASCII(const LLWString &str); - + void setPrevalidate( LLTextValidate::validate_func_t func ); static BOOL postvalidateFloat(const std::string &str); // line history support: @@ -319,7 +300,7 @@ protected: S32 mLastSelectionStart; S32 mLastSelectionEnd; - LLLinePrevalidateFunc mPrevalidateFunc; + LLTextValidate::validate_func_t mPrevalidateFunc; LLFrameTimer mKeystrokeTimer; LLTimer mTripleClickTimer; diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index f4434a0f78..cb81c39103 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -138,7 +138,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLMultiSliderCtrl::Params& p) params.font(p.font); params.max_length_bytes(MAX_STRING_LENGTH); params.commit_callback.function(LLMultiSliderCtrl::onEditorCommit); - params.prevalidate_callback(&LLLineEditor::prevalidateFloat); + params.prevalidate_callback(&LLTextValidate::validateFloat); params.follows.flags(FOLLOWS_LEFT | FOLLOWS_BOTTOM); mEditor = LLUICtrlFactory::create (params); mEditor->setFocusReceivedCallback( boost::bind(LLMultiSliderCtrl::onEditorGainFocus, _1, this) ); diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 7f23fe2671..7b406e090a 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -936,7 +936,7 @@ LLPanel *LLPanel::childGetVisiblePanelWithHelp() return ::childGetVisiblePanelWithHelp(this); } -void LLPanel::childSetPrevalidate(const std::string& id, BOOL (*func)(const LLWString &) ) +void LLPanel::childSetPrevalidate(const std::string& id, bool (*func)(const LLWString &) ) { LLLineEditor* child = findChild(id); if (child) diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 6de83fe3a7..4e53fd7ea3 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -226,7 +226,7 @@ public: std::string childGetText(const std::string& id) const { return childGetValue(id).asString(); } // LLLineEditor - void childSetPrevalidate(const std::string& id, BOOL (*func)(const LLWString &) ); + void childSetPrevalidate(const std::string& id, bool (*func)(const LLWString &) ); // LLButton void childSetAction(const std::string& id, boost::function function, void* value = NULL); diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index 01c274bb4e..80ee5d0984 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -141,7 +141,7 @@ LLSliderCtrl::LLSliderCtrl(const LLSliderCtrl::Params& p) line_p.rect.setIfNotProvided(text_rect); line_p.font.setIfNotProvided(p.font); line_p.commit_callback.function(&LLSliderCtrl::onEditorCommit); - line_p.prevalidate_callback(&LLLineEditor::prevalidateFloat); + line_p.prevalidate_callback(&LLTextValidate::validateFloat); mEditor = LLUICtrlFactory::create(line_p); mEditor->setFocusReceivedCallback( boost::bind(&LLSliderCtrl::onEditorGainFocus, _1, this )); diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index 28f3788817..491cd7b6f3 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -127,7 +127,7 @@ LLSpinCtrl::LLSpinCtrl(const LLSpinCtrl::Params& p) } params.max_length_bytes(MAX_STRING_LENGTH); params.commit_callback.function((boost::bind(&LLSpinCtrl::onEditorCommit, this, _2))); - params.prevalidate_callback(&LLLineEditor::prevalidateFloat); + params.prevalidate_callback(&LLTextValidate::validateFloat); params.follows.flags(FOLLOWS_LEFT | FOLLOWS_BOTTOM); mEditor = LLUICtrlFactory::create (params); mEditor->setFocusReceivedCallback( boost::bind(&LLSpinCtrl::onEditorGainFocus, _1, this )); diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 3fdb48b3ca..e196abc89a 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -237,13 +237,16 @@ private: /////////////////////////////////////////////////////////////////// LLTextEditor::Params::Params() : default_text("default_text"), + prevalidate_callback("prevalidate_callback"), embedded_items("embedded_items", false), ignore_tab("ignore_tab", true), handle_edit_keys_directly("handle_edit_keys_directly", false), show_line_numbers("show_line_numbers", false), default_color("default_color"), commit_on_focus_lost("commit_on_focus_lost", false) -{} +{ + addSynonym(prevalidate_callback, "text_type"); +} LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) : LLTextBase(p), @@ -258,6 +261,7 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) : mMouseDownX(0), mMouseDownY(0), mTabsToNextField(p.ignore_tab), + mPrevalidateFunc(p.prevalidate_callback()), mContextMenu(NULL) { mDefaultFont = p.font; @@ -318,9 +322,20 @@ LLTextEditor::~LLTextEditor() void LLTextEditor::setText(const LLStringExplicit &utf8str, const LLStyle::Params& input_params) { + // validate incoming text if necessary + if (mPrevalidateFunc) + { + LLWString test_text = utf8str_to_wstring(utf8str); + if (!mPrevalidateFunc(test_text)) + { + // not valid text, nothing to do + return; + } + } + blockUndo(); deselect(); - + LLTextBase::setText(utf8str, input_params); resetDirty(); @@ -909,6 +924,21 @@ S32 LLTextEditor::execute( TextCmd* cmd ) // Push the new command is now on the top (front) of the undo stack. mUndoStack.push_front(cmd); mLastCmd = cmd; + + bool need_to_rollback = mPrevalidateFunc + && !mPrevalidateFunc(getViewModel()->getDisplay()); + if (need_to_rollback) + { + // get rid of this last command and clean up undo stack + undo(); + + // remove any evidence of this command from redo history + mUndoStack.pop_front(); + delete cmd; + + // failure, nothing changed + delta = 0; + } } else { @@ -1032,7 +1062,21 @@ S32 LLTextEditor::addChar(S32 pos, llwchar wc) if (mLastCmd && mLastCmd->canExtend(pos)) { S32 delta = 0; + if (mPrevalidateFunc) + { + // get a copy of current text contents + LLWString test_string(getViewModel()->getDisplay()); + + // modify text contents as if this addChar succeeded + llassert(pos <= (S32)test_string.size()); + test_string.insert(pos, 1, wc); + if (!mPrevalidateFunc( test_string)) + { + return 0; + } + } mLastCmd->extendAndExecute(this, pos, wc, &delta); + return delta; } else diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index a136f9ccce..61ba45c598 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -44,6 +44,7 @@ #include "lldarray.h" #include "llviewborder.h" // for params #include "lltextbase.h" +#include "lltextvalidate.h" #include "llpreeditor.h" #include "llcontrol.h" @@ -63,6 +64,7 @@ public: struct Params : public LLInitParam::Block { Optional default_text; + Optional prevalidate_callback; Optional embedded_items, ignore_tab, @@ -329,6 +331,7 @@ private: LLCoordGL mLastIMEPosition; // Last position of the IME editor keystroke_signal_t mKeystrokeSignal; + LLTextValidate::validate_func_t mPrevalidateFunc; LLContextMenu* mContextMenu; }; // end class LLTextEditor diff --git a/indra/llui/lltextvalidate.cpp b/indra/llui/lltextvalidate.cpp new file mode 100644 index 0000000000..f9829465da --- /dev/null +++ b/indra/llui/lltextvalidate.cpp @@ -0,0 +1,302 @@ +/** + * @file lltextvalidate.cpp + * @brief Text validation helper functions + * + * $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 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("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. + * $/LicenseInfo$ + */ + +// Text editor widget to let users enter a single line. + +#include "linden_common.h" + +#include "lltextvalidate.h" +#include "llresmgr.h" // for LLLocale + +namespace LLTextValidate +{ + void ValidateTextNamedFuncs::declareValues() + { + declare("ascii", validateASCII); + declare("float", validateFloat); + declare("int", validateInt); + declare("positive_s32", validatePositiveS32); + declare("non_negative_s32", validateNonNegativeS32); + declare("alpha_num", validateAlphaNum); + declare("alpha_num_space", validateAlphaNumSpace); + declare("ascii_printable_no_pipe", validateASCIIPrintableNoPipe); + declare("ascii_printable_no_space", validateASCIIPrintableNoSpace); + } + + // Limits what characters can be used to [1234567890.-] with [-] only valid in the first position. + // Does NOT ensure that the string is a well-formed number--that's the job of post-validation--for + // the simple reasons that intermediate states may be invalid even if the final result is valid. + // + bool validateFloat(const LLWString &str) + { + LLLocale locale(LLLocale::USER_LOCALE); + + bool success = TRUE; + LLWString trimmed = str; + LLWStringUtil::trim(trimmed); + S32 len = trimmed.length(); + if( 0 < len ) + { + // May be a comma or period, depending on the locale + llwchar decimal_point = (llwchar)LLResMgr::getInstance()->getDecimalPoint(); + + S32 i = 0; + + // First character can be a negative sign + if( '-' == trimmed[0] ) + { + i++; + } + + for( ; i < len; i++ ) + { + if( (decimal_point != trimmed[i] ) && !LLStringOps::isDigit( trimmed[i] ) ) + { + success = FALSE; + break; + } + } + } + + return success; + } + + // Limits what characters can be used to [1234567890-] with [-] only valid in the first position. + // Does NOT ensure that the string is a well-formed number--that's the job of post-validation--for + // the simple reasons that intermediate states may be invalid even if the final result is valid. + // + bool validateInt(const LLWString &str) + { + LLLocale locale(LLLocale::USER_LOCALE); + + bool success = TRUE; + LLWString trimmed = str; + LLWStringUtil::trim(trimmed); + S32 len = trimmed.length(); + if( 0 < len ) + { + S32 i = 0; + + // First character can be a negative sign + if( '-' == trimmed[0] ) + { + i++; + } + + for( ; i < len; i++ ) + { + if( !LLStringOps::isDigit( trimmed[i] ) ) + { + success = FALSE; + break; + } + } + } + + return success; + } + + bool validatePositiveS32(const LLWString &str) + { + LLLocale locale(LLLocale::USER_LOCALE); + + LLWString trimmed = str; + LLWStringUtil::trim(trimmed); + S32 len = trimmed.length(); + bool success = TRUE; + if(0 < len) + { + if(('-' == trimmed[0]) || ('0' == trimmed[0])) + { + success = FALSE; + } + S32 i = 0; + while(success && (i < len)) + { + if(!LLStringOps::isDigit(trimmed[i++])) + { + success = FALSE; + } + } + } + if (success) + { + S32 val = strtol(wstring_to_utf8str(trimmed).c_str(), NULL, 10); + if (val <= 0) + { + success = FALSE; + } + } + return success; + } + + bool validateNonNegativeS32(const LLWString &str) + { + LLLocale locale(LLLocale::USER_LOCALE); + + LLWString trimmed = str; + LLWStringUtil::trim(trimmed); + S32 len = trimmed.length(); + bool success = TRUE; + if(0 < len) + { + if('-' == trimmed[0]) + { + success = FALSE; + } + S32 i = 0; + while(success && (i < len)) + { + if(!LLStringOps::isDigit(trimmed[i++])) + { + success = FALSE; + } + } + } + if (success) + { + S32 val = strtol(wstring_to_utf8str(trimmed).c_str(), NULL, 10); + if (val < 0) + { + success = FALSE; + } + } + return success; + } + + bool validateAlphaNum(const LLWString &str) + { + LLLocale locale(LLLocale::USER_LOCALE); + + bool rv = TRUE; + S32 len = str.length(); + if(len == 0) return rv; + while(len--) + { + if( !LLStringOps::isAlnum((char)str[len]) ) + { + rv = FALSE; + break; + } + } + return rv; + } + + bool validateAlphaNumSpace(const LLWString &str) + { + LLLocale locale(LLLocale::USER_LOCALE); + + bool rv = TRUE; + S32 len = str.length(); + if(len == 0) return rv; + while(len--) + { + if(!(LLStringOps::isAlnum((char)str[len]) || (' ' == str[len]))) + { + rv = FALSE; + break; + } + } + return rv; + } + + // Used for most names of things stored on the server, due to old file-formats + // that used the pipe (|) for multiline text storage. Examples include + // inventory item names, parcel names, object names, etc. + bool validateASCIIPrintableNoPipe(const LLWString &str) + { + bool rv = TRUE; + S32 len = str.length(); + if(len == 0) return rv; + while(len--) + { + llwchar wc = str[len]; + if (wc < 0x20 + || wc > 0x7f + || wc == '|') + { + rv = FALSE; + break; + } + if(!(wc == ' ' + || LLStringOps::isAlnum((char)wc) + || LLStringOps::isPunct((char)wc) ) ) + { + rv = FALSE; + break; + } + } + return rv; + } + + + // Used for avatar names + bool validateASCIIPrintableNoSpace(const LLWString &str) + { + bool rv = TRUE; + S32 len = str.length(); + if(len == 0) return rv; + while(len--) + { + llwchar wc = str[len]; + if (wc < 0x20 + || wc > 0x7f + || LLStringOps::isSpace(wc)) + { + rv = FALSE; + break; + } + if( !(LLStringOps::isAlnum((char)str[len]) || + LLStringOps::isPunct((char)str[len]) ) ) + { + rv = FALSE; + break; + } + } + return rv; + } + + bool validateASCII(const LLWString &str) + { + bool rv = TRUE; + S32 len = str.length(); + while(len--) + { + if (str[len] < 0x20 || str[len] > 0x7f) + { + rv = FALSE; + break; + } + } + return rv; + } +} \ No newline at end of file diff --git a/indra/llui/lltextvalidate.h b/indra/llui/lltextvalidate.h new file mode 100644 index 0000000000..f9826bf74e --- /dev/null +++ b/indra/llui/lltextvalidate.h @@ -0,0 +1,63 @@ +/** + * @file lltextbase.h + * @author Martin Reddy + * @brief The base class of text box/editor, providing Url handling support + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 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 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("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. + * $/LicenseInfo$ + */ + +#ifndef LL_LLTEXTVALIDATE_H +#define LL_LLTEXTVALIDATE_H + +#include "llstring.h" +#include "llinitparam.h" +#include + +namespace LLTextValidate +{ + typedef boost::function validate_func_t; + + struct ValidateTextNamedFuncs + : public LLInitParam::TypeValuesHelper + { + static void declareValues(); + }; + + bool validateFloat(const LLWString &str ); + bool validateInt(const LLWString &str ); + bool validatePositiveS32(const LLWString &str); + bool validateNonNegativeS32(const LLWString &str); + bool validateAlphaNum(const LLWString &str ); + bool validateAlphaNumSpace(const LLWString &str ); + bool validateASCIIPrintableNoPipe(const LLWString &str); + bool validateASCIIPrintableNoSpace(const LLWString &str); + bool validateASCII(const LLWString &str); +} + + +#endif \ No newline at end of file diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h index 7978b6a583..c0811c56c3 100644 --- a/indra/llui/lltooltip.h +++ b/indra/llui/lltooltip.h @@ -129,7 +129,8 @@ private: class LLInspector : public LLToolTip { public: - struct Params : public LLInitParam::Block {}; + struct Params : public LLInitParam::Block + {}; }; class LLToolTipMgr : public LLSingleton -- cgit v1.2.3 From 124d8e63f7d41fa779350096ce694b945f138850 Mon Sep 17 00:00:00 2001 From: richard Date: Fri, 5 Feb 2010 13:22:46 -0800 Subject: newlines fixed --- indra/llui/lltextvalidate.cpp | 2 +- indra/llui/lltextvalidate.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextvalidate.cpp b/indra/llui/lltextvalidate.cpp index f9829465da..8b6bc5bd7d 100644 --- a/indra/llui/lltextvalidate.cpp +++ b/indra/llui/lltextvalidate.cpp @@ -299,4 +299,4 @@ namespace LLTextValidate } return rv; } -} \ No newline at end of file +} diff --git a/indra/llui/lltextvalidate.h b/indra/llui/lltextvalidate.h index f9826bf74e..9cc830f5aa 100644 --- a/indra/llui/lltextvalidate.h +++ b/indra/llui/lltextvalidate.h @@ -60,4 +60,4 @@ namespace LLTextValidate } -#endif \ No newline at end of file +#endif -- cgit v1.2.3 From 7735ef557d79ee80bb7ee9b36a49735d03a4cc22 Mon Sep 17 00:00:00 2001 From: richard Date: Fri, 5 Feb 2010 13:24:05 -0800 Subject: line ending conversion --- indra/llui/lltextvalidate.h | 126 ++++++++++++++++++++++---------------------- 1 file changed, 63 insertions(+), 63 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextvalidate.h b/indra/llui/lltextvalidate.h index 9cc830f5aa..ffb4e85e7c 100644 --- a/indra/llui/lltextvalidate.h +++ b/indra/llui/lltextvalidate.h @@ -1,63 +1,63 @@ -/** - * @file lltextbase.h - * @author Martin Reddy - * @brief The base class of text box/editor, providing Url handling support - * - * $LicenseInfo:firstyear=2009&license=viewergpl$ - * - * Copyright (c) 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 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("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. - * $/LicenseInfo$ - */ - -#ifndef LL_LLTEXTVALIDATE_H -#define LL_LLTEXTVALIDATE_H - -#include "llstring.h" -#include "llinitparam.h" -#include - -namespace LLTextValidate -{ - typedef boost::function validate_func_t; - - struct ValidateTextNamedFuncs - : public LLInitParam::TypeValuesHelper - { - static void declareValues(); - }; - - bool validateFloat(const LLWString &str ); - bool validateInt(const LLWString &str ); - bool validatePositiveS32(const LLWString &str); - bool validateNonNegativeS32(const LLWString &str); - bool validateAlphaNum(const LLWString &str ); - bool validateAlphaNumSpace(const LLWString &str ); - bool validateASCIIPrintableNoPipe(const LLWString &str); - bool validateASCIIPrintableNoSpace(const LLWString &str); - bool validateASCII(const LLWString &str); -} - - -#endif +/** + * @file lltextbase.h + * @author Martin Reddy + * @brief The base class of text box/editor, providing Url handling support + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 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 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("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. + * $/LicenseInfo$ + */ + +#ifndef LL_LLTEXTVALIDATE_H +#define LL_LLTEXTVALIDATE_H + +#include "llstring.h" +#include "llinitparam.h" +#include + +namespace LLTextValidate +{ + typedef boost::function validate_func_t; + + struct ValidateTextNamedFuncs + : public LLInitParam::TypeValuesHelper + { + static void declareValues(); + }; + + bool validateFloat(const LLWString &str ); + bool validateInt(const LLWString &str ); + bool validatePositiveS32(const LLWString &str); + bool validateNonNegativeS32(const LLWString &str); + bool validateAlphaNum(const LLWString &str ); + bool validateAlphaNumSpace(const LLWString &str ); + bool validateASCIIPrintableNoPipe(const LLWString &str); + bool validateASCIIPrintableNoSpace(const LLWString &str); + bool validateASCII(const LLWString &str); +} + + +#endif -- cgit v1.2.3 From 68ea862c96a96be631505e88ae870d6aab066eb9 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Fri, 5 Feb 2010 15:51:49 -0800 Subject: Fix for EXT-4943 (Text editor is broken). Reviewed by Richard. --- indra/llui/lltextbase.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 2b1e2b8226..a83cc19d36 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1137,6 +1137,7 @@ void LLTextBase::reflow() line_list_t::iterator iter = std::upper_bound(mLineInfoList.begin(), mLineInfoList.end(), start_index, line_end_compare()); line_start_index = iter->mDocIndexStart; line_count = iter->mLineNum; + cur_top = iter->mRect.mTop; getSegmentAndOffset(iter->mDocIndexStart, &seg_iter, &seg_offset); mLineInfoList.erase(iter, mLineInfoList.end()); } -- cgit v1.2.3 From a4d224ff9316bf3b99e17f72f844d91e0ef80cc7 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 6 Feb 2010 21:38:57 +0000 Subject: EXT-5055 LLInstanceTracker promotes some dangerous patterns - detect them --- indra/llui/lllayoutstack.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 1aaba88c49..dc79550eb4 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -816,7 +816,10 @@ void LLLayoutStack::calcMinExtents() //static void LLLayoutStack::updateClass() { - for (LLLayoutStack::instance_iter it = beginInstances(); it != endInstances(); ++it) + LLInstanceTrackerScopedGuard guard; + for (LLLayoutStack::instance_iter it = guard.beginInstances(); + it != guard.endInstances(); + ++it) { it->updateLayout(); } -- cgit v1.2.3 From 93bd065356a0502fcf05bd3936c35e4d688e5756 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Mon, 8 Feb 2010 15:21:24 +0200 Subject: Fixed normal bug EXT - 3835 ([BSI] tabs in instant message floater should never change sizes) --HG-- branch : product-engine --- indra/llui/llmultifloater.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp index 78738c826d..33d47a3f0e 100644 --- a/indra/llui/llmultifloater.cpp +++ b/indra/llui/llmultifloater.cpp @@ -92,14 +92,6 @@ void LLMultiFloater::draw() } else { - for (S32 i = 0; i < mTabContainer->getTabCount(); i++) - { - LLFloater* floaterp = (LLFloater*)mTabContainer->getPanelByIndex(i); - if (floaterp->getShortTitle() != mTabContainer->getPanelTitle(i)) - { - mTabContainer->setPanelTitle(i, floaterp->getShortTitle()); - } - } LLFloater::draw(); } } -- cgit v1.2.3 From 7199c9cc1bbd17eecea33b77a97a5ad7b20d2888 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Mon, 8 Feb 2010 18:05:48 +0200 Subject: EXT-3232 Refactoring: Improved the way of horizontal alignment of button's image overlay. Now mLeftHPad/mRightHPad is used instead of mImageOverlayLeftPad and mImageOverlayRightPad. Also mImgOverlayLabelSpace/imgoverlay_label_space members was added to button.(h/xml) to define space between image overlay and button's label --HG-- branch : product-engine --- indra/llui/llbutton.cpp | 10 ++++++---- indra/llui/llbutton.h | 10 ++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 14b77925f2..a4a8cc4e17 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -85,6 +85,7 @@ LLButton::Params::Params() image_right_pad("image_right_pad"), image_top_pad("image_top_pad"), image_bottom_pad("image_bottom_pad"), + imgoverlay_label_space("imgoverlay_label_space", 1), label_color("label_color"), label_color_selected("label_color_selected"), // requires is_toggle true label_color_disabled("label_color_disabled"), @@ -148,6 +149,7 @@ LLButton::LLButton(const LLButton::Params& p) mImageOverlayRightPad(p.image_right_pad), mImageOverlayTopPad(p.image_top_pad), mImageOverlayBottomPad(p.image_bottom_pad), + mImgOverlayLabelSpace(p.imgoverlay_label_space), mIsToggle(p.is_toggle), mScaleImage(p.scale_image), mDropShadowedText(p.label_shadow), @@ -783,9 +785,9 @@ void LLButton::draw() switch(mImageOverlayAlignment) { case LLFontGL::LEFT: - text_left += overlay_width + 1; + text_left += overlay_width + mImgOverlayLabelSpace; mImageOverlay->draw( - mImageOverlayLeftPad, + mLeftHPad, center_y - (overlay_height / 2), overlay_width, overlay_height, @@ -800,9 +802,9 @@ void LLButton::draw() overlay_color); break; case LLFontGL::RIGHT: - text_right -= overlay_width + 1; + text_right -= overlay_width + mImgOverlayLabelSpace; mImageOverlay->draw( - getRect().getWidth() - mImageOverlayRightPad - overlay_width, + getRect().getWidth() - mRightHPad - overlay_width, center_y - (overlay_height / 2), overlay_width, overlay_height, diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 8e5f19602f..3fbc5c6785 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -112,6 +112,11 @@ public: Optional image_top_pad; Optional image_bottom_pad; + /** + * Space between image_overlay and label + */ + Optional imgoverlay_label_space; + // callbacks Optional click_callback, // alias -> commit_callback mouse_down_callback, @@ -333,6 +338,11 @@ private: S32 mImageOverlayTopPad; S32 mImageOverlayBottomPad; + /* + * Space between image_overlay and label + */ + S32 mImgOverlayLabelSpace; + F32 mHoverGlowStrength; F32 mCurGlowStrength; -- cgit v1.2.3 From 8ca06e7bf37f7e5391e14f74d8404bdc05d683d4 Mon Sep 17 00:00:00 2001 From: richard Date: Mon, 8 Feb 2010 08:19:32 -0800 Subject: nearby media pops up on hover --- indra/llui/lldockcontrol.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ indra/llui/lldockcontrol.h | 5 +++-- 2 files changed, 44 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp index d836a5f4cd..f91c07184d 100644 --- a/indra/llui/lldockcontrol.cpp +++ b/indra/llui/lldockcontrol.cpp @@ -162,7 +162,9 @@ bool LLDockControl::isDockVisible() { case LEFT: // to keep compiler happy break; + case BOTTOM: case TOP: + { // check is dock inside parent rect LLRect dockParentRect = mDockWidget->getParent()->calcScreenRect(); @@ -173,6 +175,9 @@ bool LLDockControl::isDockVisible() } break; } + default: + break; + } } } @@ -254,6 +259,42 @@ void LLDockControl::moveDockable() } mDockTongueY = dockRect.mTop; + break; + case BOTTOM: + x = dockRect.getCenterX() - dockableRect.getWidth() / 2; + y = dockRect.mBottom; + // unique docking used with dock tongue, so add tongue height o the Y coordinate + if (use_tongue) + { + y -= mDockTongue->getHeight(); + } + + // check is dockable inside root view rect + if (x < rootRect.mLeft) + { + x = rootRect.mLeft; + } + if (x + dockableRect.getWidth() > rootRect.mRight) + { + x = rootRect.mRight - dockableRect.getWidth(); + } + + // calculate dock tongue position + dockParentRect = mDockWidget->getParent()->calcScreenRect(); + if (dockRect.getCenterX() < dockParentRect.mLeft) + { + mDockTongueX = dockParentRect.mLeft - mDockTongue->getWidth() / 2; + } + else if (dockRect.getCenterX() > dockParentRect.mRight) + { + mDockTongueX = dockParentRect.mRight - mDockTongue->getWidth() / 2;; + } + else + { + mDockTongueX = dockRect.getCenterX() - mDockTongue->getWidth() / 2; + } + mDockTongueY = dockRect.mTop + mDockTongue->getHeight(); + break; } diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h index 550955c4c5..a5caf68001 100644 --- a/indra/llui/lldockcontrol.h +++ b/indra/llui/lldockcontrol.h @@ -47,8 +47,9 @@ class LLDockControl public: enum DocAt { - TOP - ,LEFT + TOP, + LEFT, + BOTTOM }; public: -- cgit v1.2.3 From acc0a2962bc645335f19bb5e6142690ea99df449 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Mon, 8 Feb 2010 19:09:23 +0200 Subject: EXT - 3232 Refactoring: deleted unnecessary image_left_padding, image_right_padding members from button.h and button.xml and their the only place usage in LLTabContainer::reshapeTuple . Now image overlay placement adjustible via: mLeftHPad, mRightHPad, mImageOverlayBottomPad, mImageOverlayTopPad, mImgOverlayLabelSpace --HG-- branch : product-engine --- indra/llui/llbutton.cpp | 4 ---- indra/llui/llbutton.h | 8 -------- indra/llui/lltabcontainer.cpp | 4 ---- 3 files changed, 16 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index a4a8cc4e17..1d4dc35cee 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -81,8 +81,6 @@ LLButton::Params::Params() image_pressed_selected("image_pressed_selected"), image_overlay("image_overlay"), image_overlay_alignment("image_overlay_alignment", std::string("center")), - image_left_pad("image_left_pad"), - image_right_pad("image_right_pad"), image_top_pad("image_top_pad"), image_bottom_pad("image_bottom_pad"), imgoverlay_label_space("imgoverlay_label_space", 1), @@ -145,8 +143,6 @@ LLButton::LLButton(const LLButton::Params& p) mImageOverlay(p.image_overlay()), mImageOverlayColor(p.image_overlay_color()), mImageOverlayAlignment(LLFontGL::hAlignFromName(p.image_overlay_alignment)), - mImageOverlayLeftPad(p.image_left_pad), - mImageOverlayRightPad(p.image_right_pad), mImageOverlayTopPad(p.image_top_pad), mImageOverlayBottomPad(p.image_bottom_pad), mImgOverlayLabelSpace(p.imgoverlay_label_space), diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 3fbc5c6785..8f35db1007 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -107,8 +107,6 @@ public: Optional pad_bottom; // under text label //image overlay paddings - Optional image_left_pad; - Optional image_right_pad; Optional image_top_pad; Optional image_bottom_pad; @@ -197,10 +195,6 @@ public: void setLeftHPad( S32 pad ) { mLeftHPad = pad; } void setRightHPad( S32 pad ) { mRightHPad = pad; } - void setImageOverlayLeftPad( S32 pad ) { mImageOverlayLeftPad = pad; } - S32 getImageOverlayLeftPad() const { return mImageOverlayLeftPad; } - void setImageOverlayRightPad( S32 pad ) { mImageOverlayRightPad = pad; } - S32 getImageOverlayRightPad() const { return mImageOverlayRightPad; } void setImageOverlayTopPad( S32 pad ) { mImageOverlayTopPad = pad; } S32 getImageOverlayTopPad() const { return mImageOverlayTopPad; } void setImageOverlayBottomPad( S32 pad ) { mImageOverlayBottomPad = pad; } @@ -333,8 +327,6 @@ private: S32 mRightHPad; S32 mBottomVPad; // under text label - S32 mImageOverlayLeftPad; - S32 mImageOverlayRightPad; S32 mImageOverlayTopPad; S32 mImageOverlayBottomPad; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 19408989a5..ef9d195a19 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1628,15 +1628,11 @@ void LLTabContainer::setTabImage(LLPanel* child, LLIconCtrl* icon) void LLTabContainer::reshapeTuple(LLTabTuple* tuple) { static LLUICachedControl tab_padding ("UITabPadding", 0); - static LLUICachedControl image_left_padding ("UIButtonImageLeftPadding", 4); - static LLUICachedControl image_right_padding ("UIButtonImageRightPadding", 4); static LLUICachedControl image_top_padding ("UIButtonImageTopPadding", 2); static LLUICachedControl image_bottom_padding ("UIButtonImageBottomPadding", 2); if (!mIsVertical) { - tuple->mButton->setImageOverlayLeftPad(image_left_padding); - tuple->mButton->setImageOverlayRightPad(image_right_padding); tuple->mButton->setImageOverlayTopPad(image_top_padding); tuple->mButton->setImageOverlayBottomPad(image_bottom_padding); -- cgit v1.2.3 From e0f6dc33ab2d683e5b74333989ab77baade5ac85 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 8 Feb 2010 09:11:27 -0800 Subject: Tweak avatar name icon padding --- indra/llui/lltextbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 99c3179884..b84e6f45fb 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2312,7 +2312,7 @@ F32 LLNormalTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selec image->draw(draw_rect.mLeft, image_bottom, style_image_width, style_image_height, color); - const S32 IMAGE_HPAD = 2; + const S32 IMAGE_HPAD = 3; return draw_rect.mLeft + style_image_width + IMAGE_HPAD; } -- cgit v1.2.3 From e7889301723e23b94813464a4519ee6a7751f413 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Tue, 9 Feb 2010 10:06:52 +0200 Subject: Fixed normal bug EXT - 4878 (Tab labels are no longer obeying halign attribute) --HG-- branch : product-engine --- indra/llui/lltabcontainer.cpp | 10 ++++++---- indra/llui/lltabcontainer.h | 11 +++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index ef9d195a19..2ec56d6089 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -212,7 +212,8 @@ LLTabContainer::Params::Params() middle_tab("middle_tab"), last_tab("last_tab"), use_custom_icon_ctrl("use_custom_icon_ctrl", false), - tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0) + tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0), + use_ellipses("use_ellipses") { name(std::string("tab_container")); mouse_opaque = false; @@ -249,7 +250,8 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p) mMiddleTabParams(p.middle_tab), mLastTabParams(p.last_tab), mCustomIconCtrlUsed(p.use_custom_icon_ctrl), - mTabIconCtrlPad(p.tab_icon_ctrl_pad) + mTabIconCtrlPad(p.tab_icon_ctrl_pad), + mUseTabEllipses(p.use_ellipses) { static LLUICachedControl tabcntr_vert_tab_min_width ("UITabCntrVertTabMinWidth", 0); @@ -1485,8 +1487,8 @@ BOOL LLTabContainer::setTab(S32 which) { LLTabTuple* tuple = *iter; BOOL is_selected = ( tuple == selected_tuple ); - tuple->mButton->setUseEllipses(TRUE); - tuple->mButton->setHAlign(LLFontGL::LEFT); + tuple->mButton->setUseEllipses(mUseTabEllipses); + tuple->mButton->setHAlign(mFontHalign); tuple->mTabPanel->setVisible( is_selected ); // tuple->mTabPanel->setFocus(is_selected); // not clear that we want to do this here. tuple->mButton->setToggleState( is_selected ); diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index 4b5d45fb73..50ec2679f6 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -92,6 +92,16 @@ public: middle_tab, last_tab; + /** + * Tab label horizontal alignment + */ + Optional font_halign; + + /** + * Tab label ellipses + */ + Optional use_ellipses; + /** * Use LLCustomButtonIconCtrl or LLButton in LLTabTuple */ @@ -294,6 +304,7 @@ private: bool mCustomIconCtrlUsed; S32 mTabIconCtrlPad; + bool mUseTabEllipses; }; #endif // LL_TABCONTAINER_H -- cgit v1.2.3 From 1129c7252ad06472add84da2c6bf326d29d81c16 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 9 Feb 2010 18:51:33 +0200 Subject: Fixed normal bug EXT-4817 - Preferences > Chat > Alert color preference is broken --HG-- branch : product-engine --- indra/llui/lluicolortable.cpp | 28 ++++++++++++++-------------- indra/llui/lluicolortable.h | 9 ++++++--- 2 files changed, 20 insertions(+), 17 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp index 9be33483d0..ac765fc9d5 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 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,10 @@ bool LLUIColorTable::loadFromFilename(const std::string& filename) return true; } + +void LLUIColorTable::insertFromParams(const Params& p) +{ + insertFromParams(p, mUserSetColors); +} + +// EOF \ No newline at end of file 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 { LOG_CLASS(LLUIColorTable); + + // consider using sorted vector, can be much faster + typedef std::map string_color_map_t; + public: struct ColorParams : LLInitParam::Choice { @@ -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 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); -- cgit v1.2.3 From b1099e21600c8d2c4584ef8f3696ddc5f42c936b Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 9 Feb 2010 17:19:26 -0800 Subject: fix for invalid param 'name' warnings --- indra/llui/llui.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 5840e76f5c..af8d4ea03b 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -426,8 +426,8 @@ namespace LLInitParam { typedef BlockValue super_t; public: - Mandatory name; - Optional size, + Optional name, + size, style; TypedParam(BlockDescriptor& descriptor, const char* name, const LLFontGL* const value, ParamDescriptor::validation_func_t func, S32 min_count, S32 max_count); -- cgit v1.2.3 From f8aa91dccb8255356f3be60eb00e34aa6ad0a186 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 10 Feb 2010 12:10:43 +0200 Subject: Fixed function name. --HG-- branch : product-engine --- indra/llui/lltexteditor.cpp | 2 +- indra/llui/lltexteditor.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') 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); -- cgit v1.2.3 From ea9185e0dcfde046232cc2ce20d34171b96e37e5 Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Wed, 10 Feb 2010 13:37:49 +0200 Subject: Fixed linux build error - added skipped newline at end of file --HG-- branch : product-engine --- indra/llui/lluicolortable.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp index ac765fc9d5..1b64ef3abe 100644 --- a/indra/llui/lluicolortable.cpp +++ b/indra/llui/lluicolortable.cpp @@ -329,4 +329,5 @@ void LLUIColorTable::insertFromParams(const Params& p) insertFromParams(p, mUserSetColors); } -// EOF \ No newline at end of file +// EOF + -- cgit v1.2.3 From 536ffcc7b34e35fbdd8b134147b93715dd262e30 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 10 Feb 2010 16:53:58 +0000 Subject: CID-425 Checker: UNINIT_CTOR Function: LLCustomButtonIconCtrl::LLCustomButtonIconCtrl(const LLCustomButtonIconCtrl::Params &) File: /indra/llui/lltabcontainer.cpp --- indra/llui/lltabcontainer.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llui') 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) {} -- cgit v1.2.3 From 75916b486cca96e36cd11d92c0b3c21cb7e72d05 Mon Sep 17 00:00:00 2001 From: richard Date: Wed, 10 Feb 2010 10:46:37 -0800 Subject: fixed tongue positioning --- indra/llui/lldockcontrol.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp index f91c07184d..d738b10130 100644 --- a/indra/llui/lldockcontrol.cpp +++ b/indra/llui/lldockcontrol.cpp @@ -293,7 +293,7 @@ void LLDockControl::moveDockable() { mDockTongueX = dockRect.getCenterX() - mDockTongue->getWidth() / 2; } - mDockTongueY = dockRect.mTop + mDockTongue->getHeight(); + mDockTongueY = dockRect.mBottom - mDockTongue->getHeight(); break; } -- cgit v1.2.3 From 8bc4dcc85524a23924d3a810502503cc946ce1c1 Mon Sep 17 00:00:00 2001 From: richard Date: Wed, 10 Feb 2010 18:13:02 -0800 Subject: EXT-5321 - llinfos from non ui threads is not thread safe reviewed by Mani --- indra/llui/llconsole.cpp | 57 ++++++++++++++++++++++++++---------------------- indra/llui/llconsole.h | 11 +++++----- 2 files changed, 37 insertions(+), 31 deletions(-) (limited to 'indra/llui') 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 { 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; -- cgit v1.2.3 From 6961a1501f6381ac62cc3b6dee2eff47a5fbf0d6 Mon Sep 17 00:00:00 2001 From: richard Date: Wed, 10 Feb 2010 18:40:15 -0800 Subject: build fix --- indra/llui/llconsole.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index 331d78da8c..a4f69e7ac1 100644 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -376,7 +376,9 @@ LLConsole::Paragraph::Paragraph (LLWString str, const LLColor4 &color, F32 add_t // static void LLConsole::updateClass() { - for (instance_iter it = beginInstances(); it != endInstances(); ++it) + LLInstanceTrackerScopedGuard guard; + + for (instance_iter it = guard.beginInstances(); it != guard.endInstances(); ++it) { it->update(); } -- cgit v1.2.3 From cf18a1d22c7a4c315a651bc39085bc6d723e8e7d Mon Sep 17 00:00:00 2001 From: "Paul Guslisty pguslisty@productengine.com" Date: Thu, 11 Feb 2010 12:52:26 +0200 Subject: EXT - 2753 (Implement Avatar icons on IM multifloater tabs) refactoring: - Deleted unnecessary parameters (UIButtonImageTopPadding, UIButtonImageBottomPadding) from settings.xml and their usage in LLTabContainer - Deleted triggers (LLIMFloaterContainer::processProperties and LLIMFloaterContainer::changed) due to LLIMFloaterContainer no more Observer - Renamed class LLParticularGroupMgrObserver to LLParticularGroupObserver as the last one's name is more self explanatory --HG-- branch : product-engine --- indra/llui/lltabcontainer.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index fe699cfa01..13340e7ded 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1631,14 +1631,9 @@ void LLTabContainer::setTabImage(LLPanel* child, LLIconCtrl* icon) void LLTabContainer::reshapeTuple(LLTabTuple* tuple) { static LLUICachedControl tab_padding ("UITabPadding", 0); - static LLUICachedControl image_top_padding ("UIButtonImageTopPadding", 2); - static LLUICachedControl image_bottom_padding ("UIButtonImageBottomPadding", 2); if (!mIsVertical) { - tuple->mButton->setImageOverlayTopPad(image_top_padding); - tuple->mButton->setImageOverlayBottomPad(image_bottom_padding); - // remove current width from total tab strip width mTotalTabWidth -= tuple->mButton->getRect().getWidth(); -- cgit v1.2.3 From bf26124cbc9583901ce0640c6027acb392fff6fd Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Thu, 11 Feb 2010 14:12:46 +0000 Subject: CID-60 Checker: FORWARD_NULL Function: LLMultiSliderCtrl::onEditorCommit(LLUICtrl *, const LLSD &) File: /indra/llui/llmultisliderctrl.cpp --- indra/llui/llmultisliderctrl.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llui') 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(ctrl->getParent()); + llassert(self); + if (!self) // cast failed - wrong type! :O + return; + if (!ctrl) return; -- cgit v1.2.3 From 7ac90e2a08b12a28dcd4eda5767902f0e5556818 Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Thu, 11 Feb 2010 19:56:56 +0200 Subject: Fixed low bug EXT-5329 (Delete option is enabled in context menu for empty edit field in IM floater) --HG-- branch : product-engine --- indra/llui/llsearcheditor.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llui') diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp index 6fa99df82e..838dbbd135 100644 --- a/indra/llui/llsearcheditor.cpp +++ b/indra/llui/llsearcheditor.cpp @@ -60,6 +60,7 @@ LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p) line_editor_params.keystroke_callback(boost::bind(&LLSearchEditor::handleKeystroke, this)); mSearchEditor = LLUICtrlFactory::create(line_editor_params); + mSearchEditor->setPassDelete(TRUE); addChild(mSearchEditor); if (p.search_button_visible) -- cgit v1.2.3 From 6c5b984bf670e34fd88a8f1a0bdeb1042fa531b2 Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 11 Feb 2010 18:06:25 -0800 Subject: converted llfloaternearbymedia to llpanelnearbymedia moved from LLTransientDockableFloater model to popup panel model like volume popup --- indra/llui/llscrolllistctrl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 478e270c98..ac4811210b 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -1388,6 +1388,8 @@ void LLScrollListCtrl::drawItems() LLGLSUIDefault gls_ui; + F32 alpha = getDrawContext().mAlpha; + { LLLocalClipRect clip(mItemListRect); @@ -1463,7 +1465,7 @@ void LLScrollListCtrl::drawItems() bg_color = mBgReadOnlyColor.get(); } - item->draw(item_rect, fg_color, bg_color, highlight_color, mColumnPadding); + item->draw(item_rect, fg_color % alpha, bg_color% alpha, highlight_color % alpha, mColumnPadding); cur_y -= mLineHeight; } -- cgit v1.2.3 From 8c2a6a691ad2d747d29db8d168783deb7ba91710 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Fri, 12 Feb 2010 13:41:34 +0200 Subject: Fixed low bug EXT-5166 - Undocked lldialogs respawn in chiclet tray. LLDialog floater position is saved per originating object. --HG-- branch : product-engine --- indra/llui/lldockablefloater.cpp | 4 ++-- indra/llui/lldockablefloater.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp index 57baf28dab..a94f0206a6 100644 --- a/indra/llui/lldockablefloater.cpp +++ b/indra/llui/lldockablefloater.cpp @@ -223,10 +223,10 @@ void LLDockableFloater::draw() LLFloater::draw(); } -void LLDockableFloater::setDockControl(LLDockControl* dockControl) +void LLDockableFloater::setDockControl(LLDockControl* dockControl, bool docked /* = true */) { mDockControl.reset(dockControl); - setDocked(mDockControl.get() != NULL && mDockControl.get()->isDockVisible()); + setDocked(docked && mDockControl.get() != NULL && mDockControl.get()->isDockVisible()); } const LLUIImagePtr& LLDockableFloater::getDockTongue() diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h index 2b1ce99ae2..4d747390af 100644 --- a/indra/llui/lldockablefloater.h +++ b/indra/llui/lldockablefloater.h @@ -127,7 +127,7 @@ private: void resetInstance(); protected: - void setDockControl(LLDockControl* dockControl); + void setDockControl(LLDockControl* dockControl, bool docked = true); const LLUIImagePtr& getDockTongue(); private: -- cgit v1.2.3 From 951fd66000a22d65c76d44f5de5e38a76513b528 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Fri, 12 Feb 2010 16:26:52 +0200 Subject: Completed normal task EXT-3410 (Liberate filter_editor clear_button height width parameters - art is distorted) - improved calculation of clear_button position (to be xml driven) - replaced clear_button art with suggested Icon_Close_Toast in filter_editor widget --HG-- branch : product-engine --- indra/llui/llsearcheditor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp index 838dbbd135..491eeeab54 100644 --- a/indra/llui/llsearcheditor.cpp +++ b/indra/llui/llsearcheditor.cpp @@ -80,10 +80,12 @@ LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p) if (p.clear_button_visible) { // Set up clear button. - S32 clr_btn_width = getRect().getHeight(); // button is square, and as tall as search editor - LLRect clear_btn_rect(getRect().getWidth() - clr_btn_width, getRect().getHeight(), getRect().getWidth(), 0); LLButton::Params clr_btn_params(p.clear_button); clr_btn_params.name(std::string("clear button")); + S32 clr_btn_top = clr_btn_params.rect.bottom + clr_btn_params.rect.height; + S32 clr_btn_right = getRect().getWidth() - clr_btn_params.pad_right; + S32 clr_btn_left = clr_btn_right - clr_btn_params.rect.width; + LLRect clear_btn_rect(clr_btn_left, clr_btn_top, clr_btn_right, p.clear_button.rect.bottom); clr_btn_params.rect(clear_btn_rect) ; clr_btn_params.follows.flags(FOLLOWS_RIGHT|FOLLOWS_TOP); clr_btn_params.tab_stop(false); -- cgit v1.2.3 From e159873eec4137b041fc8045f6d79ac6c21d2101 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 12 Feb 2010 16:54:47 -0800 Subject: added popup panel to hold nearby media popup and stopped using top view --- indra/llui/lltooltip.cpp | 6 ------ indra/llui/lltooltip.h | 2 -- 2 files changed, 8 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index 173fde8e76..ed7fd02e14 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -129,12 +129,6 @@ BOOL LLToolTipView::handleScrollWheel( S32 x, S32 y, S32 clicks ) return FALSE; } -void LLToolTipView::onMouseLeave(S32 x, S32 y, MASK mask) -{ - LLToolTipMgr::instance().blockToolTips(); -} - - void LLToolTipView::drawStickyRect() { gl_rect_2d(LLToolTipMgr::instance().getMouseNearRect(), LLColor4::white, false); diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h index c0811c56c3..24e32b9b24 100644 --- a/indra/llui/lltooltip.h +++ b/indra/llui/lltooltip.h @@ -56,8 +56,6 @@ public: /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); - /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); - void drawStickyRect(); /*virtual*/ void draw(); -- cgit v1.2.3 From 7c86d4434822d7a3172bed82c3812032089c1518 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 12 Feb 2010 17:08:10 -0800 Subject: potential fix for bad font names --- indra/llui/llui.cpp | 10 ++++++++-- indra/llui/lluiimage.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 76f07373b4..9d5953e380 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1894,7 +1894,9 @@ namespace LLInitParam blue("blue"), alpha("alpha"), control("") - {} + { + setBlockFromValue(); + } void TypedParam::setValueFromBlock() const { @@ -1940,6 +1942,7 @@ namespace LLInitParam style("style") { addSynonym(name, ""); + setBlockFromValue(); } void TypedParam::setValueFromBlock() const @@ -1979,7 +1982,9 @@ namespace LLInitParam bottom("bottom"), width("width"), height("height") - {} + { + setBlockFromValue(); + } void TypedParam::setValueFromBlock() const { @@ -2064,6 +2069,7 @@ namespace LLInitParam x("x"), y("y") { + setBlockFromValue(); } void TypedParam::setValueFromBlock() const diff --git a/indra/llui/lluiimage.h b/indra/llui/lluiimage.h index bdfc44262d..4ea0738026 100644 --- a/indra/llui/lluiimage.h +++ b/indra/llui/lluiimage.h @@ -109,6 +109,7 @@ namespace LLInitParam TypedParam(BlockDescriptor& descriptor, const char* name, super_t::value_assignment_t value, ParamDescriptor::validation_func_t func, S32 min_count, S32 max_count) : super_t(descriptor, name, value, func, min_count, max_count) { + setBlockFromValue(); } void setValueFromBlock() const; -- cgit v1.2.3 From af229a7bb0c891ec5d3e256e2509313c636973a3 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 12 Feb 2010 17:11:36 -0800 Subject: cast type F32 to GLint to eliminate some compiling warnings. --- indra/llui/llui.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 852a19660a..44a57a0989 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -710,19 +710,19 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre v = LLVector3(offset_x, offset_y, 0.f) * quat; gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop); - gGL.vertex2i(v.mV[0], v.mV[1] ); + gGL.vertex2i((GLint)v.mV[0], (GLint)v.mV[1] ); v = LLVector3(-offset_x, offset_y, 0.f) * quat; gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop); - gGL.vertex2i(v.mV[0], v.mV[1] ); + gGL.vertex2i((GLint)v.mV[0], (GLint)v.mV[1] ); v = LLVector3(-offset_x, -offset_y, 0.f) * quat; gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom); - gGL.vertex2i(v.mV[0], v.mV[1] ); + gGL.vertex2i((GLint)v.mV[0], (GLint)v.mV[1] ); v = LLVector3(offset_x, -offset_y, 0.f) * quat; gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom); - gGL.vertex2i(v.mV[0], v.mV[1] ); + gGL.vertex2i((GLint)v.mV[0], (GLint)v.mV[1] ); } gGL.end(); gGL.popUIMatrix(); -- cgit v1.2.3 From 25be5a201fefed5653fca9ae348b10045b090c92 Mon Sep 17 00:00:00 2001 From: Palmer Truelson Date: Fri, 12 Feb 2010 21:02:25 -0800 Subject: Backed out bao's fix to FSAA that will also be backed out. changeset ae9bbbf181d9 --- indra/llui/llui.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 44a57a0989..852a19660a 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -710,19 +710,19 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre v = LLVector3(offset_x, offset_y, 0.f) * quat; gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop); - gGL.vertex2i((GLint)v.mV[0], (GLint)v.mV[1] ); + gGL.vertex2i(v.mV[0], v.mV[1] ); v = LLVector3(-offset_x, offset_y, 0.f) * quat; gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop); - gGL.vertex2i((GLint)v.mV[0], (GLint)v.mV[1] ); + gGL.vertex2i(v.mV[0], v.mV[1] ); v = LLVector3(-offset_x, -offset_y, 0.f) * quat; gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom); - gGL.vertex2i((GLint)v.mV[0], (GLint)v.mV[1] ); + gGL.vertex2i(v.mV[0], v.mV[1] ); v = LLVector3(offset_x, -offset_y, 0.f) * quat; gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom); - gGL.vertex2i((GLint)v.mV[0], (GLint)v.mV[1] ); + gGL.vertex2i(v.mV[0], v.mV[1] ); } gGL.end(); gGL.popUIMatrix(); -- cgit v1.2.3 From cf69f03af17070152b5ca2772e7addfd0dcc4800 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 13 Feb 2010 14:06:31 +0000 Subject: CID-206 Checker: REVERSE_INULL Function: LLMultiSliderCtrl::onEditorCommit(LLUICtrl *, const LLSD &) File: /indra/llui/llmultisliderctrl.cpp --- indra/llui/llmultisliderctrl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index 50942e55ca..cc26c00a3e 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -330,13 +330,14 @@ void LLMultiSliderCtrl::updateText() // static void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata) { + llassert(ctrl); + if (!ctrl) + return; + LLMultiSliderCtrl* self = dynamic_cast(ctrl->getParent()); llassert(self); if (!self) // cast failed - wrong type! :O return; - - if (!ctrl) - return; BOOL success = FALSE; F32 val = self->mCurValue; -- cgit v1.2.3 From d7060eb323f7cfebb7576e2999f782e8617e40e8 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 13 Feb 2010 14:08:58 +0000 Subject: CID-205 Checker: REVERSE_INULL Function: LLPanel::fromXML(LLPointer, LLView *, LLPointer) File: /indra/llui/llpanel.cpp --- indra/llui/llpanel.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 7b406e090a..d963cf4c98 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -397,6 +397,12 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_ if (!panelp) { panelp = LLUICtrlFactory::getInstance()->createFactoryPanel(name); + llassert(panelp); + + if (!panelp) + { + return NULL; // :( + } } } @@ -414,7 +420,7 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_ panelp->mCommitCallbackRegistrar.popScope(); panelp->mEnableCallbackRegistrar.popScope(); - if (panelp && !panelp->getFactoryMap().empty()) + if (!panelp->getFactoryMap().empty()) { LLUICtrlFactory::instance().popFactoryFunctions(); } -- cgit v1.2.3 From eb1d043dafa86480757cc1ed934d96ba51033581 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 13 Feb 2010 14:13:06 +0000 Subject: CID-203 Checker: REVERSE_INULL Function: LLTabContainer::addTabPanel(const LLTabContainer::TabPanelParams &) File: /indra/llui/lltabcontainer.cpp --- indra/llui/lltabcontainer.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 13340e7ded..e810b6fe8f 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -891,6 +891,10 @@ void LLTabContainer::update_images(LLTabTuple* tuple, TabParams params, LLTabCon void LLTabContainer::addTabPanel(const TabPanelParams& panel) { LLPanel* child = panel.panel(); + + llassert(child); + if (!child) return; + const std::string& label = panel.label.isProvided() ? panel.label() : panel.panel()->getLabel(); -- cgit v1.2.3 From 398af7dd40a060cf9ad8d799df03d448c2f53a96 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 15 Feb 2010 18:06:49 +0000 Subject: CID-34 Checker: DEADCODE Function: LLDockableFloater::toggleInstance(const LLSD &) File: /indra/llui/lldockablefloater.cpp bool logic precendence assumptions were wrong. --- indra/llui/lldockablefloater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp index a94f0206a6..0492ab0f25 100644 --- a/indra/llui/lldockablefloater.cpp +++ b/indra/llui/lldockablefloater.cpp @@ -95,7 +95,7 @@ void LLDockableFloater::toggleInstance(const LLSD& sdname) LLDockableFloater* instance = dynamic_cast (LLFloaterReg::findInstance(name)); // if floater closed or docked - if (instance == NULL || instance != NULL && instance->isDocked()) + if (instance == NULL || (instance && instance->isDocked())) { LLFloaterReg::toggleInstance(name, key); // restore button toggle state -- cgit v1.2.3 From a301ad63c24c8f2ca79559efeee6a780c3ef7ddc Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Tue, 16 Feb 2010 17:58:41 +0200 Subject: Fixed bug EXT-5290 (TP failed if try to teleport from 'Teleport completed from...' toast). Reason: LLUrlEntrySLURL::getLocation() failed to parse maps.secondlife.com SLURLs (though worked fine for slurl.com ones). --HG-- branch : product-engine --- indra/llui/llurlentry.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 92b7816bdd..3c73ae9b0c 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -287,7 +287,7 @@ std::string LLUrlEntrySLURL::getLabel(const std::string &url, const LLUrlLabelCa std::string LLUrlEntrySLURL::getLocation(const std::string &url) const { // return the part of the Url after slurl.com/secondlife/ - const std::string search_string = "secondlife"; + const std::string search_string = "/secondlife"; size_t pos = url.find(search_string); if (pos == std::string::npos) { -- cgit v1.2.3 From 1513643e62a88531888f330e57aa1eb623061729 Mon Sep 17 00:00:00 2001 From: richard Date: Tue, 16 Feb 2010 15:45:17 -0800 Subject: EXT-5471 - Tons of spam in log about Invalid param "name" reviewed by Rick --- indra/llui/llui.cpp | 10 ++++++++-- indra/llui/llui.h | 4 ++-- indra/llui/lluiimage.h | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 76f07373b4..caf04339c2 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1894,7 +1894,9 @@ namespace LLInitParam blue("blue"), alpha("alpha"), control("") - {} + { + setBlockFromValue(); + } void TypedParam::setValueFromBlock() const { @@ -1939,6 +1941,7 @@ namespace LLInitParam size("size"), style("style") { + setBlockFromValue(); addSynonym(name, ""); } @@ -1979,7 +1982,9 @@ namespace LLInitParam bottom("bottom"), width("width"), height("height") - {} + { + setBlockFromValue(); + } void TypedParam::setValueFromBlock() const { @@ -2064,6 +2069,7 @@ namespace LLInitParam x("x"), y("y") { + setBlockFromValue(); } void TypedParam::setValueFromBlock() const diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 5840e76f5c..af8d4ea03b 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -426,8 +426,8 @@ namespace LLInitParam { typedef BlockValue super_t; public: - Mandatory name; - Optional size, + Optional name, + size, style; TypedParam(BlockDescriptor& descriptor, const char* name, const LLFontGL* const value, ParamDescriptor::validation_func_t func, S32 min_count, S32 max_count); diff --git a/indra/llui/lluiimage.h b/indra/llui/lluiimage.h index bdfc44262d..4ea0738026 100644 --- a/indra/llui/lluiimage.h +++ b/indra/llui/lluiimage.h @@ -109,6 +109,7 @@ namespace LLInitParam TypedParam(BlockDescriptor& descriptor, const char* name, super_t::value_assignment_t value, ParamDescriptor::validation_func_t func, S32 min_count, S32 max_count) : super_t(descriptor, name, value, func, min_count, max_count) { + setBlockFromValue(); } void setValueFromBlock() const; -- cgit v1.2.3 From 69032d8d9d660de5b3c97589b7cc55dac70b153c Mon Sep 17 00:00:00 2001 From: richard Date: Tue, 16 Feb 2010 19:14:55 -0800 Subject: EXT-5071 - Script Editor slows down FPS when editing scripts with 500+ lines reviewed by Monroe --- indra/llui/lltexteditor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index ce5f1bd082..7d230f7d42 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2524,9 +2524,9 @@ void LLTextEditor::loadKeywords(const std::string& filename, void LLTextEditor::updateSegments() { - LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING); - if (mKeywords.isLoaded()) + if (mReflowIndex < S32_MAX && mKeywords.isLoaded()) { + LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING); // HACK: No non-ascii keywords for now segment_vec_t segment_list; mKeywords.findSegments(&segment_list, getWText(), mDefaultColor.get(), *this); -- cgit v1.2.3 From 619415a99a08f66b8247ccd0b427c8483ba22e82 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 17 Feb 2010 15:32:00 +0200 Subject: Moved shadow drawing code from draw to separate function(drawShadow) to make this code reusable. --HG-- branch : product-engine --- indra/llui/llfloater.cpp | 39 +++++++++++++++++++++++++-------------- indra/llui/llfloater.h | 1 + 2 files changed, 26 insertions(+), 14 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index a55915af35..0199fe3f57 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1565,25 +1565,13 @@ void LLFloater::draw() // draw background if( isBackgroundVisible() ) { + drawShadow(this); + S32 left = LLPANEL_BORDER_WIDTH; S32 top = getRect().getHeight() - LLPANEL_BORDER_WIDTH; S32 right = getRect().getWidth() - LLPANEL_BORDER_WIDTH; S32 bottom = LLPANEL_BORDER_WIDTH; - static LLUICachedControl shadow_offset_S32 ("DropShadowFloater", 0); - static LLUIColor shadow_color_cached = LLUIColorTable::instance().getColor("ColorDropShadow"); - LLColor4 shadow_color = shadow_color_cached; - F32 shadow_offset = (F32)shadow_offset_S32; - - if (!isBackgroundOpaque()) - { - shadow_offset *= 0.2f; - shadow_color.mV[VALPHA] *= 0.5f; - } - gl_drop_shadow(left, top, right, bottom, - shadow_color % alpha, - llround(shadow_offset)); - LLUIImage* image = NULL; LLColor4 color; if (isBackgroundOpaque()) @@ -1666,6 +1654,29 @@ void LLFloater::draw() } } +void LLFloater::drawShadow(LLPanel* panel) +{ + F32 alpha = panel->getDrawContext().mAlpha; + S32 left = LLPANEL_BORDER_WIDTH; + S32 top = panel->getRect().getHeight() - LLPANEL_BORDER_WIDTH; + S32 right = panel->getRect().getWidth() - LLPANEL_BORDER_WIDTH; + S32 bottom = LLPANEL_BORDER_WIDTH; + + static LLUICachedControl shadow_offset_S32 ("DropShadowFloater", 0); + static LLUIColor shadow_color_cached = LLUIColorTable::instance().getColor("ColorDropShadow"); + LLColor4 shadow_color = shadow_color_cached; + F32 shadow_offset = (F32)shadow_offset_S32; + + if (!panel->isBackgroundOpaque()) + { + shadow_offset *= 0.2f; + shadow_color.mV[VALPHA] *= 0.5f; + } + gl_drop_shadow(left, top, right, bottom, + shadow_color % alpha, + llround(shadow_offset)); +} + void LLFloater::setCanMinimize(BOOL can_minimize) { // if removing minimize/restore button programmatically, diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 2166d8db8a..19e8288807 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -222,6 +222,7 @@ public: virtual BOOL handleScrollWheel(S32 x, S32 y, S32 mask); virtual void draw(); + virtual void drawShadow(LLPanel* panel); virtual void onOpen(const LLSD& key) {} virtual void onClose(bool app_quitting) {} -- cgit v1.2.3 From e938d055f427275005d538bf09d3b40e0f680d5f Mon Sep 17 00:00:00 2001 From: Palmer Date: Wed, 17 Feb 2010 17:06:36 -0800 Subject: EXT-5309 : prevent infinite loop in LLConsole. Reviewed by Richard --- indra/llui/llconsole.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index a4f69e7ac1..badbddc3cc 100644 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -300,7 +300,8 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, const LLFontGL* font, b S32 paragraph_offset = 0; //Offset into the paragraph text. // Wrap lines that are longer than the view is wide. - while( paragraph_offset < (S32)mParagraphText.length() ) + while( paragraph_offset < (S32)mParagraphText.length() && + mParagraphText[paragraph_offset] != 0) { S32 skip_chars; // skip '\n' // Figure out if a word-wrapped line fits here. -- cgit v1.2.3 From 3e8320201fb89ce01bed18dc1ab7a41811fd3982 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Wed, 17 Feb 2010 18:18:18 -0800 Subject: Partial fix for EXT-5071. Changed the index on the keyword map in LLKeywords so that LLKeywords::findSegments() doesn't have to create LLWString objects to search the map. Reviewed by Richard. --- indra/llui/llkeywords.cpp | 82 ++++++++++++++++++++++++++++++++++++++++++++++- indra/llui/llkeywords.h | 29 +++++++++++++++-- 2 files changed, 108 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index ede32084d0..75342afbe2 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -218,6 +218,86 @@ void LLKeywords::addToken(LLKeywordToken::TOKEN_TYPE type, llassert(0); } } +LLKeywords::WStringMapIndex::WStringMapIndex(const WStringMapIndex& other) +{ + if(other.mOwner) + { + copyData(other.mData, other.mLength); + } + else + { + mOwner = false; + mLength = other.mLength; + mData = other.mData; + } +} + +LLKeywords::WStringMapIndex::WStringMapIndex(const LLWString& str) +{ + copyData(str.data(), str.size()); +} + +LLKeywords::WStringMapIndex::WStringMapIndex(const llwchar *start, size_t length): +mData(start), mLength(length), mOwner(false) +{ +} + +LLKeywords::WStringMapIndex::~WStringMapIndex() +{ + if(mOwner) + delete[] mData; +} + +void LLKeywords::WStringMapIndex::copyData(const llwchar *start, size_t length) +{ + llwchar *data = new llwchar[length]; + memcpy((void*)data, (const void*)start, length * sizeof(llwchar)); + + mOwner = true; + mLength = length; + mData = data; +} + +bool LLKeywords::WStringMapIndex::operator<(const LLKeywords::WStringMapIndex &other) const +{ + // NOTE: Since this is only used to organize a std::map, it doesn't matter if it uses correct collate order or not. + // The comparison only needs to strictly order all possible strings, and be stable. + + bool result = false; + const llwchar* self_iter = mData; + const llwchar* self_end = mData + mLength; + const llwchar* other_iter = other.mData; + const llwchar* other_end = other.mData + other.mLength; + + while(true) + { + if(other_iter >= other_end) + { + // We've hit the end of other. + // This covers two cases: other being shorter than self, or the strings being equal. + // In either case, we want to return false. + result = false; + break; + } + else if(self_iter >= self_end) + { + // self is shorter than other. + result = true; + break; + } + else if(*self_iter != *other_iter) + { + // The current character differs. The strings are not equal. + result = *self_iter < *other_iter; + break; + } + + self_iter++; + other_iter++; + } + + return result; +} LLColor3 LLKeywords::readColor( const std::string& s ) { @@ -429,7 +509,7 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLW S32 seg_len = p - cur; if( seg_len > 0 ) { - LLWString word( cur, 0, seg_len ); + WStringMapIndex word( cur, seg_len ); word_token_map_t::iterator map_iter = mWordTokenMap.find(word); if( map_iter != mWordTokenMap.end() ) { diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 53377869ca..e5b66dfa56 100644 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -92,8 +92,33 @@ public: const std::string& key, const LLColor3& color, const std::string& tool_tip = LLStringUtil::null); - - typedef std::map word_token_map_t; + + // This class is here as a performance optimization. + // The word token map used to be defined as std::map. + // This worked, but caused a performance bottleneck due to memory allocation and string copies + // because it's not possible to search such a map without creating an LLWString. + // Using this class as the map index instead allows us to search using segments of an existing + // text run without copying them first, which greatly reduces overhead in LLKeywords::findSegments(). + class WStringMapIndex + { + public: + // copy constructor + WStringMapIndex(const WStringMapIndex& other); + // constructor from a string (copies the string's data into the new object) + WStringMapIndex(const LLWString& str); + // constructor from pointer and length + // NOTE: does NOT copy data, caller must ensure that the lifetime of the pointer exceeds that of the new object! + WStringMapIndex(const llwchar *start, size_t length); + ~WStringMapIndex(); + bool operator<(const WStringMapIndex &other) const; + private: + void copyData(const llwchar *start, size_t length); + const llwchar *mData; + size_t mLength; + bool mOwner; + }; + + typedef std::map word_token_map_t; typedef word_token_map_t::const_iterator keyword_iterator_t; keyword_iterator_t begin() const { return mWordTokenMap.begin(); } keyword_iterator_t end() const { return mWordTokenMap.end(); } -- cgit v1.2.3 From b1dd2f3099d9bfd03d2f1e7928beefd5e8716ae0 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 17 Feb 2010 22:22:14 -0800 Subject: EXT-5515 - Allow resizing on left and lower left of nearby media popup --- indra/llui/llresizehandle.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llresizehandle.cpp b/indra/llui/llresizehandle.cpp index 3df09d124a..367666efbd 100644 --- a/indra/llui/llresizehandle.cpp +++ b/indra/llui/llresizehandle.cpp @@ -136,9 +136,10 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) if( resizing_view ) { // undock floater when user resize it - if (((LLFloater*)getParent())->isDocked()) + LLFloater* floater_parent = dynamic_cast(getParent()); + if (floater_parent && floater_parent->isDocked()) { - ((LLFloater*)getParent())->setDocked(false, false); + floater_parent->setDocked(false, false); } // Resize the parent -- cgit v1.2.3 From bf668d4a184d52fe520748bbf3f8485380a1c775 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Thu, 18 Feb 2010 11:36:19 +0200 Subject: Fixed critical bug EXT - 4878 (Tab labels are no longer obeying halign attribute) --HG-- branch : product-engine --- indra/llui/lltabcontainer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index e810b6fe8f..9a715cca0b 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -214,7 +214,8 @@ LLTabContainer::Params::Params() last_tab("last_tab"), use_custom_icon_ctrl("use_custom_icon_ctrl", false), tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0), - use_ellipses("use_ellipses") + use_ellipses("use_ellipses"), + font_halign("font_halign") { name(std::string("tab_container")); mouse_opaque = false; -- cgit v1.2.3 From f4703f55eb5728f50f094bc54e99065f0481a067 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Thu, 18 Feb 2010 11:36:19 +0200 Subject: Fixed critical bug EXT - 4878 (Tab labels are no longer obeying halign attribute) --- indra/llui/lltabcontainer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index e810b6fe8f..9a715cca0b 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -214,7 +214,8 @@ LLTabContainer::Params::Params() last_tab("last_tab"), use_custom_icon_ctrl("use_custom_icon_ctrl", false), tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0), - use_ellipses("use_ellipses") + use_ellipses("use_ellipses"), + font_halign("font_halign") { name(std::string("tab_container")); mouse_opaque = false; -- cgit v1.2.3 From 25800b4b3728b2691a486bbbbd95c9f20e63a1c5 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Thu, 18 Feb 2010 14:43:46 +0200 Subject: Fixed normal bug EXT-5468 - Lists from people panel are not refreshed after filter field has been reseted by (x). --HG-- branch : product-engine --- indra/llui/llsearcheditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp index 491eeeab54..e6c5e3f334 100644 --- a/indra/llui/llsearcheditor.cpp +++ b/indra/llui/llsearcheditor.cpp @@ -155,7 +155,7 @@ void LLSearchEditor::setFocus( BOOL b ) void LLSearchEditor::onClearButtonClick(const LLSD& data) { - setText(LLStringUtil::null); + mSearchEditor->selectAll(); mSearchEditor->doDelete(); // force keystroke callback } -- cgit v1.2.3 From eec9f20d746805e772d38f8b338d882a6afb8df1 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Thu, 18 Feb 2010 16:05:11 +0200 Subject: =?UTF-8?q?fixed=20EXT-5006=20=E2=80=9COne=20inventory=20offer=20c?= =?UTF-8?q?ause=20blinking=20of=20both=20Conversations=20and=20Notificatio?= =?UTF-8?q?ns=20wells=E2=80=9D,=20embedded=20inventory=20offer=20panel=20i?= =?UTF-8?q?nto=20IM=20window;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : product-engine --- indra/llui/llbutton.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 8f35db1007..6a0d8ef3d6 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -257,6 +257,8 @@ public: void setForcePressedState(bool b) { mForcePressedState = b; } + void setAutoResize(bool auto_resize) { mAutoResize = auto_resize; } + protected: LLPointer getImageUnselected() const { return mImageUnselected; } LLPointer getImageSelected() const { return mImageSelected; } -- cgit v1.2.3 From 2cf2fa6ad2c82fdd7cd41456d4797e75075b9c84 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Thu, 18 Feb 2010 18:28:13 +0200 Subject: Fixed low bug EXT-5225 - Local chat doesn't go translucent when loses focus. Added customizable background image overlay color to control background transparency. Default overlay color is White, as before. --HG-- branch : product-engine --- indra/llui/llfloater.cpp | 5 ++++- indra/llui/llpanel.cpp | 10 ++++++++-- indra/llui/llpanel.h | 8 +++++++- 3 files changed, 19 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 0199fe3f57..8490fba9fa 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1574,22 +1574,25 @@ void LLFloater::draw() LLUIImage* image = NULL; LLColor4 color; + LLColor4 overlay_color; if (isBackgroundOpaque()) { // NOTE: image may not be set image = getBackgroundImage(); color = getBackgroundColor(); + overlay_color = getBackgroundImageOverlay(); } else { image = getTransparentImage(); color = getTransparentColor(); + overlay_color = getTransparentImageOverlay(); } if (image) { // We're using images for this floater's backgrounds - image->draw(getLocalRect(), UI_VERTEX_COLOR % alpha); + image->draw(getLocalRect(), overlay_color % alpha); } else { diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index d963cf4c98..0cd052eefa 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -80,6 +80,8 @@ LLPanel::Params::Params() background_opaque("background_opaque", false), bg_opaque_color("bg_opaque_color"), bg_alpha_color("bg_alpha_color"), + bg_opaque_image_overlay("bg_opaque_image_overlay"), + bg_alpha_image_overlay("bg_alpha_image_overlay"), bg_opaque_image("bg_opaque_image"), bg_alpha_image("bg_alpha_image"), min_width("min_width", 100), @@ -103,6 +105,8 @@ LLPanel::LLPanel(const LLPanel::Params& p) mBgOpaque(p.background_opaque), mBgOpaqueColor(p.bg_opaque_color()), mBgAlphaColor(p.bg_alpha_color()), + mBgOpaqueImageOverlay(p.bg_opaque_image_overlay), + mBgAlphaImageOverlay(p.bg_alpha_image_overlay), mBgOpaqueImage(p.bg_opaque_image()), mBgAlphaImage(p.bg_alpha_image()), mDefaultBtn(NULL), @@ -199,7 +203,7 @@ void LLPanel::draw() // opaque, in-front look if (mBgOpaqueImage.notNull()) { - mBgOpaqueImage->draw( local_rect, UI_VERTEX_COLOR % alpha ); + mBgOpaqueImage->draw( local_rect, mBgOpaqueImageOverlay % alpha ); } else { @@ -212,7 +216,7 @@ void LLPanel::draw() // transparent, in-back look if (mBgAlphaImage.notNull()) { - mBgAlphaImage->draw( local_rect, UI_VERTEX_COLOR % alpha ); + mBgAlphaImage->draw( local_rect, mBgAlphaImageOverlay % alpha ); } else { @@ -481,6 +485,8 @@ void LLPanel::initFromParams(const LLPanel::Params& p) setTransparentColor(p.bg_alpha_color().get()); mBgOpaqueImage = p.bg_opaque_image(); mBgAlphaImage = p.bg_alpha_image(); + mBgOpaqueImageOverlay = p.bg_opaque_image_overlay; + mBgAlphaImageOverlay = p.bg_alpha_image_overlay; } static LLFastTimer::DeclareTimer FTM_PANEL_SETUP("Panel Setup"); diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 4e53fd7ea3..03e3dc0c0e 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -77,7 +77,9 @@ public: background_opaque; Optional bg_opaque_color, - bg_alpha_color; + bg_alpha_color, + bg_opaque_image_overlay, + bg_alpha_image_overlay; // opaque image is for "panel in foreground" look Optional bg_opaque_image, bg_alpha_image; @@ -137,6 +139,8 @@ public: const LLColor4& getTransparentColor() const { return mBgAlphaColor; } LLPointer getBackgroundImage() const { return mBgOpaqueImage; } LLPointer getTransparentImage() const { return mBgAlphaImage; } + LLColor4 getBackgroundImageOverlay() { return mBgOpaqueImageOverlay; } + LLColor4 getTransparentImageOverlay() { return mBgAlphaImageOverlay; } void setBackgroundVisible( BOOL b ) { mBgVisible = b; } BOOL isBackgroundVisible() const { return mBgVisible; } void setBackgroundOpaque(BOOL b) { mBgOpaque = b; } @@ -262,6 +266,8 @@ private: BOOL mBgOpaque; // use opaque color or image LLUIColor mBgOpaqueColor; LLUIColor mBgAlphaColor; + LLUIColor mBgOpaqueImageOverlay; + LLUIColor mBgAlphaImageOverlay; LLPointer mBgOpaqueImage; // "panel in front" look LLPointer mBgAlphaImage; // "panel in back" look LLViewBorder* mBorder; -- cgit v1.2.3 From 4514b57126b2dae295602778589217f6e22451b8 Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 18 Feb 2010 10:29:56 -0800 Subject: Backed out changeset: 744bd7c535fa --- indra/llui/llfloater.cpp | 15 +++++--- indra/llui/llresizehandle.cpp | 81 ++++++++++++++++++++++--------------------- 2 files changed, 52 insertions(+), 44 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 194325cc20..a17e306325 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2360,7 +2360,7 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out LLRect::tCoordType screen_width = getSnapRect().getWidth(); LLRect::tCoordType screen_height = getSnapRect().getHeight(); - + // only automatically resize non-minimized, resizable floaters if( floater->isResizable() && !floater->isMinimized() ) { @@ -2385,11 +2385,16 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out new_width = llmax(new_width, min_width); new_height = llmax(new_height, min_height); - LLRect new_rect; - new_rect.setLeftTopAndSize(view_rect.mTop,view_rect.mLeft,new_width, new_height); - floater->reshape( new_width, new_height, TRUE ); - floater->setRect(new_rect); + if (floater->followsRight()) + { + floater->translate(old_width - new_width, 0); + } + + if (floater->followsTop()) + { + floater->translate(0, old_height - new_height); + } } } diff --git a/indra/llui/llresizehandle.cpp b/indra/llui/llresizehandle.cpp index 3df09d124a..6239a8f721 100644 --- a/indra/llui/llresizehandle.cpp +++ b/indra/llui/llresizehandle.cpp @@ -124,7 +124,7 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) { // Make sure the mouse in still over the application. We don't want to make the parent // so big that we can't see the resize handle any more. - + S32 screen_x; S32 screen_y; localPointToScreen(x, y, &screen_x, &screen_y); @@ -146,61 +146,68 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) LLRect scaled_rect = orig_rect; S32 delta_x = screen_x - mDragLastScreenX; S32 delta_y = screen_y - mDragLastScreenY; - - if(delta_x == 0 && delta_y == 0) - return FALSE; - LLCoordGL mouse_dir; // use hysteresis on mouse motion to preserve user intent when mouse stops moving mouse_dir.mX = (screen_x == mLastMouseScreenX) ? mLastMouseDir.mX : screen_x - mLastMouseScreenX; mouse_dir.mY = (screen_y == mLastMouseScreenY) ? mLastMouseDir.mY : screen_y - mLastMouseScreenY; - mLastMouseScreenX = screen_x; mLastMouseScreenY = screen_y; mLastMouseDir = mouse_dir; - S32 new_width = orig_rect.getWidth(); - S32 new_height = orig_rect.getHeight(); + S32 x_multiple = 1; + S32 y_multiple = 1; + switch( mCorner ) + { + case LEFT_TOP: + x_multiple = -1; + y_multiple = 1; + break; + case LEFT_BOTTOM: + x_multiple = -1; + y_multiple = -1; + break; + case RIGHT_TOP: + x_multiple = 1; + y_multiple = 1; + break; + case RIGHT_BOTTOM: + x_multiple = 1; + y_multiple = -1; + break; + } - S32 new_pos_x = orig_rect.mLeft; - S32 new_pos_y = orig_rect.mTop; + S32 new_width = orig_rect.getWidth() + x_multiple * delta_x; + if( new_width < mMinWidth ) + { + new_width = mMinWidth; + delta_x = x_multiple * (mMinWidth - orig_rect.getWidth()); + } + + S32 new_height = orig_rect.getHeight() + y_multiple * delta_y; + if( new_height < mMinHeight ) + { + new_height = mMinHeight; + delta_y = y_multiple * (mMinHeight - orig_rect.getHeight()); + } switch( mCorner ) { - case LEFT_TOP: - new_width-=delta_x; - new_height+=delta_y; - new_pos_x+=delta_x; - new_pos_y+=delta_y; + case LEFT_TOP: + scaled_rect.translate(delta_x, 0); break; case LEFT_BOTTOM: - new_width-=delta_x; - new_height-=delta_y; - new_pos_x+=delta_x; + scaled_rect.translate(delta_x, delta_y); break; case RIGHT_TOP: - new_width+=delta_x; - new_height+=delta_y; - new_pos_y+=delta_y; break; case RIGHT_BOTTOM: - new_width+=delta_x; - new_height-=delta_y; + scaled_rect.translate(0, delta_y); break; } - new_width = llmax(new_width,mMinWidth); - new_height = llmax(new_height,mMinHeight); - - LLRect::tCoordType screen_width = resizing_view->getParent()->getSnapRect().getWidth(); - LLRect::tCoordType screen_height = resizing_view->getParent()->getSnapRect().getHeight(); - - new_width = llmin(new_width, screen_width); - new_height = llmin(new_height, screen_height); - // temporarily set new parent rect - scaled_rect.setLeftTopAndSize(new_pos_x,new_pos_y,new_width,new_height); - + scaled_rect.mRight = scaled_rect.mLeft + new_width; + scaled_rect.mTop = scaled_rect.mBottom + new_height; resizing_view->setRect(scaled_rect); LLView* snap_view = NULL; @@ -251,11 +258,7 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) resizing_view->setRect(orig_rect); // translate and scale to new shape - resizing_view->reshape(scaled_rect.getWidth(),scaled_rect.getHeight()); - resizing_view->setRect(scaled_rect); - //set shape to handle dependent floaters... - resizing_view->handleReshape(scaled_rect, false); - + resizing_view->setShape(scaled_rect, true); // update last valid mouse cursor position based on resized view's actual size LLRect new_rect = resizing_view->getRect(); -- cgit v1.2.3 From 2231da11dd4b69a94a781e2cbb0cc980f9bdd474 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 18 Feb 2010 10:52:34 -0800 Subject: EXT-4677 Crash when closing pinned menu which has no parent Inventory floater Reviewed by Richard CC#118 --- indra/llui/llmenugl.cpp | 40 ++++++++++++++++++++++++++++++++-------- indra/llui/llmenugl.h | 10 +++------- 2 files changed, 35 insertions(+), 15 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index d18abbfb2f..0d56c5ed31 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -657,11 +657,38 @@ LLMenuItemVerticalSeparatorGL::LLMenuItemVerticalSeparatorGL( void ) // Class LLMenuItemTearOffGL //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LLMenuItemTearOffGL::LLMenuItemTearOffGL(const LLMenuItemTearOffGL::Params& p) -: LLMenuItemGL(p), - mParentHandle(p.parent_floater_handle) +: LLMenuItemGL(p) { } +// Returns the first floater ancestor if there is one +LLFloater* LLMenuItemTearOffGL::getParentFloater() +{ + LLView* parent_view = getMenu(); + + while (parent_view) + { + if (dynamic_cast(parent_view)) + { + return dynamic_cast(parent_view); + } + + bool parent_is_menu = dynamic_cast(parent_view) && !dynamic_cast(parent_view); + + if (parent_is_menu) + { + // use menu parent + parent_view = dynamic_cast(parent_view)->getParentMenuItem(); + } + else + { + // just use regular view parent + parent_view = parent_view->getParent(); + } + } + + return NULL; +} void LLMenuItemTearOffGL::onCommit() { @@ -680,7 +707,7 @@ void LLMenuItemTearOffGL::onCommit() getMenu()->needsArrange(); - LLFloater* parent_floater = mParentHandle.get(); + LLFloater* parent_floater = getParentFloater(); LLFloater* tear_off_menu = LLTearOffMenu::create(getMenu()); if (tear_off_menu) @@ -1671,7 +1698,6 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p) mSpilloverMenu(NULL), mJumpKey(p.jump_key), mCreateJumpKeys(p.create_jump_keys), - mParentFloaterHandle(p.parent_floater), mNeedsArrange(FALSE), mShortcutPad(p.shortcut_pad) { @@ -1699,7 +1725,7 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p) void LLMenuGL::initFromParams(const LLMenuGL::Params& p) { LLUICtrl::initFromParams(p); - setCanTearOff(p.can_tear_off, p.parent_floater); + setCanTearOff(p.can_tear_off); } // Destroys the object @@ -1711,12 +1737,11 @@ LLMenuGL::~LLMenuGL( void ) mJumpKeys.clear(); } -void LLMenuGL::setCanTearOff(BOOL tear_off, LLHandle parent_floater_handle ) +void LLMenuGL::setCanTearOff(BOOL tear_off) { if (tear_off && mTearOffItem == NULL) { LLMenuItemTearOffGL::Params p; - p.parent_floater_handle = parent_floater_handle; mTearOffItem = LLUICtrlFactory::create(p); addChildInBack(mTearOffItem); } @@ -2233,7 +2258,6 @@ void LLMenuGL::createSpilloverBranch() LLMenuGL::Params p; p.name("More"); p.label("More"); // *TODO: Translate - p.parent_floater(mParentFloaterHandle); p.bg_color(mBackgroundColor); p.bg_visible(true); p.can_tear_off(false); diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 8441aaadd4..39d1986461 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -355,7 +355,6 @@ class LLMenuGL public: struct Params : public LLInitParam::Block { - Optional > parent_floater; Optional jump_key; Optional horizontal_layout, can_tear_off, @@ -430,7 +429,7 @@ public: void setBackgroundColor( const LLUIColor& color ) { mBackgroundColor = color; } const LLUIColor& getBackgroundColor() const { return mBackgroundColor; } void setBackgroundVisible( BOOL b ) { mBgVisible = b; } - void setCanTearOff(BOOL tear_off, LLHandle parent_floater_handle = LLHandle()); + void setCanTearOff(BOOL tear_off); // add a separator to this menu virtual BOOL addSeparator(); @@ -553,7 +552,6 @@ private: class LLMenuItemTearOffGL* mTearOffItem; class LLMenuItemBranchGL* mSpilloverBranch; LLMenuGL* mSpilloverMenu; - LLHandle mParentFloaterHandle; KEY mJumpKey; BOOL mCreateJumpKeys; S32 mShortcutPad; @@ -814,7 +812,6 @@ class LLMenuItemTearOffGL : public LLMenuItemGL public: struct Params : public LLInitParam::Block { - Optional > parent_floater_handle; Params() { name = "tear off"; @@ -823,13 +820,12 @@ public: }; LLMenuItemTearOffGL( const Params& ); - + virtual void onCommit(void); virtual void draw(void); virtual U32 getNominalHeight() const; -private: - LLHandle mParentHandle; + LLFloater* getParentFloater(); }; -- cgit v1.2.3 From 876a764c4f8c71ad8858d07a04e05943583020e1 Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 18 Feb 2010 12:49:31 -0800 Subject: EXT-5535 - Resize handles will move floater when reaching minimum size --- indra/llui/llfloater.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 342c0684da..53296fc7a1 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2373,7 +2373,11 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out new_width = llmax(new_width, min_width); new_height = llmax(new_height, min_height); - floater->reshape( new_width, new_height, TRUE ); + LLRect new_rect; + new_rect.setLeftTopAndSize(view_rect.mLeft,view_rect.mTop,new_width, new_height); + + floater->setShape(new_rect); + if (floater->followsRight()) { floater->translate(old_width - new_width, 0); -- cgit v1.2.3 From 7ed47f72255ce9fe9ab5b3212aabf495c5554436 Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 18 Feb 2010 13:58:57 -0800 Subject: fixed line endings --- indra/llui/llfloater.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 53296fc7a1..f3cd112b9a 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2373,8 +2373,8 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out new_width = llmax(new_width, min_width); new_height = llmax(new_height, min_height); - LLRect new_rect; - new_rect.setLeftTopAndSize(view_rect.mLeft,view_rect.mTop,new_width, new_height); + LLRect new_rect; + new_rect.setLeftTopAndSize(view_rect.mLeft,view_rect.mTop,new_width, new_height); floater->setShape(new_rect); -- cgit v1.2.3 From ef9b7c5b36c7521c4519e682aa312c4c25c31c2f Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Thu, 18 Feb 2010 15:45:31 -0800 Subject: Fix for EXT-5120 "Mouse-up in the scrollbar to the right of a link in nearby chat window opens the link". Added an optional bool parameter "hit_past_end_of_line" to LLTextBase:: getDocIndexFromLocalCoord() and getSegmentAtLocalPos(). Default is true, which gives the old behavior. If false, clicks past the end-of-line won't map to the last segment on the line. Made LLNormalTextSegment::handleHover(), handleRightMouseDown(), handleMouseDown(), and handleMouseUp() call getSegmentAtLocalPos() in this new mode before processing URL actions, and only do the processing if it returns the same segment. Reviewed by Richard. --- indra/llui/lltextbase.cpp | 40 ++++++++++++++++++++++++++++------------ indra/llui/lltextbase.h | 8 ++++++-- 2 files changed, 34 insertions(+), 14 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index b84e6f45fb..851fb966ec 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1445,10 +1445,10 @@ LLTextBase::segment_set_t::const_iterator LLTextBase::getSegIterContaining(S32 i } // Finds the text segment (if any) at the give local screen position -LLTextSegmentPtr LLTextBase::getSegmentAtLocalPos( S32 x, S32 y ) +LLTextSegmentPtr LLTextBase::getSegmentAtLocalPos( S32 x, S32 y, bool hit_past_end_of_line) { // Find the cursor position at the requested local screen position - S32 offset = getDocIndexFromLocalCoord( x, y, FALSE ); + S32 offset = getDocIndexFromLocalCoord( x, y, FALSE, hit_past_end_of_line); segment_set_t::iterator seg_iter = getSegIterContaining(offset); if (seg_iter != mSegments.end()) { @@ -1788,7 +1788,7 @@ const LLWString& LLTextBase::getWText() const // will be put to its right. If round is false, the cursor will always be put to the // character's left. -S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round ) const +S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, bool hit_past_end_of_line) const { // Figure out which line we're nearest to. LLRect visible_region = getVisibleDocumentRect(); @@ -1817,7 +1817,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round S32 text_width, text_height; segmentp->getDimensions(line_seg_offset, segment_line_length, text_width, text_height); if (local_x < start_x + text_width // cursor to left of right edge of text - || segmentp->getEnd() >= line_iter->mDocIndexEnd - 1) // or this segment wraps to next line + || (hit_past_end_of_line && (segmentp->getEnd() >= line_iter->mDocIndexEnd - 1))) // or this segment wraps to next line { // Figure out which character we're nearest to. S32 offset; @@ -2402,8 +2402,12 @@ BOOL LLNormalTextSegment::handleHover(S32 x, S32 y, MASK mask) { if (getStyle() && getStyle()->isLink()) { - LLUI::getWindow()->setCursor(UI_CURSOR_HAND); - return TRUE; + // Only process the click if it's actually in this segment, not to the right of the end-of-line. + if(mEditor.getSegmentAtLocalPos(x, y, false) == this) + { + LLUI::getWindow()->setCursor(UI_CURSOR_HAND); + return TRUE; + } } return FALSE; } @@ -2412,8 +2416,12 @@ BOOL LLNormalTextSegment::handleRightMouseDown(S32 x, S32 y, MASK mask) { if (getStyle() && getStyle()->isLink()) { - mEditor.createUrlContextMenu(x, y, getStyle()->getLinkHREF()); - return TRUE; + // Only process the click if it's actually in this segment, not to the right of the end-of-line. + if(mEditor.getSegmentAtLocalPos(x, y, false) == this) + { + mEditor.createUrlContextMenu(x, y, getStyle()->getLinkHREF()); + return TRUE; + } } return FALSE; } @@ -2422,8 +2430,12 @@ BOOL LLNormalTextSegment::handleMouseDown(S32 x, S32 y, MASK mask) { if (getStyle() && getStyle()->isLink()) { - // eat mouse down event on hyperlinks, so we get the mouse up - return TRUE; + // Only process the click if it's actually in this segment, not to the right of the end-of-line. + if(mEditor.getSegmentAtLocalPos(x, y, false) == this) + { + // eat mouse down event on hyperlinks, so we get the mouse up + return TRUE; + } } return FALSE; @@ -2433,8 +2445,12 @@ BOOL LLNormalTextSegment::handleMouseUp(S32 x, S32 y, MASK mask) { if (getStyle() && getStyle()->isLink()) { - LLUrlAction::clickAction(getStyle()->getLinkHREF()); - return TRUE; + // Only process the click if it's actually in this segment, not to the right of the end-of-line. + if(mEditor.getSegmentAtLocalPos(x, y, false) == this) + { + LLUrlAction::clickAction(getStyle()->getLinkHREF()); + return TRUE; + } } return FALSE; diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 3dda6f4cc8..5b24c63557 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -48,6 +48,7 @@ class LLContextMenu; class LLTextSegment; +class LLNormalTextSegment; typedef LLPointer LLTextSegmentPtr; @@ -61,6 +62,9 @@ class LLTextBase protected LLEditMenuHandler { public: + friend class LLTextSegment; + friend class LLNormalTextSegment; + struct LineSpacingParams : public LLInitParam::Choice { Alternative multiple; @@ -165,7 +169,7 @@ public: S32 getVPad() { return mVPad; } S32 getHPad() { return mHPad; } - S32 getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round ) const; + S32 getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, bool hit_past_end_of_line = true) const; LLRect getLocalRectFromDocIndex(S32 pos) const; LLRect getDocRectFromDocIndex(S32 pos) const; @@ -275,7 +279,7 @@ protected: // manage segments void getSegmentAndOffset( S32 startpos, segment_set_t::const_iterator* seg_iter, S32* offsetp ) const; void getSegmentAndOffset( S32 startpos, segment_set_t::iterator* seg_iter, S32* offsetp ); - LLTextSegmentPtr getSegmentAtLocalPos( S32 x, S32 y ); + LLTextSegmentPtr getSegmentAtLocalPos( S32 x, S32 y, bool hit_past_end_of_line = true); segment_set_t::iterator getSegIterContaining(S32 index); segment_set_t::const_iterator getSegIterContaining(S32 index) const; void clearSegments(); -- cgit v1.2.3 From 1d89f02243d2bcd39380181efa4ca04cc8bab16f Mon Sep 17 00:00:00 2001 From: Kent Quirk Date: Sat, 20 Feb 2010 13:07:03 -0500 Subject: EXT-4878 - fixing the fix - incorrect name used for attribute. --- indra/llui/lltabcontainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 9a715cca0b..07e4cc22e0 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -215,7 +215,7 @@ LLTabContainer::Params::Params() use_custom_icon_ctrl("use_custom_icon_ctrl", false), tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0), use_ellipses("use_ellipses"), - font_halign("font_halign") + font_halign("halign") { name(std::string("tab_container")); mouse_opaque = false; -- cgit v1.2.3 From 36f708de17c64191c79a756ab7eedc3badac9828 Mon Sep 17 00:00:00 2001 From: Kent Quirk Date: Sat, 20 Feb 2010 14:41:18 -0500 Subject: EXT-5560 - filter clear button was calling doDelete which had many more gyrations than onCommit, and only onCommit was needed --- indra/llui/llsearcheditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp index 491eeeab54..8075575bab 100644 --- a/indra/llui/llsearcheditor.cpp +++ b/indra/llui/llsearcheditor.cpp @@ -156,7 +156,7 @@ void LLSearchEditor::setFocus( BOOL b ) void LLSearchEditor::onClearButtonClick(const LLSD& data) { setText(LLStringUtil::null); - mSearchEditor->doDelete(); // force keystroke callback + mSearchEditor->onCommit(); // force keystroke callback } void LLSearchEditor::handleKeystroke() -- cgit v1.2.3 From 6f98e0b9721515065b84d32428b0e55a4bde89d3 Mon Sep 17 00:00:00 2001 From: Ychebotarev ProductEngine Date: Mon, 22 Feb 2010 13:58:00 +0200 Subject: fix for EXT-5128 Groups accordions should all appear on-screen w/out scrolling (open accordion should fill space) fix is not complete since we got horizontal scrolbar which I think is not intended...need to fix croll_container. --HG-- branch : product-engine --- indra/llui/llaccordionctrl.cpp | 97 +++++++++++++++++++++++++++++++++--------- indra/llui/llaccordionctrl.h | 3 ++ 2 files changed, 81 insertions(+), 19 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index d0c73fbfbc..ae218c28c4 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -103,6 +103,13 @@ void LLAccordionCtrl::draw() LLLocalClipRect clip(local_rect); LLPanel::draw(); + /* + S32 width = getRect().getWidth(); + S32 height = getRect().getHeight(); + + gl_rect_2d(0, 0 , width - 1 ,height - 1,LLColor4::green,true); + gl_line_2d(0, 0 , width - 1 ,height - 1,LLColor4::black); + */ } @@ -338,36 +345,55 @@ void LLAccordionCtrl::addCollapsibleCtrl(LLView* view) } - -void LLAccordionCtrl::arrange() +void LLAccordionCtrl::arrangeSinge() { - if( mAccordionTabs.size() == 0) - { - //We do not arrange if we do not have what should be arranged - return; - } - - //Calculate params S32 panel_left = BORDER_MARGIN; // Margin from left side of Splitter S32 panel_top = getRect().getHeight() - BORDER_MARGIN; // Top coordinate of the first panel S32 panel_width = getRect().getWidth() - 4; // Top coordinate of the first panel + S32 panel_height; - - if(mAccordionTabs.size() == 1) + S32 collapsed_height = 0; + + for(size_t i=0;i(mAccordionTabs[0]); - - LLRect panel_rect = accordion_tab->getRect(); + LLAccordionCtrlTab* accordion_tab = dynamic_cast(mAccordionTabs[i]); - S32 panel_height = getRect().getHeight() - 2*BORDER_MARGIN; + if(accordion_tab->getVisible() == false) //skip hidden accordion tabs + continue; + if(!accordion_tab->isExpanded() ) + { + collapsed_height+=mAccordionTabs[i]->getRect().getHeight(); + } + } - ctrlSetLeftTopAndSize(accordion_tab,panel_rect.mLeft,panel_top,panel_width,panel_height); + S32 expanded_height = getRect().getHeight() - BORDER_MARGIN - collapsed_height; + + for(size_t i=0;i(mAccordionTabs[i]); - show_hide_scrollbar(getRect().getWidth(),getRect().getHeight()); - return; - + if(accordion_tab->getVisible() == false) //skip hidden accordion tabs + continue; + if(!accordion_tab->isExpanded() ) + { + panel_height = accordion_tab->getRect().getHeight(); + } + else + { + panel_height = expanded_height; + } + ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, panel_height); + panel_top-=mAccordionTabs[i]->getRect().getHeight(); } +} + +void LLAccordionCtrl::arrangeMultiple() +{ + S32 panel_left = BORDER_MARGIN; // Margin from left side of Splitter + S32 panel_top = getRect().getHeight() - BORDER_MARGIN; // Top coordinate of the first panel + S32 panel_width = getRect().getWidth() - 4; // Top coordinate of the first panel + //Calculate params for(size_t i = 0; i < mAccordionTabs.size(); i++ ) { LLAccordionCtrlTab* accordion_tab = dynamic_cast(mAccordionTabs[i]); @@ -415,7 +441,40 @@ void LLAccordionCtrl::arrange() show_hide_scrollbar(getRect().getWidth(),getRect().getHeight()); updateLayout(getRect().getWidth(),getRect().getHeight()); +} + + +void LLAccordionCtrl::arrange() +{ + if( mAccordionTabs.size() == 0) + { + //We do not arrange if we do not have what should be arranged + return; + } + + if(mAccordionTabs.size() == 1) + { + S32 panel_top = getRect().getHeight() - BORDER_MARGIN; // Top coordinate of the first panel + S32 panel_width = getRect().getWidth() - 4; // Top coordinate of the first panel + + LLAccordionCtrlTab* accordion_tab = dynamic_cast(mAccordionTabs[0]); + + LLRect panel_rect = accordion_tab->getRect(); + + S32 panel_height = getRect().getHeight() - 2*BORDER_MARGIN; + + ctrlSetLeftTopAndSize(accordion_tab,panel_rect.mLeft,panel_top,panel_width,panel_height); + + show_hide_scrollbar(getRect().getWidth(),getRect().getHeight()); + return; + + } + + if(mSingleExpansion) + arrangeSinge (); + else + arrangeMultiple (); } //--------------------------------------------------------------------------------- diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h index d57a42df32..7c29e545b7 100644 --- a/indra/llui/llaccordionctrl.h +++ b/indra/llui/llaccordionctrl.h @@ -105,6 +105,9 @@ public: void reset (); private: + void arrangeSinge(); + void arrangeMultiple(); + // Calc Splitter's height that is necessary to display all child content S32 calcRecuiredHeight(); S32 getRecuiredHeight() const { return mInnerRect.getHeight(); } -- cgit v1.2.3 From 315c0021f02f8c037aeef08b3862390ff857e2da Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 22 Feb 2010 15:06:06 +0000 Subject: remove dos line endings... --- indra/llui/llaccordionctrl.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index ae218c28c4..aa69dfe0cc 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -103,13 +103,13 @@ void LLAccordionCtrl::draw() LLLocalClipRect clip(local_rect); LLPanel::draw(); - /* - S32 width = getRect().getWidth(); - S32 height = getRect().getHeight(); - - gl_rect_2d(0, 0 , width - 1 ,height - 1,LLColor4::green,true); - gl_line_2d(0, 0 , width - 1 ,height - 1,LLColor4::black); - */ + /* + S32 width = getRect().getWidth(); + S32 height = getRect().getHeight(); + + gl_rect_2d(0, 0 , width - 1 ,height - 1,LLColor4::green,true); + gl_line_2d(0, 0 , width - 1 ,height - 1,LLColor4::black); + */ } -- cgit v1.2.3 From 16b284971ebb6ecb41ba65d5fd9da87bc08bcba3 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Mon, 22 Feb 2010 19:22:43 +0200 Subject: Fixed normal bug EXT-4964 (Invalid SLURL detection does not detect invalid slurls). - Added new static method LLSLURL::isValidSLURL() whic uses LLUrlRegistry::isUrl() to validate SLURLs and not just chek prefixes as LLSLURL::isSLURL() does. - Used it in slurl DnD check in LLViewerWindow. - LLUrlEntrySLURL regexp was changed not to pass non-valid SLURLS (such as one from the bug description). --HG-- branch : product-engine --- indra/llui/llurlentry.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 3c73ae9b0c..20c939874b 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -232,7 +232,7 @@ std::string LLUrlEntryHTTPNoProtocol::getUrl(const std::string &string) const LLUrlEntrySLURL::LLUrlEntrySLURL() { // see http://slurl.com/about.php for details on the SLURL format - mPattern = boost::regex("http://(maps.secondlife.com|slurl.com)/secondlife/\\S+/?(\\d+)?/?(\\d+)?/?(\\d+)?/?\\S*", + mPattern = boost::regex("http://(maps.secondlife.com|slurl.com)/secondlife/[^ /]+(/\\d+){0,3}(/?(\\?title|\\?img|\\?msg)=\\S*)?/?", boost::regex::perl|boost::regex::icase); mMenuName = "menu_url_slurl.xml"; mTooltip = LLTrans::getString("TooltipSLURL"); -- cgit v1.2.3 From b9ed40255857fba7c58ae054796f308871c5e6d9 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Tue, 23 Feb 2010 09:45:16 +0200 Subject: Fxed normal bug EXT - 5465 (Invalid ellipsis usage for resident names in the IM tabs) - Added reshaping procedure for tabs with LLIconCtrl --HG-- branch : product-engine --- indra/llui/lltabcontainer.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 07e4cc22e0..46d2f92ad0 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -172,6 +172,10 @@ public: } } + LLIconCtrl* getIconCtrl() const + { + return mIcon; + } private: LLIconCtrl* mIcon; @@ -1629,6 +1633,7 @@ void LLTabContainer::setTabImage(LLPanel* child, LLIconCtrl* icon) if(button) { button->setIcon(icon); + reshapeTuple(tuple); } } } @@ -1639,12 +1644,22 @@ void LLTabContainer::reshapeTuple(LLTabTuple* tuple) if (!mIsVertical) { + S32 image_overlay_width = 0; + + if(mCustomIconCtrlUsed) + { + LLCustomButtonIconCtrl* button = dynamic_cast(tuple->mButton); + LLIconCtrl* icon_ctrl = button->getIconCtrl(); + image_overlay_width = icon_ctrl ? icon_ctrl->getRect().getWidth() : 0; + } + else + { + image_overlay_width = tuple->mButton->getImageOverlay().notNull() ? + tuple->mButton->getImageOverlay()->getImage()->getWidth(0) : 0; + } // remove current width from total tab strip width mTotalTabWidth -= tuple->mButton->getRect().getWidth(); - S32 image_overlay_width = tuple->mButton->getImageOverlay().notNull() ? - tuple->mButton->getImageOverlay()->getImage()->getWidth(0) : 0; - tuple->mPadding = image_overlay_width; tuple->mButton->reshape(llclamp(mFont->getWidth(tuple->mButton->getLabelSelected()) + tab_padding + tuple->mPadding, mMinTabWidth, mMaxTabWidth), -- cgit v1.2.3 From a8165dfe59771962963e8a807b129c04a74f6d59 Mon Sep 17 00:00:00 2001 From: Ychebotarev ProductEngine Date: Tue, 23 Feb 2010 18:05:00 +0200 Subject: fix for normal EXT-5598 Group member status list is sorted by name instead of date --HG-- branch : product-engine --- indra/llui/llscrolllistctrl.cpp | 26 ++++++++++++++++++++------ indra/llui/llscrolllistctrl.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 6 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index ac4811210b..77caaaa425 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -71,8 +71,9 @@ static LLDefaultChildRegistry::Register r("scroll_list"); // local structures & classes. struct SortScrollListItem { - SortScrollListItem(const std::vector >& sort_orders) + SortScrollListItem(const std::vector >& sort_orders,const LLScrollListCtrl::sort_signal_t* sort_signal) : mSortOrders(sort_orders) + , mSortSignal(sort_signal) {} bool operator()(const LLScrollListItem* i1, const LLScrollListItem* i2) @@ -85,12 +86,20 @@ struct SortScrollListItem S32 col_idx = it->first; BOOL sort_ascending = it->second; + S32 order = sort_ascending ? 1 : -1; // ascending or descending sort for this column? + const LLScrollListCell *cell1 = i1->getColumn(col_idx); const LLScrollListCell *cell2 = i2->getColumn(col_idx); - S32 order = sort_ascending ? 1 : -1; // ascending or descending sort for this column? if (cell1 && cell2) { - sort_result = order * LLStringUtil::compareDict(cell1->getValue().asString(), cell2->getValue().asString()); + if(mSortSignal) + { + sort_result = order * (*mSortSignal)(col_idx,i1, i2); + } + else + { + sort_result = order * LLStringUtil::compareDict(cell1->getValue().asString(), cell2->getValue().asString()); + } if (sort_result != 0) { break; // we have a sort order! @@ -100,8 +109,10 @@ struct SortScrollListItem return sort_result < 0; } + typedef std::vector > sort_order_t; + const LLScrollListCtrl::sort_signal_t* mSortSignal; const sort_order_t& mSortOrders; }; @@ -169,6 +180,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) mOnSortChangedCallback( NULL ), mHighlightedItem(-1), mBorder(NULL), + mSortCallback(NULL), mPopupMenu(NULL), mNumDynamicWidthColumns(0), mTotalStaticColumnWidth(0), @@ -309,6 +321,8 @@ bool LLScrollListCtrl::preProcessChildNode(LLXMLNodePtr child) LLScrollListCtrl::~LLScrollListCtrl() { + delete mSortCallback; + std::for_each(mItemList.begin(), mItemList.end(), DeletePointer()); if( gEditMenuHandler == this ) @@ -540,7 +554,7 @@ BOOL LLScrollListCtrl::addItem( LLScrollListItem* item, EAddPosition pos, BOOL r std::stable_sort( mItemList.begin(), mItemList.end(), - SortScrollListItem(single_sort_column)); + SortScrollListItem(single_sort_column,mSortCallback)); // ADD_SORTED just sorts by first column... // this might not match user sort criteria, so flag list as being in unsorted state @@ -2395,7 +2409,7 @@ void LLScrollListCtrl::updateSort() const std::stable_sort( mItemList.begin(), mItemList.end(), - SortScrollListItem(mSortColumns)); + SortScrollListItem(mSortColumns,mSortCallback)); mSorted = true; } @@ -2411,7 +2425,7 @@ void LLScrollListCtrl::sortOnce(S32 column, BOOL ascending) std::stable_sort( mItemList.begin(), mItemList.end(), - SortScrollListItem(sort_column)); + SortScrollListItem(sort_column,mSortCallback)); } void LLScrollListCtrl::dirtyColumns() diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index d2d2379328..bfff85315d 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -73,6 +73,32 @@ public: // *TODO: Add callbacks to Params typedef boost::function callback_t; + + template struct maximum + { + typedef T result_type; + + template + T operator()(InputIterator first, InputIterator last) const + { + // If there are no slots to call, just return the + // default-constructed value + if(first == last ) return T(); + T max_value = *first++; + while (first != last) { + if (max_value < *first) + max_value = *first; + ++first; + } + + return max_value; + } + }; + + + //typedef boost::signals2::signal> sort_signal_t; + //typedef boost::signals2::signal sort_signal_t; + typedef boost::signals2::signal> sort_signal_t; struct Params : public LLInitParam::Block { @@ -362,6 +388,13 @@ public: void setNeedsSort(bool val = true) { mSorted = !val; } void dirtyColumns(); // some operation has potentially affected column layout or ordering + boost::signals2::connection setSortCallback(sort_signal_t::slot_type cb ) + { + if (!mSortCallback) mSortCallback = new sort_signal_t(); + return mSortCallback->connect(cb); + } + + protected: // "Full" interface: use this when you're creating a list that has one or more of the following: // * contains icons @@ -474,6 +507,8 @@ private: typedef std::pair sort_column_t; std::vector mSortColumns; + + sort_signal_t* mSortCallback; }; // end class LLScrollListCtrl #endif // LL_SCROLLLISTCTRL_H -- cgit v1.2.3 From 902c415595387f361db81d61589e56e5404172ae Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Tue, 23 Feb 2010 18:49:06 +0000 Subject: gah, more dos line-endings in PE diffs. --- indra/llui/llscrolllistctrl.h | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index bfff85315d..1983891649 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -74,31 +74,31 @@ public: // *TODO: Add callbacks to Params typedef boost::function callback_t; - template struct maximum - { - typedef T result_type; - - template - T operator()(InputIterator first, InputIterator last) const - { - // If there are no slots to call, just return the - // default-constructed value - if(first == last ) return T(); - T max_value = *first++; - while (first != last) { - if (max_value < *first) - max_value = *first; - ++first; - } - - return max_value; - } - }; + template struct maximum + { + typedef T result_type; + + template + T operator()(InputIterator first, InputIterator last) const + { + // If there are no slots to call, just return the + // default-constructed value + if(first == last ) return T(); + T max_value = *first++; + while (first != last) { + if (max_value < *first) + max_value = *first; + ++first; + } + + return max_value; + } + }; //typedef boost::signals2::signal> sort_signal_t; //typedef boost::signals2::signal sort_signal_t; - typedef boost::signals2::signal> sort_signal_t; + typedef boost::signals2::signal > sort_signal_t; struct Params : public LLInitParam::Block { -- cgit v1.2.3