00001 /* 00002 * lib-controler : Un contrôleur générique de scène 3D. 00003 * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC 00004 * http://www.sic.sp2mi.univ-poitiers.fr/ 00005 * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS, 00006 * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/ 00007 * 00008 * This file is part of lib-controler 00009 * 00010 * This program is free software: you can redistribute it and/or modify 00011 * it under the terms of the GNU Lesser General Public License as published by 00012 * the Free Software Foundation, either version 3 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public License 00021 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00022 */ 00023 00024 //****************************************************************************** 00025 // Ce fichier est une partie de "controler.hh". 00026 //****************************************************************************** 00028 00029 public: 00030 00031 // Accesseurs pour le nombre maximum d'undo possibles. 00032 // Si -1 : pas de limite... 00033 // Attention, le set vide eventuellement la pile des redo. 00034 int getNbMaxUndos() const; 00035 void setNbMaxUndos(int ANumber); 00036 00037 // Accesseurs pour savoir si on fait les undo-redo sur fichier 00038 // Attention, le set vide tout les undo-redo. 00039 bool getUndoOnFile() const; 00040 void setUndoOnFile(bool ABool); 00041 00047 virtual bool undo(int AStep = 1); 00048 virtual bool redo(int AStep = 1); 00049 00054 bool emptyUndoRedo(); 00055 00056 protected: 00057 00058 // Les méthodes appelées avant et après les opérations. 00059 // A redéfinir pour ajouter des pré ou post traitements. 00060 virtual void undoRedoPreSave(); 00061 virtual void undoRedoPostSaveOk(); 00062 virtual void undoRedoPostSaveFailed(); 00063 00064 //****************************************************************************** 00065 00069 void emptyUndoList(); 00070 void emptyRedoList(); 00071 00072 void basicPreSave(); 00073 void basicPostSaveOk(); 00074 void basicPostSaveFailed(); 00075 00076 std::string getUndoRedoStatus() const; 00077 00078 std::string getFilename(int AIndex) const; 00079 int getNewFileIndex(); 00080 00081 virtual std::ostringstream* saveModel(); 00082 virtual bool loadModel(std::ostringstream* AStream); 00083 00084 bool existsFile(const std::string& AFilename); 00085 void recupLastUndoFromFile(); 00086 void saveLastUndoOnFile(); 00087 void recupFromFiles(); 00088 00089 bool basicUndo(int AStep = 1); 00090 bool basicRedo(int AStep = 1); 00092 00093 protected: 00094 bool FUndoOnFile; 00095 int FNbMaxUndos; 00096 int FLastFileIndex; 00097 std::list<std::ostringstream*> FUndos; 00098 std::list<std::ostringstream*> FRedos; 00099 std::ostringstream* FActu; 00100 00102 00103 //******************************************************************************