src/history.cpp

changeset 497
c51941e590b6
parent 493
16766ac1bbd9
child 498
791c831c8020
equal deleted inserted replaced
496:d6cbf21af8fb 497:c51941e590b6
35 // ----------------------------------------------------------------------------- 35 // -----------------------------------------------------------------------------
36 void History::undo() 36 void History::undo()
37 { if (m_changesets.size() == 0 || pos() == -1) 37 { if (m_changesets.size() == 0 || pos() == -1)
38 return; 38 return;
39 39
40 const list& set = changeset (pos()); 40 const Changeset& set = changeset (pos());
41 g_fullRefresh = false; 41 g_fullRefresh = false;
42 42
43 // Iterate the list in reverse and undo all actions 43 // Iterate the list in reverse and undo all actions
44 for (const AbstractHistoryEntry* change : c_rev<AbstractHistoryEntry*> (set)) 44 for (const AbstractHistoryEntry* change : c_rev<AbstractHistoryEntry*> (set))
45 change->undo(); 45 change->undo();
58 // ----------------------------------------------------------------------------- 58 // -----------------------------------------------------------------------------
59 void History::redo() 59 void History::redo()
60 { if (pos() == (long) m_changesets.size()) 60 { if (pos() == (long) m_changesets.size())
61 return; 61 return;
62 62
63 const list& set = changeset (pos() + 1); 63 const Changeset& set = changeset (pos() + 1);
64 g_fullRefresh = false; 64 g_fullRefresh = false;
65 65
66 // Redo things - in the order as they were done in the first place 66 // Redo things - in the order as they were done in the first place
67 for (const AbstractHistoryEntry* change : set) 67 for (const AbstractHistoryEntry* change : set)
68 change->redo(); 68 change->redo();
78 } 78 }
79 79
80 // ============================================================================= 80 // =============================================================================
81 // ----------------------------------------------------------------------------- 81 // -----------------------------------------------------------------------------
82 void History::clear() 82 void History::clear()
83 { for (List<AbstractHistoryEntry*> set : m_changesets) 83 { for (Changeset set : m_changesets)
84 for (AbstractHistoryEntry* change : set) 84 for (auto change : set)
85 delete change; 85 delete change;
86 86
87 m_changesets.clear(); 87 m_changesets.clear();
88 } 88 }
89 89

mercurial