summaryrefslogtreecommitdiff
path: root/hammer/ToolManager.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /hammer/ToolManager.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'hammer/ToolManager.h')
-rw-r--r--hammer/ToolManager.h96
1 files changed, 96 insertions, 0 deletions
diff --git a/hammer/ToolManager.h b/hammer/ToolManager.h
new file mode 100644
index 0000000..3248a8d
--- /dev/null
+++ b/hammer/ToolManager.h
@@ -0,0 +1,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