1.1 --- a/mapeditor.h Wed May 02 15:31:18 2007 +0000
1.2 +++ b/mapeditor.h Wed May 02 15:31:20 2007 +0000
1.3 @@ -13,7 +13,7 @@
1.4 #include "settings.h"
1.5
1.6
1.7 -/*! \brief Main widget in vym to display and edit the map */
1.8 +/*! \brief Main widget in vym to display and edit a map */
1.9
1.10 class MapEditor : public QGraphicsView, public xmlObj {
1.11 Q_OBJECT
1.12 @@ -27,33 +27,66 @@
1.13 bool isSaveStateBlocked(); // block while undo/redo or while running scripts
1.14 void setSaveStateBlocked(bool);
1.15
1.16 -private:
1.17 +protected:
1.18 QString getName(const LinkableMapObj*); // Get e.g. heading or filename
1.19 void makeTmpDirs(); // create temporary directories
1.20 - QString saveToDir(const QString&,const QString &,bool, const QPointF &,LinkableMapObj*);
1.21 - void saveStateChangingPart (LinkableMapObj *, LinkableMapObj *, const QString &, const QString &);
1.22 - void saveStateRemovingPart (LinkableMapObj *, const QString &);
1.23 - void saveState(LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &);
1.24 - void saveState(const QString &, const QString &, const QString &, const QString &, const QString &);
1.25 - void saveState(const SaveMode&, const QString &, const QString &, const QString &, const QString &, const QString &, LinkableMapObj *);
1.26 +
1.27 + /*! This function saves all information of the map to disc.
1.28 + saveToDir also calls the functions for all BranchObj and other objects in the map.
1.29 + The structure of the map itself is returned as QString and passed back to Main,
1.30 + where saveToDir is called initially
1.31 + */
1.32 + QString saveToDir (const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, LinkableMapObj *saveSel);
1.33 +
1.34 +
1.35 + /*! \brief Save the current changes in map
1.36 +
1.37 + Two commands and selections are saved:
1.38 +
1.39 + - undocommand and undoselection to undo the change
1.40 + - redocommand and redoselection to redo the action after an undo
1.41 +
1.42 + Additionally a comment is logged.
1.43 +
1.44 + */
1.45 + void saveState(const SaveMode& savemode, const QString &undoSelection, const QString &undoCommand, const QString &redoSelection, const QString &redoCommand, const QString &comment, LinkableMapObj *saveSelection);
1.46 + /*! Overloaded for convenience */
1.47 + void saveStateChangingPart(LinkableMapObj *undoSelection, LinkableMapObj* redoSelection, const QString &rendoCommand, const QString &comment);
1.48 + /*! Overloaded for convenience */
1.49 + void saveStateRemovingPart(LinkableMapObj *redoSelection, const QString &comment);
1.50 + /*! Overloaded for convenience */
1.51 + void saveState(LinkableMapObj *undoSelection, const QString &undoCommand, LinkableMapObj *redoSelection, const QString &rendoCommand, const QString &comment);
1.52 + /*! Overloaded for convenience */
1.53 + void saveState(const QString &undoSelection, const QString &undoCommand, const QString &redoSelection, const QString &rendoCommand, const QString &comment) ;
1.54 +
1.55 public:
1.56 - void parseAtom (const QString &);
1.57 - void runScript (QString);
1.58 +
1.59 + /* \brief Process one command and its parameters */
1.60 + void parseAtom (const QString &atom);
1.61 +
1.62 + /* \brief Runs the script */
1.63 + void runScript (QString script);
1.64 private:
1.65 void addFloatImageInt(const QPixmap &img);
1.66
1.67 public:
1.68 - bool isDefault(); // false, if map was changed once
1.69 - bool isUnsaved(); // save necessary
1.70 - bool hasChanged(); // undo possible
1.71 - void setChanged(); // called from NoteEditor via LMO
1.72 - void closeMap();
1.73 - void setFilePath (QString);
1.74 - void setFilePath (QString,QString);
1.75 - QString getFilePath (); // Full path e.g. "/home/tux/map.xml"
1.76 - QString getFileName (); // e.g. "map.xml"
1.77 - QString getMapName (); // e.g. "map"
1.78 - QString getDestPath (); // e.g. "/home/tux/map.vym"
1.79 + bool isDefault(); //!< true, if map is still the empty default map
1.80 + bool hasChanged(); //!< true, if something has changed and is not saved yet
1.81 + void setChanged(); //!< called from TextEditor via LinkableMapObj
1.82 + void closeMap(); //!< Closes the map
1.83 +
1.84 + /*! \brief Sets filepath, filename and mapname
1.85 +
1.86 + If the filepath is "/home/tux/map.xml", then the filename will be set
1.87 + to map.xml. The destname is needed for vymLinks, pointing to another map.
1.88 + The destname holds the real name of the file, after it has been compressed, e.g. "map.vym"
1.89 + */
1.90 + void setFilePath (QString filepath,QString destname);
1.91 + void setFilePath (QString); //!< Overloaded for convenience
1.92 + QString getFilePath (); //!< Full path e.g. "/home/tux/map.xml"
1.93 + QString getFileName (); //!< e.g. "map.xml"
1.94 + QString getMapName (); //!< e.g. "map"
1.95 + QString getDestPath (); //!< e.g. "/home/tux/map.vym"
1.96 ErrorCode load (QString, LoadMode ); // newmap, import/replace selection
1.97 public:
1.98 int save(const SaveMode &); // Save map