From c285f59ce2a05703e3a1232fcaf3ee3aea714b3f Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sun, 18 Feb 2024 12:52:19 +0100 Subject: Replace BOOL with bool in llwindow and dependent classes --- indra/newview/lltoolselectland.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'indra/newview/lltoolselectland.cpp') diff --git a/indra/newview/lltoolselectland.cpp b/indra/newview/lltoolselectland.cpp index ff991dc9fd..5efbb670af 100644 --- a/indra/newview/lltoolselectland.cpp +++ b/indra/newview/lltoolselectland.cpp @@ -62,9 +62,9 @@ LLToolSelectLand::~LLToolSelectLand() } -BOOL LLToolSelectLand::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolSelectLand::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &mDragStartGlobal); + bool hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &mDragStartGlobal); if (hit_land) { setMouseCapture( TRUE ); @@ -94,21 +94,21 @@ BOOL LLToolSelectLand::handleMouseDown(S32 x, S32 y, MASK mask) } -BOOL LLToolSelectLand::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLToolSelectLand::handleDoubleClick(S32 x, S32 y, MASK mask) { LLVector3d pos_global; - BOOL hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &pos_global); + bool hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &pos_global); if (hit_land) { // Auto-select this parcel LLViewerParcelMgr::getInstance()->selectParcelAt( pos_global ); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLToolSelectLand::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolSelectLand::handleMouseUp(S32 x, S32 y, MASK mask) { if( hasMouseCapture() ) { @@ -135,13 +135,13 @@ BOOL LLToolSelectLand::handleMouseUp(S32 x, S32 y, MASK mask) mMouseOutsideSlop = FALSE; mDragEndValid = FALSE; - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask) +bool LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask) { if( hasMouseCapture() ) { @@ -193,7 +193,7 @@ BOOL LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask) gViewerWindow->setCursor(UI_CURSOR_ARROW); } - return TRUE; + return true; } -- cgit v1.2.3 From 60d3dd98a44230c21803c1606552ee098ed9fa7c Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 21 Feb 2024 21:05:14 +0100 Subject: Convert remaining BOOL to bool --- indra/newview/lltoolselectland.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'indra/newview/lltoolselectland.cpp') diff --git a/indra/newview/lltoolselectland.cpp b/indra/newview/lltoolselectland.cpp index 5efbb670af..674882b0cc 100644 --- a/indra/newview/lltoolselectland.cpp +++ b/indra/newview/lltoolselectland.cpp @@ -47,12 +47,12 @@ LLToolSelectLand::LLToolSelectLand( ) : LLTool( std::string("Parcel") ), mDragStartGlobal(), mDragEndGlobal(), - mDragEndValid(FALSE), + mDragEndValid(false), mDragStartX(0), mDragStartY(0), mDragEndX(0), mDragEndY(0), - mMouseOutsideSlop(FALSE), + mMouseOutsideSlop(false), mWestSouthBottom(), mEastNorthTop() { } @@ -67,14 +67,14 @@ bool LLToolSelectLand::handleMouseDown(S32 x, S32 y, MASK mask) bool hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &mDragStartGlobal); if (hit_land) { - setMouseCapture( TRUE ); + setMouseCapture( true ); mDragStartX = x; mDragStartY = y; mDragEndX = x; mDragEndY = y; - mDragEndValid = TRUE; + mDragEndValid = true; mDragEndGlobal = mDragStartGlobal; sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop); @@ -85,7 +85,7 @@ bool LLToolSelectLand::handleMouseDown(S32 x, S32 y, MASK mask) roundXY(mWestSouthBottom); roundXY(mEastNorthTop); - mMouseOutsideSlop = TRUE; //FALSE; + mMouseOutsideSlop = true; //false; LLViewerParcelMgr::getInstance()->deselectLand(); } @@ -112,7 +112,7 @@ bool LLToolSelectLand::handleMouseUp(S32 x, S32 y, MASK mask) { if( hasMouseCapture() ) { - setMouseCapture( FALSE ); + setMouseCapture( false ); if (mMouseOutsideSlop && mDragEndValid) { @@ -129,11 +129,11 @@ bool LLToolSelectLand::handleMouseUp(S32 x, S32 y, MASK mask) roundXY(mEastNorthTop); // Don't auto-select entire parcel. - mSelection = LLViewerParcelMgr::getInstance()->selectLand( mWestSouthBottom, mEastNorthTop, FALSE ); + mSelection = LLViewerParcelMgr::getInstance()->selectLand( mWestSouthBottom, mEastNorthTop, false ); } - mMouseOutsideSlop = FALSE; - mDragEndValid = FALSE; + mMouseOutsideSlop = false; + mDragEndValid = false; return true; } @@ -147,17 +147,17 @@ bool LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask) { if (mMouseOutsideSlop || outsideSlop(x, y, mDragStartX, mDragStartY)) { - mMouseOutsideSlop = TRUE; + mMouseOutsideSlop = true; // Must do this every frame, in case the camera moved or the land moved // since last frame. // If doesn't hit land, doesn't change old value LLVector3d land_global; - BOOL hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &land_global); + bool hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &land_global); if (hit_land) { - mDragEndValid = TRUE; + mDragEndValid = true; mDragEndGlobal = land_global; sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop); @@ -173,7 +173,7 @@ bool LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask) } else { - mDragEndValid = FALSE; + mDragEndValid = false; LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, no land)" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_NO); } @@ -225,7 +225,7 @@ void LLToolSelectLand::roundXY(LLVector3d &vec) // true if x,y outside small box around start_x,start_y -BOOL LLToolSelectLand::outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y) +bool LLToolSelectLand::outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y) { S32 dx = x - start_x; S32 dy = y - start_y; -- cgit v1.2.3 From e2e37cced861b98de8c1a7c9c0d3a50d2d90e433 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 22 May 2024 21:25:21 +0200 Subject: Fix line endlings --- indra/newview/lltoolselectland.cpp | 468 ++++++++++++++++++------------------- 1 file changed, 234 insertions(+), 234 deletions(-) (limited to 'indra/newview/lltoolselectland.cpp') diff --git a/indra/newview/lltoolselectland.cpp b/indra/newview/lltoolselectland.cpp index f10c15bc8b..88553c7557 100644 --- a/indra/newview/lltoolselectland.cpp +++ b/indra/newview/lltoolselectland.cpp @@ -1,234 +1,234 @@ -/** - * @file lltoolselectland.cpp - * @brief LLToolSelectLand class implementation - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "lltoolselectland.h" - -// indra includes -#include "llparcel.h" - -// Viewer includes -#include "llviewercontrol.h" -#include "llfloatertools.h" -#include "llselectmgr.h" -#include "llstatusbar.h" -#include "llviewerparcelmgr.h" -#include "llviewerwindow.h" - -// -// Member functions -// - -LLToolSelectLand::LLToolSelectLand( ) -: LLTool( std::string("Parcel") ), - mDragStartGlobal(), - mDragEndGlobal(), - mDragEndValid(false), - mDragStartX(0), - mDragStartY(0), - mDragEndX(0), - mDragEndY(0), - mMouseOutsideSlop(false), - mWestSouthBottom(), - mEastNorthTop() -{ } - -LLToolSelectLand::~LLToolSelectLand() -{ -} - - -bool LLToolSelectLand::handleMouseDown(S32 x, S32 y, MASK mask) -{ - bool hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &mDragStartGlobal); - if (hit_land) - { - setMouseCapture( true ); - - mDragStartX = x; - mDragStartY = y; - mDragEndX = x; - mDragEndY = y; - - mDragEndValid = true; - mDragEndGlobal = mDragStartGlobal; - - sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop); - - mWestSouthBottom -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 ); - mEastNorthTop += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 ); - - roundXY(mWestSouthBottom); - roundXY(mEastNorthTop); - - mMouseOutsideSlop = true; //false; - - LLViewerParcelMgr::getInstance()->deselectLand(); - } - - return hit_land; -} - - -bool LLToolSelectLand::handleDoubleClick(S32 x, S32 y, MASK mask) -{ - LLVector3d pos_global; - bool hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &pos_global); - if (hit_land) - { - // Auto-select this parcel - LLViewerParcelMgr::getInstance()->selectParcelAt( pos_global ); - return true; - } - return false; -} - - -bool LLToolSelectLand::handleMouseUp(S32 x, S32 y, MASK mask) -{ - if( hasMouseCapture() ) - { - setMouseCapture( false ); - - if (mMouseOutsideSlop && mDragEndValid) - { - // Take the drag start and end locations, then map the southwest - // point down to the next grid location, and the northeast point up - // to the next grid location. - - sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop); - - mWestSouthBottom -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 ); - mEastNorthTop += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 ); - - roundXY(mWestSouthBottom); - roundXY(mEastNorthTop); - - // Don't auto-select entire parcel. - mSelection = LLViewerParcelMgr::getInstance()->selectLand( mWestSouthBottom, mEastNorthTop, false ); - } - - mMouseOutsideSlop = false; - mDragEndValid = false; - - return true; - } - return false; -} - - -bool LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask) -{ - if( hasMouseCapture() ) - { - if (mMouseOutsideSlop || outsideSlop(x, y, mDragStartX, mDragStartY)) - { - mMouseOutsideSlop = true; - - // Must do this every frame, in case the camera moved or the land moved - // since last frame. - - // If doesn't hit land, doesn't change old value - LLVector3d land_global; - bool hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &land_global); - if (hit_land) - { - mDragEndValid = true; - mDragEndGlobal = land_global; - - sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop); - - mWestSouthBottom -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 ); - mEastNorthTop += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 ); - - roundXY(mWestSouthBottom); - roundXY(mEastNorthTop); - - LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, land)" << LL_ENDL; - gViewerWindow->setCursor(UI_CURSOR_ARROW); - } - else - { - mDragEndValid = false; - LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, no land)" << LL_ENDL; - gViewerWindow->setCursor(UI_CURSOR_NO); - } - - mDragEndX = x; - mDragEndY = y; - } - else - { - LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, in slop)" << LL_ENDL; - gViewerWindow->setCursor(UI_CURSOR_ARROW); - } - } - else - { - LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (inactive)" << LL_ENDL; - gViewerWindow->setCursor(UI_CURSOR_ARROW); - } - - return true; -} - - -void LLToolSelectLand::render() -{ - if( hasMouseCapture() && /*mMouseOutsideSlop &&*/ mDragEndValid) - { - LLViewerParcelMgr::getInstance()->renderRect( mWestSouthBottom, mEastNorthTop ); - } -} - -void LLToolSelectLand::handleSelect() -{ - gFloaterTools->setStatusText("selectland"); -} - - -void LLToolSelectLand::handleDeselect() -{ - mSelection = NULL; -} - - -void LLToolSelectLand::roundXY(LLVector3d &vec) -{ - vec.mdV[VX] = ll_round( vec.mdV[VX], (F64)PARCEL_GRID_STEP_METERS ); - vec.mdV[VY] = ll_round( vec.mdV[VY], (F64)PARCEL_GRID_STEP_METERS ); -} - - -// true if x,y outside small box around start_x,start_y -bool LLToolSelectLand::outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y) -{ - S32 dx = x - start_x; - S32 dy = y - start_y; - - return (dx <= -2 || 2 <= dx || dy <= -2 || 2 <= dy); -} +/** + * @file lltoolselectland.cpp + * @brief LLToolSelectLand class implementation + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "lltoolselectland.h" + +// indra includes +#include "llparcel.h" + +// Viewer includes +#include "llviewercontrol.h" +#include "llfloatertools.h" +#include "llselectmgr.h" +#include "llstatusbar.h" +#include "llviewerparcelmgr.h" +#include "llviewerwindow.h" + +// +// Member functions +// + +LLToolSelectLand::LLToolSelectLand( ) +: LLTool( std::string("Parcel") ), + mDragStartGlobal(), + mDragEndGlobal(), + mDragEndValid(false), + mDragStartX(0), + mDragStartY(0), + mDragEndX(0), + mDragEndY(0), + mMouseOutsideSlop(false), + mWestSouthBottom(), + mEastNorthTop() +{ } + +LLToolSelectLand::~LLToolSelectLand() +{ +} + + +bool LLToolSelectLand::handleMouseDown(S32 x, S32 y, MASK mask) +{ + bool hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &mDragStartGlobal); + if (hit_land) + { + setMouseCapture( true ); + + mDragStartX = x; + mDragStartY = y; + mDragEndX = x; + mDragEndY = y; + + mDragEndValid = true; + mDragEndGlobal = mDragStartGlobal; + + sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop); + + mWestSouthBottom -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 ); + mEastNorthTop += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 ); + + roundXY(mWestSouthBottom); + roundXY(mEastNorthTop); + + mMouseOutsideSlop = true; //false; + + LLViewerParcelMgr::getInstance()->deselectLand(); + } + + return hit_land; +} + + +bool LLToolSelectLand::handleDoubleClick(S32 x, S32 y, MASK mask) +{ + LLVector3d pos_global; + bool hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &pos_global); + if (hit_land) + { + // Auto-select this parcel + LLViewerParcelMgr::getInstance()->selectParcelAt( pos_global ); + return true; + } + return false; +} + + +bool LLToolSelectLand::handleMouseUp(S32 x, S32 y, MASK mask) +{ + if( hasMouseCapture() ) + { + setMouseCapture( false ); + + if (mMouseOutsideSlop && mDragEndValid) + { + // Take the drag start and end locations, then map the southwest + // point down to the next grid location, and the northeast point up + // to the next grid location. + + sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop); + + mWestSouthBottom -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 ); + mEastNorthTop += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 ); + + roundXY(mWestSouthBottom); + roundXY(mEastNorthTop); + + // Don't auto-select entire parcel. + mSelection = LLViewerParcelMgr::getInstance()->selectLand( mWestSouthBottom, mEastNorthTop, false ); + } + + mMouseOutsideSlop = false; + mDragEndValid = false; + + return true; + } + return false; +} + + +bool LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask) +{ + if( hasMouseCapture() ) + { + if (mMouseOutsideSlop || outsideSlop(x, y, mDragStartX, mDragStartY)) + { + mMouseOutsideSlop = true; + + // Must do this every frame, in case the camera moved or the land moved + // since last frame. + + // If doesn't hit land, doesn't change old value + LLVector3d land_global; + bool hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &land_global); + if (hit_land) + { + mDragEndValid = true; + mDragEndGlobal = land_global; + + sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop); + + mWestSouthBottom -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 ); + mEastNorthTop += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 ); + + roundXY(mWestSouthBottom); + roundXY(mEastNorthTop); + + LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, land)" << LL_ENDL; + gViewerWindow->setCursor(UI_CURSOR_ARROW); + } + else + { + mDragEndValid = false; + LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, no land)" << LL_ENDL; + gViewerWindow->setCursor(UI_CURSOR_NO); + } + + mDragEndX = x; + mDragEndY = y; + } + else + { + LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, in slop)" << LL_ENDL; + gViewerWindow->setCursor(UI_CURSOR_ARROW); + } + } + else + { + LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (inactive)" << LL_ENDL; + gViewerWindow->setCursor(UI_CURSOR_ARROW); + } + + return true; +} + + +void LLToolSelectLand::render() +{ + if( hasMouseCapture() && /*mMouseOutsideSlop &&*/ mDragEndValid) + { + LLViewerParcelMgr::getInstance()->renderRect( mWestSouthBottom, mEastNorthTop ); + } +} + +void LLToolSelectLand::handleSelect() +{ + gFloaterTools->setStatusText("selectland"); +} + + +void LLToolSelectLand::handleDeselect() +{ + mSelection = NULL; +} + + +void LLToolSelectLand::roundXY(LLVector3d &vec) +{ + vec.mdV[VX] = ll_round( vec.mdV[VX], (F64)PARCEL_GRID_STEP_METERS ); + vec.mdV[VY] = ll_round( vec.mdV[VY], (F64)PARCEL_GRID_STEP_METERS ); +} + + +// true if x,y outside small box around start_x,start_y +bool LLToolSelectLand::outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y) +{ + S32 dx = x - start_x; + S32 dy = y - start_y; + + return (dx <= -2 || 2 <= dx || dy <= -2 || 2 <= dy); +} -- cgit v1.2.3