summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2013-01-08 21:46:36 -0800
committerMerov Linden <merov@lindenlab.com>2013-01-08 21:46:36 -0800
commitc296a7eadab5a5d0e4406b0e4c1aa6d532bad9f2 (patch)
tree1738716169c230f0b3be7e05897e1ac4e9e4bb84 /indra/newview
parent4ef1181cdcb03a08fbce8d774cd85ef914bef8f3 (diff)
parentb5172de28fd6bb8a833cf93180d2d43dd9d4a073 (diff)
Merge pull from richard/viewer-chui
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lldonotdisturbnotificationstorage.cpp2
-rw-r--r--indra/newview/llfloaterimcontainer.cpp80
-rw-r--r--indra/newview/llfloaterimcontainer.h2
-rw-r--r--indra/newview/lltoastnotifypanel.cpp300
-rw-r--r--indra/newview/skins/default/xui/en/floater_im_container.xml3
5 files changed, 202 insertions, 185 deletions
diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp
index 9bb2f27a46..ac41a3804f 100644
--- a/indra/newview/lldonotdisturbnotificationstorage.cpp
+++ b/indra/newview/lldonotdisturbnotificationstorage.cpp
@@ -77,7 +77,7 @@ void LLDoNotDisturbNotificationStorage::saveNotifications()
if (!notificationPtr->isRespondedTo() && !notificationPtr->isCancelled() && !notificationPtr->isExpired())
{
- data.append(notificationPtr->asLLSD());
+ data.append(notificationPtr->asLLSD(true));
}
}
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index ae243d6495..82563b8736 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -56,8 +56,8 @@
//
// LLFloaterIMContainer
//
-LLFloaterIMContainer::LLFloaterIMContainer(const LLSD& seed)
-: LLMultiFloater(seed),
+LLFloaterIMContainer::LLFloaterIMContainer(const LLSD& seed, const Params& params /*= getDefaultParams()*/)
+: LLMultiFloater(seed, params),
mExpandCollapseBtn(NULL),
mConversationsRoot(NULL),
mConversationsEventStream("ConversationsEvents"),
@@ -153,6 +153,9 @@ void LLFloaterIMContainer::onCurrentChannelChanged(const LLUUID& session_id)
BOOL LLFloaterIMContainer::postBuild()
{
+ mOrigMinWidth = getMinWidth();
+ mOrigMinHeight = getMinHeight();
+
mNewMessageConnection = LLIMModel::instance().mNewMsgSignal.connect(boost::bind(&LLFloaterIMContainer::onNewMessageReceived, this, _1));
// Do not call base postBuild to not connect to mCloseSignal to not close all floaters via Close button
// mTabContainer will be initialized in LLMultiFloater::addChild()
@@ -618,34 +621,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 +660,13 @@ void LLFloaterIMContainer::collapseConversationsPane(bool collapse)
button_panel->setVisible(!collapse);
mExpandCollapseBtn->setImageOverlay(getString(collapse ? "expand_icon" : "collapse_icon"));
+ // Save current width of Conversation panel 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 +674,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 +692,7 @@ void LLFloaterIMContainer::collapseConversationsPane(bool collapse)
widget->setOpen(false);
}
widget->requestArrange();
-}
+ }
}
}
@@ -705,29 +712,30 @@ 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();
+
+ // With two panels visible number of borders is three, because the borders
+ // between the panels are merged into one
+ 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()
@@ -1116,16 +1124,23 @@ bool LLFloaterIMContainer::enableContextMenuItem(const LLSD& userdata)
//Enable Chat history item for ad-hoc and group conversations
if ("can_chat_history" == item)
{
- if (getCurSelectedViewModelItem()->getType() != LLConversationItem::CONV_PARTICIPANT)
+ if(getCurSelectedViewModelItem())
{
- return isConversationLoggingAllowed();
+ if (getCurSelectedViewModelItem()->getType() != LLConversationItem::CONV_PARTICIPANT)
+ {
+ return isConversationLoggingAllowed();
+ }
}
}
// If nothing is selected(and selected item is not group chat), everything needs to be disabled
if (uuids.size() <= 0)
{
- return getCurSelectedViewModelItem()->getType() == LLConversationItem::CONV_SESSION_GROUP;
+ if(getCurSelectedViewModelItem())
+ {
+ return getCurSelectedViewModelItem()->getType() == LLConversationItem::CONV_SESSION_GROUP;
+ }
+ return false;
}
if("can_activate_group" == item)
@@ -1403,6 +1418,7 @@ LLConversationItem* LLFloaterIMContainer::addConversationListItem(const LLUUID&
current_participant_model++;
}
}
+
// Do that too for the conversation dialog
LLFloaterIMSessionTab *conversation_floater = (uuid.isNull() ? (LLFloaterIMSessionTab*)(LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")) : (LLFloaterIMSessionTab*)(LLFloaterIMSession::findInstance(uuid)));
if (conversation_floater)
diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h
index 0cd1b6759b..85d950c58b 100644
--- a/indra/newview/llfloaterimcontainer.h
+++ b/indra/newview/llfloaterimcontainer.h
@@ -53,7 +53,7 @@ class LLFloaterIMContainer
, public LLIMSessionObserver
{
public:
- LLFloaterIMContainer(const LLSD& seed);
+ LLFloaterIMContainer(const LLSD& seed, const Params& params = getDefaultParams());
virtual ~LLFloaterIMContainer();
/*virtual*/ BOOL postBuild();
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index 844d7314d9..d494d12903 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -343,156 +343,156 @@ void LLToastNotifyPanel::onClickButton(void* data)
void LLToastNotifyPanel::init( LLRect rect, bool show_images )
{
- deleteAllChildren();
-
- mTextBox = NULL;
- mInfoPanel = NULL;
- mControlPanel = NULL;
- mNumOptions = 0;
- mNumButtons = 0;
- mAddedDefaultBtn = false;
-
- buildFromFile( "panel_notification.xml");
- if(rect != LLRect::null)
- {
- this->setShape(rect);
- }
- mInfoPanel = getChild<LLPanel>("info_panel");
- mInfoPanel->setFollowsAll();
-
- mControlPanel = getChild<LLPanel>("control_panel");
- BUTTON_WIDTH = gSavedSettings.getS32("ToastButtonWidth");
- // customize panel's attributes
- // is it intended for displaying a tip?
- mIsTip = mNotification->getType() == "notifytip";
- // is it a script dialog?
- mIsScriptDialog = (mNotification->getName() == "ScriptDialog" || mNotification->getName() == "ScriptDialogGroup");
- // is it a caution?
- //
- // caution flag can be set explicitly by specifying it in the notification payload, or it can be set implicitly if the
- // notify xml template specifies that it is a caution
- // tip-style notification handle 'caution' differently -they display the tip in a different color
- mIsCaution = mNotification->getPriority() >= NOTIFICATION_PRIORITY_HIGH;
-
- // setup parameters
- // get a notification message
- mMessage = mNotification->getMessage();
- // init font variables
- if (!sFont)
-{
- sFont = LLFontGL::getFontSansSerif();
- sFontSmall = LLFontGL::getFontSansSerifSmall();
-}
- // initialize
- setFocusRoot(!mIsTip);
- // get a form for the notification
- LLNotificationFormPtr form(mNotification->getForm());
- // get number of elements
- mNumOptions = form->getNumElements();
-
- // customize panel's outfit
- // preliminary adjust panel's layout
- //move to the end
- //mIsTip ? adjustPanelForTipNotice() : adjustPanelForScriptNotice(form);
-
- // adjust text options according to the notification type
- // add a caution textbox at the top of a caution notification
- if (mIsCaution && !mIsTip)
- {
- mTextBox = getChild<LLTextBox>("caution_text_box");
- }
- else
- {
- mTextBox = getChild<LLTextEditor>("text_editor_box");
- }
-
- mTextBox->setMaxTextLength(MAX_LENGTH);
- mTextBox->setVisible(TRUE);
- mTextBox->setPlainText(!show_images);
- mTextBox->setValue(mNotification->getMessage());
-
- // add buttons for a script notification
- if (mIsTip)
- {
- adjustPanelForTipNotice();
- }
- else
-{
- std::vector<index_button_pair_t> buttons;
- buttons.reserve(mNumOptions);
- S32 buttons_width = 0;
- // create all buttons and accumulate they total width to reshape mControlPanel
- for (S32 i = 0; i < mNumOptions; i++)
- {
- LLSD form_element = form->getElement(i);
- if (form_element["type"].asString() != "button")
- {
- // not a button.
- continue;
- }
- if (form_element["name"].asString() == TEXTBOX_MAGIC_TOKEN)
- {
- // a textbox pretending to be a button.
- continue;
- }
- LLButton* new_button = createButton(form_element, TRUE);
- buttons_width += new_button->getRect().getWidth();
- S32 index = form_element["index"].asInteger();
- buttons.push_back(index_button_pair_t(index,new_button));
-}
- if (buttons.empty())
-{
- addDefaultButton();
- }
- else
- {
- const S32 button_panel_width = mControlPanel->getRect().getWidth();// do not change width of the panel
- S32 button_panel_height = mControlPanel->getRect().getHeight();
- //try get an average h_pad to spread out buttons
- S32 h_pad = (button_panel_width - buttons_width) / (S32(buttons.size()));
- if(h_pad < 2*HPAD)
- {
- /*
- * Probably it is a scriptdialog toast
- * for a scriptdialog toast h_pad can be < 2*HPAD if we have a lot of buttons.
- * In last case set default h_pad to avoid heaping of buttons
- */
- S32 button_per_row = button_panel_width / BUTTON_WIDTH;
- h_pad = (button_panel_width % BUTTON_WIDTH) / (button_per_row - 1);// -1 because we do not need space after last button in a row
- if(h_pad < 2*HPAD) // still not enough space between buttons ?
- {
- h_pad = 2*HPAD;
- }
-}
- if (mIsScriptDialog)
-{
- // we are using default width for script buttons so we can determinate button_rows
- //to get a number of rows we divide the required width of the buttons to button_panel_width
- S32 button_rows = llceil(F32(buttons.size() - 1) * (BUTTON_WIDTH + h_pad) / button_panel_width);
- //S32 button_rows = (buttons.size() - 1) * (BUTTON_WIDTH + h_pad) / button_panel_width;
- //reserve one row for the ignore_btn
- button_rows++;
- //calculate required panel height for scripdialog notification.
- button_panel_height = button_rows * (BTN_HEIGHT + VPAD) + IGNORE_BTN_TOP_DELTA + BOTTOM_PAD;
- }
- else
- {
- // in common case buttons can have different widths so we need to calculate button_rows according to buttons_width
- //S32 button_rows = llceil(F32(buttons.size()) * (buttons_width + h_pad) / button_panel_width);
- S32 button_rows = llceil(F32((buttons.size() - 1) * h_pad + buttons_width) / button_panel_width);
- //calculate required panel height
- button_panel_height = button_rows * (BTN_HEIGHT + VPAD) + BOTTOM_PAD;
-}
-
- // we need to keep min width and max height to make visible all buttons, because width of the toast can not be changed
- adjustPanelForScriptNotice(button_panel_width, button_panel_height);
- updateButtonsLayout(buttons, h_pad);
- // save buttons for later use in disableButtons()
- //mButtons.assign(buttons.begin(), buttons.end());
- }
- }
- // adjust panel's height to the text size
- snapToMessageHeight(mTextBox, MAX_LENGTH);
+ deleteAllChildren();
+
+ mTextBox = NULL;
+ mInfoPanel = NULL;
+ mControlPanel = NULL;
+ mNumOptions = 0;
+ mNumButtons = 0;
+ mAddedDefaultBtn = false;
+
+ buildFromFile( "panel_notification.xml");
+ if(rect != LLRect::null)
+ {
+ this->setShape(rect);
+ }
+ mInfoPanel = getChild<LLPanel>("info_panel");
+ mInfoPanel->setFollowsAll();
+
+ mControlPanel = getChild<LLPanel>("control_panel");
+ BUTTON_WIDTH = gSavedSettings.getS32("ToastButtonWidth");
+ // customize panel's attributes
+ // is it intended for displaying a tip?
+ mIsTip = mNotification->getType() == "notifytip";
+ // is it a script dialog?
+ mIsScriptDialog = (mNotification->getName() == "ScriptDialog" || mNotification->getName() == "ScriptDialogGroup");
+ // is it a caution?
+ //
+ // caution flag can be set explicitly by specifying it in the notification payload, or it can be set implicitly if the
+ // notify xml template specifies that it is a caution
+ // tip-style notification handle 'caution' differently -they display the tip in a different color
+ mIsCaution = mNotification->getPriority() >= NOTIFICATION_PRIORITY_HIGH;
+
+ // setup parameters
+ // get a notification message
+ mMessage = mNotification->getMessage();
+ // init font variables
+ if (!sFont)
+ {
+ sFont = LLFontGL::getFontSansSerif();
+ sFontSmall = LLFontGL::getFontSansSerifSmall();
+ }
+ // initialize
+ setFocusRoot(!mIsTip);
+ // get a form for the notification
+ LLNotificationFormPtr form(mNotification->getForm());
+ // get number of elements
+ mNumOptions = form->getNumElements();
+
+ // customize panel's outfit
+ // preliminary adjust panel's layout
+ //move to the end
+ //mIsTip ? adjustPanelForTipNotice() : adjustPanelForScriptNotice(form);
+
+ // adjust text options according to the notification type
+ // add a caution textbox at the top of a caution notification
+ if (mIsCaution && !mIsTip)
+ {
+ mTextBox = getChild<LLTextBox>("caution_text_box");
+ }
+ else
+ {
+ mTextBox = getChild<LLTextEditor>("text_editor_box");
+ }
+
+ mTextBox->setMaxTextLength(MAX_LENGTH);
+ mTextBox->setVisible(TRUE);
+ mTextBox->setPlainText(!show_images);
+ mTextBox->setValue(mNotification->getMessage());
+
+ // add buttons for a script notification
+ if (mIsTip)
+ {
+ adjustPanelForTipNotice();
+ }
+ else
+ {
+ std::vector<index_button_pair_t> buttons;
+ buttons.reserve(mNumOptions);
+ S32 buttons_width = 0;
+ // create all buttons and accumulate they total width to reshape mControlPanel
+ for (S32 i = 0; i < mNumOptions; i++)
+ {
+ LLSD form_element = form->getElement(i);
+ if (form_element["type"].asString() != "button")
+ {
+ // not a button.
+ continue;
+ }
+ if (form_element["name"].asString() == TEXTBOX_MAGIC_TOKEN)
+ {
+ // a textbox pretending to be a button.
+ continue;
+ }
+ LLButton* new_button = createButton(form_element, TRUE);
+ buttons_width += new_button->getRect().getWidth();
+ S32 index = form_element["index"].asInteger();
+ buttons.push_back(index_button_pair_t(index,new_button));
+ }
+ if (buttons.empty())
+ {
+ addDefaultButton();
+ }
+ else
+ {
+ const S32 button_panel_width = mControlPanel->getRect().getWidth();// do not change width of the panel
+ S32 button_panel_height = mControlPanel->getRect().getHeight();
+ //try get an average h_pad to spread out buttons
+ S32 h_pad = (button_panel_width - buttons_width) / (S32(buttons.size()));
+ if(h_pad < 2*HPAD)
+ {
+ /*
+ * Probably it is a scriptdialog toast
+ * for a scriptdialog toast h_pad can be < 2*HPAD if we have a lot of buttons.
+ * In last case set default h_pad to avoid heaping of buttons
+ */
+ S32 button_per_row = button_panel_width / BUTTON_WIDTH;
+ h_pad = (button_panel_width % BUTTON_WIDTH) / (button_per_row - 1);// -1 because we do not need space after last button in a row
+ if(h_pad < 2*HPAD) // still not enough space between buttons ?
+ {
+ h_pad = 2*HPAD;
+ }
+ }
+ if (mIsScriptDialog)
+ {
+ // we are using default width for script buttons so we can determinate button_rows
+ //to get a number of rows we divide the required width of the buttons to button_panel_width
+ S32 button_rows = llceil(F32(buttons.size() - 1) * (BUTTON_WIDTH + h_pad) / button_panel_width);
+ //S32 button_rows = (buttons.size() - 1) * (BUTTON_WIDTH + h_pad) / button_panel_width;
+ //reserve one row for the ignore_btn
+ button_rows++;
+ //calculate required panel height for scripdialog notification.
+ button_panel_height = button_rows * (BTN_HEIGHT + VPAD) + IGNORE_BTN_TOP_DELTA + BOTTOM_PAD;
+ }
+ else
+ {
+ // in common case buttons can have different widths so we need to calculate button_rows according to buttons_width
+ //S32 button_rows = llceil(F32(buttons.size()) * (buttons_width + h_pad) / button_panel_width);
+ S32 button_rows = llceil(F32((buttons.size() - 1) * h_pad + buttons_width) / button_panel_width);
+ //calculate required panel height
+ button_panel_height = button_rows * (BTN_HEIGHT + VPAD) + BOTTOM_PAD;
+ }
+
+ // we need to keep min width and max height to make visible all buttons, because width of the toast can not be changed
+ adjustPanelForScriptNotice(button_panel_width, button_panel_height);
+ updateButtonsLayout(buttons, h_pad);
+ // save buttons for later use in disableButtons()
+ //mButtons.assign(buttons.begin(), buttons.end());
+ }
+ }
+ // adjust panel's height to the text size
+ snapToMessageHeight(mTextBox, MAX_LENGTH);
}
diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml
index e7638fe669..951665552f 100644
--- a/indra/newview/skins/default/xui/en/floater_im_container.xml
+++ b/indra/newview/skins/default/xui/en/floater_im_container.xml
@@ -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"/>