blob: 3248a8d47085ea33bf0449359ab939701f8f5f12 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef TOOLMANAGER_H
#define TOOLMANAGER_H
#ifdef _WIN32
#pragma once
#endif
#include "ToolInterface.h"
#include "utlvector.h"
class CToolAxisHandle;
class CToolDecal;
class CToolDisplace;
class CToolMagnify;
class CToolMaterial;
class CToolPickAngles;
class CToolPickEntity;
class CToolPickFace;
class CToolPointHandle;
class CToolSphere;
class CBaseTool;
class CToolSweptPlayerHull;
class CChunkHandlerMap;
class CToolManager
{
public:
CToolManager();
~CToolManager();
bool Init(CMapDoc *pDocument);
void Shutdown();
CBaseTool *GetActiveTool();
ToolID_t GetActiveToolID();
CBaseTool *GetToolForID(ToolID_t eToolID);
void SetTool(ToolID_t nToolID); // changes current tool without touching the tool stack
void PushTool(ToolID_t nToolID); // activates a new tool and put current tool on stack
void PopTool(); // restores last tool on stack
inline int GetToolCount();
inline CBaseTool *GetTool(int nIndex);
void RemoveAllTools();
void AddTool(CBaseTool *pTool);
static ChunkFileResult_t LoadCallback(CChunkFile *pFile, CBaseTool *pTool);
void AddToolHandlers( CChunkHandlerMap *pHandlersMap );
ChunkFileResult_t SaveVMF(CChunkFile *pFile, CSaveInfo *pSaveInfo);
ChunkFileResult_t LoadVMF(CChunkFile *pFile);
private:
void ActivateTool( CBaseTool *pTool );
void DeactivateTool( CBaseTool *pTool );
CUtlVector<CBaseTool *> m_Tools; // List of ALL the tools.
CMapDoc *m_pDocument; // document the manager is responisble for
CBaseTool *m_pActiveTool; // Pointer to the active new tool, NULL if none.
CUtlVector<ToolID_t> m_ToolIDStack; // Stack of active tool IDs, for PushTool/PopTool.
};
//-----------------------------------------------------------------------------
// Purpose: Accessor for iterating tools.
//-----------------------------------------------------------------------------
int CToolManager::GetToolCount()
{
return m_Tools.Count();
}
//-----------------------------------------------------------------------------
// Purpose: Accessor for iterating tools.
//-----------------------------------------------------------------------------
CBaseTool *CToolManager::GetTool(int nIndex)
{
return m_Tools.Element(nIndex);
}
// get the tool manager for the current active document:
CToolManager *ToolManager();
#endif // TOOLMANAGER_H
|