86 m_changesets.clear(); |
86 m_changesets.clear(); |
87 } |
87 } |
88 |
88 |
89 // ============================================================================= |
89 // ============================================================================= |
90 // ----------------------------------------------------------------------------- |
90 // ----------------------------------------------------------------------------- |
91 void History::updateActions() const |
|
92 { ACTION (Undo)->setEnabled (getPosition() != -1); |
|
93 ACTION (Redo)->setEnabled (getPosition() < (long) m_changesets.size() - 1); |
|
94 } |
|
95 |
|
96 // ============================================================================= |
|
97 // ----------------------------------------------------------------------------- |
|
98 void History::addStep() |
91 void History::addStep() |
99 { if (m_currentChangeset.isEmpty()) |
92 { if (m_currentChangeset.isEmpty()) |
100 return; |
93 return; |
101 |
94 |
102 while (getPosition() < getSize() - 1) |
95 while (getPosition() < getSize() - 1) |
103 m_changesets.removeLast(); |
96 m_changesets.removeLast(); |
104 |
97 |
105 m_changesets << m_currentChangeset; |
98 m_changesets << m_currentChangeset; |
106 m_currentChangeset.clear(); |
99 m_currentChangeset.clear(); |
107 setPosition (getPosition() + 1); |
100 setPosition (getPosition() + 1); |
108 updateActions(); |
101 g_win->updateActions(); |
109 } |
102 } |
110 |
103 |
111 // ============================================================================= |
104 // ============================================================================= |
112 // ----------------------------------------------------------------------------- |
105 // ----------------------------------------------------------------------------- |
113 void History::add (AbstractHistoryEntry* entry) |
106 void History::add (AbstractHistoryEntry* entry) |