diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-07-03 10:49:07 +0100 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-07-03 10:49:07 +0100 |
commit | d3060e64a2aee975320e10a6c240387f04dc973c (patch) | |
tree | 7e775a7964d7574cf2cbe462137675ad1ee23ed6 | |
parent | b8daec6144bfe064eb9b43e776ec21f997de2923 (diff) | |
parent | daec4f6bb75634c6355f58d9fa5ef60f50a2e73f (diff) |
merge from PE's viewer-release. conflicts resolved.
-rw-r--r-- | indra/llui/lltextbase.cpp | 27 | ||||
-rw-r--r-- | indra/llui/lltextbase.h | 334 | ||||
-rw-r--r-- | indra/llui/lltextutil.cpp | 34 | ||||
-rw-r--r-- | indra/llui/lltextutil.h | 15 | ||||
-rw-r--r-- | indra/llui/llurlentry.cpp | 13 | ||||
-rw-r--r-- | indra/llui/llurlentry.h | 2 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 43 | ||||
-rw-r--r-- | indra/newview/llcofwearables.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llpanelimcontrolpanel.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llpanelimcontrolpanel.h | 1 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llpaneloutfitedit.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llsidepanelinventory.h | 5 | ||||
-rw-r--r-- | indra/newview/llwearableitemslist.cpp | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/main_view.xml | 10 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml | 11 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_bottomtray.xml | 12 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_cof_wearables.xml | 26 |
18 files changed, 384 insertions, 212 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index ccd22ee050..223998569b 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -40,6 +40,7 @@ #include "llscrollcontainer.h" #include "llstl.h" #include "lltextparser.h" +#include "lltextutil.h" #include "lltooltip.h" #include "lluictrl.h" #include "llurlaction.h" @@ -1595,6 +1596,9 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para while ( LLUrlRegistry::instance().findUrl(text, match, boost::bind(&LLTextBase::replaceUrlLabel, this, _1, _2)) ) { + + LLTextUtil::processUrlMatch(&match,this); + start = match.getStart(); end = match.getEnd()+1; @@ -1619,22 +1623,6 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para std::string subtext=text.substr(0,start); appendAndHighlightText(subtext, part, style_params); } - - // output an optional icon before the Url - if (! match.getIcon().empty()) - { - LLUIImagePtr image = LLUI::getUIImage(match.getIcon()); - if (image) - { - LLStyle::Params icon; - icon.image = image; - // Text will be replaced during rendering with the icon, - // but string cannot be empty or the segment won't be - // added (or drawn). - appendImageSegment(icon); - } - } - // output the styled Url (unless we've been asked to suppress hyperlinking) if (match.isLinkDisabled()) { @@ -1716,7 +1704,14 @@ void LLTextBase::appendImageSegment(const LLStyle::Params& style_params) insertStringNoUndo(getLength(), utf8str_to_wstring(" "), &segments); } +void LLTextBase::appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo) +{ + segment_vec_t segments; + LLWString widget_wide_text = utf8str_to_wstring(text); + segments.push_back(new LLInlineViewSegment(params, getLength(), getLength() + widget_wide_text.size())); + insertStringNoUndo(getLength(), widget_wide_text, &segments); +} void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 highlight_part, const LLStyle::Params& style_params) { diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index ff63cc26f5..300ee0f05f 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -47,8 +47,170 @@ #include <boost/signals2.hpp> class LLContextMenu; -class LLTextSegment; -class LLNormalTextSegment; +class LLUrlMatch; + +/// +/// A text segment is used to specify a subsection of a text string +/// that should be formatted differently, such as a hyperlink. It +/// includes a start/end offset from the start of the string, a +/// style to render with, an optional tooltip, etc. +/// +class LLTextSegment : public LLRefCount, public LLMouseHandler +{ +public: + LLTextSegment(S32 start, S32 end) : mStart(start), mEnd(end){}; + virtual ~LLTextSegment(); + + virtual bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; + virtual S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const; + virtual S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const; + virtual void updateLayout(const class LLTextBase& editor); + virtual F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect); + virtual bool canEdit() const; + virtual void unlinkFromDocument(class LLTextBase* editor); + virtual void linkToDocument(class LLTextBase* editor); + + virtual const LLColor4& getColor() const; + //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); + virtual void dump() const; + + // LLMouseHandler interface + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ std::string getName() const; + /*virtual*/ void onMouseCaptureLost(); + /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const; + /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const; + /*virtual*/ BOOL hasMouseCapture(); + + S32 getStart() const { return mStart; } + void setStart(S32 start) { mStart = start; } + S32 getEnd() const { return mEnd; } + void setEnd( S32 end ) { mEnd = end; } + +protected: + S32 mStart; + S32 mEnd; +}; + +class LLNormalTextSegment : public LLTextSegment +{ +public: + LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor ); + LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE); + ~LLNormalTextSegment(); + + /*virtual*/ bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; + /*virtual*/ S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const; + /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const; + /*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*/ 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; + /*virtual*/ void setToolTip(const std::string& tooltip); + /*virtual*/ void dump() const; + + /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); + +protected: + F32 drawClippedSegment(S32 seg_start, S32 seg_end, S32 selection_start, S32 selection_end, LLRect rect); + +protected: + class LLTextBase& mEditor; + LLStyleConstSP mStyle; + S32 mFontHeight; + LLKeywordToken* mToken; + std::string mTooltip; + boost::signals2::connection mImageLoadedConnection; +}; + +class LLIndexSegment : public LLTextSegment +{ +public: + LLIndexSegment(S32 pos) : LLTextSegment(pos, pos) {} +}; + +class LLInlineViewSegment : public LLTextSegment +{ +public: + struct Params : public LLInitParam::Block<Params> + { + Mandatory<LLView*> view; + Optional<bool> force_newline; + Optional<S32> left_pad, + right_pad, + bottom_pad, + top_pad; + }; + + LLInlineViewSegment(const Params& p, S32 start, S32 end); + ~LLInlineViewSegment(); + /*virtual*/ bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; + /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const; + /*virtual*/ void updateLayout(const class LLTextBase& editor); + /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect); + /*virtual*/ bool canEdit() const { return false; } + /*virtual*/ void unlinkFromDocument(class LLTextBase* editor); + /*virtual*/ void linkToDocument(class LLTextBase* editor); + +private: + S32 mLeftPad; + S32 mRightPad; + S32 mTopPad; + S32 mBottomPad; + LLView* mView; + bool mForceNewLine; +}; + +class LLLineBreakTextSegment : public LLTextSegment +{ +public: + + LLLineBreakTextSegment(LLStyleConstSP style,S32 pos); + LLLineBreakTextSegment(S32 pos); + ~LLLineBreakTextSegment(); + bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; + S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const; + F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect); + +private: + S32 mFontHeight; +}; + +class LLImageTextSegment : public LLTextSegment +{ +public: + LLImageTextSegment(LLStyleConstSP style,S32 pos,class LLTextBase& editor); + ~LLImageTextSegment(); + bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; + S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const; + F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect); + +private: + class LLTextBase& mEditor; + LLStyleConstSP mStyle; +}; typedef LLPointer<LLTextSegment> LLTextSegmentPtr; @@ -196,8 +358,9 @@ public: const LLFontGL* getDefaultFont() const { return mDefaultFont; } - void appendLineBreakSegment(const LLStyle::Params& style_params); - void appendImageSegment(const LLStyle::Params& style_params); + virtual void appendLineBreakSegment(const LLStyle::Params& style_params); + virtual void appendImageSegment(const LLStyle::Params& style_params); + virtual void appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo); public: // Fired when a URL link is clicked @@ -386,167 +549,4 @@ protected: }; -/// -/// A text segment is used to specify a subsection of a text string -/// that should be formatted differently, such as a hyperlink. It -/// includes a start/end offset from the start of the string, a -/// style to render with, an optional tooltip, etc. -/// -class LLTextSegment : public LLRefCount, public LLMouseHandler -{ -public: - LLTextSegment(S32 start, S32 end) : mStart(start), mEnd(end){}; - virtual ~LLTextSegment(); - - virtual bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; - virtual S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const; - virtual S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const; - virtual void updateLayout(const class LLTextBase& editor); - virtual F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect); - virtual bool canEdit() const; - virtual void unlinkFromDocument(class LLTextBase* editor); - virtual void linkToDocument(class LLTextBase* editor); - - virtual const LLColor4& getColor() const; - //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); - virtual void dump() const; - - // LLMouseHandler interface - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); - /*virtual*/ std::string getName() const; - /*virtual*/ void onMouseCaptureLost(); - /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const; - /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const; - /*virtual*/ BOOL hasMouseCapture(); - - S32 getStart() const { return mStart; } - void setStart(S32 start) { mStart = start; } - S32 getEnd() const { return mEnd; } - void setEnd( S32 end ) { mEnd = end; } - -protected: - S32 mStart; - S32 mEnd; -}; - -class LLNormalTextSegment : public LLTextSegment -{ -public: - LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor ); - LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE); - ~LLNormalTextSegment(); - - /*virtual*/ bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; - /*virtual*/ S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const; - /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const; - /*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*/ 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; - /*virtual*/ void setToolTip(const std::string& tooltip); - /*virtual*/ void dump() const; - - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); - -protected: - F32 drawClippedSegment(S32 seg_start, S32 seg_end, S32 selection_start, S32 selection_end, LLRect rect); - -protected: - class LLTextBase& mEditor; - LLStyleConstSP mStyle; - S32 mFontHeight; - LLKeywordToken* mToken; - std::string mTooltip; - boost::signals2::connection mImageLoadedConnection; -}; - -class LLIndexSegment : public LLTextSegment -{ -public: - LLIndexSegment(S32 pos) : LLTextSegment(pos, pos) {} -}; - -class LLInlineViewSegment : public LLTextSegment -{ -public: - struct Params : public LLInitParam::Block<Params> - { - Mandatory<LLView*> view; - Optional<bool> force_newline; - Optional<S32> left_pad, - right_pad, - bottom_pad, - top_pad; - }; - - LLInlineViewSegment(const Params& p, S32 start, S32 end); - ~LLInlineViewSegment(); - /*virtual*/ bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; - /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const; - /*virtual*/ void updateLayout(const class LLTextBase& editor); - /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect); - /*virtual*/ bool canEdit() const { return false; } - /*virtual*/ void unlinkFromDocument(class LLTextBase* editor); - /*virtual*/ void linkToDocument(class LLTextBase* editor); - -private: - S32 mLeftPad; - S32 mRightPad; - S32 mTopPad; - S32 mBottomPad; - LLView* mView; - bool mForceNewLine; -}; - -class LLLineBreakTextSegment : public LLTextSegment -{ -public: - - LLLineBreakTextSegment(LLStyleConstSP style,S32 pos); - LLLineBreakTextSegment(S32 pos); - ~LLLineBreakTextSegment(); - bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; - S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const; - F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect); - -private: - S32 mFontHeight; -}; - -class LLImageTextSegment : public LLTextSegment -{ -public: - LLImageTextSegment(LLStyleConstSP style,S32 pos,class LLTextBase& editor); - ~LLImageTextSegment(); - bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; - S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const; - F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect); - -private: - class LLTextBase& mEditor; - LLStyleConstSP mStyle; -}; - #endif diff --git a/indra/llui/lltextutil.cpp b/indra/llui/lltextutil.cpp index c5f3929fb1..56664071b7 100644 --- a/indra/llui/lltextutil.cpp +++ b/indra/llui/lltextutil.cpp @@ -34,7 +34,9 @@ #include "lluicolor.h" #include "lltextbox.h" +#include "llurlmatch.h" +boost::function<bool(LLUrlMatch*,LLTextBase*)> LLTextUtil::TextHelpers::iconCallbackCreationFunction = 0; void LLTextUtil::textboxSetHighlightedVal(LLTextBox *txtbox, const LLStyle::Params& normal_style, const std::string& text, const std::string& hl) { @@ -76,4 +78,36 @@ const std::string& LLTextUtil::formatPhoneNumber(const std::string& phone_str) return formatted_phone_str; } +bool LLTextUtil::processUrlMatch(LLUrlMatch* match,LLTextBase* text_base) +{ + if (match == 0 || text_base == 0) + return false; + + if(match->getID() != LLUUID::null && TextHelpers::iconCallbackCreationFunction) + { + bool segment_created = TextHelpers::iconCallbackCreationFunction(match,text_base); + if(segment_created) + return true; + } + + // output an optional icon before the Url + if (!match->getIcon().empty() ) + { + LLUIImagePtr image = LLUI::getUIImage(match->getIcon()); + if (image) + { + LLStyle::Params icon; + icon.image = image; + // Text will be replaced during rendering with the icon, + // but string cannot be empty or the segment won't be + // added (or drawn). + text_base->appendImageSegment(icon); + + return true; + } + } + + return false; +} + // EOF diff --git a/indra/llui/lltextutil.h b/indra/llui/lltextutil.h index 325c3c5b7c..407880d195 100644 --- a/indra/llui/lltextutil.h +++ b/indra/llui/lltextutil.h @@ -36,6 +36,8 @@ #include "llstyle.h" class LLTextBox; +class LLUrlMatch; +class LLTextBase; namespace LLTextUtil { @@ -67,6 +69,19 @@ namespace LLTextUtil * @return reference to string with formatted phone number */ const std::string& formatPhoneNumber(const std::string& phone_str); + + bool processUrlMatch(LLUrlMatch* match,LLTextBase* text_base); + + class TextHelpers + { + + //we need this special callback since we need to create LLAvataIconCtrls while parsing + //avatar/group url but can't create LLAvataIconCtrl from LLUI + public: + static boost::function<bool(LLUrlMatch*,LLTextBase*)> iconCallbackCreationFunction; + }; + + } #endif // LL_LLTEXTUTIL_H diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index fd56a87345..e075699a6e 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -326,6 +326,11 @@ void LLUrlEntryAgent::onAgentNameReceived(const LLUUID& id, callObservers(id.asString(), first + " " + last); } +LLUUID LLUrlEntryAgent::getID(const std::string &string) const +{ + return LLUUID(getIDStringFromUrl(string)); +} + std::string LLUrlEntryAgent::getTooltip(const std::string &string) const { // return a tooltip corresponding to the URL type instead of the generic one @@ -434,6 +439,8 @@ LLUrlEntryGroup::LLUrlEntryGroup() mColor = LLUIColorTable::instance().getColor("GroupLinkColor"); } + + void LLUrlEntryGroup::onGroupNameReceived(const LLUUID& id, const std::string& first, const std::string& last, @@ -443,6 +450,12 @@ void LLUrlEntryGroup::onGroupNameReceived(const LLUUID& id, callObservers(id.asString(), first); } +LLUUID LLUrlEntryGroup::getID(const std::string &string) const +{ + return LLUUID(getIDStringFromUrl(string)); +} + + std::string LLUrlEntryGroup::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { if (!gCacheName) diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 3c21fe8d61..7d718b67a9 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -172,6 +172,7 @@ public: LLUrlEntryAgent(); /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); /*virtual*/ std::string getTooltip(const std::string &string) const; + /*virtual*/ LLUUID getID(const std::string &string) const; private: void onAgentNameReceived(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); @@ -186,6 +187,7 @@ class LLUrlEntryGroup : public LLUrlEntryBase public: LLUrlEntryGroup(); /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); + /*virtual*/ LLUUID getID(const std::string &string) const; private: void onGroupNameReceived(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index dc514eafe7..682e3eb874 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -82,6 +82,8 @@ #include "llvoavatarself.h" #include "llsidetray.h" #include "llfeaturemanager.h" +#include "llurlmatch.h" +#include "lltextutil.h" #include "llweb.h" #include "llsecondlifeurls.h" @@ -192,6 +194,7 @@ #include "llviewerthrottle.h" #include "llparcel.h" #include "llavatariconctrl.h" +#include "llgroupiconctrl.h" // Include for security api initialization #include "llsecapi.h" @@ -351,6 +354,45 @@ static void ui_audio_callback(const LLUUID& uuid) } } +bool create_text_segment_icon_from_url_match(LLUrlMatch* match,LLTextBase* base) +{ + if(!match || !base) + return false; + + LLUUID match_id = match->getID(); + + LLIconCtrl* icon; + + if(gAgent.isInGroup(match_id, TRUE)) + { + LLGroupIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLGroupIconCtrl>(); + icon_params.group_id = match_id; + icon_params.rect = LLRect(0, 16, 16, 0); + icon_params.visible = true; + icon = LLUICtrlFactory::instance().createWidget<LLGroupIconCtrl>(icon_params); + } + else + { + LLAvatarIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLAvatarIconCtrl>(); + icon_params.avatar_id = match_id; + icon_params.rect = LLRect(0, 16, 16, 0); + icon_params.visible = true; + icon = LLUICtrlFactory::instance().createWidget<LLAvatarIconCtrl>(icon_params); + } + + LLInlineViewSegment::Params params; + params.force_newline = false; + params.view = icon; + params.left_pad = 4; + params.right_pad = 4; + params.top_pad = 2; + params.bottom_pad = 2; + + base->appendWidget(params," ",false); + + return true; +} + void request_initial_instant_messages() { static BOOL requested = FALSE; @@ -887,6 +929,7 @@ bool LLAppViewer::init() } LLViewerMedia::initClass(); + LLTextUtil::TextHelpers::iconCallbackCreationFunction = create_text_segment_icon_from_url_match; //EXT-7013 - On windows for some locale (Japanese) standard //datetime formatting functions didn't support some parameters such as "weekday". diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index 472d2ccf24..f278fb6a7b 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -372,6 +372,11 @@ void LLCOFWearables::refresh() iter != iter_end; ++iter) { LLFlatListView* list = iter->first; + if (!list) continue; + + //restoring selection should not fire commit callbacks + list->setCommitOnSelectionChange(false); + const values_vector_t& values = iter->second; for (values_vector_t::const_iterator value_it = values.begin(), @@ -385,6 +390,8 @@ void LLCOFWearables::refresh() list->selectItemByValue(*value_it); } } + + list->setCommitOnSelectionChange(true); } } diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp index 709bb83fe4..b79a4f359a 100644 --- a/indra/newview/llpanelimcontrolpanel.cpp +++ b/indra/newview/llpanelimcontrolpanel.cpp @@ -37,6 +37,7 @@ #include "llpanelimcontrolpanel.h" #include "llagent.h" +#include "llappviewer.h" // for gDisconnected #include "llavataractions.h" #include "llavatariconctrl.h" #include "llbutton.h" @@ -163,7 +164,7 @@ BOOL LLPanelIMControlPanel::postBuild() childSetAction("pay_btn", boost::bind(&LLPanelIMControlPanel::onPayButtonClicked, this)); childSetEnabled("add_friend_btn", !LLAvatarActions::isFriend(getChild<LLAvatarIconCtrl>("avatar_icon")->getAvatarId())); - + setFocusReceivedCallback(boost::bind(&LLPanelIMControlPanel::onFocusReceived, this)); return LLPanelChatControlPanel::postBuild(); } @@ -194,6 +195,15 @@ void LLPanelIMControlPanel::onShareButtonClicked() LLAvatarActions::share(mAvatarID); } +void LLPanelIMControlPanel::onFocusReceived() +{ + // Disable all the buttons (Call, Teleport, etc) if disconnected. + if (gDisconnected) + { + setAllChildrenEnabled(FALSE); + } +} + void LLPanelIMControlPanel::setSessionId(const LLUUID& session_id) { LLPanelChatControlPanel::setSessionId(session_id); diff --git a/indra/newview/llpanelimcontrolpanel.h b/indra/newview/llpanelimcontrolpanel.h index ce8fc58e56..0a1fd70c08 100644 --- a/indra/newview/llpanelimcontrolpanel.h +++ b/indra/newview/llpanelimcontrolpanel.h @@ -95,6 +95,7 @@ private: void onShareButtonClicked(); void onTeleportButtonClicked(); void onPayButtonClicked(); + void onFocusReceived(); LLUUID mAvatarID; }; diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index fa7e06d323..29ce3449d1 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -53,6 +53,8 @@ #include "lltooldraganddrop.h" #include "llviewermenu.h" #include "llviewertexturelist.h" +#include "llsidepanelinventory.h" +#include "llsidetray.h" const std::string FILTERS_FILENAME("filters.xml"); @@ -1163,6 +1165,12 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) return FALSE; } + if (command_name == "share") + { + LLSidepanelInventory* parent = dynamic_cast<LLSidepanelInventory*>(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); + return parent ? parent->canShare() : FALSE; + } + return TRUE; } diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index ffd879dfd7..a7e901cbfa 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -726,24 +726,36 @@ void LLPanelOutfitEdit::filterWearablesBySelectedItem(void) bool more_than_one_selected = ids.size() > 1; bool is_dummy_item = (ids.size() && dynamic_cast<LLPanelDummyClothingListItem*>(mCOFWearables->getSelectedItem())); - //resetting selection if no item is selected or than one item is selected - if (nothing_selected || more_than_one_selected) + //expanded accordion tab determines filtering when no item is selected + if (nothing_selected) { - if (nothing_selected) - { - showWearablesFolderView(); - applyFolderViewFilter(FVIT_ALL); - } + showWearablesListView(); - if (more_than_one_selected) + switch (mCOFWearables->getExpandedAccordionAssetType()) { - showWearablesListView(); - applyListViewFilter(LVIT_ALL); + case LLAssetType::AT_OBJECT: + applyListViewFilter(LVIT_ATTACHMENT); + break; + case LLAssetType::AT_BODYPART: + applyListViewFilter(LVIT_BODYPART); + break; + case LLAssetType::AT_CLOTHING: + default: + applyListViewFilter(LVIT_CLOTHING); + break; } return; } + //resetting selection if more than one item is selected + if (more_than_one_selected) + { + showWearablesListView(); + applyListViewFilter(LVIT_ALL); + return; + } + //filter wearables by a type represented by a dummy item if (one_selected && is_dummy_item) diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h index 951fdd630c..f2f2509f9a 100644 --- a/indra/newview/llsidepanelinventory.h +++ b/indra/newview/llsidepanelinventory.h @@ -58,6 +58,9 @@ public: void showTaskInfoPanel(); void showInventoryPanel(); + // checks can share selected item(s) + bool canShare(); + protected: // Tracks highlighted (selected) item in inventory panel. LLInventoryItem *getSelectedItem(); @@ -65,8 +68,6 @@ protected: void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action); // "wear", "teleport", etc. void performActionOnSelection(const std::string &action); - bool canShare(); - void updateVerbs(); // diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index d24bd8499d..9f9a9bef35 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -269,13 +269,13 @@ LLPanelAttachmentListItem* LLPanelAttachmentListItem::create(LLViewerInventoryIt void LLPanelAttachmentListItem::updateItem(const std::string& name, EItemState item_state) { - std::string title_joint; + std::string title_joint = name; LLViewerInventoryItem* inv_item = getItem(); if (inv_item && isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(inv_item->getLinkedUUID())) { std::string joint = LLTrans::getString(gAgentAvatarp->getAttachedPointName(inv_item->getLinkedUUID())); - title_joint = name + " (" + joint + ")"; + title_joint = title_joint + " (" + joint + ")"; } LLPanelInventoryListItemBase::updateItem(title_joint, item_state); diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml index 72ab6195bc..a1ca910cbb 100644 --- a/indra/newview/skins/default/xui/en/main_view.xml +++ b/indra/newview/skins/default/xui/en/main_view.xml @@ -199,7 +199,15 @@ mouse_opaque="false" name="popup_holder" class="popup_holder" - width="1024"/> + width="1024"> + <icon follows="right|bottom" + image_name="Resize_Corner" + right="-1" + name="resize_corner" + width="11" + bottom="-1" + height="11" /> + </panel> <menu_holder top="0" follows="all" height="768" diff --git a/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml b/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml index 62365f7cc2..c394700081 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml @@ -81,6 +81,17 @@ function="Inventory.GearDefault.Enable" parameter="save_texture" /> </menu_item_call> + <menu_item_call + label="Share" + layout="topleft" + name="Share" + visible="true"> + <on_click + function="Inventory.Share" /> + <on_enable + function="Inventory.GearDefault.Enable" + parameter="share" /> + </menu_item_call> <menu_item_call label="Find Original" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml index 4eff5bc48a..4b622691b3 100644 --- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml @@ -503,5 +503,17 @@ image_pressed_selected "Lit" + "Selected" - there are new messages and the Well </button> </chiclet_notification> </layout_panel> + <icon + auto_resize="false" + color="0 0 0 0" + follows="left|right" + height="10" + image_name="spacer24.tga" + layout="topleft" + left="0" + min_width="4" + name="DUMMY2" + top="0" + width="8" /> </layout_stack> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_cof_wearables.xml b/indra/newview/skins/default/xui/en/panel_cof_wearables.xml index d5943ea156..f438e3d42d 100644 --- a/indra/newview/skins/default/xui/en/panel_cof_wearables.xml +++ b/indra/newview/skins/default/xui/en/panel_cof_wearables.xml @@ -22,40 +22,40 @@ width="311"> <accordion_tab layout="topleft" - name="tab_attachments" - title="Attachments"> + name="tab_clothing" + title="Clothing"> <flat_list_view allow_select="true" follows="all" height="10" item_pad="3" + keep_selection_visible_on_reshape="true" layout="topleft" left="0" - keep_selection_visible_on_reshape="true" multi_select="true" - name="list_attachments" + name="list_clothing" top="0" - width="311"> - <flat_list_view.no_items_text - value="No attachments worn" /> - </flat_list_view> + width="311" /> </accordion_tab> <accordion_tab layout="topleft" - name="tab_clothing" - title="Clothing"> + name="tab_attachments" + title="Attachments"> <flat_list_view allow_select="true" follows="all" height="10" item_pad="3" - keep_selection_visible_on_reshape="true" layout="topleft" left="0" + keep_selection_visible_on_reshape="true" multi_select="true" - name="list_clothing" + name="list_attachments" top="0" - width="311" /> + width="311"> + <flat_list_view.no_items_text + value="No attachments worn" /> + </flat_list_view> </accordion_tab> <accordion_tab layout="topleft" |