From 2c722547ea57c1510a82200242a3ccff2e505d17 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 15 Jul 2010 10:20:06 -0700 Subject: changed allow_html to parse_urls to be clearer about its meaning allow_html still supported as alternate --- indra/llui/lldraghandle.cpp | 2 +- indra/llui/lltextbase.cpp | 5 +++-- indra/llui/lltextbase.h | 2 +- indra/llui/lltooltip.cpp | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp index 9f83fcca35..b52cb2b751 100644 --- a/indra/llui/lldraghandle.cpp +++ b/indra/llui/lldraghandle.cpp @@ -113,7 +113,7 @@ void LLDragHandleTop::setTitle(const std::string& title) params.follows.flags(FOLLOWS_TOP | FOLLOWS_LEFT | FOLLOWS_RIGHT); params.font_shadow(LLFontGL::DROP_SHADOW_SOFT); params.use_ellipses = true; - params.allow_html = false; //cancel URL replacement in floater title + params.parse_urls = false; //cancel URL replacement in floater title mTitleBox = LLUICtrlFactory::create (params); addChild( mTitleBox ); } diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index ed03645944..dd0b7ebad1 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -167,11 +167,12 @@ LLTextBase::Params::Params() font_shadow("font_shadow"), wrap("wrap"), use_ellipses("use_ellipses", false), - allow_html("allow_html", false), + parse_urls("parse_urls", false), parse_highlights("parse_highlights", false) { addSynonym(track_end, "track_bottom"); addSynonym(wrap, "word_wrap"); + addSynonym(parse_urls, "allow_html"); } @@ -209,7 +210,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mPlainText ( p.plain_text ), mWordWrap(p.wrap), mUseEllipses( p.use_ellipses ), - mParseHTML(p.allow_html), + mParseHTML(p.parse_urls), mParseHighlights(p.parse_highlights), mBGVisible(p.bg_visible), mScroller(NULL), diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 4b0eeeb7d6..bd41272f11 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -251,7 +251,7 @@ public: plain_text, wrap, use_ellipses, - allow_html, + parse_urls, parse_highlights, clip_partial; diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index ed7fd02e14..025725476e 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -186,7 +186,7 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) params.font = p.font; params.use_ellipses = true; params.wrap = p.wrap; - params.allow_html = false; // disallow hyperlinks in tooltips, as they want to spawn their own explanatory tooltips + params.parse_urls = false; // disallow hyperlinks in tooltips, as they want to spawn their own explanatory tooltips mTextBox = LLUICtrlFactory::create (params); addChild(mTextBox); -- cgit v1.2.3 From 5eaab96a0b6bcf22db53f2783c0c2716ec872967 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 16 Jul 2010 17:11:51 -0700 Subject: EXT-8465 FIX Text selection is often unreadable --- indra/llui/llstyle.cpp | 12 ++++++------ indra/llui/llstyle.h | 37 ++++++++++++++++++------------------- indra/llui/lltextbase.cpp | 31 ++++++++++++------------------- indra/llui/lltextbase.h | 6 +++++- 4 files changed, 41 insertions(+), 45 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llstyle.cpp b/indra/llui/llstyle.cpp index b8f93b6a0e..d63f67b4c1 100644 --- a/indra/llui/llstyle.cpp +++ b/indra/llui/llstyle.cpp @@ -42,6 +42,8 @@ LLStyle::Params::Params() : visible("visible", true), drop_shadow("drop_shadow", LLFontGL::NO_SHADOW), color("color", LLColor4::black), + readonly_color("readonly_color", LLColor4::black), + selected_color("selected_color", LLColor4::black), font("font", LLFontGL::getFontMonospace()), image("image"), link_href("href") @@ -49,12 +51,10 @@ LLStyle::Params::Params() LLStyle::LLStyle(const LLStyle::Params& p) -: mItalic(FALSE), - mBold(FALSE), - mUnderline(FALSE), - mVisible(p.visible), - mColor(p.color()), - mReadOnlyColor(p.readonly_color()), +: mVisible(p.visible), + mColor(p.color), + mReadOnlyColor(p.readonly_color), + mSelectedColor(p.selected_color), mFont(p.font()), mLink(p.link_href), mDropShadow(p.drop_shadow), diff --git a/indra/llui/llstyle.h b/indra/llui/llstyle.h index 2067e8e8be..44d9da7a1e 100644 --- a/indra/llui/llstyle.h +++ b/indra/llui/llstyle.h @@ -47,7 +47,8 @@ public: Optional visible; Optional drop_shadow; Optional color, - readonly_color; + readonly_color, + selected_color; Optional font; Optional image; Optional link_href; @@ -55,11 +56,14 @@ public: }; LLStyle(const Params& p = Params()); public: - const LLColor4& getColor() const { return mColor; } - void setColor(const LLColor4 &color) { mColor = color; } + const LLUIColor& getColor() const { return mColor; } + void setColor(const LLUIColor &color) { mColor = color; } - const LLColor4& getReadOnlyColor() const { return mReadOnlyColor; } - void setReadOnlyColor(const LLColor4& color) { mReadOnlyColor = color; } + const LLUIColor& getReadOnlyColor() const { return mReadOnlyColor; } + void setReadOnlyColor(const LLUIColor& color) { mReadOnlyColor = color; } + + const LLUIColor& getSelectedColor() const { return mSelectedColor; } + void setSelectedColor(const LLUIColor& color) { mSelectedColor = color; } BOOL isVisible() const; void setVisible(BOOL is_visible); @@ -79,41 +83,36 @@ public: BOOL isImage() const { return mImagep.notNull(); } - // inlined here to make it easier to compare to member data below. -MG bool operator==(const LLStyle &rhs) const { return mVisible == rhs.mVisible && mColor == rhs.mColor && mReadOnlyColor == rhs.mReadOnlyColor + && mSelectedColor == rhs.mSelectedColor && mFont == rhs.mFont && mLink == rhs.mLink && mImagep == rhs.mImagep - && mItalic == rhs.mItalic - && mBold == rhs.mBold - && mUnderline == rhs.mUnderline && mDropShadow == rhs.mDropShadow; } bool operator!=(const LLStyle& rhs) const { return !(*this == rhs); } public: - BOOL mItalic; - BOOL mBold; - BOOL mUnderline; LLFontGL::ShadowType mDropShadow; protected: ~LLStyle() { } private: - BOOL mVisible; - LLUIColor mColor; - LLUIColor mReadOnlyColor; - std::string mFontName; - const LLFontGL* mFont; // cached for performance - std::string mLink; - LLUIImagePtr mImagep; + BOOL mVisible; + LLUIColor mColor; + LLUIColor mReadOnlyColor; + LLUIColor mSelectedColor; + std::string mFontName; + const LLFontGL* mFont; + std::string mLink; + LLUIImagePtr mImagep; }; typedef LLPointer LLStyleSP; diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index dd0b7ebad1..538924e5d1 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -155,6 +155,8 @@ LLTextBase::Params::Params() bg_readonly_color("bg_readonly_color"), bg_writeable_color("bg_writeable_color"), bg_focus_color("bg_focus_color"), + text_selected_color("text_selected_color"), + bg_selected_color("bg_selected_color"), allow_scroll("allow_scroll", true), plain_text("plain_text",false), track_end("track_end", false), @@ -191,6 +193,8 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mWriteableBgColor(p.bg_writeable_color), mReadOnlyBgColor(p.bg_readonly_color), mFocusBgColor(p.bg_focus_color), + mTextSelectedColor(p.text_selected_color), + mSelectedBGColor(p.bg_selected_color), mReflowIndex(S32_MAX), mCursorPos( 0 ), mScrollNeeded(FALSE), @@ -302,11 +306,14 @@ bool LLTextBase::truncate() const LLStyle::Params& LLTextBase::getDefaultStyleParams() { + //FIXME: convert mDefaultStyle to a flyweight http://www.boost.org/doc/libs/1_40_0/libs/flyweight/doc/index.html + //and eliminate color member values if (mStyleDirty) { mDefaultStyle - .color(LLUIColor(&mFgColor)) + .color(LLUIColor(&mFgColor)) // pass linked color instead of copy of mFGColor .readonly_color(LLUIColor(&mReadOnlyFgColor)) + .selected_color(LLUIColor(&mTextSelectedColor)) .font(mDefaultFont) .drop_shadow(mFontShadow); mStyleDirty = false; @@ -404,7 +411,7 @@ void LLTextBase::drawSelectionBackground() // Draw the selection box (we're using a box instead of reversing the colors on the selected text). gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - const LLColor4& color = mReadOnly ? mReadOnlyFgColor.get() : mFgColor.get(); + const LLColor4& color = mSelectedBGColor; F32 alpha = hasFocus() ? 0.7f : 0.3f; alpha *= getDrawContext().mAlpha; LLColor4 selection_color(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], alpha); @@ -444,7 +451,6 @@ void LLTextBase::drawCursor() } else { - //segmentp = mSegments.back(); return; } @@ -478,21 +484,8 @@ void LLTextBase::drawCursor() { LLColor4 text_color; const LLFontGL* fontp; - if (segmentp) - { - text_color = segmentp->getColor(); - fontp = segmentp->getStyle()->getFont(); - } - else if (mReadOnly) - { - text_color = mReadOnlyFgColor.get(); - fontp = mDefaultFont; - } - else - { - text_color = mFgColor.get(); - fontp = mDefaultFont; - } + text_color = segmentp->getColor(); + fontp = segmentp->getStyle()->getFont(); fontp->render(text, mCursorPos, cursor_rect, LLColor4(1.f - text_color.mV[VRED], 1.f - text_color.mV[VGREEN], 1.f - text_color.mV[VBLUE], alpha), LLFontGL::LEFT, mVAlign, @@ -2482,7 +2475,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele font->render(text, start, rect, - LLColor4( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], 1.f ), + mStyle->getSelectedColor().get(), LLFontGL::LEFT, mEditor.mVAlign, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index bd41272f11..86f0e55a1d 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -241,7 +241,9 @@ public: text_readonly_color, bg_readonly_color, bg_writeable_color, - bg_focus_color; + bg_focus_color, + text_selected_color, + bg_selected_color; Optional bg_visible, border_visible, @@ -507,6 +509,8 @@ protected: LLUIColor mWriteableBgColor; LLUIColor mReadOnlyBgColor; LLUIColor mFocusBgColor; + LLUIColor mTextSelectedColor; + LLUIColor mSelectedBGColor; // cursor S32 mCursorPos; // I-beam is just after the mCursorPos-th character. -- cgit v1.2.3