history.h

Mon, 15 Apr 2013 02:56:42 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Mon, 15 Apr 2013 02:56:42 +0300
changeset 107
195aa036da7f
parent 104
6e29bb0e83c5
child 117
7eb7a43a511b
permissions
-rw-r--r--

Picking improvements

85
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 102
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
85
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #ifndef HISTORY_H
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #define HISTORY_H
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include "common.h"
93
92682e6369e9 Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
23 #include "ldtypes.h"
85
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 #define IMPLEMENT_HISTORY_TYPE(N) \
90
03f718ed5b33 Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 89
diff changeset
26 virtual ~N##History (); \
03f718ed5b33 Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 89
diff changeset
27 virtual void undo (); \
96
2f175b3d8211 Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 93
diff changeset
28 virtual void redo (); \
2f175b3d8211 Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 93
diff changeset
29 virtual HistoryType type () { return HISTORY_##N; }
85
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30
96
2f175b3d8211 Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 93
diff changeset
31 // =============================================================================
2f175b3d8211 Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 93
diff changeset
32 enum HistoryType {
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
33 HISTORY_Del,
96
2f175b3d8211 Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 93
diff changeset
34 HISTORY_SetColor,
2f175b3d8211 Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 93
diff changeset
35 HISTORY_SetContents,
2f175b3d8211 Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 93
diff changeset
36 HISTORY_ListMove,
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
37 HISTORY_Add,
96
2f175b3d8211 Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 93
diff changeset
38 HISTORY_QuadSplit,
98
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
39 HISTORY_Inline,
102
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
40 HISTORY_Move,
96
2f175b3d8211 Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 93
diff changeset
41 };
85
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42
89
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
43 // =============================================================================
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
45 // =============================================================================
85
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 class HistoryEntry {
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 public:
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 virtual void undo () {}
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49 virtual void redo () {}
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 virtual ~HistoryEntry () {}
96
2f175b3d8211 Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 93
diff changeset
51 virtual HistoryType type () { return (HistoryType)(0); }
85
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52 };
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53
89
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
54 // =============================================================================
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
56 // =============================================================================
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
57 class DelHistory : public HistoryEntry {
85
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 public:
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
59 enum Type {
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
60 Cut, // were deleted with a cut operation
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
61 Other, // were deleted witout specific reason
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
62 };
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
63
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
64 IMPLEMENT_HISTORY_TYPE (Del)
85
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
65
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66 vector<ulong> indices;
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 vector<LDObject*> cache;
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
68 const Type eType;
85
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
70 DelHistory (vector<ulong> indices, vector<LDObject*> cache, const Type eType = Other) :
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
71 indices (indices), cache (cache), eType (eType) {}
85
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
72 };
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73
89
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
74 // =============================================================================
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
75 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
76 // =============================================================================
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
77 class SetColorHistory : public HistoryEntry {
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
78 public:
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
79 IMPLEMENT_HISTORY_TYPE (SetColor)
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
80
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
81 vector<ulong> ulaIndices;
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
82 vector<short> daColors;
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
83 short dNewColor;
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
84
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
85 SetColorHistory (vector<ulong> ulaIndices, vector<short> daColors, short dNewColor) :
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
86 ulaIndices (ulaIndices), daColors (daColors), dNewColor (dNewColor) {}
90
03f718ed5b33 Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 89
diff changeset
87 };
03f718ed5b33 Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 89
diff changeset
88
91
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
89 // =============================================================================
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
90 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
91 // =============================================================================
90
03f718ed5b33 Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 89
diff changeset
92 class SetContentsHistory : public HistoryEntry {
03f718ed5b33 Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 89
diff changeset
93 public:
03f718ed5b33 Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 89
diff changeset
94 IMPLEMENT_HISTORY_TYPE (SetContents)
03f718ed5b33 Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 89
diff changeset
95
03f718ed5b33 Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 89
diff changeset
96 ulong ulIndex;
03f718ed5b33 Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 89
diff changeset
97 LDObject* oldObj, *newObj;
03f718ed5b33 Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 89
diff changeset
98
03f718ed5b33 Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 89
diff changeset
99 SetContentsHistory (ulong ulIndex, LDObject* oldObj, LDObject* newObj) :
03f718ed5b33 Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 89
diff changeset
100 ulIndex (ulIndex), oldObj (oldObj), newObj (newObj) {}
89
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
101 };
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
102
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
103 // =============================================================================
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
5e6c08e98dbf Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
105 // =============================================================================
91
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
106 class ListMoveHistory : public HistoryEntry {
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
107 public:
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
108 IMPLEMENT_HISTORY_TYPE (ListMove)
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
109
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
110 std::vector<ulong> ulaIndices;
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
111 bool bUp;
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
112
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
113 std::vector<LDObject*> getObjects (short ofs);
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
114 ListMoveHistory (vector<ulong> ulaIndices, const bool bUp) :
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
115 ulaIndices (ulaIndices), bUp (bUp) {}
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
116 };
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
117
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
118 // =============================================================================
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
b4dda6348e7e History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 90
diff changeset
120 // =============================================================================
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
121 class AddHistory : public HistoryEntry {
92
586d294ca83f Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 91
diff changeset
122 public:
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
123 enum Type {
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
124 Other, // was "just added"
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
125 Paste, // was added through a paste operation
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
126 };
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
127
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
128 IMPLEMENT_HISTORY_TYPE (Add)
92
586d294ca83f Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 91
diff changeset
129
586d294ca83f Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 91
diff changeset
130 std::vector<ulong> ulaIndices;
586d294ca83f Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 91
diff changeset
131 std::vector<LDObject*> paObjs;
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
132 const Type eType;
92
586d294ca83f Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 91
diff changeset
133
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
134 AddHistory (std::vector<ulong> ulaIndices, std::vector<LDObject*> paObjs,
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
135 const Type eType = Other) :
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
136 ulaIndices (ulaIndices), paObjs (paObjs), eType (eType) {}
92
586d294ca83f Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 91
diff changeset
137 };
586d294ca83f Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 91
diff changeset
138
586d294ca83f Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 91
diff changeset
139 // =============================================================================
586d294ca83f Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 91
diff changeset
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
586d294ca83f Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 91
diff changeset
141 // =============================================================================
93
92682e6369e9 Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
142 class QuadSplitHistory : public HistoryEntry {
92682e6369e9 Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
143 public:
92682e6369e9 Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
144 IMPLEMENT_HISTORY_TYPE (QuadSplit)
92682e6369e9 Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
145
92682e6369e9 Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
146 std::vector<ulong> ulaIndices;
92682e6369e9 Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
147 std::vector<LDQuad*> paQuads;
92682e6369e9 Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
148
92682e6369e9 Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
149 QuadSplitHistory (std::vector<ulong> ulaIndices, std::vector<LDQuad*> paQuads) :
92682e6369e9 Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
150 ulaIndices (ulaIndices), paQuads (paQuads) {}
92682e6369e9 Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
151 };
92682e6369e9 Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
152
92682e6369e9 Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
153 // =============================================================================
92682e6369e9 Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
92682e6369e9 Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
155 // =============================================================================
98
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
156 class InlineHistory : public HistoryEntry {
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
157 public:
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
158 IMPLEMENT_HISTORY_TYPE (Inline)
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
159
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
160 const std::vector<ulong> ulaBitIndices, ulaRefIndices;
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
161 const std::vector<LDSubfile*> paRefs;
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
162 const bool bDeep;
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
163
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
164 InlineHistory (const std::vector<ulong> ulaBitIndices, const std::vector<ulong> ulaRefIndices,
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
165 const std::vector<LDSubfile*> paRefs, const bool bDeep) :
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
166 ulaBitIndices (ulaBitIndices), ulaRefIndices (ulaRefIndices), paRefs (paRefs), bDeep (bDeep) {}
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
167 };
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
168
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
169 // =============================================================================
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
171 // =============================================================================
102
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
172 class MoveHistory : public HistoryEntry {
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
173 public:
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
174 IMPLEMENT_HISTORY_TYPE (Move)
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
175
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
176 const std::vector<ulong> ulaIndices;
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
177 const vertex vVector;
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
178
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
179 MoveHistory (const std::vector<ulong> ulaIndices, const vertex vVector) :
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
180 ulaIndices (ulaIndices), vVector (vVector) {}
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
181 };
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
182
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
183 // =============================================================================
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
185 // =============================================================================
85
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
186 namespace History {
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
187 extern std::vector<HistoryEntry*> entries;
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
188
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
189 void addEntry (HistoryEntry* entry);
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
190 void undo ();
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
191 void redo ();
96
2f175b3d8211 Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 93
diff changeset
192 void clear ();
92
586d294ca83f Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 91
diff changeset
193 void updateActions ();
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
194 long pos ();
85
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
195 };
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
196
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
197 #endif // HISTORY_H

mercurial