src/history.cc

changeset 561
1d90296ad3fc
parent 560
39085791128f
child 562
c4ff45e98551
equal deleted inserted replaced
560:39085791128f 561:1d90296ad3fc
41 dlog ("History: performing undo: set has %1 changes", set.size()); 41 dlog ("History: performing undo: set has %1 changes", set.size());
42 42
43 // Iterate the list in reverse and undo all actions 43 // Iterate the list in reverse and undo all actions
44 for (int i = set.size() - 1; i >= 0; --i) 44 for (int i = set.size() - 1; i >= 0; --i)
45 { AbstractHistoryEntry* change = set[i]; 45 { AbstractHistoryEntry* change = set[i];
46 dlog ("Undo change of type %1", change->getType());
47 change->undo(); 46 change->undo();
48 } 47 }
49 48
50 decreasePosition(); 49 decreasePosition();
51 50
53 g_win->refresh(); 52 g_win->refresh();
54 else 53 else
55 g_win->doFullRefresh(); 54 g_win->doFullRefresh();
56 55
57 g_win->updateActions(); 56 g_win->updateActions();
57 dlog ("Position is now %1", getPosition());
58 } 58 }
59 59
60 // ============================================================================= 60 // =============================================================================
61 // ----------------------------------------------------------------------------- 61 // -----------------------------------------------------------------------------
62 void History::redo() 62 void History::redo()
95 // ----------------------------------------------------------------------------- 95 // -----------------------------------------------------------------------------
96 void History::addStep() 96 void History::addStep()
97 { if (m_currentChangeset.isEmpty()) 97 { if (m_currentChangeset.isEmpty())
98 return; 98 return;
99 99
100 dlog ("position: %1, size: %2\n", getPosition(), getSize());
100 while (getPosition() < getSize() - 1) 101 while (getPosition() < getSize() - 1)
101 { Changeset last = m_changesets.last(); 102 { Changeset last = m_changesets.last();
102 103
103 for (AbstractHistoryEntry* entry : last) 104 for (AbstractHistoryEntry* entry : last)
104 delete entry; 105 delete entry;
115 116
116 // ============================================================================= 117 // =============================================================================
117 // ----------------------------------------------------------------------------- 118 // -----------------------------------------------------------------------------
118 void History::add (AbstractHistoryEntry* entry) 119 void History::add (AbstractHistoryEntry* entry)
119 { if (isIgnoring()) 120 { if (isIgnoring())
120 { delete entry; 121 { dlog ("Ignored addition of history entry of type %1", entry->getTypeName());
122 delete entry;
121 return; 123 return;
122 } 124 }
123 125
124 entry->setParent (this); 126 entry->setParent (this);
125 m_currentChangeset << entry; 127 m_currentChangeset << entry;

mercurial