mapeditor.h
author insilmaril
Fri Mar 05 20:16:46 2010 +0000 (2010-03-05)
branchrelease-1-12-maintained
changeset 80 5c5b4464b24f
parent 0 7a96bd401351
permissions -rw-r--r--
Some changes by Tagg for Win version
insilmaril@0
     1
#ifndef MAPEDITOR_H
insilmaril@0
     2
#define MAPEDITOR_H
insilmaril@0
     3
insilmaril@74
     4
#include <QGraphicsView>
insilmaril@74
     5
#include <QtNetwork>
insilmaril@0
     6
insilmaril@74
     7
#include "attribute.h"
insilmaril@74
     8
#include "file.h"
insilmaril@0
     9
#include "misc.h"
insilmaril@74
    10
#include "parser.h"
insilmaril@74
    11
#include "ornamentedobj.h"
insilmaril@74
    12
#include "selection.h"
insilmaril@74
    13
#include "settings.h"
insilmaril@74
    14
#include "vymmodel.h"
insilmaril@0
    15
insilmaril@74
    16
class VymModel;
insilmaril@74
    17
class Selection;
insilmaril@74
    18
insilmaril@74
    19
/*! \brief Main widget in vym to display and edit a map */
insilmaril@74
    20
insilmaril@74
    21
