-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd.h
349 lines (339 loc) · 8.93 KB
/
cmd.h
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
// Copyright 2008 Daniel Anselmi
//
// This file is part of TimingEditor.
//
// TimingEditor is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// TimingEditor is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with TimingEditor. If not, see <http://www.gnu.org/licenses/>.
//
// Contact e-mail: daniel anselmi <[email protected]>
// Program URL : http://sourceforge.net/projects/timingeditor/
//
//
#ifndef __CMD__
#define __CMD__
#include <wx/docview.h>
#include <wx/cmdproc.h>
class TimingDocument;
class DeleteVLineCommand : public wxCommand
{
public:
DeleteVLineCommand(TimingDocument *doc, wxInt32 nmbr);
~DeleteVLineCommand();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt32 m_nmbr;
VLine m_vline;
std::vector<HArrow> m_harrows;
bool first;
};
class ChangeLength : public wxCommand
{
public:
ChangeLength(TimingDocument *doc, wxInt32 newLength);
~ChangeLength();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
bool m_shorten;
wxInt32 m_newLength;
std::vector< Signal > signals;
std::vector< TimeCompressor > compressors;
std::vector<DeleteVLineCommand*> delVlineCom;
};
class ChangeLengthLeft : public wxCommand
{
public:
ChangeLengthLeft(TimingDocument *doc, wxInt32 newLength);
~ChangeLengthLeft();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
bool m_shorten;
wxInt32 m_newLength;
std::vector< Signal > signals;
std::vector< TimeCompressor > compressors;
std::vector<DeleteVLineCommand*> delVlineCom;
};
class ChangeSignal : public wxCommand
{
public:
ChangeSignal(TimingDocument *doc, wxInt32 changingSigNr, Signal newSig);
~ChangeSignal();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt32 m_changingSigNr;
Signal m_newSig;
};
class DeleteSignalCommand : public wxCommand
{
public:
DeleteSignalCommand(TimingDocument *doc, wxInt32 deletedSigNr);
~DeleteSignalCommand();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt32 m_deletedSigNr;
Signal m_sig;
std::vector<VLine> vlines;
std::vector<HArrow> harrows;
std::vector<DeleteVLineCommand*> delVlineCom;
};
class ChangeClockParamCommand : public wxCommand
{
public:
ChangeClockParamCommand(TimingDocument *doc, wxInt32 changingSigNr, wxInt32 per, wxInt32 delay, bool shadow, bool DrawPeriod);
~ChangeClockParamCommand();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt32 m_changingSigNr;
wxInt32 m_newPer;
wxInt32 m_newDelay;
bool m_shadow;
bool m_DrawPeriod;
};
class MoveSignalPosCommand : public wxCommand
{
public:
MoveSignalPosCommand(TimingDocument *doc, wxInt32 selectedSigNr, wxInt32 targetPos);
~MoveSignalPosCommand();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt32 m_selectedSigNr;
wxInt32 m_targetPos;
std::vector<VLine> vlines;
std::vector<HArrow> harrows;
bool DoMove(void);
};
class AddSignalCommand : public wxCommand
{
public:
AddSignalCommand(TimingDocument *doc, wxInt32 selectedSigNr, Signal sig);
~AddSignalCommand();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt32 m_selectedSigNr;
Signal m_sig;
std::vector<VLine> vlines;
std::vector<HArrow> harrows;
};
class AddDiscontCommand : public wxCommand
{
public:
AddDiscontCommand(TimingDocument *doc, wxInt32 discont);
~AddDiscontCommand();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt32 m_discont;
};
class RemoveDiscontCommand : public wxCommand
{
public:
RemoveDiscontCommand(TimingDocument *doc, wxInt32 discont);
~RemoveDiscontCommand();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt32 m_pos;
TimeCompressor m_cmprssr;
};
class ChangeSpaceCommand : public wxCommand
{
public:
ChangeSpaceCommand(TimingDocument *doc, wxInt32 selectedSignal, wxInt32 newLength, bool upper);
~ChangeSpaceCommand();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt32 m_selectedSignal;
wxInt32 m_newLength;
bool m_upper;
std::vector<HArrow> harrows;
bool DoChangeSpace(void);
};
class AddVLineCommand : public wxCommand
{
public:
AddVLineCommand(TimingDocument *doc, VLine newline);
~AddVLineCommand();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
VLine m_newline;
};
class AddHArrowCommand : public wxCommand
{
public:
AddHArrowCommand(TimingDocument *doc, HArrow newha);
~AddHArrowCommand();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
HArrow m_newha;
};
class ChangeVLineCommand : public wxCommand
{
public:
ChangeVLineCommand(TimingDocument *doc, wxInt32 nmbr, wxInt32 newVpos, wxInt32 newUpper, wxInt32 newLower, wxInt32 newVposoffset);
~ChangeVLineCommand();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt32 m_nmbr;
wxInt32 m_newVpos;
wxInt32 m_newUpper;
wxInt32 m_newLower;
wxInt32 m_newVposoff;
};
class ChangeHArrowCommand : public wxCommand
{
public:
ChangeHArrowCommand(TimingDocument *doc, wxInt32 nmbr, wxInt32 pos, wxInt32 sigindex, wxInt32 newLeft, wxInt32 newRight);
~ChangeHArrowCommand();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt32 m_nmbr;
wxInt32 m_newPos;
wxInt32 m_newLeft;
wxInt32 m_newRight;
wxInt32 m_newPosIndex;
};
class DeleteHArrowCommand : public wxCommand
{
public:
DeleteHArrowCommand(TimingDocument *doc, wxInt32 nmbr);
~DeleteHArrowCommand();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt32 m_nmbr;
HArrow m_harrow;
};
class ChangeHArrowTextPosCommand : public wxCommand
{
public:
ChangeHArrowTextPosCommand(TimingDocument *doc, wxInt32 editingNumber, wxInt32 xoff, wxInt32 yoff, wxInt32 gridoff);
~ChangeHArrowTextPosCommand();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt32 m_nmbr;
wxPoint m_off;
wxInt32 m_gridoff;
};
class ChangeTextCommand : public wxCommand
{
public:
ChangeTextCommand(TimingDocument *doc, wxInt32 number, wxString text);
~ChangeTextCommand();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt32 m_nmbr;
wxString m_newText;
};
class ChangeTransitionWidth : public wxCommand
{
public:
ChangeTransitionWidth(TimingDocument *doc, wxInt8 width, bool en50, bool en90);
~ChangeTransitionWidth();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt8 m_width;
bool m_en50;
bool m_en90;
};
class ChangeAxisSettings : public wxCommand
{
public:
ChangeAxisSettings(TimingDocument *doc, wxInt8 unit, wxInt32 ticklenth, wxInt32 markerlength, wxInt32 offset, wxInt32 totallength);
~ChangeAxisSettings();
bool Do(void);
bool Undo(void);
private:
void Change();
protected:
TimingDocument *m_doc;
wxInt8 m_unit;
wxInt32 m_ticklength;
wxInt32 m_markerlength;
wxInt32 m_offset;
wxCommand *AddRemoveTimeCommand;
};
class ChangeTimeCompressor : public wxCommand
{
public:
ChangeTimeCompressor(TimingDocument *doc, wxInt32 index, wxInt32 time, bool en);
~ChangeTimeCompressor();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt32 m_time;
wxInt32 m_index;
bool m_en;
};
class AddTimeCommand : public wxCommand
{
public:
AddTimeCommand(TimingDocument *doc, wxInt32 pos, wxInt32 len);
~AddTimeCommand();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt32 m_pos;
wxInt32 m_len;
};
class RemoveTimeCommand : public wxCommand
{
public:
RemoveTimeCommand(TimingDocument *doc, wxInt32 beg, wxInt32 end);
~RemoveTimeCommand();
bool Do(void);
bool Undo(void);
protected:
TimingDocument *m_doc;
wxInt32 m_beg;
wxInt32 m_end;
std::vector<Signal> m_signals;
std::vector<TimeCompressor> m_compressors;
std::vector<DeleteVLineCommand*> delVlineCom;
};
#endif //__CMD__