mapeditor.h
changeset 491 c58b3973337c
parent 486 9c86935835a4
child 502 f3465a5f0dc4
     1.1 --- a/mapeditor.h	Thu May 17 20:19:03 2007 +0000
     1.2 +++ b/mapeditor.h	Thu May 17 20:19:03 2007 +0000
     1.3 @@ -1,7 +1,6 @@
     1.4  #ifndef MAPEDITOR_H
     1.5  #define MAPEDITOR_H
     1.6  
     1.7 -//#include <QBuffer>
     1.8  #include <QGraphicsView>
     1.9  
    1.10  #include "mapcenterobj.h"
    1.11 @@ -19,15 +18,33 @@
    1.12      Q_OBJECT
    1.13  
    1.14  public:
    1.15 +    /*! \brief State of the mapeditor 
    1.16 +		
    1.17 +		While a heading is edited, the state has to change, so
    1.18 +		that e.g. no other object might get selected. This is done
    1.19 +		in Main by calling setStateEditHeading
    1.20 +	*/
    1.21 +	enum State {
    1.22 +		Idle,			//!< Idle, waiting for user event
    1.23 +		EditHeading		//!< Editing heading (dont't select another branch now)
    1.24 +	};
    1.25      MapEditor(QWidget* parent=0);
    1.26  	~MapEditor();
    1.27 -    MapCenterObj* getMapCenter();
    1.28 +    MapCenterObj* getMapCenter();		//!< Return center of map
    1.29  	QGraphicsScene * getScene();
    1.30 -	bool isRepositionBlocked(); // block while load or undo
    1.31 -	bool isSaveStateBlocked();	// block while undo/redo or while running scripts
    1.32 -	void setSaveStateBlocked(bool);
    1.33 +	State getState();					//!< Return State of MapEditor
    1.34 +	void setStateEditHeading (bool);	//!< If set to true, State will change to EditHeading
    1.35 +	bool isRepositionBlocked(); //!< While load or undo there is no need to update graphicsview
    1.36 +	bool isSaveStateBlocked();			//!< block while undo/redo or while running scripts
    1.37 +	void setSaveStateBlocked(bool);		//!< block saving the undo/redo state
    1.38 +	bool isSelectBlocked();		//!< true, if no change of selection is possible, e.g. while editing the heading of abranch
    1.39  	
    1.40  protected:
    1.41 +	/*! \brief Get name of object
    1.42 +	  
    1.43 +	  Returns heading of a branch or name of an object for use in comment
    1.44 +	  of undo/redo history
    1.45 +	*/ 
    1.46  	QString getName(const LinkableMapObj*);	// Get e.g. heading or filename
    1.47  	void makeTmpDirs();		// create temporary directories
    1.48  
    1.49 @@ -81,64 +98,99 @@
    1.50  		 to map.xml. The destname is needed for vymLinks, pointing to another map. 
    1.51  		 The destname holds the real name of the file, after it has been compressed, e.g. "map.vym"
    1.52  	*/	 
    1.53 +
    1.54 +	/*! \brief Set File path
    1.55 +
    1.56 +	     The destname is needed to construct the references between maps
    1.57 +	*/	 
    1.58  	void setFilePath (QString filepath,QString destname);	
    1.59  	void setFilePath (QString);	//!< Overloaded for convenience
    1.60  	QString getFilePath ();	//!< Full path e.g. "/home/tux/map.xml"
    1.61  	QString getFileName ();	//!< e.g. "map.xml"
    1.62  	QString getMapName ();	//!< e.g. "map"
    1.63  	QString getDestPath (); //!< e.g. "/home/tux/map.vym"
    1.64 +
    1.65 +	/*! \brief Load map
    1.66 +
    1.67 +		The data is read from file. Depending on LoadMode the current
    1.68 +		selection gets replaced by data or the data is appended.
    1.69 +	*/	
    1.70      ErrorCode load (QString, LoadMode );	// newmap, import/replace selection
    1.71  public:
    1.72 -    int save(const SaveMode &);	// Save map 
    1.73 -	void setZipped(bool);		// save map zipped
    1.74 -	bool saveZipped();			// 1 if file will be saved zipped
    1.75 -    void print();				// print canvas
    1.76 -	void setAntiAlias (bool);
    1.77 -	void setSmoothPixmap(bool);
    1.78 +	/*! \brief Save the map to file */
    1.79 +    int save(const SaveMode &);	
    1.80 +	void setZipped(bool);		//!< Set or unset compression of map with zip save map zipped
    1.81 +	bool saveZipped();			//!< True, if file will be saved zipped
    1.82 +    void print();				//!< Print the map
    1.83 +	void setAntiAlias (bool);	//!< Set or unset antialiasing
    1.84 +	void setSmoothPixmap(bool); //!< Set or unset smoothing of pixmaps
    1.85  private:
    1.86      QPixmap getPixmap();
    1.87  	void setHideTmpMode (BranchObj::HideTmpMode);	// temporary hide stuff
    1.88  	BranchObj::HideTmpMode getHideTmpMode();		// temporary hide stuff
    1.89  public:
    1.90 -	void setExportMode (bool);			// temporary hide stuff during export
    1.91 -    void exportImage (QString fn);			// export as PNG	
    1.92 -    void exportImage (QString fn, QString);	// export in given format
    1.93 -    void exportOOPresentation(const QString &,const QString &);
    1.94 -    void exportXML(const QString&);		// export to directory
    1.95 -    void clear();		// clear map
    1.96 -    void copy();		// copy branch to clipboard
    1.97 -    void redo();		// redo last action
    1.98 -	bool isRedoAvailable();
    1.99 -    void undo();		// undo last action
   1.100 -	bool isUndoAvailable();
   1.101 -	void gotoHistoryStep (int);// goto a step in history
   1.102 +	void setExportMode (bool);			//!< Set or unset temporary hiding of objects during export
   1.103 +    void exportImage (QString fn);			//!< Export as PNG	
   1.104 +    void exportImage (QString fn, QString);	//!< Export in given format
   1.105 +    void exportOOPresentation(const QString &,const QString &);	//!< Export as OpenOfficeOrg presentation
   1.106 +    void exportXML(const QString&);		//!< Export as XML to directory
   1.107 +    void clear();						//!< Clear map
   1.108 +    void copy();						//!< Copy to clipboard
   1.109 +    void redo();						//!< Redo last action
   1.110 +	bool isRedoAvailable();				//!< True, if redo is available
   1.111 +    void undo();						//!< Undo last action
   1.112 +	bool isUndoAvailable();				//!< True, if undo is available
   1.113 +	void gotoHistoryStep (int);			//!< Goto a specifig step in history
   1.114  private:	
   1.115      void addMapReplaceInt(const QString & undoSel, const QString & path);
   1.116      void addMapInsertInt (const QString & path, int pos);
   1.117      void pasteNoSave();		// paste clipboard to branch
   1.118 -    void cutNoSave();	// cut to clipboard
   1.119  public:	
   1.120 -    void paste();		// paste clipboard to branch and backup
   1.121 -    void cut();			// cut to clipboard and backup
   1.122 +    void paste();		//!< Paste clipboard to branch and backup
   1.123 +    void cut();			//!< Cut to clipboard (and copy)
   1.124 +	/*! \brief Move absolutly
   1.125 +
   1.126 +		Move absolutly to (x,y).
   1.127 +	*/	
   1.128      void move    (const int &x, const int &y);
   1.129 +	/*! \brief Move relativly
   1.130 +
   1.131 +		Move relativly to (x,y).
   1.132 +	*/	
   1.133      void moveRel (const int &x, const int &y);
   1.134 -    void moveBranchUp();
   1.135 -    void moveBranchDown();
   1.136 +    void moveBranchUp();	//!< Move branch up
   1.137 +    void moveBranchDown();	//!< Move branch down
   1.138  private:	
   1.139  	void linkTo(const QString &);
   1.140  public:	
   1.141 -	QString getHeading (bool &ok,QPoint &p); // Get heading, ok if selection is branch
   1.142 -	void setHeading(const QString &);
   1.143 +	QString getHeading (bool &ok,QPoint &p); //!< Get heading, ok if selection is branch
   1.144 +	void setHeading(const QString &);		//!< Set heading of branch	
   1.145  private:
   1.146  	void setHeadingInt(const QString &);
   1.147 -	void setURLInt(const QString &);		// Just set the URL for selection
   1.148  	void setVymLinkInt(const QString &);	// Set vymLink for selection
   1.149 +	/*! \brief Add new branch
   1.150 +
   1.151 +		Depending on num the new branch is created
   1.152 +
   1.153 +		-3 above selection as child of selections parent
   1.154 +		-2 as child of selection
   1.155 +		-1 below selection as child of selections parent
   1.156 +		0..n	insert at a specific position in selections parent
   1.157 +		(needed for free relinking)
   1.158 +	*/	
   1.159      BranchObj* addNewBranchInt(int);		// pos allows to add above/below selection
   1.160  public:	
   1.161 -    BranchObj* addNewBranch(int);			// pos allows to add above/below selection
   1.162 -    BranchObj* addNewBranchBefore();		// insert and make selection its
   1.163 -    void deleteSelection();
   1.164 -	LinkableMapObj* getSelection();			// returns selection
   1.165 +	/*! \Add new branch
   1.166 +		
   1.167 +		Depending on num the new branch is created
   1.168 +		-1 above selection
   1.169 +		 0 as child of selection
   1.170 +		 1 below selection
   1.171 +	*/
   1.172 +    BranchObj* addNewBranch(int pos);		
   1.173 +    BranchObj* addNewBranchBefore();		//!< Insert branch between selection and its parent
   1.174 +    void deleteSelection();					//!< Delete selection
   1.175 +	LinkableMapObj* getSelection();			//!< Returns selection
   1.176  	BranchObj* getSelectedBranch();			// returns selected branch or NULL
   1.177  	FloatImageObj* getSelectedFloatImage();	// returns selected branch or NULL
   1.178  	void unselect();						// before changing current noteedit
   1.179 @@ -232,6 +284,7 @@
   1.180  	bool getHideLinkUnselected ();
   1.181  private:	
   1.182      void importDirInt(BranchObj *,QDir);
   1.183 +    void importDirInt(const QString&);
   1.184  public:	
   1.185      void importDir();
   1.186  	void followXLink (int);
   1.187 @@ -260,6 +313,7 @@
   1.188  	void autosave ();
   1.189  
   1.190  private:
   1.191 +	State state;				// State of MapEditor
   1.192  	QGraphicsScene *mapScene;
   1.193      MapCenterObj* mapCenter;
   1.194  	QTimer *autosaveTimer;