diff -r a6499713d8ae -r c58b3973337c mapeditor.h --- a/mapeditor.h Thu May 17 20:19:03 2007 +0000 +++ b/mapeditor.h Thu May 17 20:19:03 2007 +0000 @@ -1,7 +1,6 @@ #ifndef MAPEDITOR_H #define MAPEDITOR_H -//#include #include #include "mapcenterobj.h" @@ -19,15 +18,33 @@ Q_OBJECT public: + /*! \brief State of the mapeditor + + While a heading is edited, the state has to change, so + that e.g. no other object might get selected. This is done + in Main by calling setStateEditHeading + */ + enum State { + Idle, //!< Idle, waiting for user event + EditHeading //!< Editing heading (dont't select another branch now) + }; MapEditor(QWidget* parent=0); ~MapEditor(); - MapCenterObj* getMapCenter(); + MapCenterObj* getMapCenter(); //!< Return center of map QGraphicsScene * getScene(); - bool isRepositionBlocked(); // block while load or undo - bool isSaveStateBlocked(); // block while undo/redo or while running scripts - void setSaveStateBlocked(bool); + State getState(); //!< Return State of MapEditor + void setStateEditHeading (bool); //!< If set to true, State will change to EditHeading + bool isRepositionBlocked(); //!< While load or undo there is no need to update graphicsview + bool isSaveStateBlocked(); //!< block while undo/redo or while running scripts + void setSaveStateBlocked(bool); //!< block saving the undo/redo state + bool isSelectBlocked(); //!< true, if no change of selection is possible, e.g. while editing the heading of abranch protected: + /*! \brief Get name of object + + Returns heading of a branch or name of an object for use in comment + of undo/redo history + */ QString getName(const LinkableMapObj*); // Get e.g. heading or filename void makeTmpDirs(); // create temporary directories @@ -81,64 +98,99 @@ 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" */ + + /*! \brief Set File path + + The destname is needed to construct the references between maps + */ 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" + + /*! \brief Load map + + The data is read from file. Depending on LoadMode the current + selection gets replaced by data or the data is appended. + */ ErrorCode load (QString, LoadMode ); // newmap, import/replace selection public: - int save(const SaveMode &); // Save map - void setZipped(bool); // save map zipped - bool saveZipped(); // 1 if file will be saved zipped - void print(); // print canvas - void setAntiAlias (bool); - void setSmoothPixmap(bool); + /*! \brief Save the map to file */ + int save(const SaveMode &); + void setZipped(bool); //!< Set or unset compression of map with zip save map zipped + bool saveZipped(); //!< True, if file will be saved zipped + void print(); //!< Print the map + void setAntiAlias (bool); //!< Set or unset antialiasing + void setSmoothPixmap(bool); //!< Set or unset smoothing of pixmaps private: QPixmap getPixmap(); void setHideTmpMode (BranchObj::HideTmpMode); // temporary hide stuff BranchObj::HideTmpMode getHideTmpMode(); // temporary hide stuff public: - void setExportMode (bool); // temporary hide stuff during export - void exportImage (QString fn); // export as PNG - void exportImage (QString fn, QString); // export in given format - void exportOOPresentation(const QString &,const QString &); - void exportXML(const QString&); // export to directory - void clear(); // clear map - void copy(); // copy branch to clipboard - void redo(); // redo last action - bool isRedoAvailable(); - void undo(); // undo last action - bool isUndoAvailable(); - void gotoHistoryStep (int);// goto a step in history + void setExportMode (bool); //!< Set or unset temporary hiding of objects during export + void exportImage (QString fn); //!< Export as PNG + void exportImage (QString fn, QString); //!< Export in given format + void exportOOPresentation(const QString &,const QString &); //!< Export as OpenOfficeOrg presentation + void exportXML(const QString&); //!< Export as XML to directory + void clear(); //!< Clear map + void copy(); //!< Copy to clipboard + void redo(); //!< Redo last action + bool isRedoAvailable(); //!< True, if redo is available + void undo(); //!< Undo last action + bool isUndoAvailable(); //!< True, if undo is available + void gotoHistoryStep (int); //!< Goto a specifig step in history private: void addMapReplaceInt(const QString & undoSel, const QString & path); void addMapInsertInt (const QString & path, int pos); void pasteNoSave(); // paste clipboard to branch - void cutNoSave(); // cut to clipboard public: - void paste(); // paste clipboard to branch and backup - void cut(); // cut to clipboard and backup + void paste(); //!< Paste clipboard to branch and backup + void cut(); //!< Cut to clipboard (and copy) + /*! \brief Move absolutly + + Move absolutly to (x,y). + */ void move (const int &x, const int &y); + /*! \brief Move relativly + + Move relativly to (x,y). + */ void moveRel (const int &x, const int &y); - void moveBranchUp(); - void moveBranchDown(); + void moveBranchUp(); //!< Move branch up + void moveBranchDown(); //!< Move branch down private: void linkTo(const QString &); public: - QString getHeading (bool &ok,QPoint &p); // Get heading, ok if selection is branch - void setHeading(const QString &); + QString getHeading (bool &ok,QPoint &p); //!< Get heading, ok if selection is branch + void setHeading(const QString &); //!< Set heading of branch private: void setHeadingInt(const QString &); - void setURLInt(const QString &); // Just set the URL for selection void setVymLinkInt(const QString &); // Set vymLink for selection + /*! \brief Add new branch + + Depending on num the new branch is created + + -3 above selection as child of selections parent + -2 as child of selection + -1 below selection as child of selections parent + 0..n insert at a specific position in selections parent + (needed for free relinking) + */ BranchObj* addNewBranchInt(int); // pos allows to add above/below selection public: - BranchObj* addNewBranch(int); // pos allows to add above/below selection - BranchObj* addNewBranchBefore(); // insert and make selection its - void deleteSelection(); - LinkableMapObj* getSelection(); // returns selection + /*! \Add new branch + + Depending on num the new branch is created + -1 above selection + 0 as child of selection + 1 below selection + */ + BranchObj* addNewBranch(int pos); + BranchObj* addNewBranchBefore(); //!< Insert branch between selection and its parent + void deleteSelection(); //!< Delete selection + LinkableMapObj* getSelection(); //!< Returns selection BranchObj* getSelectedBranch(); // returns selected branch or NULL FloatImageObj* getSelectedFloatImage(); // returns selected branch or NULL void unselect(); // before changing current noteedit @@ -232,6 +284,7 @@ bool getHideLinkUnselected (); private: void importDirInt(BranchObj *,QDir); + void importDirInt(const QString&); public: void importDir(); void followXLink (int); @@ -260,6 +313,7 @@ void autosave (); private: + State state; // State of MapEditor QGraphicsScene *mapScene; MapCenterObj* mapCenter; QTimer *autosaveTimer;