diff options
Diffstat (limited to 'indra/newview/lltoolselectrect.cpp')
-rw-r--r-- | indra/newview/lltoolselectrect.cpp | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/indra/newview/lltoolselectrect.cpp b/indra/newview/lltoolselectrect.cpp index 3b68751740..a3f4e5a18c 100644 --- a/indra/newview/lltoolselectrect.cpp +++ b/indra/newview/lltoolselectrect.cpp @@ -2,30 +2,25 @@ * @file lltoolselectrect.cpp * @brief A tool to select multiple objects with a screen-space rectangle. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * 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. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * 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. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * 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 * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -36,14 +31,13 @@ // Library includes #include "llgl.h" -#include "llglimmediate.h" +#include "llrender.h" #include "lldarray.h" // Viewer includes #include "llviewercontrol.h" #include "llui.h" #include "llselectmgr.h" -#include "lltoolview.h" #include "lltoolmgr.h" #include "llviewerobject.h" #include "llviewerobjectlist.h" @@ -78,18 +72,26 @@ void dialog_refresh_all(void); BOOL LLToolSelectRect::handleMouseDown(S32 x, S32 y, MASK mask) { + handlePick(gViewerWindow->pickImmediate(x, y, TRUE)); + + LLTool::handleMouseDown(x, y, mask); + + return mPick.getObject().notNull(); +} + +void LLToolSelectRect::handlePick(const LLPickInfo& pick) +{ + mPick = pick; + // start dragging rectangle setMouseCapture( TRUE ); - mDragStartX = x; - mDragStartY = y; - mDragEndX = x; - mDragEndY = y; + mDragStartX = pick.mMousePt.mX; + mDragStartY = pick.mMousePt.mY; + mDragEndX = pick.mMousePt.mX; + mDragEndY = pick.mMousePt.mY; mMouseOutsideSlop = FALSE; - - LLToolSelect::handleMouseDown(x, y, mask); - return TRUE; } @@ -106,11 +108,11 @@ BOOL LLToolSelectRect::handleMouseUp(S32 x, S32 y, MASK mask) if (mask == MASK_CONTROL) { - gSelectMgr->deselectHighlightedObjects(); + LLSelectMgr::getInstance()->deselectHighlightedObjects(); } else { - gSelectMgr->selectHighlightedObjects(); + LLSelectMgr::getInstance()->selectHighlightedObjects(); } return TRUE; } @@ -130,7 +132,7 @@ BOOL LLToolSelectRect::handleHover(S32 x, S32 y, MASK mask) if (!mMouseOutsideSlop && !(mask & MASK_SHIFT) && !(mask & MASK_CONTROL)) { // just started rect select, and not adding to current selection - gSelectMgr->deselectAll(); + LLSelectMgr::getInstance()->deselectAll(); } mMouseOutsideSlop = TRUE; mDragEndX = x; @@ -150,7 +152,7 @@ BOOL LLToolSelectRect::handleHover(S32 x, S32 y, MASK mask) lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectRect (inactive)" << llendl; } - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); + gViewerWindow->setCursor(UI_CURSOR_ARROW); return TRUE; } @@ -167,7 +169,7 @@ void LLToolSelectRect::draw() { gGL.color4f(1.f, 1.f, 0.f, 1.f); } - LLGLSNoTexture gls_no_texture; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gl_rect_2d( llmin(mDragStartX, mDragEndX), llmax(mDragStartY, mDragEndY), |