7 #include <qfiledialog.h>
12 #include "mapcenterobj.h"
15 class QNetworkOperation;
18 class MapEditor : public QCanvasView , public xmlObj {
22 MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, WFlags f=0);
25 QColor backgroundColor();
26 MapCenterObj* getMapCenter();
28 void adjustCanvasSize();// adjust canvas size to map and scrollview
29 bool isRepositionBlocked(); // block while load or undo
32 void makeTmpDirs(); // create temporary directories
33 void delTmpDirs(); // delete temporary directories
34 void makeSubDirs(const QString&);
35 // create subdirs in dir
36 QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
37 void saveState(); // save actual state to backup
38 void saveState(LinkableMapObj *);
39 void saveState(const QString &, const QString &);
40 void saveState(const SaveMode&, LinkableMapObj *, const QString &, const QString &);
41 void parseAtom(const QString &);
43 void addFloatImage(const QPixmap &img);
46 void finishedLineEditNoSave();
47 void fetchImage(const QString &img);
48 void imageDataFetched(const QByteArray &, QNetworkOperation *);
49 void imageDataFinished(QNetworkOperation *);
52 bool isDefault(); // false, if map was changed once
53 bool isUnsaved(); // save necessary
54 bool hasChanged(); // undo possible
55 void setChanged(); // called from NoteEditor via LMO
57 void setFilePath (QString);
58 void setFilePath (QString,QString);
59 QString getFilePath (); // Full path e.g. "/home/tux/map.xml"
60 QString getFileName (); // e.g. "map.xml"
61 QString getMapName (); // e.g. "map"
62 QString getDestPath (); // e.g. "/home/tux/map.vym"
63 int load (QString&, const LoadMode &); // newmap, import/replace selection
64 int save(const SaveMode &); // Save map
65 void setZipped(bool); // save map zipped
66 bool saveZipped(); // 1 if file will be saved zipped
67 void print(); // print canvas
71 void exportImage (QString fn); // export as PNG
72 void exportImage (QString fn, int); // export in given format
74 void exportXML(const QString&); // export to directory
75 void clear(); // clear map
76 void copy(); // copy branch to clipboard
77 void undo(); // undo last action
79 void undoXML(const QString &); // undo by replacing with saved data
80 LinkableMapObj* pasteNoSave(); // paste clipboard to branch
81 void cutNoSave(); // cut to clipboard
83 void paste(); // paste clipboard to branch and backup
84 void cut(); // cut to clipboard and backup
85 void move(const int &,const int&);
87 void moveBranchDown();
88 void editHeading(); // Start editing heading
90 void setHeading(const QString &); // Just set the heading for selection
92 void addNewBranch(int); // pos allows to add above/below selection
93 void addNewBranchHere(); // insert and make selection its
94 void deleteSelection();
95 LinkableMapObj* getSelection(); // returns selection
96 bool select(const QString &); // Select
97 void unselect(); // before changing current noteedit
98 void reselect(); // after changing current noteedit
100 void selectNextBranch(); // Increment number of branch
101 void selectPrevBranch(); // Decrement number of branch
103 void selectUpperBranch();
104 void selectLowerBranch();
105 void selectLeftBranch();
106 void selectRightBranch();
107 void selectFirstBranch();
108 void selectLastBranch();
109 void setColor(QColor);
110 void selectBackgroundColor();
111 void setBackgroundColor(QColor);
115 void toggleStandardFlag(QString);
116 virtual void setViewCenter(); // needed for zooming
117 BranchObj* findText(QString,bool); // Find object
118 void findReset(); // Reset Find
119 void openURL(); // open URL in external browser
120 void editURL(); // edit the URL
121 void editHeading2URL(); // copy heading to URL
122 void editBugzilla2URL(); // create URL to Bugzilla
123 void editVymLink(); // edit link to another map
124 void deleteVymLink(); // delete link to another map
125 QString getVymLink(); // return path to map
126 void removeBranchHere(); // remove but keep childs
127 void removeChilds(); // remove childs
128 void editMapInfo(); // dialog to enter author, ...
129 void updateActions(); // update e.g. format buttons
130 void setLinkStyle (LinkStyle); // Set style of link
131 LinkStyle getLinkStyle (); // requested in LMO
132 void setLinkColor(QColor); // default color of links
133 void setLinkColorHint(); // color of links
134 void setLinkColorHint(LinkColorHint); // color of links
135 LinkColorHint getLinkColorHint();
136 QColor getDefLinkColor();
137 void setDefXLinkColor(QColor);
138 QColor getDefXLinkColor();
139 void setDefXLinkWidth (int);
140 int getDefXLinkWidth();
141 void toggleLinkColorHint(); // after changing linkStyles
142 void selectLinkColor();
145 void loadFloatImage ();
146 void saveFloatImage (int);
147 void toggleFloatExport();
148 void setFrame(const FrameType &);
150 void importDir(BranchObj *,QDir);
153 void followXLink (int);
154 void editXLink (int);
155 void testFunction(); // FIXME just testing
158 void ensureSelectionVisible();
159 virtual void updateViewCenter(); // needed for zooming
160 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
161 virtual void contentsMousePressEvent(QMouseEvent*);
162 virtual void contentsMouseReleaseEvent(QMouseEvent*);
163 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
164 virtual void contentsMouseMoveEvent(QMouseEvent*);
166 virtual void contentsDragEnterEvent(QDragEnterEvent *event);
167 virtual void contentsDropEvent(QDropEvent *event);
170 MapCenterObj* mapCenter;
172 bool adjustCanvasRequested; // collect requests until end of user event
173 BranchObj *editingBO; // entering Text into BO
176 QColor actColor; // actual color
177 QColor defLinkColor; // default color for links
178 QColor defXLinkColor; // default color for xlinks
179 int defXLinkWidth; // default width for xlinks
180 LinkColorHint linkcolorhint;// use heading color or own color
181 LinkStyle linkstyle; // default style for links
183 QCursor handOpenCursor; // cursor while moving canvas view
184 QCursor pickColorCursor; // cursor while picking color
186 bool drawingLink; // true while creating a link
187 bool copyingObj; // true while creating a link
190 LinkableMapObj* selection; // select a LinkableMapObj
191 LinkableMapObj* selectionLast; // last selection
192 QString undoSelection; // selection for undo
193 QString redoSelection; // selection for redo
194 MapObj* movingObj; // moving a MapObj
195 MapObj* linkingObj_src; // part of a link
196 QPoint movingObj_orgPos; // org. pos of mouse before move
197 QPoint movingObj_start; // rel. pos of mouse to absPos
198 QPoint movingCont_start; // inital pos of moving Content or
199 QPoint movingVec; // how far has Content moved
200 QPoint movingCenter; // used when zooming
201 QPrinter* printer; // Printing
203 bool mapDefault; // Flag if map is untouched
204 bool mapChanged; // Flag if undo is possible
205 bool mapUnsaved; // Flag if map should be saved
206 QString backupXML; // backup (XML) for undo
207 QString undoCommand; // FIXME testing
208 QString redoCommand; // FIXME testing
211 bool printFrame; // Print frame around map
212 bool printFooter; // Print footer below map
214 bool zipped; // should map be zipped
215 QString fileName; // short name of file (for tab)
216 QString filePath; // path to file which will be saved
217 QString fileDir; // dir where file is saved
218 QString destPath; // path to .vym file (needed for vymlinks)
219 QString mapName; // fileName without ".vym"
220 QString lastImageDir; // save dir for adding images
222 bool isInteractive; // non interactive don't need tmpdirs
223 QString bakMapDir; // tmp directory with data for undo
224 bool blockReposition; // block while load or undo
225 bool blockSaveState; // block while load or undo
227 BranchObj* itFind; // next object in find process
228 bool EOFind; // true, if search failed
230 QPoint exportOffset; // set before export, used in save
231 void resizeEvent( QResizeEvent * );
233 QUrlOperator *urlOperator;
234 QDataStream *imageData;
235 QBuffer *imageBuffer;