summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterimcontainer.cpp
diff options
context:
space:
mode:
authorAlexanderP ProductEngine <apaschenko@productengine.com>2013-01-05 00:09:36 +0200
committerAlexanderP ProductEngine <apaschenko@productengine.com>2013-01-05 00:09:36 +0200
commitb1ba208e7fcb8dbaa2c47b70fe580094982e36dd (patch)
treeda1956b106be8a2412044b6e5c048f7c1f5e16fe /indra/newview/llfloaterimcontainer.cpp
parent613b7a45a783f961a38d7135eb7eeafd572b13b9 (diff)
CHUI-643 W.I.P. Collapsed conversations floater has huge right padding: corrected of a imcontainer's resize calculating
Diffstat (limited to 'indra/newview/llfloaterimcontainer.cpp')
-rw-r--r--indra/newview/llfloaterimcontainer.cpp59
1 files changed, 32 insertions, 27 deletions
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index ae243d6495..69d6f1ca38 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -618,34 +618,34 @@ void LLFloaterIMContainer::collapseMessagesPane(bool collapse)
return;
}
+ // Save current width of panels before collapsing/expanding right pane.
+ S32 conv_pane_width = mConversationsPane->getRect().getWidth();
+ S32 msg_pane_width = mMessagesPane->getRect().getWidth();
+
if (collapse)
{
// Save the messages pane width before collapsing it.
- gSavedPerAccountSettings.setS32("ConversationsMessagePaneWidth", mMessagesPane->getRect().getWidth());
+ gSavedPerAccountSettings.setS32("ConversationsMessagePaneWidth", msg_pane_width);
// Save the order in which the panels are closed to reverse user's last action.
gSavedPerAccountSettings.setBOOL("ConversationsExpandMessagePaneFirst", mConversationsPane->isCollapsed());
}
- // Save left pane rectangle before collapsing/expanding right pane.
- LLRect prevRect = mConversationsPane->getRect();
-
// Show/hide the messages pane.
mConversationsStack->collapsePanel(mMessagesPane, collapse);
- if (!collapse)
- {
- // Make sure layout is updated before resizing conversation pane.
- mConversationsStack->updateLayout();
- }
+ // Make sure layout is updated before resizing conversation pane.
+ mConversationsStack->updateLayout();
updateState(collapse, gSavedPerAccountSettings.getS32("ConversationsMessagePaneWidth"));
+
if (!collapse)
{
// Restore conversation's pane previous width after expanding messages pane.
- mConversationsPane->setTargetDim(prevRect.getWidth());
+ mConversationsPane->setTargetDim(conv_pane_width);
}
}
+
void LLFloaterIMContainer::collapseConversationsPane(bool collapse)
{
if (mConversationsPane->isCollapsed() == collapse)
@@ -657,10 +657,13 @@ void LLFloaterIMContainer::collapseConversationsPane(bool collapse)
button_panel->setVisible(!collapse);
mExpandCollapseBtn->setImageOverlay(getString(collapse ? "expand_icon" : "collapse_icon"));
+ // Save current width of panels before collapsing/expanding right pane.
+ S32 conv_pane_width = mConversationsPane->getRect().getWidth();
+
if (collapse)
{
// Save the conversations pane width before collapsing it.
- gSavedPerAccountSettings.setS32("ConversationsListPaneWidth", mConversationsPane->getRect().getWidth());
+ gSavedPerAccountSettings.setS32("ConversationsListPaneWidth", conv_pane_width);
// Save the order in which the panels are closed to reverse user's last action.
gSavedPerAccountSettings.setBOOL("ConversationsExpandMessagePaneFirst", !mMessagesPane->isCollapsed());
@@ -668,8 +671,9 @@ void LLFloaterIMContainer::collapseConversationsPane(bool collapse)
mConversationsStack->collapsePanel(mConversationsPane, collapse);
- S32 collapsed_width = mConversationsPane->getMinDim();
- updateState(collapse, gSavedPerAccountSettings.getS32("ConversationsListPaneWidth") - collapsed_width);
+ S32 delta_width = gSavedPerAccountSettings.getS32("ConversationsListPaneWidth") - mConversationsPane->getMinDim();
+
+ updateState(collapse, delta_width);
for (conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin();
widget_it != mConversationsWidgets.end(); ++widget_it)
@@ -685,7 +689,7 @@ void LLFloaterIMContainer::collapseConversationsPane(bool collapse)
widget->setOpen(false);
}
widget->requestArrange();
-}
+ }
}
}
@@ -693,6 +697,8 @@ void LLFloaterIMContainer::updateState(bool collapse, S32 delta_width)
{
LLRect floater_rect = getRect();
floater_rect.mRight += ((collapse ? -1 : 1) * delta_width);
+S32 debug_var = floater_rect.getWidth();
+debug_var = debug_var + 1;
// Set by_user = true so that reshaped rect is saved in user_settings.
setShape(floater_rect, true);
@@ -705,29 +711,28 @@ void LLFloaterIMContainer::updateState(bool collapse, S32 delta_width)
setCanResize(is_left_pane_expanded || is_right_pane_expanded);
setCanMinimize(is_left_pane_expanded || is_right_pane_expanded);
+ assignResizeLimits();
+
// force set correct size for the title after show/hide minimize button
LLRect cur_rect = getRect();
LLRect force_rect = cur_rect;
force_rect.mRight = cur_rect.mRight + 1;
setRect(force_rect);
setRect(cur_rect);
-
- // restore floater's resize limits (prevent collapse when left panel is expanded)
- if (is_left_pane_expanded && !is_right_pane_expanded)
- {
- S32 expanded_min_size = mConversationsPane->getExpandedMinDim();
- setResizeLimits(expanded_min_size, expanded_min_size);
- }
-
- assignResizeLimits();
}
void LLFloaterIMContainer::assignResizeLimits()
{
- const LLRect& conv_rect = mConversationsPane->isCollapsed() ? LLRect() : mConversationsPane->getRect();
- S32 msg_limits = mMessagesPane->isCollapsed() ? 0 : mMessagesPane->getExpandedMinDim();
- S32 x_limits = conv_rect.getWidth() + msg_limits;
- setResizeLimits(x_limits + LLPANEL_BORDER_WIDTH * 3, getMinHeight());
+ bool is_conv_pane_expanded = !mConversationsPane->isCollapsed();
+ bool is_msg_pane_expanded = !mMessagesPane->isCollapsed();
+
+ S32 number_of_visible_borders = llmin((is_conv_pane_expanded? 2 : 0) + (is_msg_pane_expanded? 2 : 0), 3);
+ S32 summary_width_of_visible_borders = number_of_visible_borders * LLPANEL_BORDER_WIDTH;
+ S32 conv_pane_current_width = is_conv_pane_expanded? mConversationsPane->getRect().getWidth() : mConversationsPane->getMinDim();
+ S32 msg_pane_min_width = is_msg_pane_expanded ? mMessagesPane->getExpandedMinDim() : 0;
+ S32 new_min_width = conv_pane_current_width + msg_pane_min_width + summary_width_of_visible_borders;
+
+ setResizeLimits(new_min_width, getMinHeight());
}
void LLFloaterIMContainer::onAddButtonClicked()