lltoolmgr.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_TOOLMGR_H
00033 #define LL_TOOLMGR_H
00034 
00035 #include "doublelinkedlist.h"
00036 #include "llkeyboard.h"
00037 
00038 class LLTool;
00039 class LLToolset;
00040 
00041 // Key bindings for common operations
00042 const MASK MASK_VERTICAL                = MASK_CONTROL;
00043 const MASK MASK_SPIN                    = MASK_CONTROL | MASK_SHIFT;
00044 const MASK MASK_ZOOM                    = MASK_NONE;
00045 const MASK MASK_ORBIT                   = MASK_CONTROL;
00046 const MASK MASK_PAN                             = MASK_CONTROL | MASK_SHIFT;
00047 const MASK MASK_COPY                    = MASK_SHIFT;
00048 
00049 class LLToolMgr
00050 {
00051 public:
00052         LLToolMgr();
00053         ~LLToolMgr();
00054 
00055         // Must be called after gSavedSettings set up.
00056         void                    initTools();
00057 
00058         LLTool*                 getCurrentTool(); // returns active tool, taking into account keyboard state
00059         LLTool*                 getBaseTool(); // returns active tool when overrides are deactivated
00060 
00061         BOOL                    inEdit();
00062 
00063         void                    setTransientTool(LLTool* tool);
00064         void                    clearTransientTool();
00065         BOOL                    usingTransientTool();
00066 
00067         void                    setCurrentToolset(LLToolset* current);
00068         LLToolset*              getCurrentToolset();
00069 
00070         void                    onAppFocusGained();
00071         void                    onAppFocusLost();
00072 
00073 protected:
00074         friend class LLToolset;  // to allow access to setCurrentTool();
00075         void                    setCurrentTool(LLTool* tool);
00076         void                    updateToolStatus();
00077 
00078 protected:
00079         LLTool*                 mBaseTool;
00080         LLTool*                 mSavedTool;             // The current tool at the time application focus was lost.
00081         LLTool*                 mTransientTool;
00082         LLTool*                 mOverrideTool; // Tool triggered by keyboard override
00083         LLTool*                 mSelectedTool; // last known active tool
00084         LLToolset*              mCurrentToolset;
00085 };
00086 
00087 // Sets of tools for various modes
00088 class LLToolset
00089 {
00090 public:
00091         LLToolset() : mSelectedTool(NULL) {}
00092 
00093         LLTool*                 getSelectedTool()                               { return mSelectedTool; }
00094 
00095         void                    addTool(LLTool* tool);
00096 
00097         void                    selectTool( LLTool* tool );
00098         void                    selectToolByIndex( S32 index );
00099         void                    selectFirstTool();
00100         void                    selectNextTool();
00101         void                    selectPrevTool();
00102 
00103         void                    handleScrollWheel(S32 clicks);
00104 
00105         BOOL                    isToolSelected( S32 index );
00106 
00107 protected:
00108         LLTool*                 mSelectedTool;
00109         LLDoubleLinkedList<LLTool> mToolList;
00110 };
00111 
00112 // Handy callbacks for switching tools
00113 void select_tool(void *tool);
00114 
00115 
00116 // Globals (created and destroyed by LLViewerWindow)
00117 extern LLToolMgr*   gToolMgr;
00118 
00119 extern LLToolset* gBasicToolset;
00120 extern LLToolset *gCameraToolset;
00121 //extern LLToolset *gLandToolset;
00122 extern LLToolset* gMouselookToolset;
00123 extern LLToolset* gFaceEditToolset;
00124 
00125 extern LLTool*          gToolNull;
00126 
00127 #endif

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