From 2fb2efe2a24127ccb274cfdf1ca8e7e22d301ed5 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 +- indra/newview/llfolderview.cpp | 2 +- indra/newview/skins/default/xui/en/floater_aaa.xml | 2 +- indra/newview/skins/default/xui/en/floater_about.xml | 2 +- indra/newview/skins/default/xui/en/floater_im_session.xml | 2 +- indra/newview/skins/default/xui/en/floater_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/en/floater_preview_notecard.xml | 2 +- indra/newview/skins/default/xui/en/inspect_object.xml | 2 +- indra/newview/skins/default/xui/en/panel_body_parts_list_item.xml | 2 +- indra/newview/skins/default/xui/en/panel_chat_header.xml | 2 +- indra/newview/skins/default/xui/en/panel_classified_info.xml | 4 ++-- indra/newview/skins/default/xui/en/panel_clothing_list_item.xml | 2 +- .../skins/default/xui/en/panel_deletable_wearable_list_item.xml | 2 +- .../newview/skins/default/xui/en/panel_dummy_clothing_list_item.xml | 2 +- indra/newview/skins/default/xui/en/panel_group_list_item.xml | 2 +- indra/newview/skins/default/xui/en/panel_group_notify.xml | 2 +- indra/newview/skins/default/xui/en/panel_inventory_item.xml | 2 +- indra/newview/skins/default/xui/en/panel_landmark_info.xml | 2 +- indra/newview/skins/default/xui/en/panel_notification.xml | 2 +- indra/newview/skins/default/xui/en/panel_pick_info.xml | 2 +- indra/newview/skins/default/xui/en/panel_place_profile.xml | 4 ++-- indra/newview/skins/default/xui/en/panel_teleport_history_item.xml | 2 +- indra/newview/skins/default/xui/en/widgets/bodyparts_list_item.xml | 2 +- indra/newview/skins/default/xui/en/widgets/clothing_list_item.xml | 2 +- .../skins/default/xui/en/widgets/deletable_wearable_list_item.xml | 2 +- .../skins/default/xui/en/widgets/dummy_clothing_list_item.xml | 2 +- indra/newview/skins/default/xui/en/widgets/expandable_text.xml | 2 +- indra/newview/skins/default/xui/en/widgets/inventory_list_item.xml | 2 +- indra/newview/skins/default/xui/en/widgets/simple_text_editor.xml | 2 +- indra/newview/skins/default/xui/en/widgets/text.xml | 2 +- indra/newview/skins/default/xui/en/widgets/text_editor.xml | 2 +- 34 files changed, 38 insertions(+), 37 deletions(-) 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); diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 87c5a830e9..8708ebebb0 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -250,7 +250,7 @@ LLFolderView::LLFolderView(const Params& p) text_p.name(std::string(p.name)); text_p.font(font); text_p.visible(false); - text_p.allow_html(true); + text_p.parse_urls(true); text_p.wrap(true); // allow multiline text. See EXT-7564, EXT-7047 // set text padding the same as in People panel. EXT-7047, EXT-4837 text_p.h_pad(STATUS_TEXT_HPAD); diff --git a/indra/newview/skins/default/xui/en/floater_aaa.xml b/indra/newview/skins/default/xui/en/floater_aaa.xml index b9bc45a10b..cae6146880 100644 --- a/indra/newview/skins/default/xui/en/floater_aaa.xml +++ b/indra/newview/skins/default/xui/en/floater_aaa.xml @@ -21,7 +21,7 @@ This string CHANGE2 is extracted. Just a test. changes. diff --git a/indra/newview/skins/default/xui/en/floater_nearby_chat.xml b/indra/newview/skins/default/xui/en/floater_nearby_chat.xml index ec097a8e87..3b26c2ab59 100644 --- a/indra/newview/skins/default/xui/en/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/en/floater_nearby_chat.xml @@ -25,7 +25,7 @@ single_instance="true" width="320"> Touch Sit + parse_urls="true"/> - -- cgit v1.2.3 From 109ff259ca4f2d2d9d7d4b6e8120bf201736b434 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 +++- .../default/xui/en/widgets/simple_text_editor.xml | 2 ++ 5 files changed, 43 insertions(+), 45 deletions(-) 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. diff --git a/indra/newview/skins/default/xui/en/widgets/simple_text_editor.xml b/indra/newview/skins/default/xui/en/widgets/simple_text_editor.xml index f575304c76..3878c7a144 100644 --- a/indra/newview/skins/default/xui/en/widgets/simple_text_editor.xml +++ b/indra/newview/skins/default/xui/en/widgets/simple_text_editor.xml @@ -15,11 +15,13 @@ default_color="TextDefaultColor" text_color="TextFgColor" text_readonly_color="TextFgReadOnlyColor" + text_selected_color="White" h_pad="6" v_pad="4" bg_visible="true" bg_readonly_color="TextBgReadOnlyColor" bg_writeable_color="TextBgWriteableColor" + bg_selected_color="EmphasisColor" bg_focus_color="TextBgFocusColor">