--- a/src/editHistory.cpp Thu Jan 04 19:40:52 2018 +0200 +++ b/src/editHistory.cpp Thu Jan 04 19:44:26 2018 +0200 @@ -23,10 +23,10 @@ #include "mainwindow.h" #include "glRenderer.h" -EditHistory::EditHistory (LDDocument* document) : - m_document (document), - m_isIgnoring (false), - m_position (-1) {} +EditHistory::EditHistory(LDDocument* document) : + m_document(document), + m_isIgnoring(false), + m_position(-1) {} void EditHistory::undo() { @@ -34,8 +34,8 @@ return; // Don't take the changes done here as actual edits to the document - setIgnoring (true); - const Changeset& set = changesetAt (position()); + setIgnoring(true); + const Changeset& set = changesetAt(position()); // Iterate the list in reverse and undo all actions for (int i = set.size() - 1; i >= 0; --i) @@ -45,7 +45,7 @@ } m_position--; - setIgnoring (false); + setIgnoring(false); emit undone(); } @@ -54,15 +54,15 @@ if (position() == m_changesets.size()) return; - setIgnoring (true); - const Changeset& set = changesetAt (position() + 1); + setIgnoring(true); + const Changeset& set = changesetAt(position() + 1); // Redo things in original order for (const AbstractHistoryEntry* change : set) change->redo(); ++m_position; - setIgnoring (false); + setIgnoring(false); emit redone(); } @@ -96,7 +96,7 @@ emit stepAdded(); } -void EditHistory::add (AbstractHistoryEntry* entry) +void EditHistory::add(AbstractHistoryEntry* entry) { if (isIgnoring()) { @@ -104,7 +104,7 @@ return; } - entry->setParent (this); + entry->setParent(this); m_currentChangeset << entry; } @@ -113,7 +113,7 @@ return m_changesets.size(); } -const EditHistory::Changeset& EditHistory::changesetAt (int pos) const +const EditHistory::Changeset& EditHistory::changesetAt(int pos) const { return m_changesets[pos]; } @@ -128,7 +128,7 @@ return m_isIgnoring; } -void EditHistory::setIgnoring (bool value) +void EditHistory::setIgnoring(bool value) { m_isIgnoring = value; } @@ -150,7 +150,7 @@ return m_parent; } -void AbstractHistoryEntry::setParent (EditHistory* parent) +void AbstractHistoryEntry::setParent(EditHistory* parent) { m_parent = parent; } @@ -159,26 +159,26 @@ // --------------------------------------------------------------------------------------------------------------------- // -AddHistoryEntry::AddHistoryEntry (int idx, LDObject* obj) : - m_index (idx), - m_code (obj->asText()) {} +AddHistoryEntry::AddHistoryEntry(int idx, LDObject* obj) : + m_index(idx), + m_code(obj->asText()) {} void AddHistoryEntry::undo() const { - parent()->document()->getObject (m_index)->destroy(); + parent()->document()->getObject(m_index)->destroy(); } void AddHistoryEntry::redo() const { - parent()->document()->insertObj (m_index, ParseLine (m_code)); + parent()->document()->insertObj(m_index, ParseLine(m_code)); } // // --------------------------------------------------------------------------------------------------------------------- // -DelHistoryEntry::DelHistoryEntry (int idx, LDObject* obj) : - AddHistoryEntry (idx, obj) {} +DelHistoryEntry::DelHistoryEntry(int idx, LDObject* obj) : + AddHistoryEntry(idx, obj) {} void DelHistoryEntry::undo() const { @@ -194,37 +194,37 @@ // --------------------------------------------------------------------------------------------------------------------- // -EditHistoryEntry::EditHistoryEntry (int idx, QString oldCode, QString newCode) : - m_index (idx), - m_oldCode (oldCode), - m_newCode (newCode) {} +EditHistoryEntry::EditHistoryEntry(int idx, QString oldCode, QString newCode) : + m_index(idx), + m_oldCode(oldCode), + m_newCode(newCode) {} void EditHistoryEntry::undo() const { - LDObject* obj = parent()->document()->getObject (m_index); - LDObject* newobj = ParseLine (m_oldCode); - obj->replace (newobj); + LDObject* obj = parent()->document()->getObject(m_index); + LDObject* newobj = ParseLine(m_oldCode); + obj->replace(newobj); } void EditHistoryEntry::redo() const { - LDObject* obj = parent()->document()->getObject (m_index); - LDObject* newobj = ParseLine (m_newCode); - obj->replace (newobj); + LDObject* obj = parent()->document()->getObject(m_index); + LDObject* newobj = ParseLine(m_newCode); + obj->replace(newobj); } // // --------------------------------------------------------------------------------------------------------------------- // -SwapHistoryEntry::SwapHistoryEntry (int a, int b) : - m_a (a), - m_b (b) {} +SwapHistoryEntry::SwapHistoryEntry(int a, int b) : + m_a(a), + m_b(b) {} void SwapHistoryEntry::undo() const { - LDObject::fromID (m_a)->swap (LDObject::fromID (m_b)); + LDObject::fromID(m_a)->swap(LDObject::fromID(m_b)); } void SwapHistoryEntry::redo() const