7 #include <qfiledialog.h>
12 #include "mapcenterobj.h"
16 class QNetworkOperation;
19 class MapEditor : public QCanvasView , public xmlObj {
23 MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, WFlags f=0);
26 QColor backgroundColor();
27 MapCenterObj* getMapCenter();
29 void adjustCanvasSize();// adjust canvas size to map and scrollview
30 bool isRepositionBlocked(); // block while load or undo
33 void makeTmpDirs(); // create temporary directories
34 void delTmpDirs(); // delete temporary directories
35 QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
36 void saveState(); // save actual state to backup
37 void saveState(LinkableMapObj *);
38 void saveState(const QString &, const QString &);
39 void saveState(const QString &, LinkableMapObj *);
40 void saveState(const SaveMode&, const QString &, LinkableMapObj *, const QString &, LinkableMapObj *);
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 ErrorCode load (QString, LoadMode ); // newmap, import/replace selection
65 int save(const SaveMode &); // Save map
66 void setZipped(bool); // save map zipped
67 bool saveZipped(); // 1 if file will be saved zipped
68 void print(); // print canvas
72 void exportImage (QString fn); // export as PNG
73 void exportImage (QString fn, int); // export in given format
74 void exportOOPresentation(const QString &,const QString &);
75 void exportXML(const QString&); // export to directory
76 void clear(); // clear map
77 void copy(); // copy branch to clipboard
78 void redo(); // redo last action
79 void undo(); // undo last action
81 void undoXML(const QString &, const QString &);
82 void pasteNoSave(); // paste clipboard to branch
83 void cutNoSave(); // cut to clipboard
85 void paste(); // paste clipboard to branch and backup
86 void cut(); // cut to clipboard and backup
87 void move(const int &,const int&);
89 void moveBranchDown();
90 void editHeading(); // Start editing heading
92 void setHeading(const QString &); // Just set the heading for selection
93 void setURL(const QString &); // Just set the URL for selection
94 void setVymLink(const QString &); // Set vymLink for selection
96 void addNewBranch(int); // pos allows to add above/below selection
97 void addNewBranchHere(); // insert and make selection its
98 void deleteSelection();
99 LinkableMapObj* getSelection(); // returns selection
100 bool select(const QString &); // Select
101 void unselect(); // before changing current noteedit
102 void reselect(); // after changing current noteedit
104 void selectNextBranch(); // Increment number of branch
105 void selectPrevBranch(); // Decrement number of branch
107 void selectUpperBranch();
108 void selectLowerBranch();
109 void selectLeftBranch();
110 void selectRightBranch();
111 void selectFirstBranch();
112 void selectLastBranch();
113 void setColor(QColor);
114 void selectBackgroundColor();
115 void setBackgroundColor(QColor);
119 void toggleStandardFlag(QString);
120 virtual void setViewCenter(); // needed for zooming
121 BranchObj* findText(QString,bool); // Find object
122 void findReset(); // Reset Find
123 void openURL(); // open URL in external browser
124 void editURL(); // edit the URL
125 void editHeading2URL(); // copy heading to URL
126 void editBugzilla2URL(); // create URL to Bugzilla
127 void editFATE2URL(); // create URL to FATE
128 void editVymLink(); // edit link to another map
129 void deleteVymLink(); // delete link to another map
130 QString getVymLink(); // return path to map
131 void removeBranchHere(); // remove but keep childs
132 void removeChilds(); // remove childs
133 void editMapInfo(); // dialog to enter author, ...
134 void updateActions(); // update e.g. format buttons
135 void updateNoteFlag(); // when TextEditor changes
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 &);
155 void setIncludeImagesVer(bool);
156 void setIncludeImagesHor(bool);
157 void setHideLinkUnselected (bool);
158 bool getHideLinkUnselected ();
160 void importDir(BranchObj *,QDir);
163 void followXLink (int);
164 void editXLink (int);
165 void testFunction(); // FIXME just testing
168 void ensureSelectionVisible();
169 virtual void updateViewCenter(); // needed for zooming
170 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
171 virtual void contentsMousePressEvent(QMouseEvent*);
172 virtual void contentsMouseReleaseEvent(QMouseEvent*);
173 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
174 virtual void contentsMouseMoveEvent(QMouseEvent*);
176 virtual void contentsDragEnterEvent(QDragEnterEvent *event);
177 virtual void contentsDropEvent(QDropEvent *event);
180 MapCenterObj* mapCenter;
182 bool adjustCanvasRequested; // collect requests until end of user event
183 BranchObj *editingBO; // entering Text into BO
186 QColor actColor; // actual color
187 QColor defLinkColor; // default color for links
188 QColor defXLinkColor; // default color for xlinks
189 int defXLinkWidth; // default width for xlinks
190 LinkColorHint linkcolorhint;// use heading color or own color
191 LinkStyle linkstyle; // default style for links
193 QCursor handOpenCursor; // cursor while moving canvas view
194 QCursor pickColorCursor; // cursor while picking color
196 bool drawingLink; // true while creating a link
197 bool copyingObj; // true while creating a link
200 LinkableMapObj* selection; // select a LinkableMapObj
201 LinkableMapObj* selectionLast; // last selection
202 MapObj* movingObj; // moving a MapObj
203 MapObj* linkingObj_src; // part of a link
204 QPoint movingObj_orgPos; // org. pos of mouse before move
205 QPoint movingObj_start; // rel. pos of mouse to absPos
206 QPoint movingCont_start; // inital pos of moving Content or
207 QPoint movingVec; // how far has Content moved
208 QPoint movingCenter; // used when zooming
209 QPrinter* printer; // Printing
211 bool mapDefault; // Flag if map is untouched
212 bool mapChanged; // Flag if undo is possible
213 bool mapUnsaved; // Flag if map should be saved
215 bool printFrame; // Print frame around map
216 bool printFooter; // Print footer below map
218 bool zipped; // should map be zipped
219 static int mapNum; // unique number for Editor
220 QString fileName; // short name of file (for tab)
221 QString filePath; // path to file which will be saved
222 QString fileDir; // dir where file is saved
223 QString destPath; // path to .vym file (needed for vymlinks)
224 QString mapName; // fileName without ".vym"
225 QString lastImageDir; // save dir for adding images
227 bool isInteractive; // non interactive don't need tmpdirs
228 QString tmpMapDir; // tmp directory with data for undo/redo
229 int undosTotal; // total number of undos
230 int undoNum; // current number of bakMapDir to be used
231 int undosAvail; // how many actions can currently be undone
232 bool blockReposition; // block while load or undo
233 bool blockSaveState; // block while load or undo
235 BranchObj* itFind; // next object in find process
236 bool EOFind; // true, if search failed
238 QPoint exportOffset; // set before export, used in save
239 void resizeEvent( QResizeEvent * );
241 QUrlOperator *urlOperator;
242 QDataStream *imageData;
243 QBuffer *imageBuffer;