OSDN Git Service

[denncoCreator] Implemented change cell and cell code type command functionality.
[dennco/denncoCreator.git] / Source / command / dceditcommands.h
1 //  Copyright (c) 2012 Dennco Project
2 //
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16 //
17 //  Created by tkawata on Sep-30, 2012.
18 //
19 #ifndef DCEDITCOMMANDS_H
20 #define DCEDITCOMMANDS_H
21
22 #include "dccommand.h"
23
24 class DCCell;
25 class DCCellCode;
26 class DCContainer;
27 class DCAxon;
28 class DCReceptor;
29 class DCAxonTerminal;
30 class DCVCPage;
31
32 class DCStartAddAxonTerminalCommandFromAxon : public DCCommand
33 {
34     DCCell  *d_ownerCell;
35
36 public:
37     DCStartAddAxonTerminalCommandFromAxon(const void *requester, DCCreator *creator, DCCell *ownerCell);
38     virtual ~DCStartAddAxonTerminalCommandFromAxon() {}
39     void undo();
40     void redo();
41 };
42
43
44 class DCStartAddAxonTerminalCommandFromReceptor : public DCCommand
45 {
46     DCCell  *d_ownerCell;
47     QString d_receptorName;
48
49 public:
50     DCStartAddAxonTerminalCommandFromReceptor(const void *requester, DCCreator *creator, DCCell *ownerCell, const QString &receptorName);
51     virtual ~DCStartAddAxonTerminalCommandFromReceptor() {}
52     void undo();
53     void redo();
54 };
55
56
57 //------------------------------------------
58
59 class DCCommitAddAxonTerminalCommand : public DCCommand
60 {
61     DCCell          *d_axonCell;
62     DCCell          *d_receptorCell;
63     DCReceptor      *d_receptor;
64     QString         d_receptorName;
65     bool            d_isAdded;
66
67 public:
68     DCCommitAddAxonTerminalCommand(const void *requester, DCCreator *creator, DCAxon *axon, DCCell *receptorCell, const QString &receptorName);
69     DCCommitAddAxonTerminalCommand(const void *requester, DCCreator *creator, DCCell *axonCell, DCReceptor *receptor);
70     virtual ~DCCommitAddAxonTerminalCommand() {}
71     void undo();
72     void redo();
73 };
74
75 //------------------------------------------
76
77 class DCRemoveAxonTerminalCommand : public DCCommand
78 {
79     DCCell          *d_cell;
80     DCAxonTerminal  *d_axonTerminal;
81     QString         d_receptorName;
82     bool            d_isDeleted;
83 public:
84     DCRemoveAxonTerminalCommand(const void *requester, DCCreator *creator, DCCell *axonCell, DCAxonTerminal *terminal);
85     DCRemoveAxonTerminalCommand(const void *requester, DCCreator *creator, DCCell *receptorCell, const QString& receptorName);
86     virtual ~DCRemoveAxonTerminalCommand() {}
87     void undo();
88     void redo();
89 };
90
91 //------------------------------------------
92
93 class DCStartCellCodeEditCommand : public DCCommand
94 {
95     DCCell          *d_cell;
96 public:
97     DCStartCellCodeEditCommand(const void *requester, DCCreator *creator, DCCell *ownerCell);
98     virtual ~DCStartCellCodeEditCommand() {}
99     void undo();
100     void redo();
101 };
102
103 //------------------------------------------
104
105 class DCFinishCellCodeEditCommand : public DCCommand
106 {
107 public:
108     DCFinishCellCodeEditCommand(const void *requester, DCCreator *creator);
109     virtual ~DCFinishCellCodeEditCommand() {}
110     void undo();
111     void redo();
112 };
113
114 //------------------------------------------
115
116 class DCAssignCellCodeClassToCellCommand : public DCCommand
117 {
118     DCCell      *d_cell;
119     DCCellCode  *d_cellCode;
120     DCCellCode  *d_prevClass;
121 public:
122     DCAssignCellCodeClassToCellCommand(const void *requester, DCCreator *creator, DCCell *cell, DCCellCode *cellCode);
123     virtual ~DCAssignCellCodeClassToCellCommand() {}
124     void undo();
125     void redo();
126 };
127
128 //------------------------------------------
129
130 class DCUnassignCellCodeClassFromCellCommand : public DCCommand
131 {
132     DCCell      *d_cell;
133     DCCellCode  *d_prevClass;
134 public:
135     DCUnassignCellCodeClassFromCellCommand(const void *requester, DCCreator *creator, DCCell *cell);
136     virtual ~DCUnassignCellCodeClassFromCellCommand() {}
137     void undo();
138     void redo();
139 };
140
141 //------------------------------------------
142
143 class DCAddCellCodeClassCommand : public DCCommand
144 {
145     DCContainer *d_container;
146     QString     d_name;
147     QString     d_type;
148
149 public:
150     DCAddCellCodeClassCommand(const void *requester, DCCreator *creator, DCContainer *container, const QString& name, const QString &type);
151     virtual ~DCAddCellCodeClassCommand() {}
152     void undo();
153     void redo();
154 };
155
156 //------------------------------------------
157
158 class DCMoveCellCodeClassCommand : public DCCommand
159 {
160     QString     d_name;
161     QString     d_type;
162
163 public:
164     DCMoveCellCodeClassCommand(const void *requester, DCCreator *creator, const QString& name, const QString &type);
165     virtual ~DCMoveCellCodeClassCommand();
166     void undo();
167     void redo();
168 };
169
170 //------------------------------------------
171
172 class DCChangeCellCodeClassTypeCommand : public DCCommand
173 {
174     DCCellCode* d_cellCode;
175     QString     d_type;
176
177 public:
178     DCChangeCellCodeClassTypeCommand(const void *requester, DCCreator *creator, DCCellCode* cellCode, const QString& newType);
179     virtual ~DCChangeCellCodeClassTypeCommand() {}
180     void undo();
181     void redo();
182 };
183
184 //------------------------------------------
185
186 class DCRemoveCellCodeClassCommand : public DCCommand
187 {
188     DCContainer         *d_container;
189     QList<DCCellCode*>  d_cellCodes;
190     QString             d_type;
191
192 public:
193     DCRemoveCellCodeClassCommand(const void *requester, DCCreator *creator, DCContainer *container, DCCellCode* cellCode);
194     DCRemoveCellCodeClassCommand(const void *requester, DCCreator *creator, DCContainer *container, const QList<DCCellCode*> &cellcodes);
195     virtual ~DCRemoveCellCodeClassCommand();
196     void undo();
197     void redo();
198 };
199
200 //------------------------------------------
201
202 class DCAddCellCommand : public DCCommand
203 {
204     DCContainer *d_container;
205     QString     d_path;
206     QString     d_name;
207     QString     d_type;
208
209 public:
210     DCAddCellCommand(const void *requester, DCCreator *creator, DCContainer *container, const QString& path, const QString& name, const QString &type);
211     virtual ~DCAddCellCommand() {}
212     void undo();
213     void redo();
214 };
215
216 //------------------------------------------
217
218 class DCChangeCellTypeCommand : public DCCommand
219 {
220     DCCell      *d_cell;
221     QString     d_type;
222
223 public:
224     DCChangeCellTypeCommand(const void *requester, DCCreator *creator, DCCell *cell, const QString& newType);
225     virtual ~DCChangeCellTypeCommand() {}
226     void undo();
227     void redo();
228 };
229
230 //------------------------------------------
231
232 class DCRenameCellCommand : public DCCommand
233 {
234     DCCell      *d_cell;
235     QString     d_name;
236
237 public:
238     DCRenameCellCommand(const void *requester, DCCreator *creator, DCCell *cell, const QString& newName);
239     virtual ~DCRenameCellCommand();
240     void undo();
241     void redo();
242 };
243
244 //------------------------------------------
245
246 class DCMoveCellCommand : public DCCommand
247 {
248     DCCell      *d_cell;
249     DCVCPage    *d_page;
250
251 public:
252     DCMoveCellCommand(const void *requester, DCCreator *creator, DCCell *cell, DCVCPage *newPage);
253     virtual ~DCMoveCellCommand();
254     void undo();
255     void redo();
256 };
257
258 //------------------------------------------
259
260 class DCRemoveCellCommand : public DCCommand
261 {
262     DCContainer     *d_container;
263     QList<DCCell*>  d_cells;
264
265 public:
266     DCRemoveCellCommand(const void *requester, DCCreator *creator, DCContainer *container, DCCell *cell);
267     DCRemoveCellCommand(const void *requester, DCCreator *creator, DCContainer *container, const QList<DCCell*> &cells);
268     virtual ~DCRemoveCellCommand();
269     void undo();
270     void redo();
271 };
272
273 //------------------------------------------
274
275 class DCAddPageCommand : public DCCommand
276 {
277     QString     d_path;
278     DCVCPage    *d_page;
279 public:
280     DCAddPageCommand(const void *requester, DCCreator *creator, const QString& containerBasedPathName);
281     virtual ~DCAddPageCommand() {}
282     void undo();
283     void redo();
284 };
285
286 //------------------------------------------
287
288 class DCMovePageCommand : public DCCommand
289 {
290     QString     d_oldPath;
291     QString     d_newPath;
292
293 public:
294     DCMovePageCommand(const void *requester, DCCreator *creator, const QString& oldContainerBasedPathName, const QString& newContainerBasedPathName);
295     virtual ~DCMovePageCommand();
296     void undo();
297     void redo();
298 };
299
300 //------------------------------------------
301
302 class DCRemovePageCommand : public DCCommand
303 {
304     DCVCPage    *d_page;
305     QUndoStack  d_undoStack;
306
307 public:
308     DCRemovePageCommand(const void *requester, DCCreator *creator, DCVCPage *page);
309     virtual ~DCRemovePageCommand();
310     void undo();
311     void redo();
312 };
313
314 //------------------------------------------
315
316 class DCAddDirectoryCommand : public DCCommand
317 {
318     QString d_path;
319 public:
320     DCAddDirectoryCommand(const void *requester, DCCreator *creator, const QString& sysFilePath);
321     virtual ~DCAddDirectoryCommand() {}
322     void undo();
323     void redo();
324 };
325
326 //------------------------------------------
327
328 class DCRenameDirectoryCommand : public DCCommand
329 {
330     QString d_oldPath;
331     QString d_newPath;
332
333 public:
334     DCRenameDirectoryCommand(const void *requester, DCCreator *creator, const QString& sysOldDirPath, const QString& sysNewDirPath);
335     virtual ~DCRenameDirectoryCommand() {}
336     void undo();
337     void redo();
338
339     bool moveComponentsToDirectory(const QString& orgDirectory, const QString& destDirectory);
340 };
341
342 //------------------------------------------
343
344 class DCRemoveDirectoryCommand : public DCCommand
345 {
346     QString d_path;
347 public:
348     DCRemoveDirectoryCommand(const void *requester, DCCreator *creator, const QString& sysFilePath);
349     virtual ~DCRemoveDirectoryCommand() {}
350     void undo();
351     void redo();
352 };
353
354 //------------------------------------------
355
356 class DCRenameReceptorNameCommand : public DCCommand
357 {
358     DCCell* d_cell;
359     QString d_oldName;
360     QString d_newName;
361
362 public:
363     DCRenameReceptorNameCommand(const void *requester, DCCreator *creator, DCCell *cell, const QString& oldName, const QString& newName);
364     virtual ~DCRenameReceptorNameCommand() {}
365     void undo();
366     void redo();
367 };
368
369 #endif // DCEDITCOMMANDS_H