22 #define MAX_HISTORY 1000
25 #include "vapor/ParamNode.h"
58 if (_nextRoot)
delete _nextRoot;
59 if (_prevRoot)
delete _prevRoot;
60 if (_nextAuxRoot)
delete _nextAuxRoot;
61 if (_prevAuxRoot)
delete _prevAuxRoot;
69 static Params* BackupQueue();
74 static Params* AdvanceQueue();
77 static void resetCommandQueue();
89 int posn = _currentQueuePos - offset;
116 if (!isRecording())
return 0;
117 Command* cmd =
new Command(prevParams, desc, helper, prevAuxParams);
131 if (!pCom->_prevRoot){
132 pCom->_tag = nextParams->
GetName();
138 pCom->_nextAuxRoot = nextAuxParams->GetRootNode()->deepCopy();
139 if (!pCom->_prevAuxRoot){
140 pCom->_auxTag = nextAuxParams->GetName();
141 pCom->_auxInstance = nextAuxParams->GetInstanceIndex();
142 pCom->_auxWinnum = nextAuxParams->GetVizNum();
162 #ifndef DOXYGEN_SKIP_THIS
170 static void blockCapture() {_recordingCount++;}
174 static void unblockCapture() {_recordingCount--; assert(_recordingCount>=0);}
177 void applyHelpers(
bool isUndo,
int instance, Params* prev, Params* next);
183 static int AddToHistory(Command* cmd,
bool ignoreBlocking =
false);
184 static Command* CurrentUndoCommand() {
return CurrentCommand(0);}
185 static Command* CurrentRedoCommand() {
return CurrentCommand(-1);}
189 static Params* reDo();
193 static Params* unDo();
197 ParamNode* _prevRoot;
198 ParamNode* _nextRoot;
199 ParamNode* _prevAuxRoot;
200 ParamNode* _nextAuxRoot;
210 static int _currentQueuePos;
211 static int _endQueuePos;
212 static int _startQueuePos;
213 static int _recordingCount;
214 #endif //DOXYGEN_SKIP_THIS
void setDescription(const char *str)
ParamNode * GetRootNode() const
A pure virtual class for managing parameters used in visualization.
virtual int GetInstanceIndex()
static Command * CaptureStart(Params *prevParams, const char *desc, UndoRedoHelpCB_T helper=0, Params *prevAuxParams=0)
static Command * CurrentCommand(int offset)
static bool isRecording()
static method to tell if commands are being inserted in the queue
virtual ParamNode * deepCopy()
Provides support for maintaining a queue of recently issued commands, performing UnDo, ReDo, etc. The parent Command class supports a queue of Params changes; each entry has a clone of the previous and next Params instance associated with a change.
void(* UndoRedoHelpCB_T)(bool isUndo, int instance, VAPoR::Params *beforeP, VAPoR::Params *afterP, VAPoR::Params *auxBP, VAPoR::Params *auxAP)
static void CaptureEnd(Command *pCom, Params *nextParams, Params *nextAuxParams=0)
const string GetName() const