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 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'indra/newview/llconversationview.cpp') 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; -- 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 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'indra/newview/llconversationview.cpp') 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); } } -- cgit v1.2.3 From 18f294715822bedaea3bafa9dfec1ee42c12353c Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales 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/llconversationview.cpp') 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