From 6aeb2c68b9294e77ef9e16a8ad2fcd38d40ecfaf Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 11 Apr 2012 13:20:54 -0700 Subject: Refining the behavior of the pathing test tool behavior with regards to mouse clicks. --- indra/llcommon/llcursortypes.cpp | 1 + indra/llcommon/llcursortypes.h | 1 + indra/llwindow/llwindowwin32.cpp | 1 + indra/newview/llpathfindingpathtool.cpp | 54 ++++++++++++++++++++++++++++----- indra/newview/llpathfindingpathtool.h | 16 ++++++---- indra/newview/res/viewerRes.rc | 1 + 6 files changed, 60 insertions(+), 14 deletions(-) diff --git a/indra/llcommon/llcursortypes.cpp b/indra/llcommon/llcursortypes.cpp index dc308c30af..0367e6e622 100644 --- a/indra/llcommon/llcursortypes.cpp +++ b/indra/llcommon/llcursortypes.cpp @@ -70,6 +70,7 @@ ECursorType getCursorFromString(const std::string& cursor_string) cursor_string_table["UI_CURSOR_TOOLBUY"] = UI_CURSOR_TOOLBUY; cursor_string_table["UI_CURSOR_TOOLOPEN"] = UI_CURSOR_TOOLOPEN; cursor_string_table["UI_CURSOR_TOOLPATHFINDING"] = UI_CURSOR_TOOLPATHFINDING; + cursor_string_table["UI_CURSOR_TOOLNO"] = UI_CURSOR_TOOLNO; } std::map::const_iterator iter = cursor_string_table.find(cursor_string); diff --git a/indra/llcommon/llcursortypes.h b/indra/llcommon/llcursortypes.h index ea072ff4b4..4662e90975 100644 --- a/indra/llcommon/llcursortypes.h +++ b/indra/llcommon/llcursortypes.h @@ -66,6 +66,7 @@ enum ECursorType { UI_CURSOR_TOOLBUY, UI_CURSOR_TOOLOPEN, UI_CURSOR_TOOLPATHFINDING, + UI_CURSOR_TOOLNO, UI_CURSOR_COUNT // Number of elements in this enum (NOT a cursor) }; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index f6e4f9f6e1..a332bfddc4 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1698,6 +1698,7 @@ void LLWindowWin32::initCursors() mCursor[ UI_CURSOR_TOOLBUY ] = LoadCursor(module, TEXT("TOOLBUY")); mCursor[ UI_CURSOR_TOOLOPEN ] = LoadCursor(module, TEXT("TOOLOPEN")); mCursor[ UI_CURSOR_TOOLPATHFINDING ] = LoadCursor(module, TEXT("TOOLPATHFINDING")); + mCursor[ UI_CURSOR_TOOLNO ] = LoadCursor(module, TEXT("TOOLNO")); // Color cursors mCursor[ UI_CURSOR_TOOLPLAY ] = loadColorCursor(TEXT("TOOLPLAY")); diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp index d838441dfb..03e441a7f2 100644 --- a/indra/newview/llpathfindingpathtool.cpp +++ b/indra/newview/llpathfindingpathtool.cpp @@ -46,7 +46,10 @@ LLPathfindingPathTool::LLPathfindingPathTool() mTempPathData(), mPathResult(LLPathingLib::LLPL_NO_PATH), mCharacterType(kCharacterTypeNone), - mPathEventSignal() + mPathEventSignal(), + mIsLeftMouseButtonHeld(false), + mIsMiddleMouseButtonHeld(false), + mIsRightMouseButtonHeld(false) { if (!LLPathingLib::getInstance()) { @@ -65,12 +68,16 @@ BOOL LLPathfindingPathTool::handleMouseDown(S32 pX, S32 pY, MASK pMask) { BOOL returnVal = FALSE; - if (isAnyPathToolModKeys(pMask)) + llinfos << "STINSON DEBUG: got here" << llendl; + + if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask)) { computeFinalPoints(pX, pY, pMask); + mIsLeftMouseButtonHeld = true; setMouseCapture(TRUE); returnVal = TRUE; } + mIsLeftMouseButtonHeld = true; return returnVal; } @@ -79,54 +86,85 @@ BOOL LLPathfindingPathTool::handleMouseUp(S32 pX, S32 pY, MASK pMask) { BOOL returnVal = FALSE; - if (isAnyPathToolModKeys(pMask)) + llinfos << "STINSON DEBUG: got here" << llendl; + + if (mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask)) { computeFinalPoints(pX, pY, pMask); setMouseCapture(FALSE); returnVal = TRUE; } + mIsLeftMouseButtonHeld = false; return returnVal; } BOOL LLPathfindingPathTool::handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask) { - setMouseCapture(FALSE); + llinfos << "STINSON DEBUG: got here" << llendl; + + setMouseCapture(TRUE); + mIsMiddleMouseButtonHeld = true; + gViewerWindow->setCursor(UI_CURSOR_TOOLNO); return TRUE; } BOOL LLPathfindingPathTool::handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask) { - setMouseCapture(FALSE); + llinfos << "STINSON DEBUG: got here" << llendl; + + if (!mIsLeftMouseButtonHeld && mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld) + { + setMouseCapture(FALSE); + } + mIsMiddleMouseButtonHeld = false; return TRUE; } BOOL LLPathfindingPathTool::handleRightMouseDown(S32 pX, S32 pY, MASK pMask) { - setMouseCapture(FALSE); + llinfos << "STINSON DEBUG: got here" << llendl; + + setMouseCapture(TRUE); + mIsRightMouseButtonHeld = true; + gViewerWindow->setCursor(UI_CURSOR_TOOLNO); return TRUE; } BOOL LLPathfindingPathTool::handleRightMouseUp(S32 pX, S32 pY, MASK pMask) { - setMouseCapture(FALSE); + llinfos << "STINSON DEBUG: got here" << llendl; + + if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && mIsRightMouseButtonHeld) + { + setMouseCapture(FALSE); + } + mIsRightMouseButtonHeld = false; return TRUE; } BOOL LLPathfindingPathTool::handleDoubleClick(S32 pX, S32 pY, MASK pMask) { + llinfos << "STINSON DEBUG: got here" << llendl; + return TRUE; } +void LLPathfindingPathTool::onMouseCaptureLost() +{ + llinfos << "STINSON DEBUG: got here" << llendl; +} + BOOL LLPathfindingPathTool::handleHover(S32 pX, S32 pY, MASK pMask) { BOOL returnVal = FALSE; + llinfos << "STINSON DEBUG: got here" << llendl; - if (isAnyPathToolModKeys(pMask)) + if (!mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask)) { gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING); computeTempPoints(pX, pY, pMask); diff --git a/indra/newview/llpathfindingpathtool.h b/indra/newview/llpathfindingpathtool.h index ab1408826e..15ce97fe67 100644 --- a/indra/newview/llpathfindingpathtool.h +++ b/indra/newview/llpathfindingpathtool.h @@ -68,12 +68,13 @@ public: typedef boost::signals2::connection path_event_slot_t; virtual BOOL handleMouseDown(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleMouseUp(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleRightMouseDown(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleRightMouseUp(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + virtual BOOL handleMouseUp(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleRightMouseDown(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleRightMouseUp(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + virtual void onMouseCaptureLost(); virtual BOOL handleHover(S32 pX, S32 pY, MASK pMask); @@ -128,6 +129,9 @@ private: LLPathingLib::LLPLResult mPathResult; ECharacterType mCharacterType; path_event_signal_t mPathEventSignal; + bool mIsLeftMouseButtonHeld; + bool mIsMiddleMouseButtonHeld; + bool mIsRightMouseButtonHeld; }; #endif // LL_LLPATHFINDINGPATHTOOL_H diff --git a/indra/newview/res/viewerRes.rc b/indra/newview/res/viewerRes.rc index 5b25714203..686de0e7d5 100644 --- a/indra/newview/res/viewerRes.rc +++ b/indra/newview/res/viewerRes.rc @@ -123,6 +123,7 @@ TOOLBUY CURSOR "toolbuy.cur" TOOLOPEN CURSOR "toolopen.cur" TOOLSIT CURSOR "toolsit.cur" TOOLPATHFINDING CURSOR "lltoolpathfinding.cur" +TOOLNO CURSOR "llno.cur" ///////////////////////////////////////////////////////////////////////////// // -- cgit v1.2.3