From 381c13d0e51c3c054fdf2afeff8a8bcb6fc7aa11 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 20 Sep 2012 16:12:28 -0700 Subject: CHUI-283: Refactor of how the layout is determined for LLFolderViewItem. Changed constant members that defined the layout to non-const member varaibles, which are populated using a .xml file. --- indra/newview/llconversationview.cpp | 24 +++++++++++----------- indra/newview/llconversationview.h | 2 ++ .../default/xui/en/panel_outbox_inventory.xml | 9 +++++++- .../en/widgets/conversation_view_participant.xml | 11 ++++++++-- .../xui/en/widgets/conversation_view_session.xml | 9 +++++++- .../default/xui/en/widgets/folder_view_item.xml | 8 +++++++- .../xui/en/widgets/inbox_folder_view_folder.xml | 8 +++++++- 7 files changed, 53 insertions(+), 18 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 721abd5892..6860415377 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -109,8 +109,8 @@ void LLConversationViewSession::draw() { LLUIImage* arrow_image = default_params.folder_arrow_image; gl_draw_scaled_rotated_image( - mIndentation, getRect().getHeight() - ARROW_SIZE - TEXT_PAD - TOP_PAD, - ARROW_SIZE, ARROW_SIZE, mControlLabelRotation, arrow_image->getImage(), sFgColor); + mIndentation, getRect().getHeight() - mArrowSize - mTextPad - TOP_PAD, + mArrowSize, mArrowSize, mControlLabelRotation, arrow_image->getImage(), sFgColor); } @@ -227,7 +227,7 @@ void LLConversationViewSession::draw() // virtual S32 LLConversationViewSession::arrange(S32* width, S32* height) { - LLRect rect(getIndentation() + ARROW_SIZE, + LLRect rect(getIndentation() + mArrowSize, getLocalRect().mTop, getLocalRect().mRight, getLocalRect().mTop - getItemHeight()); @@ -336,7 +336,7 @@ void LLConversationViewParticipant::initFromParams(const LLConversationViewParti applyXUILayout(avatar_icon_params, this); LLAvatarIconCtrl * avatarIcon = LLUICtrlFactory::create(avatar_icon_params); addChild(avatarIcon); - + LLButton::Params info_button_params(params.info_button()); applyXUILayout(info_button_params, this); LLButton * button = LLUICtrlFactory::create(info_button_params); @@ -381,16 +381,11 @@ void LLConversationViewParticipant::draw() const BOOL show_context = (getRoot() ? getRoot()->getShowSelectionContext() : FALSE); const BOOL filled = show_context || (getRoot() ? getRoot()->getParentPanel()->hasFocus() : FALSE); // If we have keyboard focus, draw selection filled - const LLFolderViewItem::Params& default_params = LLUICtrlFactory::getDefaultParams(); - const S32 TOP_PAD = default_params.item_top_pad; - const LLFontGL* font = getLabelFontForStyle(mLabelStyle); F32 right_x = 0; - //TEXT_PAD, TOP_PAD, ICON_PAD and mIndentation are temporary values and will non-const eventually since they don't - //apply to every single layout - F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD; - F32 text_left = (F32)(mAvatarIcon->getRect().mRight + ICON_PAD + mIndentation); + F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad; + F32 text_left = (F32)getLabelXPos(); LLColor4 color = (mIsSelected && filled) ? sHighlightFgColor : sFgColor; drawHighlight(show_context, filled, sHighlightBgColor, sFocusOutlineColor, sMouseOverColor); @@ -448,6 +443,11 @@ void LLConversationViewParticipant::onMouseLeave(S32 x, S32 y, MASK mask) LLFolderViewItem::onMouseEnter(x, y, mask); } +S32 LLConversationViewParticipant::getLabelXPos() +{ + return mAvatarIcon->getRect().mRight + mIconPad; +} + // static void LLConversationViewParticipant::initChildrenWidths(LLConversationViewParticipant* self) { @@ -465,7 +465,7 @@ void LLConversationViewParticipant::initChildrenWidths(LLConversationViewPartici void LLConversationViewParticipant::computeLabelRightPadding() { - mLabelPaddingRight = DEFAULT_TEXT_PADDING_RIGHT; + mLabelPaddingRight = DEFAULT_LABEL_PADDING_RIGHT; LLView* control; S32 ctrl_width; diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index 075ad09d5b..5bc4678b7b 100755 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -101,6 +101,8 @@ public: void onMouseEnter(S32 x, S32 y, MASK mask); void onMouseLeave(S32 x, S32 y, MASK mask); + /*virtual*/ S32 getLabelXPos(); + protected: friend class LLUICtrlFactory; LLConversationViewParticipant( const Params& p ); diff --git a/indra/newview/skins/default/xui/en/panel_outbox_inventory.xml b/indra/newview/skins/default/xui/en/panel_outbox_inventory.xml index 203febbf18..c80e5b168a 100644 --- a/indra/newview/skins/default/xui/en/panel_outbox_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_outbox_inventory.xml @@ -20,6 +20,13 @@ folder_indentation="8" item_height="20" item_top_pad="4" - selection_image="Rounded_Square"/> + selection_image="Rounded_Square" + left_pad="5" + icon_pad="2" + icon_width="16" + text_pad="1" + text_pad_right="4" + arrow_size="12" + max_folder_item_overlap="2"/> 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 index 7ddcfe3b03..a28d6e0209 100755 --- a/indra/newview/skins/default/xui/en/widgets/conversation_view_participant.xml +++ b/indra/newview/skins/default/xui/en/widgets/conversation_view_participant.xml @@ -1,12 +1,19 @@ + follows="left|top|right" + left_pad="5" + icon_pad="2" + icon_width="16" + text_pad="1" + text_pad_right="4" + arrow_size="12" + max_folder_item_overlap="2"/> diff --git a/indra/newview/skins/default/xui/en/widgets/folder_view_item.xml b/indra/newview/skins/default/xui/en/widgets/folder_view_item.xml index 6fa74f403d..bbd53ccb12 100644 --- a/indra/newview/skins/default/xui/en/widgets/folder_view_item.xml +++ b/indra/newview/skins/default/xui/en/widgets/folder_view_item.xml @@ -7,4 +7,10 @@ selection_image="Rounded_Square" mouse_opaque="true" follows="left|top|right" - /> + left_pad="5" + icon_pad="2" + icon_width="16" + text_pad="1" + text_pad_right="4" + arrow_size="12" + max_folder_item_overlap="2"/> diff --git a/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_folder.xml b/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_folder.xml index 77d8024cb2..590a4730a9 100644 --- a/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_folder.xml +++ b/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_folder.xml @@ -5,7 +5,13 @@ item_height="20" item_top_pad="4" selection_image="Rounded_Square" - > + left_pad="5" + icon_pad="2" + icon_width="16" + text_pad="1" + text_pad_right="4" + arrow_size="12" + max_folder_item_overlap="2"> Date: Fri, 21 Sep 2012 17:52:03 +0300 Subject: CHUI-289 ADD. FIX (Newly added conversation is not selected in conversation list): Select item which was added from avatar picker --- indra/newview/llimconversation.cpp | 1 + indra/newview/llimfloatercontainer.cpp | 4 +++- indra/newview/llimfloatercontainer.h | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index a2efe63546..d5bce5a43f 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -54,6 +54,7 @@ LLIMConversation::LLIMConversation(const LLUUID& session_id) , mInputEditor(NULL) , mInputEditorTopPad(0) , mRefreshTimer(new LLTimer()) + , mHaveFocus(false) { mSession = LLIMModel::getInstance()->findIMSession(mSessionID); diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 4e0fba9502..de1fd58661 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -700,7 +700,7 @@ void LLIMFloaterContainer::repositioningWidgets() } } -void LLIMFloaterContainer::setConvItemSelect(LLUUID& session_id) +void LLIMFloaterContainer::setConvItemSelect(const LLUUID& session_id) { LLFolderViewItem* widget = mConversationsWidgets[session_id]; if (widget && mSelectedSession != session_id) @@ -763,6 +763,8 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) participant_view->addToFolder(widget); current_participant_model++; } + + setConvItemSelect(uuid); return; } diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 1f526091bb..077ecd192b 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -62,7 +62,7 @@ public: /*virtual*/ void addFloater(LLFloater* floaterp, BOOL select_added_floater, LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); - void setConvItemSelect(LLUUID& session_id); + void setConvItemSelect(const LLUUID& session_id); /*virtual*/ void tabClose(); static LLFloater* getCurrentVoiceFloater(); -- cgit v1.2.3 From 8b63f7f50367f5726d03fb784f5a2f0783470b9c Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 21 Sep 2012 19:42:11 +0300 Subject: CHUI-289 ADDITIONAL FIX (Newly added conversation is not selected in conversation list): gave more meaningful names to variables --- indra/newview/llimconversation.cpp | 10 +++++----- indra/newview/llimconversation.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index d5bce5a43f..ca8493f787 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -54,7 +54,7 @@ LLIMConversation::LLIMConversation(const LLUUID& session_id) , mInputEditor(NULL) , mInputEditorTopPad(0) , mRefreshTimer(new LLTimer()) - , mHaveFocus(false) + , mHasFocus(false) { mSession = LLIMModel::getInstance()->findIMSession(mSessionID); @@ -217,10 +217,10 @@ void LLIMConversation::onFocusReceived() LLTransientDockableFloater::onFocusReceived(); - mHasFocus = mHaveFocus; - mHaveFocus = true; + mHadFocus = mHasFocus; + mHasFocus = true; - if (! mHasFocus) + if (! mHadFocus) { LLIMFloaterContainer* container = LLIMFloaterContainer::getInstance(); container->setConvItemSelect(mSessionID); @@ -230,7 +230,7 @@ void LLIMConversation::onFocusReceived() void LLIMConversation::onFocusLost() { setBackgroundOpaque(false); - mHaveFocus = false; + mHasFocus = false; LLTransientDockableFloater::onFocusLost(); } diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h index e09ba79a6a..bad5eaa99f 100644 --- a/indra/newview/llimconversation.h +++ b/indra/newview/llimconversation.h @@ -140,8 +140,8 @@ private: LLTimer* mRefreshTimer; ///< Defines the rate at which refresh() is called. + bool mHadFocus; bool mHasFocus; - bool mHaveFocus; }; -- cgit v1.2.3 From 6dd2bf36c52fa00732ed5a3910539f38c91ff173 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 21 Sep 2012 15:27:46 -0700 Subject: CHUI-283: Now the speaker/info icon positions are set based upon visibility.' --- indra/newview/llconversationview.cpp | 23 ++++++++++++++++++---- indra/newview/llconversationview.h | 2 +- .../en/widgets/conversation_view_participant.xml | 2 ++ 3 files changed, 22 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 6860415377..26d618e1b3 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -366,7 +366,7 @@ BOOL LLConversationViewParticipant::postBuild() sStaticInitialized = true; } - computeLabelRightPadding(); + updateChildren(); return LLFolderViewItem::postBuild(); } @@ -432,14 +432,14 @@ void LLConversationViewParticipant::onInfoBtnClick() void LLConversationViewParticipant::onMouseEnter(S32 x, S32 y, MASK mask) { mInfoBtn->setVisible(true); - computeLabelRightPadding(); + updateChildren(); LLFolderViewItem::onMouseEnter(x, y, mask); } void LLConversationViewParticipant::onMouseLeave(S32 x, S32 y, MASK mask) { mInfoBtn->setVisible(false); - computeLabelRightPadding(); + updateChildren(); LLFolderViewItem::onMouseEnter(x, y, mask); } @@ -463,12 +463,14 @@ void LLConversationViewParticipant::initChildrenWidths(LLConversationViewPartici llassert(index == 0); } -void LLConversationViewParticipant::computeLabelRightPadding() +void LLConversationViewParticipant::updateChildren() { mLabelPaddingRight = DEFAULT_LABEL_PADDING_RIGHT; LLView* control; S32 ctrl_width; + LLRect controlRect; + //Cycles through controls starting from right to left for (S32 i = 0; i < ALIC_COUNT; ++i) { control = getItemChildView((EAvatarListItemChildIndex)i); @@ -476,9 +478,22 @@ void LLConversationViewParticipant::computeLabelRightPadding() // skip invisible views if (!control->getVisible()) continue; + //Get current pos/dimensions + controlRect = control->getRect(); + ctrl_width = sChildrenWidths[i]; // including space between current & left controls // accumulate the amount of space taken by the controls mLabelPaddingRight += ctrl_width; + + //Reposition visible controls in case adjacent controls to the right are hidden. + controlRect.setLeftTopAndSize( + getLocalRect().getWidth() - mLabelPaddingRight, + controlRect.mTop, + controlRect.getWidth(), + controlRect.getHeight()); + + //Sets the new position + control->setShape(controlRect); } } diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index 5bc4678b7b..0b98c34c73 100755 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -127,7 +127,7 @@ private: static bool sStaticInitialized; // this variable is introduced to improve code readability static S32 sChildrenWidths[ALIC_COUNT]; static void initChildrenWidths(LLConversationViewParticipant* self); - void computeLabelRightPadding(); + void updateChildren(); LLView* getItemChildView(EAvatarListItemChildIndex child_view_index); }; 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 index a28d6e0209..0024decd4c 100755 --- a/indra/newview/skins/default/xui/en/widgets/conversation_view_participant.xml +++ b/indra/newview/skins/default/xui/en/widgets/conversation_view_participant.xml @@ -19,7 +19,9 @@ follows="left" height="20" default_icon_name="Generic_Person" + layout="topleft" left="50" + top="2" width="20" /> Date: Fri, 21 Sep 2012 16:26:44 -0700 Subject: CHUI-283: Now the mouse over highlight only shows up when hovering over a participant. Before there was a bug where the onMouseLeave() function was not being called. This prevented the mouse-over-highlight from turning off. --- indra/newview/llconversationview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 26d618e1b3..394a830e5e 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -440,7 +440,7 @@ void LLConversationViewParticipant::onMouseLeave(S32 x, S32 y, MASK mask) { mInfoBtn->setVisible(false); updateChildren(); - LLFolderViewItem::onMouseEnter(x, y, mask); + LLFolderViewItem::onMouseLeave(x, y, mask); } S32 LLConversationViewParticipant::getLabelXPos() -- cgit v1.2.3