lltoolcomp.cpp

Go to the documentation of this file.
00001 
00032 #include "llviewerprecompiledheaders.h"
00033 
00034 #include "lltoolcomp.h"
00035 
00036 #include "llgl.h"
00037 #include "indra_constants.h"
00038 
00039 #include "llmanip.h"
00040 #include "llmaniprotate.h"
00041 #include "llmanipscale.h"
00042 #include "llmaniptranslate.h"
00043 #include "llmenugl.h"                   // for right-click menu hack
00044 #include "llselectmgr.h"
00045 #include "lltoolfocus.h"
00046 #include "lltoolgrab.h"
00047 #include "lltoolgun.h"
00048 #include "lltoolmgr.h"
00049 #include "lltoolselectrect.h"
00050 #include "lltoolplacer.h"
00051 #include "llviewermenu.h"
00052 #include "llviewerobject.h"
00053 #include "llviewerwindow.h"
00054 #include "llagent.h"
00055 #include "llfloatertools.h"
00056 #include "llviewercontrol.h"
00057 
00058 const S32 BUTTON_HEIGHT = 16;
00059 const S32 BUTTON_WIDTH_SMALL = 32;
00060 const S32 BUTTON_WIDTH_BIG = 48;
00061 const S32 HPAD = 4;
00062 
00063 extern LLControlGroup gSavedSettings;
00064 
00065 
00066 //-----------------------------------------------------------------------
00067 // LLToolComposite
00068 
00069 //static
00070 void LLToolComposite::setCurrentTool( LLTool* new_tool )
00071 {
00072         if( mCur != new_tool )
00073         {
00074                 if( mSelected )
00075                 {
00076                         mCur->handleDeselect();
00077                         mCur = new_tool;
00078                         mCur->handleSelect();
00079                 }
00080                 else
00081                 {
00082                         mCur = new_tool;
00083                 }
00084         }
00085 }
00086 
00087 LLToolComposite::LLToolComposite(const LLString& name)
00088         : LLTool(name),
00089           mCur(NULL), mDefault(NULL), mSelected(FALSE),
00090           mMouseDown(FALSE), mManip(NULL), mSelectRect(NULL)
00091 {
00092 }
00093 
00094 // Returns to the default tool
00095 BOOL LLToolComposite::handleMouseUp(S32 x, S32 y, MASK mask)
00096 { 
00097         BOOL handled = mCur->handleMouseUp( x, y, mask );
00098         if( handled )
00099         {
00100                 setCurrentTool( mDefault );
00101         }
00102  return handled;
00103 }
00104 
00105 void LLToolComposite::onMouseCaptureLost()
00106 {
00107         mCur->onMouseCaptureLost();
00108         setCurrentTool( mDefault );
00109 }
00110 
00111 BOOL LLToolComposite::isSelecting()
00112 { 
00113         return mCur == mSelectRect; 
00114 }
00115 
00116 void LLToolComposite::handleSelect()
00117 {
00118         if (!gSavedSettings.getBOOL("EditLinkedParts"))
00119         {
00120                 LLSelectMgr::getInstance()->promoteSelectionToRoot();
00121         }
00122         mCur = mDefault; 
00123         mCur->handleSelect(); 
00124         mSelected = TRUE; 
00125 }
00126 
00127 //----------------------------------------------------------------------------
00128 // LLToolCompInspect
00129 //----------------------------------------------------------------------------
00130 
00131 LLToolCompInspect::LLToolCompInspect()
00132 : LLToolComposite("Inspect")
00133 {
00134         mSelectRect             = new LLToolSelectRect(this);
00135         mDefault = mSelectRect;
00136 }
00137 
00138 
00139 LLToolCompInspect::~LLToolCompInspect()
00140 {
00141         delete mSelectRect;
00142         mSelectRect = NULL;
00143 }
00144 
00145 BOOL LLToolCompInspect::handleMouseDown(S32 x, S32 y, MASK mask)
00146 {
00147         mMouseDown = TRUE;
00148         gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback);
00149         return TRUE;
00150 }
00151 
00152 void LLToolCompInspect::pickCallback(S32 x, S32 y, MASK mask)
00153 {
00154         LLViewerObject* hit_obj = gViewerWindow->lastObjectHit();
00155 
00156         if (!LLToolCompInspect::getInstance()->mMouseDown)
00157         {
00158                 // fast click on object, but mouse is already up...just do select
00159                 LLToolCompInspect::getInstance()->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
00160                 return;
00161         }
00162 
00163         if( hit_obj )
00164         {
00165                 if (LLSelectMgr::getInstance()->getSelection()->getObjectCount())
00166                 {
00167                         LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
00168                 }
00169                 LLToolCompInspect::getInstance()->setCurrentTool( LLToolCompInspect::getInstance()->mSelectRect );
00170                 LLToolCompInspect::getInstance()->mSelectRect->handleMouseDown( x, y, mask );
00171 
00172         }
00173         else
00174         {
00175                 LLToolCompInspect::getInstance()->setCurrentTool( LLToolCompInspect::getInstance()->mSelectRect );
00176                 LLToolCompInspect::getInstance()->mSelectRect->handleMouseDown( x, y, mask);
00177         }
00178 }
00179 
00180 BOOL LLToolCompInspect::handleDoubleClick(S32 x, S32 y, MASK mask)
00181 {
00182         return TRUE;
00183 }
00184 
00185 //----------------------------------------------------------------------------
00186 // LLToolCompTranslate
00187 //----------------------------------------------------------------------------
00188 
00189 LLToolCompTranslate::LLToolCompTranslate()
00190         : LLToolComposite("Move")
00191 {
00192         mManip          = new LLManipTranslate(this);
00193         mSelectRect             = new LLToolSelectRect(this);
00194 
00195         mCur                    = mManip;
00196         mDefault                = mManip;
00197 }
00198 
00199 LLToolCompTranslate::~LLToolCompTranslate()
00200 {
00201         delete mManip;
00202         mManip = NULL;
00203 
00204         delete mSelectRect;
00205         mSelectRect = NULL;
00206 }
00207 
00208 BOOL LLToolCompTranslate::handleHover(S32 x, S32 y, MASK mask)
00209 {
00210         if( !mCur->hasMouseCapture() )
00211         {
00212                 setCurrentTool( mManip );
00213         }
00214         return mCur->handleHover( x, y, mask );
00215 }
00216 
00217 
00218 BOOL LLToolCompTranslate::handleMouseDown(S32 x, S32 y, MASK mask)
00219 {
00220         mMouseDown = TRUE;
00221         gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback, TRUE);
00222         return TRUE;
00223 }
00224 
00225 void LLToolCompTranslate::pickCallback(S32 x, S32 y, MASK mask)
00226 {
00227         LLViewerObject* hit_obj = gViewerWindow->lastObjectHit();
00228 
00229         LLToolCompTranslate::getInstance()->mManip->highlightManipulators(x, y);
00230         if (!LLToolCompTranslate::getInstance()->mMouseDown)
00231         {
00232                 // fast click on object, but mouse is already up...just do select
00233                 LLToolCompTranslate::getInstance()->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
00234                 return;
00235         }
00236 
00237         if( hit_obj || LLToolCompTranslate::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART )
00238         {
00239                 if (LLToolCompTranslate::getInstance()->mManip->getSelection()->getObjectCount())
00240                 {
00241                         LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
00242                 }
00243 
00244                 BOOL can_move = LLToolCompTranslate::getInstance()->mManip->canAffectSelection();
00245 
00246                 if(     LLManip::LL_NO_PART != LLToolCompTranslate::getInstance()->mManip->getHighlightedPart() && can_move)
00247                 {
00248                         LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mManip );
00249                         LLToolCompTranslate::getInstance()->mManip->handleMouseDownOnPart( x, y, mask );
00250                 }
00251                 else
00252                 {
00253                         LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mSelectRect );
00254                         LLToolCompTranslate::getInstance()->mSelectRect->handleMouseDown( x, y, mask );
00255 
00256                         // *TODO: add toggle to trigger old click-drag functionality
00257                         // LLToolCompTranslate::getInstance()->mManip->handleMouseDownOnPart( XY_part, x, y, mask);
00258                 }
00259         }
00260         else
00261         {
00262                 LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mSelectRect );
00263                 LLToolCompTranslate::getInstance()->mSelectRect->handleMouseDown( x, y, mask);
00264         }
00265 }
00266 
00267 BOOL LLToolCompTranslate::handleMouseUp(S32 x, S32 y, MASK mask)
00268 {
00269         mMouseDown = FALSE;
00270         return LLToolComposite::handleMouseUp(x, y, mask);
00271 }
00272 
00273 LLTool* LLToolCompTranslate::getOverrideTool(MASK mask)
00274 {
00275         if (mask == MASK_CONTROL)
00276         {
00277                 return LLToolCompRotate::getInstance();
00278         }
00279         else if (mask == (MASK_CONTROL | MASK_SHIFT))
00280         {
00281                 return LLToolCompScale::getInstance();
00282         }
00283         return LLToolComposite::getOverrideTool(mask);
00284 }
00285 
00286 BOOL LLToolCompTranslate::handleDoubleClick(S32 x, S32 y, MASK mask)
00287 {
00288         if (mManip->getSelection()->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART)
00289         {
00290                 // You should already have an object selected from the mousedown.
00291                 // If so, show its properties
00292                 gFloaterTools->showPanel(LLFloaterTools::PANEL_CONTENTS);
00293                 return TRUE;
00294         }
00295         // Nothing selected means the first mouse click was probably
00296         // bad, so try again.
00297         return FALSE;
00298 }
00299 
00300 
00301 void LLToolCompTranslate::render()
00302 {
00303         mCur->render(); // removing this will not draw the RGB arrows and guidelines
00304 
00305         if( mCur != mManip )
00306         {
00307                 LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
00308                 mManip->renderGuidelines();
00309         }
00310 }
00311 
00312 
00313 //-----------------------------------------------------------------------
00314 // LLToolCompScale
00315 
00316 LLToolCompScale::LLToolCompScale()
00317         : LLToolComposite("Stretch")
00318 {
00319         mManip = new LLManipScale(this);
00320         mSelectRect = new LLToolSelectRect(this);
00321 
00322         mCur = mManip;
00323         mDefault = mManip;
00324 }
00325 
00326 LLToolCompScale::~LLToolCompScale()
00327 {
00328         delete mManip;
00329         delete mSelectRect;
00330 }
00331 
00332 BOOL LLToolCompScale::handleHover(S32 x, S32 y, MASK mask)
00333 {
00334         if( !mCur->hasMouseCapture() )
00335         {
00336                 setCurrentTool(mManip );
00337         }
00338         return mCur->handleHover( x, y, mask );
00339 }
00340 
00341 
00342 BOOL LLToolCompScale::handleMouseDown(S32 x, S32 y, MASK mask)
00343 {
00344         mMouseDown = TRUE;
00345         gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback);
00346         return TRUE;
00347 }
00348 
00349 void LLToolCompScale::pickCallback(S32 x, S32 y, MASK mask)
00350 {
00351         LLViewerObject* hit_obj = gViewerWindow->lastObjectHit();
00352 
00353         LLToolCompScale::getInstance()->mManip->highlightManipulators(x, y);
00354         if (!LLToolCompScale::getInstance()->mMouseDown)
00355         {
00356                 // fast click on object, but mouse is already up...just do select
00357                 LLToolCompScale::getInstance()->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
00358 
00359                 return;
00360         }
00361 
00362         if( hit_obj || LLToolCompScale::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART)
00363         {
00364                 if (LLToolCompScale::getInstance()->mManip->getSelection()->getObjectCount())
00365                 {
00366                         LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
00367                 }
00368                 if(     LLManip::LL_NO_PART != LLToolCompScale::getInstance()->mManip->getHighlightedPart() )
00369                 {
00370                         LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mManip );
00371                         LLToolCompScale::getInstance()->mManip->handleMouseDownOnPart( x, y, mask );
00372                 }
00373                 else
00374                 {
00375                         LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mSelectRect );
00376                         LLToolCompScale::getInstance()->mSelectRect->handleMouseDown( x, y, mask );
00377                 }
00378         }
00379         else
00380         {
00381                 LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mSelectRect );
00382                 LLToolCompScale::getInstance()->mCur->handleMouseDown( x, y, mask );
00383         }
00384 }
00385 
00386 BOOL LLToolCompScale::handleMouseUp(S32 x, S32 y, MASK mask)
00387 {
00388         mMouseDown = FALSE;
00389         return LLToolComposite::handleMouseUp(x, y, mask);
00390 }
00391 
00392 LLTool* LLToolCompScale::getOverrideTool(MASK mask)
00393 {
00394         if (mask == MASK_CONTROL)
00395         {
00396                 return LLToolCompRotate::getInstance();
00397         }
00398 
00399         return LLToolComposite::getOverrideTool(mask);
00400 }
00401 
00402 
00403 BOOL LLToolCompScale::handleDoubleClick(S32 x, S32 y, MASK mask)
00404 {
00405         if (!mManip->getSelection()->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART)
00406         {
00407                 // You should already have an object selected from the mousedown.
00408                 // If so, show its properties
00409                 gFloaterTools->showPanel(LLFloaterTools::PANEL_CONTENTS);
00410                 //gBuildView->setPropertiesPanelOpen(TRUE);
00411                 return TRUE;
00412         }
00413         else
00414         {
00415                 // Nothing selected means the first mouse click was probably
00416                 // bad, so try again.
00417                 return handleMouseDown(x, y, mask);
00418         }
00419 }
00420 
00421 
00422 void LLToolCompScale::render()
00423 {
00424         mCur->render();
00425 
00426         if( mCur != mManip )
00427         {
00428                 LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
00429                 mManip->renderGuidelines();
00430         }
00431 }
00432 
00433 //-----------------------------------------------------------------------
00434 // LLToolCompCreate
00435 
00436 LLToolCompCreate::LLToolCompCreate()
00437         : LLToolComposite("Create")
00438 {
00439         mPlacer = new LLToolPlacer();
00440         mSelectRect = new LLToolSelectRect(this);
00441 
00442         mCur = mPlacer;
00443         mDefault = mPlacer;
00444         mObjectPlacedOnMouseDown = FALSE;
00445 }
00446 
00447 
00448 LLToolCompCreate::~LLToolCompCreate()
00449 {
00450         delete mPlacer;
00451         delete mSelectRect;
00452 }
00453 
00454 
00455 BOOL LLToolCompCreate::handleMouseDown(S32 x, S32 y, MASK mask)
00456 {
00457         BOOL handled = FALSE;
00458         mMouseDown = TRUE;
00459 
00460         if ( !(mask == MASK_SHIFT) && !(mask == MASK_CONTROL) )
00461         {
00462                 setCurrentTool( mPlacer );
00463                 handled = mPlacer->placeObject( x, y, mask );
00464         }
00465         else
00466         {
00467                 gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback);
00468                 handled = TRUE;
00469         }
00470         
00471         mObjectPlacedOnMouseDown = TRUE;
00472 
00473         return TRUE;
00474 }
00475 
00476 void LLToolCompCreate::pickCallback(S32 x, S32 y, MASK mask)
00477 {
00478         // *NOTE: We mask off shift and control, so you cannot
00479         // multi-select multiple objects with the create tool.
00480         mask = (mask & ~MASK_SHIFT);
00481         mask = (mask & ~MASK_CONTROL);
00482 
00483         LLToolCompCreate::getInstance()->setCurrentTool( LLToolCompCreate::getInstance()->mSelectRect );
00484         LLToolCompCreate::getInstance()->mSelectRect->handleMouseDown( x, y, mask);
00485 }
00486 
00487 BOOL LLToolCompCreate::handleDoubleClick(S32 x, S32 y, MASK mask)
00488 {
00489         return handleMouseDown(x, y, mask);
00490 }
00491 
00492 BOOL LLToolCompCreate::handleMouseUp(S32 x, S32 y, MASK mask)
00493 {
00494         BOOL handled = FALSE;
00495 
00496         if ( mMouseDown && !mObjectPlacedOnMouseDown && !(mask == MASK_SHIFT) && !(mask == MASK_CONTROL) )
00497         {
00498                 setCurrentTool( mPlacer );
00499                 handled = mPlacer->placeObject( x, y, mask );
00500         }
00501 
00502         mObjectPlacedOnMouseDown = FALSE;
00503         mMouseDown = FALSE;
00504 
00505         if (!handled)
00506         {
00507                 handled = LLToolComposite::handleMouseUp(x, y, mask);
00508         }
00509 
00510         return handled;
00511 }
00512 
00513 //-----------------------------------------------------------------------
00514 // LLToolCompRotate
00515 
00516 LLToolCompRotate::LLToolCompRotate()
00517         : LLToolComposite("Rotate")
00518 {
00519         mManip = new LLManipRotate(this);
00520         mSelectRect = new LLToolSelectRect(this);
00521 
00522         mCur = mManip;
00523         mDefault = mManip;
00524 }
00525 
00526 
00527 LLToolCompRotate::~LLToolCompRotate()
00528 {
00529         delete mManip;
00530         delete mSelectRect;
00531 }
00532 
00533 BOOL LLToolCompRotate::handleHover(S32 x, S32 y, MASK mask)
00534 {
00535         if( !mCur->hasMouseCapture() )
00536         {
00537                 setCurrentTool( mManip );
00538         }
00539         return mCur->handleHover( x, y, mask );
00540 }
00541 
00542 
00543 BOOL LLToolCompRotate::handleMouseDown(S32 x, S32 y, MASK mask)
00544 {
00545         mMouseDown = TRUE;
00546         gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback);
00547         return TRUE;
00548 }
00549 
00550 void LLToolCompRotate::pickCallback(S32 x, S32 y, MASK mask)
00551 {
00552         LLViewerObject* hit_obj = gViewerWindow->lastObjectHit();
00553 
00554         LLToolCompRotate::getInstance()->mManip->highlightManipulators(x, y);
00555         if (!LLToolCompRotate::getInstance()->mMouseDown)
00556         {
00557                 // fast click on object, but mouse is already up...just do select
00558                 LLToolCompRotate::getInstance()->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
00559                 return;
00560         }
00561         
00562         if( hit_obj || LLToolCompRotate::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART)
00563         {
00564                 if (LLToolCompRotate::getInstance()->mManip->getSelection()->getObjectCount())
00565                 {
00566                         LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
00567                 }
00568                 if(     LLManip::LL_NO_PART != LLToolCompRotate::getInstance()->mManip->getHighlightedPart() )
00569                 {
00570                         LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mManip );
00571                         LLToolCompRotate::getInstance()->mManip->handleMouseDownOnPart( x, y, mask );
00572                 }
00573                 else
00574                 {
00575                         LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mSelectRect );
00576                         LLToolCompRotate::getInstance()->mSelectRect->handleMouseDown( x, y, mask );
00577                 }
00578         }
00579         else
00580         {
00581                 LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mSelectRect );
00582                 LLToolCompRotate::getInstance()->mCur->handleMouseDown( x, y, mask );
00583         }
00584 }
00585 
00586 BOOL LLToolCompRotate::handleMouseUp(S32 x, S32 y, MASK mask)
00587 {
00588         mMouseDown = FALSE;
00589         return LLToolComposite::handleMouseUp(x, y, mask);
00590 }
00591 
00592 LLTool* LLToolCompRotate::getOverrideTool(MASK mask)
00593 {
00594         if (mask == (MASK_CONTROL | MASK_SHIFT))
00595         {
00596                 return LLToolCompScale::getInstance();
00597         }
00598         return LLToolComposite::getOverrideTool(mask);
00599 }
00600 
00601 BOOL LLToolCompRotate::handleDoubleClick(S32 x, S32 y, MASK mask)
00602 {
00603         if (!mManip->getSelection()->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART)
00604         {
00605                 // You should already have an object selected from the mousedown.
00606                 // If so, show its properties
00607                 gFloaterTools->showPanel(LLFloaterTools::PANEL_CONTENTS);
00608                 //gBuildView->setPropertiesPanelOpen(TRUE);
00609                 return TRUE;
00610         }
00611         else
00612         {
00613                 // Nothing selected means the first mouse click was probably
00614                 // bad, so try again.
00615                 return handleMouseDown(x, y, mask);
00616         }
00617 }
00618 
00619 
00620 void LLToolCompRotate::render()
00621 {
00622         mCur->render();
00623 
00624         if( mCur != mManip )
00625         {
00626                 LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
00627                 mManip->renderGuidelines();
00628         }
00629 }
00630 
00631 
00632 //-----------------------------------------------------------------------
00633 // LLToolCompGun
00634 
00635 LLToolCompGun::LLToolCompGun()
00636         : LLToolComposite("Mouselook")
00637 {
00638         mGun = new LLToolGun(this);
00639         mGrab = new LLToolGrab(this);
00640         mNull = new LLTool("null", this);
00641 
00642         setCurrentTool(mGun);
00643         mDefault = mGun;
00644 }
00645 
00646 
00647 LLToolCompGun::~LLToolCompGun()
00648 {
00649         delete mGun;
00650         mGun = NULL;
00651 
00652         delete mGrab;
00653         mGrab = NULL;
00654 
00655         delete mNull;
00656         mNull = NULL;
00657 }
00658 
00659 BOOL LLToolCompGun::handleHover(S32 x, S32 y, MASK mask)
00660 {
00661         // *NOTE: This hack is here to make mouselook kick in again after
00662         // item selected from context menu.
00663         if ( mCur == mNull && !gPopupMenuView->getVisible() )
00664         {
00665                 LLSelectMgr::getInstance()->deselectAll();
00666                 setCurrentTool( (LLTool*) mGrab );
00667         }
00668 
00669         // Note: if the tool changed, we can't delegate the current mouse event
00670         // after the change because tools can modify the mouse during selection and deselection.
00671         // Instead we let the current tool handle the event and then make the change.
00672         // The new tool will take effect on the next frame.
00673 
00674         mCur->handleHover( x, y, mask );
00675 
00676         // If mouse button not down...
00677         if( !gViewerWindow->getLeftMouseDown())
00678         {
00679                 // let ALT switch from gun to grab
00680                 if ( mCur == mGun && (mask & MASK_ALT) )
00681                 {
00682                         setCurrentTool( (LLTool*) mGrab );
00683                 }
00684                 else if ( mCur == mGrab && !(mask & MASK_ALT) )
00685                 {
00686                         setCurrentTool( (LLTool*) mGun );
00687                         setMouseCapture(TRUE);
00688                 }
00689         }
00690 
00691         return TRUE; 
00692 }
00693 
00694 
00695 BOOL LLToolCompGun::handleMouseDown(S32 x, S32 y, MASK mask)
00696 { 
00697         // if the left button is grabbed, don't put up the pie menu
00698         if (gAgent.leftButtonGrabbed())
00699         {
00700                 gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN);
00701                 return FALSE;
00702         }
00703 
00704         // On mousedown, start grabbing
00705         gGrabTransientTool = this;
00706         LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool*) mGrab );
00707 
00708         return LLToolGrab::getInstance()->handleMouseDown(x, y, mask);
00709 }
00710 
00711 
00712 BOOL LLToolCompGun::handleDoubleClick(S32 x, S32 y, MASK mask)
00713 {
00714         // if the left button is grabbed, don't put up the pie menu
00715         if (gAgent.leftButtonGrabbed())
00716         {
00717                 gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN);
00718                 return FALSE;
00719         }
00720 
00721         // On mousedown, start grabbing
00722         gGrabTransientTool = this;
00723         LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool*) mGrab );
00724 
00725         return LLToolGrab::getInstance()->handleDoubleClick(x, y, mask);
00726 }
00727 
00728 
00729 BOOL LLToolCompGun::handleRightMouseDown(S32 x, S32 y, MASK mask)
00730 {
00731         /* JC - suppress context menu 8/29/2002
00732 
00733         // On right mouse, go through some convoluted steps to
00734         // make the build menu appear.
00735         setCurrentTool( (LLTool*) mNull );
00736 
00737         // This should return FALSE, meaning the context menu will
00738         // be shown.
00739         return FALSE;
00740         */
00741 
00742         // Returning true will suppress the context menu
00743         return TRUE;
00744 }
00745 
00746 
00747 BOOL LLToolCompGun::handleMouseUp(S32 x, S32 y, MASK mask)
00748 {
00749         gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_UP);
00750         setCurrentTool( (LLTool*) mGun );
00751         return TRUE;
00752 }
00753 
00754 void LLToolCompGun::onMouseCaptureLost()
00755 {
00756         if (mComposite)
00757         {
00758                 mComposite->onMouseCaptureLost();
00759                 return;
00760         }
00761         mCur->onMouseCaptureLost();
00762 
00763         // JC - I don't know if this is necessary.  Maybe we could lose capture
00764         // if someone ALT-Tab's out when in mouselook.
00765         setCurrentTool( (LLTool*) mGun );
00766 }
00767 
00768 void    LLToolCompGun::handleSelect()
00769 {
00770         LLToolComposite::handleSelect();
00771         setMouseCapture(TRUE);
00772 }
00773 
00774 void    LLToolCompGun::handleDeselect()
00775 {
00776         LLToolComposite::handleDeselect();
00777         setMouseCapture(FALSE);
00778 }
00779 
00780 
00781 BOOL LLToolCompGun::handleScrollWheel(S32 x, S32 y, S32 clicks)
00782 {
00783         if (clicks > 0)
00784         {
00785                 gAgent.changeCameraToDefault();
00786 
00787         }
00788         return TRUE;
00789 }

Generated on Fri May 16 08:34:06 2008 for SecondLife by  doxygen 1.5.5