// actionmgr.hpp -- the action manager // // Written by Frederic Bouvier, started May 2002. // // Copyright (C) 2002 Frederic Bouvier - fredb@users.sourceforge.net // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as // published by the Free Software Foundation; either version 2 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // // $Id: actionmgr.hpp,v 1.5 2002/06/21 06:49:09 fredb Exp $ #ifndef _actionmgr_hpp_ #define _actionmgr_hpp_ #ifdef _MSC_VER #pragma warning( disable : 4786 ) #endif #include #include #include #include #include class FGSD_Action; class FGSD_ActionFactory; class SGPropertyNode; class FGSD_ActionManager { public: typedef std::map FactoryMap; typedef std::list ActionList; FGSD_ActionManager(); void registerFactory( const std::string &__name, FGSD_ActionFactory *__fact ); bool loadAndExecute( const char *__project, SGPropertyNode *__node ); bool save( const char *__project, SGPropertyNode *__node ); size_t getWeight( const char *__project, SGPropertyNode *__node ) const; bool getPosition( bool undo, double &lon, double &lat ) const; void clear(); bool undo(); bool redo(); void newAction( FGSD_Action *__action ); bool undoable(); bool redoable(); FGSD_Action *firstUndoable(); FGSD_Action *firstRedoable(); std::vector getUndoDesc() const; std::vector getRedoDesc() const; bool modified() const; private: FactoryMap _factoryMap; ActionList _undoable; ActionList _redoable; SGTimeStamp _lastNewAction; size_t _lastSaveSize; }; #endif