src/history.cpp

changeset 493
16766ac1bbd9
parent 455
c5d14d112034
child 497
c51941e590b6
--- a/src/history.cpp	Thu Oct 03 18:07:06 2013 +0300
+++ b/src/history.cpp	Thu Oct 03 20:56:20 2013 +0300
@@ -33,90 +33,90 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void History::undo() {
-	if (m_changesets.size() == 0 || pos() == -1)
+void History::undo()
+{	if (m_changesets.size() == 0 || pos() == -1)
 		return;
-	
+
 	const list& set = changeset (pos());
 	g_fullRefresh = false;
-	
+
 	// Iterate the list in reverse and undo all actions
-	for (const AbstractHistoryEntry * change : c_rev<AbstractHistoryEntry*> (set))
+	for (const AbstractHistoryEntry* change : c_rev<AbstractHistoryEntry*> (set))
 		change->undo();
-	
+
 	setPos (pos() - 1);
-	
+
 	if (!g_fullRefresh)
 		g_win->refresh();
 	else
 		g_win->fullRefresh();
-	
+
 	updateActions();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void History::redo() {
-	if (pos() == (long) m_changesets.size())
+void History::redo()
+{	if (pos() == (long) m_changesets.size())
 		return;
-	
+
 	const list& set = changeset (pos() + 1);
 	g_fullRefresh = false;
-	
+
 	// Redo things - in the order as they were done in the first place
-	for (const AbstractHistoryEntry * change : set)
+	for (const AbstractHistoryEntry* change : set)
 		change->redo();
-	
+
 	setPos (pos() + 1);
-	
+
 	if (!g_fullRefresh)
 		g_win->refresh();
 	else
 		g_win->fullRefresh();
-	
+
 	updateActions();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void History::clear() {
-	for (List<AbstractHistoryEntry*> set : m_changesets)
-		for (AbstractHistoryEntry * change : set)
+void History::clear()
+{	for (List<AbstractHistoryEntry*> set : m_changesets)
+		for (AbstractHistoryEntry* change : set)
 			delete change;
-	
+
 	m_changesets.clear();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void History::updateActions() const {
-	ACTION (Undo)->setEnabled (pos() != -1);
+void History::updateActions() const
+{	ACTION (Undo)->setEnabled (pos() != -1);
 	ACTION (Redo)->setEnabled (pos() < (long) m_changesets.size() - 1);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void History::open() {
-	if (opened())
+void History::open()
+{	if (opened())
 		return;
-	
+
 	setOpened (true);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void History::close() {
-	if (!opened())
+void History::close()
+{	if (!opened())
 		return;
-	
+
 	setOpened (false);
-	
+
 	if (m_currentArchive.size() == 0)
 		return;
-	
+
 	while (pos() < size() - 1)
 		m_changesets.erase (size() - 1);
-	
+
 	m_changesets << m_currentArchive;
 	m_currentArchive.clear();
 	setPos (pos() + 1);
@@ -125,31 +125,31 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void History::add (AbstractHistoryEntry* entry) {
-	if (!opened()) {
-		delete entry;
+void History::add (AbstractHistoryEntry* entry)
+{	if (!opened())
+	{	delete entry;
 		return;
 	}
-	
+
 	entry->setParent (this);
 	m_currentArchive << entry;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void AddHistory::undo() const {
-	LDFile* f = parent()->file();
+void AddHistory::undo() const
+{	LDFile* f = parent()->file();
 	LDObject* obj = f->object (index());
 	f->forgetObject (obj);
 	delete obj;
-	
+
 	g_fullRefresh = true;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void AddHistory::redo() const {
-	LDFile* f = parent()->file();
+void AddHistory::redo() const
+{	LDFile* f = parent()->file();
 	LDObject* obj = parseLine (code());
 	f->insertObj (index(), obj);
 	g_win->R()->compileObject (obj);
@@ -160,8 +160,8 @@
 // =============================================================================
 // heh
 // -----------------------------------------------------------------------------
-void DelHistory::undo() const {
-	LDFile* f = parent()->file();
+void DelHistory::undo() const
+{	LDFile* f = parent()->file();
 	LDObject* obj = parseLine (code());
 	f->insertObj (index(), obj);
 	g_win->R()->compileObject (obj);
@@ -169,12 +169,12 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void DelHistory::redo() const {
-	LDFile* f = parent()->file();
+void DelHistory::redo() const
+{	LDFile* f = parent()->file();
 	LDObject* obj = f->object (index());
 	f->forgetObject (obj);
 	delete obj;
-	
+
 	g_fullRefresh = true;
 }
 
@@ -182,8 +182,8 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void EditHistory::undo() const {
-	LDObject* obj = LDFile::current()->object (index());
+void EditHistory::undo() const
+{	LDObject* obj = LDFile::current()->object (index());
 	LDObject* newobj = parseLine (oldCode());
 	obj->replace (newobj);
 	g_win->R()->compileObject (newobj);
@@ -191,8 +191,8 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void EditHistory::redo() const {
-	LDObject* obj = LDFile::current()->object (index());
+void EditHistory::redo() const
+{	LDObject* obj = LDFile::current()->object (index());
 	LDObject* newobj = parseLine (newCode());
 	obj->replace (newobj);
 	g_win->R()->compileObject (newobj);
@@ -202,12 +202,12 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void SwapHistory::undo() const {
-	LDObject::fromID (a)->swap (LDObject::fromID (b));
+void SwapHistory::undo() const
+{	LDObject::fromID (a)->swap (LDObject::fromID (b));
 }
 
-void SwapHistory::redo() const {
-	undo(); // :v
+void SwapHistory::redo() const
+{	undo(); // :v
 }
 
-SwapHistory::~SwapHistory() {}
\ No newline at end of file
+SwapHistory::~SwapHistory() {}

mercurial