summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-03-09 13:21:39 +0000
committerTofu Linden <tofu.linden@lindenlab.com>2010-03-09 13:21:39 +0000
commit6b3191a7bd9540364d76803f71079ab0f1db3545 (patch)
tree31bfa6fdd053d77a7eab5fdcc3bfdd047b47c3b9
parent7b029036339ae1770307ff33ccd5d540e2618748 (diff)
parentded6723781fa87954b4bba9bee98f9a50c6f9d82 (diff)
PE merge
-rw-r--r--indra/newview/llgrouplist.cpp2
-rw-r--r--indra/newview/llscriptfloater.cpp7
-rw-r--r--indra/newview/lltoastnotifypanel.cpp15
-rw-r--r--indra/newview/lltoastnotifypanel.h12
-rw-r--r--indra/newview/skins/default/xui/en/floater_script.xml6
5 files changed, 31 insertions, 11 deletions
diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp
index bcfb516b81..8a056f836f 100644
--- a/indra/newview/llgrouplist.cpp
+++ b/indra/newview/llgrouplist.cpp
@@ -127,7 +127,7 @@ BOOL LLGroupList::handleRightMouseDown(S32 x, S32 y, MASK mask)
BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask);
LLMenuGL* context_menu = (LLMenuGL*)mContextMenuHandle.get();
- if (context_menu)
+ if (context_menu && size() > 0)
{
context_menu->buildDrawLabels();
context_menu->updateParent(LLMenuGL::sMenuContainer);
diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp
index eb71cc52c8..f35cb3516a 100644
--- a/indra/newview/llscriptfloater.cpp
+++ b/indra/newview/llscriptfloater.cpp
@@ -154,14 +154,17 @@ void LLScriptFloater::createForm(const LLUUID& notification_id)
}
// create new form
- mScriptForm = new LLToastNotifyPanel(notification);
+ LLRect toast_rect = getRect();
+ // LLToastNotifyPanel will fit own content in vertical direction,
+ // but it needs an initial rect to properly calculate its width
+ // Use an initial rect of the script floater to make the floater window more configurable.
+ mScriptForm = new LLToastNotifyPanel(notification, toast_rect);
addChild(mScriptForm);
// position form on floater
mScriptForm->setOrigin(0, 0);
// make floater size fit form size
- LLRect toast_rect = getRect();
LLRect panel_rect = mScriptForm->getRect();
toast_rect.setLeftTopAndSize(toast_rect.mLeft, toast_rect.mTop, panel_rect.getWidth(), panel_rect.getHeight() + getHeaderHeight());
setShape(toast_rect);
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index c47c017143..e6d13a7613 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -53,7 +53,7 @@ S32 BUTTON_WIDTH = 90;
const LLFontGL* LLToastNotifyPanel::sFont = NULL;
const LLFontGL* LLToastNotifyPanel::sFontSmall = NULL;
-LLToastNotifyPanel::LLToastNotifyPanel(LLNotificationPtr& notification) :
+LLToastNotifyPanel::LLToastNotifyPanel(LLNotificationPtr& notification, const LLRect& rect) :
LLToastPanel(notification),
mTextBox(NULL),
mInfoPanel(NULL),
@@ -63,6 +63,10 @@ mNumButtons(0),
mAddedDefaultBtn(false)
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_notification.xml");
+ if(rect != LLRect::null)
+ {
+ this->setShape(rect);
+ }
mInfoPanel = getChild<LLPanel>("info_panel");
mControlPanel = getChild<LLPanel>("control_panel");
BUTTON_WIDTH = gSavedSettings.getS32("ToastButtonWidth");
@@ -159,7 +163,12 @@ mAddedDefaultBtn(false)
* 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
*/
- h_pad = 2*HPAD;
+ 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)
{
@@ -224,7 +233,7 @@ LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_opt
p.click_callback.function(boost::bind(&LLToastNotifyPanel::onClickButton, userdata));
p.rect.width = BUTTON_WIDTH;
p.auto_resize = false;
- p.follows.flags(FOLLOWS_RIGHT | FOLLOWS_LEFT | FOLLOWS_BOTTOM);
+ p.follows.flags(FOLLOWS_LEFT | FOLLOWS_BOTTOM);
if (mIsCaution)
{
p.image_color(LLUIColorTable::instance().getColor("ButtonCautionImageColor"));
diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h
index e791eea469..152975e7de 100644
--- a/indra/newview/lltoastnotifypanel.h
+++ b/indra/newview/lltoastnotifypanel.h
@@ -53,7 +53,15 @@ class LLNotificationForm;
class LLToastNotifyPanel: public LLToastPanel
{
public:
- LLToastNotifyPanel(LLNotificationPtr&);
+ /**
+ * Constructor for LLToastNotifyPanel.
+ *
+ * @param pNotification a shared pointer to LLNotification
+ * @param rect an initial rectangle of the toast panel.
+ * If it is null then a loaded from xml rectangle will be used.
+ * @see LLNotification
+ */
+ LLToastNotifyPanel(LLNotificationPtr& pNotification, const LLRect& rect = LLRect::null);
virtual ~LLToastNotifyPanel();
LLPanel * getControlPanel() { return mControlPanel; }
@@ -77,7 +85,7 @@ private:
/*
* It lays out buttons of the notification in mControlPanel.
* Buttons will be placed from BOTTOM to TOP.
- * @param h_pad horizontal space between buttons. It is depent on number of buttons.
+ * @param h_pad horizontal space between buttons. It is depend on number of buttons.
* @param buttons vector of button to be added.
*/
void updateButtonsLayout(const std::vector<index_button_pair_t>& buttons, S32 h_pad);
diff --git a/indra/newview/skins/default/xui/en/floater_script.xml b/indra/newview/skins/default/xui/en/floater_script.xml
index 663899d4b3..12ade86b5f 100644
--- a/indra/newview/skins/default/xui/en/floater_script.xml
+++ b/indra/newview/skins/default/xui/en/floater_script.xml
@@ -3,7 +3,7 @@
legacy_header_height="18"
background_visible="true"
follows="left|top|right|bottom"
- height="369"
+ height="250"
layout="topleft"
left="0"
name="script_floater"
@@ -11,8 +11,8 @@
can_dock="true"
can_minimize="true"
visible="false"
- width="520"
+ width="350"
can_resize="false"
min_width="350"
- min_height="369">
+ min_height="200">
</floater>