lltoolgrab.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_TOOLGRAB_H
00033 #define LL_TOOLGRAB_H
00034 
00035 #include "lltool.h"
00036 #include "v3math.h"
00037 #include "llquaternion.h"
00038 #include "llmemory.h"
00039 #include "lluuid.h"
00040 
00041 class LLView;
00042 class LLTextBox;
00043 class LLViewerObject;
00044 
00045 class LLToolGrab : public LLTool
00046 {
00047 public:
00048         LLToolGrab( LLToolComposite* composite = NULL );
00049         ~LLToolGrab();
00050 
00051         /*virtual*/ BOOL        handleHover(S32 x, S32 y, MASK mask);
00052         /*virtual*/ BOOL        handleMouseDown(S32 x, S32 y, MASK mask);
00053         /*virtual*/ BOOL        handleMouseUp(S32 x, S32 y, MASK mask);
00054         /*virtual*/ BOOL        handleDoubleClick(S32 x, S32 y, MASK mask);
00055         /*virtual*/ void        render();               // 3D elements
00056         /*virtual*/ void        draw();                 // 2D elements
00057 
00058         virtual void            handleSelect();
00059         virtual void            handleDeselect();
00060         
00061         virtual LLViewerObject* getEditingObject();
00062         virtual LLVector3d              getEditingPointGlobal();
00063         virtual BOOL                    isEditing();
00064         virtual void                    stopEditing();
00065         
00066         virtual void                    onMouseCaptureLost();
00067 
00068         BOOL                    hasGrabOffset()  { return TRUE; }       // HACK
00069         LLVector3               getGrabOffset(S32 x, S32 y);            // HACK
00070 
00071         // Capture the mouse and start grabbing.
00072         BOOL                    handleObjectHit(LLViewerObject *objectp, S32 x, S32 y, MASK mask);
00073 
00074         // Certain grabs should not highlight the "Build" toolbar button
00075         BOOL getHideBuildHighlight() { return mHideBuildHighlight; }
00076 
00077         static void             pickCallback(S32 x, S32 y, MASK mask);
00078 private:
00079         LLVector3d              getGrabPointGlobal();
00080         void                    startGrab(S32 x, S32 y);
00081         void                    stopGrab();
00082 
00083         void                    startSpin();
00084         void                    stopSpin();
00085 
00086         void                    handleHoverSpin(S32 x, S32 y, MASK mask);
00087         void                    handleHoverActive(S32 x, S32 y, MASK mask);
00088         void                    handleHoverInactive(S32 x, S32 y, MASK mask);
00089         void                    handleHoverFailed(S32 x, S32 y, MASK mask);
00090 
00091 private:
00092         enum                    EGrabMode { GRAB_INACTIVE, GRAB_ACTIVE_CENTER, GRAB_NONPHYSICAL, GRAB_LOCKED, GRAB_NOOBJECT };
00093 
00094         EGrabMode               mMode;
00095 
00096         BOOL                    mVerticalDragging;
00097 
00098         BOOL                    mHitLand;
00099         LLUUID                  mHitObjectID;                           // if hit something, its ID
00100 
00101         LLPointer<LLViewerObject>       mGrabObject;                                    // the object currently being grabbed
00102         LLTimer                 mGrabTimer;                                             // send simulator time between hover movements
00103 
00104         LLVector3               mGrabOffsetFromCenterInitial;   // meters from CG of object
00105         LLVector3               mGrabOffset;                                    // how far cursor currently is from grab start point, meters
00106         LLVector3d              mGrabHiddenOffsetFromCamera;    // in cursor hidden drag, how far is grab offset from camera
00107 
00108         LLVector3d              mDragStartPointGlobal;                          // projected into world
00109         LLVector3d              mDragStartFromCamera;                   // drag start relative to camera
00110 
00111         S32                             mLastMouseX;
00112         S32                             mLastMouseY;
00113         S32                             mMouseDownX;
00114         S32                             mMouseDownY;
00115         MASK                    mMouseMask;
00116         S32                             mAccumDeltaX;   // since cursor hidden, how far have you moved?
00117         S32                             mAccumDeltaY;
00118         BOOL                    mHasMoved;              // has mouse moved off center at all?
00119         BOOL                    mOutsideSlop;   // has mouse moved outside center 5 pixels?
00120         BOOL                    mDeselectedThisClick;
00121 
00122         BOOL                    mSpinGrabbing;
00123         LLQuaternion    mSpinRotation;
00124 
00125         BOOL                    mHideBuildHighlight;
00126 };
00127 
00128 extern LLToolGrab *gToolGrab;
00129 
00130 extern BOOL gGrabBtnVertical;
00131 extern BOOL gGrabBtnSpin;
00132 extern LLTool* gGrabTransientTool;
00133 
00134 #endif  // LL_TOOLGRAB_H
00135 

Generated on Thu Jul 1 06:09:21 2010 for Second Life Viewer by  doxygen 1.4.7