From 427d16ee2d1de0614c85f94cf2325b501d5ffbbf Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Mon, 17 Jan 2011 14:03:52 +0100 Subject: [PATCH] Added "ScriptDialogPerObject" setting to control the behaviour of scripted dialogs from the same object -> 0 - viewer 2 default (one script dialog per object) 1 - per-channel (one script dialog per unique reply channel per object) 2 - unconstrained (each script dialog will always add a new chiclet) --- indra/newview/app_settings/settings.xml | 11 ++++++ indra/newview/llscriptfloater.cpp | 47 +++++++++++++++++++++++-- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index c4cfc52027..e72a27a720 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -11212,6 +11212,17 @@ Change of this parameter will affect the layout of buttons in notification toast Value 0 + ScriptDialogPerObject + + Comment + Controls how script dialogs from the same object are handled (0 = one dialog per object, 1 = one dialog per channel per object, 2 = unconstrained) + Persist + 1 + Type + S32 + Value + 1 + ScriptHelpFollowsCursor Comment diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index da216325cc..28e89a1018 100644 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -377,9 +377,50 @@ void LLScriptFloaterManager::onAddNotification(const LLUUID& 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 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 = LLBottomTray::getInstance()->getChicletPanel()->findChiclet(it->first);