aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lltoolcomp.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-09-06 18:24:57 -0500
committerJacek Antonelli2008-09-06 18:25:07 -0500
commit798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch)
tree1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/newview/lltoolcomp.cpp
parentSecond Life viewer sources 1.20.15 (diff)
downloadmeta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/newview/lltoolcomp.cpp')
-rw-r--r--linden/indra/newview/lltoolcomp.cpp92
1 files changed, 46 insertions, 46 deletions
diff --git a/linden/indra/newview/lltoolcomp.cpp b/linden/indra/newview/lltoolcomp.cpp
index f840a15..26f0bac 100644
--- a/linden/indra/newview/lltoolcomp.cpp
+++ b/linden/indra/newview/lltoolcomp.cpp
@@ -84,7 +84,7 @@ void LLToolComposite::setCurrentTool( LLTool* new_tool )
84 } 84 }
85} 85}
86 86
87LLToolComposite::LLToolComposite(const LLString& name) 87LLToolComposite::LLToolComposite(const std::string& name)
88 : LLTool(name), 88 : LLTool(name),
89 mCur(NULL), mDefault(NULL), mSelected(FALSE), 89 mCur(NULL), mDefault(NULL), mSelected(FALSE),
90 mMouseDown(FALSE), mManip(NULL), mSelectRect(NULL) 90 mMouseDown(FALSE), mManip(NULL), mSelectRect(NULL)
@@ -129,7 +129,7 @@ void LLToolComposite::handleSelect()
129//---------------------------------------------------------------------------- 129//----------------------------------------------------------------------------
130 130
131LLToolCompInspect::LLToolCompInspect() 131LLToolCompInspect::LLToolCompInspect()
132: LLToolComposite("Inspect") 132: LLToolComposite(std::string("Inspect"))
133{ 133{
134 mSelectRect = new LLToolSelectRect(this); 134 mSelectRect = new LLToolSelectRect(this);
135 mDefault = mSelectRect; 135 mDefault = mSelectRect;
@@ -145,18 +145,18 @@ LLToolCompInspect::~LLToolCompInspect()
145BOOL LLToolCompInspect::handleMouseDown(S32 x, S32 y, MASK mask) 145BOOL LLToolCompInspect::handleMouseDown(S32 x, S32 y, MASK mask)
146{ 146{
147 mMouseDown = TRUE; 147 mMouseDown = TRUE;
148 gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback); 148 gViewerWindow->pickAsync(x, y, mask, pickCallback);
149 return TRUE; 149 return TRUE;
150} 150}
151 151
152void LLToolCompInspect::pickCallback(S32 x, S32 y, MASK mask) 152void LLToolCompInspect::pickCallback(const LLPickInfo& pick_info)
153{ 153{
154 LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); 154 LLViewerObject* hit_obj = pick_info.getObject();
155 155
156 if (!LLToolCompInspect::getInstance()->mMouseDown) 156 if (!LLToolCompInspect::getInstance()->mMouseDown)
157 { 157 {
158 // fast click on object, but mouse is already up...just do select 158 // fast click on object, but mouse is already up...just do select
159 LLToolCompInspect::getInstance()->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); 159 LLToolCompInspect::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
160 return; 160 return;
161 } 161 }
162 162
@@ -167,13 +167,13 @@ void LLToolCompInspect::pickCallback(S32 x, S32 y, MASK mask)
167 LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance(); 167 LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
168 } 168 }
169 LLToolCompInspect::getInstance()->setCurrentTool( LLToolCompInspect::getInstance()->mSelectRect ); 169 LLToolCompInspect::getInstance()->setCurrentTool( LLToolCompInspect::getInstance()->mSelectRect );
170 LLToolCompInspect::getInstance()->mSelectRect->handleMouseDown( x, y, mask ); 170 LLToolCompInspect::getInstance()->mSelectRect->handlePick( pick_info );
171 171
172 } 172 }
173 else 173 else
174 { 174 {
175 LLToolCompInspect::getInstance()->setCurrentTool( LLToolCompInspect::getInstance()->mSelectRect ); 175 LLToolCompInspect::getInstance()->setCurrentTool( LLToolCompInspect::getInstance()->mSelectRect );
176 LLToolCompInspect::getInstance()->mSelectRect->handleMouseDown( x, y, mask); 176 LLToolCompInspect::getInstance()->mSelectRect->handlePick( pick_info );
177 } 177 }
178} 178}
179 179
@@ -187,7 +187,7 @@ BOOL LLToolCompInspect::handleDoubleClick(S32 x, S32 y, MASK mask)
187//---------------------------------------------------------------------------- 187//----------------------------------------------------------------------------
188 188
189LLToolCompTranslate::LLToolCompTranslate() 189LLToolCompTranslate::LLToolCompTranslate()
190 : LLToolComposite("Move") 190 : LLToolComposite(std::string("Move"))
191{ 191{
192 mManip = new LLManipTranslate(this); 192 mManip = new LLManipTranslate(this);
193 mSelectRect = new LLToolSelectRect(this); 193 mSelectRect = new LLToolSelectRect(this);
@@ -218,19 +218,19 @@ BOOL LLToolCompTranslate::handleHover(S32 x, S32 y, MASK mask)
218BOOL LLToolCompTranslate::handleMouseDown(S32 x, S32 y, MASK mask) 218BOOL LLToolCompTranslate::handleMouseDown(S32 x, S32 y, MASK mask)
219{ 219{
220 mMouseDown = TRUE; 220 mMouseDown = TRUE;
221 gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback, TRUE); 221 gViewerWindow->pickAsync(x, y, mask, pickCallback, TRUE);
222 return TRUE; 222 return TRUE;
223} 223}
224 224
225void LLToolCompTranslate::pickCallback(S32 x, S32 y, MASK mask) 225void LLToolCompTranslate::pickCallback(const LLPickInfo& pick_info)
226{ 226{
227 LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); 227 LLViewerObject* hit_obj = pick_info.getObject();
228 228
229 LLToolCompTranslate::getInstance()->mManip->highlightManipulators(x, y); 229 LLToolCompTranslate::getInstance()->mManip->highlightManipulators(pick_info.mMousePt.mX, pick_info.mMousePt.mY);
230 if (!LLToolCompTranslate::getInstance()->mMouseDown) 230 if (!LLToolCompTranslate::getInstance()->mMouseDown)
231 { 231 {
232 // fast click on object, but mouse is already up...just do select 232 // fast click on object, but mouse is already up...just do select
233 LLToolCompTranslate::getInstance()->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); 233 LLToolCompTranslate::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
234 return; 234 return;
235 } 235 }
236 236
@@ -246,12 +246,12 @@ void LLToolCompTranslate::pickCallback(S32 x, S32 y, MASK mask)
246 if( LLManip::LL_NO_PART != LLToolCompTranslate::getInstance()->mManip->getHighlightedPart() && can_move) 246 if( LLManip::LL_NO_PART != LLToolCompTranslate::getInstance()->mManip->getHighlightedPart() && can_move)
247 { 247 {
248 LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mManip ); 248 LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mManip );
249 LLToolCompTranslate::getInstance()->mManip->handleMouseDownOnPart( x, y, mask ); 249 LLToolCompTranslate::getInstance()->mManip->handleMouseDownOnPart( pick_info.mMousePt.mX, pick_info.mMousePt.mY, pick_info.mKeyMask );
250 } 250 }
251 else 251 else
252 { 252 {
253 LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mSelectRect ); 253 LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mSelectRect );
254 LLToolCompTranslate::getInstance()->mSelectRect->handleMouseDown( x, y, mask ); 254 LLToolCompTranslate::getInstance()->mSelectRect->handlePick( pick_info );
255 255
256 // *TODO: add toggle to trigger old click-drag functionality 256 // *TODO: add toggle to trigger old click-drag functionality
257 // LLToolCompTranslate::getInstance()->mManip->handleMouseDownOnPart( XY_part, x, y, mask); 257 // LLToolCompTranslate::getInstance()->mManip->handleMouseDownOnPart( XY_part, x, y, mask);
@@ -260,7 +260,7 @@ void LLToolCompTranslate::pickCallback(S32 x, S32 y, MASK mask)
260 else 260 else
261 { 261 {
262 LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mSelectRect ); 262 LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mSelectRect );
263 LLToolCompTranslate::getInstance()->mSelectRect->handleMouseDown( x, y, mask); 263 LLToolCompTranslate::getInstance()->mSelectRect->handlePick( pick_info );
264 } 264 }
265} 265}
266 266
@@ -314,7 +314,7 @@ void LLToolCompTranslate::render()
314// LLToolCompScale 314// LLToolCompScale
315 315
316LLToolCompScale::LLToolCompScale() 316LLToolCompScale::LLToolCompScale()
317 : LLToolComposite("Stretch") 317 : LLToolComposite(std::string("Stretch"))
318{ 318{
319 mManip = new LLManipScale(this); 319 mManip = new LLManipScale(this);
320 mSelectRect = new LLToolSelectRect(this); 320 mSelectRect = new LLToolSelectRect(this);
@@ -342,19 +342,19 @@ BOOL LLToolCompScale::handleHover(S32 x, S32 y, MASK mask)
342BOOL LLToolCompScale::handleMouseDown(S32 x, S32 y, MASK mask) 342BOOL LLToolCompScale::handleMouseDown(S32 x, S32 y, MASK mask)
343{ 343{
344 mMouseDown = TRUE; 344 mMouseDown = TRUE;
345 gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback); 345 gViewerWindow->pickAsync(x, y, mask, pickCallback);
346 return TRUE; 346 return TRUE;
347} 347}
348 348
349void LLToolCompScale::pickCallback(S32 x, S32 y, MASK mask) 349void LLToolCompScale::pickCallback(const LLPickInfo& pick_info)
350{ 350{
351 LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); 351 LLViewerObject* hit_obj = pick_info.getObject();
352 352
353 LLToolCompScale::getInstance()->mManip->highlightManipulators(x, y); 353 LLToolCompScale::getInstance()->mManip->highlightManipulators(pick_info.mMousePt.mX, pick_info.mMousePt.mY);
354 if (!LLToolCompScale::getInstance()->mMouseDown) 354 if (!LLToolCompScale::getInstance()->mMouseDown)
355 { 355 {
356 // fast click on object, but mouse is already up...just do select 356 // fast click on object, but mouse is already up...just do select
357 LLToolCompScale::getInstance()->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); 357 LLToolCompScale::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
358 358
359 return; 359 return;
360 } 360 }
@@ -368,18 +368,18 @@ void LLToolCompScale::pickCallback(S32 x, S32 y, MASK mask)
368 if( LLManip::LL_NO_PART != LLToolCompScale::getInstance()->mManip->getHighlightedPart() ) 368 if( LLManip::LL_NO_PART != LLToolCompScale::getInstance()->mManip->getHighlightedPart() )
369 { 369 {
370 LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mManip ); 370 LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mManip );
371 LLToolCompScale::getInstance()->mManip->handleMouseDownOnPart( x, y, mask ); 371 LLToolCompScale::getInstance()->mManip->handleMouseDownOnPart( pick_info.mMousePt.mX, pick_info.mMousePt.mY, pick_info.mKeyMask );
372 } 372 }
373 else 373 else
374 { 374 {
375 LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mSelectRect ); 375 LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mSelectRect );
376 LLToolCompScale::getInstance()->mSelectRect->handleMouseDown( x, y, mask ); 376 LLToolCompScale::getInstance()->mSelectRect->handlePick( pick_info );
377 } 377 }
378 } 378 }
379 else 379 else
380 { 380 {
381 LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mSelectRect ); 381 LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mSelectRect );
382 LLToolCompScale::getInstance()->mCur->handleMouseDown( x, y, mask ); 382 LLToolCompScale::getInstance()->mSelectRect->handlePick( pick_info );
383 } 383 }
384} 384}
385 385
@@ -434,7 +434,7 @@ void LLToolCompScale::render()
434// LLToolCompCreate 434// LLToolCompCreate
435 435
436LLToolCompCreate::LLToolCompCreate() 436LLToolCompCreate::LLToolCompCreate()
437 : LLToolComposite("Create") 437 : LLToolComposite(std::string("Create"))
438{ 438{
439 mPlacer = new LLToolPlacer(); 439 mPlacer = new LLToolPlacer();
440 mSelectRect = new LLToolSelectRect(this); 440 mSelectRect = new LLToolSelectRect(this);
@@ -457,15 +457,15 @@ BOOL LLToolCompCreate::handleMouseDown(S32 x, S32 y, MASK mask)
457 BOOL handled = FALSE; 457 BOOL handled = FALSE;
458 mMouseDown = TRUE; 458 mMouseDown = TRUE;
459 459
460 if ( !(mask == MASK_SHIFT) && !(mask == MASK_CONTROL) ) 460 if ( (mask == MASK_SHIFT) || (mask == MASK_CONTROL) )
461 { 461 {
462 setCurrentTool( mPlacer ); 462 gViewerWindow->pickAsync(x, y, mask, pickCallback);
463 handled = mPlacer->placeObject( x, y, mask ); 463 handled = TRUE;
464 } 464 }
465 else 465 else
466 { 466 {
467 gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback); 467 setCurrentTool( mPlacer );
468 handled = TRUE; 468 handled = mPlacer->placeObject( x, y, mask );
469 } 469 }
470 470
471 mObjectPlacedOnMouseDown = TRUE; 471 mObjectPlacedOnMouseDown = TRUE;
@@ -473,15 +473,15 @@ BOOL LLToolCompCreate::handleMouseDown(S32 x, S32 y, MASK mask)
473 return TRUE; 473 return TRUE;
474} 474}
475 475
476void LLToolCompCreate::pickCallback(S32 x, S32 y, MASK mask) 476void LLToolCompCreate::pickCallback(const LLPickInfo& pick_info)
477{ 477{
478 // *NOTE: We mask off shift and control, so you cannot 478 // *NOTE: We mask off shift and control, so you cannot
479 // multi-select multiple objects with the create tool. 479 // multi-select multiple objects with the create tool.
480 mask = (mask & ~MASK_SHIFT); 480 MASK mask = (pick_info.mKeyMask & ~MASK_SHIFT);
481 mask = (mask & ~MASK_CONTROL); 481 mask = (mask & ~MASK_CONTROL);
482 482
483 LLToolCompCreate::getInstance()->setCurrentTool( LLToolCompCreate::getInstance()->mSelectRect ); 483 LLToolCompCreate::getInstance()->setCurrentTool( LLToolCompCreate::getInstance()->mSelectRect );
484 LLToolCompCreate::getInstance()->mSelectRect->handleMouseDown( x, y, mask); 484 LLToolCompCreate::getInstance()->mSelectRect->handlePick( pick_info );
485} 485}
486 486
487BOOL LLToolCompCreate::handleDoubleClick(S32 x, S32 y, MASK mask) 487BOOL LLToolCompCreate::handleDoubleClick(S32 x, S32 y, MASK mask)
@@ -514,7 +514,7 @@ BOOL LLToolCompCreate::handleMouseUp(S32 x, S32 y, MASK mask)
514// LLToolCompRotate 514// LLToolCompRotate
515 515
516LLToolCompRotate::LLToolCompRotate() 516LLToolCompRotate::LLToolCompRotate()
517 : LLToolComposite("Rotate") 517 : LLToolComposite(std::string("Rotate"))
518{ 518{
519 mManip = new LLManipRotate(this); 519 mManip = new LLManipRotate(this);
520 mSelectRect = new LLToolSelectRect(this); 520 mSelectRect = new LLToolSelectRect(this);
@@ -543,19 +543,19 @@ BOOL LLToolCompRotate::handleHover(S32 x, S32 y, MASK mask)
543BOOL LLToolCompRotate::handleMouseDown(S32 x, S32 y, MASK mask) 543BOOL LLToolCompRotate::handleMouseDown(S32 x, S32 y, MASK mask)
544{ 544{
545 mMouseDown = TRUE; 545 mMouseDown = TRUE;
546 gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback); 546 gViewerWindow->pickAsync(x, y, mask, pickCallback);
547 return TRUE; 547 return TRUE;
548} 548}
549 549
550void LLToolCompRotate::pickCallback(S32 x, S32 y, MASK mask) 550void LLToolCompRotate::pickCallback(const LLPickInfo& pick_info)
551{ 551{
552 LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); 552 LLViewerObject* hit_obj = pick_info.getObject();
553 553
554 LLToolCompRotate::getInstance()->mManip->highlightManipulators(x, y); 554 LLToolCompRotate::getInstance()->mManip->highlightManipulators(pick_info.mMousePt.mX, pick_info.mMousePt.mY);
555 if (!LLToolCompRotate::getInstance()->mMouseDown) 555 if (!LLToolCompRotate::getInstance()->mMouseDown)
556 { 556 {
557 // fast click on object, but mouse is already up...just do select 557 // fast click on object, but mouse is already up...just do select
558 LLToolCompRotate::getInstance()->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); 558 LLToolCompRotate::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
559 return; 559 return;
560 } 560 }
561 561
@@ -568,18 +568,18 @@ void LLToolCompRotate::pickCallback(S32 x, S32 y, MASK mask)
568 if( LLManip::LL_NO_PART != LLToolCompRotate::getInstance()->mManip->getHighlightedPart() ) 568 if( LLManip::LL_NO_PART != LLToolCompRotate::getInstance()->mManip->getHighlightedPart() )
569 { 569 {
570 LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mManip ); 570 LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mManip );
571 LLToolCompRotate::getInstance()->mManip->handleMouseDownOnPart( x, y, mask ); 571 LLToolCompRotate::getInstance()->mManip->handleMouseDownOnPart( pick_info.mMousePt.mX, pick_info.mMousePt.mY, pick_info.mKeyMask );
572 } 572 }
573 else 573 else
574 { 574 {
575 LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mSelectRect ); 575 LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mSelectRect );
576 LLToolCompRotate::getInstance()->mSelectRect->handleMouseDown( x, y, mask ); 576 LLToolCompRotate::getInstance()->mSelectRect->handlePick( pick_info );
577 } 577 }
578 } 578 }
579 else 579 else
580 { 580 {
581 LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mSelectRect ); 581 LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mSelectRect );
582 LLToolCompRotate::getInstance()->mCur->handleMouseDown( x, y, mask ); 582 LLToolCompRotate::getInstance()->mSelectRect->handlePick( pick_info );
583 } 583 }
584} 584}
585 585
@@ -633,11 +633,11 @@ void LLToolCompRotate::render()
633// LLToolCompGun 633// LLToolCompGun
634 634
635LLToolCompGun::LLToolCompGun() 635LLToolCompGun::LLToolCompGun()
636 : LLToolComposite("Mouselook") 636 : LLToolComposite(std::string("Mouselook"))
637{ 637{
638 mGun = new LLToolGun(this); 638 mGun = new LLToolGun(this);
639 mGrab = new LLToolGrab(this); 639 mGrab = new LLToolGrab(this);
640 mNull = new LLTool("null", this); 640 mNull = new LLTool(std::string("null"), this);
641 641
642 setCurrentTool(mGun); 642 setCurrentTool(mGun);
643 mDefault = mGun; 643 mDefault = mGun;