Mercurial > hg > svgui
comparison widgets/CommandHistory.cpp @ 397:2c59b0cd176b
* Update translations, and add change counter to name of bundle command
author | Chris Cannam |
---|---|
date | Thu, 12 Jun 2008 10:47:11 +0000 |
parents | 0bcb449d15f4 |
children | 80e279e4f9fe |
comparison
equal
deleted
inserted
replaced
396:2669267fb7ea | 397:2c59b0cd176b |
---|---|
33 #include <QTimer> | 33 #include <QTimer> |
34 #include <QAction> | 34 #include <QAction> |
35 | 35 |
36 #include <iostream> | 36 #include <iostream> |
37 | 37 |
38 //#define DEBUG_COMMAND_HISTORY 1 | 38 #define DEBUG_COMMAND_HISTORY 1 |
39 | 39 |
40 CommandHistory *CommandHistory::m_instance = 0; | 40 CommandHistory *CommandHistory::m_instance = 0; |
41 | 41 |
42 CommandHistory::CommandHistory() : | 42 CommandHistory::CommandHistory() : |
43 m_undoLimit(50), | 43 m_undoLimit(50), |
137 void | 137 void |
138 CommandHistory::addCommand(Command *command, bool execute, bool bundle) | 138 CommandHistory::addCommand(Command *command, bool execute, bool bundle) |
139 { | 139 { |
140 if (!command) return; | 140 if (!command) return; |
141 | 141 |
142 #ifdef DEBUG_COMMAND_HISTORY | |
143 std::cerr << "CommandHistory::addCommand: " << command->getName().toLocal8Bit().data() << " at " << command << ": execute = " << execute << ", bundle = " << bundle << " (m_currentCompound = " << m_currentCompound << ", m_currentBundle = " << m_currentBundle << ")" << std::endl; | |
144 #endif | |
145 | |
142 if (m_currentCompound) { | 146 if (m_currentCompound) { |
143 addToCompound(command, execute); | 147 addToCompound(command, execute); |
144 return; | 148 return; |
145 } | 149 } |
146 | 150 |
150 } else if (m_currentBundle) { | 154 } else if (m_currentBundle) { |
151 closeBundle(); | 155 closeBundle(); |
152 } | 156 } |
153 | 157 |
154 #ifdef DEBUG_COMMAND_HISTORY | 158 #ifdef DEBUG_COMMAND_HISTORY |
155 std::cerr << "CommandHistory::addCommand: " << command->getName().toLocal8Bit().data() << " at " << command << std::endl; | |
156 if (!m_redoStack.empty()) { | 159 if (!m_redoStack.empty()) { |
157 std::cerr << "CommandHistory::clearing redo stack" << std::endl; | 160 std::cerr << "CommandHistory::clearing redo stack" << std::endl; |
158 } | 161 } |
159 #endif | 162 #endif |
160 | 163 |
203 << ": creating new bundle" << std::endl; | 206 << ": creating new bundle" << std::endl; |
204 #endif | 207 #endif |
205 | 208 |
206 // need to addCommand before setting m_currentBundle, as addCommand | 209 // need to addCommand before setting m_currentBundle, as addCommand |
207 // with bundle false will reset m_currentBundle to 0 | 210 // with bundle false will reset m_currentBundle to 0 |
208 MacroCommand *mc = new MacroCommand(command->getName()); | 211 MacroCommand *mc = new BundleCommand(command->getName()); |
209 addCommand(mc, false); | 212 addCommand(mc, false); |
210 m_currentBundle = mc; | 213 m_currentBundle = mc; |
211 m_currentBundleName = command->getName(); | 214 m_currentBundleName = command->getName(); |
212 } | 215 } |
213 | 216 |