diff options
Diffstat (limited to 'indra/newview/llsyswellwindow.cpp')
-rw-r--r-- | indra/newview/llsyswellwindow.cpp | 117 |
1 files changed, 19 insertions, 98 deletions
diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index cbb030836e..1a8c2b8fc0 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -56,14 +56,11 @@ LLSysWellWindow::LLSysWellWindow(const LLSD& key) : LLTransientDockableFloater(N mChannel(NULL), mMessageList(NULL), mSysWellChiclet(NULL), - mSeparator(NULL), NOTIFICATION_WELL_ANCHOR_NAME("notification_well_panel"), IM_WELL_ANCHOR_NAME("im_well_panel"), mIsReshapedByUser(false) { - mTypedItemsCount[IT_NOTIFICATION] = 0; - mTypedItemsCount[IT_INSTANT_MESSAGE] = 0; setOverlapsScreenChannel(true); } @@ -75,18 +72,6 @@ BOOL LLSysWellWindow::postBuild() // get a corresponding channel initChannel(); - LLPanel::Params params; - mSeparator = LLUICtrlFactory::create<LLPanel>(params); - LLUICtrlFactory::instance().buildPanel(mSeparator, "panel_separator.xml"); - - LLRect rc = mSeparator->getRect(); - rc.setOriginAndSize(0, 0, mMessageList->getItemsRect().getWidth(), rc.getHeight()); - mSeparator->setRect(rc); - mSeparator->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_TOP); - mSeparator->setVisible(FALSE); - - mMessageList->addItem(mSeparator); - // click on SysWell Window should clear "new message" state (and 'Lit' status). EXT-3147. // mouse up callback is not called in this case. setMouseDownCallback(boost::bind(&LLSysWellWindow::releaseNewMessagesState, this)); @@ -130,7 +115,7 @@ void LLSysWellWindow::removeItemByID(const LLUUID& id) { if(mMessageList->removeItemByValue(id)) { - handleItemRemoved(IT_NOTIFICATION); + mSysWellChiclet->updateWidget(isWindowEmpty()); reshapeWindow(); } else @@ -258,76 +243,7 @@ void LLSysWellWindow::releaseNewMessagesState() //--------------------------------------------------------------------------------- bool LLSysWellWindow::isWindowEmpty() { - // keep in mind, mSeparator is always in the list - return mMessageList->size() == 1; -} - -// *TODO: mantipov: probably is deprecated -void LLSysWellWindow::handleItemAdded(EItemType added_item_type) -{ - bool should_be_shown = ++mTypedItemsCount[added_item_type] == 1 && anotherTypeExists(added_item_type); - - if (should_be_shown && !mSeparator->getVisible()) - { - mSeparator->setVisible(TRUE); - - // refresh list to recalculate mSeparator position - mMessageList->reshape(mMessageList->getRect().getWidth(), mMessageList->getRect().getHeight()); - } - - //fix for EXT-3254 - //set limits for min_height. - S32 parent_list_delta_height = getRect().getHeight() - mMessageList->getRect().getHeight(); - - std::vector<LLPanel*> items; - mMessageList->getItems(items); - - if(items.size()>1)//first item is separator - { - S32 min_height; - S32 min_width; - getResizeLimits(&min_width,&min_height); - - min_height = items[1]->getRect().getHeight() + 2 * mMessageList->getBorderWidth() + parent_list_delta_height; - - setResizeLimits(min_width,min_height); - } - mSysWellChiclet->updateWidget(isWindowEmpty()); -} - -void LLSysWellWindow::handleItemRemoved(EItemType removed_item_type) -{ - bool should_be_hidden = --mTypedItemsCount[removed_item_type] == 0; - - if (should_be_hidden && mSeparator->getVisible()) - { - mSeparator->setVisible(FALSE); - - // refresh list to recalculate mSeparator position - mMessageList->reshape(mMessageList->getRect().getWidth(), mMessageList->getRect().getHeight()); - } - mSysWellChiclet->updateWidget(isWindowEmpty()); -} - -bool LLSysWellWindow::anotherTypeExists(EItemType item_type) -{ - bool exists = false; - switch(item_type) - { - case IT_INSTANT_MESSAGE: - if (mTypedItemsCount[IT_NOTIFICATION] > 0) - { - exists = true; - } - break; - case IT_NOTIFICATION: - if (mTypedItemsCount[IT_INSTANT_MESSAGE] > 0) - { - exists = true; - } - break; - } - return exists; + return mMessageList->size() == 0; } /************************************************************************/ @@ -455,7 +371,7 @@ LLIMWellWindow::ObjectRowPanel::~ObjectRowPanel() //--------------------------------------------------------------------------------- void LLIMWellWindow::ObjectRowPanel::onClosePanel() { - LLScriptFloaterManager::getInstance()->onRemoveNotification(mChiclet->getSessionId()); + LLScriptFloaterManager::getInstance()->removeNotification(mChiclet->getSessionId()); } void LLIMWellWindow::ObjectRowPanel::initChiclet(const LLUUID& notification_id, bool new_message/* = false*/) @@ -559,8 +475,7 @@ void LLNotificationWellWindow::addItem(LLSysWellItem::Params p) LLSysWellItem* new_item = new LLSysWellItem(p); if (mMessageList->addItem(new_item, value, ADD_TOP)) { - handleItemAdded(IT_NOTIFICATION); - + mSysWellChiclet->updateWidget(isWindowEmpty()); reshapeWindow(); new_item->setOnItemCloseCallback(boost::bind(&LLNotificationWellWindow::onItemClose, this, _1)); @@ -667,8 +582,6 @@ LLIMWellWindow::LLIMWellWindow(const LLSD& key) : LLSysWellWindow(key) { LLIMMgr::getInstance()->addSessionObserver(this); - LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLIMWellWindow::findIMChiclet, this, _1)); - LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLIMWellWindow::findObjectChiclet, this, _1)); } LLIMWellWindow::~LLIMWellWindow() @@ -686,6 +599,10 @@ BOOL LLIMWellWindow::postBuild() { BOOL rv = LLSysWellWindow::postBuild(); setTitle(getString("title_im_well_window")); + + LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLIMWellWindow::findIMChiclet, this, _1)); + LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLIMWellWindow::findObjectChiclet, this, _1)); + return rv; } @@ -726,6 +643,8 @@ void LLIMWellWindow::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID LLChiclet* LLIMWellWindow::findObjectChiclet(const LLUUID& notification_id) { + if (!mMessageList) return NULL; + LLChiclet* res = NULL; ObjectRowPanel* panel = mMessageList->getTypedItemByValue<ObjectRowPanel>(notification_id); if (panel != NULL) @@ -740,6 +659,8 @@ LLChiclet* LLIMWellWindow::findObjectChiclet(const LLUUID& notification_id) // PRIVATE METHODS LLChiclet* LLIMWellWindow::findIMChiclet(const LLUUID& sessionId) { + if (!mMessageList) return NULL; + LLChiclet* res = NULL; RowPanel* panel = mMessageList->getTypedItemByValue<RowPanel>(sessionId); if (panel != NULL) @@ -755,9 +676,9 @@ void LLIMWellWindow::addIMRow(const LLUUID& sessionId, S32 chicletCounter, const std::string& name, const LLUUID& otherParticipantId) { RowPanel* item = new RowPanel(this, sessionId, chicletCounter, name, otherParticipantId); - if (mMessageList->insertItemAfter(mSeparator, item, sessionId)) + if (mMessageList->addItem(item, sessionId)) { - handleItemAdded(IT_INSTANT_MESSAGE); + mSysWellChiclet->updateWidget(isWindowEmpty()); } else { @@ -782,7 +703,7 @@ void LLIMWellWindow::delIMRow(const LLUUID& sessionId) if (mMessageList->removeItemByValue(sessionId)) { - handleItemRemoved(IT_INSTANT_MESSAGE); + mSysWellChiclet->updateWidget(isWindowEmpty()); } else { @@ -810,9 +731,9 @@ void LLIMWellWindow::addObjectRow(const LLUUID& notification_id, bool new_messag if (mMessageList->getItemByValue(notification_id) == NULL) { ObjectRowPanel* item = new ObjectRowPanel(notification_id, new_message); - if (mMessageList->insertItemAfter(mSeparator, item, notification_id)) + if (mMessageList->addItem(item, notification_id)) { - handleItemAdded(IT_INSTANT_MESSAGE); + mSysWellChiclet->updateWidget(isWindowEmpty()); } else { @@ -827,7 +748,7 @@ void LLIMWellWindow::removeObjectRow(const LLUUID& notification_id) { if (mMessageList->removeItemByValue(notification_id)) { - handleItemRemoved(IT_INSTANT_MESSAGE); + mSysWellChiclet->updateWidget(isWindowEmpty()); } else { @@ -911,7 +832,7 @@ void LLIMWellWindow::closeAllImpl() ObjectRowPanel* obj_panel = dynamic_cast <ObjectRowPanel*> (panel); if (obj_panel) { - LLScriptFloaterManager::instance().onRemoveNotification(*iter); + LLScriptFloaterManager::instance().removeNotification(*iter); } } } |