summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/llmultifloater.cpp10
-rw-r--r--indra/llui/llnotifications.cpp35
-rw-r--r--indra/llui/llnotifications.h3
-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
8 files changed, 239 insertions, 196 deletions
diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp
index 179b251cdb..59faabd482 100644
--- a/indra/llui/llmultifloater.cpp
+++ b/indra/llui/llmultifloater.cpp
@@ -37,12 +37,10 @@
//
LLMultiFloater::LLMultiFloater(const LLSD& key, const LLFloater::Params& params)
- : LLFloater(key),
- mTabContainer(NULL),
- mTabPos(LLTabContainer::TOP),
- mAutoResize(TRUE),
- mOrigMinWidth(params.min_width),
- mOrigMinHeight(params.min_height)
+ : LLFloater(key)
+ , mTabContainer(NULL)
+ , mTabPos(LLTabContainer::TOP)
+ , mAutoResize(TRUE)
{
}
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 386345177d..a5492b46f7 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -279,6 +279,18 @@ bool LLNotificationForm::hasElement(const std::string& element_name) const
return false;
}
+void LLNotificationForm::getElements(LLSD& elements, S32 offset)
+{
+ //Finds elements that the template did not add
+ LLSD::array_const_iterator it = mFormData.beginArray() + offset;
+
+ //Keeps track of only the dynamic elements
+ for(; it != mFormData.endArray(); ++it)
+ {
+ elements.append(*it);
+ }
+}
+
bool LLNotificationForm::getElementEnabled(const std::string& element_name) const
{
for (LLSD::array_const_iterator it = mFormData.beginArray();
@@ -503,21 +515,36 @@ LLNotification::LLNotification(const LLSDParamAdapter<Params>& p) :
}
-LLSD LLNotification::asLLSD()
+LLSD LLNotification::asLLSD(bool excludeTemplateElements)
{
LLParamSDParser parser;
Params p;
p.id = mId;
p.name = mTemplatep->mName;
- p.form_elements = getForm()->asLLSD();
-
p.substitutions = mSubstitutions;
p.payload = mPayload;
p.time_stamp = mTimestamp;
p.expiry = mExpiresAt;
p.priority = mPriority;
+ LLNotificationFormPtr templateForm = mTemplatep->mForm;
+ LLSD formElements = mForm->asLLSD();
+
+ //All form elements (dynamic or not)
+ if(!excludeTemplateElements)
+ {
+ p.form_elements = formElements;
+ }
+ //Only dynamic form elements (exclude template elements)
+ else if(templateForm->getNumElements() < formElements.size())
+ {
+ LLSD dynamicElements;
+ //Offset to dynamic elements and store them
+ mForm->getElements(dynamicElements, templateForm->getNumElements());
+ p.form_elements = dynamicElements;
+ }
+
if(mResponder)
{
p.functor.responder_sd = mResponder->asLLSD();
@@ -818,7 +845,7 @@ void LLNotification::init(const std::string& template_name, const LLSD& form_ele
//mSubstitutions["_ARGS"] = get_all_arguments_as_text(mSubstitutions);
mForm = LLNotificationFormPtr(new LLNotificationForm(*mTemplatep->mForm));
- mForm->append(form_elements);
+ mForm->append(form_elements);
// apply substitution to form labels
mForm->formatElements(mSubstitutions);
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index 092a9acd7c..236c2a42d1 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -242,6 +242,7 @@ public:
S32 getNumElements() { return mFormData.size(); }
LLSD getElement(S32 index) { return mFormData.get(index); }
LLSD getElement(const std::string& element_name);
+ void getElements(LLSD& elements, S32 offset = 0);
bool hasElement(const std::string& element_name) const;
bool getElementEnabled(const std::string& element_name) const;
void setElementEnabled(const std::string& element_name, bool enabled);
@@ -456,7 +457,7 @@ public:
// ["time"] = time at which notification was generated;
// ["expiry"] = time at which notification expires;
// ["responseFunctor"] = name of registered functor that handles responses to notification;
- LLSD asLLSD();
+ LLSD asLLSD(bool excludeTemplateElements = false);
const LLNotificationFormPtr getForm();
void updateForm(const LLNotificationFormPtr& form);
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"/>