aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lltoolcomp.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/lltoolcomp.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/lltoolcomp.cpp')
-rw-r--r--linden/indra/newview/lltoolcomp.cpp133
1 files changed, 62 insertions, 71 deletions
diff --git a/linden/indra/newview/lltoolcomp.cpp b/linden/indra/newview/lltoolcomp.cpp
index 055cbb7..f840a15 100644
--- a/linden/indra/newview/lltoolcomp.cpp
+++ b/linden/indra/newview/lltoolcomp.cpp
@@ -46,7 +46,6 @@
46#include "lltoolgrab.h" 46#include "lltoolgrab.h"
47#include "lltoolgun.h" 47#include "lltoolgun.h"
48#include "lltoolmgr.h" 48#include "lltoolmgr.h"
49#include "lltoolselect.h"
50#include "lltoolselectrect.h" 49#include "lltoolselectrect.h"
51#include "lltoolplacer.h" 50#include "lltoolplacer.h"
52#include "llviewermenu.h" 51#include "llviewermenu.h"
@@ -61,14 +60,6 @@ const S32 BUTTON_WIDTH_SMALL = 32;
61const S32 BUTTON_WIDTH_BIG = 48; 60const S32 BUTTON_WIDTH_BIG = 48;
62const S32 HPAD = 4; 61const S32 HPAD = 4;
63 62
64// Globals
65LLToolCompInspect *gToolInspect = NULL;
66LLToolCompTranslate *gToolTranslate = NULL;
67LLToolCompScale *gToolStretch = NULL;
68LLToolCompRotate *gToolRotate = NULL;
69LLToolCompCreate *gToolCreate = NULL;
70LLToolCompGun *gToolGun = NULL;
71
72extern LLControlGroup gSavedSettings; 63extern LLControlGroup gSavedSettings;
73 64
74 65
@@ -126,7 +117,7 @@ void LLToolComposite::handleSelect()
126{ 117{
127 if (!gSavedSettings.getBOOL("EditLinkedParts")) 118 if (!gSavedSettings.getBOOL("EditLinkedParts"))
128 { 119 {
129 gSelectMgr->promoteSelectionToRoot(); 120 LLSelectMgr::getInstance()->promoteSelectionToRoot();
130 } 121 }
131 mCur = mDefault; 122 mCur = mDefault;
132 mCur->handleSelect(); 123 mCur->handleSelect();
@@ -162,27 +153,27 @@ void LLToolCompInspect::pickCallback(S32 x, S32 y, MASK mask)
162{ 153{
163 LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); 154 LLViewerObject* hit_obj = gViewerWindow->lastObjectHit();
164 155
165 if (!gToolInspect->mMouseDown) 156 if (!LLToolCompInspect::getInstance()->mMouseDown)
166 { 157 {
167 // 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
168 gToolInspect->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); 159 LLToolCompInspect::getInstance()->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
169 return; 160 return;
170 } 161 }
171 162
172 if( hit_obj ) 163 if( hit_obj )
173 { 164 {
174 if (gSelectMgr->getSelection()->getObjectCount()) 165 if (LLSelectMgr::getInstance()->getSelection()->getObjectCount())
175 { 166 {
176 LLEditMenuHandler::gEditMenuHandler = gSelectMgr; 167 LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
177 } 168 }
178 gToolInspect->setCurrentTool( gToolInspect->mSelectRect ); 169 LLToolCompInspect::getInstance()->setCurrentTool( LLToolCompInspect::getInstance()->mSelectRect );
179 gToolInspect->mSelectRect->handleMouseDown( x, y, mask ); 170 LLToolCompInspect::getInstance()->mSelectRect->handleMouseDown( x, y, mask );
180 171
181 } 172 }
182 else 173 else
183 { 174 {
184 gToolInspect->setCurrentTool( gToolInspect->mSelectRect ); 175 LLToolCompInspect::getInstance()->setCurrentTool( LLToolCompInspect::getInstance()->mSelectRect );
185 gToolInspect->mSelectRect->handleMouseDown( x, y, mask); 176 LLToolCompInspect::getInstance()->mSelectRect->handleMouseDown( x, y, mask);
186 } 177 }
187} 178}
188 179
@@ -235,41 +226,41 @@ void LLToolCompTranslate::pickCallback(S32 x, S32 y, MASK mask)
235{ 226{
236 LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); 227 LLViewerObject* hit_obj = gViewerWindow->lastObjectHit();
237 228
238 gToolTranslate->mManip->highlightManipulators(x, y); 229 LLToolCompTranslate::getInstance()->mManip->highlightManipulators(x, y);
239 if (!gToolTranslate->mMouseDown) 230 if (!LLToolCompTranslate::getInstance()->mMouseDown)
240 { 231 {
241 // 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
242 gToolTranslate->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); 233 LLToolCompTranslate::getInstance()->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
243 return; 234 return;
244 } 235 }
245 236
246 if( hit_obj || gToolTranslate->mManip->getHighlightedPart() != LLManip::LL_NO_PART ) 237 if( hit_obj || LLToolCompTranslate::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART )
247 { 238 {
248 if (gToolTranslate->mManip->getSelection()->getObjectCount()) 239 if (LLToolCompTranslate::getInstance()->mManip->getSelection()->getObjectCount())
249 { 240 {
250 LLEditMenuHandler::gEditMenuHandler = gSelectMgr; 241 LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
251 } 242 }
252 243
253 BOOL can_move = gToolTranslate->mManip->canAffectSelection(); 244 BOOL can_move = LLToolCompTranslate::getInstance()->mManip->canAffectSelection();
254 245
255 if( LLManip::LL_NO_PART != gToolTranslate->mManip->getHighlightedPart() && can_move) 246 if( LLManip::LL_NO_PART != LLToolCompTranslate::getInstance()->mManip->getHighlightedPart() && can_move)
256 { 247 {
257 gToolTranslate->setCurrentTool( gToolTranslate->mManip ); 248 LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mManip );
258 gToolTranslate->mManip->handleMouseDownOnPart( x, y, mask ); 249 LLToolCompTranslate::getInstance()->mManip->handleMouseDownOnPart( x, y, mask );
259 } 250 }
260 else 251 else
261 { 252 {
262 gToolTranslate->setCurrentTool( gToolTranslate->mSelectRect ); 253 LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mSelectRect );
263 gToolTranslate->mSelectRect->handleMouseDown( x, y, mask ); 254 LLToolCompTranslate::getInstance()->mSelectRect->handleMouseDown( x, y, mask );
264 255
265 // *TODO: add toggle to trigger old click-drag functionality 256 // *TODO: add toggle to trigger old click-drag functionality
266 // gToolTranslate->mManip->handleMouseDownOnPart( XY_part, x, y, mask); 257 // LLToolCompTranslate::getInstance()->mManip->handleMouseDownOnPart( XY_part, x, y, mask);
267 } 258 }
268 } 259 }
269 else 260 else
270 { 261 {
271 gToolTranslate->setCurrentTool( gToolTranslate->mSelectRect ); 262 LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mSelectRect );
272 gToolTranslate->mSelectRect->handleMouseDown( x, y, mask); 263 LLToolCompTranslate::getInstance()->mSelectRect->handleMouseDown( x, y, mask);
273 } 264 }
274} 265}
275 266
@@ -283,11 +274,11 @@ LLTool* LLToolCompTranslate::getOverrideTool(MASK mask)
283{ 274{
284 if (mask == MASK_CONTROL) 275 if (mask == MASK_CONTROL)
285 { 276 {
286 return gToolRotate; 277 return LLToolCompRotate::getInstance();
287 } 278 }
288 else if (mask == (MASK_CONTROL | MASK_SHIFT)) 279 else if (mask == (MASK_CONTROL | MASK_SHIFT))
289 { 280 {
290 return gToolStretch; 281 return LLToolCompScale::getInstance();
291 } 282 }
292 return LLToolComposite::getOverrideTool(mask); 283 return LLToolComposite::getOverrideTool(mask);
293} 284}
@@ -309,7 +300,7 @@ BOOL LLToolCompTranslate::handleDoubleClick(S32 x, S32 y, MASK mask)
309 300
310void LLToolCompTranslate::render() 301void LLToolCompTranslate::render()
311{ 302{
312 mCur->render(); 303 mCur->render(); // removing this will not draw the RGB arrows and guidelines
313 304
314 if( mCur != mManip ) 305 if( mCur != mManip )
315 { 306 {
@@ -359,36 +350,36 @@ void LLToolCompScale::pickCallback(S32 x, S32 y, MASK mask)
359{ 350{
360 LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); 351 LLViewerObject* hit_obj = gViewerWindow->lastObjectHit();
361 352
362 gToolStretch->mManip->highlightManipulators(x, y); 353 LLToolCompScale::getInstance()->mManip->highlightManipulators(x, y);
363 if (!gToolStretch->mMouseDown) 354 if (!LLToolCompScale::getInstance()->mMouseDown)
364 { 355 {
365 // 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
366 gToolStretch->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); 357 LLToolCompScale::getInstance()->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
367 358
368 return; 359 return;
369 } 360 }
370 361
371 if( hit_obj || gToolStretch->mManip->getHighlightedPart() != LLManip::LL_NO_PART) 362 if( hit_obj || LLToolCompScale::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART)
372 { 363 {
373 if (gToolStretch->mManip->getSelection()->getObjectCount()) 364 if (LLToolCompScale::getInstance()->mManip->getSelection()->getObjectCount())
374 { 365 {
375 LLEditMenuHandler::gEditMenuHandler = gSelectMgr; 366 LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
376 } 367 }
377 if( LLManip::LL_NO_PART != gToolStretch->mManip->getHighlightedPart() ) 368 if( LLManip::LL_NO_PART != LLToolCompScale::getInstance()->mManip->getHighlightedPart() )
378 { 369 {
379 gToolStretch->setCurrentTool( gToolStretch->mManip ); 370 LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mManip );
380 gToolStretch->mManip->handleMouseDownOnPart( x, y, mask ); 371 LLToolCompScale::getInstance()->mManip->handleMouseDownOnPart( x, y, mask );
381 } 372 }
382 else 373 else
383 { 374 {
384 gToolStretch->setCurrentTool( gToolStretch->mSelectRect ); 375 LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mSelectRect );
385 gToolStretch->mSelectRect->handleMouseDown( x, y, mask ); 376 LLToolCompScale::getInstance()->mSelectRect->handleMouseDown( x, y, mask );
386 } 377 }
387 } 378 }
388 else 379 else
389 { 380 {
390 gToolStretch->setCurrentTool( gToolStretch->mSelectRect ); 381 LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mSelectRect );
391 gToolStretch->mCur->handleMouseDown( x, y, mask ); 382 LLToolCompScale::getInstance()->mCur->handleMouseDown( x, y, mask );
392 } 383 }
393} 384}
394 385
@@ -402,7 +393,7 @@ LLTool* LLToolCompScale::getOverrideTool(MASK mask)
402{ 393{
403 if (mask == MASK_CONTROL) 394 if (mask == MASK_CONTROL)
404 { 395 {
405 return gToolRotate; 396 return LLToolCompRotate::getInstance();
406 } 397 }
407 398
408 return LLToolComposite::getOverrideTool(mask); 399 return LLToolComposite::getOverrideTool(mask);
@@ -489,8 +480,8 @@ void LLToolCompCreate::pickCallback(S32 x, S32 y, MASK mask)
489 mask = (mask & ~MASK_SHIFT); 480 mask = (mask & ~MASK_SHIFT);
490 mask = (mask & ~MASK_CONTROL); 481 mask = (mask & ~MASK_CONTROL);
491 482
492 gToolCreate->setCurrentTool( gToolCreate->mSelectRect ); 483 LLToolCompCreate::getInstance()->setCurrentTool( LLToolCompCreate::getInstance()->mSelectRect );
493 gToolCreate->mSelectRect->handleMouseDown( x, y, mask); 484 LLToolCompCreate::getInstance()->mSelectRect->handleMouseDown( x, y, mask);
494} 485}
495 486
496BOOL LLToolCompCreate::handleDoubleClick(S32 x, S32 y, MASK mask) 487BOOL LLToolCompCreate::handleDoubleClick(S32 x, S32 y, MASK mask)
@@ -560,35 +551,35 @@ void LLToolCompRotate::pickCallback(S32 x, S32 y, MASK mask)
560{ 551{
561 LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); 552 LLViewerObject* hit_obj = gViewerWindow->lastObjectHit();
562 553
563 gToolRotate->mManip->highlightManipulators(x, y); 554 LLToolCompRotate::getInstance()->mManip->highlightManipulators(x, y);
564 if (!gToolRotate->mMouseDown) 555 if (!LLToolCompRotate::getInstance()->mMouseDown)
565 { 556 {
566 // 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
567 gToolRotate->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); 558 LLToolCompRotate::getInstance()->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
568 return; 559 return;
569 } 560 }
570 561
571 if( hit_obj || gToolRotate->mManip->getHighlightedPart() != LLManip::LL_NO_PART) 562 if( hit_obj || LLToolCompRotate::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART)
572 { 563 {
573 if (gToolRotate->mManip->getSelection()->getObjectCount()) 564 if (LLToolCompRotate::getInstance()->mManip->getSelection()->getObjectCount())
574 { 565 {
575 LLEditMenuHandler::gEditMenuHandler = gSelectMgr; 566 LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
576 } 567 }
577 if( LLManip::LL_NO_PART != gToolRotate->mManip->getHighlightedPart() ) 568 if( LLManip::LL_NO_PART != LLToolCompRotate::getInstance()->mManip->getHighlightedPart() )
578 { 569 {
579 gToolRotate->setCurrentTool( gToolRotate->mManip ); 570 LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mManip );
580 gToolRotate->mManip->handleMouseDownOnPart( x, y, mask ); 571 LLToolCompRotate::getInstance()->mManip->handleMouseDownOnPart( x, y, mask );
581 } 572 }
582 else 573 else
583 { 574 {
584 gToolRotate->setCurrentTool( gToolRotate->mSelectRect ); 575 LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mSelectRect );
585 gToolRotate->mSelectRect->handleMouseDown( x, y, mask ); 576 LLToolCompRotate::getInstance()->mSelectRect->handleMouseDown( x, y, mask );
586 } 577 }
587 } 578 }
588 else 579 else
589 { 580 {
590 gToolRotate->setCurrentTool( gToolRotate->mSelectRect ); 581 LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mSelectRect );
591 gToolRotate->mCur->handleMouseDown( x, y, mask ); 582 LLToolCompRotate::getInstance()->mCur->handleMouseDown( x, y, mask );
592 } 583 }
593} 584}
594 585
@@ -602,7 +593,7 @@ LLTool* LLToolCompRotate::getOverrideTool(MASK mask)
602{ 593{
603 if (mask == (MASK_CONTROL | MASK_SHIFT)) 594 if (mask == (MASK_CONTROL | MASK_SHIFT))
604 { 595 {
605 return gToolStretch; 596 return LLToolCompScale::getInstance();
606 } 597 }
607 return LLToolComposite::getOverrideTool(mask); 598 return LLToolComposite::getOverrideTool(mask);
608} 599}
@@ -671,7 +662,7 @@ BOOL LLToolCompGun::handleHover(S32 x, S32 y, MASK mask)
671 // item selected from context menu. 662 // item selected from context menu.
672 if ( mCur == mNull && !gPopupMenuView->getVisible() ) 663 if ( mCur == mNull && !gPopupMenuView->getVisible() )
673 { 664 {
674 gSelectMgr->deselectAll(); 665 LLSelectMgr::getInstance()->deselectAll();
675 setCurrentTool( (LLTool*) mGrab ); 666 setCurrentTool( (LLTool*) mGrab );
676 } 667 }
677 668
@@ -712,9 +703,9 @@ BOOL LLToolCompGun::handleMouseDown(S32 x, S32 y, MASK mask)
712 703
713 // On mousedown, start grabbing 704 // On mousedown, start grabbing
714 gGrabTransientTool = this; 705 gGrabTransientTool = this;
715 gToolMgr->getCurrentToolset()->selectTool( (LLTool*) mGrab ); 706 LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool*) mGrab );
716 707
717 return gToolGrab->handleMouseDown(x, y, mask); 708 return LLToolGrab::getInstance()->handleMouseDown(x, y, mask);
718} 709}
719 710
720 711
@@ -729,9 +720,9 @@ BOOL LLToolCompGun::handleDoubleClick(S32 x, S32 y, MASK mask)
729 720
730 // On mousedown, start grabbing 721 // On mousedown, start grabbing
731 gGrabTransientTool = this; 722 gGrabTransientTool = this;
732 gToolMgr->getCurrentToolset()->selectTool( (LLTool*) mGrab ); 723 LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool*) mGrab );
733 724
734 return gToolGrab->handleDoubleClick(x, y, mask); 725 return LLToolGrab::getInstance()->handleDoubleClick(x, y, mask);
735} 726}
736 727
737 728