class MapEditor : public QGraphicsView, public XMLObj {
insilmaril@0
    22
    Q_OBJECT
insilmaril@0
    23
insilmaril@0
    24
public:
insilmaril@74
    25
    /*! \brief State of the mapeditor 
insilmaril@74
    26
		
insilmaril@74
    27
		While a heading is edited, the state has to change, so
insilmaril@74
    28
		that e.g. no other object might get selected. This is done
insilmaril@74
    29
		in Main by calling setStateEditHeading
insilmaril@74
    30
	*/
insilmaril@74
    31
	enum State {
insilmaril@74
    32
		Idle,			//!< Idle, waiting for user event
insilmaril@74
    33
		EditHeading		//!< Editing heading (dont't select another branch now)
insilmaril@74
    34
	};
insilmaril@74
    35
    /*! \brief Networking states
insilmaril@74
    36
		
insilmaril@74
    37
		In Network modus we want to switch of saveState, autosave, ...
insilmaril@74
    38
	*/
insilmaril@74
    39
	enum NetState {
insilmaril@74
    40
		Offline,			//!< Offline
insilmaril@74
    41
		Client,				//!< I am the client and connected to server
insilmaril@74
    42
		Server				//!< I am the server
insilmaril@74
    43
	};
insilmaril@74
    44
    MapEditor(QWidget* parent=0);
insilmaril@0
    45
	~MapEditor();
insilmaril@74
    46
	VymModel* getModel();
insilmaril@74
    47
	QGraphicsScene * getScene();
insilmaril@74
    48
	State getState();					//!< Return State of MapEditor
insilmaril@74
    49
	void setStateEditHeading (bool);	//!< If set to true, State will change to EditHeading
insilmaril@74
    50
	bool isRepositionBlocked(); //!< While load or undo there is no need to update graphicsview
insilmaril@74
    51
	bool isSaveStateBlocked();			//!< block while undo/redo or while running scripts
insilmaril@74
    52
	void setSaveStateBlocked(bool);		//!< block saving the undo/redo state
insilmaril@74
    53
	bool isSelectBlocked();		//!< true, if no change of selection is possible, e.g. while editing the heading of abranch
insilmaril@0
    54
	
insilmaril@74
    55
protected:
insilmaril@74
    56
	/*! \brief Get name of object
insilmaril@74
    57
	  
insilmaril@74
    58
	  Returns heading of a branch or name of an object for use in comment
insilmaril@74
    59
	  of undo/redo history
insilmaril@74
    60
	*/ 
insilmaril@74
    61
	QString getName(const LinkableMapObj*);	// Get e.g. heading or filename
insilmaril@74
    62
	void makeTmpDirs();		// create temporary directories
insilmaril@74
    63
insilmaril@74
    64
	/*! This function saves all information of the map to disc.
insilmaril@74
    65
	    saveToDir also calls the functions for all BranchObj and other objects in the map.
insilmaril@74
    66
		The structure of the map itself is returned as QString and passed back to Main, 
insilmaril@74
    67
		where saveToDir is called initially
insilmaril@74
    68
	*/	
insilmaril@74
    69
    QString saveToDir (const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, LinkableMapObj *saveSel);
insilmaril@74
    70
insilmaril@74
    71
	/*! \brief Get directory, where current step in history is save
insilmaril@74
    72
insilmaril@74
    73
		saveState creates a directory for each step in history. This function returns the
insilmaril@74
    74
		path of the current directory
insilmaril@74
    75
	*/
insilmaril@74
    76
	QString getHistoryDir();
insilmaril@74
    77
insilmaril@74
    78
	/*! \brief Save the current changes in map 
insilmaril@74
    79
insilmaril@74
    80
		Two commands and selections are saved:
insilmaril@74
    81
insilmaril@74
    82
			- undocommand and undoselection to undo the change
insilmaril@74
    83
			- redocommand and redoselection to redo the action after an undo
insilmaril@74
    84
insilmaril@74
    85
		Additionally a comment is logged. 
insilmaril@74
    86
insilmaril@74
    87
	*/	
insilmaril@74
    88
    void saveState(
insilmaril@74
    89
		const SaveMode& savemode, 
insilmaril@74
    90
		const QString &undoSelection, 
insilmaril@74
    91
		const QString &undoCommand, 
insilmaril@74
    92
		const QString &redoSelection, 
insilmaril@74
    93
		const QString &redoCommand, 
insilmaril@74
    94
		const QString &comment, 
insilmaril@74
    95
		LinkableMapObj *saveSelection);
insilmaril@74
    96
	/*! Overloaded for convenience */
insilmaril@74
    97
    void saveStateChangingPart(
insilmaril@74
    98
		LinkableMapObj *undoSelection, 
insilmaril@74
    99
		LinkableMapObj* redoSelection, 
insilmaril@74
   100
		const QString &redoCommand, 
insilmaril@74
   101
		const QString &comment);
insilmaril@74
   102
	/*! Overloaded for convenience */
insilmaril@74
   103
    void saveStateRemovingPart(
insilmaril@74
   104
		LinkableMapObj *redoSelection, 
insilmaril@74
   105
		const QString &comment);
insilmaril@74
   106
	/*! Overloaded for convenience */
insilmaril@74
   107
    void saveState(
insilmaril@74
   108
		LinkableMapObj *undoSelection, 
insilmaril@74
   109
		const QString &undoCommand, 
insilmaril@74
   110
		LinkableMapObj *redoSelection, 
insilmaril@74
   111
		const QString &redoCommand, 
insilmaril@74
   112
		const QString &comment); 
insilmaril@74
   113
	/*! Overloaded for convenience */
insilmaril@74
   114
    void saveState(
insilmaril@74
   115
		const QString &undoSelection, 
insilmaril@74
   116
		const QString &undoCommand, 
insilmaril@74
   117
		const QString &redoSelection, 
insilmaril@74
   118
		const QString &redoCommand, 
insilmaril@74
   119
		const QString &comment) ;
insilmaril@74
   120
    void saveState(
insilmaril@74
   121
		const QString &undoCommand, 
insilmaril@74
   122
		const QString &redoCommand, 
insilmaril@74
   123
		const QString &comment) ;
insilmaril@74
   124
insilmaril@74
   125
public:	
insilmaril@74
   126
insilmaril@74
   127
	/* \brief Process one command and its parameters */
insilmaril@74
   128
    void parseAtom (const QString &atom);	
insilmaril@74
   129
insilmaril@74
   130
	/* \brief Runs the script */
insilmaril@74
   131
	void runScript (QString script);
insilmaril@0
   132
private:
insilmaril@74
   133
    void addFloatImageInt(const QPixmap &img);
insilmaril@0
   134
insilmaril@0
   135
public:
insilmaril@74
   136
	bool isDefault();		//!< true, if map is still the empty default map
insilmaril@74
   137
    bool hasChanged();		//!< true, if something has changed and is not saved yet
insilmaril@74
   138
	void setChanged();		//!< called from TextEditor via LinkableMapObj
insilmaril@74
   139
	void closeMap();		//!< Closes the map
insilmaril@74
   140
insilmaril@74
   141
	/*! \brief Sets filepath, filename and mapname
insilmaril@74
   142
insilmaril@74
   143
	     If the filepath is "/home/tux/map.xml", then the filename will be set
insilmaril@74
   144
		 to map.xml. The destname is needed for vymLinks, pointing to another map. 
insilmaril@74
   145
		 The destname holds the real name of the file, after it has been compressed, e.g. "map.vym"
insilmaril@74
   146
	*/	 
insilmaril@74
   147
insilmaril@74
   148
	/*! \brief Set File path
insilmaril@74
   149
insilmaril@74
   150
	     The destname is needed to construct the references between maps
insilmaril@74
   151
	*/	 
insilmaril@74
   152
	void setFilePath (QString filepath,QString destname);	
insilmaril@74
   153
	void setFilePath (QString);	//!< Overloaded for convenience
insilmaril@74
   154
	QString getFilePath ();	//!< Full path e.g. "/home/tux/map.xml"
insilmaril@74
   155
	QString getFileName ();	//!< e.g. "map.xml"
insilmaril@74
   156
	QString getMapName ();	//!< e.g. "map"
insilmaril@74
   157
	QString getDestPath (); //!< e.g. "/home/tux/map.vym"
insilmaril@74
   158
insilmaril@74
   159
	/*! \brief Load map
insilmaril@74
   160
insilmaril@74
   161
		The data is read from file. Depending on LoadMode the current
insilmaril@74
   162
		selection gets replaced by data or the data is appended.
insilmaril@74
   163
	*/	
insilmaril@74
   164
    ErrorCode load (QString, const LoadMode &, const FileType& );	// newmap, import/replace selection
insilmaril@74
   165
public:
insilmaril@74
   166
	/*! \brief Save the map to file */
insilmaril@74
   167
    ErrorCode save(const SaveMode &);	
insilmaril@74
   168
	/* FIXME no needed any longer
insilmaril@74
   169
	void setZipped(bool);		//!< Set or unset compression of map with zip save map zipped
insilmaril@74
   170
	bool saveZipped();			//!< True, if file will be saved zipped
insilmaril@74
   171
	*/
insilmaril@74
   172
    void print();				//!< Print the map
insilmaril@74
   173
	void setAntiAlias (bool);	//!< Set or unset antialiasing
insilmaril@74
   174
	void setSmoothPixmap(bool); //!< Set or unset smoothing of pixmaps
insilmaril@0
   175
private:
insilmaril@0
   176
    QPixmap getPixmap();
insilmaril@74
   177
	void setHideTmpMode (HideTmpMode);	// temporary hide stuff
insilmaril@74
   178
	HideTmpMode getHideTmpMode();		// temporary hide stuff
insilmaril@0
   179
public:
insilmaril@74
   180
	/*! Set or unset temporary hiding of objects during export  */
insilmaril@74
   181
	void setExportMode (bool);
insilmaril@74
   182
insilmaril@74
   183
	/*! Export as ASCII text to file */
insilmaril@74
   184
	void exportASCII (QString fname="",bool askForName=true);  
insilmaril@74
   185
insilmaril@74
   186
	/*! Save as image */
insilmaril@74
   187
    void exportImage (QString fname="",bool askForName=true,QString format="PNG");
insilmaril@74
   188
insilmaril@74
   189
    /*! Export as OpenOfficeOrg presentation */
insilmaril@74
   190
    void exportOOPresentation(const QString &,const QString &);	
insilmaril@74
   191
insilmaril@74
   192
	/*! Export as XHTML to directory */
insilmaril@74
   193
    void exportXHTML(const QString& dir="", bool askForName=true);	
insilmaril@74
   194
insilmaril@74
   195
	/*! Export as XTML to directory */
insilmaril@74
   196
    void exportXML(QString dir="", bool askForName=true);
insilmaril@74
   197
insilmaril@74
   198
    void clear();						//!< Clear map
insilmaril@74
   199
    void copy();						//!< Copy to clipboard
insilmaril@74
   200
    void redo();						//!< Redo last action
insilmaril@74
   201
	bool isRedoAvailable();				//!< True, if redo is available
insilmaril@74
   202
    void undo();						//!< Undo last action
insilmaril@74
   203
	bool isUndoAvailable();				//!< True, if undo is available
insilmaril@74
   204
	void gotoHistoryStep (int);			//!< Goto a specifig step in history
insilmaril@0
   205
private:	
insilmaril@74
   206
    void addMapReplaceInt(const QString & undoSel, const QString & path);
insilmaril@74
   207
    bool addMapInsertInt (const QString & path);
insilmaril@74
   208
    bool addMapInsertInt (const QString & path, int pos);
insilmaril@74
   209
    void pasteNoSave(const int &n);		//!< paste clipboard to branch
insilmaril@0
   210
public:	
insilmaril@74
   211
    void paste();		//!< Paste clipboard to branch and backup
insilmaril@74
   212
    void cut();			//!< Cut to clipboard (and copy)
insilmaril@74
   213
	/*! \brief Move absolutly
insilmaril@74
   214
insilmaril@74
   215
		Move absolutly to (x,y).
insilmaril@74
   216
	*/	
insilmaril@74
   217
    void move    (const double &x, const double &y);
insilmaril@74
   218
	/*! \brief Move relativly
insilmaril@74
   219
insilmaril@74
   220
		Move relativly to (x,y).
insilmaril@74
   221
	*/	
insilmaril@74
   222
    void moveRel (const double &x, const double &y);
insilmaril@74
   223
    void moveBranchUp();	//!< Move branch up
insilmaril@74
   224
    void moveBranchDown();	//!< Move branch down
insilmaril@74
   225
	void sortChildren();	//!< Sort children lexically
insilmaril@0
   226
private:	
insilmaril@74
   227
	void linkTo(const QString &);
insilmaril@74
   228
public:	
insilmaril@74
   229
	QString getHeading (bool &ok,QPoint &p); //!< Get heading, ok if selection is branch
insilmaril@74
   230
	void setHeading(const QString &);		//!< Set heading of branch	
insilmaril@74
   231
private:
insilmaril@74
   232
	void setHeadingInt(const QString &);
insilmaril@74
   233
	void setVymLinkInt(const QString &);	// Set vymLink for selection
insilmaril@74
   234
	/*! \brief Add new mapcenter
insilmaril@74
   235
insilmaril@74
   236
	    Disclaimer: Still experimental, not fully supported.
insilmaril@74
   237
	*/	
insilmaril@74
   238
public:	
insilmaril@74
   239
    BranchObj* addMapCenter();		
insilmaril@74
   240
insilmaril@74
   241
	/*! \brief Add new branch
insilmaril@74
   242
insilmaril@74
   243
		Depending on num the new branch is created
insilmaril@74
   244
insilmaril@74
   245
		-3 above selection as child of selections parent
insilmaril@74
   246
		-2 as child of selection
insilmaril@74
   247
		-1 below selection as child of selections parent
insilmaril@74
   248
		0..n	insert at a specific position in selections parent
insilmaril@74
   249
		(needed for free relinking)
insilmaril@74
   250
	*/	
insilmaril@74
   251
private:	
insilmaril@74
   252
    BranchObj* addNewBranchInt(int);		// pos allows to add above/below selection
insilmaril@74
   253
public:	
insilmaril@74
   254
	/*! \Add new branch
insilmaril@74
   255
		
insilmaril@74
   256
		Depending on num the new branch is created
insilmaril@74
   257
		-1 above selection
insilmaril@74
   258
		 0 as child of selection
insilmaril@74
   259
		 1 below selection
insilmaril@74
   260
	*/
insilmaril@74
   261
    BranchObj* addNewBranch(int pos);		
insilmaril@74
   262
    BranchObj* addNewBranchBefore();		//!< Insert branch between selection and its parent
insilmaril@74
   263
    void deleteSelection();					//!< Delete selection
insilmaril@74
   264
	LinkableMapObj* getSelection();			//!< Returns selection
insilmaril@74
   265
	BranchObj* getSelectedBranch();			// returns selected branch or NULL
insilmaril@74
   266
	FloatImageObj* getSelectedFloatImage();	// returns selected branch or NULL
insilmaril@74
   267
	void unselect();						// before changing current noteedit
insilmaril@74
   268
	void reselect();						// after  changing current noteedit
insilmaril@74
   269
	bool select(const QString &);			// Select by string
insilmaril@74
   270
	bool select(LinkableMapObj *lmo);		// Select by pointer
insilmaril@74
   271
	QString getSelectString();
insilmaril@74
   272
private:	
insilmaril@74
   273
	void selectInt(LinkableMapObj*);	
insilmaril@74
   274
	void selectNextBranchInt();		// Increment number of branch
insilmaril@74
   275
	void selectPrevBranchInt();		// Decrement number of branch
insilmaril@0
   276
public:	
insilmaril@0
   277
    void selectUpperBranch();
insilmaril@0
   278
    void selectLowerBranch();
insilmaril@0
   279
    void selectLeftBranch();
insilmaril@0
   280
    void selectRightBranch();
insilmaril@0
   281
    void selectFirstBranch();
insilmaril@0
   282
    void selectLastBranch();
insilmaril@74
   283
    void selectMapBackgroundImage();
insilmaril@74
   284
    void setMapBackgroundImage(const QString &);
insilmaril@74
   285
    void selectMapBackgroundColor();
insilmaril@74
   286
    void setMapBackgroundColor(QColor);
insilmaril@74
   287
    QColor getMapBackgroundColor();
insilmaril@74
   288
    QColor getCurrentHeadingColor();
insilmaril@74
   289
    void colorBranch(QColor);
insilmaril@74
   290
    void colorSubtree(QColor);
insilmaril@0
   291
	void toggleStandardFlag(QString);
insilmaril@0
   292
    BranchObj* findText(QString,bool);		// Find object
insilmaril@0
   293
    void findReset();						// Reset Find 
insilmaril@74
   294
	void setURL(const QString &);			// set  URL
insilmaril@74
   295
	void editURL();							// edit URL
insilmaril@74
   296
	void editLocalURL();					// edit URL to local file
insilmaril@74
   297
	QString getURL();						// returns URL of selection or ""
insilmaril@74
   298
	QStringList getURLs();					// returns URLs of subtree
insilmaril@0
   299
	void editHeading2URL();					// copy heading to URL
insilmaril@0
   300
	void editBugzilla2URL();				// create URL to Bugzilla
insilmaril@74
   301
	void editFATE2URL();					// create URL to FATE
insilmaril@0
   302
	void editVymLink();						// edit link to another map
insilmaril@0
   303
	void deleteVymLink();					// delete link to another map
insilmaril@0
   304
	QString getVymLink();					// return path to map
insilmaril@74
   305
	QStringList getVymLinks();				// return paths in subtree
insilmaril@74
   306
	void setHideExport(bool);				// toggle the export flag
insilmaril@74
   307
	void toggleHideExport();				// toggle the export flag
insilmaril@74
   308
	void deleteKeepChilds();				// remove but keep childs
insilmaril@74
   309
	void deleteChilds();					// remove childs
insilmaril@0
   310
	void editMapInfo();						// dialog to enter author, ...
insilmaril@74
   311
	void ensureSelectionVisible();		
insilmaril@74
   312
	void updateSelection();					// update geometry of selection
insilmaril@0
   313
	void updateActions();					// update e.g. format buttons
insilmaril@74
   314
	void updateNoteFlag();					// when TextEditor changes
insilmaril@74
   315
	void setMapAuthor (const QString &);
insilmaril@74
   316
	void setMapComment(const QString &);
insilmaril@74
   317
	void setMapLinkStyle (const QString &);	// Set style of link
insilmaril@74
   318
	LinkableMapObj::Style getMapLinkStyle ();	// requested in LMO
insilmaril@74
   319
	void setMapDefLinkColor(QColor);		// default color of links
insilmaril@74
   320
	void setMapLinkColorHintInt();			// color of links
insilmaril@74
   321
	void setMapLinkColorHint(LinkableMapObj::ColorHint);// color of links
insilmaril@74
   322
	LinkableMapObj::ColorHint getMapLinkColorHint();
insilmaril@74
   323
	QColor getMapDefLinkColor();
insilmaril@74
   324
	void setMapDefXLinkColor(QColor);
insilmaril@74
   325
	QColor getMapDefXLinkColor();
insilmaril@74
   326
	void setMapDefXLinkWidth (int);
insilmaril@74
   327
	int getMapDefXLinkWidth();
insilmaril@74
   328
	void toggleMapLinkColorHint();			// after changing linkStyles
insilmaril@74
   329
    void selectMapLinkColor();
insilmaril@74
   330
    void selectMapSelectionColor();
insilmaril@74
   331
private:	
insilmaril@74
   332
    void setSelectionColorInt(QColor);
insilmaril@74
   333
public:	
insilmaril@74
   334
    void setSelectionColor(QColor);
insilmaril@74
   335
    QColor getSelectionColor();
insilmaril@74
   336
	bool scrollBranch(BranchObj*);
insilmaril@74
   337
	bool unscrollBranch(BranchObj*);
insilmaril@0
   338
    void toggleScroll();
insilmaril@74
   339
    void unscrollChilds();
insilmaril@74
   340
private:	
insilmaril@74
   341
	FloatImageObj* loadFloatImageInt (QString);
insilmaril@74
   342
public:	
insilmaril@0
   343
	void loadFloatImage ();
insilmaril@0
   344
private:	
insilmaril@74
   345
	void saveFloatImageInt (FloatImageObj*, const QString &, const QString &);
insilmaril@74
   346
public:	
insilmaril@74
   347
	void saveFloatImage ();
insilmaril@74
   348
	void setFrameType(const FrameObj::FrameType &);
insilmaril@74
   349
	void setFrameType(const QString &);
insilmaril@74
   350
	void setFramePenColor (const QColor &);
insilmaril@74
   351
	void setFrameBrushColor (const QColor &);
insilmaril@74
   352
	void setFramePadding (const int &);
insilmaril@74
   353
	void setFrameBorderWidth (const int &);
insilmaril@74
   354
	void setIncludeImagesVer(bool);
insilmaril@74
   355
	void setIncludeImagesHor(bool);
insilmaril@74
   356
	void setHideLinkUnselected (bool);
insilmaril@74
   357
	bool getHideLinkUnselected ();
insilmaril@74
   358
private:	
insilmaril@74
   359
    void importDirInt(BranchObj *,QDir);
insilmaril@74
   360
    void importDirInt(const QString&);
insilmaril@0
   361
public:	
insilmaril@0
   362
    void importDir();
insilmaril@74
   363
	void followXLink (int);
insilmaril@74
   364
	void editXLink (int);
insilmaril@74
   365
	AttributeTable* attributeTable();
insilmaril@74
   366
    void testFunction1();					// just testing new stuff
insilmaril@74
   367
    void testFunction2();					// just testing new stuff
insilmaril@74
   368
											// set /mainwindo/showTestMenu=true...
insilmaril@0
   369
insilmaril@0
   370
protected:
insilmaril@74
   371
	virtual void contextMenuEvent ( QContextMenuEvent *e );
insilmaril@74
   372
    virtual void keyPressEvent(QKeyEvent*);
insilmaril@74
   373
    virtual void keyReleaseEvent(QKeyEvent*);
insilmaril@74
   374
    virtual void mousePressEvent(QMouseEvent*);
insilmaril@74
   375
    virtual void mouseMoveEvent(QMouseEvent*);
insilmaril@74
   376
    virtual void mouseReleaseEvent(QMouseEvent*);
insilmaril@74
   377
    virtual void mouseDoubleClickEvent(QMouseEvent*);
insilmaril@74
   378
    virtual void resizeEvent( QResizeEvent * );
insilmaril@74
   379
insilmaril@74
   380
	void dragEnterEvent (QDragEnterEvent *);
insilmaril@74
   381
	void dragMoveEvent (QDragMoveEvent *);
insilmaril@74
   382
	void dragLeaveEvent (QDragLeaveEvent *);
insilmaril@74
   383
	void dropEvent (QDropEvent *);
insilmaril@74
   384
insilmaril@74
   385
insilmaril@74
   386
protected:
insilmaril@74
   387
	void sendSelection();
insilmaril@74
   388
insilmaril@74
   389
public:
insilmaril@74
   390
	void newServer();
insilmaril@74
   391
	void connectToServer();
insilmaril@74
   392
insilmaril@74
   393
private slots:	
insilmaril@74
   394
	void newClient();
insilmaril@74
   395
	void sendData(const QString &s);
insilmaril@74
   396
	void readData();
insilmaril@74
   397
	void displayNetworkError (QAbstractSocket::SocketError);
insilmaril@74
   398
insilmaril@74
   399
	void autosave ();
insilmaril@74
   400
	void fileChanged();
insilmaril@0
   401
insilmaril@0
   402
private:
insilmaril@74
   403
	State state;				// State of MapEditor
insilmaril@74
   404
	QGraphicsScene *mapScene;
insilmaril@74
   405
	VymModel *model;					// Vym Map, includding several mapCenters
insilmaril@74
   406
	QTimer *autosaveTimer;
insilmaril@74
   407
	QTimer *fileChangedTimer;
insilmaril@74
   408
	QDateTime fileChangedTime;
insilmaril@0
   409
insilmaril@0
   410
	bool adjustCanvasRequested;	// collect requests until end of user event
insilmaril@0
   411
	BranchObj *editingBO;		// entering Text into BO
insilmaril@0
   412
insilmaril@74
   413
	QColor defLinkColor;		// default color for links
insilmaril@74
   414
	QColor defXLinkColor;		// default color for xlinks
insilmaril@74
   415
	int defXLinkWidth;			// default width for xlinks
insilmaril@74
   416
	LinkableMapObj::ColorHint linkcolorhint;// use heading color or own color
insilmaril@74
   417
	LinkableMapObj::Style linkstyle;		// default style for links
insilmaril@0
   418
insilmaril@74
   419
    QCursor HandOpenCursor;		// cursor while moving canvas view
insilmaril@74
   420
	QCursor PickColorCursor;	// cursor while picking color 
insilmaril@74
   421
	QCursor CopyCursor;			// cursor while picking color 
insilmaril@74
   422
	QCursor XLinkCursor;		// cursor while picking color 
insilmaril@74
   423
	bool pickingColor;
insilmaril@74
   424
	bool drawingLink;			// true while creating a link
insilmaril@74
   425
	bool copyingObj;			// true while creating a link
insilmaril@74
   426
	XLinkObj* tmpXLink;
insilmaril@74
   427
insilmaril@74
   428
	Selection xelection;	
insilmaril@74
   429
insilmaril@74
   430
	QString latestSelection;		// select string of latest added object
insilmaril@74
   431
insilmaril@0
   432
    MapObj* movingObj;				// moving a MapObj
insilmaril@74
   433
	MapObj* linkingObj_src;			// part of a link
insilmaril@74
   434
    QPointF movingObj_orgPos;		// org. pos of mouse before move
insilmaril@74
   435
    QPointF movingObj_orgRelPos;	// org. relative pos of mouse before move
insilmaril@74
   436
    QPointF movingObj_start;		// rel. pos of mouse to absPos 
insilmaril@74
   437
    QPointF movingCont_start;		// inital pos of moving Content or
insilmaril@74
   438
    QPointF movingVec;				// how far has Content moved
insilmaril@74
   439
insilmaril@74
   440
	QPointF contextMenuPos;					// position where context event was triggered
insilmaril@74
   441
insilmaril@0
   442
    QPrinter* printer;				// Printing
insilmaril@0
   443
insilmaril@0
   444
    bool mapDefault;				// Flag if map is untouched
insilmaril@0
   445
    bool mapChanged;				// Flag if undo is possible
insilmaril@0
   446
	bool mapUnsaved;				// Flag if map should be saved
insilmaril@74
   447
insilmaril@74
   448
	Parser parser;				// Parser stuff for scripting
insilmaril@74
   449
insilmaril@74
   450
	AttributeTable *attrTable;
insilmaril@0
   451
insilmaril@0
   452
	bool printFrame;			// Print frame around map
insilmaril@0
   453
	bool printFooter;			// Print footer below map
insilmaril@0
   454
insilmaril@0
   455
	bool zipped;				// should map be zipped
insilmaril@74
   456
	static	int mapNum;			// unique number for Editor
insilmaril@74
   457
	FileType fileType;			// type of file, e.g. vym, freemind...
insilmaril@0
   458
	QString fileName;			// short name of file (for tab)
insilmaril@0
   459
	QString filePath;			// path to file which will be saved
insilmaril@0
   460
	QString fileDir;			// dir where file is saved
insilmaril@0
   461
	QString destPath;			// path to .vym file (needed for vymlinks)
insilmaril@0
   462
	QString mapName;			// fileName without ".vym"
insilmaril@0
   463
insilmaril@74
   464
	QString tmpMapDir;			// tmp directory with undo history
insilmaril@74
   465
	QString histPath;			// Path to history file
insilmaril@74
   466
	SimpleSettings undoSet;		// undo/redo commands, saved in histPath
insilmaril@74
   467
	int stepsTotal;				// total number of steps (undos+redos) 
insilmaril@74
   468
	int curStep;				// Current step in history (ring buffer)
insilmaril@74
   469
	int curClipboard;			// number of history step, which is the current clipboard
insilmaril@74
   470
	int redosAvail;				// Available number of redo steps
insilmaril@74
   471
	int undosAvail;				// Available number of undo steps
insilmaril@74
   472
	bool blockReposition;		// block while load or undo
insilmaril@74
   473
	bool blockSaveState;		// block while load or undo
insilmaril@0
   474
insilmaril@0
   475
	BranchObj* itFind;			// next object in find process
insilmaril@0
   476
	bool EOFind;				// true, if search failed
insilmaril@0
   477
insilmaril@0
   478
	QPoint exportOffset;		// set before export, used in save
insilmaril@74
   479
	HideTmpMode hidemode;	// true while exporting to hide some stuff
insilmaril@74
   480
insilmaril@74
   481
	// Network connections **Experimental**
insilmaril@74
   482
	NetState netstate;			// offline, client, server
insilmaril@74
   483
	QTcpServer *tcpServer;		// Act as server in conference mode (experimental)
insilmaril@74
   484
	QList <QTcpSocket*> clientList;		// List of connected clients
insilmaril@74
   485
	quint16 sendCounter;		// Increased with every sent command
insilmaril@74
   486
insilmaril@74
   487
	QTcpSocket	*clientSocket;	// socket of this client
insilmaril@74
   488
	QString server;				// server address of this client
insilmaril@74
   489
	int port;					// server port of this client
insilmaril@74
   490
	void displayClientError(QAbstractSocket::SocketError socketError);
insilmaril@74
   491
insilmaril@0
   492
};
insilmaril@0
   493
#endif
insilmaril@0
   494