aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lltoolpie.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/lltoolpie.cpp
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/lltoolpie.cpp')
-rw-r--r--linden/indra/newview/lltoolpie.cpp71
1 files changed, 37 insertions, 34 deletions
diff --git a/linden/indra/newview/lltoolpie.cpp b/linden/indra/newview/lltoolpie.cpp
index ab60c67..a9e733a 100644
--- a/linden/indra/newview/lltoolpie.cpp
+++ b/linden/indra/newview/lltoolpie.cpp
@@ -67,8 +67,6 @@
67#include "llui.h" 67#include "llui.h"
68#include "llweb.h" 68#include "llweb.h"
69 69
70LLToolPie *gToolPie = NULL;
71
72LLPointer<LLViewerObject> LLToolPie::sClickActionObject; 70LLPointer<LLViewerObject> LLToolPie::sClickActionObject;
73LLSafeHandle<LLObjectSelection> LLToolPie::sLeftClickSelection = NULL; 71LLSafeHandle<LLObjectSelection> LLToolPie::sLeftClickSelection = NULL;
74U8 LLToolPie::sClickAction = 0; 72U8 LLToolPie::sClickAction = 0;
@@ -94,8 +92,6 @@ LLToolPie::LLToolPie()
94 92
95BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask) 93BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask)
96{ 94{
97 if (!gCamera) return FALSE;
98
99 gPickFaces = TRUE; 95 gPickFaces = TRUE;
100 //left mouse down always picks transparent 96 //left mouse down always picks transparent
101 gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, leftMouseCallback, 97 gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, leftMouseCallback,
@@ -107,7 +103,7 @@ BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask)
107// static 103// static
108void LLToolPie::leftMouseCallback(S32 x, S32 y, MASK mask) 104void LLToolPie::leftMouseCallback(S32 x, S32 y, MASK mask)
109{ 105{
110 gToolPie->pickAndShowMenu(x, y, mask, FALSE); 106 LLToolPie::getInstance()->pickAndShowMenu(x, y, mask, FALSE);
111} 107}
112 108
113BOOL LLToolPie::handleRightMouseDown(S32 x, S32 y, MASK mask) 109BOOL LLToolPie::handleRightMouseDown(S32 x, S32 y, MASK mask)
@@ -125,7 +121,7 @@ BOOL LLToolPie::handleRightMouseDown(S32 x, S32 y, MASK mask)
125// static 121// static
126void LLToolPie::rightMouseCallback(S32 x, S32 y, MASK mask) 122void LLToolPie::rightMouseCallback(S32 x, S32 y, MASK mask)
127{ 123{
128 gToolPie->pickAndShowMenu(x, y, mask, TRUE); 124 LLToolPie::getInstance()->pickAndShowMenu(x, y, mask, TRUE);
129} 125}
130 126
131// True if you selected an object. 127// True if you selected an object.
@@ -133,12 +129,12 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
133{ 129{
134 if (!always_show && gLastHitParcelWall) 130 if (!always_show && gLastHitParcelWall)
135 { 131 {
136 LLParcel* parcel = gParcelMgr->getCollisionParcel(); 132 LLParcel* parcel = LLViewerParcelMgr::getInstance()->getCollisionParcel();
137 if (parcel) 133 if (parcel)
138 { 134 {
139 gParcelMgr->selectCollisionParcel(); 135 LLViewerParcelMgr::getInstance()->selectCollisionParcel();
140 if (parcel->getParcelFlag(PF_USE_PASS_LIST) 136 if (parcel->getParcelFlag(PF_USE_PASS_LIST)
141 && !gParcelMgr->isCollisionBanned()) 137 && !LLViewerParcelMgr::getInstance()->isCollisionBanned())
142 { 138 {
143 // if selling passes, just buy one 139 // if selling passes, just buy one
144 void* deselect_when_done = (void*)TRUE; 140 void* deselect_when_done = (void*)TRUE;
@@ -161,7 +157,7 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
161 mHitLand = !object && !gLastHitPosGlobal.isExactlyZero(); 157 mHitLand = !object && !gLastHitPosGlobal.isExactlyZero();
162 if (!mHitLand) 158 if (!mHitLand)
163 { 159 {
164 gParcelMgr->deselectLand(); 160 LLViewerParcelMgr::getInstance()->deselectLand();
165 } 161 }
166 162
167 if (object) 163 if (object)
@@ -198,8 +194,12 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
198 // nothing 194 // nothing
199 break; 195 break;
200 case CLICK_ACTION_SIT: 196 case CLICK_ACTION_SIT:
201 handle_sit_or_stand(); 197 if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->mIsSitting)) // agent not already sitting
202 return TRUE; 198 {
199 handle_sit_or_stand();
200 return TRUE;
201 } // else nothing (fall through to touch)
202
203 case CLICK_ACTION_PAY: 203 case CLICK_ACTION_PAY:
204 if (object && object->flagTakesMoney() 204 if (object && object->flagTakesMoney()
205 || parent && parent->flagTakesMoney()) 205 || parent && parent->flagTakesMoney())
@@ -238,8 +238,8 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
238 !always_show) 238 !always_show)
239 { 239 {
240 gGrabTransientTool = this; 240 gGrabTransientTool = this;
241 gToolMgr->getCurrentToolset()->selectTool( gToolGrab ); 241 LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() );
242 return gToolGrab->handleObjectHit( object, x, y, mask); 242 return LLToolGrab::getInstance()->handleObjectHit( object, x, y, mask);
243 } 243 }
244 244
245 if (!object && gLastHitHUDIcon && gLastHitHUDIcon->getSourceObject()) 245 if (!object && gLastHitHUDIcon && gLastHitHUDIcon->getSourceObject())
@@ -270,10 +270,10 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
270 if (object && object == gAgent.getAvatarObject()) 270 if (object && object == gAgent.getAvatarObject())
271 { 271 {
272 // we left clicked on avatar, switch to focus mode 272 // we left clicked on avatar, switch to focus mode
273 gToolMgr->setTransientTool(gToolCamera); 273 LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance());
274 gViewerWindow->hideCursor(); 274 gViewerWindow->hideCursor();
275 gToolCamera->setMouseCapture(TRUE); 275 LLToolCamera::getInstance()->setMouseCapture(TRUE);
276 gToolCamera->pickCallback(gViewerWindow->getCurrentMouseX(), gViewerWindow->getCurrentMouseY(), mask); 276 LLToolCamera::getInstance()->pickCallback(gViewerWindow->getCurrentMouseX(), gViewerWindow->getCurrentMouseY(), mask);
277 gAgent.setFocusOnAvatar(TRUE, TRUE); 277 gAgent.setFocusOnAvatar(TRUE, TRUE);
278 278
279 return TRUE; 279 return TRUE;
@@ -297,12 +297,12 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
297 // Spawn pie menu 297 // Spawn pie menu
298 if (mHitLand) 298 if (mHitLand)
299 { 299 {
300 LLParcelSelectionHandle selection = gParcelMgr->selectParcelAt( gLastHitPosGlobal ); 300 LLParcelSelectionHandle selection = LLViewerParcelMgr::getInstance()->selectParcelAt( gLastHitPosGlobal );
301 gMenuHolder->setParcelSelection(selection); 301 gMenuHolder->setParcelSelection(selection);
302 gPieLand->show(x, y, mPieMouseButtonDown); 302 gPieLand->show(x, y, mPieMouseButtonDown);
303 303
304 // VEFFECT: ShowPie 304 // VEFFECT: ShowPie
305 LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); 305 LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE);
306 effectp->setPositionGlobal(gLastHitPosGlobal); 306 effectp->setPositionGlobal(gLastHitPosGlobal);
307 effectp->setColor(LLColor4U(gAgent.getEffectColor())); 307 effectp->setColor(LLColor4U(gAgent.getEffectColor()));
308 effectp->setDuration(0.25f); 308 effectp->setDuration(0.25f);
@@ -313,7 +313,7 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
313 } 313 }
314 else if (object) 314 else if (object)
315 { 315 {
316 gMenuHolder->setObjectSelection(gSelectMgr->getSelection()); 316 gMenuHolder->setObjectSelection(LLSelectMgr::getInstance()->getSelection());
317 317
318 if (object->isAvatar() 318 if (object->isAvatar()
319 || (object->isAttachment() && !object->isHUDAttachment() && !object->permYouOwner())) 319 || (object->isAttachment() && !object->isHUDAttachment() && !object->permYouOwner()))
@@ -327,7 +327,7 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
327 // Object is an avatar, so check for mute by id. 327 // Object is an avatar, so check for mute by id.
328 LLVOAvatar* avatar = (LLVOAvatar*)object; 328 LLVOAvatar* avatar = (LLVOAvatar*)object;
329 LLString name = avatar->getFullname(); 329 LLString name = avatar->getFullname();
330 if (gMuteListp->isMuted(avatar->getID(), name)) 330 if (LLMuteList::getInstance()->isMuted(avatar->getID(), name))
331 { 331 {
332 gMenuHolder->childSetText("Avatar Mute", LLString("Unmute")); // *TODO:Translate 332 gMenuHolder->childSetText("Avatar Mute", LLString("Unmute")); // *TODO:Translate
333 //gMutePieMenu->setLabel("Unmute"); 333 //gMutePieMenu->setLabel("Unmute");
@@ -348,12 +348,12 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
348 { 348 {
349 // BUG: What about chatting child objects? 349 // BUG: What about chatting child objects?
350 LLString name; 350 LLString name;
351 LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); 351 LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
352 if (node) 352 if (node)
353 { 353 {
354 name = node->mName; 354 name = node->mName;
355 } 355 }
356 if (gMuteListp->isMuted(object->getID(), name)) 356 if (LLMuteList::getInstance()->isMuted(object->getID(), name))
357 { 357 {
358 gMenuHolder->childSetText("Object Mute", LLString("Unmute")); // *TODO:Translate 358 gMenuHolder->childSetText("Object Mute", LLString("Unmute")); // *TODO:Translate
359 //gMuteObjectPieMenu->setLabel("Unmute"); 359 //gMuteObjectPieMenu->setLabel("Unmute");
@@ -369,7 +369,7 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
369 // VEFFECT: ShowPie object 369 // VEFFECT: ShowPie object
370 // Don't show when you click on someone else, it freaks them 370 // Don't show when you click on someone else, it freaks them
371 // out. 371 // out.
372 LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); 372 LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE);
373 effectp->setPositionGlobal(gLastHitPosGlobal); 373 effectp->setPositionGlobal(gLastHitPosGlobal);
374 effectp->setColor(LLColor4U(gAgent.getEffectColor())); 374 effectp->setColor(LLColor4U(gAgent.getEffectColor()));
375 effectp->setDuration(0.25f); 375 effectp->setDuration(0.25f);
@@ -440,7 +440,10 @@ ECursorType cursor_from_object(LLViewerObject* object)
440 switch(click_action) 440 switch(click_action)
441 { 441 {
442 case CLICK_ACTION_SIT: 442 case CLICK_ACTION_SIT:
443 cursor = UI_CURSOR_TOOLSIT; 443 if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->mIsSitting)) // not already sitting?
444 {
445 cursor = UI_CURSOR_TOOLSIT;
446 }
444 break; 447 break;
445 case CLICK_ACTION_BUY: 448 case CLICK_ACTION_BUY:
446 cursor = UI_CURSOR_TOOLBUY; 449 cursor = UI_CURSOR_TOOLBUY;
@@ -476,7 +479,7 @@ void LLToolPie::selectionPropertiesReceived()
476{ 479{
477 // Make sure all data has been received. 480 // Make sure all data has been received.
478 // This function will be called repeatedly as the data comes in. 481 // This function will be called repeatedly as the data comes in.
479 if (!gSelectMgr->selectGetAllValid()) 482 if (!LLSelectMgr::getInstance()->selectGetAllValid())
480 { 483 {
481 return; 484 return;
482 } 485 }
@@ -594,7 +597,7 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask)
594 } 597 }
595 } 598 }
596 mGrabMouseButtonDown = FALSE; 599 mGrabMouseButtonDown = FALSE;
597 gToolMgr->clearTransientTool(); 600 LLToolMgr::getInstance()->clearTransientTool();
598 gAgent.setLookAt(LOOKAT_TARGET_CONVERSATION, obj); // maybe look at object/person clicked on 601 gAgent.setLookAt(LOOKAT_TARGET_CONVERSATION, obj); // maybe look at object/person clicked on
599 return LLTool::handleMouseUp(x, y, mask); 602 return LLTool::handleMouseUp(x, y, mask);
600} 603}
@@ -602,7 +605,7 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask)
602BOOL LLToolPie::handleRightMouseUp(S32 x, S32 y, MASK mask) 605BOOL LLToolPie::handleRightMouseUp(S32 x, S32 y, MASK mask)
603{ 606{
604 mPieMouseButtonDown = FALSE; 607 mPieMouseButtonDown = FALSE;
605 gToolMgr->clearTransientTool(); 608 LLToolMgr::getInstance()->clearTransientTool();
606 return LLTool::handleRightMouseUp(x, y, mask); 609 return LLTool::handleRightMouseUp(x, y, mask);
607} 610}
608 611
@@ -668,18 +671,18 @@ void LLToolPie::handleDeselect()
668 setMouseCapture( FALSE ); // Calls onMouseCaptureLost() indirectly 671 setMouseCapture( FALSE ); // Calls onMouseCaptureLost() indirectly
669 } 672 }
670 // remove temporary selection for pie menu 673 // remove temporary selection for pie menu
671 gSelectMgr->validateSelection(); 674 LLSelectMgr::getInstance()->validateSelection();
672} 675}
673 676
674LLTool* LLToolPie::getOverrideTool(MASK mask) 677LLTool* LLToolPie::getOverrideTool(MASK mask)
675{ 678{
676 if (mask == MASK_CONTROL) 679 if (mask == MASK_CONTROL)
677 { 680 {
678 return gToolGrab; 681 return LLToolGrab::getInstance();
679 } 682 }
680 else if (mask == (MASK_CONTROL | MASK_SHIFT)) 683 else if (mask == (MASK_CONTROL | MASK_SHIFT))
681 { 684 {
682 return gToolGrab; 685 return LLToolGrab::getInstance();
683 } 686 }
684 687
685 return LLTool::getOverrideTool(mask); 688 return LLTool::getOverrideTool(mask);
@@ -716,7 +719,7 @@ void LLToolPie::render()
716 719
717static void handle_click_action_play() 720static void handle_click_action_play()
718{ 721{
719 LLParcel* parcel = gParcelMgr->getAgentParcel(); 722 LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
720 if (!parcel) return; 723 if (!parcel) return;
721 724
722 LLMediaBase::EStatus status = LLViewerParcelMedia::getStatus(); 725 LLMediaBase::EStatus status = LLViewerParcelMedia::getStatus();
@@ -739,7 +742,7 @@ static void handle_click_action_play()
739static void handle_click_action_open_media(LLPointer<LLViewerObject> objectp) 742static void handle_click_action_open_media(LLPointer<LLViewerObject> objectp)
740{ 743{
741 //FIXME: how do we handle object in different parcel than us? 744 //FIXME: how do we handle object in different parcel than us?
742 LLParcel* parcel = gParcelMgr->getAgentParcel(); 745 LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
743 if (!parcel) return; 746 if (!parcel) return;
744 747
745 // did we hit an object? 748 // did we hit an object?
@@ -781,7 +784,7 @@ static ECursorType cursor_from_parcel_media(U8 click_action)
781 784
782 //FIXME: how do we handle object in different parcel than us? 785 //FIXME: how do we handle object in different parcel than us?
783 ECursorType open_cursor = UI_CURSOR_ARROW; 786 ECursorType open_cursor = UI_CURSOR_ARROW;
784 LLParcel* parcel = gParcelMgr->getAgentParcel(); 787 LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
785 if (!parcel) return open_cursor; 788 if (!parcel) return open_cursor;
786 789
787 std::string media_url = std::string ( parcel->getMediaURL () ); 790 std::string media_url = std::string ( parcel->getMediaURL () );