CHUI-643 W.I.P. Collapsed conversations floater has huge right padding: corrected of a imcontainer's resize calculating

meow-7.2.2
AlexanderP ProductEngine 2013-01-05 00:09:36 +02:00
parent 613b7a45a7
commit b1ba208e7f
2 changed files with 34 additions and 28 deletions

View File

@ -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()

View File

@ -14,7 +14,8 @@
title="CONVERSATIONS"
bottom="-50"
right="-5"
width="450">
width="450"
min_width="38">
<string
name="collapse_icon"
value="Conv_toolbar_collapse"/>