src/EditHistory.cc

changeset 642
751a8df42842
parent 640
d4dda62c6600
child 644
93dcd1a0e4bd
--- a/src/EditHistory.cc	Wed Mar 05 03:45:49 2014 +0200
+++ b/src/EditHistory.cc	Wed Mar 05 05:30:36 2014 +0200
@@ -26,19 +26,19 @@
 // =============================================================================
 //
 History::History() :
-	m_Position (-1) {}
+	m_position (-1) {}
 
 // =============================================================================
 //
 void History::undo()
 {
-	if (m_changesets.isEmpty() || getPosition() == -1)
+	if (m_changesets.isEmpty() || position() == -1)
 		return;
 
 	// Don't take the changes done here as actual edits to the document
 	setIgnoring (true);
 
-	const Changeset& set = getChangeset (getPosition());
+	const Changeset& set = getChangeset (position());
 
 	// Iterate the list in reverse and undo all actions
 	for (int i = set.size() - 1; i >= 0; --i)
@@ -47,10 +47,10 @@
 		change->undo();
 	}
 
-	decreasePosition();
+	m_position--;
 	g_win->refresh();
 	g_win->updateActions();
-	dlog ("Position is now %1", getPosition());
+	dlog ("Position is now %1", position());
 	setIgnoring (false);
 }
 
@@ -58,20 +58,20 @@
 //
 void History::redo()
 {
-	if (getPosition() == m_changesets.size())
+	if (position() == m_changesets.size())
 		return;
 
 	setIgnoring (true);
-	const Changeset& set = getChangeset (getPosition() + 1);
+	const Changeset& set = getChangeset (position() + 1);
 
 	// Redo things - in the order as they were done in the first place
 	for (const AbstractHistoryEntry* change : set)
 		change->redo();
 
-	setPosition (getPosition() + 1);
+	setPosition (position() + 1);
 	g_win->refresh();
 	g_win->updateActions();
-	dlog ("Position is now %1", getPosition());
+	dlog ("Position is now %1", position());
 	setIgnoring (false);
 }
 
@@ -94,7 +94,7 @@
 	if (m_currentChangeset.isEmpty())
 		return;
 
-	while (getPosition() < getSize() - 1)
+	while (position() < getSize() - 1)
 	{
 		Changeset last = m_changesets.last();
 
@@ -107,7 +107,7 @@
 	dlog ("History: step added (%1 changes)", m_currentChangeset.size());
 	m_changesets << m_currentChangeset;
 	m_currentChangeset.clear();
-	setPosition (getPosition() + 1);
+	setPosition (position() + 1);
 	g_win->updateActions();
 }
 
@@ -130,7 +130,7 @@
 //
 void AddHistory::undo() const
 {
-	LDObject* obj = getParent()->getDocument()->getObject (getIndex());
+	LDObject* obj = parent()->document()->getObject (index());
 	obj->destroy();
 }
 
@@ -138,24 +138,24 @@
 //
 void AddHistory::redo() const
 {
-	LDObject* obj = parseLine (getCode());
-	getParent()->getDocument()->insertObj (getIndex(), obj);
+	LDObject* obj = parseLine (code());
+	parent()->document()->insertObj (index(), obj);
 	g_win->R()->compileObject (obj);
 }
 
 // =============================================================================
 //
 DelHistory::DelHistory (int idx, LDObject* obj) :
-	m_Index (idx),
-	m_Code (obj->asText()) {}
+	m_index (idx),
+	m_code (obj->asText()) {}
 
 // =============================================================================
 // heh
 //
 void DelHistory::undo() const
 {
-	LDObject* obj = parseLine (getCode());
-	getParent()->getDocument()->insertObj (getIndex(), obj);
+	LDObject* obj = parseLine (code());
+	parent()->document()->insertObj (index(), obj);
 	g_win->R()->compileObject (obj);
 }
 
@@ -163,7 +163,7 @@
 //
 void DelHistory::redo() const
 {
-	LDObject* obj = getParent()->getDocument()->getObject (getIndex());
+	LDObject* obj = parent()->document()->getObject (index());
 	obj->destroy();
 }
 
@@ -171,8 +171,8 @@
 //
 void EditHistory::undo() const
 {
-	LDObject* obj = getCurrentDocument()->getObject (getIndex());
-	LDObject* newobj = parseLine (getOldCode());
+	LDObject* obj = getCurrentDocument()->getObject (index());
+	LDObject* newobj = parseLine (oldCode());
 	obj->replace (newobj);
 	g_win->R()->compileObject (newobj);
 }
@@ -181,8 +181,8 @@
 //
 void EditHistory::redo() const
 {
-	LDObject* obj = getCurrentDocument()->getObject (getIndex());
-	LDObject* newobj = parseLine (getNewCode());
+	LDObject* obj = getCurrentDocument()->getObject (index());
+	LDObject* newobj = parseLine (newCode());
 	obj->replace (newobj);
 	g_win->R()->compileObject (newobj);
 }

mercurial