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 blockReposition(); // 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
39 void saveState(LinkableMapObj *);
40 void saveState(const QString &);
41 void saveState(const SaveMode&, LinkableMapObj *, const QString &);
42 void parseAtom(const QString &);
44 void addFloatImage(const QPixmap &img);
46 void saveState(LinkableMapObj *);
47 void saveState(const QString &);
48 void saveState(const SaveMode&, LinkableMapObj *, const QString &);
49 void parseAtom(const QString &);
53 void finishedLineEditNoSave();
54 void fetchImage(const QString &img);
55 void imageDataFetched(const QByteArray &, QNetworkOperation *);
56 void imageDataFinished(QNetworkOperation *);
59 bool isDefault(); // false, if map was changed once
60 bool isUnsaved(); // save necessary
61 bool hasChanged(); // undo possible
62 void setChanged(); // called from NoteEditor via LMO
64 void setFilePath (QString);
65 void setFilePath (QString,QString);
66 QString getFilePath (); // Full path e.g. "/home/tux/map.xml"
67 QString getFileName (); // e.g. "map.xml"
68 QString getMapName (); // e.g. "map"
69 QString getDestPath (); // e.g. "/home/tux/map.vym"
70 int load (QString&, const LoadMode &); // newmap, import/replace selection
71 int save(const SaveMode &); // Save map
72 void setZipped(bool); // save map zipped
73 bool saveZipped(); // 1 if file will be saved zipped
74 void print(); // print canvas
78 void exportImage (QString fn); // export as PNG
79 void exportImage (QString fn, int); // export in given format
81 void exportXML(const QString&); // export to directory
82 void clear(); // clear map
83 void copy(); // copy branch to clipboard
84 void undo(); // undo last action
86 void undoXML(const QString &); // undo by replacing with saved data
87 LinkableMapObj* pasteNoSave(); // paste clipboard to branch
88 void cutNoSave(); // cut to clipboard
90 void paste(); // paste clipboard to branch and backup
91 void cut(); // cut to clipboard and backup
93 void moveBranchDown();
94 void editHeading(); // Start editing heading
96 void setHeading(const QString &); // Just set the heading for selection
98 void addNewBranch(int); // pos allows to add above/below selection
99 void addNewBranchHere(); // insert and make selection its
100 void deleteSelection();
101 LinkableMapObj* getSelection(); // returns selection
102 bool select(const QString &); // Select
103 void unselect(); // before changing current noteedit
104 void reselect(); // after changing current noteedit
106 void selectNextBranch(); // Increment number of branch
107 void selectPrevBranch(); // Decrement number of branch
109 void selectUpperBranch();
110 void selectLowerBranch();
111 void selectLeftBranch();
112 void selectRightBranch();
113 void selectFirstBranch();
114 void selectLastBranch();
115 void setColor(QColor);
116 void selectBackgroundColor();
117 void setBackgroundColor(QColor);
121 void toggleStandardFlag(QString);
122 virtual void setViewCenter(); // needed for zooming
123 BranchObj* findText(QString,bool); // Find object
124 void findReset(); // Reset Find
125 void openURL(); // open URL in external browser
126 void editURL(); // edit the URL
127 void editHeading2URL(); // copy heading to URL
128 void editBugzilla2URL(); // create URL to Bugzilla
129 void editVymLink(); // edit link to another map
130 void deleteVymLink(); // delete link to another map
131 QString getVymLink(); // return path to map
132 void removeBranchHere(); // remove but keep childs
133 void removeChilds(); // remove childs
134 void editMapInfo(); // dialog to enter author, ...
135 void updateActions(); // update e.g. format buttons
136 void setLinkStyle (LinkStyle); // Set style of link
137 LinkStyle getLinkStyle (); // requested in LMO
138 void setLinkColor(QColor); // default color of links
139 void setLinkColorHint(); // color of links
140 void setLinkColorHint(LinkColorHint); // color of links
141 LinkColorHint getLinkColorHint();
142 QColor getDefLinkColor();
143 void setDefXLinkColor(QColor);
144 QColor getDefXLinkColor();
145 void setDefXLinkWidth (int);
146 int getDefXLinkWidth();
147 void toggleLinkColorHint(); // after changing linkStyles
148 void selectLinkColor();
151 void loadFloatImage ();
152 void saveFloatImage (int);
153 void toggleFloatExport();
154 void setFrame(const FrameType &);
156 void importDir(BranchObj *,QDir);
159 void followXLink (int);
160 void editXLink (int);
161 void testFunction(); // FIXME just testing
164 void ensureSelectionVisible();
165 virtual void updateViewCenter(); // needed for zooming
166 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
167 virtual void contentsMousePressEvent(QMouseEvent*);
168 virtual void contentsMouseReleaseEvent(QMouseEvent*);
169 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
170 virtual void contentsMouseMoveEvent(QMouseEvent*);
172 virtual void contentsDragEnterEvent(QDragEnterEvent *event);
173 virtual void contentsDropEvent(QDropEvent *event);
176 MapCenterObj* mapCenter;
178 bool adjustCanvasRequested; // collect requests until end of user event
179 BranchObj *editingBO; // entering Text into BO
182 QColor actColor; // actual color
183 QColor defLinkColor; // default color for links
184 QColor defXLinkColor; // default color for xlinks
185 int defXLinkWidth; // default width for xlinks
186 LinkColorHint linkcolorhint;// use heading color or own color
187 LinkStyle linkstyle; // default style for links
189 QCursor handOpenCursor; // cursor while moving canvas view
190 QCursor pickColorCursor; // cursor while picking color
192 bool drawingLink; // true while creating a link
193 bool copyingObj; // true while creating a link
196 LinkableMapObj* selection; // select a LinkableMapObj
197 LinkableMapObj* selectionLast; // last selection
198 MapObj* movingObj; // moving a MapObj
199 MapObj* linkingObj_src; // part of a link
200 QPoint movingObj_start; // rel. pos of mouse to absPos
201 QPoint movingCont_start; // inital pos of moving Content or
202 QPoint movingVec; // how far has Content moved
203 QPoint movingCenter; // used when zooming
204 QPrinter* printer; // Printing
206 bool mapDefault; // Flag if map is untouched
207 bool mapChanged; // Flag if undo is possible
208 bool mapUnsaved; // Flag if map should be saved
209 QString backupXML; // backup (XML) for undo
210 QString undoCommand; // FIXME testing
213 bool printFrame; // Print frame around map
214 bool printFooter; // Print footer below map
216 bool zipped; // should map be zipped
217 QString fileName; // short name of file (for tab)
218 QString filePath; // path to file which will be saved
219 QString fileDir; // dir where file is saved
220 QString destPath; // path to .vym file (needed for vymlinks)
221 QString mapName; // fileName without ".vym"
222 QString lastImageDir; // save dir for adding images
224 bool isInteractive; // non interactive don't need tmpdirs
225 QString bakMapDir; // tmp directory with data for undo
226 bool blockreposition; // block while load or undo
228 BranchObj* itFind; // next object in find process
229 bool EOFind; // true, if search failed
231 QPoint exportOffset; // set before export, used in save
232 void resizeEvent( QResizeEvent * );
234 QUrlOperator *urlOperator;
235 QDataStream *imageData;
236 QBuffer *imageBuffer;