diff options
author | Todd Stinson <stinson@lindenlab.com> | 2012-02-14 17:14:11 -0800 |
---|---|---|
committer | Todd Stinson <stinson@lindenlab.com> | 2012-02-14 17:14:11 -0800 |
commit | d62017ddaaf8430e3f6887e687aa232578261b5e (patch) | |
tree | 178daef884ce90a4d8282682b5888fa1b64c431d /indra/newview | |
parent | d2bd4e4d108acae5473c28936b04bd19055e97e8 (diff) |
PATH-284: Refactoring the code for determining whether in path creation mode.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloaterpathfindingconsole.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindingconsole.h | 2 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 7 |
3 files changed, 9 insertions, 11 deletions
diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index e46a454e70..62f7b9c85c 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -105,9 +105,7 @@ BOOL LLFloaterPathfindingConsole::postBuild() BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down)
{
- if (down && (clicktype == LLMouseHandler::CLICK_LEFT) &&
- (((mask & MASK_CONTROL) && !(mask & (~MASK_CONTROL))) ||
- ((mask & MASK_SHIFT) && !(mask & (~MASK_SHIFT)))))
+ if (isGeneratePathMode(mask, clicktype, down))
{
LLVector3 dv = gViewerWindow->mouseDirectionGlobal(x, y);
LLVector3 mousePos = LLViewerCamera::getInstance()->getOrigin();
@@ -136,9 +134,12 @@ BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, E }
}
-BOOL LLFloaterPathfindingConsole::isGeneratePathMode() const
+BOOL LLFloaterPathfindingConsole::isGeneratePathMode(MASK mask, EClickType clicktype, BOOL down) const
{
- return (getVisible() && (mEditTestTabContainer->getCurrentPanelIndex() == 1));
+ return (getVisible() && (mEditTestTabContainer->getCurrentPanelIndex() == 1) &&
+ (clicktype == LLMouseHandler::CLICK_LEFT) && down && + (((mask & MASK_CONTROL) && !(mask & (~MASK_CONTROL))) || + ((mask & MASK_SHIFT) && !(mask & (~MASK_SHIFT)))));
}
LLHandle<LLFloaterPathfindingConsole> LLFloaterPathfindingConsole::getInstanceHandle()
diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index ab5933f46c..7f8e269459 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -58,7 +58,7 @@ public: virtual BOOL postBuild(); virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down); - BOOL isGeneratePathMode() const; + BOOL isGeneratePathMode(MASK mask, EClickType clicktype, BOOL down) const; static LLHandle<LLFloaterPathfindingConsole> getInstanceHandle(); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index e60bc66e82..219f00d47d 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -953,16 +953,13 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK } //Determine if we have a pathing system and subsequently provide any mouse input - if ((LLPathingLib::getInstance() != NULL) && - (clicktype == LLMouseHandler::CLICK_LEFT) && down && - (((mask & MASK_CONTROL) && !(mask & (~MASK_CONTROL))) || - ((mask & MASK_SHIFT) && !(mask & (~MASK_SHIFT))))) + if (LLPathingLib::getInstance() != NULL) { LLHandle<LLFloaterPathfindingConsole> pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle(); if (!pathfindingConsoleHandle.isDead()) { LLFloaterPathfindingConsole *pathfindingConsoleFloater = pathfindingConsoleHandle.get(); - if (pathfindingConsoleFloater->isGeneratePathMode()) + if (pathfindingConsoleFloater->isGeneratePathMode(mask, clicktype, down)) { return pathfindingConsoleFloater->handleAnyMouseClick(x, y, mask, clicktype, down); } |