PageRenderTime 194ms CodeModel.GetById 90ms app.highlight 8ms RepoModel.GetById 93ms app.codeStats 0ms

/indra/newview/lltoolmgr.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 124 lines | 67 code | 26 blank | 31 comment | 0 complexity | bafe8c5096f826db8e49b7e908fb412e MD5 | raw file
  1/** 
  2 * @file lltoolmgr.h
  3 * @brief LLToolMgr class header file
  4 *
  5 * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27#ifndef LL_TOOLMGR_H
 28#define LL_TOOLMGR_H
 29
 30#include "llkeyboard.h"
 31
 32class LLTool;
 33class LLToolset;
 34
 35// Key bindings for common operations
 36const MASK MASK_VERTICAL		= MASK_CONTROL;
 37const MASK MASK_SPIN			= MASK_CONTROL | MASK_SHIFT;
 38const MASK MASK_ZOOM			= MASK_NONE;
 39const MASK MASK_ORBIT			= MASK_CONTROL;
 40const MASK MASK_PAN				= MASK_CONTROL | MASK_SHIFT;
 41const MASK MASK_COPY			= MASK_SHIFT;
 42
 43class LLToolMgr : public LLSingleton<LLToolMgr>
 44{
 45public:
 46	LLToolMgr();
 47	~LLToolMgr();
 48
 49	// Must be called after gSavedSettings set up.
 50	void			initTools();
 51
 52	LLTool*			getCurrentTool(); // returns active tool, taking into account keyboard state
 53	LLTool*			getBaseTool(); // returns active tool when overrides are deactivated
 54
 55	bool			inEdit();
 56	bool			canEdit();
 57	void			toggleBuildMode();
 58	
 59	/* Determines if we are in Build mode or not. */
 60	bool			inBuildMode();
 61
 62	void			setTransientTool(LLTool* tool);
 63	void			clearTransientTool();
 64	BOOL			usingTransientTool();
 65
 66	void			setCurrentToolset(LLToolset* current);
 67	LLToolset*		getCurrentToolset();
 68
 69	void			onAppFocusGained();
 70	void			onAppFocusLost();
 71
 72	void            clearSavedTool();
 73
 74protected:
 75	friend class LLToolset;  // to allow access to setCurrentTool();
 76	void			setCurrentTool(LLTool* tool);
 77	void			updateToolStatus();
 78
 79protected:
 80	LLTool*			mBaseTool;
 81	LLTool*			mSavedTool;		// The current tool at the time application focus was lost.
 82	LLTool*			mTransientTool;
 83	LLTool*			mOverrideTool; // Tool triggered by keyboard override
 84	LLTool*			mSelectedTool; // last known active tool
 85	LLToolset*		mCurrentToolset;
 86};
 87
 88// Sets of tools for various modes
 89class LLToolset
 90{
 91public:
 92	LLToolset() : mSelectedTool(NULL) {}
 93
 94	LLTool*			getSelectedTool()				{ return mSelectedTool; }
 95
 96	void			addTool(LLTool* tool);
 97
 98	void			selectTool( LLTool* tool );
 99	void			selectToolByIndex( S32 index );
100	void			selectFirstTool();
101	void			selectNextTool();
102	void			selectPrevTool();
103
104	void			handleScrollWheel(S32 clicks);
105
106	BOOL			isToolSelected( S32 index );
107
108protected:
109	LLTool*			mSelectedTool;
110	typedef std::vector<LLTool*> tool_list_t;
111	tool_list_t 	mToolList;
112};
113
114// Globals
115
116extern LLToolset* gBasicToolset;
117extern LLToolset *gCameraToolset;
118//extern LLToolset *gLandToolset;
119extern LLToolset* gMouselookToolset;
120extern LLToolset* gFaceEditToolset;
121
122extern LLTool*		gToolNull;
123
124#endif