summaryrefslogtreecommitdiff
path: root/indra/newview/llsyswellwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llsyswellwindow.cpp')
-rw-r--r--indra/newview/llsyswellwindow.cpp174
1 files changed, 60 insertions, 114 deletions
diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp
index 26d8338b24..66373feb93 100644
--- a/indra/newview/llsyswellwindow.cpp
+++ b/indra/newview/llsyswellwindow.cpp
@@ -106,15 +106,15 @@ void LLSysWellWindow::onStartUpToastClick(S32 x, S32 y, MASK mask)
setVisible(TRUE);
}
-//---------------------------------------------------------------------------------
-LLSysWellWindow::~LLSysWellWindow()
-{
+void LLSysWellWindow::setSysWellChiclet(LLSysWellChiclet* chiclet)
+{
+ mSysWellChiclet = chiclet;
+ if(mSysWellChiclet)
+ mSysWellChiclet->updateWidget(isWindowEmpty());
}
-
//---------------------------------------------------------------------------------
-void LLSysWellWindow::clear()
+LLSysWellWindow::~LLSysWellWindow()
{
- mMessageList->clear();
}
//---------------------------------------------------------------------------------
@@ -211,22 +211,25 @@ void LLSysWellWindow::reshapeWindow()
// it includes height from floater top to list top and from floater bottom and list bottom
static S32 parent_list_delta_height = getRect().getHeight() - mMessageList->getRect().getHeight();
- S32 notif_list_height = mMessageList->getItemsRect().getHeight() + 2 * mMessageList->getBorderWidth();
+ if (isDocked()) // Don't reshape undocked Well window. See EXT-5715.
+ {
+ S32 notif_list_height = mMessageList->getItemsRect().getHeight() + 2 * mMessageList->getBorderWidth();
- LLRect curRect = getRect();
+ LLRect curRect = getRect();
- S32 new_window_height = notif_list_height + parent_list_delta_height;
+ S32 new_window_height = notif_list_height + parent_list_delta_height;
- if (new_window_height > MAX_WINDOW_HEIGHT)
- {
- new_window_height = MAX_WINDOW_HEIGHT;
- }
- S32 newY = curRect.mTop + new_window_height - curRect.getHeight();
- S32 newWidth = curRect.getWidth() < MIN_WINDOW_WIDTH ? MIN_WINDOW_WIDTH
+ if (new_window_height > MAX_WINDOW_HEIGHT)
+ {
+ new_window_height = MAX_WINDOW_HEIGHT;
+ }
+ S32 newY = curRect.mTop + new_window_height - curRect.getHeight();
+ S32 newWidth = curRect.getWidth() < MIN_WINDOW_WIDTH ? MIN_WINDOW_WIDTH
: curRect.getWidth();
- curRect.setLeftTopAndSize(curRect.mLeft, newY, newWidth, new_window_height);
- reshape(curRect.getWidth(), curRect.getHeight(), TRUE);
- setRect(curRect);
+ curRect.setLeftTopAndSize(curRect.mLeft, newY, newWidth, new_window_height);
+ reshape(curRect.getWidth(), curRect.getHeight(), TRUE);
+ setRect(curRect);
+ }
// update notification channel state
// update on a window reshape is important only when a window is visible and docked
@@ -281,6 +284,7 @@ void LLSysWellWindow::handleItemAdded(EItemType added_item_type)
setResizeLimits(min_width,min_height);
}
+ mSysWellChiclet->updateWidget(isWindowEmpty());
}
void LLSysWellWindow::handleItemRemoved(EItemType removed_item_type)
@@ -294,6 +298,7 @@ void LLSysWellWindow::handleItemRemoved(EItemType removed_item_type)
// refresh list to recalculate mSeparator position
mMessageList->reshape(mMessageList->getRect().getWidth(), mMessageList->getRect().getHeight());
}
+ mSysWellChiclet->updateWidget(isWindowEmpty());
}
bool LLSysWellWindow::anotherTypeExists(EItemType item_type)
@@ -347,7 +352,6 @@ LLIMWellWindow::RowPanel::RowPanel(const LLSysWellWindow* parent, const LLUUID&
}
// Initialize chiclet.
- mChiclet->setRect(LLRect(5, 28, 30, 3)); // *HACK: workaround for (EXT-3599)
mChiclet->setChicletSizeChangedCallback(boost::bind(&LLIMWellWindow::RowPanel::onChicletSizeChanged, this, mChiclet, _2));
mChiclet->enableCounterControl(true);
mChiclet->setCounter(chicletCounter);
@@ -403,25 +407,33 @@ BOOL LLIMWellWindow::RowPanel::handleMouseDown(S32 x, S32 y, MASK mask)
{
// Pass the mouse down event to the chiclet (EXT-596).
if (!mChiclet->pointInView(x, y) && !mCloseBtn->getRect().pointInRect(x, y)) // prevent double call of LLIMChiclet::onMouseDown()
+ {
mChiclet->onMouseDown();
+ return TRUE;
+ }
return LLPanel::handleMouseDown(x, y, mask);
}
+// virtual
+BOOL LLIMWellWindow::RowPanel::handleRightMouseDown(S32 x, S32 y, MASK mask)
+{
+ return mChiclet->handleRightMouseDown(x, y, mask);
+}
/************************************************************************/
/* ObjectRowPanel implementation */
/************************************************************************/
-LLIMWellWindow::ObjectRowPanel::ObjectRowPanel(const LLUUID& object_id, bool new_message/* = false*/)
+LLIMWellWindow::ObjectRowPanel::ObjectRowPanel(const LLUUID& notification_id, bool new_message/* = false*/)
: LLPanel()
, mChiclet(NULL)
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_active_object_row.xml", NULL);
- initChiclet(object_id);
+ initChiclet(notification_id);
LLTextBox* obj_name = getChild<LLTextBox>("object_name");
- obj_name->setValue(getObjectName(object_id));
+ obj_name->setValue(LLScriptFloaterManager::getObjectName(notification_id));
mCloseBtn = getChild<LLButton>("hide_btn");
mCloseBtn->setCommitCallback(boost::bind(&LLIMWellWindow::ObjectRowPanel::onClosePanel, this));
@@ -432,90 +444,18 @@ LLIMWellWindow::ObjectRowPanel::~ObjectRowPanel()
{
}
-std::string LLIMWellWindow::ObjectRowPanel::getObjectName(const LLUUID& object_id)
-{
- using namespace LLNotificationsUI;
- LLUUID notification_id = LLScriptFloaterManager::getInstance()->findNotificationId(object_id);
- LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id);
- if(!notification)
- {
- llwarns << "Invalid notification" << llendl;
- return LLStringUtil::null;
- }
-
- std::string text;
-
- switch(getObjectType(notification))
- {
- case OBJ_SCRIPT:
- text = notification->getSubstitutions()["TITLE"].asString();
- break;
- case OBJ_LOAD_URL:
- text = notification->getSubstitutions()["OBJECTNAME"].asString();
- break;
- case OBJ_GIVE_INVENTORY:
- text = notification->getSubstitutions()["NAME"].asString();
- break;
- default:
- text = getString("unknown_obj");
- break;
- }
-
- return text;
-}
-
//---------------------------------------------------------------------------------
void LLIMWellWindow::ObjectRowPanel::onClosePanel()
{
- LLScriptFloaterManager::getInstance()->removeNotificationByObjectId(mChiclet->getSessionId());
+ LLScriptFloaterManager::getInstance()->onRemoveNotification(mChiclet->getSessionId());
}
-//static
-LLIMWellWindow::ObjectRowPanel::object_type_map LLIMWellWindow::ObjectRowPanel::initObjectTypeMap()
-{
- object_type_map type_map;
- type_map["ScriptDialog"] = OBJ_SCRIPT;
- type_map["LoadWebPage"] = OBJ_LOAD_URL;
- type_map["ObjectGiveItem"] = OBJ_GIVE_INVENTORY;
- return type_map;
-}
-
-// static
-LLIMWellWindow::ObjectRowPanel::EObjectType LLIMWellWindow::ObjectRowPanel::getObjectType(const LLNotificationPtr& notification)
+void LLIMWellWindow::ObjectRowPanel::initChiclet(const LLUUID& notification_id, bool new_message/* = false*/)
{
- if(!notification)
- {
- llwarns << "Invalid notification" << llendl;
- return OBJ_UNKNOWN;
- }
-
- static object_type_map type_map = initObjectTypeMap();
- std::string name = notification->getName();
- object_type_map::const_iterator it = type_map.find(name);
- if(it != type_map.end())
- {
- return it->second;
- }
-
- llwarns << "Unknown object type" << llendl;
- return OBJ_UNKNOWN;
-}
-
-void LLIMWellWindow::ObjectRowPanel::initChiclet(const LLUUID& object_id, bool new_message/* = false*/)
-{
- using namespace LLNotificationsUI;
- LLUUID notification_id = LLScriptFloaterManager::getInstance()->findNotificationId(object_id);
- LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id);
- if(!notification)
- {
- llwarns << "Invalid notification" << llendl;
- return;
- }
-
// Choose which of the pre-created chiclets to use.
- switch(getObjectType(notification))
+ switch(LLScriptFloaterManager::getObjectType(notification_id))
{
- case OBJ_GIVE_INVENTORY:
+ case LLScriptFloaterManager::OBJ_GIVE_INVENTORY:
mChiclet = getChild<LLInvOfferChiclet>("inv_offer_chiclet");
break;
default:
@@ -524,8 +464,7 @@ void LLIMWellWindow::ObjectRowPanel::initChiclet(const LLUUID& object_id, bool n
}
mChiclet->setVisible(true);
- mChiclet->setSessionId(object_id);
-// mChiclet->setShowNewMessagesIcon(new_message);
+ mChiclet->setSessionId(notification_id);
}
//---------------------------------------------------------------------------------
@@ -546,11 +485,20 @@ BOOL LLIMWellWindow::ObjectRowPanel::handleMouseDown(S32 x, S32 y, MASK mask)
{
// Pass the mouse down event to the chiclet (EXT-596).
if (!mChiclet->pointInView(x, y) && !mCloseBtn->getRect().pointInRect(x, y)) // prevent double call of LLIMChiclet::onMouseDown()
+ {
mChiclet->onMouseDown();
+ return TRUE;
+ }
return LLPanel::handleMouseDown(x, y, mask);
}
+// virtual
+BOOL LLIMWellWindow::ObjectRowPanel::handleRightMouseDown(S32 x, S32 y, MASK mask)
+{
+ return mChiclet->handleRightMouseDown(x, y, mask);
+}
+
/************************************************************************/
/* LLNotificationWellWindow implementation */
/************************************************************************/
@@ -688,8 +636,7 @@ void LLNotificationWellWindow::connectListUpdaterToSignal(std::string notificati
void LLNotificationWellWindow::onItemClick(LLSysWellItem* item)
{
LLUUID id = item->getID();
- if(mChannel)
- mChannel->loadStoredToastByNotificationIDToChannel(id);
+ LLFloaterReg::showInstance("inspect_toast", id);
}
void LLNotificationWellWindow::onItemClose(LLSysWellItem* item)
@@ -769,10 +716,10 @@ void LLIMWellWindow::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID
}
}
-LLChiclet* LLIMWellWindow::findObjectChiclet(const LLUUID& object_id)
+LLChiclet* LLIMWellWindow::findObjectChiclet(const LLUUID& notification_id)
{
LLChiclet* res = NULL;
- ObjectRowPanel* panel = mMessageList->getTypedItemByValue<ObjectRowPanel>(object_id);
+ ObjectRowPanel* panel = mMessageList->getTypedItemByValue<ObjectRowPanel>(notification_id);
if (panel != NULL)
{
res = panel->mChiclet;
@@ -850,33 +797,33 @@ void LLIMWellWindow::delIMRow(const LLUUID& sessionId)
}
}
-void LLIMWellWindow::addObjectRow(const LLUUID& object_id, bool new_message/* = false*/)
+void LLIMWellWindow::addObjectRow(const LLUUID& notification_id, bool new_message/* = false*/)
{
- if (mMessageList->getItemByValue(object_id) == NULL)
+ if (mMessageList->getItemByValue(notification_id) == NULL)
{
- ObjectRowPanel* item = new ObjectRowPanel(object_id, new_message);
- if (mMessageList->insertItemAfter(mSeparator, item, object_id))
+ ObjectRowPanel* item = new ObjectRowPanel(notification_id, new_message);
+ if (mMessageList->insertItemAfter(mSeparator, item, notification_id))
{
handleItemAdded(IT_INSTANT_MESSAGE);
}
else
{
- llwarns << "Unable to add Object Row into the list, objectID: " << object_id << llendl;
+ llwarns << "Unable to add Object Row into the list, notificationID: " << notification_id << llendl;
item->die();
}
reshapeWindow();
}
}
-void LLIMWellWindow::removeObjectRow(const LLUUID& object_id)
+void LLIMWellWindow::removeObjectRow(const LLUUID& notification_id)
{
- if (mMessageList->removeItemByValue(object_id))
+ if (mMessageList->removeItemByValue(notification_id))
{
handleItemRemoved(IT_INSTANT_MESSAGE);
}
else
{
- llwarns << "Unable to remove Object Row from the list, objectID: " << object_id << llendl;
+ llwarns << "Unable to remove Object Row from the list, notificationID: " << notification_id << llendl;
}
reshapeWindow();
@@ -956,8 +903,7 @@ void LLIMWellWindow::closeAllImpl()
ObjectRowPanel* obj_panel = dynamic_cast <ObjectRowPanel*> (panel);
if (obj_panel)
{
- LLScriptFloaterManager::instance()
- .removeNotificationByObjectId(*iter);
+ LLScriptFloaterManager::instance().onRemoveNotification(*iter);
}
}
}