src/history.cpp

changeset 542
46a33bdc0b36
parent 539
72ad83a67165
child 553
2418d5955421
equal deleted inserted replaced
541:0e38beeb050a 542:46a33bdc0b36
48 if (!g_fullRefresh) 48 if (!g_fullRefresh)
49 g_win->refresh(); 49 g_win->refresh();
50 else 50 else
51 g_win->doFullRefresh(); 51 g_win->doFullRefresh();
52 52
53 updateActions(); 53 g_win->updateActions();
54 } 54 }
55 55
56 // ============================================================================= 56 // =============================================================================
57 // ----------------------------------------------------------------------------- 57 // -----------------------------------------------------------------------------
58 void History::redo() 58 void History::redo()
71 if (!g_fullRefresh) 71 if (!g_fullRefresh)
72 g_win->refresh(); 72 g_win->refresh();
73 else 73 else
74 g_win->doFullRefresh(); 74 g_win->doFullRefresh();
75 75
76 updateActions(); 76 g_win->updateActions();
77 } 77 }
78 78
79 // ============================================================================= 79 // =============================================================================
80 // ----------------------------------------------------------------------------- 80 // -----------------------------------------------------------------------------
81 void History::clear() 81 void History::clear()
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)

mercurial