diff options
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
-rw-r--r-- | indra/newview/llviewermenu.cpp | 134 |
1 files changed, 81 insertions, 53 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 728fb7c616..4307002980 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -51,6 +51,8 @@ #include "llfontgl.h" #include "llinstantmessage.h" #include "llinventorypanel.h" +#include "llnotifications.h" +#include "llnotificationsutil.h" #include "llpermissionsflags.h" #include "llrect.h" #include "llsecondlifeurls.h" @@ -2733,15 +2735,26 @@ bool enable_object_edit() // there. Eventually this needs to be replaced with code that only // lets you edit objects if you have permission to do so (edit perms, // group edit, god). See also lltoolbar.cpp. JC - bool enable = true; + bool enable = false; if (gAgent.inPrelude()) { - enable = LLViewerParcelMgr::getInstance()->agentCanBuild() + enable = LLViewerParcelMgr::getInstance()->allowAgentBuild() || LLSelectMgr::getInstance()->getSelection()->isAttachment(); + } + else if (LLSelectMgr::getInstance()->selectGetModify()) + { + enable = true; } + return enable; } +// mutually exclusive - show either edit option or build in menu +bool enable_object_build() +{ + return !enable_object_edit(); +} + class LLSelfRemoveAllAttachments : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -2927,7 +2940,7 @@ class LLAvatarReportAbuse : public view_listener_t bool callback_freeze(const LLSD& notification, const LLSD& response) { LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (0 == option || 1 == option) { @@ -2981,14 +2994,14 @@ void handle_avatar_freeze(const LLSD& avatar_id) { LLSD args; args["AVATAR_NAME"] = fullname; - LLNotifications::instance().add("FreezeAvatarFullname", + LLNotificationsUtil::add("FreezeAvatarFullname", args, payload, callback_freeze); } else { - LLNotifications::instance().add("FreezeAvatar", + LLNotificationsUtil::add("FreezeAvatar", LLSD(), payload, callback_freeze); @@ -3028,7 +3041,7 @@ class LLAvatarDebug : public view_listener_t bool callback_eject(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (2 == option) { // Cancel button. @@ -3110,14 +3123,14 @@ void handle_avatar_eject(const LLSD& avatar_id) { LLSD args; args["AVATAR_NAME"] = fullname; - LLNotifications::instance().add("EjectAvatarFullname", + LLNotificationsUtil::add("EjectAvatarFullname", args, payload, callback_eject); } else { - LLNotifications::instance().add("EjectAvatarFullname", + LLNotificationsUtil::add("EjectAvatarFullname", LLSD(), payload, callback_eject); @@ -3130,14 +3143,14 @@ void handle_avatar_eject(const LLSD& avatar_id) { LLSD args; args["AVATAR_NAME"] = fullname; - LLNotifications::instance().add("EjectAvatarFullnameNoBan", + LLNotificationsUtil::add("EjectAvatarFullnameNoBan", args, payload, callback_eject); } else { - LLNotifications::instance().add("EjectAvatarNoBan", + LLNotificationsUtil::add("EjectAvatarNoBan", LLSD(), payload, callback_eject); @@ -3220,11 +3233,11 @@ class LLAvatarGiveCard : public view_listener_t transaction_id.generate(); msg->addUUIDFast(_PREHASH_TransactionID, transaction_id); msg->sendReliable(dest_host); - LLNotifications::instance().add("OfferedCard", args); + LLNotificationsUtil::add("OfferedCard", args); } else { - LLNotifications::instance().add("CantOfferCallingCard", old_args); + LLNotificationsUtil::add("CantOfferCallingCard", old_args); } } return true; @@ -3243,7 +3256,7 @@ void login_done(S32 which, void *user) bool callback_leave_group(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (option == 0) { LLMessageSystem *msg = gMessageSystem; @@ -3310,7 +3323,7 @@ void handle_buy_object(LLSaleInfo sale_info) { if(!LLSelectMgr::getInstance()->selectGetAllRootsValid()) { - LLNotifications::instance().add("UnableToBuyWhileDownloading"); + LLNotificationsUtil::add("UnableToBuyWhileDownloading"); return; } @@ -3319,7 +3332,7 @@ void handle_buy_object(LLSaleInfo sale_info) BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); if (!owners_identical) { - LLNotifications::instance().add("CannotBuyObjectsFromDifferentOwners"); + LLNotificationsUtil::add("CannotBuyObjectsFromDifferentOwners"); return; } @@ -3329,7 +3342,7 @@ void handle_buy_object(LLSaleInfo sale_info) valid &= LLSelectMgr::getInstance()->selectGetAggregatePermissions(ag_perm); if(!valid || !sale_info.isForSale() || !perm.allowTransferTo(gAgent.getID())) { - LLNotifications::instance().add("ObjectNotForSale"); + LLNotificationsUtil::add("ObjectNotForSale"); return; } @@ -3493,12 +3506,12 @@ void set_god_level(U8 god_level) if(god_level > GOD_NOT) { args["LEVEL"] = llformat("%d",(S32)god_level); - LLNotifications::instance().add("EnteringGodMode", args); + LLNotificationsUtil::add("EnteringGodMode", args); } else { args["LEVEL"] = llformat("%d",(S32)old_god_level); - LLNotifications::instance().add("LeavingGodMode", args); + LLNotificationsUtil::add("LeavingGodMode", args); } // changing god-level can affect which menus we see @@ -3619,7 +3632,7 @@ void request_friendship(const LLUUID& dest_id) } else { - LLNotifications::instance().add("CantOfferFriendship"); + LLNotificationsUtil::add("CantOfferFriendship"); } } } @@ -3879,8 +3892,7 @@ void god_force_inv_owner_permissive(LLViewerObject* object, InventoryObjectList::const_iterator inv_end = inventory->end(); for ( ; inv_it != inv_end; ++inv_it) { - if(((*inv_it)->getType() != LLAssetType::AT_CATEGORY) - && ((*inv_it)->getType() != LLAssetType::AT_ROOT_CATEGORY)) + if(((*inv_it)->getType() != LLAssetType::AT_CATEGORY)) { LLInventoryObject* obj = *inv_it; LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem((LLViewerInventoryItem*)obj); @@ -3951,7 +3963,7 @@ void handle_claim_public_land(void*) { if (LLViewerParcelMgr::getInstance()->getSelectionRegion() != gAgent.getRegion()) { - LLNotifications::instance().add("ClaimPublicLand"); + LLNotificationsUtil::add("ClaimPublicLand"); return; } @@ -4147,7 +4159,7 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) } else if(!error.empty()) { - LLNotifications::instance().add(error); + LLNotificationsUtil::add(error); } } @@ -4168,13 +4180,13 @@ class LLObjectReturn : public view_listener_t mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); - LLNotifications::instance().add("ReturnToOwner", LLSD(), LLSD(), boost::bind(&LLObjectReturn::onReturnToOwner, this, _1, _2)); + LLNotificationsUtil::add("ReturnToOwner", LLSD(), LLSD(), boost::bind(&LLObjectReturn::onReturnToOwner, this, _1, _2)); return true; } bool onReturnToOwner(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (0 == option) { // Ignore category ID for this derez destination. @@ -4351,7 +4363,7 @@ void handle_take() bool confirm_take(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if(enable_take() && (option == 0)) { derez_objects(DRD_TAKE_INTO_AGENT_INVENTORY, notification["payload"]["folder_id"].asUUID()); @@ -4526,7 +4538,7 @@ S32 selection_price() /* bool callback_show_buy_currency(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (0 == option) { llinfos << "Loading page " << LLNotifications::instance().getGlobalString("BUY_CURRENCY_URL") << llendl; @@ -4552,7 +4564,7 @@ void show_buy_currency(const char* extra) { args["EXTRA"] = extra; } - LLNotifications::instance().add("PromptGoToCurrencyPage", args);//, LLSD(), callback_show_buy_currency); + LLNotificationsUtil::add("PromptGoToCurrencyPage", args);//, LLSD(), callback_show_buy_currency); } void handle_buy() @@ -4822,7 +4834,7 @@ class LLToolsLink : public view_listener_t { if(!LLSelectMgr::getInstance()->selectGetAllRootsValid()) { - LLNotifications::instance().add("UnableToLinkWhileDownloading"); + LLNotificationsUtil::add("UnableToLinkWhileDownloading"); return true; } @@ -4833,18 +4845,18 @@ class LLToolsLink : public view_listener_t args["COUNT"] = llformat("%d", object_count); int max = MAX_CHILDREN_PER_TASK+1; args["MAX"] = llformat("%d", max); - LLNotifications::instance().add("UnableToLinkObjects", args); + LLNotificationsUtil::add("UnableToLinkObjects", args); return true; } if(LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() < 2) { - LLNotifications::instance().add("CannotLinkIncompleteSet"); + LLNotificationsUtil::add("CannotLinkIncompleteSet"); return true; } if(!LLSelectMgr::getInstance()->selectGetRootsModify()) { - LLNotifications::instance().add("CannotLinkModify"); + LLNotificationsUtil::add("CannotLinkModify"); return true; } LLUUID owner_id; @@ -4854,7 +4866,7 @@ class LLToolsLink : public view_listener_t // we don't actually care if you're the owner, but novices are // the most likely to be stumped by this one, so offer the // easiest and most likely solution. - LLNotifications::instance().add("CannotLinkDifferentOwners"); + LLNotificationsUtil::add("CannotLinkDifferentOwners"); return true; } LLSelectMgr::getInstance()->sendLink(); @@ -5190,7 +5202,7 @@ void show_debug_menus() gMenuBarView->setItemEnabled("Develop", qamode); // Server ('Admin') menu hidden when not in godmode. - const bool show_server_menu = debug && (gAgent.getGodLevel() > GOD_NOT || gAgent.getAdminOverride()); + const bool show_server_menu = (gAgent.getGodLevel() > GOD_NOT || (debug && gAgent.getAdminOverride())); gMenuBarView->setItemVisible("Admin", show_server_menu); gMenuBarView->setItemEnabled("Admin", show_server_menu); } @@ -5338,7 +5350,7 @@ class LLWorldSetBusy : public view_listener_t else { gAgent.setBusy(); - LLNotifications::instance().add("BusyModeSet"); + LLNotificationsUtil::add("BusyModeSet"); } return true; } @@ -5454,7 +5466,7 @@ class LLAvatarAddContact : public view_listener_t bool complete_give_money(const LLSD& notification, const LLSD& response, LLObjectSelectionHandle selection) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (option == 0) { gAgent.clearBusy(); @@ -5616,12 +5628,7 @@ class LLShowFloater : public view_listener_t } else if (floater_name == "buy land") { - if (LLViewerParcelMgr::getInstance()->selectionEmpty()) - { - LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal()); - } - - LLViewerParcelMgr::getInstance()->startBuyLand(); + handle_buy_land(); } else if (floater_name == "script errors") { @@ -5668,9 +5675,19 @@ class LLFloaterVisible : public view_listener_t } }; +class LLShowSidetrayPanel : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string panel_name = userdata.asString(); + LLSideTray::getInstance()->showPanel(panel_name, LLSD()); + return true; + } +}; + bool callback_show_url(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (0 == option) { LLWeb::loadURL(notification["payload"]["url"].asString()); @@ -5693,7 +5710,7 @@ class LLPromptShowURL : public view_listener_t { LLSD payload; payload["url"] = url; - LLNotifications::instance().add(alert, LLSD(), payload, callback_show_url); + LLNotificationsUtil::add(alert, LLSD(), payload, callback_show_url); } else { @@ -5710,7 +5727,7 @@ class LLPromptShowURL : public view_listener_t bool callback_show_file(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (0 == option) { LLWeb::loadURL(notification["payload"]["url"]); @@ -5731,7 +5748,7 @@ class LLPromptShowFile : public view_listener_t LLSD payload; payload["url"] = file; - LLNotifications::instance().add(alert, LLSD(), payload, callback_show_file); + LLNotificationsUtil::add(alert, LLSD(), payload, callback_show_file); } else { @@ -5821,7 +5838,15 @@ BOOL enable_buy_land(void*) LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(), false); } - +void handle_buy_land() +{ + LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); + if (vpm->selectionEmpty()) + { + vpm->selectParcelAt(gAgent.getPositionGlobal()); + } + vpm->startBuyLand(); +} class LLObjectAttachToAvatar : public view_listener_t { @@ -6086,7 +6111,7 @@ class LLAttachmentEnableDrop : public view_listener_t { bool handleEvent(const LLSD& userdata) { - BOOL can_build = gAgent.isGodlike() || (LLViewerParcelMgr::getInstance()->agentCanBuild()); + BOOL can_build = gAgent.isGodlike() || (LLViewerParcelMgr::getInstance()->allowAgentBuild()); //Add an inventory observer to only allow dropping the newly attached item //once it exists in your inventory. Look at Jira 2422. @@ -6302,12 +6327,12 @@ void queue_actions(LLFloaterScriptQueue* q, const std::string& msg) if ( !func.scripted ) { std::string noscriptmsg = std::string("Cannot") + msg + "SelectObjectsNoScripts"; - LLNotifications::instance().add(noscriptmsg); + LLNotificationsUtil::add(noscriptmsg); } else if ( !func.modifiable ) { std::string nomodmsg = std::string("Cannot") + msg + "SelectObjectsNoPermission"; - LLNotifications::instance().add(nomodmsg); + LLNotificationsUtil::add(nomodmsg); } else { @@ -6424,13 +6449,13 @@ void handle_selected_texture_info(void*) void handle_test_male(void*) { - LLAppearanceManager::wearOutfitByName("Male Shape & Outfit"); + LLAppearanceManager::instance().wearOutfitByName("Male Shape & Outfit"); //gGestureList.requestResetFromServer( TRUE ); } void handle_test_female(void*) { - LLAppearanceManager::wearOutfitByName("Female Shape & Outfit"); + LLAppearanceManager::instance().wearOutfitByName("Female Shape & Outfit"); //gGestureList.requestResetFromServer( FALSE ); } @@ -7116,7 +7141,7 @@ void handle_save_to_xml(void*) LLFloater* frontmost = gFloaterView->getFrontmost(); if (!frontmost) { - LLNotifications::instance().add("NoFrontmostFloater"); + LLNotificationsUtil::add("NoFrontmostFloater"); return; } @@ -8024,9 +8049,12 @@ void initialize_menus() visible.add("VisiblePayObject", boost::bind(&enable_pay_object)); enable.add("EnablePayAvatar", boost::bind(&enable_pay_avatar)); enable.add("EnableEdit", boost::bind(&enable_object_edit)); + visible.add("VisibleBuild", boost::bind(&enable_object_build)); + visible.add("VisibleEdit", boost::bind(&enable_object_edit)); visible.add("Object.VisibleEdit", boost::bind(&enable_object_edit)); view_listener_t::addMenu(new LLFloaterVisible(), "FloaterVisible"); + view_listener_t::addMenu(new LLShowSidetrayPanel(), "ShowSidetrayPanel"); view_listener_t::addMenu(new LLSomethingSelected(), "SomethingSelected"); view_listener_t::addMenu(new LLSomethingSelectedNoHUD(), "SomethingSelectedNoHUD"); view_listener_t::addMenu(new LLEditableSelected(), "EditableSelected"); |