diff options
Diffstat (limited to 'indra/newview/llscriptfloater.cpp')
-rwxr-xr-x[-rw-r--r--] | indra/newview/llscriptfloater.cpp | 152 |
1 files changed, 95 insertions, 57 deletions
diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index 170e23e4c5..1d021ec28f 100644..100755 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -28,9 +28,9 @@ #include "llscriptfloater.h" #include "llagentcamera.h" -#include "llbottomtray.h" #include "llchannelmanager.h" #include "llchiclet.h" +#include "llchicletbar.h" #include "llfloaterreg.h" #include "lllslconstants.h" #include "llnotifications.h" @@ -41,7 +41,7 @@ #include "lltoastscripttextbox.h" #include "lltrans.h" #include "llviewerwindow.h" -#include "llimfloater.h" +#include "llfloaterimsession.h" ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -95,7 +95,12 @@ bool LLScriptFloater::toggle(const LLUUID& notification_id) show(notification_id); } - LLBottomTray::getInstance()->getChicletPanel()->setChicletToggleState(notification_id, true); + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) + { + chiclet_panelp->setChicletToggleState(notification_id, true); + } + return true; } @@ -131,11 +136,6 @@ void LLScriptFloater::setNotificationId(const LLUUID& id) mObjectId = notification_id_to_object_id(id); } -void LLScriptFloater::getAllowedRect(LLRect& rect) -{ - rect = gViewerWindow->getWorldViewRectScaled(); -} - void LLScriptFloater::createForm(const LLUUID& notification_id) { // delete old form @@ -211,10 +211,14 @@ void LLScriptFloater::setVisible(BOOL visible) if(!visible) { - LLIMChiclet* chiclet = LLBottomTray::getInstance()->getChicletPanel()->findChiclet<LLIMChiclet>(getNotificationId()); - if(chiclet) + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) { - chiclet->setToggleState(false); + LLIMChiclet * chicletp = chiclet_panelp->findChiclet<LLIMChiclet>(getNotificationId()); + if(NULL != chicletp) + { + chicletp->setToggleState(false); + } } } } @@ -223,15 +227,19 @@ void LLScriptFloater::onMouseDown() { if(getNotificationId().notNull()) { - // Remove new message icon - LLIMChiclet* chiclet = LLBottomTray::getInstance()->getChicletPanel()->findChiclet<LLIMChiclet>(getNotificationId()); - if (chiclet == NULL) - { - llerror("Dock chiclet for LLScriptFloater doesn't exist", 0); - } - else + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) { - chiclet->setShowNewMessagesIcon(false); + LLIMChiclet * chicletp = chiclet_panelp->findChiclet<LLIMChiclet>(getNotificationId()); + // Remove new message icon + if (NULL == chicletp) + { + LL_ERRS() << "Dock chiclet for LLScriptFloater doesn't exist" << LL_ENDL; + } + else + { + chicletp->setShowNewMessagesIcon(false); + } } } } @@ -267,7 +275,11 @@ void LLScriptFloater::onFocusLost() { if(getNotificationId().notNull()) { - LLBottomTray::getInstance()->getChicletPanel()->setChicletToggleState(getNotificationId(), false); + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) + { + chiclet_panelp->setChicletToggleState(getNotificationId(), false); + } } } @@ -276,7 +288,11 @@ void LLScriptFloater::onFocusReceived() // first focus will be received before setObjectId() call - don't toggle chiclet if(getNotificationId().notNull()) { - LLBottomTray::getInstance()->getChicletPanel()->setChicletToggleState(getNotificationId(), true); + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) + { + chiclet_panelp->setChicletToggleState(getNotificationId(), true); + } } } @@ -284,28 +300,30 @@ void LLScriptFloater::dockToChiclet(bool dock) { if (getDockControl() == NULL) { - LLChiclet* chiclet = LLBottomTray::getInstance()->getChicletPanel()->findChiclet<LLChiclet>(getNotificationId()); - if (chiclet == NULL) + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) { - llwarns << "Dock chiclet for LLScriptFloater doesn't exist" << llendl; - return; - } - else - { - LLBottomTray::getInstance()->getChicletPanel()->scrollToChiclet(chiclet); - } + LLChiclet * chicletp = chiclet_panelp->findChiclet<LLChiclet>(getNotificationId()); + if (NULL == chicletp) + { + LL_WARNS() << "Dock chiclet for LLScriptFloater doesn't exist" << LL_ENDL; + return; + } + + chiclet_panelp->scrollToChiclet(chicletp); - // Stop saving position while we dock floater - bool save = getSavePosition(); - setSavePosition(false); + // Stop saving position while we dock floater + bool save = getSavePosition(); + setSavePosition(false); - setDockControl(new LLDockControl(chiclet, this, getDockTongue(), - LLDockControl::TOP, boost::bind(&LLScriptFloater::getAllowedRect, this, _1))); + setDockControl(new LLDockControl(chicletp, this, getDockTongue(), + LLDockControl::BOTTOM)); - setDocked(dock); + setDocked(dock); - // Restore saving - setSavePosition(save); + // Restore saving + setSavePosition(save); + } } } @@ -332,7 +350,7 @@ void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id) { if(notification_id.isNull()) { - llwarns << "Invalid notification ID" << llendl; + LL_WARNS() << "Invalid notification ID" << LL_ENDL; return; } @@ -352,11 +370,16 @@ void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id) script_notification_map_t::const_iterator it = findUsingObjectId(object_id); if(it != mNotifications.end()) { - LLIMChiclet* chiclet = LLBottomTray::getInstance()->getChicletPanel()->findChiclet<LLIMChiclet>(it->first); - if(chiclet) + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) { - // Pass the new_message icon state further. - set_new_message = chiclet->getShowNewMessagesIcon(); + LLIMChiclet * chicletp = chiclet_panelp->findChiclet<LLIMChiclet>(it->first); + if(NULL != chicletp) + { + // Pass the new_message icon state further. + set_new_message = chicletp->getShowNewMessagesIcon(); + chicletp->hidePopupMenu(); + } } LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", it->first); @@ -372,14 +395,18 @@ void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id) mNotifications.insert(std::make_pair(notification_id, object_id)); - // Create inventory offer chiclet for offer type notifications - if( OBJ_GIVE_INVENTORY == obj_type ) + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) { - LLBottomTray::instance().getChicletPanel()->createChiclet<LLInvOfferChiclet>(notification_id); - } - else - { - LLBottomTray::getInstance()->getChicletPanel()->createChiclet<LLScriptChiclet>(notification_id); + // Create inventory offer chiclet for offer type notifications + if( OBJ_GIVE_INVENTORY == obj_type ) + { + chiclet_panelp->createChiclet<LLInvOfferChiclet>(notification_id); + } + else + { + chiclet_panelp->createChiclet<LLScriptChiclet>(notification_id); + } } LLIMWellWindow::getInstance()->addObjectRow(notification_id, set_new_message); @@ -408,14 +435,25 @@ void LLScriptFloaterManager::onRemoveNotification(const LLUUID& notification_id) { if(notification_id.isNull()) { - llwarns << "Invalid notification ID" << llendl; + LL_WARNS() << "Invalid notification ID" << LL_ENDL; return; } // remove related chiclet - LLBottomTray::getInstance()->getChicletPanel()->removeChiclet(notification_id); + if (LLChicletBar::instanceExists()) + { + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) + { + chiclet_panelp->removeChiclet(notification_id); + } + } - LLIMWellWindow::getInstance()->removeObjectRow(notification_id); + LLIMWellWindow* im_well_window = LLIMWellWindow::findInstance(); + if (im_well_window) + { + im_well_window->removeObjectRow(notification_id); + } mNotifications.erase(notification_id); @@ -468,7 +506,7 @@ LLScriptFloaterManager::EObjectType LLScriptFloaterManager::getObjectType(const { if(notification_id.isNull()) { - llwarns << "Invalid notification ID" << llendl; + LL_WARNS() << "Invalid notification ID" << LL_ENDL; return OBJ_UNKNOWN; } @@ -481,7 +519,7 @@ LLScriptFloaterManager::EObjectType LLScriptFloaterManager::getObjectType(const return it->second; } - llwarns << "Unknown object type" << llendl; + LL_WARNS() << "Unknown object type" << LL_ENDL; return OBJ_UNKNOWN; } @@ -492,7 +530,7 @@ std::string LLScriptFloaterManager::getObjectName(const LLUUID& notification_id) LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id); if(!notification) { - llwarns << "Invalid notification" << llendl; + LL_WARNS() << "Invalid notification" << LL_ENDL; return LLStringUtil::null; } @@ -549,7 +587,7 @@ void LLScriptFloaterManager::saveFloaterPosition(const LLUUID& object_id, const } else { - llwarns << "Invalid object id" << llendl; + LL_WARNS() << "Invalid object id" << LL_ENDL; } } |