void LLScriptFloaterManager::onRemoveNotification(const LLUUID& notification_id) { if(notification_id.isNull()) { llwarns << "Invalid notification ID" << llendl; return; } // remove related chiclet if (LLChicletBar::instanceExists()) { LLChicletBar::getInstance()->getChicletPanel()->removeChiclet(notification_id); } LLIMWellWindow* im_well_window = LLIMWellWindow::findInstance(); if (im_well_window) { im_well_window->removeObjectRow(notification_id); } mNotifications.erase(notification_id); // close floater LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", notification_id); if(floater) { floater->savePosition(); floater->setNotificationId(LLUUID::null); floater->closeFloater(); } }
bool LLScriptFloater::toggle(const LLUUID& notification_id) { LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", notification_id); // show existing floater if(floater) { if(floater->getVisible()) { floater->setVisible(false); return false; } else { floater->setVisible(TRUE); floater->setFocus(FALSE); } } // create and show new floater else { show(notification_id); } LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(notification_id, true); return true; }
void LLScriptFloaterManager::setFloaterVisible(const LLUUID& notification_id, bool visible) { LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>( "script_floater", notification_id); if(floater) { floater->setVisible(visible); } }
LLScriptFloater* LLScriptFloater::show(const LLUUID& notification_id) { LLScriptFloater* floater = LLFloaterReg::getTypedInstance<LLScriptFloater>("script_floater", notification_id); floater->setNotificationId(notification_id); floater->createForm(notification_id); //LLDialog(LLGiveInventory and LLLoadURL) should no longer steal focus (see EXT-5445) floater->setAutoFocus(FALSE); if(LLScriptFloaterManager::OBJ_SCRIPT == LLScriptFloaterManager::getObjectType(notification_id)) { floater->setSavePosition(true); floater->restorePosition(); } else { floater->dockToChiclet(true); } //LLDialog(LLGiveInventory and LLLoadURL) should no longer steal focus (see EXT-5445) LLFloaterReg::showTypedInstance<LLScriptFloater>("script_floater", notification_id, FALSE); return floater; }
void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id) { if(notification_id.isNull()) { llwarns << "Invalid notification ID" << llendl; return; } // get scripted Object's ID LLUUID object_id = notification_id_to_object_id(notification_id); // Need to indicate of "new message" for object chiclets according to requirements // specified in the Message Bar design specification. See EXT-3142. bool set_new_message = false; EObjectType obj_type = getObjectType(notification_id); // LLDialog can spawn only one instance, LLLoadURL and LLGiveInventory can spawn unlimited number of instances if(OBJ_SCRIPT == obj_type) { // // If an Object spawns more-than-one floater, only the newest one is shown. // // The previous is automatically closed. // script_notification_map_t::const_iterator it = findUsingObjectId(object_id); // [SL:KB] - Patch: UI-ScriptDialog | Checked: 2011-01-17 (Catznip-2.4.0h) | Added: Catznip-2.4.0h script_notification_map_t::const_iterator it = mNotifications.end(); switch (gSavedSettings.getS32("ScriptDialogPerObject")) { case 0: // One script dialog per object (viewer 2 default) { // If an Object spawns more-than-one floater, only the newest one is shown. // The previous is automatically closed. it = findUsingObjectId(object_id); } break; case 1: // One script dialog per reply channel per object { // We'll allow an object to have more than one script dialog floater open, but we'll limit it to one per chat channel // (in practice a lot of objects open a new listen channel for each new dialog but it still reduces chiclets somewhat) LLNotificationPtr newNotif = LLNotifications::instance().find(notification_id); if (newNotif) { S32 nNewChannel = newNotif->getPayload()["chat_channel"].asInteger(); for (it = mNotifications.begin(); it != mNotifications.end(); ++it) { if (it->second == object_id) { LLNotificationPtr curNotif = LLNotifications::instance().find(it->first); if (curNotif) { S32 nCurChannel = curNotif->getPayload()["chat_channel"].asInteger(); if (nNewChannel == nCurChannel) break; } } } } } break; case 2: // Unconstrained default: break; } // [/SL:KB] if(it != mNotifications.end()) { LLIMChiclet* chiclet = LLChicletBar::getInstance()->getChicletPanel()->findChiclet<LLIMChiclet>(it->first); if(chiclet) { // Pass the new_message icon state further. set_new_message = chiclet->getShowNewMessagesIcon(); } LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", it->first); if(floater) { // Generate chiclet with a "new message" indicator if a docked window was opened but not in focus. See EXT-3142. set_new_message |= !floater->hasFocus(); } removeNotification(it->first); } } mNotifications.insert(std::make_pair(notification_id, object_id)); // Create inventory offer chiclet for offer type notifications if( OBJ_GIVE_INVENTORY == obj_type ) { LLChicletBar::instance().getChicletPanel()->createChiclet<LLInvOfferChiclet>(notification_id); } else { LLChicletBar::getInstance()->getChicletPanel()->createChiclet<LLScriptChiclet>(notification_id); } LLIMWellWindow::getInstance()->addObjectRow(notification_id, set_new_message); LLSD data; data["notification_id"] = notification_id; data["new_message"] = set_new_message; data["unread"] = 1; // each object has got only one floater mNewObjectSignal(data); toggleScriptFloater(notification_id, set_new_message); }
LLScriptFloater* LLScriptFloater::show(const LLUUID& notification_id) { LLScriptFloater* floater = LLFloaterReg::getTypedInstance<LLScriptFloater>("script_floater", notification_id); floater->setNotificationId(notification_id); floater->createForm(notification_id); //LLDialog(LLGiveInventory and LLLoadURL) should no longer steal focus (see EXT-5445) floater->setAutoFocus(FALSE); LLScriptFloaterManager::e_object_type floaterType=LLScriptFloaterManager::getObjectType(notification_id); // for some reason an inventory offer comes back as OBJ_UNKNOWN -Zi if(floaterType==LLScriptFloaterManager::OBJ_UNKNOWN || floaterType==LLScriptFloaterManager::OBJ_SCRIPT) { floater->setSavePosition(true); if(gSavedSettings.getBOOL("ShowScriptDialogsTopRight")) { // undock the dialog floater->setDocked(false,true); LLRect pos=floater->getRect(); S32 width=pos.getWidth(); S32 height=pos.getHeight(); pos.setOriginAndSize(gViewerWindow->getWorldViewWidthScaled()-width, gViewerWindow->getWorldViewHeightScaled()-height, width,height); floater->setRect(pos); floater->savePosition(); } // do this only for inventory offers -Zi else if(floaterType==LLScriptFloaterManager::OBJ_UNKNOWN) { // undock the dialog floater->setDocked(false,true); LLRect pos=floater->getRect(); S32 width=pos.getWidth(); S32 height=pos.getHeight(); pos.setOriginAndSize(gViewerWindow->getWorldViewWidthScaled()-width, gViewerWindow->getWorldViewHeightScaled()-height, width,height); floater->setRect(pos); floater->savePosition(); } floater->restorePosition(); } else { floater->dockToChiclet(true); } //LLDialog(LLGiveInventory and LLLoadURL) should no longer steal focus (see EXT-5445) LLFloaterReg::showTypedInstance<LLScriptFloater>("script_floater", notification_id, FALSE); return floater; }
void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id) { if(notification_id.isNull()) { llwarns << "Invalid notification ID" << llendl; return; } // get scripted Object's ID LLUUID object_id = notification_id_to_object_id(notification_id); // Need to indicate of "new message" for object chiclets according to requirements // specified in the Message Bar design specification. See EXT-3142. bool set_new_message = false; EObjectType obj_type = getObjectType(notification_id); // LLDialog can spawn only one instance, LLLoadURL and LLGiveInventory can spawn unlimited number of instances if(OBJ_SCRIPT == obj_type) { // If an Object spawns more-than-one floater, only the newest one is shown. // The previous is automatically closed. 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) { // Pass the new_message icon state further. set_new_message = chiclet->getShowNewMessagesIcon(); } LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", it->first); if(floater) { // Generate chiclet with a "new message" indicator if a docked window was opened but not in focus. See EXT-3142. set_new_message |= !floater->hasFocus(); } removeNotification(it->first); } } mNotifications.insert(std::make_pair(notification_id, object_id)); // Create inventory offer chiclet for offer type notifications if( OBJ_GIVE_INVENTORY == obj_type ) { LLBottomTray::instance().getChicletPanel()->createChiclet<LLInvOfferChiclet>(notification_id); } else { LLBottomTray::getInstance()->getChicletPanel()->createChiclet<LLScriptChiclet>(notification_id); } LLIMWellWindow::getInstance()->addObjectRow(notification_id, set_new_message); LLSD data; data["notification_id"] = notification_id; data["new_message"] = set_new_message; data["unread"] = 1; // each object has got only one floater mNewObjectSignal(data); toggleScriptFloater(notification_id, set_new_message); }