-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathcmdmgr.h
More file actions
202 lines (163 loc) · 5.47 KB
/
cmdmgr.h
File metadata and controls
202 lines (163 loc) · 5.47 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#ifndef cmdmgr_h
#define cmdmgr_h
/*
* NIST STEP Editor Class Library
* cleditor/cmdmgr.h
* April 1997
* David Sauder
* K. C. Morris
* Development of this software was funded by the United States Government,
* and is not subject to copyright.
*/
#include <sc_export.h>
#include "clutils/gennode.h"
#include "clutils/gennodelist.h"
#include "clutils/gennodearray.h"
#include "cleditor/editordefines.h"
#include "clstepcore/mgrnode.h"
#include "clstepcore/mgrnodelist.h"
#include "clstepcore/dispnode.h"
#include "clstepcore/dispnodelist.h"
#include "clstepcore/SingleLinkList.h"
//#define NUM_CMDMGR_CMDS 9
// this is the number of columns that contain cmds (as opposed
// to state info)
#define NUM_CMD_COLUMNS 3
// **** each of CMD_CHAR must be a unique char.
#define SAVE_COMPLETE_CMD_CHAR 's'
#define SAVE_COMPLETE_CMD_COL 0
#define SAVE_COMPLETE_STATE_CHAR ' '
#define SAVE_COMPLETE_STATE_COL 4
#define SAVE_INCOMPLETE_CMD_CHAR 'i'
#define SAVE_INCOMPLETE_CMD_COL 0
#define SAVE_INCOMPLETE_STATE_CHAR 'I'
#define SAVE_INCOMPLETE_STATE_COL 4
// backup to last save
//#define CANCEL_CMD_CHAR 'c'
//#define CANCEL_CMD_COL 0
#define NEW_STATE_CHAR 'N'
#define NEW_STATE_COL 4
#define DELETE_CMD_CHAR 'd'
#define DELETE_CMD_COL 0
#define DELETE_STATE_CHAR 'D'
#define DELETE_STATE_COL 4
// close will try to save it to its previous status
#define CLOSE_CMD_CHAR 'c'
#define CLOSE_CMD_COL 2
#define MODIFY_CMD_CHAR 'm'
#define MODIFY_CMD_COL 2
#define MODIFY_STATE_CHAR 'M'
#define MODIFY_STATE_COL 3
#define VIEW_CMD_CHAR 'v'
#define VIEW_CMD_COL 2
#define VIEW_STATE_CHAR 'V'
#define VIEW_STATE_COL 3
#define REPLICATE_CMD_CHAR 'r'
#define REPLICATE_CMD_COL 1
#define EXECUTE_CMD_CHAR 'x'
#define EXECUTE_CMD_COL 5
#define UNMARK_CMD_CHAR 'u'
#define UNMARK_CMD_COL 5
///////////////////////////////////////////////////////////////////////////////
class SC_EDITOR_EXPORT ReplicateLinkNode : public SingleLinkNode {
private:
protected:
MgrNode * _repNode;
public:
ReplicateLinkNode() {
_repNode = 0;
}
~ReplicateLinkNode() { }
const char * ClassName() {
return "ReplicateLinkNode";
}
MgrNode * ReplicateNode() {
return _repNode;
}
void ReplicateNode( MgrNode * rn ) {
_repNode = rn;
}
};
class SC_EDITOR_EXPORT ReplicateList : public SingleLinkList {
private:
protected:
public:
ReplicateList() { }
~ReplicateList() { }
virtual SingleLinkNode * NewNode() {
return new ReplicateLinkNode;
}
bool IsOnList( MgrNode * mn );
ReplicateLinkNode * FindNode( MgrNode * mn );
ReplicateLinkNode * AddNode( MgrNode * rn ) {
ReplicateLinkNode * node = ( ReplicateLinkNode * ) NewNode();
node->ReplicateNode( rn );
SingleLinkList::AppendNode( node );
return node;
}
bool Remove( ReplicateLinkNode * rln );
bool Remove( MgrNode * rn );
const char * ClassName() {
return "ReplicateList";
}
};
///////////////////////////////////////////////////////////////////////////////
class SC_EDITOR_EXPORT CmdMgr {
protected:
MgrNodeList * completeList;
MgrNodeList * incompleteList;
MgrNodeList * cancelList;
MgrNodeList * deleteList;
DisplayNodeList * mappedWriteList;
DisplayNodeList * mappedViewList;
DisplayNodeList * closeList;
ReplicateList * replicateList;
public:
CmdMgr();
~CmdMgr();
// STATE LIST OPERATIONS
MgrNode * GetHead( stateEnum listType );
DisplayNode * GetHead( displayStateEnum listType );
ReplicateLinkNode * GetReplicateHead() {
return ( ReplicateLinkNode * )( replicateList->GetHead() );
}
void ClearEntries( stateEnum listType );
void ClearEntries( displayStateEnum listType );
void ClearReplicateEntries() {
replicateList->Empty();
}
ReplicateList * RepList() {
return replicateList;
}
// searches current list for fileId
MgrNode * StateFindFileId( stateEnum s, int fileId );
// returns stateNext or statePrev member variables
// i.e. next or previous node on curr state list
int SaveCompleteCmdList( MgrNode * mn ) {
return mn->ChangeList( completeList );
}
int SaveIncompleteCmdList( MgrNode * mn ) {
return mn->ChangeList( incompleteList );
}
int CancelCmdList( MgrNode * mn ) {
return mn->ChangeList( cancelList );
}
int DeleteCmdList( MgrNode * mn ) {
return mn->ChangeList( deleteList );
}
int ModifyCmdList( MgrNode * mn ) {
return mn->ChangeList( mappedWriteList );
}
int ViewCmdList( MgrNode * mn ) {
return mn->ChangeList( mappedViewList );
}
int CloseCmdList( MgrNode * mn ) {
return ( ( mn->DisplayState() == mappedWrite ) ||
( mn->DisplayState() == mappedView ) ) ?
mn->ChangeList( closeList ) : 0;
}
void ReplicateCmdList( MgrNode * mn );
void ClearInstances();
protected:
};
#endif