mapeditor.h
changeset 366 e95081c21da2
parent 295 f6fecd518011
child 377 5391ab620c95
     1.1 --- a/mapeditor.h	Tue Sep 05 09:47:13 2006 +0000
     1.2 +++ b/mapeditor.h	Tue Sep 05 09:47:14 2006 +0000
     1.3 @@ -1,32 +1,40 @@
     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 <qbuffer.h>
    1.14 +#include <q3canvas.h>
    1.15 +//#include <q3filedialog.h>
    1.16 +//#include <q3process.h>
    1.17 +#include <QBuffer>
    1.18 +#include <QContextMenuEvent>
    1.19 +#include <QCursor>
    1.20 +#include <QDragEnterEvent>
    1.21 +#include <QDropEvent>
    1.22 +#include <QEvent>
    1.23 +#include <QLineEdit>
    1.24 +#include <QMouseEvent>
    1.25 +#include <QPixmap>
    1.26 +#include <QResizeEvent>
    1.27  
    1.28  #include "mapcenterobj.h"
    1.29  #include "file.h"
    1.30  #include "misc.h"
    1.31 +#include "selection.h"
    1.32 +#include "settings.h"
    1.33  #include "showtextdialog.h"
    1.34  
    1.35 -class QNetworkOperation;
    1.36 -class QUrlOperator;
    1.37 +class Q3NetworkOperation;
    1.38 +class Q3UrlOperator;
    1.39  
    1.40 -class MapEditor : public QCanvasView , public xmlObj {
    1.41 +class MapEditor : public Q3CanvasView , public xmlObj {
    1.42      Q_OBJECT
    1.43  
    1.44  public:
    1.45 -    MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, WFlags f=0);
    1.46 +    MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, Qt::WFlags f=0);
    1.47  	~MapEditor();
    1.48      QColor color();
    1.49      QColor backgroundColor();
    1.50      MapCenterObj* getMapCenter();
    1.51 -	QCanvas* getCanvas();
    1.52 +	Q3Canvas* getCanvas();
    1.53  	void adjustCanvasSize();// adjust canvas size to map and scrollview
    1.54  	bool isRepositionBlocked(); // block while load or undo
    1.55  	
    1.56 @@ -34,20 +42,21 @@
    1.57  	QString getName(LinkableMapObj*);	// Get e.g. heading or filename
    1.58  	void makeTmpDirs();		// create temporary directories
    1.59      QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
    1.60 -    void saveState(const QString &);	// save actual state to backup
    1.61 -    void saveState(LinkableMapObj *, const QString &);
    1.62 -    void saveState(const QString &, const QString &, const QString &);
    1.63 -    void saveState(const QString &, LinkableMapObj *, const QString &);
    1.64 -    void saveState(const SaveMode&, const QString &, LinkableMapObj *, const QString &, LinkableMapObj *, const QString &);
    1.65 +    void saveStateComplete       (const QString &);					
    1.66 +    void saveStatePart           (LinkableMapObj *, const QString &);
    1.67 +    void saveStateConstSelection (const QString &, const QString &, const QString &);
    1.68 +    void saveStateComData		 (LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &, LinkableMapObj *);
    1.69 +    void saveState(LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &);
    1.70 +    void saveState(const QString &, const QString &, const QString &, const QString &, const QString &);
    1.71 +    void saveState(const SaveMode&, const QString &, const QString &, const QString &, const QString &, const QString &, LinkableMapObj *);
    1.72      void parseAtom(const QString &);	
    1.73  
    1.74      void addFloatImage(const QPixmap &img);
    1.75  
    1.76    private slots:
    1.77 -    void finishedLineEdit();
    1.78      void fetchImage(const QString &img);
    1.79 -    void imageDataFetched(const QByteArray &, QNetworkOperation *);
    1.80 -    void imageDataFinished(QNetworkOperation *);
    1.81 +    void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
    1.82 +    void imageDataFinished(Q3NetworkOperation *);
    1.83  
    1.84  public:
    1.85  	void toggleHistoryWindow();
    1.86 @@ -74,8 +83,8 @@
    1.87  	HideTmpMode getHideTmpMode();		// temporary hide stuff
    1.88  public:
    1.89  	void setExportMode (bool);			// temporary hide stuff during export
    1.90 -    void exportImage (QString fn);		// export as PNG	
    1.91 -    void exportImage (QString fn, int);	// export in given format
    1.92 +    void exportImage (QString fn);			// export as PNG	
    1.93 +    void exportImage (QString fn, QString);	// export in given format
    1.94      void exportOOPresentation(const QString &,const QString &);
    1.95      void exportXML(const QString&);		// export to directory
    1.96      void clear();		// clear map
    1.97 @@ -89,14 +98,17 @@
    1.98  public:	
    1.99      void paste();		// paste clipboard to branch and backup
   1.100      void cut();			// cut to clipboard and backup
   1.101 -    void move(const int &,const int&);
   1.102 +    void move    (const int &,const int&);
   1.103 +    void moveRel (const int &,const int&);
   1.104      void moveBranchUp();
   1.105      void moveBranchDown();
   1.106 -    void editHeading();					// Start editing heading 
   1.107 +	QString getHeading (bool &,QPoint &);	// Get heading, ok if selection is branch
   1.108 +	void setHeading(const QString &);
   1.109  private:
   1.110 -	void setHeading(const QString &);	// Just set the heading for selection
   1.111 -	void setURL(const QString &);		// Just set the URL for selection
   1.112 -	void setVymLink(const QString &);	// Set vymLink for selection
   1.113 +	void setHeadingInt(const QString &);
   1.114 +	void setURLInt(const QString &);		// Just set the URL for selection
   1.115 +	void setVymLinkInt(const QString &);	// Set vymLink for selection
   1.116 +    BranchObj* addNewBranchInt(int);		// pos allows to add above/below selection
   1.117  public:	
   1.118      void addNewBranch(int);			// pos allows to add above/below selection
   1.119      void addNewBranchHere();		// insert and make selection its
   1.120 @@ -104,11 +116,12 @@
   1.121  	LinkableMapObj* getSelection();	// returns selection
   1.122  	void unselect();				// before changing current noteedit
   1.123  	void reselect();				// after  changing current noteedit
   1.124 -	bool select(const QString &);	// Select 
   1.125 +	bool select(const QString &);	// Select by string
   1.126 +	QString getSelectString();
   1.127  private:	
   1.128 -	void select(LinkableMapObj*);	
   1.129 -	void selectNextBranch();		// Increment number of branch
   1.130 -	void selectPrevBranch();		// Decrement number of branch
   1.131 +	void selectInt(LinkableMapObj*);	
   1.132 +	void selectNextBranchInt();		// Increment number of branch
   1.133 +	void selectPrevBranchInt();		// Decrement number of branch
   1.134  public:	
   1.135      void selectUpperBranch();
   1.136      void selectLowerBranch();
   1.137 @@ -128,12 +141,14 @@
   1.138      void findReset();						// Reset Find 
   1.139  	void editURL();							// edit the URL
   1.140  	QString getURL();						// returns URL of selection or ""
   1.141 +	QStringList getURLs();					// returns URLs of subtree
   1.142  	void editHeading2URL();					// copy heading to URL
   1.143  	void editBugzilla2URL();				// create URL to Bugzilla
   1.144  	void editFATE2URL();					// create URL to FATE
   1.145  	void editVymLink();						// edit link to another map
   1.146  	void deleteVymLink();					// delete link to another map
   1.147  	QString getVymLink();					// return path to map
   1.148 +	QStringList getVymLinks();				// return paths in subtree
   1.149  	void toggleHideExport();				// toggle the export flag
   1.150  	void removeBranchKeepChilds();			// remove but keep childs
   1.151  	void removeChilds();					// remove childs
   1.152 @@ -156,19 +171,20 @@
   1.153      void toggleScroll();
   1.154      void unScrollAll();
   1.155  	void loadFloatImage ();
   1.156 -	void saveFloatImage (int);
   1.157 +	void saveFloatImage ();
   1.158  	void setFrame(const FrameType &);
   1.159  	void setIncludeImagesVer(bool);
   1.160  	void setIncludeImagesHor(bool);
   1.161  	void setHideLinkUnselected (bool);
   1.162  	bool getHideLinkUnselected ();
   1.163  private:	
   1.164 -    void importDir(BranchObj *,QDir);
   1.165 +    void importDirInt(BranchObj *,QDir);
   1.166  public:	
   1.167      void importDir();
   1.168  	void followXLink (int);
   1.169  	void editXLink (int);
   1.170 -    void testFunction();				// FIXME just testing
   1.171 +    void testFunction();					// just testing new stuff
   1.172 +											// set /mainwindo/showTestMenu=true...
   1.173  
   1.174  protected:
   1.175  	void ensureSelectionVisible();		
   1.176 @@ -182,12 +198,11 @@
   1.177      virtual void contentsDragEnterEvent(QDragEnterEvent *event);
   1.178      virtual void contentsDropEvent(QDropEvent *event);
   1.179  private:
   1.180 -    QCanvas* mapCanvas;
   1.181 +    Q3Canvas* mapCanvas;
   1.182      MapCenterObj* mapCenter;
   1.183  
   1.184  	bool adjustCanvasRequested;	// collect requests until end of user event
   1.185  	BranchObj *editingBO;		// entering Text into BO
   1.186 -    QLineEdit* lineedit;
   1.187  
   1.188      QColor actColor;			// actual color
   1.189  	QColor defLinkColor;		// default color for links
   1.190 @@ -202,12 +217,14 @@
   1.191  	bool drawingLink;			// true while creating a link
   1.192  	bool copyingObj;			// true while creating a link
   1.193  	XLinkObj* tmpXLink;
   1.194 -	
   1.195 +
   1.196 +	Selection xelection;
   1.197      LinkableMapObj* selection;		// select a LinkableMapObj
   1.198      LinkableMapObj* selectionLast;	// last selection 
   1.199      MapObj* movingObj;				// moving a MapObj
   1.200  	MapObj* linkingObj_src;			// part of a link
   1.201      QPoint movingObj_orgPos;		// org. pos of mouse before move
   1.202 +    QPoint movingObj_orgRelPos;		// org. relative pos of mouse before move
   1.203      QPoint movingObj_start;			// rel. pos of mouse to absPos 
   1.204      QPoint movingCont_start;		// inital pos of moving Content or
   1.205      QPoint movingVec;				// how far has Content moved
   1.206 @@ -228,13 +245,12 @@
   1.207  	QString fileDir;			// dir where file is saved
   1.208  	QString destPath;			// path to .vym file (needed for vymlinks)
   1.209  	QString mapName;			// fileName without ".vym"
   1.210 -	QString lastImageDir;		// save dir for adding images
   1.211  
   1.212  	bool isInteractive;			// non interactive don't need tmpdirs
   1.213  	QString tmpMapDir;			// tmp directory with data for undo/redo
   1.214 +	QString histPath;			// Path to history file
   1.215  	int undosTotal;				// total number of undos 
   1.216 -	int undoNum;				// current number of bakMapDir to be used 
   1.217 -	int undosAvail;				// how many actions can currently be undone
   1.218 +	SimpleSettings undoSet;		// undo/redo commands
   1.219  	bool blockReposition;		// block while load or undo
   1.220  	bool blockSaveState;		// block while load or undo
   1.221  
   1.222 @@ -246,7 +262,7 @@
   1.223  	
   1.224      void resizeEvent( QResizeEvent * );
   1.225  
   1.226 -  QUrlOperator *urlOperator;
   1.227 +  Q3UrlOperator *urlOperator;
   1.228    QDataStream *imageData;
   1.229    QBuffer *imageBuffer;
   1.230