summaryrefslogtreecommitdiff
path: root/indra/newview/lltoolgrab.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2016-09-15 20:18:12 -0400
committerNat Goodspeed <nat@lindenlab.com>2016-09-15 20:18:12 -0400
commitd2c3c2f9fe197b1856e9a8ed37aeb56b77e2ff07 (patch)
tree18bf4b0b83a44d629d238014babb0553788f80e2 /indra/newview/lltoolgrab.cpp
parent1cadeb40df15c1eaef3410064f9a2b8e4489082d (diff)
MAINT-5232: Normalize LLSingleton subclasses.
A shocking number of LLSingleton subclasses had public constructors -- and in several instances, were being explicitly instantiated independently of the LLSingleton machinery. This breaks the new LLSingleton dependency-tracking machinery. It seems only fair that if you say you want an LLSingleton, there should only be ONE INSTANCE! Introduce LLSINGLETON() and LLSINGLETON_EMPTY_CTOR() macros. These handle the friend class LLSingleton<whatevah>; and explicitly declare a private nullary constructor. To try to enforce the LLSINGLETON() convention, introduce a new pure virtual LLSingleton method you_must_use_LLSINGLETON_macro() which is, as you might suspect, defined by the macro. If you declare an LLSingleton subclass without using LLSINGLETON() or LLSINGLETON_EMPTY_CTOR() in the class body, you can't instantiate the subclass for lack of a you_must_use_LLSINGLETON_macro() implementation -- which will hopefully remind the coder. Trawl through ALL LLSingleton subclass definitions, sprinkling in LLSINGLETON() or LLSINGLETON_EMPTY_CTOR() as appropriate. Remove all explicit constructor declarations, public or private, along with relevant 'friend class LLSingleton<myself>' declarations. Where destructors are declared, move them into private section as well. Where the constructor was inline but nontrivial, move out of class body. Fix several LLSingleton abuses revealed by making ctors/dtors private: LLGlobalEconomy was both an LLSingleton and the base class for LLRegionEconomy, a non-LLSingleton. (Therefore every LLRegionEconomy instance contained another instance of the LLGlobalEconomy "singleton.") Extract LLBaseEconomy; LLGlobalEconomy is now a trivial subclass of that. LLRegionEconomy, as you might suspect, now derives from LLBaseEconomy. LLToolGrab, an LLSingleton, was also explicitly instantiated by LLToolCompGun's constructor. Extract LLToolGrabBase, explicitly instantiated, with trivial subclass LLToolGrab, the LLSingleton instance. (WARNING: LLToolGrabBase methods have an unnerving tendency to go after LLToolGrab::getInstance(). I DO NOT KNOW what should be the relationship between the instance in LLToolCompGun and the LLToolGrab singleton instance.) LLGridManager declared a variant constructor accepting (const std::string&), with the comment: // initialize with an explicity grid file for testing. As there is no evidence of this being called from anywhere, delete it. LLChicletBar's constructor accepted an optional (const LLSD&). As the LLSD parameter wasn't used, and as there is no evidence of it being passed from anywhere, delete the parameter. LLViewerWindow::shutdownViews() was checking LLNavigationBar:: instanceExists(), then deleting its getInstance() pointer -- leaving a dangling LLSingleton instance pointer, a land mine if any subsequent code should attempt to reference it. Use deleteSingleton() instead. ~LLAppViewer() was calling LLViewerEventRecorder::instance() and then explicitly calling ~LLViewerEventRecorder() on that instance -- leaving the LLSingleton instance pointer pointing to an allocated-but-destroyed instance. Use deleteSingleton() instead.
Diffstat (limited to 'indra/newview/lltoolgrab.cpp')
-rw-r--r--indra/newview/lltoolgrab.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp
index c0ca4d7a9a..ed32e584a5 100644
--- a/indra/newview/lltoolgrab.cpp
+++ b/indra/newview/lltoolgrab.cpp
@@ -69,7 +69,7 @@ extern BOOL gDebugClicks;
//
// Methods
//
-LLToolGrab::LLToolGrab( LLToolComposite* composite )
+LLToolGrabBase::LLToolGrabBase( LLToolComposite* composite )
: LLTool( std::string("Grab"), composite ),
mMode( GRAB_INACTIVE ),
mVerticalDragging( FALSE ),
@@ -88,12 +88,12 @@ LLToolGrab::LLToolGrab( LLToolComposite* composite )
mHideBuildHighlight(FALSE)
{ }
-LLToolGrab::~LLToolGrab()
+LLToolGrabBase::~LLToolGrabBase()
{ }
// virtual
-void LLToolGrab::handleSelect()
+void LLToolGrabBase::handleSelect()
{
if(gFloaterTools)
{
@@ -106,7 +106,7 @@ void LLToolGrab::handleSelect()
gGrabBtnSpin = FALSE;
}
-void LLToolGrab::handleDeselect()
+void LLToolGrabBase::handleDeselect()
{
if( hasMouseCapture() )
{
@@ -123,7 +123,7 @@ void LLToolGrab::handleDeselect()
}
-BOOL LLToolGrab::handleDoubleClick(S32 x, S32 y, MASK mask)
+BOOL LLToolGrabBase::handleDoubleClick(S32 x, S32 y, MASK mask)
{
if (gDebugClicks)
{
@@ -133,7 +133,7 @@ BOOL LLToolGrab::handleDoubleClick(S32 x, S32 y, MASK mask)
return FALSE;
}
-BOOL LLToolGrab::handleMouseDown(S32 x, S32 y, MASK mask)
+BOOL LLToolGrabBase::handleMouseDown(S32 x, S32 y, MASK mask)
{
if (gDebugClicks)
{
@@ -152,7 +152,7 @@ BOOL LLToolGrab::handleMouseDown(S32 x, S32 y, MASK mask)
return TRUE;
}
-void LLToolGrab::pickCallback(const LLPickInfo& pick_info)
+void LLToolGrabBase::pickCallback(const LLPickInfo& pick_info)
{
LLToolGrab::getInstance()->mGrabPick = pick_info;
LLViewerObject *objectp = pick_info.getObject();
@@ -182,7 +182,7 @@ void LLToolGrab::pickCallback(const LLPickInfo& pick_info)
}
}
-BOOL LLToolGrab::handleObjectHit(const LLPickInfo& info)
+BOOL LLToolGrabBase::handleObjectHit(const LLPickInfo& info)
{
mGrabPick = info;
LLViewerObject* objectp = mGrabPick.getObject();
@@ -315,7 +315,7 @@ BOOL LLToolGrab::handleObjectHit(const LLPickInfo& info)
}
-void LLToolGrab::startSpin()
+void LLToolGrabBase::startSpin()
{
LLViewerObject* objectp = mGrabPick.getObject();
if (!objectp)
@@ -339,7 +339,7 @@ void LLToolGrab::startSpin()
}
-void LLToolGrab::stopSpin()
+void LLToolGrabBase::stopSpin()
{
mSpinGrabbing = FALSE;
@@ -373,7 +373,7 @@ void LLToolGrab::stopSpin()
}
-void LLToolGrab::startGrab()
+void LLToolGrabBase::startGrab()
{
// Compute grab_offset in the OBJECT's root's coordinate frame
// (sometimes root == object)
@@ -422,7 +422,7 @@ void LLToolGrab::startGrab()
}
-BOOL LLToolGrab::handleHover(S32 x, S32 y, MASK mask)
+BOOL LLToolGrabBase::handleHover(S32 x, S32 y, MASK mask)
{
if (!gViewerWindow->getLeftMouseDown())
{
@@ -466,7 +466,7 @@ const F32 GRAB_SENSITIVITY_Y = 0.0075f;
// Dragging.
-void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask)
+void LLToolGrabBase::handleHoverActive(S32 x, S32 y, MASK mask)
{
LLViewerObject* objectp = mGrabPick.getObject();
if (!objectp || !hasMouseCapture() ) return;
@@ -724,7 +724,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask)
}
-void LLToolGrab::handleHoverNonPhysical(S32 x, S32 y, MASK mask)
+void LLToolGrabBase::handleHoverNonPhysical(S32 x, S32 y, MASK mask)
{
LLViewerObject* objectp = mGrabPick.getObject();
if (!objectp || !hasMouseCapture() ) return;
@@ -881,7 +881,7 @@ void LLToolGrab::handleHoverNonPhysical(S32 x, S32 y, MASK mask)
// Not dragging. Just showing affordances
-void LLToolGrab::handleHoverInactive(S32 x, S32 y, MASK mask)
+void LLToolGrabBase::handleHoverInactive(S32 x, S32 y, MASK mask)
{
// JC - TODO - change cursor based on gGrabBtnVertical, gGrabBtnSpin
LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (inactive-not over editable object)" << LL_ENDL;
@@ -889,7 +889,7 @@ void LLToolGrab::handleHoverInactive(S32 x, S32 y, MASK mask)
}
// User is trying to do something that's not allowed.
-void LLToolGrab::handleHoverFailed(S32 x, S32 y, MASK mask)
+void LLToolGrabBase::handleHoverFailed(S32 x, S32 y, MASK mask)
{
if( GRAB_NOOBJECT == mMode )
{
@@ -930,7 +930,7 @@ void LLToolGrab::handleHoverFailed(S32 x, S32 y, MASK mask)
-BOOL LLToolGrab::handleMouseUp(S32 x, S32 y, MASK mask)
+BOOL LLToolGrabBase::handleMouseUp(S32 x, S32 y, MASK mask)
{
// call the base class to propogate info to sim
LLTool::handleMouseUp(x, y, mask);
@@ -961,7 +961,7 @@ BOOL LLToolGrab::handleMouseUp(S32 x, S32 y, MASK mask)
return TRUE;
}
-void LLToolGrab::stopEditing()
+void LLToolGrabBase::stopEditing()
{
if( hasMouseCapture() )
{
@@ -969,7 +969,7 @@ void LLToolGrab::stopEditing()
}
}
-void LLToolGrab::onMouseCaptureLost()
+void LLToolGrabBase::onMouseCaptureLost()
{
LLViewerObject* objectp = mGrabPick.getObject();
if (!objectp)
@@ -1026,7 +1026,7 @@ void LLToolGrab::onMouseCaptureLost()
}
-void LLToolGrab::stopGrab()
+void LLToolGrabBase::stopGrab()
{
LLViewerObject* objectp = mGrabPick.getObject();
if (!objectp)
@@ -1067,29 +1067,29 @@ void LLToolGrab::stopGrab()
}
-void LLToolGrab::draw()
+void LLToolGrabBase::draw()
{ }
-void LLToolGrab::render()
+void LLToolGrabBase::render()
{ }
-BOOL LLToolGrab::isEditing()
+BOOL LLToolGrabBase::isEditing()
{
return (mGrabPick.getObject().notNull());
}
-LLViewerObject* LLToolGrab::getEditingObject()
+LLViewerObject* LLToolGrabBase::getEditingObject()
{
return mGrabPick.getObject();
}
-LLVector3d LLToolGrab::getEditingPointGlobal()
+LLVector3d LLToolGrabBase::getEditingPointGlobal()
{
return getGrabPointGlobal();
}
-LLVector3d LLToolGrab::getGrabPointGlobal()
+LLVector3d LLToolGrabBase::getGrabPointGlobal()
{
switch(mMode)
{