src/history.h

changeset 498
791c831c8020
parent 497
c51941e590b6
child 504
6a1fa662bfc1
equal deleted inserted replaced
497:c51941e590b6 498:791c831c8020
98 enum Type 98 enum Type
99 { Cut, // was deleted with a cut operation 99 { Cut, // was deleted with a cut operation
100 Other, // was deleted witout specific reason 100 Other, // was deleted witout specific reason
101 }; 101 };
102 102
103 PROPERTY (ulong, index, setIndex) 103 PROPERTY (int, index, setIndex)
104 PROPERTY (str, code, setCode) 104 PROPERTY (str, code, setCode)
105 PROPERTY (DelHistory::Type, type, setType) 105 PROPERTY (DelHistory::Type, type, setType)
106 106
107 public: 107 public:
108 IMPLEMENT_HISTORY_TYPE (Del) 108 IMPLEMENT_HISTORY_TYPE (Del)
109 109
110 DelHistory (ulong idx, LDObject* obj, Type type = Other) : 110 DelHistory (int idx, LDObject* obj, Type type = Other) :
111 m_index (idx), 111 m_index (idx),
112 m_code (obj->raw()), 112 m_code (obj->raw()),
113 m_type (type) {} 113 m_type (type) {}
114 }; 114 };
115 115
116 // ============================================================================= 116 // =============================================================================
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
118 // ============================================================================= 118 // =============================================================================
119 class EditHistory : public AbstractHistoryEntry 119 class EditHistory : public AbstractHistoryEntry
120 { PROPERTY (ulong, index, setIndex) 120 { PROPERTY (int, index, setIndex)
121 PROPERTY (str, oldCode, setOldCode) 121 PROPERTY (str, oldCode, setOldCode)
122 PROPERTY (str, newCode, setNewCode) 122 PROPERTY (str, newCode, setNewCode)
123 123
124 public: 124 public:
125 IMPLEMENT_HISTORY_TYPE (Edit) 125 IMPLEMENT_HISTORY_TYPE (Edit)
126 126
127 EditHistory (ulong idx, str oldCode, str newCode) : 127 EditHistory (int idx, str oldCode, str newCode) :
128 m_index (idx), 128 m_index (idx),
129 m_oldCode (oldCode), 129 m_oldCode (oldCode),
130 m_newCode (newCode) {} 130 m_newCode (newCode) {}
131 }; 131 };
132 132
133 // ============================================================================= 133 // =============================================================================
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
135 // ============================================================================= 135 // =============================================================================
138 enum Type 138 enum Type
139 { Other, // was "just added" 139 { Other, // was "just added"
140 Paste, // was added through a paste operation 140 Paste, // was added through a paste operation
141 }; 141 };
142 142
143 PROPERTY (ulong, index, setIndex) 143 PROPERTY (int, index, setIndex)
144 PROPERTY (str, code, setCode) 144 PROPERTY (str, code, setCode)
145 PROPERTY (AddHistory::Type, type, setType) 145 PROPERTY (AddHistory::Type, type, setType)
146 146
147 public: 147 public:
148 IMPLEMENT_HISTORY_TYPE (Add) 148 IMPLEMENT_HISTORY_TYPE (Add)
149 149
150 AddHistory (ulong idx, LDObject* obj, Type type = Other) : 150 AddHistory (int idx, LDObject* obj, Type type = Other) :
151 m_index (idx), 151 m_index (idx),
152 m_code (obj->raw()), 152 m_code (obj->raw()),
153 m_type (type) {} 153 m_type (type) {}
154 }; 154 };
155 155
156 // ============================================================================= 156 // =============================================================================
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
158 // ============================================================================= 158 // =============================================================================
159 class MoveHistory : public AbstractHistoryEntry 159 class MoveHistory : public AbstractHistoryEntry
160 { public: 160 { public:
161 IMPLEMENT_HISTORY_TYPE (Move) 161 IMPLEMENT_HISTORY_TYPE (Move)
162 162
163 List<ulong> indices; 163 List<int> indices;
164 vertex dest; 164 vertex dest;
165 165
166 MoveHistory (List<ulong> indices, vertex dest) : 166 MoveHistory (List<int> indices, vertex dest) :
167 indices (indices), 167 indices (indices),
168 dest (dest) {} 168 dest (dest) {}
169 }; 169 };
170 170
171 class SwapHistory : public AbstractHistoryEntry 171 class SwapHistory : public AbstractHistoryEntry
172 { public: 172 { public:
173 IMPLEMENT_HISTORY_TYPE (Swap) 173 IMPLEMENT_HISTORY_TYPE (Swap)
174 ulong a, b; 174 int a, b;
175 175
176 SwapHistory (ulong a, ulong b) : 176 SwapHistory (int a, int b) :
177 a (a), 177 a (a),
178 b (b) {} 178 b (b) {}
179 }; 179 };
180 180
181 #endif // HISTORY_H 181 #endif // HISTORY_H

mercurial