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
91 void setURL(const QString &); // Just set the URL for selection
92 void setVymLink(const QString &); // Set vymLink for selection
94 void addNewBranch(int); // pos allows to add above/below selection
95 void addNewBranchHere(); // insert and make selection its
96 void deleteSelection();
97 LinkableMapObj* getSelection(); // returns selection
98 bool select(const QString &); // Select
99 void unselect(); // before changing current noteedit
100 void reselect(); // after changing current noteedit
102 void selectNextBranch(); // Increment number of branch
103 void selectPrevBranch(); // Decrement number of branch
105 void selectUpperBranch();
106 void selectLowerBranch();
107 void selectLeftBranch();
108 void selectRightBranch();
109 void selectFirstBranch();
110 void selectLastBranch();
111 void setColor(QColor);
112 void selectBackgroundColor();
113 void setBackgroundColor(QColor);
117 void toggleStandardFlag(QString);
118 virtual void setViewCenter(); // needed for zooming
119 BranchObj* findText(QString,bool); // Find object
120 void findReset(); // Reset Find
121 void openURL(); // open URL in external browser
122 void editURL(); // edit the URL
123 void editHeading2URL(); // copy heading to URL
124 void editBugzilla2URL(); // create URL to Bugzilla
125 void editVymLink(); // edit link to another map
126 void deleteVymLink(); // delete link to another map
127 QString getVymLink(); // return path to map
128 void removeBranchHere(); // remove but keep childs
129 void removeChilds(); // remove childs
130 void editMapInfo(); // dialog to enter author, ...
131 void updateActions(); // update e.g. format buttons
132 void setLinkStyle (LinkStyle); // Set style of link
133 LinkStyle getLinkStyle (); // requested in LMO
134 void setLinkColor(QColor); // default color of links
135 void setLinkColorHint(); // color of links
136 void setLinkColorHint(LinkColorHint); // color of links
137 LinkColorHint getLinkColorHint();
138 QColor getDefLinkColor();
139 void setDefXLinkColor(QColor);
140 QColor getDefXLinkColor();
141 void setDefXLinkWidth (int);
142 int getDefXLinkWidth();
143 void toggleLinkColorHint(); // after changing linkStyles
144 void selectLinkColor();
147 void loadFloatImage ();
148 void saveFloatImage (int);
149 void toggleFloatExport();
150 void setFrame(const FrameType &);
152 void importDir(BranchObj *,QDir);
155 void followXLink (int);
156 void editXLink (int);
157 void testFunction(); // FIXME just testing
160 void ensureSelectionVisible();
161 virtual void updateViewCenter(); // needed for zooming
162 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
163 virtual void contentsMousePressEvent(QMouseEvent*);
164 virtual void contentsMouseReleaseEvent(QMouseEvent*);
165 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
166 virtual void contentsMouseMoveEvent(QMouseEvent*);
168 virtual void contentsDragEnterEvent(QDragEnterEvent *event);
169 virtual void contentsDropEvent(QDropEvent *event);
172 MapCenterObj* mapCenter;
174 bool adjustCanvasRequested; // collect requests until end of user event
175 BranchObj *editingBO; // entering Text into BO
178 QColor actColor; // actual color
179 QColor defLinkColor; // default color for links
180 QColor defXLinkColor; // default color for xlinks
181 int defXLinkWidth; // default width for xlinks
182 LinkColorHint linkcolorhint;// use heading color or own color
183 LinkStyle linkstyle; // default style for links
185 QCursor handOpenCursor; // cursor while moving canvas view
186 QCursor pickColorCursor; // cursor while picking color
188 bool drawingLink; // true while creating a link
189 bool copyingObj; // true while creating a link
192 LinkableMapObj* selection; // select a LinkableMapObj
193 LinkableMapObj* selectionLast; // last selection
194 QString undoSelection; // selection for undo
195 QString redoSelection; // selection for redo
196 MapObj* movingObj; // moving a MapObj
197 MapObj* linkingObj_src; // part of a link
198 QPoint movingObj_orgPos; // org. pos of mouse before move
199 QPoint movingObj_start; // rel. pos of mouse to absPos
200 QPoint movingCont_start; // inital pos of moving Content or
201 QPoint movingVec; // how far has Content moved
202 QPoint movingCenter; // used when zooming
203 QPrinter* printer; // Printing
205 bool mapDefault; // Flag if map is untouched
206 bool mapChanged; // Flag if undo is possible
207 bool mapUnsaved; // Flag if map should be saved
208 QString backupXML; // backup (XML) for undo
209 QString undoCommand; // FIXME testing
210 QString redoCommand; // 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
227 bool blockSaveState; // block while load or undo
229 BranchObj* itFind; // next object in find process
230 bool EOFind; // true, if search failed
232 QPoint exportOffset; // set before export, used in save
233 void resizeEvent( QResizeEvent * );
235 QUrlOperator *urlOperator;
236 QDataStream *imageData;
237 QBuffer *imageBuffer;