X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FEditorGraphicBBS%2FbbsWxGUIEditorGraphic%2FwxGEditorTabPanel.cxx;h=b37e67d4b6b35cf0c13f3d04dd7c9b1d8485008e;hb=9877bb1bc1cbfc8b4ac0dbd45d443ba670c9d8d2;hp=10e10a0270053a02c95b064b6961103f500670a7;hpb=27e3325d47885b491198917840e8162c234a1545;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx index 10e10a0..b37e67d 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx @@ -55,6 +55,7 @@ printf("EED wxGEditorTabPanel::wxGEditorTabPanel 0\n"); _panelAUIMgr = new wxAuiManager(this); _sceneManager = NULL; _actualdo = states.begin(); + _sactualdo = sstates.begin(); initWxVtkCanvas(); printf("EED wxGEditorTabPanel::wxGEditorTabPanel 1\n"); } @@ -111,14 +112,14 @@ printf("EED wxGEditorTabPanel::initWxVtkCanvas 1\n"); boxType += result; _sceneManager->createGBlackBox(x,y,packageName, boxType); - saveTempandUpdate(); + saveTempandUpdate("drop box"); return true; } //========================================================================= - void wxGEditorTabPanel::saveTempandUpdate() + void wxGEditorTabPanel::saveTempandUpdate(const std::string &action) { - _panelsManager->saveTempandUpdate(); + _panelsManager->saveTempandUpdate(action); } //========================================================================= @@ -189,7 +190,7 @@ printf("EED wxGEditorTabPanel::initWxVtkCanvas 1\n"); //========================================================================= - void wxGEditorTabPanel::saveTempDiagram() //FCY + void wxGEditorTabPanel::saveTempDiagram(const std::string &action) //FCY { std::string content = ""; // writing file header @@ -206,14 +207,20 @@ printf("EED wxGEditorTabPanel::initWxVtkCanvas 1\n"); if(_actualdo == states.end() ) // same size, write to the end { states.push_back (content); + saveStringAction(action); } else { std::vector::iterator it = _actualdo+1; states.erase(it, states.end()); states.push_back(content); + + std::vector::iterator sit = _sactualdo+1; + sstates.erase(sit, sstates.end()); + saveStringAction(action); } _actualdo = states.end(); + _sactualdo = sstates.end(); } @@ -228,25 +235,40 @@ printf("EED wxGEditorTabPanel::initWxVtkCanvas 1\n"); } //========================================================================= - unsigned short wxGEditorTabPanel::getUndoState() + unsigned short wxGEditorTabPanel::getUndoState( std::string &stun) { + stun = "Undo"; if(states.size()>0) { if(_actualdo == states.begin() ) + { + return 0; + } else + { + stun +=" - "; + stun += _sactualdo->substr(0,(--_sactualdo)->find_last_of(".")); + _sactualdo++; return 1; + } } } - unsigned short wxGEditorTabPanel::getRedoState() + unsigned short wxGEditorTabPanel::getRedoState( std::string &stre) { + stre = "Redo"; if(states.size()>0) { - if(_actualdo == --states.end() || states.size() == 1) + if(_actualdo == --states.end() || states.size() == 1 || _actualdo == states.end()) return 0; else + { + stre +=" - "; + stre += _sactualdo->substr(0,(++_sactualdo)->find_last_of(".")); + --_sactualdo; return 1; + } } } @@ -261,10 +283,12 @@ printf("EED wxGEditorTabPanel::initWxVtkCanvas 1\n"); if(_actualdo == states.end() ) // same size, write to the end { (_actualdo--); + (_sactualdo--); } if(_actualdo != states.begin() ) { ss << *(--_actualdo); + _sactualdo--; } else { @@ -275,6 +299,7 @@ printf("EED wxGEditorTabPanel::initWxVtkCanvas 1\n"); else //redo { _actualdo++; + _sactualdo++; if(_actualdo != states.end()) { ss << *_actualdo; @@ -287,13 +312,22 @@ printf("EED wxGEditorTabPanel::initWxVtkCanvas 1\n"); _sceneManager->loadDiagram(ss); } - + + void wxGEditorTabPanel::saveStringAction(const std::string &action) + { + char temp[50]; + sprintf(temp,".%d", sstates.size()); + sstates.push_back(action + temp); + } + //========================================================================= int wxGEditorTabPanel::getPanelId() { return _id; } + + //=========================================================================