src/history.h

changeset 251
c4b96bc41298
parent 192
c414924a647c
child 265
955c0aabfebf
equal deleted inserted replaced
250:6e80f038e8df 251:c4b96bc41298
92 // ============================================================================= 92 // =============================================================================
93 class EditHistory : public HistoryEntry { 93 class EditHistory : public HistoryEntry {
94 public: 94 public:
95 IMPLEMENT_HISTORY_TYPE (Edit) 95 IMPLEMENT_HISTORY_TYPE (Edit)
96 96
97 std::vector<ulong> ulaIndices; 97 vector<ulong> ulaIndices;
98 std::vector<LDObject*> paOldObjs, paNewObjs; 98 vector<LDObject*> paOldObjs, paNewObjs;
99 99
100 EditHistory () {} 100 EditHistory () {}
101 EditHistory (std::vector<ulong> ulaIndices, std::vector<LDObject*> paOldObjs, 101 EditHistory (vector<ulong> ulaIndices, vector<LDObject*> paOldObjs,
102 std::vector<LDObject*> paNewObjs) : 102 vector<LDObject*> paNewObjs) :
103 ulaIndices (ulaIndices), paOldObjs (paOldObjs), paNewObjs (paNewObjs) {} 103 ulaIndices (ulaIndices), paOldObjs (paOldObjs), paNewObjs (paNewObjs) {}
104 104
105 void addEntry (LDObject* const oldObj, LDObject* const newObj); 105 void addEntry (LDObject* const oldObj, LDObject* const newObj);
106 void addEntry (LDObject* const oldObj, LDObject* const newObj, const ulong idx); 106 void addEntry (LDObject* const oldObj, LDObject* const newObj, const ulong idx);
107 ulong numEntries () const { return ulaIndices.size (); } 107 ulong numEntries () const { return ulaIndices.size (); }
112 // ============================================================================= 112 // =============================================================================
113 class ListMoveHistory : public HistoryEntry { 113 class ListMoveHistory : public HistoryEntry {
114 public: 114 public:
115 IMPLEMENT_HISTORY_TYPE (ListMove) 115 IMPLEMENT_HISTORY_TYPE (ListMove)
116 116
117 std::vector<ulong> ulaIndices; 117 vector<ulong> ulaIndices;
118 bool bUp; 118 bool bUp;
119 119
120 std::vector<LDObject*> getObjects (short ofs); 120 vector<LDObject*> getObjects (short ofs);
121 ListMoveHistory (vector<ulong> ulaIndices, const bool bUp) : 121 ListMoveHistory (vector<ulong> ulaIndices, const bool bUp) :
122 ulaIndices (ulaIndices), bUp (bUp) {} 122 ulaIndices (ulaIndices), bUp (bUp) {}
123 }; 123 };
124 124
125 // ============================================================================= 125 // =============================================================================
132 Paste, // was added through a paste operation 132 Paste, // was added through a paste operation
133 }; 133 };
134 134
135 IMPLEMENT_HISTORY_TYPE (Add) 135 IMPLEMENT_HISTORY_TYPE (Add)
136 136
137 std::vector<ulong> ulaIndices; 137 vector<ulong> ulaIndices;
138 std::vector<LDObject*> paObjs; 138 vector<LDObject*> paObjs;
139 const Type eType; 139 const Type eType;
140 140
141 AddHistory (std::vector<ulong> ulaIndices, std::vector<LDObject*> paObjs, 141 AddHistory (vector<ulong> ulaIndices, vector<LDObject*> paObjs,
142 const Type eType = Other) : 142 const Type eType = Other) :
143 ulaIndices (ulaIndices), paObjs (paObjs), eType (eType) {} 143 ulaIndices (ulaIndices), paObjs (paObjs), eType (eType) {}
144 }; 144 };
145 145
146 // ============================================================================= 146 // =============================================================================
148 // ============================================================================= 148 // =============================================================================
149 class QuadSplitHistory : public HistoryEntry { 149 class QuadSplitHistory : public HistoryEntry {
150 public: 150 public:
151 IMPLEMENT_HISTORY_TYPE (QuadSplit) 151 IMPLEMENT_HISTORY_TYPE (QuadSplit)
152 152
153 std::vector<ulong> ulaIndices; 153 vector<ulong> ulaIndices;
154 std::vector<LDQuad*> paQuads; 154 vector<LDQuad*> paQuads;
155 155
156 QuadSplitHistory (std::vector<ulong> ulaIndices, std::vector<LDQuad*> paQuads) : 156 QuadSplitHistory (vector<ulong> ulaIndices, vector<LDQuad*> paQuads) :
157 ulaIndices (ulaIndices), paQuads (paQuads) {} 157 ulaIndices (ulaIndices), paQuads (paQuads) {}
158 }; 158 };
159 159
160 // ============================================================================= 160 // =============================================================================
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
162 // ============================================================================= 162 // =============================================================================
163 class InlineHistory : public HistoryEntry { 163 class InlineHistory : public HistoryEntry {
164 public: 164 public:
165 IMPLEMENT_HISTORY_TYPE (Inline) 165 IMPLEMENT_HISTORY_TYPE (Inline)
166 166
167 const std::vector<ulong> ulaBitIndices, ulaRefIndices; 167 const vector<ulong> ulaBitIndices, ulaRefIndices;
168 const std::vector<LDSubfile*> paRefs; 168 const vector<LDSubfile*> paRefs;
169 const bool bDeep; 169 const bool bDeep;
170 170
171 InlineHistory (const std::vector<ulong> ulaBitIndices, const std::vector<ulong> ulaRefIndices, 171 InlineHistory (const vector<ulong> ulaBitIndices, const vector<ulong> ulaRefIndices,
172 const std::vector<LDSubfile*> paRefs, const bool bDeep) : 172 const vector<LDSubfile*> paRefs, const bool bDeep) :
173 ulaBitIndices (ulaBitIndices), ulaRefIndices (ulaRefIndices), paRefs (paRefs), bDeep (bDeep) {} 173 ulaBitIndices (ulaBitIndices), ulaRefIndices (ulaRefIndices), paRefs (paRefs), bDeep (bDeep) {}
174 }; 174 };
175 175
176 // ============================================================================= 176 // =============================================================================
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
178 // ============================================================================= 178 // =============================================================================
179 class MoveHistory : public HistoryEntry { 179 class MoveHistory : public HistoryEntry {
180 public: 180 public:
181 IMPLEMENT_HISTORY_TYPE (Move) 181 IMPLEMENT_HISTORY_TYPE (Move)
182 182
183 const std::vector<ulong> ulaIndices; 183 const vector<ulong> ulaIndices;
184 const vertex vVector; 184 const vertex vVector;
185 185
186 MoveHistory (const std::vector<ulong> ulaIndices, const vertex vVector) : 186 MoveHistory (const vector<ulong> ulaIndices, const vertex vVector) :
187 ulaIndices (ulaIndices), vVector (vVector) {} 187 ulaIndices (ulaIndices), vVector (vVector) {}
188 }; 188 };
189 189
190 // ============================================================================= 190 // =============================================================================
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
192 // ============================================================================= 192 // =============================================================================
193 class ComboHistory : public HistoryEntry { 193 class ComboHistory : public HistoryEntry {
194 public: 194 public:
195 IMPLEMENT_HISTORY_TYPE (Combo) 195 IMPLEMENT_HISTORY_TYPE (Combo)
196 196
197 std::vector<HistoryEntry*> paEntries; 197 vector<HistoryEntry*> paEntries;
198 198
199 ComboHistory () {} 199 ComboHistory () {}
200 ComboHistory (std::vector<HistoryEntry*> paEntries) : paEntries (paEntries) {} 200 ComboHistory (vector<HistoryEntry*> paEntries) : paEntries (paEntries) {}
201 201
202 void addEntry (HistoryEntry* entry) { if (entry) paEntries.push_back (entry); } 202 void addEntry (HistoryEntry* entry) { if (entry) paEntries << entry; }
203 ulong numEntries () const { return paEntries.size (); } 203 ulong numEntries () const { return paEntries.size (); }
204 ComboHistory& operator<< (HistoryEntry* entry) { addEntry (entry); return *this;} 204 ComboHistory& operator<< (HistoryEntry* entry) { addEntry (entry); return *this;}
205 }; 205 };
206 206
207 // ============================================================================= 207 // =============================================================================
212 void undo (); 212 void undo ();
213 void redo (); 213 void redo ();
214 void clear (); 214 void clear ();
215 void updateActions (); 215 void updateActions ();
216 long pos (); 216 long pos ();
217 std::vector<HistoryEntry*>& entries (); 217 vector<HistoryEntry*>& entries ();
218 }; 218 };
219 219
220 #endif // HISTORY_H 220 #endif // HISTORY_H

mercurial