diff options
-rw-r--r-- | indra/newview/llpersontabview.cpp | 77 | ||||
-rw-r--r-- | indra/newview/llpersontabview.h | 16 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/widgets/person_view.xml | 9 |
3 files changed, 95 insertions, 7 deletions
diff --git a/indra/newview/llpersontabview.cpp b/indra/newview/llpersontabview.cpp index eaa112e051..fa7bc09e10 100644 --- a/indra/newview/llpersontabview.cpp +++ b/indra/newview/llpersontabview.cpp @@ -142,7 +142,6 @@ mInfoBtn(NULL), mProfileBtn(NULL), mOutputMonitorCtrl(NULL) { - initChildrenWidths(this); } S32 LLPersonView::getLabelXPos() @@ -162,6 +161,29 @@ LLPersonView::~LLPersonView() } +BOOL LLPersonView::postBuild() +{ + initChildrenWidths(this); + updateChildren(); + return LLFolderViewItem::postBuild(); +} + +void LLPersonView::onMouseEnter(S32 x, S32 y, MASK mask) +{ + mInfoBtn->setVisible(TRUE); + mProfileBtn->setVisible(TRUE); + updateChildren(); + LLFolderViewItem::onMouseEnter(x, y, mask); +} + +void LLPersonView::onMouseLeave(S32 x, S32 y, MASK mask) +{ + mInfoBtn->setVisible(FALSE); + mProfileBtn->setVisible(FALSE); + updateChildren(); + LLFolderViewItem::onMouseLeave(x, y, mask); +} + void LLPersonView::draw() { static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE); @@ -222,6 +244,11 @@ void LLPersonView::initFromParams(const LLPersonView::Params & params) mPermissionEditTheirsIcon = LLUICtrlFactory::create<LLIconCtrl>(permission_edit_theirs_icon); addChild(mPermissionEditTheirsIcon); + LLIconCtrl::Params permission_edit_mine_icon(params.permission_edit_mine_icon()); + applyXUILayout(permission_edit_mine_icon, this); + mPermissionEditMineIcon = LLUICtrlFactory::create<LLIconCtrl>(permission_edit_mine_icon); + addChild(mPermissionEditMineIcon); + LLIconCtrl::Params permission_map_icon(params.permission_map_icon()); applyXUILayout(permission_map_icon, this); mPermissionMapIcon = LLUICtrlFactory::create<LLIconCtrl>(permission_map_icon); @@ -250,5 +277,53 @@ void LLPersonView::initFromParams(const LLPersonView::Params & params) void LLPersonView::initChildrenWidths(LLPersonView* self) { + S32 output_monitor_width = self->getRect().getWidth() - self->mOutputMonitorCtrl->getRect().mLeft; + S32 profile_btn_width = self->mOutputMonitorCtrl->getRect().mLeft - self->mProfileBtn->getRect().mLeft; + S32 info_btn_width = self->mProfileBtn->getRect().mLeft - self->mInfoBtn->getRect().mLeft; + S32 permission_online_icon_width = self->mInfoBtn->getRect().mLeft - self->mPermissionOnlineIcon->getRect().mLeft; + S32 permissions_map_icon_width = self->mPermissionOnlineIcon->getRect().mLeft - self->mPermissionMapIcon->getRect().mLeft; + S32 permission_edit_mine_icon_width = self->mPermissionMapIcon->getRect().mLeft - self->mPermissionEditMineIcon->getRect().mLeft; + S32 permission_edit_theirs_icon_width = self->mPermissionEditMineIcon->getRect().mLeft - self->mPermissionEditTheirsIcon->getRect().mLeft; + S32 last_interaction_time_textbox_width = self->mPermissionEditTheirsIcon->getRect().mLeft - self->mLastInteractionTimeTextbox->getRect().mLeft; + + self->mChildAndWidthVec.push_back(std::pair<LLView *, S32>(self->mOutputMonitorCtrl, output_monitor_width)); + self->mChildAndWidthVec.push_back(std::pair<LLView *, S32>(self->mProfileBtn, profile_btn_width)); + self->mChildAndWidthVec.push_back(std::pair<LLView *, S32>(self->mInfoBtn, info_btn_width)); + self->mChildAndWidthVec.push_back(std::pair<LLView *, S32>(self->mPermissionOnlineIcon, permission_online_icon_width)); + self->mChildAndWidthVec.push_back(std::pair<LLView *, S32>(self->mPermissionMapIcon, permissions_map_icon_width)); + self->mChildAndWidthVec.push_back(std::pair<LLView *, S32>(self->mPermissionEditMineIcon, permission_edit_mine_icon_width)); + self->mChildAndWidthVec.push_back(std::pair<LLView *, S32>(self->mPermissionEditTheirsIcon, permission_edit_theirs_icon_width)); + self->mChildAndWidthVec.push_back(std::pair<LLView *, S32>(self->mLastInteractionTimeTextbox, last_interaction_time_textbox_width)); } + +void LLPersonView::updateChildren() +{ + mLabelPaddingRight = 0; + LLView * control; + S32 control_width; + LLRect control_rect; + + for(S32 i = 0; i < mChildAndWidthVec.size(); ++i) + { + control = mChildAndWidthVec[i].first; + + if(!control->getVisible()) + { + continue; + } + + control_width = mChildAndWidthVec[i].second; + mLabelPaddingRight += control_width; + + control_rect = control->getRect(); + control_rect.setLeftTopAndSize( + getLocalRect().getWidth() - mLabelPaddingRight, + control_rect.mTop, + control_rect.getWidth(), + control_rect.getHeight()); + + control->setShape(control_rect); + + } +} diff --git a/indra/newview/llpersontabview.h b/indra/newview/llpersontabview.h index d8d1a65df6..56d7f4eade 100644 --- a/indra/newview/llpersontabview.h +++ b/indra/newview/llpersontabview.h @@ -86,11 +86,15 @@ public: LLPersonView(const LLPersonView::Params& p); virtual ~LLPersonView(); - S32 getLabelXPos(); - void addToFolder(LLFolderViewFolder * person_folder_view); - void initFromParams(const LLPersonView::Params & params); + S32 getLabelXPos(); + void addToFolder(LLFolderViewFolder * person_folder_view); + void initFromParams(const LLPersonView::Params & params); + BOOL postBuild(); + void onMouseEnter(S32 x, S32 y, MASK mask); + void onMouseLeave(S32 x, S32 y, MASK mask); protected: + void draw(); void drawHighlight(); @@ -123,12 +127,12 @@ private: ALIC_COUNT, } EAvatarListItemChildIndex; + typedef std::vector<std::pair<LLView *, S32>> ChildAndWidthVec; + ChildAndWidthVec mChildAndWidthVec; + static bool sStaticInitialized; - static S32 sMouseOverChildrenWidths[ALIC_COUNT]; - static S32 sMouseOverChildren[ALIC_COUNT]; static void initChildrenWidths(LLPersonView* self); void updateChildren(); - //LLView* getItemChildView(EAvatarListItemChildIndex child_view_index); }; #endif // LL_LLPERSONTABVIEW_H diff --git a/indra/newview/skins/default/xui/en/widgets/person_view.xml b/indra/newview/skins/default/xui/en/widgets/person_view.xml index d257a5114f..d0d87c02c2 100644 --- a/indra/newview/skins/default/xui/en/widgets/person_view.xml +++ b/indra/newview/skins/default/xui/en/widgets/person_view.xml @@ -31,6 +31,7 @@ name="last_interaction_time_textbox" text_color="LtGray_50" value="0s" + visible="false" width="35" /> <permission_edit_theirs_icon layout="topleft" @@ -42,6 +43,7 @@ name="permission_edit_theirs_icon" tool_tip="You can edit this friend's objects" top="4" + visible="false" width="16" /> <permission_edit_mine_icon layout="topleft" @@ -52,6 +54,8 @@ right="-110" name="permission_edit_mine_icon" tool_tip="This friend can edit, delete or take your objects" + top="4" + visible="false" width="16" /> <permission_map_icon height="16" @@ -61,6 +65,7 @@ tool_tip="This friend can locate you on the map" right="-91" name="permission_map_icon" + visible="false" width="16" /> <permission_online_icon height="16" @@ -70,6 +75,7 @@ right="-72" name="permission_online_icon" tool_tip="This friend can see when you're online" + visible="false" width="16" /> <info_btn follows="right" @@ -81,6 +87,7 @@ name="info_btn" tool_tip="More info" tab_stop="false" + visible="false" width="16" /> <profile_btn follows="right" @@ -92,6 +99,7 @@ tab_stop="false" tool_tip="View profile" top_delta="-2" + visible="false" width="20" /> <output_monitor auto_update="true" @@ -101,6 +109,7 @@ right="-3" mouse_opaque="true" name="speaking_indicator" + visible="false" width="20" /> </person_view> |