-
Notifications
You must be signed in to change notification settings - Fork 852
/
Copy pathcommands.h
1206 lines (953 loc) · 26.8 KB
/
commands.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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*******************************************************************
Part of the Fritzing project - http://fritzing.org
Copyright (c) 2007-2019 Fritzing
Fritzing 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.
Fritzing 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 Fritzing. If not, see <http://www.gnu.org/licenses/>.
********************************************************************/
#ifndef COMMANDS_H
#define COMMANDS_H
#include <QUndoCommand>
#include <QHash>
#include <QPainterPath>
#include "viewgeometry.h"
#include "viewlayer.h"
#include "routingstatus.h"
#include "utils/misc.h"
#include "items/itembase.h"
#include "mainwindow/mainwindow.h"
/////////////////////////////////////////////
class CommandProgress : public QObject {
Q_OBJECT
public:
CommandProgress() = default;
void setActive(bool);
constexpr bool active() const noexcept { return m_active; }
void emitUndo();
void emitRedo();
Q_SIGNALS:
void incUndo();
void incRedo();
protected:
bool m_active = false;
};
/////////////////////////////////////////////
class SketchWidget;
class BaseCommand : public QUndoCommand
{
public:
enum CrossViewType {
SingleView,
CrossView
};
public:
BaseCommand(BaseCommand::CrossViewType, SketchWidget*, QUndoCommand* parent);
~BaseCommand();
BaseCommand::CrossViewType crossViewType() const noexcept;
void setCrossViewType(BaseCommand::CrossViewType);
SketchWidget* sketchWidget() const;
int subCommandCount() const;
const BaseCommand * subCommand(int index) const;
virtual QString getDebugString() const;
const QUndoCommand * parentCommand() const;
void addSubCommand(BaseCommand * subCommand);
void subUndo();
void subRedo();
void subUndo(int index);
void subRedo(int index);
int index() const;
void setUndoOnly();
void setRedoOnly();
void setSkipFirstRedo();
void undo();
void redo();
static int totalChildCount(const QUndoCommand *);
static CommandProgress * initProgress();
static void clearProgress();
protected:
virtual QString getParamString() const;
static int nextIndex;
protected:
BaseCommand::CrossViewType m_crossViewType;
SketchWidget *m_sketchWidget = nullptr;
QList<BaseCommand *> m_commands;
QUndoCommand * m_parentCommand = nullptr;
int m_index = 0;
bool m_undoOnly = false;
bool m_redoOnly = false;
bool m_skipFirstRedo = false;
static CommandProgress m_commandProgress;
};
/////////////////////////////////////////////
class SimulationCommand : public BaseCommand
{
public:
SimulationCommand(BaseCommand::CrossViewType, SketchWidget * sketchWidget, QUndoCommand *parent);
void undo();
void redo();
private:
MainWindow* m_mainWindow;
};
/////////////////////////////////////////////
class AddDeleteItemCommand : public SimulationCommand
{
public:
AddDeleteItemCommand(SketchWidget * sketchWidget, BaseCommand::CrossViewType, QString moduleID, ViewLayer::ViewLayerPlacement, ViewGeometry &, qint64 id, long modelIndex, QHash<QString, QString> * localConnectors, QUndoCommand *parent);
~AddDeleteItemCommand();
long itemID() const;
void setDropOrigin(SketchWidget *);
SketchWidget * dropOrigin();
protected:
QString getParamString() const;
protected:
QString m_moduleID;
long m_itemID;
ViewGeometry m_viewGeometry;
long m_modelIndex;
SketchWidget * m_dropOrigin;
ViewLayer::ViewLayerPlacement m_viewLayerPlacement;
QHash<QString, QString> * m_localConnectors;
};
/////////////////////////////////////////////
class AddItemCommand : public AddDeleteItemCommand
{
public:
AddItemCommand(class SketchWidget *sketchWidget, BaseCommand::CrossViewType, QString moduleID, ViewLayer::ViewLayerPlacement, ViewGeometry &, qint64 id, bool updateInfoView, long modelIndex, QUndoCommand *parent);
void undo();
void redo();
void addRestoreIndexesCommand(class RestoreIndexesCommand *);
protected:
QString getParamString() const;
protected:
bool m_updateInfoView = false;
bool m_module = false;
RestoreIndexesCommand * m_restoreIndexesCommand = nullptr;
};
/////////////////////////////////////////////
class DeleteItemCommand : public AddDeleteItemCommand
{
public:
DeleteItemCommand(SketchWidget *sketchWidget, BaseCommand::CrossViewType, QString moduleID, ViewLayer::ViewLayerPlacement, ViewGeometry &, qint64 id, long modelIndex, QHash<QString, QString>* localConnectors, QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
};
/////////////////////////////////////////////
class MoveItemCommand : public SimulationCommand
{
public:
MoveItemCommand(SketchWidget *sketchWidget, long id, ViewGeometry & oldG, ViewGeometry & newG, bool updateRatsnest, QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
bool m_updateRatsnest = false;
long m_itemID = 0;
ViewGeometry m_old;
ViewGeometry m_new;
};
/////////////////////////////////////////////
class SimpleMoveItemCommand : public SimulationCommand
{
public:
SimpleMoveItemCommand(SketchWidget *sketchWidget, long id, QPointF & oldP, QPointF & newP, QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_itemID = 0;
QPointF m_old;
QPointF m_new;
};
/////////////////////////////////////////////
struct MoveItemThing {
long id = 0;
QPointF oldPos;
QPointF newPos;
};
class MoveItemsCommand : public SimulationCommand
{
public:
MoveItemsCommand(SketchWidget *sketchWidget, bool updateRatsnest, QUndoCommand *parent);
void undo();
void redo();
void addItem(long id, const QPointF & oldPos, const QPointF & newPos);
void addWire(long id, const QString & connectorID);
protected:
QString getParamString() const;
protected:
bool m_updateRatsnest;
QHash<long, QString> m_wires;
QList<MoveItemThing> m_items;
};
/////////////////////////////////////////////
class RotateItemCommand : public SimulationCommand
{
public:
RotateItemCommand(SketchWidget *sketchWidget, long id, double degrees, QUndoCommand *parent);
void undo();
void redo();
protected:
virtual QString getParamString() const;
protected:
long m_itemID;
double m_degrees;
};
/////////////////////////////////////////////
class FlipItemCommand : public BaseCommand
{
public:
FlipItemCommand(SketchWidget *sketchWidget, long id, Qt::Orientations orientation, QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_itemID;
Qt::Orientations m_orientation;
};
/////////////////////////////////////////////
class QTransform;
class TransformItemCommand : public SimulationCommand
{
public:
TransformItemCommand(SketchWidget *sketchWidget, long id, const QTransform & oldMatrix, const class QTransform & newMatrix, QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_itemID;
QTransform m_oldMatrix;
QTransform m_newMatrix;
};
/////////////////////////////////////////////
class ChangeConnectionCommand : public SimulationCommand
{
public:
ChangeConnectionCommand(class SketchWidget * sketchWidget, BaseCommand::CrossViewType,
long fromID, const QString & fromConnectorID,
long toID, const QString & toConnectorID,
ViewLayer::ViewLayerPlacement,
bool connect, QUndoCommand * parent);
void undo();
void redo();
void setUpdateConnections(bool updatem);
void disable();
protected:
QString getParamString() const;
protected:
long m_fromID;
long m_toID;
QString m_fromConnectorID;
QString m_toConnectorID;
bool m_connect;
bool m_updateConnections;
ViewLayer::ViewLayerPlacement m_viewLayerPlacement;
bool m_enabled;
};
/////////////////////////////////////////////
class ChangeWireCommand : public SimulationCommand
{
public:
ChangeWireCommand(class SketchWidget *sketchWidget, long fromID,
const QLineF & oldLine, const QLineF & newLine, QPointF oldPos, QPointF newPos,
bool updateConnections, bool updateRatsnest,
QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
bool m_updateRatsnest;
long m_fromID;
QLineF m_newLine;
QLineF m_oldLine;
QPointF m_newPos;
QPointF m_oldPos;
bool m_updateConnections;
};
/////////////////////////////////////////////
class ChangeWireCurveCommand : public SimulationCommand
{
public:
ChangeWireCurveCommand(class SketchWidget *sketchWidget, long fromID,
const class Bezier * oldBezier, const class Bezier * newBezier, bool wasAutoroutable,
QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_fromID;
class Bezier * m_newBezier;
class Bezier * m_oldBezier;
bool m_wasAutoroutable;
};
/////////////////////////////////////////////
class ChangeLegCommand : public SimulationCommand
{
public:
ChangeLegCommand(class SketchWidget *sketchWidget, long fromID, const QString & fromConnectorID,
const QPolygonF & oldLeg, const QPolygonF & newLeg, bool relative, bool active, const QString & why, QUndoCommand *parent);
void undo();
void redo();
void setSimple();
protected:
QString getParamString() const;
protected:
QString m_fromConnectorID;
long m_fromID;
QPolygonF m_newLeg;
QPolygonF m_oldLeg;
bool m_relative;
bool m_active;
bool m_simple;
QString m_why;
};
/////////////////////////////////////////////
class MoveLegBendpointCommand : public SimulationCommand
{
public:
MoveLegBendpointCommand(class SketchWidget *sketchWidget, long fromID, const QString & fromConnectorID,
int index, QPointF oldPos, QPointF newPos, QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
QString m_fromConnectorID;
long m_fromID;
QPointF m_newPos;
QPointF m_oldPos;
};
/////////////////////////////////////////////
class ChangeLegCurveCommand : public SimulationCommand
{
public:
ChangeLegCurveCommand(class SketchWidget *sketchWidget, long fromID, const QString & fromConnectorID, int index,
const class Bezier * oldBezier, const class Bezier * newBezier,
QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_fromID;
class Bezier * m_newBezier;
class Bezier * m_oldBezier;
QString m_fromConnectorID;
int m_index;
};
/////////////////////////////////////////////
class ChangeLegBendpointCommand : public BaseCommand
{
public:
ChangeLegBendpointCommand(class SketchWidget *sketchWidget, long fromID, const QString & fromConnectorID,
int oldCount, int newCount, int index, QPointF pos,
const class Bezier *, const class Bezier *, const class Bezier *, QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_fromID;
class Bezier * m_bezier0;
class Bezier * m_bezier1;
class Bezier * m_bezier2;
QString m_fromConnectorID;
int m_index;
int m_oldCount;
int m_newCount;
QPointF m_pos;
};
/////////////////////////////////////////////
class RotateLegCommand : public SimulationCommand
{
public:
RotateLegCommand(class SketchWidget *sketchWidget, long fromID, const QString & fromConnectorID,
const QPolygonF & oldLeg, bool active, QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
QString m_fromConnectorID;
long m_fromID;
QPolygonF m_oldLeg;
bool m_active;
};
/////////////////////////////////////////////
class ChangeLayerCommand : public BaseCommand
{
public:
ChangeLayerCommand(class SketchWidget *sketchWidget, long fromID,
double oldZ, double newZ,
ViewLayer::ViewLayerID oldLayer, ViewLayer::ViewLayerID newLayer,
QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_fromID;
double m_newZ;
double m_oldZ;
ViewLayer::ViewLayerID m_newLayer;
ViewLayer::ViewLayerID m_oldLayer;
};
/////////////////////////////////////////////
class SelectItemCommand : public BaseCommand
{
public:
enum SelectItemType {
NormalSelect,
NormalDeselect,
SelectAll,
DeselectAll
};
public:
SelectItemCommand(class SketchWidget *sketchWidget, SelectItemType type, QUndoCommand *parent);
void undo();
void redo();
void addUndo(long id);
void addRedo(long id);
void clearRedo();
int id() const;
bool mergeWith(const QUndoCommand *other);
void copyUndo(SelectItemCommand * sother);
void copyRedo(SelectItemCommand * sother);
void setSelectItemType(SelectItemType);
bool updated();
void setUpdated(bool);
protected:
void selectAllFromStack(QList<long> & stack, bool select, bool updateInfoView);
QString getParamString() const;
protected:
QList<long> m_undoIDs;
QList<long> m_redoIDs;
SelectItemType m_type;
bool m_updated;
protected:
static int selectItemCommandID;
};
/////////////////////////////////////////////
class ChangeZCommand : public BaseCommand
{
public:
ChangeZCommand(class SketchWidget *sketchWidget, QUndoCommand *parent);
~ChangeZCommand();
void addTriplet(long id, double oldZ, double newZ);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
static double first(RealPair *);
static double second(RealPair *);
protected:
QHash<long, RealPair *> m_triplets;
};
struct StickyThing {
SketchWidget * sketchWidget;
bool stickem;
long fromID;
long toID;
};
/////////////////////////////////////////////
class SketchWidget;
class CheckStickyCommand : public BaseCommand
{
public:
enum CheckType {
UndoOnly = 0,
RedoOnly,
RemoveOnly
};
public:
CheckStickyCommand(SketchWidget *sketchWidget, BaseCommand::CrossViewType, long itemID, bool checkCurrent, CheckType, QUndoCommand *parent);
~CheckStickyCommand();
void undo();
void redo();
void stick(SketchWidget *, long fromID, long toID, bool stickem);
protected:
QString getParamString() const;
protected:
long m_itemID = 0;
QList<StickyThing *> m_stickyList;
bool m_checkCurrent = false;
CheckType m_checkType;
};
/////////////////////////////////////////////
class WireColorChangeCommand : public BaseCommand
{
public:
WireColorChangeCommand(
SketchWidget* sketchWidget,
long wireId, const QString &oldColor, const QString &newColor,
double oldOpacity, double newOpacity,
QUndoCommand *parent=0);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_wireId;
QString m_oldColor;
QString m_newColor;
double m_oldOpacity;
double m_newOpacity;
};
/////////////////////////////////////////////
class WireWidthChangeCommand : public BaseCommand
{
public:
WireWidthChangeCommand(
SketchWidget* sketchWidget,
long wireId, double oldWidth, double newWidth,
QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_wireId;
double m_oldWidth;
double m_newWidth;
};
/////////////////////////////////////////////
class RoutingStatusCommand : public BaseCommand
{
public:
RoutingStatusCommand(class SketchWidget *, const RoutingStatus & oldRoutingStatus, const RoutingStatus & newRoutingStatus, QUndoCommand * parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
RoutingStatus m_oldRoutingStatus;
RoutingStatus m_newRoutingStatus;
};
/////////////////////////////////////////////
struct RatsnestConnectThing
{
long id;
QString connectorID;
bool connect;
};
class CleanUpWiresCommand : public SimulationCommand
{
public:
enum Direction {
UndoOnly = 0,
RedoOnly,
Noop
};
public:
CleanUpWiresCommand(class SketchWidget * sketchWidget, CleanUpWiresCommand::Direction, QUndoCommand * parent);
void undo();
void redo();
void addRoutingStatus(SketchWidget *, const RoutingStatus & oldRoutingStatus, const RoutingStatus & newRoutingStatus);
void setDirection(CleanUpWiresCommand::Direction);
void addTrace(SketchWidget * sketchWidget, Wire * wire);
bool hasTraces(SketchWidget *);
void addRatsnestConnect(long id, const QString & connectorID, bool connect);
CleanUpWiresCommand::Direction direction();
protected:
QString getParamString() const;
protected:
QSet<SketchWidget *> m_sketchWidgets;
QList<RatsnestConnectThing> m_ratsnestConnectThings;
CleanUpWiresCommand::Direction m_direction;
};
/////////////////////////////////////////////
class CleanUpRatsnestsCommand : public SimulationCommand
{
public:
CleanUpRatsnestsCommand(class SketchWidget * sketchWidget, CleanUpWiresCommand::Direction, QUndoCommand * parent);
void undo();
void redo();
protected:
QString getParamString() const;
};
/////////////////////////////////////////////
class RestoreLabelCommand : public BaseCommand
{
public:
RestoreLabelCommand(class SketchWidget *sketchWidget, long id, QDomElement & oldLabelGeometry, QDomElement & newLabelGeometry, QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_itemID;
QDomElement m_oldLabelGeometry;
QDomElement m_newLabelGeometry;
};
/////////////////////////////////////////////
class CheckPartLabelLayerVisibilityCommand : public BaseCommand
{
public:
CheckPartLabelLayerVisibilityCommand(class SketchWidget *sketchWidget, long id, QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_itemID;
};
/////////////////////////////////////////////
class ShowLabelFirstTimeCommand : public BaseCommand
{
public:
ShowLabelFirstTimeCommand(class SketchWidget *sketchWidget, CrossViewType crossView, long id, bool oldVis, bool newVis, QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_itemID;
bool m_oldVis;
bool m_newVis;
};
/////////////////////////////////////////////
class MoveLabelCommand : public BaseCommand
{
public:
MoveLabelCommand(class SketchWidget *sketchWidget, long id, QPointF oldPos, QPointF oldOffset, QPointF newPos, QPointF newOffset, QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_itemID;
QPointF m_oldPos;
QPointF m_newPos;
QPointF m_oldOffset;
QPointF m_newOffset;
};
/////////////////////////////////////////////
class MoveLockCommand : public BaseCommand
{
public:
MoveLockCommand(class SketchWidget *sketchWidget, long id, bool oldLock, bool newLock, QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_itemID;
bool m_oldLock;
bool m_newLock;
};
/////////////////////////////////////////////
class IncLabelTextCommand : public BaseCommand
{
public:
IncLabelTextCommand(class SketchWidget *sketchWidget, long id, QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_itemID;
};
/////////////////////////////////////////////
class ChangeLabelTextCommand : public BaseCommand
{
public:
ChangeLabelTextCommand(class SketchWidget *sketchWidget, long id, const QString & oldText, const QString & newText, QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_itemID;
QString m_oldText;
QString m_newText;
};
/////////////////////////////////////////////
class ChangeNoteTextCommand : public BaseCommand
{
public:
ChangeNoteTextCommand(class SketchWidget *sketchWidget, long id, const QString & oldText, const QString & newText, QSizeF oldSize, QSizeF newSize, QUndoCommand *parent);
void undo();
void redo();
int id() const;
bool mergeWith(const QUndoCommand *other);
protected:
QString getParamString() const;
protected:
long m_itemID;
QString m_oldText;
QString m_newText;
QSizeF m_oldSize;
QSizeF m_newSize;
static int changeNoteTextCommandID;
};
/////////////////////////////////////////////
class RotateFlipLabelCommand : public BaseCommand
{
public:
RotateFlipLabelCommand(class SketchWidget *sketchWidget, long id, double degrees, Qt::Orientations, QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_itemID;
double m_degrees;
Qt::Orientations m_orientation;
};
/////////////////////////////////////////////
class ResizeNoteCommand : public BaseCommand
{
public:
ResizeNoteCommand(class SketchWidget *sketchWidget, long id, const QSizeF & oldSize, const QSizeF & newSize, QUndoCommand *parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
long m_itemID;
QSizeF m_oldSize;
QSizeF m_newSize;
};
/////////////////////////////////////////////
class ResizeBoardCommand : public BaseCommand
{
public:
ResizeBoardCommand(class SketchWidget *, long itemID, double oldWidth, double oldHeight, double newWidth, double newHeight, QUndoCommand * parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
double m_oldWidth;
double m_oldHeight;
double m_newWidth;
double m_newHeight;
long m_itemID;
};
/////////////////////////////////////////////
class SetResistanceCommand : public SimulationCommand
{
public:
SetResistanceCommand(class SketchWidget *, long itemID, QString oldResistance, QString newResistance, QString oldPinSpacing, QString newPinSpacing, QUndoCommand * parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
QString m_oldResistance;
QString m_newResistance;
QString m_oldPinSpacing;
QString m_newPinSpacing;
long m_itemID;
};
/////////////////////////////////////////////
class SetPropCommand : public SimulationCommand
{
public:
SetPropCommand(class SketchWidget *, long itemID, QString prop, QString oldValue, QString newValue, bool redraw, QUndoCommand * parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
bool m_redraw;
QString m_prop;
QString m_oldValue;
QString m_newValue;
long m_itemID;
};
/////////////////////////////////////////////
class ResizeJumperItemCommand : public BaseCommand
{
public:
ResizeJumperItemCommand(class SketchWidget *, long itemID, QPointF oldPos, QPointF oldC0, QPointF oldC1, QPointF newPos, QPointF newC0, QPointF newC1, QUndoCommand * parent);
void undo();
void redo();
protected:
QString getParamString() const;
protected:
QPointF m_oldPos;
QPointF m_oldC0;
QPointF m_oldC1;
QPointF m_newPos;
QPointF m_newC0;
QPointF m_newC1;
long m_itemID;
};
/////////////////////////////////////////////
class ShowLabelCommand : public BaseCommand
{
public:
ShowLabelCommand(class SketchWidget *sketchWidget, QUndoCommand *parent);