Changeset 443
- Timestamp:
- 12/15/11 15:38:09 (5 months ago)
- Location:
- cafu/trunk/CaWE
- Files:
-
- 2 modified
-
CommandHistory.cpp (modified) (4 diffs)
-
CommandHistory.hpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cafu/trunk/CaWE/CommandHistory.cpp
r364 r443 30 30 31 31 32 namespace 33 { 34 class RecursionCheckerT 35 { 36 public: 37 38 RecursionCheckerT(bool& IsActive) : m_IsActive(IsActive) { wxASSERT(!m_IsActive); m_IsActive=true; } 39 ~RecursionCheckerT() { m_IsActive=false; } 40 41 42 private: 43 44 bool& m_IsActive; 45 }; 46 } 47 48 32 49 CommandHistoryT::CommandHistoryT() 33 50 : m_CurrentIndex(-1), 51 m_Debug_IsActive(false), 34 52 m_InvalidCommandID(0) 35 53 { … … 81 99 if (m_CurrentIndex<0) return; 82 100 wxASSERT(m_CurrentIndex<(int)m_Commands.Size()); 101 RecursionCheckerT RecCheck(m_Debug_IsActive); 83 102 84 103 // Undo all commands from the invisible commands list and delete them. … … 112 131 if (m_CurrentIndex+1>=int(m_Commands.Size())) return; 113 132 wxASSERT(m_CurrentIndex<(int)m_Commands.Size()-1); 133 RecursionCheckerT RecCheck(m_Debug_IsActive); 114 134 115 135 // Undo all commands from the invisible commands list and delete them. … … 141 161 bool CommandHistoryT::SubmitCommand(CommandT* Command) 142 162 { 163 RecursionCheckerT RecCheck(m_Debug_IsActive); 164 143 165 if (!Command->IsDone() && !Command->Do()) 144 166 { -
cafu/trunk/CaWE/CommandHistory.hpp
r285 r443 48 48 ArrayT<CommandT*> m_Commands; 49 49 ArrayT<CommandT*> m_InvisCommands; ///< Stores all commands not visible in the history until a visible command is added to the history (then they are moved into the normal history). 50 int m_CurrentIndex; ///< The current index inside the commands array. -1 means no valid index. 50 int m_CurrentIndex; ///< The index of the last done command: all commands in <code>m_Commands[0 ... m_CurrentIndex]</code> are "done" (available for undo), any commands following them are "undone" (available for redo). If m_CurrentIndex is -1, there are no "done" commands at all. 51 bool m_Debug_IsActive; ///< In order to facilitate debugging, this member helps with detecting recursive calls to our functions. For example, when we call a commands CommandT::Undo() method, does it erroneously cause a recursive call back to SubmitCommand()? 51 52 52 53 /// The command id returned when there is no current command (when the current index is -1).
