diff -r aff86e2f2a4a -r 9c86935835a4 mapeditor.h --- a/mapeditor.h Wed May 02 15:31:18 2007 +0000 +++ b/mapeditor.h Wed May 02 15:31:20 2007 +0000 @@ -13,7 +13,7 @@ #include "settings.h" -/*! \brief Main widget in vym to display and edit the map */ +/*! \brief Main widget in vym to display and edit a map */ class MapEditor : public QGraphicsView, public xmlObj { Q_OBJECT @@ -27,33 +27,66 @@ bool isSaveStateBlocked(); // block while undo/redo or while running scripts void setSaveStateBlocked(bool); -private: +protected: QString getName(const LinkableMapObj*); // Get e.g. heading or filename void makeTmpDirs(); // create temporary directories - QString saveToDir(const QString&,const QString &,bool, const QPointF &,LinkableMapObj*); - void saveStateChangingPart (LinkableMapObj *, LinkableMapObj *, const QString &, const QString &); - void saveStateRemovingPart (LinkableMapObj *, const QString &); - void saveState(LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &); - void saveState(const QString &, const QString &, const QString &, const QString &, const QString &); - void saveState(const SaveMode&, const QString &, const QString &, const QString &, const QString &, const QString &, LinkableMapObj *); + + /*! This function saves all information of the map to disc. + saveToDir also calls the functions for all BranchObj and other objects in the map. + The structure of the map itself is returned as QString and passed back to Main, + where saveToDir is called initially + */ + QString saveToDir (const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, LinkableMapObj *saveSel); + + + /*! \brief Save the current changes in map + + Two commands and selections are saved: + + - undocommand and undoselection to undo the change + - redocommand and redoselection to redo the action after an undo + + Additionally a comment is logged. + + */ + void saveState(const SaveMode& savemode, const QString &undoSelection, const QString &undoCommand, const QString &redoSelection, const QString &redoCommand, const QString &comment, LinkableMapObj *saveSelection); + /*! Overloaded for convenience */ + void saveStateChangingPart(LinkableMapObj *undoSelection, LinkableMapObj* redoSelection, const QString &rendoCommand, const QString &comment); + /*! Overloaded for convenience */ + void saveStateRemovingPart(LinkableMapObj *redoSelection, const QString &comment); + /*! Overloaded for convenience */ + void saveState(LinkableMapObj *undoSelection, const QString &undoCommand, LinkableMapObj *redoSelection, const QString &rendoCommand, const QString &comment); + /*! Overloaded for convenience */ + void saveState(const QString &undoSelection, const QString &undoCommand, const QString &redoSelection, const QString &rendoCommand, const QString &comment) ; + public: - void parseAtom (const QString &); - void runScript (QString); + + /* \brief Process one command and its parameters */ + void parseAtom (const QString &atom); + + /* \brief Runs the script */ + void runScript (QString script); private: void addFloatImageInt(const QPixmap &img); public: - bool isDefault(); // false, if map was changed once - bool isUnsaved(); // save necessary - bool hasChanged(); // undo possible - void setChanged(); // called from NoteEditor via LMO - void closeMap(); - void setFilePath (QString); - void setFilePath (QString,QString); - QString getFilePath (); // Full path e.g. "/home/tux/map.xml" - QString getFileName (); // e.g. "map.xml" - QString getMapName (); // e.g. "map" - QString getDestPath (); // e.g. "/home/tux/map.vym" + bool isDefault(); //!< true, if map is still the empty default map + bool hasChanged(); //!< true, if something has changed and is not saved yet + void setChanged(); //!< called from TextEditor via LinkableMapObj + void closeMap(); //!< Closes the map + + /*! \brief Sets filepath, filename and mapname + + If the filepath is "/home/tux/map.xml", then the filename will be set + to map.xml. The destname is needed for vymLinks, pointing to another map. + The destname holds the real name of the file, after it has been compressed, e.g. "map.vym" + */ + void setFilePath (QString filepath,QString destname); + void setFilePath (QString); //!< Overloaded for convenience + QString getFilePath (); //!< Full path e.g. "/home/tux/map.xml" + QString getFileName (); //!< e.g. "map.xml" + QString getMapName (); //!< e.g. "map" + QString getDestPath (); //!< e.g. "/home/tux/map.vym" ErrorCode load (QString, LoadMode ); // newmap, import/replace selection public: int save(const SaveMode &); // Save map