diff options
| -rwxr-xr-x[-rw-r--r--] | indra/llcommon/llfoldertype.h | 4 | ||||
| -rwxr-xr-x[-rw-r--r--] | indra/llui/llfolderviewitem.cpp | 29 | ||||
| -rwxr-xr-x[-rw-r--r--] | indra/llui/llfolderviewitem.h | 6 | ||||
| -rwxr-xr-x[-rw-r--r--] | indra/newview/llconversationmodel.h | 5 | ||||
| -rwxr-xr-x[-rw-r--r--] | indra/newview/llconversationview.cpp | 143 | ||||
| -rwxr-xr-x[-rw-r--r--] | indra/newview/llconversationview.h | 40 | ||||
| -rwxr-xr-x[-rw-r--r--] | indra/newview/llimfloatercontainer.cpp | 5 | ||||
| -rwxr-xr-x[-rw-r--r--] | indra/newview/llviewerfoldertype.cpp | 2 | ||||
| -rwxr-xr-x | indra/newview/skins/default/xui/en/widgets/conversation_view_participant.xml | 32 | 
9 files changed, 240 insertions, 26 deletions
diff --git a/indra/llcommon/llfoldertype.h b/indra/llcommon/llfoldertype.h index a0c847914f..609b550900 100644..100755 --- a/indra/llcommon/llfoldertype.h +++ b/indra/llcommon/llfoldertype.h @@ -89,7 +89,9 @@ public:  		FT_COUNT, -		FT_NONE = -1 +		FT_NONE = -1, + +        FT_PROFILEXXXGGG = 58  	};  	static EType 				lookup(const std::string& type_name); diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 52923389cd..7ca02b726a 100644..100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -98,6 +98,7 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)  :	LLView(p),  	mLabelWidth(0),  	mLabelWidthDirty(false), +    mLabelPaddingRight(DEFAULT_TEXT_PADDING_RIGHT),  	mParentFolder( NULL ),  	mIsSelected( FALSE ),  	mIsCurSelection( FALSE ), @@ -291,7 +292,7 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height )  		: 0;  	if (mLabelWidthDirty)  	{ -		mLabelWidth = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(mLabelStyle)->getWidth(mLabelSuffix) + TEXT_PAD_RIGHT;  +		mLabelWidth = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(mLabelStyle)->getWidth(mLabelSuffix) + mLabelPaddingRight;   		mLabelWidthDirty = false;  	} @@ -609,12 +610,13 @@ void LLFolderViewItem::draw()  	static LLUIColor sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE);  	static LLUIColor sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE); +  	const Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();  	const S32 TOP_PAD = default_params.item_top_pad;  	const S32 FOCUS_LEFT = 1;  	const LLFontGL* font = getLabelFontForStyle(mLabelStyle); -	getViewModelItem()->update(); +    getViewModelItem()->update();  	//--------------------------------------------------------------------------------//  	// Draw open folder arrow @@ -770,7 +772,7 @@ void LLFolderViewItem::draw()  	//  	font->renderUTF8(mLabel, 0, text_left, y, color,  					 LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -					 S32_MAX, getRect().getWidth() - (S32) text_left, &right_x, TRUE); +					 S32_MAX, getRect().getWidth() - (S32) text_left - mLabelPaddingRight, &right_x, TRUE);  	//--------------------------------------------------------------------------------//  	// Draw label suffix @@ -785,15 +787,18 @@ void LLFolderViewItem::draw()  	//--------------------------------------------------------------------------------//  	// Highlight string match  	// -		if (filter_string_length > 0) -		{ -		F32 match_string_left = text_left + font->getWidthF32(combined_string, 0, mViewModelItem->getFilterStringOffset()); -			F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD; -		font->renderUTF8( combined_string, mViewModelItem->getFilterStringOffset(), match_string_left, yy, -							  sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -							  filter_string_length, S32_MAX, &right_x, FALSE ); -		} -	} +    if (filter_string_length > 0) +    { +        F32 match_string_left = text_left + font->getWidthF32(combined_string, 0, mViewModelItem->getFilterStringOffset()); +        F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD; +        font->renderUTF8( combined_string, mViewModelItem->getFilterStringOffset(), match_string_left, yy, +            sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, +            filter_string_length, S32_MAX, &right_x, FALSE ); +    } + + +    LLView::draw();  +}  const LLFolderViewModelInterface* LLFolderViewItem::getFolderViewModel( void ) const  { diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index 141956c3f0..7025b94a9a 100644..100755 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -68,7 +68,7 @@ public:  						ICON_PAD = 2,  						ICON_WIDTH = 16,  						TEXT_PAD = 1, -						TEXT_PAD_RIGHT = 4, +                        DEFAULT_TEXT_PADDING_RIGHT = 4,  						ARROW_SIZE = 12,  						MAX_FOLDER_ITEM_OVERLAP = 2; @@ -85,6 +85,7 @@ protected:  	std::string					mLabel;  	S32							mLabelWidth;  	bool						mLabelWidthDirty; +    S32                         mLabelPaddingRight;  	LLFolderViewFolder*			mParentFolder;  	LLFolderViewModelItem*		mViewModelItem;  	LLFontGL::StyleFlags		mLabelStyle; @@ -230,7 +231,7 @@ public:  	virtual void onMouseLeave(S32 x, S32 y, MASK mask); -	virtual LLView* findChildView(const std::string& name, BOOL recurse) const { return NULL; } +	//virtual LLView* findChildView(const std::string& name, BOOL recurse) const { return LLView::findChildView(name, recurse); }  	//	virtual void handleDropped();  	virtual void draw(); @@ -242,6 +243,7 @@ public:  private:  	static std::map<U8, LLFontGL*> sFonts; // map of styles to fonts +  };  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index f95db9a9d7..c340194dd3 100644..100755 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -30,6 +30,7 @@  #include "llfolderviewitem.h"  #include "llfolderviewmodel.h"  #include "llavatarname.h" +#include "llviewerfoldertype.h"  // Implementation of conversations list @@ -56,7 +57,7 @@ public:  	virtual const std::string& getSearchableName() const { return mName; }  	virtual const LLUUID& getUUID() const { return mUUID; }  	virtual time_t getCreationDate() const { return 0; } -	virtual LLPointer<LLUIImage> getIcon() const { return NULL; } +	virtual LLPointer<LLUIImage> getIcon() const { return LLUI::getUIImage(LLViewerFolderType::lookupIconName(LLFolderType::FT_PROFILEXXXGGG, FALSE)); }  	virtual LLPointer<LLUIImage> getOpenIcon() const { return getIcon(); }  	virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }  	virtual std::string getLabelSuffix() const { return LLStringUtil::null; } @@ -121,7 +122,7 @@ public:  	virtual ~LLConversationItemSession() {}  	/*virtual*/ bool hasChildren() const; - +    LLPointer<LLUIImage> getIcon() const { return NULL; }  	void setSessionID(const LLUUID& session_id) { mUUID = session_id; mNeedsRefresh = true; }  	void addParticipant(LLConversationItemParticipant* participant);  	void removeParticipant(LLConversationItemParticipant* participant); diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 53971a3159..208a89cc8d 100644..100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -28,15 +28,21 @@  #include "llviewerprecompiledheaders.h"  #include "llconversationview.h" + +#include <boost/bind.hpp>  #include "llconversationmodel.h"  #include "llimconversation.h"  #include "llimfloatercontainer.h" +#include "llfloaterreg.h" +#include "lluictrlfactory.h"  //  // Implementation of conversations list session widgets  //  static LLDefaultChildRegistry::Register<LLConversationViewSession> r_conversation_view_session("conversation_view_session"); + +  LLConversationViewSession::Params::Params() :	  	container()  {} @@ -303,14 +309,57 @@ void LLConversationViewSession::refresh()  // Implementation of conversations list participant (avatar) widgets  // +static LLDefaultChildRegistry::Register<LLConversationViewParticipant> r("conversation_view_participant"); +bool LLConversationViewParticipant::sStaticInitialized = false; +S32 LLConversationViewParticipant::sChildrenWidths[LLConversationViewParticipant::ALIC_COUNT]; +  LLConversationViewParticipant::Params::Params() :	 -	participant_id() +container(), +participant_id(), +info_button("info_button"), +output_monitor("output_monitor")  {}  LLConversationViewParticipant::LLConversationViewParticipant( const LLConversationViewParticipant::Params& p ):  	LLFolderViewItem(p), -	mUUID(p.participant_id) +    mInfoBtn(NULL), +    mSpeakingIndicator(NULL), +    mUUID(p.participant_id) +{ + +} + +void LLConversationViewParticipant::initFromParams(const LLConversationViewParticipant::Params& params) +{	 +	LLButton::Params info_button_params(params.info_button()); +    applyXUILayout(info_button_params, this); +	LLButton * button = LLUICtrlFactory::create<LLButton>(info_button_params); +	addChild(button);	 + +    LLOutputMonitorCtrl::Params output_monitor_params(params.output_monitor()); +    applyXUILayout(output_monitor_params, this); +    LLOutputMonitorCtrl * outputMonitor = LLUICtrlFactory::create<LLOutputMonitorCtrl>(output_monitor_params); +    addChild(outputMonitor); +} + +BOOL LLConversationViewParticipant::postBuild()  { +	mInfoBtn = getChild<LLButton>("info_btn"); +	mInfoBtn->setClickedCallback(boost::bind(&LLConversationViewParticipant::onInfoBtnClick, this)); +	mInfoBtn->setVisible(false); + +	mSpeakingIndicator = getChild<LLOutputMonitorCtrl>("speaking_indicator"); + +    if (!sStaticInitialized) +    { +        // Remember children widths including their padding from the next sibling, +        // so that we can hide and show them again later. +        initChildrenWidths(this); +        sStaticInitialized = true; +    } + +    computeLabelRightPadding(); +	return LLFolderViewItem::postBuild();  }  void LLConversationViewParticipant::refresh() @@ -325,4 +374,94 @@ void LLConversationViewParticipant::refresh()  	LLFolderViewItem::refresh();  } +void LLConversationViewParticipant::addToFolder(LLFolderViewFolder* folder) +{ +    //Add the item to the folder (conversation) +    LLFolderViewItem::addToFolder(folder); +	 +    //Now retrieve the folder (conversation) UUID, which is the speaker session +    LLConversationItem* vmi = this->getParentFolder() ? dynamic_cast<LLConversationItem*>(this->getParentFolder()->getViewModelItem()) : NULL; +    if(vmi) +    { +        mSpeakingIndicator->setSpeakerId(mUUID,  +        vmi->getUUID()); //set the session id +    } +} + +void LLConversationViewParticipant::onInfoBtnClick() +{ +	LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mUUID)); +} + +void LLConversationViewParticipant::onMouseEnter(S32 x, S32 y, MASK mask) +{ +    mInfoBtn->setVisible(true); +    computeLabelRightPadding(); +    LLFolderViewItem::onMouseEnter(x, y, mask); +} + +void LLConversationViewParticipant::onMouseLeave(S32 x, S32 y, MASK mask) +{ +    mInfoBtn->setVisible(false); +    computeLabelRightPadding(); +    LLFolderViewItem::onMouseEnter(x, y, mask); +} + +// static +void LLConversationViewParticipant::initChildrenWidths(LLConversationViewParticipant* self) +{ +    //speaking indicator width + padding +    S32 speaking_indicator_width = self->getRect().getWidth() - self->mSpeakingIndicator->getRect().mLeft; + +    //info btn width + padding +    S32 info_btn_width = self->mSpeakingIndicator->getRect().mLeft - self->mInfoBtn->getRect().mLeft; + +    S32 index = ALIC_COUNT; +    sChildrenWidths[--index] = info_btn_width; +    sChildrenWidths[--index] = speaking_indicator_width; +    llassert(index == 0); +} + +void LLConversationViewParticipant::computeLabelRightPadding() +{ +    mLabelPaddingRight = DEFAULT_TEXT_PADDING_RIGHT; +    LLView* control; +    S32 ctrl_width; + +    for (S32 i = 0; i < ALIC_COUNT; ++i) +    { +        control = getItemChildView((EAvatarListItemChildIndex)i); + +        // skip invisible views +        if (!control->getVisible()) continue; + +        ctrl_width = sChildrenWidths[i]; // including space between current & left controls +        // accumulate the amount of space taken by the controls +        mLabelPaddingRight += ctrl_width; +    } +} + +LLView* LLConversationViewParticipant::getItemChildView(EAvatarListItemChildIndex child_view_index) +{ +    LLView* child_view = NULL; + +    switch (child_view_index) +    { +        case ALIC_SPEAKER_INDICATOR: +            child_view = mSpeakingIndicator; +            break; +        case ALIC_INFO_BUTTON: +            child_view = mInfoBtn; +            break; +        default: +            LL_WARNS("AvatarItemReshape") << "Unexpected child view index is passed: " << child_view_index << LL_ENDL; +            llassert(0); +            break; +            // leave child_view untouched +    } + +    return child_view; +} +  // EOF + diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index ec99b2eb9b..3dbc36e811 100644..100755 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -29,6 +29,9 @@  #include "llfolderviewitem.h" +#include "llbutton.h" +#include "lloutputmonitorctrl.h" +  class LLTextBox;  class LLIMFloaterContainer;  class LLConversationViewSession; @@ -54,7 +57,7 @@ protected:  public:  	virtual ~LLConversationViewSession( void ) { } -	virtual void selectItem(); +	virtual void selectItem();	  	/*virtual*/ BOOL postBuild();  	/*virtual*/ void draw(); @@ -75,26 +78,51 @@ private:  class LLConversationViewParticipant : public LLFolderViewItem  { +  public: +  	struct Params : public LLInitParam::Block<Params, LLFolderViewItem::Params>  	{ +        Optional<LLIMFloaterContainer*>			container;  		Optional<LLUUID>	participant_id; +		Optional<LLButton::Params>				info_button; +        Optional<LLOutputMonitorCtrl::Params>   output_monitor;  		Params();  	}; +    virtual ~LLConversationViewParticipant( void ) { } +    bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); } +    virtual void refresh(); +    void addToFolder(LLFolderViewFolder* folder); + +    void onMouseEnter(S32 x, S32 y, MASK mask); +    void onMouseLeave(S32 x, S32 y, MASK mask); +  protected:  	friend class LLUICtrlFactory;  	LLConversationViewParticipant( const Params& p ); +	void initFromParams(const Params& params); +	BOOL postBuild(); -public: -	virtual ~LLConversationViewParticipant( void ) { } - -	bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); } +	void onInfoBtnClick(); -	virtual void refresh();  private: +	LLButton * mInfoBtn; +    LLOutputMonitorCtrl* mSpeakingIndicator;  	LLUUID mUUID;		// UUID of the participant + +    typedef enum e_avatar_item_child { +        ALIC_SPEAKER_INDICATOR, +        ALIC_INFO_BUTTON, +        ALIC_COUNT, +    } EAvatarListItemChildIndex; + +    static bool	sStaticInitialized; // this variable is introduced to improve code readability +    static S32 sChildrenWidths[ALIC_COUNT]; +    static void initChildrenWidths(LLConversationViewParticipant* self); +    void computeLabelRightPadding(); +    LLView* getItemChildView(EAvatarListItemChildIndex child_view_index);  };  #endif // LL_LLCONVERSATIONVIEW_H diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 58b788d231..54a40627fb 100644..100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -711,6 +711,7 @@ LLConversationViewSession* LLIMFloaterContainer::createConversationItemWidget(LL  LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParticipant(LLConversationItem* item)  {  	LLConversationViewParticipant::Params params; +    LLRect panel_rect = mConversationsListPanel->getRect();  	params.name = item->getDisplayName();  	//params.icon = bridge->getIcon(); @@ -718,7 +719,9 @@ LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParti  	//params.creation_date = bridge->getCreationDate();  	params.root = mConversationsRoot;  	params.listener = item; -	params.rect = LLRect (0, 0, 0, 0); + +    //16 and panel_rect.getWidth() are used since that is currently the values used in repositioningWidgets() +	params.rect = LLRect (0, 16, panel_rect.getWidth(), 0);  	params.tool_tip = params.name;  	params.participant_id = item->getUUID(); diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp index a179b61cff..0a402d8c42 100644..100755 --- a/indra/newview/llviewerfoldertype.cpp +++ b/indra/newview/llviewerfoldertype.cpp @@ -147,6 +147,8 @@ LLViewerFolderDictionary::LLViewerFolderDictionary()  		addEntry((LLFolderType::EType)type, 		new ViewerFolderEntry("New Folder",				"Inv_FolderOpen",		"Inv_FolderClosed",		FALSE,     false));  	}	  #endif + +    addEntry(LLFolderType::FT_PROFILEXXXGGG, 				new ViewerFolderEntry("Profile",				"Generic_Person",		"Generic_Person",		FALSE,     false, "default"));  }  bool LLViewerFolderDictionary::initEnsemblesFromFile() diff --git a/indra/newview/skins/default/xui/en/widgets/conversation_view_participant.xml b/indra/newview/skins/default/xui/en/widgets/conversation_view_participant.xml new file mode 100755 index 0000000000..60015576b5 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/conversation_view_participant.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<conversation_view_participant +  folder_arrow_image="ForSale_Badge" +  folder_indentation="8" +  item_height="20"  +  item_top_pad="4" +  selection_image="Rounded_Square" +  mouse_opaque="true" +  follows="left|top|right" +> +<info_button +	 follows="right" +	 auto_update="true" +     height="16" +     image_pressed="Info_Press" +     image_unselected="Info_Over" +     layout="topleft" +     right="-28" +     name="info_btn" +     width="16" /> +<output_monitor +	follows="right" +	auto_update="true" +	draw_border="false" +	height="16" +	layout="topleft" +	right="-3" +	mouse_opaque="true" +	name="speaking_indicator" +	visible="true" +	width="20" />	  +</conversation_view_participant>  | 
