mapeditor.h
branchrelease-1-12-maintained
changeset 74 98449ef9eccd
parent 0 7a96bd401351
     1.1 --- a/mapeditor.h	Mon Jul 27 12:53:19 2009 +0000
     1.2 +++ b/mapeditor.h	Thu Jul 30 07:40:05 2009 +0000
     1.3 @@ -1,88 +1,278 @@
     1.4  #ifndef MAPEDITOR_H
     1.5  #define MAPEDITOR_H
     1.6  
     1.7 -#include <qcanvas.h>
     1.8 -#include <qlineedit.h>
     1.9 -#include <qcursor.h>
    1.10 -#include <qfiledialog.h>
    1.11 -#include <qevent.h>
    1.12 -#include <qprocess.h>
    1.13 +#include <QGraphicsView>
    1.14 +#include <QtNetwork>
    1.15  
    1.16 -#include "mapcenterobj.h"
    1.17 +#include "attribute.h"
    1.18 +#include "file.h"
    1.19  #include "misc.h"
    1.20 +#include "parser.h"
    1.21 +#include "ornamentedobj.h"
    1.22 +#include "selection.h"
    1.23 +#include "settings.h"
    1.24 +#include "vymmodel.h"
    1.25  
    1.26 -class MapEditor : public QCanvasView , public xmlObj {
    1.27 +class VymModel;
    1.28 +class Selection;
    1.29 +
    1.30 +/*! \brief Main widget in vym to display and edit a map */
    1.31 +
    1.32 +class MapEditor : public QGraphicsView, public XMLObj {
    1.33      Q_OBJECT
    1.34  
    1.35  public:
    1.36 -    MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, WFlags f=0);
    1.37 +    /*! \brief State of the mapeditor 
    1.38 +		
    1.39 +		While a heading is edited, the state has to change, so
    1.40 +		that e.g. no other object might get selected. This is done
    1.41 +		in Main by calling setStateEditHeading
    1.42 +	*/
    1.43 +	enum State {
    1.44 +		Idle,			//!< Idle, waiting for user event
    1.45 +		EditHeading		//!< Editing heading (dont't select another branch now)
    1.46 +	};
    1.47 +    /*! \brief Networking states
    1.48 +		
    1.49 +		In Network modus we want to switch of saveState, autosave, ...
    1.50 +	*/
    1.51 +	enum NetState {
    1.52 +		Offline,			//!< Offline
    1.53 +		Client,				//!< I am the client and connected to server
    1.54 +		Server				//!< I am the server
    1.55 +	};
    1.56 +    MapEditor(QWidget* parent=0);
    1.57  	~MapEditor();
    1.58 -    QColor color();
    1.59 -    QColor backgroundColor();
    1.60 -    MapCenterObj* getMapCenter();
    1.61 -	QCanvas* getCanvas();
    1.62 -	void adjustCanvasSize();// adjust canvas size to map and scrollview
    1.63 -	bool blockReposition(); // block while load or undo
    1.64 +	VymModel* getModel();
    1.65 +	QGraphicsScene * getScene();
    1.66 +	State getState();					//!< Return State of MapEditor
    1.67 +	void setStateEditHeading (bool);	//!< If set to true, State will change to EditHeading
    1.68 +	bool isRepositionBlocked(); //!< While load or undo there is no need to update graphicsview
    1.69 +	bool isSaveStateBlocked();			//!< block while undo/redo or while running scripts
    1.70 +	void setSaveStateBlocked(bool);		//!< block saving the undo/redo state
    1.71 +	bool isSelectBlocked();		//!< true, if no change of selection is possible, e.g. while editing the heading of abranch
    1.72  	
    1.73 +protected:
    1.74 +	/*! \brief Get name of object
    1.75 +	  
    1.76 +	  Returns heading of a branch or name of an object for use in comment
    1.77 +	  of undo/redo history
    1.78 +	*/ 
    1.79 +	QString getName(const LinkableMapObj*);	// Get e.g. heading or filename
    1.80 +	void makeTmpDirs();		// create temporary directories
    1.81 +
    1.82 +	/*! This function saves all information of the map to disc.
    1.83 +	    saveToDir also calls the functions for all BranchObj and other objects in the map.
    1.84 +		The structure of the map itself is returned as QString and passed back to Main, 
    1.85 +		where saveToDir is called initially
    1.86 +	*/	
    1.87 +    QString saveToDir (const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, LinkableMapObj *saveSel);
    1.88 +
    1.89 +	/*! \brief Get directory, where current step in history is save
    1.90 +
    1.91 +		saveState creates a directory for each step in history. This function returns the
    1.92 +		path of the current directory
    1.93 +	*/
    1.94 +	QString getHistoryDir();
    1.95 +
    1.96 +	/*! \brief Save the current changes in map 
    1.97 +
    1.98 +		Two commands and selections are saved:
    1.99 +
   1.100 +			- undocommand and undoselection to undo the change
   1.101 +			- redocommand and redoselection to redo the action after an undo
   1.102 +
   1.103 +		Additionally a comment is logged. 
   1.104 +
   1.105 +	*/	
   1.106 +    void saveState(
   1.107 +		const SaveMode& savemode, 
   1.108 +		const QString &undoSelection, 
   1.109 +		const QString &undoCommand, 
   1.110 +		const QString &redoSelection, 
   1.111 +		const QString &redoCommand, 
   1.112 +		const QString &comment, 
   1.113 +		LinkableMapObj *saveSelection);
   1.114 +	/*! Overloaded for convenience */
   1.115 +    void saveStateChangingPart(
   1.116 +		LinkableMapObj *undoSelection, 
   1.117 +		LinkableMapObj* redoSelection, 
   1.118 +		const QString &redoCommand, 
   1.119 +		const QString &comment);
   1.120 +	/*! Overloaded for convenience */
   1.121 +    void saveStateRemovingPart(
   1.122 +		LinkableMapObj *redoSelection, 
   1.123 +		const QString &comment);
   1.124 +	/*! Overloaded for convenience */
   1.125 +    void saveState(
   1.126 +		LinkableMapObj *undoSelection, 
   1.127 +		const QString &undoCommand, 
   1.128 +		LinkableMapObj *redoSelection, 
   1.129 +		const QString &redoCommand, 
   1.130 +		const QString &comment); 
   1.131 +	/*! Overloaded for convenience */
   1.132 +    void saveState(
   1.133 +		const QString &undoSelection, 
   1.134 +		const QString &undoCommand, 
   1.135 +		const QString &redoSelection, 
   1.136 +		const QString &redoCommand, 
   1.137 +		const QString &comment) ;
   1.138 +    void saveState(
   1.139 +		const QString &undoCommand, 
   1.140 +		const QString &redoCommand, 
   1.141 +		const QString &comment) ;
   1.142 +
   1.143 +public:	
   1.144 +
   1.145 +	/* \brief Process one command and its parameters */
   1.146 +    void parseAtom (const QString &atom);	
   1.147 +
   1.148 +	/* \brief Runs the script */
   1.149 +	void runScript (QString script);
   1.150  private:
   1.151 -	void makeTmpDirs();		// create temporary directories
   1.152 -	void delTmpDirs();		// delete temporary directories
   1.153 -	void makeSubDirs(const QString&);		
   1.154 -							// create subdirs in dir
   1.155 -    QString saveToDir(const QString&,const QString &,bool, const QPoint
   1.156 -	&,SaveMode);
   1.157 -    void saveState();		// save actual state to backup
   1.158 -    void saveState(const SaveMode&, LinkableMapObj *);
   1.159 -
   1.160 -private slots:
   1.161 -    void finishedLineEditNoSave();
   1.162 +    void addFloatImageInt(const QPixmap &img);
   1.163  
   1.164  public:
   1.165 -	bool isDefault();		// false, if map was changed once
   1.166 -    bool isUnsaved();		// save necessary
   1.167 -    bool hasChanged();		// undo possible
   1.168 -	void setChanged();		// called from NoteEditor via LMO
   1.169 -	void closeMap();
   1.170 -	void setFilePath (QString);	
   1.171 -	void setFilePath (QString,QString);	
   1.172 -	QString getFilePath ();	// Full path e.g. "/home/tux/map.xml"
   1.173 -	QString getFileName ();	// e.g. "map.xml"
   1.174 -	QString getMapName ();	// e.g. "map"
   1.175 -	QString getDestPath (); // e.g. "/home/tux/map.vym"
   1.176 -    int load (QString&, const LoadMode &);	// newmap, import/replace selection
   1.177 -    int save(const SaveMode &);	// Save map 
   1.178 -	void setZipped(bool);		// save map zipped
   1.179 -	bool saveZipped();			// 1 if file will be saved zipped
   1.180 -    void print();				// print canvas
   1.181 +	bool isDefault();		//!< true, if map is still the empty default map
   1.182 +    bool hasChanged();		//!< true, if something has changed and is not saved yet
   1.183 +	void setChanged();		//!< called from TextEditor via LinkableMapObj
   1.184 +	void closeMap();		//!< Closes the map
   1.185 +
   1.186 +	/*! \brief Sets filepath, filename and mapname
   1.187 +
   1.188 +	     If the filepath is "/home/tux/map.xml", then the filename will be set
   1.189 +		 to map.xml. The destname is needed for vymLinks, pointing to another map. 
   1.190 +		 The destname holds the real name of the file, after it has been compressed, e.g. "map.vym"
   1.191 +	*/	 
   1.192 +
   1.193 +	/*! \brief Set File path
   1.194 +
   1.195 +	     The destname is needed to construct the references between maps
   1.196 +	*/	 
   1.197 +	void setFilePath (QString filepath,QString destname);	
   1.198 +	void setFilePath (QString);	//!< Overloaded for convenience
   1.199 +	QString getFilePath ();	//!< Full path e.g. "/home/tux/map.xml"
   1.200 +	QString getFileName ();	//!< e.g. "map.xml"
   1.201 +	QString getMapName ();	//!< e.g. "map"
   1.202 +	QString getDestPath (); //!< e.g. "/home/tux/map.vym"
   1.203 +
   1.204 +	/*! \brief Load map
   1.205 +
   1.206 +		The data is read from file. Depending on LoadMode the current
   1.207 +		selection gets replaced by data or the data is appended.
   1.208 +	*/	
   1.209 +    ErrorCode load (QString, const LoadMode &, const FileType& );	// newmap, import/replace selection
   1.210 +public:
   1.211 +	/*! \brief Save the map to file */
   1.212 +    ErrorCode save(const SaveMode &);	
   1.213 +	/* FIXME no needed any longer
   1.214 +	void setZipped(bool);		//!< Set or unset compression of map with zip save map zipped
   1.215 +	bool saveZipped();			//!< True, if file will be saved zipped
   1.216 +	*/
   1.217 +    void print();				//!< Print the map
   1.218 +	void setAntiAlias (bool);	//!< Set or unset antialiasing
   1.219 +	void setSmoothPixmap(bool); //!< Set or unset smoothing of pixmaps
   1.220  private:
   1.221      QPixmap getPixmap();
   1.222 +	void setHideTmpMode (HideTmpMode);	// temporary hide stuff
   1.223 +	HideTmpMode getHideTmpMode();		// temporary hide stuff
   1.224  public:
   1.225 -    void exportImage (QString fn);		// export as PNG	
   1.226 -    void exportImage (QString fn, int);	// export in given format
   1.227 -    void exportASCII();
   1.228 -    void exportXML(const QString&);		// export to directory
   1.229 -    void clear();		// clear map
   1.230 -    void undo();		// undo last action
   1.231 -    void copy();		// copy branch to clipboard
   1.232 +	/*! Set or unset temporary hiding of objects during export  */
   1.233 +	void setExportMode (bool);
   1.234 +
   1.235 +	/*! Export as ASCII text to file */
   1.236 +	void exportASCII (QString fname="",bool askForName=true);  
   1.237 +
   1.238 +	/*! Save as image */
   1.239 +    void exportImage (QString fname="",bool askForName=true,QString format="PNG");
   1.240 +
   1.241 +    /*! Export as OpenOfficeOrg presentation */
   1.242 +    void exportOOPresentation(const QString &,const QString &);	
   1.243 +
   1.244 +	/*! Export as XHTML to directory */
   1.245 +    void exportXHTML(const QString& dir="", bool askForName=true);	
   1.246 +
   1.247 +	/*! Export as XTML to directory */
   1.248 +    void exportXML(QString dir="", bool askForName=true);
   1.249 +
   1.250 +    void clear();						//!< Clear map
   1.251 +    void copy();						//!< Copy to clipboard
   1.252 +    void redo();						//!< Redo last action
   1.253 +	bool isRedoAvailable();				//!< True, if redo is available
   1.254 +    void undo();						//!< Undo last action
   1.255 +	bool isUndoAvailable();				//!< True, if undo is available
   1.256 +	void gotoHistoryStep (int);			//!< Goto a specifig step in history
   1.257  private:	
   1.258 -    LinkableMapObj* pasteNoSave();		// paste clipboard to branch
   1.259 -    LinkableMapObj* pasteAtNoSave(int);	// paste clipboard to branch at position i
   1.260 -    void cutNoSave();	// cut to clipboard
   1.261 +    void addMapReplaceInt(const QString & undoSel, const QString & path);
   1.262 +    bool addMapInsertInt (const QString & path);
   1.263 +    bool addMapInsertInt (const QString & path, int pos);
   1.264 +    void pasteNoSave(const int &n);		//!< paste clipboard to branch
   1.265  public:	
   1.266 -    void paste();		// paste clipboard to branch and backup
   1.267 -    void cut();			// cut to clipboard and backup
   1.268 -    void moveBranchUp();
   1.269 -    void moveBranchDown();
   1.270 -    void editHeading();
   1.271 -    void addNewBranch(int);			// pos allows to add above/below selection
   1.272 -    void deleteSelection();
   1.273 -	LinkableMapObj* getSelection();	// returns selection
   1.274 -	bool select(QString );			// Select 
   1.275 -	void unselect();				// before changing current noteedit
   1.276 -	void reselect();				// after  changing current noteedit
   1.277 +    void paste();		//!< Paste clipboard to branch and backup
   1.278 +    void cut();			//!< Cut to clipboard (and copy)
   1.279 +	/*! \brief Move absolutly
   1.280 +
   1.281 +		Move absolutly to (x,y).
   1.282 +	*/	
   1.283 +    void move    (const double &x, const double &y);
   1.284 +	/*! \brief Move relativly
   1.285 +
   1.286 +		Move relativly to (x,y).
   1.287 +	*/	
   1.288 +    void moveRel (const double &x, const double &y);
   1.289 +    void moveBranchUp();	//!< Move branch up
   1.290 +    void moveBranchDown();	//!< Move branch down
   1.291 +	void sortChildren();	//!< Sort children lexically
   1.292  private:	
   1.293 -	void selectNextBranch();		// Increment number of branch
   1.294 -	void selectPrevBranch();		// Decrement number of branch
   1.295 +	void linkTo(const QString &);
   1.296 +public:	
   1.297 +	QString getHeading (bool &ok,QPoint &p); //!< Get heading, ok if selection is branch
   1.298 +	void setHeading(const QString &);		//!< Set heading of branch	
   1.299 +private:
   1.300 +	void setHeadingInt(const QString &);
   1.301 +	void setVymLinkInt(const QString &);	// Set vymLink for selection
   1.302 +	/*! \brief Add new mapcenter
   1.303 +
   1.304 +	    Disclaimer: Still experimental, not fully supported.
   1.305 +	*/	
   1.306 +public:	
   1.307 +    BranchObj* addMapCenter();		
   1.308 +
   1.309 +	/*! \brief Add new branch
   1.310 +
   1.311 +		Depending on num the new branch is created
   1.312 +
   1.313 +		-3 above selection as child of selections parent
   1.314 +		-2 as child of selection
   1.315 +		-1 below selection as child of selections parent
   1.316 +		0..n	insert at a specific position in selections parent
   1.317 +		(needed for free relinking)
   1.318 +	*/	
   1.319 +private:	
   1.320 +    BranchObj* addNewBranchInt(int);		// pos allows to add above/below selection
   1.321 +public:	
   1.322 +	/*! \Add new branch
   1.323 +		
   1.324 +		Depending on num the new branch is created
   1.325 +		-1 above selection
   1.326 +		 0 as child of selection
   1.327 +		 1 below selection
   1.328 +	*/
   1.329 +    BranchObj* addNewBranch(int pos);		
   1.330 +    BranchObj* addNewBranchBefore();		//!< Insert branch between selection and its parent
   1.331 +    void deleteSelection();					//!< Delete selection
   1.332 +	LinkableMapObj* getSelection();			//!< Returns selection
   1.333 +	BranchObj* getSelectedBranch();			// returns selected branch or NULL
   1.334 +	FloatImageObj* getSelectedFloatImage();	// returns selected branch or NULL
   1.335 +	void unselect();						// before changing current noteedit
   1.336 +	void reselect();						// after  changing current noteedit
   1.337 +	bool select(const QString &);			// Select by string
   1.338 +	bool select(LinkableMapObj *lmo);		// Select by pointer
   1.339 +	QString getSelectString();
   1.340 +private:	
   1.341 +	void selectInt(LinkableMapObj*);	
   1.342 +	void selectNextBranchInt();		// Increment number of branch
   1.343 +	void selectPrevBranchInt();		// Decrement number of branch
   1.344  public:	
   1.345      void selectUpperBranch();
   1.346      void selectLowerBranch();
   1.347 @@ -90,108 +280,215 @@
   1.348      void selectRightBranch();
   1.349      void selectFirstBranch();
   1.350      void selectLastBranch();
   1.351 -    void setColor(QColor);
   1.352 -    void selectBackgroundColor();
   1.353 -    void setBackgroundColor(QColor);
   1.354 -    QColor pickColor();
   1.355 -    void colorItem();
   1.356 -    void colorBranch();
   1.357 +    void selectMapBackgroundImage();
   1.358 +    void setMapBackgroundImage(const QString &);
   1.359 +    void selectMapBackgroundColor();
   1.360 +    void setMapBackgroundColor(QColor);
   1.361 +    QColor getMapBackgroundColor();
   1.362 +    QColor getCurrentHeadingColor();
   1.363 +    void colorBranch(QColor);
   1.364 +    void colorSubtree(QColor);
   1.365  	void toggleStandardFlag(QString);
   1.366 -	virtual void setViewCenter();			// needed for zooming
   1.367      BranchObj* findText(QString,bool);		// Find object
   1.368      void findReset();						// Reset Find 
   1.369 -	void openURL();							// open URL in external browser
   1.370 -	void editURL();							// edit the URL
   1.371 +	void setURL(const QString &);			// set  URL
   1.372 +	void editURL();							// edit URL
   1.373 +	void editLocalURL();					// edit URL to local file
   1.374 +	QString getURL();						// returns URL of selection or ""
   1.375 +	QStringList getURLs();					// returns URLs of subtree
   1.376  	void editHeading2URL();					// copy heading to URL
   1.377  	void editBugzilla2URL();				// create URL to Bugzilla
   1.378 +	void editFATE2URL();					// create URL to FATE
   1.379  	void editVymLink();						// edit link to another map
   1.380  	void deleteVymLink();					// delete link to another map
   1.381  	QString getVymLink();					// return path to map
   1.382 +	QStringList getVymLinks();				// return paths in subtree
   1.383 +	void setHideExport(bool);				// toggle the export flag
   1.384 +	void toggleHideExport();				// toggle the export flag
   1.385 +	void deleteKeepChilds();				// remove but keep childs
   1.386 +	void deleteChilds();					// remove childs
   1.387  	void editMapInfo();						// dialog to enter author, ...
   1.388 +	void ensureSelectionVisible();		
   1.389 +	void updateSelection();					// update geometry of selection
   1.390  	void updateActions();					// update e.g. format buttons
   1.391 -	void setLinkStyle (LinkStyle);			// Set style of link
   1.392 -	LinkStyle getLinkStyle ();				// requested in LMO
   1.393 -	void setLinkColor(QColor);				// default color of links
   1.394 -	void setLinkColorHint();				// color of links
   1.395 -	void setLinkColorHint(LinkColorHint);	// color of links
   1.396 -	LinkColorHint getLinkColorHint();
   1.397 -	QColor getDefLinkColor();
   1.398 -	void toggleLinkColorHint();				// after changing linkStyles
   1.399 -    void selectLinkColor();
   1.400 +	void updateNoteFlag();					// when TextEditor changes
   1.401 +	void setMapAuthor (const QString &);
   1.402 +	void setMapComment(const QString &);
   1.403 +	void setMapLinkStyle (const QString &);	// Set style of link
   1.404 +	LinkableMapObj::Style getMapLinkStyle ();	// requested in LMO
   1.405 +	void setMapDefLinkColor(QColor);		// default color of links
   1.406 +	void setMapLinkColorHintInt();			// color of links
   1.407 +	void setMapLinkColorHint(LinkableMapObj::ColorHint);// color of links
   1.408 +	LinkableMapObj::ColorHint getMapLinkColorHint();
   1.409 +	QColor getMapDefLinkColor();
   1.410 +	void setMapDefXLinkColor(QColor);
   1.411 +	QColor getMapDefXLinkColor();
   1.412 +	void setMapDefXLinkWidth (int);
   1.413 +	int getMapDefXLinkWidth();
   1.414 +	void toggleMapLinkColorHint();			// after changing linkStyles
   1.415 +    void selectMapLinkColor();
   1.416 +    void selectMapSelectionColor();
   1.417 +private:	
   1.418 +    void setSelectionColorInt(QColor);
   1.419 +public:	
   1.420 +    void setSelectionColor(QColor);
   1.421 +    QColor getSelectionColor();
   1.422 +	bool scrollBranch(BranchObj*);
   1.423 +	bool unscrollBranch(BranchObj*);
   1.424      void toggleScroll();
   1.425 -    void unScrollAll();
   1.426 +    void unscrollChilds();
   1.427 +private:	
   1.428 +	FloatImageObj* loadFloatImageInt (QString);
   1.429 +public:	
   1.430  	void loadFloatImage ();
   1.431 -	void saveFloatImage (int);
   1.432 -	void toggleFloatExport();
   1.433 -	void setFrame(const FrameType &);
   1.434  private:	
   1.435 -    void importDir(BranchObj *,QDir);
   1.436 +	void saveFloatImageInt (FloatImageObj*, const QString &, const QString &);
   1.437 +public:	
   1.438 +	void saveFloatImage ();
   1.439 +	void setFrameType(const FrameObj::FrameType &);
   1.440 +	void setFrameType(const QString &);
   1.441 +	void setFramePenColor (const QColor &);
   1.442 +	void setFrameBrushColor (const QColor &);
   1.443 +	void setFramePadding (const int &);
   1.444 +	void setFrameBorderWidth (const int &);
   1.445 +	void setIncludeImagesVer(bool);
   1.446 +	void setIncludeImagesHor(bool);
   1.447 +	void setHideLinkUnselected (bool);
   1.448 +	bool getHideLinkUnselected ();
   1.449 +private:	
   1.450 +    void importDirInt(BranchObj *,QDir);
   1.451 +    void importDirInt(const QString&);
   1.452  public:	
   1.453      void importDir();
   1.454 -    void testFunction();				// FIXME just testing
   1.455 +	void followXLink (int);
   1.456 +	void editXLink (int);
   1.457 +	AttributeTable* attributeTable();
   1.458 +    void testFunction1();					// just testing new stuff
   1.459 +    void testFunction2();					// just testing new stuff
   1.460 +											// set /mainwindo/showTestMenu=true...
   1.461  
   1.462  protected:
   1.463 -	void ensureSelectionVisible();		
   1.464 -	virtual void updateViewCenter();	// needed for zooming
   1.465 -	virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
   1.466 -    virtual void contentsMousePressEvent(QMouseEvent*);
   1.467 -    virtual void contentsMouseReleaseEvent(QMouseEvent*);
   1.468 -    virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
   1.469 -    virtual void contentsMouseMoveEvent(QMouseEvent*);
   1.470 +	virtual void contextMenuEvent ( QContextMenuEvent *e );
   1.471 +    virtual void keyPressEvent(QKeyEvent*);
   1.472 +    virtual void keyReleaseEvent(QKeyEvent*);
   1.473 +    virtual void mousePressEvent(QMouseEvent*);
   1.474 +    virtual void mouseMoveEvent(QMouseEvent*);
   1.475 +    virtual void mouseReleaseEvent(QMouseEvent*);
   1.476 +    virtual void mouseDoubleClickEvent(QMouseEvent*);
   1.477 +    virtual void resizeEvent( QResizeEvent * );
   1.478 +
   1.479 +	void dragEnterEvent (QDragEnterEvent *);
   1.480 +	void dragMoveEvent (QDragMoveEvent *);
   1.481 +	void dragLeaveEvent (QDragLeaveEvent *);
   1.482 +	void dropEvent (QDropEvent *);
   1.483 +
   1.484 +
   1.485 +protected:
   1.486 +	void sendSelection();
   1.487 +
   1.488 +public:
   1.489 +	void newServer();
   1.490 +	void connectToServer();
   1.491 +
   1.492 +private slots:	
   1.493 +	void newClient();
   1.494 +	void sendData(const QString &s);
   1.495 +	void readData();
   1.496 +	void displayNetworkError (QAbstractSocket::SocketError);
   1.497 +
   1.498 +	void autosave ();
   1.499 +	void fileChanged();
   1.500  
   1.501  private:
   1.502 -    QCanvas* mapCanvas;
   1.503 -    MapCenterObj* mapCenter;
   1.504 +	State state;				// State of MapEditor
   1.505 +	QGraphicsScene *mapScene;
   1.506 +	VymModel *model;					// Vym Map, includding several mapCenters
   1.507 +	QTimer *autosaveTimer;
   1.508 +	QTimer *fileChangedTimer;
   1.509 +	QDateTime fileChangedTime;
   1.510  
   1.511  	bool adjustCanvasRequested;	// collect requests until end of user event
   1.512  	BranchObj *editingBO;		// entering Text into BO
   1.513 -    QLineEdit* lineedit;
   1.514  
   1.515 -    QColor actColor;			// actual color
   1.516 -	QColor deflinkcolor;		// default color for links
   1.517 -	LinkColorHint linkcolorhint;// use heading color or own color
   1.518 -	LinkStyle linkstyle;		// default style for links
   1.519 +	QColor defLinkColor;		// default color for links
   1.520 +	QColor defXLinkColor;		// default color for xlinks
   1.521 +	int defXLinkWidth;			// default width for xlinks
   1.522 +	LinkableMapObj::ColorHint linkcolorhint;// use heading color or own color
   1.523 +	LinkableMapObj::Style linkstyle;		// default style for links
   1.524  
   1.525 -    QCursor handOpenCursor;		// cursor while moving canvas view
   1.526 -	QCursor pickColorCursor;	// cursor while picking color 
   1.527 -	bool pickingColor;			// true while picking Color CTRL-LeftButton
   1.528 -	
   1.529 -    LinkableMapObj* selection;		// select a LinkableMapObj
   1.530 -    LinkableMapObj* selectionLast;	// last selection 
   1.531 +    QCursor HandOpenCursor;		// cursor while moving canvas view
   1.532 +	QCursor PickColorCursor;	// cursor while picking color 
   1.533 +	QCursor CopyCursor;			// cursor while picking color 
   1.534 +	QCursor XLinkCursor;		// cursor while picking color 
   1.535 +	bool pickingColor;
   1.536 +	bool drawingLink;			// true while creating a link
   1.537 +	bool copyingObj;			// true while creating a link
   1.538 +	XLinkObj* tmpXLink;
   1.539 +
   1.540 +	Selection xelection;	
   1.541 +
   1.542 +	QString latestSelection;		// select string of latest added object
   1.543 +
   1.544      MapObj* movingObj;				// moving a MapObj
   1.545 -    QPoint movingObj_start;			// rel. pos of mouse to absPos 
   1.546 -    QPoint movingCont_start;		// inital pos of moving Content or
   1.547 -    QPoint movingVec;				// how far has Content moved
   1.548 -	QPoint movingCenter;			// used when zooming
   1.549 +	MapObj* linkingObj_src;			// part of a link
   1.550 +    QPointF movingObj_orgPos;		// org. pos of mouse before move
   1.551 +    QPointF movingObj_orgRelPos;	// org. relative pos of mouse before move
   1.552 +    QPointF movingObj_start;		// rel. pos of mouse to absPos 
   1.553 +    QPointF movingCont_start;		// inital pos of moving Content or
   1.554 +    QPointF movingVec;				// how far has Content moved
   1.555 +
   1.556 +	QPointF contextMenuPos;					// position where context event was triggered
   1.557 +
   1.558      QPrinter* printer;				// Printing
   1.559  
   1.560      bool mapDefault;				// Flag if map is untouched
   1.561      bool mapChanged;				// Flag if undo is possible
   1.562  	bool mapUnsaved;				// Flag if map should be saved
   1.563 -    QString backupXML;				// backup (XML) for undo
   1.564 -	LinkableMapObj* undoSelection;	// replace this LMO with vympart from backup
   1.565 -									// if != NULL
   1.566 +
   1.567 +	Parser parser;				// Parser stuff for scripting
   1.568 +
   1.569 +	AttributeTable *attrTable;
   1.570  
   1.571  	bool printFrame;			// Print frame around map
   1.572  	bool printFooter;			// Print footer below map
   1.573  
   1.574  	bool zipped;				// should map be zipped
   1.575 +	static	int mapNum;			// unique number for Editor
   1.576 +	FileType fileType;			// type of file, e.g. vym, freemind...
   1.577  	QString fileName;			// short name of file (for tab)
   1.578  	QString filePath;			// path to file which will be saved
   1.579  	QString fileDir;			// dir where file is saved
   1.580  	QString destPath;			// path to .vym file (needed for vymlinks)
   1.581  	QString mapName;			// fileName without ".vym"
   1.582 -	QString lastImageDir;		// save dir for adding images
   1.583  
   1.584 -	bool isInteractive;			// non interactive don't need tmpdirs
   1.585 -	QString bakMapDir;			// tmp directory with data for undo
   1.586 -	bool blockreposition;		// block while load or undo
   1.587 +	QString tmpMapDir;			// tmp directory with undo history
   1.588 +	QString histPath;			// Path to history file
   1.589 +	SimpleSettings undoSet;		// undo/redo commands, saved in histPath
   1.590 +	int stepsTotal;				// total number of steps (undos+redos) 
   1.591 +	int curStep;				// Current step in history (ring buffer)
   1.592 +	int curClipboard;			// number of history step, which is the current clipboard
   1.593 +	int redosAvail;				// Available number of redo steps
   1.594 +	int undosAvail;				// Available number of undo steps
   1.595 +	bool blockReposition;		// block while load or undo
   1.596 +	bool blockSaveState;		// block while load or undo
   1.597  
   1.598  	BranchObj* itFind;			// next object in find process
   1.599  	bool EOFind;				// true, if search failed
   1.600  
   1.601  	QPoint exportOffset;		// set before export, used in save
   1.602 -    void resizeEvent( QResizeEvent * );
   1.603 +	HideTmpMode hidemode;	// true while exporting to hide some stuff
   1.604 +
   1.605 +	// Network connections **Experimental**
   1.606 +	NetState netstate;			// offline, client, server
   1.607 +	QTcpServer *tcpServer;		// Act as server in conference mode (experimental)
   1.608 +	QList <QTcpSocket*> clientList;		// List of connected clients
   1.609 +	quint16 sendCounter;		// Increased with every sent command
   1.610 +
   1.611 +	QTcpSocket	*clientSocket;	// socket of this client
   1.612 +	QString server;				// server address of this client
   1.613 +	int port;					// server port of this client
   1.614 +	void displayClientError(QAbstractSocket::SocketError socketError);
   1.615 +
   1.616  };
   1.617  #endif
   1.618