diff options
Diffstat (limited to 'indra/newview/lltoolgrab.cpp')
-rw-r--r-- | indra/newview/lltoolgrab.cpp | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp index 59bfebafe4..f3ec655f00 100644 --- a/indra/newview/lltoolgrab.cpp +++ b/indra/newview/lltoolgrab.cpp @@ -62,10 +62,10 @@ const S32 SLOP_DIST_SQ = 4; // Override modifier key behavior with these buttons -BOOL gGrabBtnVertical = FALSE; -BOOL gGrabBtnSpin = FALSE; +bool gGrabBtnVertical = false; +bool gGrabBtnSpin = false; LLTool* gGrabTransientTool = NULL; -extern BOOL gDebugClicks; +extern bool gDebugClicks; // // Methods @@ -73,20 +73,20 @@ extern BOOL gDebugClicks; LLToolGrabBase::LLToolGrabBase( LLToolComposite* composite ) : LLTool( std::string("Grab"), composite ), mMode( GRAB_INACTIVE ), - mVerticalDragging( FALSE ), - mHitLand(FALSE), + mVerticalDragging( false ), + mHitLand(false), mLastMouseX(0), mLastMouseY(0), mAccumDeltaX(0), mAccumDeltaY(0), - mHasMoved( FALSE ), - mOutsideSlop(FALSE), - mDeselectedThisClick(FALSE), + mHasMoved( false ), + mOutsideSlop(false), + mDeselectedThisClick(false), mLastFace(0), - mSpinGrabbing( FALSE ), + mSpinGrabbing( false ), mSpinRotation(), - mClickedInMouselook( FALSE ), - mHideBuildHighlight(FALSE) + mClickedInMouselook( false ), + mHideBuildHighlight(false) { } LLToolGrabBase::~LLToolGrabBase() @@ -103,19 +103,19 @@ void LLToolGrabBase::handleSelect() // in case we start from tools floater, we count any selection as valid mValidSelection = gFloaterTools->getVisible(); } - gGrabBtnVertical = FALSE; - gGrabBtnSpin = FALSE; + gGrabBtnVertical = false; + gGrabBtnSpin = false; } void LLToolGrabBase::handleDeselect() { if( hasMouseCapture() ) { - setMouseCapture( FALSE ); + setMouseCapture( false ); } // Make sure that temporary(invalid) selection won't pass anywhere except pie tool. - MASK override_mask = gKeyboard ? gKeyboard->currentMask(TRUE) : 0; + MASK override_mask = gKeyboard ? gKeyboard->currentMask(true) : 0; if (!mValidSelection && (override_mask != MASK_NONE || (gFloaterTools && gFloaterTools->getVisible()))) { LLMenuGL::sMenuContainer->hideMenus(); @@ -124,17 +124,17 @@ void LLToolGrabBase::handleDeselect() } -BOOL LLToolGrabBase::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLToolGrabBase::handleDoubleClick(S32 x, S32 y, MASK mask) { if (gDebugClicks) { LL_INFOS() << "LLToolGrab handleDoubleClick (becoming mouseDown)" << LL_ENDL; } - return FALSE; + return false; } -BOOL LLToolGrabBase::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolGrabBase::handleMouseDown(S32 x, S32 y, MASK mask) { if (gDebugClicks) { @@ -147,7 +147,7 @@ BOOL LLToolGrabBase::handleMouseDown(S32 x, S32 y, MASK mask) if (!gAgent.leftButtonGrabbed() || ((mask & DEFAULT_GRAB_MASK) != 0 && !gAgentCamera.cameraMouselook())) { // can grab transparent objects (how touch event propagates, scripters rely on this) - gViewerWindow->pickAsync(x, y, mask, pickCallback, /*BOOL pick_transparent*/ TRUE); + gViewerWindow->pickAsync(x, y, mask, pickCallback, /*bool pick_transparent*/ true); } mClickedInMouselook = gAgentCamera.cameraMouselook(); @@ -163,7 +163,7 @@ BOOL LLToolGrabBase::handleMouseDown(S32 x, S32 y, MASK mask) // Todo: LLToolGrabBase probably shouldn't consume the event if there is nothing // to grab in Mouselook, it intercepts handling in scanMouse } - return TRUE; + return true; } void LLToolGrabBase::pickCallback(const LLPickInfo& pick_info) @@ -171,22 +171,22 @@ void LLToolGrabBase::pickCallback(const LLPickInfo& pick_info) LLToolGrab::getInstance()->mGrabPick = pick_info; LLViewerObject *objectp = pick_info.getObject(); - BOOL extend_select = (pick_info.mKeyMask & MASK_SHIFT); + bool extend_select = (pick_info.mKeyMask & MASK_SHIFT); if (!extend_select && !LLSelectMgr::getInstance()->getSelection()->isEmpty()) { LLSelectMgr::getInstance()->deselectAll(); - LLToolGrab::getInstance()->mDeselectedThisClick = TRUE; + LLToolGrab::getInstance()->mDeselectedThisClick = true; } else { - LLToolGrab::getInstance()->mDeselectedThisClick = FALSE; + LLToolGrab::getInstance()->mDeselectedThisClick = false; } // if not over object, do nothing if (!objectp) { - LLToolGrab::getInstance()->setMouseCapture(TRUE); + LLToolGrab::getInstance()->setMouseCapture(true); LLToolGrab::getInstance()->mMode = GRAB_NOOBJECT; LLToolGrab::getInstance()->mGrabPick.mObjectID.setNull(); } @@ -196,7 +196,7 @@ void LLToolGrabBase::pickCallback(const LLPickInfo& pick_info) } } -BOOL LLToolGrabBase::handleObjectHit(const LLPickInfo& info) +bool LLToolGrabBase::handleObjectHit(const LLPickInfo& info) { mGrabPick = info; LLViewerObject* objectp = mGrabPick.getObject(); @@ -208,8 +208,8 @@ BOOL LLToolGrabBase::handleObjectHit(const LLPickInfo& info) if (NULL == objectp) // unexpected { - LL_WARNS() << "objectp was NULL; returning FALSE" << LL_ENDL; - return FALSE; + LL_WARNS() << "objectp was NULL; returning false" << LL_ENDL; + return false; } if (objectp->isAvatar()) @@ -219,16 +219,16 @@ BOOL LLToolGrabBase::handleObjectHit(const LLPickInfo& info) gBasicToolset->selectTool( gGrabTransientTool ); gGrabTransientTool = NULL; } - return TRUE; + return true; } - setMouseCapture( TRUE ); + setMouseCapture( true ); // Grabs always start from the root // objectp = (LLViewerObject *)objectp->getRoot(); LLViewerObject* parent = objectp->getRootEdit(); - BOOL script_touch = (objectp->flagHandleTouch()) || (parent && parent->flagHandleTouch()); + bool script_touch = (objectp->flagHandleTouch()) || (parent && parent->flagHandleTouch()); // Clicks on scripted or physical objects are temporary grabs, so // not "Build mode" @@ -291,8 +291,8 @@ BOOL LLToolGrabBase::handleObjectHit(const LLPickInfo& info) mLastMouseY = gViewerWindow->getCurrentMouseY(); mAccumDeltaX = 0; mAccumDeltaY = 0; - mHasMoved = FALSE; - mOutsideSlop = FALSE; + mHasMoved = false; + mOutsideSlop = false; mVerticalDragging = (info.mKeyMask == MASK_VERTICAL) || gGrabBtnVertical; @@ -325,7 +325,7 @@ BOOL LLToolGrabBase::handleObjectHit(const LLPickInfo& info) gGrabTransientTool = NULL; } - return TRUE; + return true; } @@ -336,7 +336,7 @@ void LLToolGrabBase::startSpin() { return; } - mSpinGrabbing = TRUE; + mSpinGrabbing = true; // Was saveSelectedObjectTransform() LLViewerObject *root = (LLViewerObject *)objectp->getRoot(); @@ -355,7 +355,7 @@ void LLToolGrabBase::startSpin() void LLToolGrabBase::stopSpin() { - mSpinGrabbing = FALSE; + mSpinGrabbing = false; LLViewerObject* objectp = mGrabPick.getObject(); if (!objectp) @@ -436,13 +436,13 @@ void LLToolGrabBase::startGrab() } -BOOL LLToolGrabBase::handleHover(S32 x, S32 y, MASK mask) +bool LLToolGrabBase::handleHover(S32 x, S32 y, MASK mask) { if (!gViewerWindow->getLeftMouseDown()) { gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB); - setMouseCapture(FALSE); - return TRUE; + setMouseCapture(false); + return true; } // Do the right hover based on mode @@ -470,7 +470,7 @@ BOOL LLToolGrabBase::handleHover(S32 x, S32 y, MASK mask) mLastMouseX = x; mLastMouseY = y; - return TRUE; + return true; } const F32 GRAB_SENSITIVITY_X = 0.0075f; @@ -487,7 +487,7 @@ void LLToolGrabBase::handleHoverActive(S32 x, S32 y, MASK mask) if (objectp->isDead()) { // Bail out of drag because object has been killed - setMouseCapture(FALSE); + setMouseCapture(false); return; } @@ -499,12 +499,12 @@ void LLToolGrabBase::handleHoverActive(S32 x, S32 y, MASK mask) if ((mask == MASK_VERTICAL) || (gGrabBtnVertical && (mask != MASK_SPIN))) { - vertical_dragging = TRUE; + vertical_dragging = true; } else if ((mask == MASK_SPIN) || (gGrabBtnSpin && (mask != MASK_VERTICAL))) { - spin_grabbing = TRUE; + spin_grabbing = true; } //-------------------------------------------------- @@ -552,11 +552,11 @@ void LLToolGrabBase::handleHoverActive(S32 x, S32 y, MASK mask) S32 dist_sq = mAccumDeltaX * mAccumDeltaX + mAccumDeltaY * mAccumDeltaY; if (dist_sq > SLOP_DIST_SQ) { - mOutsideSlop = TRUE; + mOutsideSlop = true; } // mouse has moved outside center - mHasMoved = TRUE; + mHasMoved = true; if (mSpinGrabbing) { @@ -628,7 +628,7 @@ void LLToolGrabBase::handleHoverActive(S32 x, S32 y, MASK mask) /* Snap to grid disabled for grab tool - very confusing // Handle snapping to grid, but only when the tool is formally selected. - BOOL snap_on = gSavedSettings.getBOOL("SnapEnabled"); + bool snap_on = gSavedSettings.getBOOL("SnapEnabled"); if (snap_on && !gGrabTransientTool) { F64 snap_size = gSavedSettings.getF32("GridResolution"); @@ -741,7 +741,7 @@ void LLToolGrabBase::handleHoverActive(S32 x, S32 y, MASK mask) // force focus to point in space where we were looking previously // Example of use: follow cam scripts shouldn't affect you when movng objects arouns gAgentCamera.setFocusGlobal(gAgentCamera.calcFocusPositionTargetGlobal(), LLUUID::null); - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(false, ANIMATE); } } else @@ -764,7 +764,7 @@ void LLToolGrabBase::handleHoverNonPhysical(S32 x, S32 y, MASK mask) if (objectp->isDead()) { // Bail out of drag because object has been killed - setMouseCapture(FALSE); + setMouseCapture(false); return; } @@ -782,7 +782,7 @@ void LLToolGrabBase::handleHoverNonPhysical(S32 x, S32 y, MASK mask) LLVector3 grab_pos_region(0,0,0); - const BOOL SUPPORT_LLDETECTED_GRAB = TRUE; + const bool SUPPORT_LLDETECTED_GRAB = true; if (SUPPORT_LLDETECTED_GRAB) { //-------------------------------------------------- @@ -790,13 +790,13 @@ void LLToolGrabBase::handleHoverNonPhysical(S32 x, S32 y, MASK mask) //-------------------------------------------------- if (!(mask == MASK_VERTICAL) && !gGrabBtnVertical) { - mVerticalDragging = FALSE; + mVerticalDragging = false; } else if ((gGrabBtnVertical && (mask != MASK_SPIN)) || (mask == MASK_VERTICAL)) { - mVerticalDragging = TRUE; + mVerticalDragging = true; } S32 dx = x - mLastMouseX; @@ -810,11 +810,11 @@ void LLToolGrabBase::handleHoverNonPhysical(S32 x, S32 y, MASK mask) S32 dist_sq = mAccumDeltaX * mAccumDeltaX + mAccumDeltaY * mAccumDeltaY; if (dist_sq > SLOP_DIST_SQ) { - mOutsideSlop = TRUE; + mOutsideSlop = true; } // mouse has moved - mHasMoved = TRUE; + mHasMoved = true; //------------------------------------------------------ // Handle grabbing @@ -853,7 +853,7 @@ void LLToolGrabBase::handleHoverNonPhysical(S32 x, S32 y, MASK mask) // only send message if something has changed since last message - BOOL changed_since_last_update = FALSE; + bool changed_since_last_update = false; // test if touch data needs to be updated if ((pick.mObjectFace != mLastFace) || @@ -864,7 +864,7 @@ void LLToolGrabBase::handleHoverNonPhysical(S32 x, S32 y, MASK mask) (pick.mBinormal != mLastBinormal) || (grab_pos_region != mLastGrabPos)) { - changed_since_last_update = TRUE; + changed_since_last_update = true; } if (changed_since_last_update) @@ -935,7 +935,7 @@ void LLToolGrabBase::handleHoverFailed(S32 x, S32 y, MASK mask) S32 dist_sq = (x-mGrabPick.mMousePt.mX) * (x-mGrabPick.mMousePt.mX) + (y-mGrabPick.mMousePt.mY) * (y-mGrabPick.mMousePt.mY); if( mOutsideSlop || dist_sq > SLOP_DIST_SQ ) { - mOutsideSlop = TRUE; + mOutsideSlop = true; switch( mMode ) { @@ -964,7 +964,7 @@ void LLToolGrabBase::handleHoverFailed(S32 x, S32 y, MASK mask) -BOOL LLToolGrabBase::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolGrabBase::handleMouseUp(S32 x, S32 y, MASK mask) { LLTool::handleMouseUp(x, y, mask); @@ -980,14 +980,14 @@ BOOL LLToolGrabBase::handleMouseUp(S32 x, S32 y, MASK mask) if( hasMouseCapture() ) { - setMouseCapture( FALSE ); + setMouseCapture( false ); } mMode = GRAB_INACTIVE; if(mClickedInMouselook && !gAgentCamera.cameraMouselook()) { - mClickedInMouselook = FALSE; + mClickedInMouselook = false; } else { @@ -1001,14 +1001,14 @@ BOOL LLToolGrabBase::handleMouseUp(S32 x, S32 y, MASK mask) //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject")); - return TRUE; + return true; } void LLToolGrabBase::stopEditing() { if( hasMouseCapture() ) { - setMouseCapture( FALSE ); + setMouseCapture( false ); } } @@ -1057,7 +1057,7 @@ void LLToolGrabBase::onMouseCaptureLost() mMode = GRAB_INACTIVE; - mHideBuildHighlight = FALSE; + mHideBuildHighlight = false; mGrabPick.mObjectID.setNull(); @@ -1096,7 +1096,7 @@ void LLToolGrabBase::stopGrab() case GRAB_NONPHYSICAL: case GRAB_LOCKED: send_ObjectDeGrab_message(objectp, pick); - mVerticalDragging = FALSE; + mVerticalDragging = false; break; case GRAB_NOOBJECT: @@ -1106,7 +1106,7 @@ void LLToolGrabBase::stopGrab() break; } - mHideBuildHighlight = FALSE; + mHideBuildHighlight = false; } @@ -1116,7 +1116,7 @@ void LLToolGrabBase::draw() void LLToolGrabBase::render() { } -BOOL LLToolGrabBase::isEditing() +bool LLToolGrabBase::isEditing() { return (mGrabPick.getObject().notNull()); } |