From 330840af7c363accc8e12d073ba91b871c578d27 Mon Sep 17 00:00:00 2001 From: Martin Reddy Date: Fri, 4 Sep 2009 12:11:27 +0000 Subject: Merging the SLURLs Everywhere branch (viewer-2.0.0-slurls-3) into Viewer 2.0 (viewer-2.0.0-3). This provides support for clickable Urls in text editors and textboxes, with right-click context menus, tooltips, and alternate link labels. This includes alert boxes, the login progress window, local chat and IM interfaces, etc. As well as context menus for avatars and groups in list widgets. Includes fixes for the following individual JIRAs: DEV-8763 VWR-10636: Hyperlinks in alert dialogs should be selectable (clickable)! DEV-38829 EXT-742: Remove LLLink class DEV-35459 VWR-14679: SLURLs and teleport Links not parsed properly DEV-19842 VWR-8773: Closing parenthesis ")" breaks urls DEV-21577 VWR-9405: In-world SLURLs containing "(" or ")" are not treated as a hyperlink in chat DEV-37652 SEC-435: Object Chat/IMs are untraceable (VWR-2388) Fix has left flaw DEV-10353: URLs in chat log terminated incorrectly when newline in chat DEV-2925: In chat history, use a teleport hyperlink as source name for object IMs DEV-36192: Need a way to copy Avatar names and Group names DEV-2926: Allow viewer hyperlinks to have different text than the actual url DEV-27253: Add easy way to copy URLs from viewer chat DEV-38274: Make About Second Life window use new Url hyperlinking features DEV-39076: No url support in Text Editors DEV-7476 VWR-2172: Add hyperlinks to chat console for easier access DEV-7475: Add hyperlinks to notecards! DEV-35375 EXT-128: HTTPS urls aren't loaded in the internal browser by click Master JIRA issues: DEV-32819, DEV-323820, DEV-7474 Testing performed against QAR-1789 svn merge -r 131623:131889 svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer-2.0.0-slurl-3 svn merge -r 131978:132515 svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer-2.0.0-slurl-3 --- indra/newview/llchatmsgbox.h | 129 ++++++++----------------------------------- 1 file changed, 24 insertions(+), 105 deletions(-) (limited to 'indra/newview/llchatmsgbox.h') diff --git a/indra/newview/llchatmsgbox.h b/indra/newview/llchatmsgbox.h index 61035499c7..b81b740bdc 100644 --- a/indra/newview/llchatmsgbox.h +++ b/indra/newview/llchatmsgbox.h @@ -1,10 +1,11 @@ /** * @file llchatmsgbox.h + * @author Martin Reddy * @brief chat history text box, able to show array of strings with separator * - * $LicenseInfo:firstyear=2004&license=viewergpl$ + * $LicenseInfo:firstyear=2009&license=viewergpl$ * - * Copyright (c) 2004-2009, Linden Research, Inc. + * Copyright (c) 2009, Linden Research, Inc. * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab @@ -33,127 +34,45 @@ #ifndef LL_LLCHATMSGBOX_H #define LL_LLCHATMSGBOX_H - +#include "lltextbox.h" #include "lluictrl.h" #include "v4color.h" #include "llstring.h" -#include "lluistring.h" - -class LLChatMsgBox -: public LLUICtrl +/// +/// LLChatMsgBox provides a text box with support for multiple blocks +/// of text that can be added incrementally. Each block of text is +/// visual separated from the previous block (e.g., with a horizontal +/// line). +/// +class LLChatMsgBox : + public LLTextBox { -protected: - struct text_block - { - LLUIString text; - std::vector lines; - }; public: - typedef boost::function callback_t; - - struct Params : public LLInitParam::Block + struct Params : public LLInitParam::Block { - Optional text; - - Optional highlight_on_hover, - border_visible, - border_drop_shadow_visible, - bg_visible, - use_ellipses, - word_wrap; - - Optional font_shadow; - - Optional text_color, - hover_color, - disabled_color, - background_color, - border_color; - - Optional line_spacing; - - Optional block_spacing; + Optional block_spacing; Params(); }; + protected: LLChatMsgBox(const Params&); friend class LLUICtrlFactory; -public: - virtual void draw(); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - - void setColor( const LLColor4& c ) { mTextColor = c; } - void setDisabledColor( const LLColor4& c) { mDisabledColor = c; } - void setBackgroundColor( const LLColor4& c) { mBackgroundColor = c; } - void setBorderColor( const LLColor4& c) { mBorderColor = c; } - - void setHoverColor( const LLColor4& c ) { mHoverColor = c; } - void setHoverActive( BOOL active ) { mHoverActive = active; } - - void setText( const LLStringExplicit& text ); - void addText( const LLStringExplicit& text ); - - void setUseEllipses( BOOL use_ellipses ) { mUseEllipses = use_ellipses; } +public: + void setText(const LLStringExplicit &text); + void addText(const LLStringExplicit &text); - void setBackgroundVisible(BOOL visible) { mBackgroundVisible = visible; } - void setBorderVisible(BOOL visible) { mBorderVisible = visible; } - void setBorderDropshadowVisible(BOOL visible){ mBorderDropShadowVisible = visible; } - void setRightAlign() { mHAlign = LLFontGL::RIGHT; } - void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; } - void setClickedCallback( boost::function cb, void* userdata = NULL ){ mClickedCallback = boost::bind(cb, userdata); } // mouse down and up within button - - const LLFontGL* getFont() const { return mFontGL; } - - S32 getTextPixelHeight(); - S32 getTextLinesNum(); - - virtual void setValue(const LLSD& value ); - + S32 getTextPixelHeight(); + S32 getTextLinesNum(); + /*virtual*/ void setValue(const LLSD &value); + /*virtual*/ void drawText(S32 x, S32 y, const LLWString &text, const LLColor4 &color); private: - std::string wrapText (const LLStringExplicit& in_text, F32 max_width = -1.0); - - void setLineLengths (text_block& t); - void resetLineLengths (); - void drawText (S32 x, S32 y, const LLColor4& color ); - - const LLFontGL* mFontGL; - LLUIColor mTextColor; - LLUIColor mDisabledColor; - LLUIColor mBackgroundColor; - LLUIColor mBorderColor; - LLUIColor mHoverColor; - - BOOL mHoverActive; - BOOL mHasHover; - BOOL mBackgroundVisible; - BOOL mBorderVisible; - BOOL mWordWrap; - - U8 mFontStyle; // style bit flags for font - LLFontGL::ShadowType mShadowType; - BOOL mBorderDropShadowVisible; - BOOL mUseEllipses; - - S32 mLineSpacing; - S32 mBlockSpasing; - - LLFontGL::HAlign mHAlign; - LLFontGL::VAlign mVAlign; - - callback_t mClickedCallback; - - - //same as mLineLengthList and mText in LLTextBox - std::vector< boost::shared_ptr > mTextStrings; - + S32 mBlockSpacing; + std::vector mSeparatorOffset; }; #endif -- cgit v1.2.3