summaryrefslogtreecommitdiff
path: root/indra/newview/lltoolcomp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltoolcomp.cpp')
-rw-r--r--indra/newview/lltoolcomp.cpp248
1 files changed, 118 insertions, 130 deletions
diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp
index d8f4e55b0e..923fbecb1a 100644
--- a/indra/newview/lltoolcomp.cpp
+++ b/indra/newview/lltoolcomp.cpp
@@ -2,30 +2,25 @@
* @file lltoolcomp.cpp
* @brief Composite tools
*
- * $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.
*
- * 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 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.
*
- * 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.
+ * 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.
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * 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$
*/
@@ -33,6 +28,7 @@
#include "lltoolcomp.h"
+#include "llfloaterreg.h"
#include "llgl.h"
#include "indra_constants.h"
@@ -46,13 +42,13 @@
#include "lltoolgrab.h"
#include "lltoolgun.h"
#include "lltoolmgr.h"
-#include "lltoolselect.h"
#include "lltoolselectrect.h"
#include "lltoolplacer.h"
#include "llviewermenu.h"
#include "llviewerobject.h"
#include "llviewerwindow.h"
#include "llagent.h"
+#include "llagentcamera.h"
#include "llfloatertools.h"
#include "llviewercontrol.h"
@@ -61,17 +57,12 @@ const S32 BUTTON_WIDTH_SMALL = 32;
const S32 BUTTON_WIDTH_BIG = 48;
const S32 HPAD = 4;
-// Globals
-LLToolCompInspect *gToolInspect = NULL;
-LLToolCompTranslate *gToolTranslate = NULL;
-LLToolCompScale *gToolStretch = NULL;
-LLToolCompRotate *gToolRotate = NULL;
-LLToolCompCreate *gToolCreate = NULL;
-LLToolCompGun *gToolGun = NULL;
-
extern LLControlGroup gSavedSettings;
+// we use this in various places instead of NULL
+static LLTool* sNullTool = new LLTool(std::string("null"), NULL);
+
//-----------------------------------------------------------------------
// LLToolComposite
@@ -93,9 +84,11 @@ void LLToolComposite::setCurrentTool( LLTool* new_tool )
}
}
-LLToolComposite::LLToolComposite(const LLString& name)
+LLToolComposite::LLToolComposite(const std::string& name)
: LLTool(name),
- mCur(NULL), mDefault(NULL), mSelected(FALSE),
+ mCur(sNullTool),
+ mDefault(sNullTool),
+ mSelected(FALSE),
mMouseDown(FALSE), mManip(NULL), mSelectRect(NULL)
{
}
@@ -126,7 +119,7 @@ void LLToolComposite::handleSelect()
{
if (!gSavedSettings.getBOOL("EditLinkedParts"))
{
- gSelectMgr->promoteSelectionToRoot();
+ LLSelectMgr::getInstance()->promoteSelectionToRoot();
}
mCur = mDefault;
mCur->handleSelect();
@@ -138,7 +131,7 @@ void LLToolComposite::handleSelect()
//----------------------------------------------------------------------------
LLToolCompInspect::LLToolCompInspect()
-: LLToolComposite("Inspect")
+: LLToolComposite(std::string("Inspect"))
{
mSelectRect = new LLToolSelectRect(this);
mDefault = mSelectRect;
@@ -154,35 +147,35 @@ LLToolCompInspect::~LLToolCompInspect()
BOOL LLToolCompInspect::handleMouseDown(S32 x, S32 y, MASK mask)
{
mMouseDown = TRUE;
- gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback);
+ gViewerWindow->pickAsync(x, y, mask, pickCallback);
return TRUE;
}
-void LLToolCompInspect::pickCallback(S32 x, S32 y, MASK mask)
+void LLToolCompInspect::pickCallback(const LLPickInfo& pick_info)
{
- LLViewerObject* hit_obj = gViewerWindow->lastObjectHit();
+ LLViewerObject* hit_obj = pick_info.getObject();
- if (!gToolInspect->mMouseDown)
+ if (!LLToolCompInspect::getInstance()->mMouseDown)
{
// fast click on object, but mouse is already up...just do select
- gToolInspect->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
+ LLToolCompInspect::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
return;
}
if( hit_obj )
{
- if (gSelectMgr->getSelection()->getObjectCount())
+ if (LLSelectMgr::getInstance()->getSelection()->getObjectCount())
{
- LLEditMenuHandler::gEditMenuHandler = gSelectMgr;
+ LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
}
- gToolInspect->setCurrentTool( gToolInspect->mSelectRect );
- gToolInspect->mSelectRect->handleMouseDown( x, y, mask );
+ LLToolCompInspect::getInstance()->setCurrentTool( LLToolCompInspect::getInstance()->mSelectRect );
+ LLToolCompInspect::getInstance()->mSelectRect->handlePick( pick_info );
}
else
{
- gToolInspect->setCurrentTool( gToolInspect->mSelectRect );
- gToolInspect->mSelectRect->handleMouseDown( x, y, mask);
+ LLToolCompInspect::getInstance()->setCurrentTool( LLToolCompInspect::getInstance()->mSelectRect );
+ LLToolCompInspect::getInstance()->mSelectRect->handlePick( pick_info );
}
}
@@ -196,7 +189,7 @@ BOOL LLToolCompInspect::handleDoubleClick(S32 x, S32 y, MASK mask)
//----------------------------------------------------------------------------
LLToolCompTranslate::LLToolCompTranslate()
- : LLToolComposite("Move")
+ : LLToolComposite(std::string("Move"))
{
mManip = new LLManipTranslate(this);
mSelectRect = new LLToolSelectRect(this);
@@ -227,49 +220,49 @@ BOOL LLToolCompTranslate::handleHover(S32 x, S32 y, MASK mask)
BOOL LLToolCompTranslate::handleMouseDown(S32 x, S32 y, MASK mask)
{
mMouseDown = TRUE;
- gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback, TRUE);
+ gViewerWindow->pickAsync(x, y, mask, pickCallback, TRUE);
return TRUE;
}
-void LLToolCompTranslate::pickCallback(S32 x, S32 y, MASK mask)
+void LLToolCompTranslate::pickCallback(const LLPickInfo& pick_info)
{
- LLViewerObject* hit_obj = gViewerWindow->lastObjectHit();
+ LLViewerObject* hit_obj = pick_info.getObject();
- gToolTranslate->mManip->highlightManipulators(x, y);
- if (!gToolTranslate->mMouseDown)
+ LLToolCompTranslate::getInstance()->mManip->highlightManipulators(pick_info.mMousePt.mX, pick_info.mMousePt.mY);
+ if (!LLToolCompTranslate::getInstance()->mMouseDown)
{
// fast click on object, but mouse is already up...just do select
- gToolTranslate->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
+ LLToolCompTranslate::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
return;
}
- if( hit_obj || gToolTranslate->mManip->getHighlightedPart() != LLManip::LL_NO_PART )
+ if( hit_obj || LLToolCompTranslate::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART )
{
- if (gToolTranslate->mManip->getSelection()->getObjectCount())
+ if (LLToolCompTranslate::getInstance()->mManip->getSelection()->getObjectCount())
{
- LLEditMenuHandler::gEditMenuHandler = gSelectMgr;
+ LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
}
- BOOL can_move = gToolTranslate->mManip->canAffectSelection();
+ BOOL can_move = LLToolCompTranslate::getInstance()->mManip->canAffectSelection();
- if( LLManip::LL_NO_PART != gToolTranslate->mManip->getHighlightedPart() && can_move)
+ if( LLManip::LL_NO_PART != LLToolCompTranslate::getInstance()->mManip->getHighlightedPart() && can_move)
{
- gToolTranslate->setCurrentTool( gToolTranslate->mManip );
- gToolTranslate->mManip->handleMouseDownOnPart( x, y, mask );
+ LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mManip );
+ LLToolCompTranslate::getInstance()->mManip->handleMouseDownOnPart( pick_info.mMousePt.mX, pick_info.mMousePt.mY, pick_info.mKeyMask );
}
else
{
- gToolTranslate->setCurrentTool( gToolTranslate->mSelectRect );
- gToolTranslate->mSelectRect->handleMouseDown( x, y, mask );
+ LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mSelectRect );
+ LLToolCompTranslate::getInstance()->mSelectRect->handlePick( pick_info );
// *TODO: add toggle to trigger old click-drag functionality
- // gToolTranslate->mManip->handleMouseDownOnPart( XY_part, x, y, mask);
+ // LLToolCompTranslate::getInstance()->mManip->handleMouseDownOnPart( XY_part, x, y, mask);
}
}
else
{
- gToolTranslate->setCurrentTool( gToolTranslate->mSelectRect );
- gToolTranslate->mSelectRect->handleMouseDown( x, y, mask);
+ LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mSelectRect );
+ LLToolCompTranslate::getInstance()->mSelectRect->handlePick( pick_info );
}
}
@@ -283,11 +276,11 @@ LLTool* LLToolCompTranslate::getOverrideTool(MASK mask)
{
if (mask == MASK_CONTROL)
{
- return gToolRotate;
+ return LLToolCompRotate::getInstance();
}
else if (mask == (MASK_CONTROL | MASK_SHIFT))
{
- return gToolStretch;
+ return LLToolCompScale::getInstance();
}
return LLToolComposite::getOverrideTool(mask);
}
@@ -298,7 +291,7 @@ BOOL LLToolCompTranslate::handleDoubleClick(S32 x, S32 y, MASK mask)
{
// You should already have an object selected from the mousedown.
// If so, show its properties
- gFloaterTools->showPanel(LLFloaterTools::PANEL_CONTENTS);
+ LLFloaterReg::showInstance("build", "Content");
return TRUE;
}
// Nothing selected means the first mouse click was probably
@@ -309,7 +302,7 @@ BOOL LLToolCompTranslate::handleDoubleClick(S32 x, S32 y, MASK mask)
void LLToolCompTranslate::render()
{
- mCur->render();
+ mCur->render(); // removing this will not draw the RGB arrows and guidelines
if( mCur != mManip )
{
@@ -323,7 +316,7 @@ void LLToolCompTranslate::render()
// LLToolCompScale
LLToolCompScale::LLToolCompScale()
- : LLToolComposite("Stretch")
+ : LLToolComposite(std::string("Stretch"))
{
mManip = new LLManipScale(this);
mSelectRect = new LLToolSelectRect(this);
@@ -351,44 +344,44 @@ BOOL LLToolCompScale::handleHover(S32 x, S32 y, MASK mask)
BOOL LLToolCompScale::handleMouseDown(S32 x, S32 y, MASK mask)
{
mMouseDown = TRUE;
- gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback);
+ gViewerWindow->pickAsync(x, y, mask, pickCallback);
return TRUE;
}
-void LLToolCompScale::pickCallback(S32 x, S32 y, MASK mask)
+void LLToolCompScale::pickCallback(const LLPickInfo& pick_info)
{
- LLViewerObject* hit_obj = gViewerWindow->lastObjectHit();
+ LLViewerObject* hit_obj = pick_info.getObject();
- gToolStretch->mManip->highlightManipulators(x, y);
- if (!gToolStretch->mMouseDown)
+ LLToolCompScale::getInstance()->mManip->highlightManipulators(pick_info.mMousePt.mX, pick_info.mMousePt.mY);
+ if (!LLToolCompScale::getInstance()->mMouseDown)
{
// fast click on object, but mouse is already up...just do select
- gToolStretch->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
+ LLToolCompScale::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
return;
}
- if( hit_obj || gToolStretch->mManip->getHighlightedPart() != LLManip::LL_NO_PART)
+ if( hit_obj || LLToolCompScale::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART)
{
- if (gToolStretch->mManip->getSelection()->getObjectCount())
+ if (LLToolCompScale::getInstance()->mManip->getSelection()->getObjectCount())
{
- LLEditMenuHandler::gEditMenuHandler = gSelectMgr;
+ LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
}
- if( LLManip::LL_NO_PART != gToolStretch->mManip->getHighlightedPart() )
+ if( LLManip::LL_NO_PART != LLToolCompScale::getInstance()->mManip->getHighlightedPart() )
{
- gToolStretch->setCurrentTool( gToolStretch->mManip );
- gToolStretch->mManip->handleMouseDownOnPart( x, y, mask );
+ LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mManip );
+ LLToolCompScale::getInstance()->mManip->handleMouseDownOnPart( pick_info.mMousePt.mX, pick_info.mMousePt.mY, pick_info.mKeyMask );
}
else
{
- gToolStretch->setCurrentTool( gToolStretch->mSelectRect );
- gToolStretch->mSelectRect->handleMouseDown( x, y, mask );
+ LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mSelectRect );
+ LLToolCompScale::getInstance()->mSelectRect->handlePick( pick_info );
}
}
else
{
- gToolStretch->setCurrentTool( gToolStretch->mSelectRect );
- gToolStretch->mCur->handleMouseDown( x, y, mask );
+ LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mSelectRect );
+ LLToolCompScale::getInstance()->mSelectRect->handlePick( pick_info );
}
}
@@ -402,7 +395,7 @@ LLTool* LLToolCompScale::getOverrideTool(MASK mask)
{
if (mask == MASK_CONTROL)
{
- return gToolRotate;
+ return LLToolCompRotate::getInstance();
}
return LLToolComposite::getOverrideTool(mask);
@@ -415,8 +408,7 @@ BOOL LLToolCompScale::handleDoubleClick(S32 x, S32 y, MASK mask)
{
// You should already have an object selected from the mousedown.
// If so, show its properties
- gFloaterTools->showPanel(LLFloaterTools::PANEL_CONTENTS);
- //gBuildView->setPropertiesPanelOpen(TRUE);
+ LLFloaterReg::showInstance("build", "Content");
return TRUE;
}
else
@@ -443,7 +435,7 @@ void LLToolCompScale::render()
// LLToolCompCreate
LLToolCompCreate::LLToolCompCreate()
- : LLToolComposite("Create")
+ : LLToolComposite(std::string("Create"))
{
mPlacer = new LLToolPlacer();
mSelectRect = new LLToolSelectRect(this);
@@ -466,15 +458,15 @@ BOOL LLToolCompCreate::handleMouseDown(S32 x, S32 y, MASK mask)
BOOL handled = FALSE;
mMouseDown = TRUE;
- if ( !(mask == MASK_SHIFT) && !(mask == MASK_CONTROL) )
+ if ( (mask == MASK_SHIFT) || (mask == MASK_CONTROL) )
{
- setCurrentTool( mPlacer );
- handled = mPlacer->placeObject( x, y, mask );
+ gViewerWindow->pickAsync(x, y, mask, pickCallback);
+ handled = TRUE;
}
else
{
- gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback);
- handled = TRUE;
+ setCurrentTool( mPlacer );
+ handled = mPlacer->placeObject( x, y, mask );
}
mObjectPlacedOnMouseDown = TRUE;
@@ -482,15 +474,15 @@ BOOL LLToolCompCreate::handleMouseDown(S32 x, S32 y, MASK mask)
return TRUE;
}
-void LLToolCompCreate::pickCallback(S32 x, S32 y, MASK mask)
+void LLToolCompCreate::pickCallback(const LLPickInfo& pick_info)
{
// *NOTE: We mask off shift and control, so you cannot
// multi-select multiple objects with the create tool.
- mask = (mask & ~MASK_SHIFT);
+ MASK mask = (pick_info.mKeyMask & ~MASK_SHIFT);
mask = (mask & ~MASK_CONTROL);
- gToolCreate->setCurrentTool( gToolCreate->mSelectRect );
- gToolCreate->mSelectRect->handleMouseDown( x, y, mask);
+ LLToolCompCreate::getInstance()->setCurrentTool( LLToolCompCreate::getInstance()->mSelectRect );
+ LLToolCompCreate::getInstance()->mSelectRect->handlePick( pick_info );
}
BOOL LLToolCompCreate::handleDoubleClick(S32 x, S32 y, MASK mask)
@@ -523,7 +515,7 @@ BOOL LLToolCompCreate::handleMouseUp(S32 x, S32 y, MASK mask)
// LLToolCompRotate
LLToolCompRotate::LLToolCompRotate()
- : LLToolComposite("Rotate")
+ : LLToolComposite(std::string("Rotate"))
{
mManip = new LLManipRotate(this);
mSelectRect = new LLToolSelectRect(this);
@@ -552,43 +544,43 @@ BOOL LLToolCompRotate::handleHover(S32 x, S32 y, MASK mask)
BOOL LLToolCompRotate::handleMouseDown(S32 x, S32 y, MASK mask)
{
mMouseDown = TRUE;
- gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback);
+ gViewerWindow->pickAsync(x, y, mask, pickCallback);
return TRUE;
}
-void LLToolCompRotate::pickCallback(S32 x, S32 y, MASK mask)
+void LLToolCompRotate::pickCallback(const LLPickInfo& pick_info)
{
- LLViewerObject* hit_obj = gViewerWindow->lastObjectHit();
+ LLViewerObject* hit_obj = pick_info.getObject();
- gToolRotate->mManip->highlightManipulators(x, y);
- if (!gToolRotate->mMouseDown)
+ LLToolCompRotate::getInstance()->mManip->highlightManipulators(pick_info.mMousePt.mX, pick_info.mMousePt.mY);
+ if (!LLToolCompRotate::getInstance()->mMouseDown)
{
// fast click on object, but mouse is already up...just do select
- gToolRotate->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
+ LLToolCompRotate::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
return;
}
- if( hit_obj || gToolRotate->mManip->getHighlightedPart() != LLManip::LL_NO_PART)
+ if( hit_obj || LLToolCompRotate::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART)
{
- if (gToolRotate->mManip->getSelection()->getObjectCount())
+ if (LLToolCompRotate::getInstance()->mManip->getSelection()->getObjectCount())
{
- LLEditMenuHandler::gEditMenuHandler = gSelectMgr;
+ LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
}
- if( LLManip::LL_NO_PART != gToolRotate->mManip->getHighlightedPart() )
+ if( LLManip::LL_NO_PART != LLToolCompRotate::getInstance()->mManip->getHighlightedPart() )
{
- gToolRotate->setCurrentTool( gToolRotate->mManip );
- gToolRotate->mManip->handleMouseDownOnPart( x, y, mask );
+ LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mManip );
+ LLToolCompRotate::getInstance()->mManip->handleMouseDownOnPart( pick_info.mMousePt.mX, pick_info.mMousePt.mY, pick_info.mKeyMask );
}
else
{
- gToolRotate->setCurrentTool( gToolRotate->mSelectRect );
- gToolRotate->mSelectRect->handleMouseDown( x, y, mask );
+ LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mSelectRect );
+ LLToolCompRotate::getInstance()->mSelectRect->handlePick( pick_info );
}
}
else
{
- gToolRotate->setCurrentTool( gToolRotate->mSelectRect );
- gToolRotate->mCur->handleMouseDown( x, y, mask );
+ LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mSelectRect );
+ LLToolCompRotate::getInstance()->mSelectRect->handlePick( pick_info );
}
}
@@ -602,7 +594,7 @@ LLTool* LLToolCompRotate::getOverrideTool(MASK mask)
{
if (mask == (MASK_CONTROL | MASK_SHIFT))
{
- return gToolStretch;
+ return LLToolCompScale::getInstance();
}
return LLToolComposite::getOverrideTool(mask);
}
@@ -613,8 +605,7 @@ BOOL LLToolCompRotate::handleDoubleClick(S32 x, S32 y, MASK mask)
{
// You should already have an object selected from the mousedown.
// If so, show its properties
- gFloaterTools->showPanel(LLFloaterTools::PANEL_CONTENTS);
- //gBuildView->setPropertiesPanelOpen(TRUE);
+ LLFloaterReg::showInstance("build", "Content");
return TRUE;
}
else
@@ -642,11 +633,11 @@ void LLToolCompRotate::render()
// LLToolCompGun
LLToolCompGun::LLToolCompGun()
- : LLToolComposite("Mouselook")
+ : LLToolComposite(std::string("Mouselook"))
{
mGun = new LLToolGun(this);
mGrab = new LLToolGrab(this);
- mNull = new LLTool("null", this);
+ mNull = sNullTool;
setCurrentTool(mGun);
mDefault = mGun;
@@ -661,7 +652,8 @@ LLToolCompGun::~LLToolCompGun()
delete mGrab;
mGrab = NULL;
- delete mNull;
+ // don't delete a static object
+ // delete mNull;
mNull = NULL;
}
@@ -671,7 +663,7 @@ BOOL LLToolCompGun::handleHover(S32 x, S32 y, MASK mask)
// item selected from context menu.
if ( mCur == mNull && !gPopupMenuView->getVisible() )
{
- gSelectMgr->deselectAll();
+ LLSelectMgr::getInstance()->deselectAll();
setCurrentTool( (LLTool*) mGrab );
}
@@ -712,9 +704,9 @@ BOOL LLToolCompGun::handleMouseDown(S32 x, S32 y, MASK mask)
// On mousedown, start grabbing
gGrabTransientTool = this;
- gToolMgr->getCurrentToolset()->selectTool( (LLTool*) mGrab );
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool*) mGrab );
- return gToolGrab->handleMouseDown(x, y, mask);
+ return LLToolGrab::getInstance()->handleMouseDown(x, y, mask);
}
@@ -729,9 +721,9 @@ BOOL LLToolCompGun::handleDoubleClick(S32 x, S32 y, MASK mask)
// On mousedown, start grabbing
gGrabTransientTool = this;
- gToolMgr->getCurrentToolset()->selectTool( (LLTool*) mGrab );
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool*) mGrab );
- return gToolGrab->handleDoubleClick(x, y, mask);
+ return LLToolGrab::getInstance()->handleDoubleClick(x, y, mask);
}
@@ -768,10 +760,6 @@ void LLToolCompGun::onMouseCaptureLost()
return;
}
mCur->onMouseCaptureLost();
-
- // JC - I don't know if this is necessary. Maybe we could lose capture
- // if someone ALT-Tab's out when in mouselook.
- setCurrentTool( (LLTool*) mGun );
}
void LLToolCompGun::handleSelect()
@@ -791,7 +779,7 @@ BOOL LLToolCompGun::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
if (clicks > 0)
{
- gAgent.changeCameraToDefault();
+ gAgentCamera.changeCameraToDefault();
}
return TRUE;