history.cpp

changeset 96
2f175b3d8211
parent 94
a9e67f6e610e
child 97
52bcca21579e
--- a/history.cpp	Wed Apr 10 16:17:22 2013 +0300
+++ b/history.cpp	Wed Apr 10 19:26:14 2013 +0300
@@ -37,7 +37,6 @@
 	void addEntry (HistoryEntry* entry) {
 		// If there's any entries after our current position, we need to remove them now
 		for (ulong i = lPos + 1; i < entries.size(); ++i) {
-			
 			delete entries[i];
 			entries.erase (entries.begin() + i);
 		}
@@ -67,6 +66,16 @@
 	}
 	
 	// =========================================================================
+	void clear () {
+		for (HistoryEntry* entry : entries)
+			delete entry;
+		
+		entries.clear ();
+		lPos = -1;
+		updateActions ();
+	}
+	
+	// =========================================================================
 	void updateActions () {
 		ACTION_NAME (undo)->setEnabled (lPos > -1);
 		ACTION_NAME (redo)->setEnabled (lPos < (long) entries.size () - 1);

mercurial