From ce28e056c20bf2723f565bbf464b87781ec248a2 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:42 -0500 Subject: Second Life viewer sources 1.20.2 --- linden/indra/newview/llviewermenu.cpp | 684 ++++++++++++++++++---------------- 1 file changed, 357 insertions(+), 327 deletions(-) (limited to 'linden/indra/newview/llviewermenu.cpp') diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index b35abe6..6ee80a6 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp @@ -67,7 +67,6 @@ #include "llagentpilot.h" #include "llbox.h" #include "llcallingcard.h" -#include "llcameraview.h" #include "llclipboard.h" #include "llcompilequeue.h" #include "llconsole.h" @@ -92,6 +91,7 @@ #include "llfloaterbuycontents.h" #include "llfloaterbuycurrency.h" #include "llfloaterbuyland.h" +#include "llfloatercamera.h" #include "llfloaterchat.h" #include "llfloatercustomize.h" #include "llfloaterdaycycle.h" @@ -106,6 +106,7 @@ #include "llfloatergroups.h" #include "llfloaterhtml.h" #include "llfloaterhtmlhelp.h" +#include "llfloaterhud.h" #include "llfloaterinspect.h" #include "llfloaterlagmeter.h" #include "llfloaterland.h" @@ -119,7 +120,9 @@ #include "llfloaterregioninfo.h" #include "llfloaterreporter.h" #include "llfloaterscriptdebug.h" +#include "llfloatersettingsdebug.h" #include "llfloaterenvsettings.h" +#include "llfloaterstats.h" #include "llfloatertest.h" #include "llfloatertools.h" #include "llfloaterwater.h" @@ -170,7 +173,7 @@ #include "lltoolpie.h" #include "lltoolplacer.h" #include "lltoolselectland.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "lluploaddialog.h" #include "lluserauth.h" #include "lluuid.h" @@ -374,6 +377,11 @@ void toggle_cull_small(void *); void toggle_show_xui_names(void *); BOOL check_show_xui_names(void *); +void run_vectorize_perf_test(void *) +{ + gSavedSettings.setBOOL("VectorizePerfTest", TRUE); +} + // Debug UI void handle_web_search_demo(void*); void handle_slurl_test(void*); @@ -457,8 +465,6 @@ void handle_dump_image_list(void*); void handle_crash(void*); void handle_dump_followcam(void*); -void handle_toggle_flycam(void*); -BOOL check_flycam(void*); void handle_viewer_enable_message_log(void*); void handle_viewer_disable_message_log(void*); void handle_send_postcard(void*); @@ -563,12 +569,12 @@ static LLLandmarkObserver* gLandmarkObserver = NULL; LLMenuParcelObserver::LLMenuParcelObserver() { - gParcelMgr->addObserver(this); + LLViewerParcelMgr::getInstance()->addObserver(this); } LLMenuParcelObserver::~LLMenuParcelObserver() { - gParcelMgr->removeObserver(this); + LLViewerParcelMgr::getInstance()->removeObserver(this); } void LLMenuParcelObserver::changed() @@ -660,23 +666,23 @@ void init_menus() /// /// Pie menus /// - gPieSelf = gUICtrlFactory->buildPieMenu("menu_pie_self.xml", gMenuHolder); + gPieSelf = LLUICtrlFactory::getInstance()->buildPieMenu("menu_pie_self.xml", gMenuHolder); // TomY TODO: what shall we do about these? gDetachScreenPieMenu = gMenuHolder->getChild("Object Detach HUD", true); gDetachPieMenu = gMenuHolder->getChild("Object Detach", true); - gPieAvatar = gUICtrlFactory->buildPieMenu("menu_pie_avatar.xml", gMenuHolder); + gPieAvatar = LLUICtrlFactory::getInstance()->buildPieMenu("menu_pie_avatar.xml", gMenuHolder); - gPieObject = gUICtrlFactory->buildPieMenu("menu_pie_object.xml", gMenuHolder); + gPieObject = LLUICtrlFactory::getInstance()->buildPieMenu("menu_pie_object.xml", gMenuHolder); gAttachScreenPieMenu = gMenuHolder->getChild("Object Attach HUD"); gAttachPieMenu = gMenuHolder->getChild("Object Attach"); gPieRate = gMenuHolder->getChild("Rate Menu"); - gPieAttachment = gUICtrlFactory->buildPieMenu("menu_pie_attachment.xml", gMenuHolder); + gPieAttachment = LLUICtrlFactory::getInstance()->buildPieMenu("menu_pie_attachment.xml", gMenuHolder); - gPieLand = gUICtrlFactory->buildPieMenu("menu_pie_land.xml", gMenuHolder); + gPieLand = LLUICtrlFactory::getInstance()->buildPieMenu("menu_pie_land.xml", gMenuHolder); /// /// set up the colors @@ -702,10 +708,13 @@ void init_menus() { color = gColors.getColor( "MenuNonProductionBgColor" ); } - gMenuBarView = (LLMenuBarGL*)gUICtrlFactory->buildMenu("menu_viewer.xml", gMenuHolder); + gMenuBarView = (LLMenuBarGL*)LLUICtrlFactory::getInstance()->buildMenu("menu_viewer.xml", gMenuHolder); gMenuBarView->setRect(LLRect(0, top, 0, top - MENU_BAR_HEIGHT)); gMenuBarView->setBackgroundColor( color ); + gMenuBarView->setItemVisible("Tools", FALSE); + gMenuBarView->arrange(); + gMenuHolder->addChild(gMenuBarView); // menu holder appears on top of menu bar so you can see the menu title @@ -764,7 +773,7 @@ void init_menus() // show_debug_menus(); - gLoginMenuBarView = (LLMenuBarGL*)gUICtrlFactory->buildMenu("menu_login.xml", gMenuHolder); + gLoginMenuBarView = (LLMenuBarGL*)LLUICtrlFactory::getInstance()->buildMenu("menu_login.xml", gMenuHolder); LLRect menuBarRect = gLoginMenuBarView->getRect(); gLoginMenuBarView->setRect(LLRect(menuBarRect.mLeft, menuBarRect.mTop, gViewerWindow->getRootView()->getRect().getWidth() - menuBarRect.mLeft, menuBarRect.mBottom)); @@ -821,14 +830,12 @@ void clear_landmark_menu(LLMenuGL* menu) for ( ; it != child_list->end(); ++it) { LLView* view = *it; - if (view->getWidgetType() == WIDGET_TYPE_MENU_ITEM_CALL) + LLMenuItemCallGL* menu_item = dynamic_cast(view); + + if (menu_item && menu_item->getMenuCallback() == landmark_menu_action) { - LLMenuItemCallGL* menu_item = (LLMenuItemCallGL*)view; - if (menu_item->getMenuCallback() == landmark_menu_action) - { - void* user_data = menu_item->getUserData(); - delete (LLUUID*)user_data; - } + void* user_data = menu_item->getUserData(); + delete (LLUUID*)user_data; } } @@ -1072,9 +1079,6 @@ void init_client_menu(LLMenuGL* menu) &menu_check_control, (void*)"DisableCameraConstraints")); - menu->append(new LLMenuItemCheckGL("Joystick Flycam", - &handle_toggle_flycam,NULL,&check_flycam,NULL)); - menu->append(new LLMenuItemCheckGL("Mouse Smoothing", &menu_toggle_control, NULL, @@ -1088,7 +1092,7 @@ void init_client_menu(LLMenuGL* menu) &menu_check_control, (void*)"ShowConsoleWindow")); - if(gQAMode) + if(gSavedSettings.getBOOL("QAMode")) { LLMenuGL* sub = NULL; sub = new LLMenuGL("Debugging"); @@ -1174,7 +1178,6 @@ extern BOOL gDebugClicks; extern BOOL gDebugWindowProc; extern BOOL gDebugTextEditorTips; extern BOOL gDebugSelectMgr; -extern BOOL gVectorizePerfTest; void init_debug_ui_menu(LLMenuGL* menu) { @@ -1184,7 +1187,6 @@ void init_debug_ui_menu(LLMenuGL* menu) menu->append(new LLMenuItemCallGL( "Dump SelectMgr", &dump_select_mgr)); menu->append(new LLMenuItemCallGL( "Dump Inventory", &dump_inventory)); menu->append(new LLMenuItemCallGL( "Dump Focus Holder", &handle_dump_focus, NULL, NULL, 'F', MASK_ALT | MASK_CONTROL)); - menu->append(new LLMenuItemCallGL( "Dump VolumeMgr", &dump_volume_mgr, NULL, NULL)); menu->append(new LLMenuItemCallGL( "Print Selected Object Info", &print_object_info, NULL, NULL, 'P', MASK_CONTROL|MASK_SHIFT )); menu->append(new LLMenuItemCallGL( "Print Agent Info", &print_agent_nvpairs, NULL, NULL, 'P', MASK_SHIFT )); menu->append(new LLMenuItemCallGL( "Texture Memory Stats", &output_statistics, NULL, NULL, 'M', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); @@ -1357,6 +1359,9 @@ void init_debug_rendering_menu(LLMenuGL* menu) sub_menu->append(new LLMenuItemCheckGL("Texture Priority", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY)); + sub_menu->append(new LLMenuItemCheckGL("Avatar Rendering Cost", &LLPipeline::toggleRenderDebug, NULL, + &LLPipeline::toggleRenderDebugControl, + (void*)LLPipeline::RENDER_DEBUG_SHAME)); sub_menu->append(new LLMenuItemCheckGL("Texture Area (sqrt(A))",&LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_TEXTURE_AREA)); @@ -1386,7 +1391,7 @@ void init_debug_rendering_menu(LLMenuGL* menu) (void*)"ShowDepthBuffer")); sub_menu->append(new LLMenuItemToggleGL("Show Select Buffer", &gDebugSelect)); - sub_menu->append(new LLMenuItemToggleGL("Vectorize Perf Test", &gVectorizePerfTest)); + sub_menu->append(new LLMenuItemCallGL("Vectorize Perf Test", &run_vectorize_perf_test)); sub_menu = new LLMenuGL("Render Tests"); @@ -1422,7 +1427,7 @@ void init_debug_rendering_menu(LLMenuGL* menu) LLMenuItemCheckGL* item; item = new LLMenuItemCheckGL("Object-Object Occlusion", menu_toggle_control, NULL, menu_check_control, (void*)"UseOcclusion", 'O', MASK_CONTROL|MASK_SHIFT); - item->setEnabled(gGLManager.mHasOcclusionQuery && gFeatureManagerp->isFeatureAvailable("UseOcclusion")); + item->setEnabled(gGLManager.mHasOcclusionQuery && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")); menu->append(item); item = new LLMenuItemCheckGL("Fast Alpha", menu_toggle_control, NULL, menu_check_control, (void*)"RenderFastAlpha"); @@ -1485,6 +1490,7 @@ void init_debug_avatar_menu(LLMenuGL* menu) menu->appendMenu(sub_menu); + menu->append(new LLMenuItemToggleGL("Tap-Tap-Hold To Run", &gAllowTapTapHoldRun)); menu->append(new LLMenuItemCallGL("Force Params to Default", &LLAgent::clearVisualParams, NULL)); menu->append(new LLMenuItemCallGL("Reload Vertex Shader", &reload_vertex_shader, NULL)); menu->append(new LLMenuItemToggleGL("Animation Info", &LLVOAvatar::sShowAnimationDebug)); @@ -1734,7 +1740,7 @@ class LLObjectEnableTouch : public view_listener_t gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); // Update label based on the node touch name if available. - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node && node->mValid && !node->mTouchName.empty()) { gMenuHolder->childSetText("Object Touch", node->mTouchName); @@ -1750,7 +1756,7 @@ class LLObjectEnableTouch : public view_listener_t void label_touch(LLString& label, void*) { - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node && node->mValid && !node->mTouchName.empty()) { label.assign(node->mTouchName); @@ -1802,7 +1808,7 @@ class LLViewCheckBuildMode : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gToolMgr->inEdit(); + bool new_value = LLToolMgr::getInstance()->inEdit(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -1810,13 +1816,21 @@ class LLViewCheckBuildMode : public view_listener_t bool toggle_build_mode() { - if (gToolMgr->inEdit()) + if (LLToolMgr::getInstance()->inEdit()) { // just reset the view, will pull us out of edit mode handle_reset_view(); + + // avoid spurious avatar movements pulling out of edit mode + LLViewerJoystick::getInstance()->moveAvatar(true); } else { + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + handle_toggle_flycam(); + } + if (gAgent.getFocusOnAvatar() && gSavedSettings.getBOOL("EditCameraMovement") ) { // zoom in if we're looking at the avatar @@ -1826,8 +1840,8 @@ bool toggle_build_mode() gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD ); } - gToolMgr->setCurrentToolset(gBasicToolset); - gToolMgr->getCurrentToolset()->selectTool( gToolCreate ); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() ); // Could be first use LLFirstUse::useBuild(); @@ -1844,11 +1858,35 @@ class LLViewBuildMode : public view_listener_t }; +class LLViewJoystickFlycam : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + handle_toggle_flycam(); + return true; + } +}; + +class LLViewCheckJoystickFlycam : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + bool new_val = LLViewerJoystick::getInstance()->getOverrideCamera(); + gMenuHolder->findControl(userdata["control"].asString())->setValue(new_val); + return true; + } +}; + +void handle_toggle_flycam() +{ + LLViewerJoystick::getInstance()->toggleFlycam(); +} + class LLObjectBuild : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if (gAgent.getFocusOnAvatar() && !gToolMgr->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") ) + if (gAgent.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") ) { // zoom in if we're looking at the avatar gAgent.setFocusOnAvatar(FALSE, ANIMATE); @@ -1863,8 +1901,8 @@ class LLObjectBuild : public view_listener_t gViewerWindow->moveCursorToCenter(); } - gToolMgr->setCurrentToolset(gBasicToolset); - gToolMgr->getCurrentToolset()->selectTool( gToolCreate ); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() ); // Could be first use LLFirstUse::useBuild(); @@ -1876,11 +1914,11 @@ class LLObjectEdit : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - gParcelMgr->deselectLand(); + LLViewerParcelMgr::getInstance()->deselectLand(); - if (gAgent.getFocusOnAvatar() && !gToolMgr->inEdit()) + if (gAgent.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit()) { - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (selection->getSelectType() == SELECT_TYPE_HUD || !gSavedSettings.getBOOL("EditCameraMovement")) { @@ -1902,8 +1940,11 @@ class LLObjectEdit : public view_listener_t gFloaterTools->open(); /* Flawfinder: ignore */ - gToolMgr->setCurrentToolset(gBasicToolset); - gFloaterTools->setEditTool( gToolTranslate ); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + gFloaterTools->setEditTool( LLToolCompTranslate::getInstance() ); + + LLViewerJoystick::getInstance()->moveObjects(true); + LLViewerJoystick::getInstance()->setNeedsReset(true); // Could be first use LLFirstUse::useBuild(); @@ -1928,9 +1969,9 @@ class LLLandBuild : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - gParcelMgr->deselectLand(); + LLViewerParcelMgr::getInstance()->deselectLand(); - if (gAgent.getFocusOnAvatar() && !gToolMgr->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") ) + if (gAgent.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") ) { // zoom in if we're looking at the avatar gAgent.setFocusOnAvatar(FALSE, ANIMATE); @@ -1947,8 +1988,8 @@ class LLLandBuild : public view_listener_t } - gToolMgr->setCurrentToolset(gBasicToolset); - gToolMgr->getCurrentToolset()->selectTool( gToolCreate ); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() ); // Could be first use LLFirstUse::useBuild(); @@ -1982,7 +2023,7 @@ BOOL enable_land_build(void*) if (gAgent.inPrelude()) return FALSE; BOOL can_build = FALSE; - LLParcel* agent_parcel = gParcelMgr->getAgentParcel(); + LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (agent_parcel) { can_build = agent_parcel->getAllowModify(); @@ -1997,7 +2038,7 @@ BOOL enable_object_build(void*) if (gAgent.inPrelude()) return FALSE; BOOL can_build = FALSE; - LLParcel* agent_parcel = gParcelMgr->getAgentParcel(); + LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (agent_parcel) { can_build = agent_parcel->getAllowModify(); @@ -2118,7 +2159,7 @@ class LLObjectMute : public view_listener_t // it's an object id = object->getID(); - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node) { name = node->mName; @@ -2128,13 +2169,13 @@ class LLObjectMute : public view_listener_t } LLMute mute(id, name, type); - if (gMuteListp->isMuted(mute.mID, mute.mName)) + if (LLMuteList::getInstance()->isMuted(mute.mID, mute.mName)) { - gMuteListp->remove(mute); + LLMuteList::getInstance()->remove(mute); } else { - gMuteListp->add(mute); + LLMuteList::getInstance()->add(mute); LLFloaterMute::showInstance(); } @@ -2155,7 +2196,7 @@ bool handle_go_to() strings.push_back(val); send_generic_message("autopilot", strings); - gParcelMgr->deselectLand(); + LLViewerParcelMgr::getInstance()->deselectLand(); if (gAgent.getAvatarObject() && !gSavedSettings.getBOOL("AutoPilotLocksCamera")) { @@ -2224,10 +2265,23 @@ class LLAvatarFreeze : public view_listener_t if( avatar ) { LLUUID* avatar_id = new LLUUID( avatar->getID() ); + LLString fullname = avatar->getFullname(); - gViewerWindow->alertXml("FreezeAvatar", - callback_freeze, (void*)avatar_id); - + if (!fullname.empty()) + { + LLString::format_map_t args; + args["[AVATAR_NAME]"] = fullname; + gViewerWindow->alertXml("FreezeAvatarFullname", + args, + callback_freeze, + (void*)avatar_id); + } + else + { + gViewerWindow->alertXml("FreezeAvatar", + callback_freeze, + (void*)avatar_id); + } } return true; } @@ -2313,9 +2367,23 @@ class LLAvatarEject : public view_listener_t if( avatar ) { LLUUID* avatar_id = new LLUUID( avatar->getID() ); - gViewerWindow->alertXml("EjectAvatar", - callback_eject, (void*)avatar_id); - + LLString fullname = avatar->getFullname(); + + if (!fullname.empty()) + { + LLString::format_map_t args; + args["[AVATAR_NAME]"] = fullname; + gViewerWindow->alertXml("EjectAvatarFullname", + args, + callback_eject, + (void*)avatar_id); + } + else + { + gViewerWindow->alertXml("EjectAvatar", + callback_eject, + (void*)avatar_id); + } } return true; } @@ -2484,9 +2552,9 @@ BOOL enable_buy(void*) { // In order to buy, there must only be 1 purchaseable object in // the selection manger. - if(gSelectMgr->getSelection()->getRootObjectCount() != 1) return FALSE; + if(LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() != 1) return FALSE; LLViewerObject* obj = NULL; - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if(node) { obj = node->getObject(); @@ -2515,7 +2583,7 @@ class LLObjectEnableBuy : public view_listener_t // received by the viewer and cached in the selection manager. void handle_buy_object(LLSaleInfo sale_info) { - if(!gSelectMgr->selectGetAllRootsValid()) + if(!LLSelectMgr::getInstance()->selectGetAllRootsValid()) { LLNotifyBox::showXml("UnableToBuyWhileDownloading"); return; @@ -2523,7 +2591,7 @@ void handle_buy_object(LLSaleInfo sale_info) LLUUID owner_id; LLString owner_name; - BOOL owners_identical = gSelectMgr->selectGetOwner(owner_id, owner_name); + BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); if (!owners_identical) { LLNotifyBox::showXml("CannotBuyObjectsFromDifferentOwners"); @@ -2531,9 +2599,9 @@ void handle_buy_object(LLSaleInfo sale_info) } LLPermissions perm; - BOOL valid = gSelectMgr->selectGetPermissions(perm); + BOOL valid = LLSelectMgr::getInstance()->selectGetPermissions(perm); LLAggregatePermissions ag_perm; - valid &= gSelectMgr->selectGetAggregatePermissions(ag_perm); + valid &= LLSelectMgr::getInstance()->selectGetAggregatePermissions(ag_perm); if(!valid || !sale_info.isForSale() || !perm.allowTransferTo(gAgent.getID())) { LLNotifyBox::showXml("ObjectNotForSale"); @@ -2670,14 +2738,14 @@ void set_god_level(U8 god_level) U8 old_god_level = gAgent.getGodLevel(); gAgent.setGodLevel( god_level ); gIMMgr->refresh(); - gParcelMgr->notifyObservers(); + LLViewerParcelMgr::getInstance()->notifyObservers(); // Some classifieds change visibility on god mode LLFloaterDirectory::requestClassifieds(); // God mode changes sim visibility - gWorldMap->reset(); - gWorldMap->setCurrentLayer(0); + LLWorldMap::getInstance()->reset(); + LLWorldMap::getInstance()->setCurrentLayer(0); // inventory in items may change in god mode gObjectList.dirtyAllObjectInventory(); @@ -2943,7 +3011,7 @@ class LLLandSit : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); - gParcelMgr->deselectLand(); + LLViewerParcelMgr::getInstance()->deselectLand(); LLVector3d posGlobal = gLastHitPosGlobal; @@ -3043,7 +3111,7 @@ void create_new_landmark(void*) llwarns << "No agent region" << llendl; return; } - LLParcel* agent_parcel = gParcelMgr->getAgentParcel(); + LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (!agent_parcel) { llwarns << "No agent parcel" << llendl; @@ -3083,7 +3151,7 @@ void landmark_menu_action(void* userdata) void reload_ui(void *) { - gUICtrlFactory->rebuild(); + LLUICtrlFactory::getInstance()->rebuild(); } class LLWorldFly : public view_listener_t @@ -3106,7 +3174,7 @@ void handle_agent_stop_moving(void*) void print_packets_lost(void*) { - gWorldPointer->printPacketsLost(); + LLWorld::getInstance()->printPacketsLost(); } @@ -3155,7 +3223,7 @@ void velocity_interpolate( void* data ) void update_fov(S32 increments) { - F32 old_fov = gCamera->getDefaultFOV(); + F32 old_fov = LLViewerCamera::getInstance()->getDefaultFOV(); // for each increment, FoV is 20% bigger F32 new_fov = old_fov * pow(1.2f, increments); @@ -3178,8 +3246,8 @@ void update_fov(S32 increments) gAgent.sendReliableMessage(); // force agent to update dirty patches - gCamera->setDefaultFOV(new_fov); - gCamera->setView(new_fov); + LLViewerCamera::getInstance()->setDefaultFOV(new_fov); + LLViewerCamera::getInstance()->setView(new_fov); } } @@ -3205,7 +3273,7 @@ class LLViewZoomDefault : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - F32 old_fov = gCamera->getView(); + F32 old_fov = LLViewerCamera::getInstance()->getView(); // for each increment, FoV is 20% bigger F32 new_fov = DEFAULT_FIELD_OF_VIEW; @@ -3224,8 +3292,8 @@ class LLViewZoomDefault : public view_listener_t gAgent.sendReliableMessage(); // force agent to update dirty patches - gCamera->setDefaultFOV(new_fov); - gCamera->setView(new_fov); + LLViewerCamera::getInstance()->setDefaultFOV(new_fov); + LLViewerCamera::getInstance()->setView(new_fov); } return true; } @@ -3262,17 +3330,6 @@ void handle_show_newest_map(void*) // Help menu functions //------------------------------------------------------------------- -class LLHelpMOTD : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - LLString::format_map_t args; - args["[MOTD]"] = gAgent.mMOTD; - gViewerWindow->alertXml("MOTD", args, NULL, NULL); - return true; - } -}; - // // Major mode switching // @@ -3310,9 +3367,15 @@ void reset_view_final( BOOL proceed, void* ) gAgent.changeCameraToDefault(); - if (LLViewerJoystick::sOverrideCamera) + if (LLViewerJoystick::getInstance()->getOverrideCamera()) { - handle_toggle_flycam(NULL); + handle_toggle_flycam(); + } + + // reset avatar mode from eventual residual motion + if (LLToolMgr::getInstance()->inBuildMode()) + { + LLViewerJoystick::getInstance()->moveAvatar(true); } gAgent.resetView(!gFloaterTools->getVisible()); @@ -3321,7 +3384,7 @@ void reset_view_final( BOOL proceed, void* ) gViewerWindow->showCursor(); // Switch back to basic toolset - gToolMgr->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); } class LLViewLookAtLastChatter : public view_listener_t @@ -3394,7 +3457,7 @@ class LLEditEnableDuplicate : public view_listener_t void disabled_duplicate(void*) { - if (gSelectMgr->getSelection()->getFirstObject()) + if (LLSelectMgr::getInstance()->getSelection()->getFirstObject()) { LLNotifyBox::showXml("CopyFailed"); } @@ -3405,32 +3468,32 @@ void handle_duplicate_in_place(void*) llinfos << "handle_duplicate_in_place" << llendl; LLVector3 offset(0.f, 0.f, 0.f); - gSelectMgr->selectDuplicate(offset, TRUE); + LLSelectMgr::getInstance()->selectDuplicate(offset, TRUE); } void handle_repeat_duplicate(void*) { - gSelectMgr->repeatDuplicate(); + LLSelectMgr::getInstance()->repeatDuplicate(); } void handle_deed_object_to_group(void*) { LLUUID group_id; - gSelectMgr->selectGetGroup(group_id); - gSelectMgr->sendOwner(LLUUID::null, group_id, FALSE); - gViewerStats->incStat(LLViewerStats::ST_RELEASE_COUNT); + LLSelectMgr::getInstance()->selectGetGroup(group_id); + LLSelectMgr::getInstance()->sendOwner(LLUUID::null, group_id, FALSE); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_RELEASE_COUNT); } BOOL enable_deed_object_to_group(void*) { - if(gSelectMgr->getSelection()->isEmpty()) return FALSE; + if(LLSelectMgr::getInstance()->getSelection()->isEmpty()) return FALSE; LLPermissions perm; LLUUID group_id; - if (gSelectMgr->selectGetGroup(group_id) && + if (LLSelectMgr::getInstance()->selectGetGroup(group_id) && gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && - gSelectMgr->selectGetPermissions(perm) && + LLSelectMgr::getInstance()->selectGetPermissions(perm) && perm.deedToGroup(gAgent.getID(), group_id)) { return TRUE; @@ -3483,8 +3546,8 @@ void handle_object_owner_permissive(void*) if(gAgent.isGodlike()) { // do the objects. - gSelectMgr->selectionSetObjectPermissions(PERM_BASE, TRUE, PERM_ALL, TRUE); - gSelectMgr->selectionSetObjectPermissions(PERM_OWNER, TRUE, PERM_ALL, TRUE); + LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_BASE, TRUE, PERM_ALL, TRUE); + LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, TRUE, PERM_ALL, TRUE); } } @@ -3493,14 +3556,14 @@ void handle_object_owner_self(void*) // only send this if they're a god. if(gAgent.isGodlike()) { - gSelectMgr->sendOwner(gAgent.getID(), gAgent.getGroupID(), TRUE); + LLSelectMgr::getInstance()->sendOwner(gAgent.getID(), gAgent.getGroupID(), TRUE); } } // Shortcut to set owner permissions to not editable. void handle_object_lock(void*) { - gSelectMgr->selectionSetObjectPermissions(PERM_OWNER, FALSE, PERM_MODIFY); + LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, FALSE, PERM_MODIFY); } void handle_object_asset_ids(void*) @@ -3508,23 +3571,23 @@ void handle_object_asset_ids(void*) // only send this if they're a god. if (gAgent.isGodlike()) { - gSelectMgr->sendGodlikeRequest("objectinfo", "assetids"); + LLSelectMgr::getInstance()->sendGodlikeRequest("objectinfo", "assetids"); } } void handle_force_parcel_owner_to_me(void*) { - gParcelMgr->sendParcelGodForceOwner( gAgent.getID() ); + LLViewerParcelMgr::getInstance()->sendParcelGodForceOwner( gAgent.getID() ); } void handle_force_parcel_to_content(void*) { - gParcelMgr->sendParcelGodForceToContent(); + LLViewerParcelMgr::getInstance()->sendParcelGodForceToContent(); } void handle_claim_public_land(void*) { - if (gParcelMgr->getSelectionRegion() != gAgent.getRegion()) + if (LLViewerParcelMgr::getInstance()->getSelectionRegion() != gAgent.getRegion()) { LLNotifyBox::showXml("ClaimPublicLand"); return; @@ -3532,7 +3595,7 @@ void handle_claim_public_land(void*) LLVector3d west_south_global; LLVector3d east_north_global; - gParcelMgr->getSelection(west_south_global, east_north_global); + LLViewerParcelMgr::getInstance()->getSelection(west_south_global, east_north_global); LLVector3 west_south = gAgent.getPosAgentFromGlobal(west_south_global); LLVector3 east_north = gAgent.getPosAgentFromGlobal(east_north_global); @@ -3565,7 +3628,7 @@ void handle_god_request_havok(void *) { if (gAgent.isGodlike()) { - gSelectMgr->sendGodlikeRequest("havok", "infoverbose"); + LLSelectMgr::getInstance()->sendGodlikeRequest("havok", "infoverbose"); } } @@ -3573,7 +3636,7 @@ void handle_god_request_havok(void *) //{ // if (gAgent.isGodlike()) // { -// gSelectMgr->sendGodlikeRequest(GOD_WANTS_FOO); +// LLSelectMgr::getInstance()->sendGodlikeRequest(GOD_WANTS_FOO); // } //} @@ -3581,7 +3644,7 @@ void handle_god_request_havok(void *) //{ // if (gAgent.isGodlike()) // { -// gSelectMgr->sendGodlikeRequest("terrain", "save"); +// LLSelectMgr::getInstance()->sendGodlikeRequest("terrain", "save"); // } //} @@ -3589,7 +3652,7 @@ void handle_god_request_havok(void *) //{ // if (gAgent.isGodlike()) // { -// gSelectMgr->sendGodlikeRequest("terrain", "load"); +// LLSelectMgr::getInstance()->sendGodlikeRequest("terrain", "load"); // } //} @@ -3599,7 +3662,7 @@ void handle_god_request_avatar_geometry(void *) { if (gAgent.isGodlike()) { - gSelectMgr->sendGodlikeRequest("avatar toggle", NULL); + LLSelectMgr::getInstance()->sendGodlikeRequest("avatar toggle", NULL); } } @@ -3624,8 +3687,8 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) // Check conditions that we can't deal with, building a list of // everything that we'll actually be derezzing. LLViewerRegion* first_region = NULL; - for (LLObjectSelection::valid_root_iterator iter = gSelectMgr->getSelection()->valid_root_begin(); - iter != gSelectMgr->getSelection()->valid_root_end(); iter++) + for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++) { LLSelectNode* node = *iter; LLViewerObject* object = node->getObject(); @@ -3742,7 +3805,7 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID()); // VEFFECT: DerezObject - LLHUDEffectSpiral* effectp = (LLHUDEffectSpiral*)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); + LLHUDEffectSpiral* effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); effectp->setPositionGlobal(object->getPositionGlobal()); effectp->setColor(LLColor4U(gAgent.getEffectColor())); } @@ -3767,7 +3830,7 @@ class LLToolsTakeCopy : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if (gSelectMgr->getSelection()->isEmpty()) return true; + if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return true; const LLUUID& category_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_OBJECT); derez_objects(DRD_ACQUIRE_TO_AGENT_INVENTORY, category_id); @@ -3782,9 +3845,9 @@ class LLObjectReturn : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if (gSelectMgr->getSelection()->isEmpty()) return true; + if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return true; - mObjectSelection = gSelectMgr->getEditSelection(); + mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); gViewerWindow->alertXml("ReturnToOwner", onReturnToOwner, @@ -3847,7 +3910,7 @@ class LLObjectEnableReturn : public view_listener_t } } func; const bool firstonly = true; - new_value = gSelectMgr->getSelection()->applyToRootObjects(&func, firstonly); + new_value = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); } } } @@ -3859,7 +3922,7 @@ class LLObjectEnableReturn : public view_listener_t void force_take_copy(void*) { - if (gSelectMgr->getSelection()->isEmpty()) return; + if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return; const LLUUID& category_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_OBJECT); derez_objects(DRD_FORCE_TO_GOD_INVENTORY, category_id); } @@ -3868,7 +3931,7 @@ void handle_take() { // we want to use the folder this was derezzed from if it's // available. Otherwise, derez to the normal place. - if(gSelectMgr->getSelection()->isEmpty()) + if(LLSelectMgr::getInstance()->getSelection()->isEmpty()) { return; } @@ -3877,8 +3940,8 @@ void handle_take() BOOL locked_but_takeable_object = FALSE; LLUUID category_id; - for (LLObjectSelection::root_iterator iter = gSelectMgr->getSelection()->root_begin(); - iter != gSelectMgr->getSelection()->root_end(); iter++) + for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) { LLSelectNode* node = *iter; LLViewerObject* object = node->getObject(); @@ -3994,8 +4057,8 @@ BOOL enable_take() return FALSE; } - for (LLObjectSelection::valid_root_iterator iter = gSelectMgr->getSelection()->valid_root_begin(); - iter != gSelectMgr->getSelection()->valid_root_end(); iter++) + for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++) { LLSelectNode* node = *iter; LLViewerObject* object = node->getObject(); @@ -4030,7 +4093,7 @@ class LLToolsBuyOrTake : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if (gSelectMgr->getSelection()->isEmpty()) + if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) { return true; } @@ -4109,8 +4172,8 @@ class LLToolsEnableBuyOrTake : public view_listener_t // FALSE if selection is a 'take' BOOL is_selection_buy_not_take() { - for (LLObjectSelection::root_iterator iter = gSelectMgr->getSelection()->root_begin(); - iter != gSelectMgr->getSelection()->root_end(); iter++) + for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) { LLSelectNode* node = *iter; LLViewerObject* obj = node->getObject(); @@ -4127,8 +4190,8 @@ BOOL is_selection_buy_not_take() S32 selection_price() { S32 total_price = 0; - for (LLObjectSelection::root_iterator iter = gSelectMgr->getSelection()->root_begin(); - iter != gSelectMgr->getSelection()->root_end(); iter++) + for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) { LLSelectNode* node = *iter; LLViewerObject* obj = node->getObject(); @@ -4181,10 +4244,10 @@ void handle_buy_currency(void*) void handle_buy(void*) { - if (gSelectMgr->getSelection()->isEmpty()) return; + if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return; LLSaleInfo sale_info; - BOOL valid = gSelectMgr->selectGetSaleInfo(sale_info); + BOOL valid = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info); if (!valid) return; if (sale_info.getSaleType() == LLSaleInfo::FS_CONTENTS) @@ -4208,7 +4271,7 @@ class LLObjectBuy : public view_listener_t BOOL sitting_on_selection() { - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (!node) { return FALSE; @@ -4251,14 +4314,11 @@ class LLToolsSaveToObjectInventory : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if(gSelectMgr) + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); + if(node && (node->mValid) && (!node->mFromTaskID.isNull())) { - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); - if(node && (node->mValid) && (!node->mFromTaskID.isNull())) - { - // *TODO: check to see if the fromtaskid object exists. - derez_objects(DRD_SAVE_INTO_TASK_INVENTORY, node->mFromTaskID); - } + // *TODO: check to see if the fromtaskid object exists. + derez_objects(DRD_SAVE_INTO_TASK_INVENTORY, node->mFromTaskID); } return true; } @@ -4271,8 +4331,8 @@ class LLToolsSnapObjectXY : public view_listener_t { F64 snap_size = (F64)gSavedSettings.getF32("GridResolution"); - for (LLObjectSelection::root_iterator iter = gSelectMgr->getSelection()->root_begin(); - iter != gSelectMgr->getSelection()->root_end(); iter++) + for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) { LLSelectNode* node = *iter; LLViewerObject* obj = node->getObject(); @@ -4306,7 +4366,7 @@ class LLToolsSnapObjectXY : public view_listener_t obj->setPositionGlobal(pos_global, FALSE); } } - gSelectMgr->sendMultipleUpdate(UPD_POSITION); + LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION); return true; } }; @@ -4330,7 +4390,7 @@ class LLToolsEnableLink : public view_listener_t // in component mode, can't link if (!gSavedSettings.getBOOL("EditLinkedParts")) { - if(gSelectMgr->selectGetAllRootsValid() && gSelectMgr->getSelection()->getRootObjectCount() >= 2) + if(LLSelectMgr::getInstance()->selectGetAllRootsValid() && LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() >= 2) { struct f : public LLSelectedObjectFunctor { @@ -4340,7 +4400,7 @@ class LLToolsEnableLink : public view_listener_t } } func; const bool firstonly = true; - new_value = gSelectMgr->getSelection()->applyToRootObjects(&func, firstonly); + new_value = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); } } gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); @@ -4352,13 +4412,13 @@ class LLToolsLink : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if(!gSelectMgr->selectGetAllRootsValid()) + if(!LLSelectMgr::getInstance()->selectGetAllRootsValid()) { LLNotifyBox::showXml("UnableToLinkWhileDownloading"); return true; } - S32 object_count = gSelectMgr->getSelection()->getObjectCount(); + S32 object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); if (object_count > MAX_CHILDREN_PER_TASK + 1) { LLStringBase::format_map_t args; @@ -4369,19 +4429,19 @@ class LLToolsLink : public view_listener_t return true; } - if(gSelectMgr->getSelection()->getRootObjectCount() < 2) + if(LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() < 2) { gViewerWindow->alertXml("CannotLinkIncompleteSet"); return true; } - if(!gSelectMgr->selectGetRootsModify()) + if(!LLSelectMgr::getInstance()->selectGetRootsModify()) { gViewerWindow->alertXml("CannotLinkModify"); return true; } LLUUID owner_id; LLString owner_name; - if(!gSelectMgr->selectGetOwner(owner_id, owner_name)) + if(!LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name)) { // 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 @@ -4389,7 +4449,7 @@ class LLToolsLink : public view_listener_t gViewerWindow->alertXml("CannotLinkDifferentOwners"); return true; } - gSelectMgr->sendLink(); + LLSelectMgr::getInstance()->sendLink(); return true; } }; @@ -4398,9 +4458,9 @@ class LLToolsEnableUnlink : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gSelectMgr->selectGetAllRootsValid() && - gSelectMgr->getSelection()->getFirstEditableObject() && - !gSelectMgr->getSelection()->getFirstEditableObject()->isAttachment(); + bool new_value = LLSelectMgr::getInstance()->selectGetAllRootsValid() && + LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() && + !LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject()->isAttachment(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4410,7 +4470,7 @@ class LLToolsUnlink : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - gSelectMgr->sendDelink(); + LLSelectMgr::getInstance()->sendDelink(); return true; } }; @@ -4433,32 +4493,32 @@ class LLToolsStopAllAnimations : public view_listener_t //void handle_hinge(void*) //{ -// gSelectMgr->sendHinge(1); +// LLSelectMgr::getInstance()->sendHinge(1); //} //void handle_ptop(void*) //{ -// gSelectMgr->sendHinge(2); +// LLSelectMgr::getInstance()->sendHinge(2); //} //void handle_lptop(void*) //{ -// gSelectMgr->sendHinge(3); +// LLSelectMgr::getInstance()->sendHinge(3); //} //void handle_wheel(void*) //{ -// gSelectMgr->sendHinge(4); +// LLSelectMgr::getInstance()->sendHinge(4); //} //void handle_dehinge(void*) //{ -// gSelectMgr->sendDehinge(); +// LLSelectMgr::getInstance()->sendDehinge(); //} //BOOL enable_dehinge(void*) //{ -// LLViewerObject* obj = gSelectMgr->getSelection()->getFirstEditableObject(); +// LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject(); // return obj && !obj->isAttachment(); //} @@ -4572,7 +4632,7 @@ class LLObjectEnableDelete : public view_listener_t (!LLAppViewer::instance()->isInProductionGrid() && gAgent.isGodlike()) || # endif - (gSelectMgr && gSelectMgr->canDoDelete()); + LLSelectMgr::getInstance()->canDoDelete(); #endif gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; @@ -4592,9 +4652,9 @@ class LLObjectDelete : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if (gSelectMgr) + if (LLSelectMgr::getInstance()) { - gSelectMgr->doDelete(); + LLSelectMgr::getInstance()->doDelete(); } // and close any pie/context menus when done @@ -4609,7 +4669,7 @@ class LLObjectDelete : public view_listener_t void handle_force_delete(void*) { - gSelectMgr->selectForceDelete(); + LLSelectMgr::getInstance()->selectForceDelete(); } class LLViewEnableLastChatter : public view_listener_t @@ -4717,7 +4777,7 @@ class LLEditRedo : public view_listener_t void print_object_info(void*) { - gSelectMgr->selectionDump(); + LLSelectMgr::getInstance()->selectionDump(); } void print_agent_nvpairs(void*) @@ -4761,6 +4821,8 @@ void show_debug_menus() //gMenuBarView->setItemVisible(LLString("DebugOptions"), visible); //gMenuBarView->setItemVisible(LLString(AVI_TOOLS), visible); + + gMenuBarView->arrange(); // clean-up positioning }; } @@ -4795,7 +4857,7 @@ LLUploadDialog *gExportDialog = NULL; void handle_export_selected( void * ) { - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (selection->isEmpty()) { return; @@ -4829,13 +4891,13 @@ void handle_export_selected( void * ) BOOL menu_check_build_tool( void* user_data ) { S32 index = (intptr_t) user_data; - return gToolMgr->getCurrentToolset()->isToolSelected( index ); + return LLToolMgr::getInstance()->getCurrentToolset()->isToolSelected( index ); } void handle_reload_settings(void*) { gSavedSettings.resetToDefaults(); - gSavedSettings.loadFromFile(gSettingsFileName, TRUE); + gSavedSettings.loadFromFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); llinfos << "Loading colors from colors.xml" << llendl; std::string color_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"colors.xml"); @@ -4868,23 +4930,22 @@ class LLWorldAlwaysRun : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { + // as well as altering the default walk-vs-run state, + // we also change the *current* walk-vs-run state. if (gAgent.getAlwaysRun()) { gAgent.clearAlwaysRun(); + gAgent.clearRunning(); } else { gAgent.setAlwaysRun(); + gAgent.setRunning(); } - LLMessageSystem *msg = gMessageSystem; + // tell the simulator. + gAgent.sendWalkRun(gAgent.getAlwaysRun()); - msg->newMessageFast(_PREHASH_SetAlwaysRun); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addBOOLFast(_PREHASH_AlwaysRun, gAgent.getAlwaysRun() ); - gAgent.sendReliableMessage(); return true; } }; @@ -4943,7 +5004,7 @@ class LLWorldCreateLandmark : public view_listener_t llwarns << "No agent region" << llendl; return true; } - LLParcel* agent_parcel = gParcelMgr->getAgentParcel(); + LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (!agent_parcel) { llwarns << "No agent parcel" << llendl; @@ -4978,24 +5039,24 @@ class LLToolsLookAtSelection : public view_listener_t { const F32 PADDING_FACTOR = 2.f; BOOL zoom = (userdata.asString() == "zoom"); - if (!gSelectMgr->getSelection()->isEmpty()) + if (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) { gAgent.setFocusOnAvatar(FALSE, ANIMATE); - LLBBox selection_bbox = gSelectMgr->getBBoxOfSelection(); - F32 angle_of_view = llmax(0.1f, gCamera->getAspect() > 1.f ? gCamera->getView() * gCamera->getAspect() : gCamera->getView()); + LLBBox selection_bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); + F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView()); F32 distance = selection_bbox.getExtentLocal().magVec() * PADDING_FACTOR / atan(angle_of_view); - LLVector3 obj_to_cam = gCamera->getOrigin() - selection_bbox.getCenterAgent(); + LLVector3 obj_to_cam = LLViewerCamera::getInstance()->getOrigin() - selection_bbox.getCenterAgent(); obj_to_cam.normVec(); if (zoom) { - gAgent.setCameraPosAndFocusGlobal(gSelectMgr->getSelectionCenterGlobal() + LLVector3d(obj_to_cam * distance), gSelectMgr->getSelectionCenterGlobal(), gSelectMgr->getSelection()->getFirstObject()->mID ); + gAgent.setCameraPosAndFocusGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal() + LLVector3d(obj_to_cam * distance), LLSelectMgr::getInstance()->getSelectionCenterGlobal(), LLSelectMgr::getInstance()->getSelection()->getFirstObject()->mID ); } else { - gAgent.setFocusGlobal( gSelectMgr->getSelectionCenterGlobal(), gSelectMgr->getSelection()->getFirstObject()->mID ); + gAgent.setFocusGlobal( LLSelectMgr::getInstance()->getSelectionCenterGlobal(), LLSelectMgr::getInstance()->getSelection()->getFirstObject()->mID ); } } return true; @@ -5091,7 +5152,7 @@ void complete_give_money(S32 option, void* user_data) bool handle_give_money_dialog() { - LLObjectSelectionHandle* handlep = new LLObjectSelectionHandle(gSelectMgr->getSelection()); + LLObjectSelectionHandle* handlep = new LLObjectSelectionHandle(LLSelectMgr::getInstance()->getSelection()); if (gAgent.getBusy()) { // warn users of being in busy mode during a transaction @@ -5167,7 +5228,7 @@ class LLObjectEnableSitOrStand : public view_listener_t } else { - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node && node->mValid && !node->mSitName.empty()) { label.assign(node->mSitName); @@ -5190,12 +5251,7 @@ void edit_ui(void*) void dump_select_mgr(void*) { - gSelectMgr->dump(); -} - -void dump_volume_mgr(void*) -{ - gVolumeMgr->dump(); + LLSelectMgr::getInstance()->dump(); } void dump_inventory(void*) @@ -5207,7 +5263,7 @@ void dump_inventory(void*) void handle_force_unlock(void*) { // First, make it public. - gSelectMgr->sendOwner(LLUUID::null, LLUUID::null, TRUE); + LLSelectMgr::getInstance()->sendOwner(LLUUID::null, LLUUID::null, TRUE); // Second, lie to the viewer and mark it editable and unowned @@ -5224,7 +5280,7 @@ void handle_force_unlock(void*) return true; } } func; - gSelectMgr->getSelection()->applyToObjects(&func); + LLSelectMgr::getInstance()->getSelection()->applyToObjects(&func); } void handle_dump_followcam(void*) @@ -5232,21 +5288,6 @@ void handle_dump_followcam(void*) LLFollowCamMgr::dump(); } -BOOL check_flycam(void*) -{ - return LLViewerJoystick::sOverrideCamera; -} - -void handle_toggle_flycam(void*) -{ - LLViewerJoystick::sOverrideCamera = !LLViewerJoystick::sOverrideCamera; - if (LLViewerJoystick::sOverrideCamera) - { - LLViewerJoystick::updateCamera(TRUE); - LLFloaterJoystick::show(NULL); - } -} - void handle_viewer_enable_message_log(void*) { gMessageSystem->startLogging(); @@ -5304,11 +5345,11 @@ class LLShowFloater : public view_listener_t } else if (floater_name == "camera controls") { - LLFloaterCamera::toggle(NULL); + LLFloaterCamera::toggleInstance(); } else if (floater_name == "movement controls") { - LLFloaterMove::show(NULL); + LLFloaterMove::toggleInstance(); } else if (floater_name == "world map") { @@ -5320,7 +5361,7 @@ class LLShowFloater : public view_listener_t } else if (floater_name == "stat bar") { - gDebugView->mStatViewp->setVisible(!gDebugView->mStatViewp->getVisible()); + gDebugView->mFloaterStatsp->setVisible(!gDebugView->mFloaterStatsp->getVisible()); } else if (floater_name == "my land") { @@ -5328,21 +5369,21 @@ class LLShowFloater : public view_listener_t } else if (floater_name == "about land") { - if (gParcelMgr->selectionEmpty()) + if (LLViewerParcelMgr::getInstance()->selectionEmpty()) { - gParcelMgr->selectParcelAt(gAgent.getPositionGlobal()); + LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal()); } LLFloaterLand::showInstance(); } else if (floater_name == "buy land") { - if (gParcelMgr->selectionEmpty()) + if (LLViewerParcelMgr::getInstance()->selectionEmpty()) { - gParcelMgr->selectParcelAt(gAgent.getPositionGlobal()); + LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal()); } - gParcelMgr->startBuyLand(); + LLViewerParcelMgr::getInstance()->startBuyLand(); } else if (floater_name == "about region") { @@ -5360,6 +5401,10 @@ class LLShowFloater : public view_listener_t { gViewerHtmlHelp.show(); } + else if (floater_name == "help tutorial") + { + LLFloaterHUD::show(); + } else if (floater_name == "complaint reporter") { // Prevent menu from appearing in screen shot. @@ -5375,7 +5420,7 @@ class LLShowFloater : public view_listener_t } else if (floater_name == "lag meter") { - LLFloaterLagMeter::show(NULL); + LLFloaterLagMeter::showInstance(); } else if (floater_name == "bug reporter") { @@ -5428,15 +5473,15 @@ class LLFloaterVisible : public view_listener_t } else if (floater_name == "camera controls") { - new_value = LLFloaterCamera::visible(NULL); + new_value = LLFloaterCamera::instanceVisible(); } else if (floater_name == "movement controls") { - new_value = LLFloaterMove::visible(NULL); + new_value = LLFloaterMove::instanceVisible(); } else if (floater_name == "stat bar") { - new_value = gDebugView->mStatViewp->getVisible(); + new_value = gDebugView->mFloaterStatsp->getVisible(); } else if (floater_name == "active speakers") { @@ -5585,8 +5630,8 @@ void handle_focus(void *) gViewerWindow->moveCursorToCenter(); // Switch to camera toolset -// gToolMgr->setCurrentToolset(gCameraToolset); - gToolMgr->getCurrentToolset()->selectTool( gToolCamera ); +// LLToolMgr::getInstance()->setCurrentToolset(gCameraToolset); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCamera::getInstance() ); } class LLLandEdit : public view_listener_t @@ -5609,13 +5654,13 @@ class LLLandEdit : public view_listener_t } - gParcelMgr->selectParcelAt( gLastHitPosGlobal ); + LLViewerParcelMgr::getInstance()->selectParcelAt( gLastHitPosGlobal ); gFloaterTools->showMore(TRUE); gFloaterView->bringToFront( gFloaterTools ); // Switch to land edit toolset - gToolMgr->getCurrentToolset()->selectTool( gToolParcel ); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolSelectLand::getInstance() ); return true; } }; @@ -5624,10 +5669,10 @@ class LLWorldEnableBuyLand : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gParcelMgr->canAgentBuyParcel( - gParcelMgr->selectionEmpty() - ? gParcelMgr->getAgentParcel() - : gParcelMgr->getParcelSelection()->getParcel(), + bool new_value = LLViewerParcelMgr::getInstance()->canAgentBuyParcel( + LLViewerParcelMgr::getInstance()->selectionEmpty() + ? LLViewerParcelMgr::getInstance()->getAgentParcel() + : LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(), false); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; @@ -5636,8 +5681,8 @@ class LLWorldEnableBuyLand : public view_listener_t BOOL enable_buy_land(void*) { - return gParcelMgr->canAgentBuyParcel( - gParcelMgr->getParcelSelection()->getParcel(), false); + return LLViewerParcelMgr::getInstance()->canAgentBuyParcel( + LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(), false); } @@ -5658,8 +5703,8 @@ void handle_move(void*) gViewerWindow->moveCursorToCenter(); - gToolMgr->setCurrentToolset(gBasicToolset); - gToolMgr->getCurrentToolset()->selectTool( gToolGrab ); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() ); } class LLObjectAttachToAvatar : public view_listener_t @@ -5670,7 +5715,7 @@ public: private: bool handleEvent(LLPointer event, const LLSD& userdata) { - setObjectSelection(gSelectMgr->getSelection()); + setObjectSelection(LLSelectMgr::getInstance()->getSelection()); LLViewerObject* selectedObject = sObjectSelection->getFirstRootObject(); if (selectedObject) { @@ -5713,7 +5758,7 @@ void near_attach_object(BOOL success, void *user_data) // interpret 0 as "default location" attachment_id = 0; } - gSelectMgr->sendAttach(attachment_id); + LLSelectMgr::getInstance()->sendAttach(attachment_id); } LLObjectAttachToAvatar::setObjectSelection(NULL); } @@ -5722,7 +5767,7 @@ void confirm_replace_attachment(S32 option, void* user_data) { if (option == 0/*YES*/) { - LLViewerObject* selectedObject = gSelectMgr->getSelection()->getFirstRootObject(); + LLViewerObject* selectedObject = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(); if (selectedObject) { const F32 MIN_STOP_DISTANCE = 1.f; // meters @@ -5789,7 +5834,7 @@ class LLAttachmentDrop : public view_listener_t // objects. Thus we need to clear the list, make sure it only // contains the object the user clicked, send the message, // then clear the list. - gSelectMgr->sendDropAttachment(); + LLSelectMgr::getInstance()->sendDropAttachment(); return true; } }; @@ -5892,9 +5937,9 @@ class LLAttachmentDetach : public view_listener_t // We use deselectAll to update the simulator's notion of what's // selected, and removeAll just to change things locally. //RN: I thought it was more useful to detach everything that was selected - if (gSelectMgr->getSelection()->isAttachment()) + if (LLSelectMgr::getInstance()->getSelection()->isAttachment()) { - gSelectMgr->sendDetach(); + LLSelectMgr::getInstance()->sendDetach(); } return true; } @@ -5922,7 +5967,7 @@ class LLAttachmentEnableDrop : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - LLParcel* parcel = gParcelMgr->getAgentParcel(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); BOOL can_build = gAgent.isGodlike() || (parcel && parcel->getAllowModify()); //Add an inventory observer to only allow dropping the newly attached item @@ -6011,11 +6056,7 @@ class LLAttachmentEnableDetach : public view_listener_t BOOL object_selected_and_point_valid(void *user_data) { //LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data; - if (gSelectMgr == NULL) - { - return FALSE; - } - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); for (LLObjectSelection::root_iterator iter = selection->root_begin(); iter != selection->root_end(); iter++) { @@ -6048,9 +6089,9 @@ BOOL object_is_wearable() { return FALSE; } - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); - for (LLObjectSelection::valid_root_iterator iter = gSelectMgr->getSelection()->valid_root_begin(); - iter != gSelectMgr->getSelection()->valid_root_end(); iter++) + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++) { LLSelectNode* node = *iter; if (node->mPermissions->getOwner() == gAgent.getID()) @@ -6150,7 +6191,7 @@ void queue_actions(LLFloaterScriptQueue* q, const std::string& noscriptmsg, cons // Apply until an object fails QueueObjects func(q); const bool firstonly = true; - bool fail = gSelectMgr->getSelection()->applyToObjects(&func, firstonly); + bool fail = LLSelectMgr::getInstance()->getSelection()->applyToObjects(&func, firstonly); if(fail) { if ( !func.scripted ) @@ -6228,8 +6269,8 @@ void handle_set_not_run_selection(void*) void handle_selected_texture_info(void*) { - for (LLObjectSelection::valid_iterator iter = gSelectMgr->getSelection()->valid_begin(); - iter != gSelectMgr->getSelection()->valid_end(); iter++) + for (LLObjectSelection::valid_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->valid_end(); iter++) { LLSelectNode* node = *iter; @@ -6397,14 +6438,14 @@ BOOL menu_check_variable( void* user_data) BOOL enable_land_selected( void* ) { - return gParcelMgr && !(gParcelMgr->selectionEmpty()); + return !(LLViewerParcelMgr::getInstance()->selectionEmpty()); } class LLSomethingSelected : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = !(gSelectMgr->getSelection()->isEmpty()); + bool new_value = !(LLSelectMgr::getInstance()->getSelection()->isEmpty()); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -6414,7 +6455,7 @@ class LLSomethingSelectedNoHUD : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); bool new_value = !(selection->isEmpty()) && !(selection->getSelectType() == SELECT_TYPE_HUD); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; @@ -6423,14 +6464,14 @@ class LLSomethingSelectedNoHUD : public view_listener_t BOOL enable_more_than_one_selected(void* ) { - return (gSelectMgr->getSelection()->getObjectCount() > 1); + return (LLSelectMgr::getInstance()->getSelection()->getObjectCount() > 1); } class LLEditableSelected : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = (gSelectMgr->getSelection()->getFirstEditableObject() != NULL); + bool new_value = (LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() != NULL); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -6441,7 +6482,7 @@ class LLToolsEnableTakeCopy : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { bool all_valid = false; - if (gSelectMgr) + if (LLSelectMgr::getInstance()) { all_valid = true; #ifndef HACKED_GODLIKE_VIEWER @@ -6458,7 +6499,7 @@ class LLToolsEnableTakeCopy : public view_listener_t } } func; const bool firstonly = true; - bool any_invalid = gSelectMgr->getSelection()->applyToRootObjects(&func, firstonly); + bool any_invalid = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); all_valid = !any_invalid; } #endif // HACKED_GODLIKE_VIEWER @@ -6471,7 +6512,7 @@ class LLToolsEnableTakeCopy : public view_listener_t BOOL enable_selection_you_own_all(void*) { - if (gSelectMgr) + if (LLSelectMgr::getInstance()) { struct f : public LLSelectedObjectFunctor { @@ -6481,7 +6522,7 @@ BOOL enable_selection_you_own_all(void*) } } func; const bool firstonly = true; - bool no_perms = gSelectMgr->getSelection()->applyToRootObjects(&func, firstonly); + bool no_perms = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); if (no_perms) { return FALSE; @@ -6492,7 +6533,7 @@ BOOL enable_selection_you_own_all(void*) BOOL enable_selection_you_own_one(void*) { - if (gSelectMgr) + if (LLSelectMgr::getInstance()) { struct f : public LLSelectedObjectFunctor { @@ -6502,7 +6543,7 @@ BOOL enable_selection_you_own_one(void*) } } func; const bool firstonly = true; - bool any_perms = gSelectMgr->getSelection()->applyToRootObjects(&func, firstonly); + bool any_perms = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); if (!any_perms) { return FALSE; @@ -6537,40 +6578,37 @@ bool LLHasAsset::operator()(LLInventoryCategory* cat, BOOL enable_save_into_inventory(void*) { - if(gSelectMgr) + // *TODO: clean this up + // find the last root + LLSelectNode* last_node = NULL; + for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) { - // *TODO: clean this up - // find the last root - LLSelectNode* last_node = NULL; - for (LLObjectSelection::root_iterator iter = gSelectMgr->getSelection()->root_begin(); - iter != gSelectMgr->getSelection()->root_end(); iter++) - { - last_node = *iter; - } + last_node = *iter; + } #ifdef HACKED_GODLIKE_VIEWER - return TRUE; + return TRUE; #else # ifdef TOGGLE_HACKED_GODLIKE_VIEWER - if (!LLAppViewer::instance()->isInProductionGrid() - && gAgent.isGodlike()) - { - return TRUE; - } + if (!LLAppViewer::instance()->isInProductionGrid() + && gAgent.isGodlike()) + { + return TRUE; + } # endif - // check all pre-req's for save into inventory. - if(last_node && last_node->mValid && !last_node->mItemID.isNull() - && (last_node->mPermissions->getOwner() == gAgent.getID()) - && (gInventory.getItem(last_node->mItemID) != NULL)) + // check all pre-req's for save into inventory. + if(last_node && last_node->mValid && !last_node->mItemID.isNull() + && (last_node->mPermissions->getOwner() == gAgent.getID()) + && (gInventory.getItem(last_node->mItemID) != NULL)) + { + LLViewerObject* obj = last_node->getObject(); + if( obj && !obj->isAttachment() ) { - LLViewerObject* obj = last_node->getObject(); - if( obj && !obj->isAttachment() ) - { - return TRUE; - } + return TRUE; } -#endif } +#endif return FALSE; } @@ -6586,17 +6624,14 @@ class LLToolsEnableSaveToInventory : public view_listener_t BOOL enable_save_into_task_inventory(void*) { - if(gSelectMgr) + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); + if(node && (node->mValid) && (!node->mFromTaskID.isNull())) { - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); - if(node && (node->mValid) && (!node->mFromTaskID.isNull())) + // *TODO: check to see if the fromtaskid object exists. + LLViewerObject* obj = node->getObject(); + if( obj && !obj->isAttachment() ) { - // *TODO: check to see if the fromtaskid object exists. - LLViewerObject* obj = node->getObject(); - if( obj && !obj->isAttachment() ) - { - return TRUE; - } + return TRUE; } } return FALSE; @@ -6620,7 +6655,7 @@ BOOL enable_not_thirdperson(void*) BOOL enable_export_selected(void *) { - if (gSelectMgr->getSelection()->isEmpty()) + if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) { return FALSE; } @@ -6651,7 +6686,7 @@ class LLToolsEnableToolNotPie : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = ( gToolMgr->getBaseTool() != gToolPie ); + bool new_value = ( LLToolMgr::getInstance()->getBaseTool() != LLToolPie::getInstance() ); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -6819,11 +6854,11 @@ class LLToolsEditLinkedParts : public view_listener_t BOOL select_individuals = gSavedSettings.getBOOL("EditLinkedParts"); if (select_individuals) { - gSelectMgr->demoteSelectionToIndividuals(); + LLSelectMgr::getInstance()->demoteSelectionToIndividuals(); } else { - gSelectMgr->promoteSelectionToRoot(); + LLSelectMgr::getInstance()->promoteSelectionToRoot(); } return true; } @@ -7043,17 +7078,17 @@ class LLToolsUseSelectionForGrid : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - gSelectMgr->clearGridObjects(); + LLSelectMgr::getInstance()->clearGridObjects(); struct f : public LLSelectedObjectFunctor { virtual bool apply(LLViewerObject* objectp) { - gSelectMgr->addGridObject(objectp); + LLSelectMgr::getInstance()->addGridObject(objectp); return true; } } func; - gSelectMgr->getSelection()->applyToRootObjects(&func); - gSelectMgr->setGridMode(GRID_MODE_REF_OBJECT); + LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func); + LLSelectMgr::getInstance()->setGridMode(GRID_MODE_REF_OBJECT); if (gFloaterTools) { gFloaterTools->mComboGridMode->setCurrentByIndex((S32)GRID_MODE_REF_OBJECT); @@ -7131,7 +7166,7 @@ void handle_save_to_xml(void*) if (picker.getSaveFile(LLFilePicker::FFSAVE_XML, default_name.c_str())) { LLString filename = picker.getFirstFile(); - gUICtrlFactory->saveToXML(frontmost, filename); + LLUICtrlFactory::getInstance()->saveToXML(frontmost, filename); } } @@ -7142,15 +7177,19 @@ void handle_load_from_xml(void*) { LLString filename = picker.getFirstFile(); LLFloater* floater = new LLFloater("sample_floater"); - gUICtrlFactory->buildFloater(floater, filename); + LLUICtrlFactory::getInstance()->buildFloater(floater, filename); } } void handle_slurl_test(void*) { - bool open_app_slurls = true; - bool open_links_externally = false; - LLFloaterHtml::getInstance()->show("http://secondlife.com/app/search/slurls.html", "SLURL Test", open_app_slurls, open_links_externally); + const bool open_links_externally = false; + const bool open_app_slurls = true; + LLFloaterHtml::getInstance()->show( + "http://secondlife.com/app/search/slurls.html", + "SLURL Test", + open_links_externally, + open_app_slurls); } void handle_rebake_textures(void*) @@ -7510,15 +7549,6 @@ class LLWorldChat : public view_listener_t } }; -class LLWorldStartGesture : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - handle_slash_key(NULL); - return true; - } -}; - class LLToolsSelectTool : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -7526,23 +7556,23 @@ class LLToolsSelectTool : public view_listener_t LLString tool_name = userdata.asString(); if (tool_name == "focus") { - gToolMgr->getCurrentToolset()->selectToolByIndex(1); + LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(1); } else if (tool_name == "move") { - gToolMgr->getCurrentToolset()->selectToolByIndex(2); + LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(2); } else if (tool_name == "edit") { - gToolMgr->getCurrentToolset()->selectToolByIndex(3); + LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(3); } else if (tool_name == "create") { - gToolMgr->getCurrentToolset()->selectToolByIndex(4); + LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(4); } else if (tool_name == "land") { - gToolMgr->getCurrentToolset()->selectToolByIndex(5); + LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(5); } return true; } @@ -7706,6 +7736,7 @@ void initialize_menus() // View menu addMenu(new LLViewMouselook(), "View.Mouselook"); addMenu(new LLViewBuildMode(), "View.BuildMode"); + addMenu(new LLViewJoystickFlycam(), "View.JoystickFlycam"); addMenu(new LLViewResetView(), "View.ResetView"); addMenu(new LLViewLookAtLastChatter(), "View.LookAtLastChatter"); addMenu(new LLViewShowHoverTips(), "View.ShowHoverTips"); @@ -7724,6 +7755,7 @@ void initialize_menus() addMenu(new LLViewEnableLastChatter(), "View.EnableLastChatter"); addMenu(new LLViewCheckBuildMode(), "View.CheckBuildMode"); + addMenu(new LLViewCheckJoystickFlycam(), "View.CheckJoystickFlycam"); addMenu(new LLViewCheckShowHoverTips(), "View.CheckShowHoverTips"); addMenu(new LLViewCheckHighlightTransparent(), "View.CheckHighlightTransparent"); addMenu(new LLViewCheckBeaconEnabled(), "View.CheckBeaconEnabled"); @@ -7732,7 +7764,6 @@ void initialize_menus() // World menu addMenu(new LLWorldChat(), "World.Chat"); - addMenu(new LLWorldStartGesture(), "World.StartGesture"); addMenu(new LLWorldAlwaysRun(), "World.AlwaysRun"); addMenu(new LLWorldFly(), "World.Fly"); addMenu(new LLWorldCreateLandmark(), "World.CreateLandmark"); @@ -7785,7 +7816,6 @@ void initialize_menus() addMenu(new LLToolsVisibleTakeObject(), "Tools.VisibleTakeObject");*/ // Help menu - addMenu(new LLHelpMOTD(), "Help.MOTD"); // most items use the ShowFloater method // Self pie menu -- cgit v1.1