]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - include/iundo.h
Merge pull request #47 from mrwonko/MapLoading
[xonotic/netradiant.git] / include / iundo.h
1 /*
2    Copyright (C) 1999-2007 id Software, Inc. and contributors.
3    For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5    This file is part of GtkRadiant.
6
7    GtkRadiant is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    GtkRadiant is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with GtkRadiant; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21
22 #ifndef _IUNDO_H_
23 #define _IUNDO_H_
24
25 #define UNDO_MAJOR "undo"
26
27 //start operation
28 typedef void ( *PFN_UNDOSTART )( const char *operation );
29 //end operation
30 typedef void ( *PFN_UNDOEND )( void );
31 //add brush to the undo
32 typedef void ( *PFN_UNDOADDBRUSH )( brush_t *pBrush );
33 //end a brush after the operation is performed
34 typedef void ( *PFN_UNDOENDBRUSH )( brush_t *pBrush );
35 //add a list with brushes to the undo
36 typedef void ( *PFN_UNDOADDBRUSHLIST )( brush_t *brushlist );
37 //end a list with brushes after the operation is performed
38 typedef void ( *PFN_UNDOENDBRUSHLIST )( brush_t *brushlist );
39 //add entity to undo
40 typedef void ( *PFN_UNDOADDENTITY )( entity_t *entity );
41 //end an entity after the operation is performed
42 typedef void ( *PFN_UNDOENDENTITY )( entity_t *entity );
43 //undo last operation (bSilent == true -> will not print the "undone blah blah message")
44 typedef void ( *PFN_UNDO )( unsigned char bSilent );
45 //redo last undone operation
46 typedef void ( *PFN_REDO )( void );
47 //get the undo Id of the next undo (0 if none available)
48 typedef int ( *PFN_GETUNDOID )( void );
49 //returns true if there is something to be undone available
50 typedef int ( *PFN_UNDOAVAILABLE )( void );
51 //returns true if there is something to redo available
52 typedef int ( *PFN_REDOAVAILABLE )( void );
53
54 struct _QERUndoTable
55 {
56         int m_nSize;
57         PFN_UNDOSTART m_pfnUndo_Start;
58         PFN_UNDOEND m_pfnUndo_End;
59         PFN_UNDOADDBRUSH m_pfnUndo_AddBrush;
60         PFN_UNDOENDBRUSH m_pfnUndo_EndBrush;
61         PFN_UNDOADDBRUSHLIST m_pfnUndo_AddBrushList;
62         PFN_UNDOENDBRUSHLIST m_pfnUndo_EndBrushList;
63         PFN_UNDOADDENTITY m_pfnUndo_AddEntity;
64         PFN_UNDOENDENTITY m_pfnUndo_EndEntity;
65         PFN_UNDO m_pfnUndo_Undo;
66         PFN_REDO m_pfnUndo_Redo;
67         PFN_GETUNDOID m_pfnUndo_GetUndoId;
68         PFN_UNDOAVAILABLE m_pfnUndo_UndoAvailable;
69         PFN_REDOAVAILABLE m_pfnUndo_RedoAvailable;
70 };
71
72 #ifdef USE_UNDOTABLE_DEFINE
73 #ifndef __UNDOTABLENAME
74 #define __UNDOTABLENAME g_UndoTable
75 #endif
76 #define Undo_Start __UNDOTABLENAME.m_pfnUndo_Start
77 #define Undo_End __UNDOTABLENAME.m_pfnUndo_End
78 #define Undo_AddBrush __UNDOTABLENAME.m_pfnUndo_AddBrush
79 #define Undo_EndBrush __UNDOTABLENAME.m_pfnUndo_EndBrush
80 #define Undo_AddBrushList __UNDOTABLENAME.m_pfnUndo_AddBrushList
81 #define Undo_EndBrushList __UNDOTABLENAME.m_pfnUndo_EndBrushList
82 #define Undo_AddEntity __UNDOTABLENAME.m_pfnUndo_AddEntity
83 #define Undo_EndEntity __UNDOTABLENAME.m_pfnUndo_EndEntity
84 #endif
85
86 #endif // _IUNDO_H_