7 #include <q3filedialog.h>
12 #include <QContextMenuEvent>
14 #include <QResizeEvent>
16 #include <QMouseEvent>
17 #include <QDragEnterEvent>
19 #include "mapcenterobj.h"
22 #include "showtextdialog.h"
24 class Q3NetworkOperation;
27 class MapEditor : public Q3CanvasView , public xmlObj {
31 MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, Qt::WFlags f=0);
34 QColor backgroundColor();
35 MapCenterObj* getMapCenter();
36 Q3Canvas* getCanvas();
37 void adjustCanvasSize();// adjust canvas size to map and scrollview
38 bool isRepositionBlocked(); // block while load or undo
41 QString getName(LinkableMapObj*); // Get e.g. heading or filename
42 void makeTmpDirs(); // create temporary directories
43 QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
44 void saveState(const QString &); // save actual state to backup
45 void saveState(LinkableMapObj *, const QString &);
46 void saveState(const QString &, const QString &, const QString &);
47 void saveState(const QString &, LinkableMapObj *, const QString &);
48 void saveState(const SaveMode&, const QString &, LinkableMapObj *, const QString &, LinkableMapObj *, const QString &);
49 void parseAtom(const QString &);
51 void addFloatImage(const QPixmap &img);
54 void finishedLineEdit();
55 void fetchImage(const QString &img);
56 void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
57 void imageDataFinished(Q3NetworkOperation *);
60 void toggleHistoryWindow();
61 bool isDefault(); // false, if map was changed once
62 bool isUnsaved(); // save necessary
63 bool hasChanged(); // undo possible
64 void setChanged(); // called from NoteEditor via LMO
66 void setFilePath (QString);
67 void setFilePath (QString,QString);
68 QString getFilePath (); // Full path e.g. "/home/tux/map.xml"
69 QString getFileName (); // e.g. "map.xml"
70 QString getMapName (); // e.g. "map"
71 QString getDestPath (); // e.g. "/home/tux/map.vym"
72 ErrorCode load (QString, LoadMode ); // newmap, import/replace selection
74 int save(const SaveMode &); // Save map
75 void setZipped(bool); // save map zipped
76 bool saveZipped(); // 1 if file will be saved zipped
77 void print(); // print canvas
80 void setHideTmpMode (HideTmpMode); // temporary hide stuff
81 HideTmpMode getHideTmpMode(); // temporary hide stuff
83 void setExportMode (bool); // temporary hide stuff during export
84 void exportImage (QString fn); // export as PNG
85 void exportImage (QString fn, int); // export in given format
86 void exportOOPresentation(const QString &,const QString &);
87 void exportXML(const QString&); // export to directory
88 void clear(); // clear map
89 void copy(); // copy branch to clipboard
90 void redo(); // redo last action
91 void undo(); // undo last action
93 void undoXML(const QString &, const QString &);
94 void pasteNoSave(); // paste clipboard to branch
95 void cutNoSave(); // cut to clipboard
97 void paste(); // paste clipboard to branch and backup
98 void cut(); // cut to clipboard and backup
99 void move(const int &,const int&);
101 void moveBranchDown();
102 void editHeading(); // Start editing heading
104 void setHeading(const QString &); // Just set the heading for selection
105 void setURL(const QString &); // Just set the URL for selection
106 void setVymLink(const QString &); // Set vymLink for selection
108 void addNewBranch(int); // pos allows to add above/below selection
109 void addNewBranchHere(); // insert and make selection its
110 void deleteSelection();
111 LinkableMapObj* getSelection(); // returns selection
112 void unselect(); // before changing current noteedit
113 void reselect(); // after changing current noteedit
114 bool select(const QString &); // Select
116 void select(LinkableMapObj*);
117 void selectNextBranch(); // Increment number of branch
118 void selectPrevBranch(); // Decrement number of branch
120 void selectUpperBranch();
121 void selectLowerBranch();
122 void selectLeftBranch();
123 void selectRightBranch();
124 void selectFirstBranch();
125 void selectLastBranch();
126 void setColor(QColor);
127 void selectBackgroundColor();
128 void setBackgroundColor(QColor);
132 void toggleStandardFlag(QString);
133 virtual void setViewCenter(); // needed for zooming
134 BranchObj* findText(QString,bool); // Find object
135 void findReset(); // Reset Find
136 void editURL(); // edit the URL
137 QString getURL(); // returns URL of selection or ""
138 void editHeading2URL(); // copy heading to URL
139 void editBugzilla2URL(); // create URL to Bugzilla
140 void editFATE2URL(); // create URL to FATE
141 void editVymLink(); // edit link to another map
142 void deleteVymLink(); // delete link to another map
143 QString getVymLink(); // return path to map
144 void toggleHideExport(); // toggle the export flag
145 void removeBranchKeepChilds(); // remove but keep childs
146 void removeChilds(); // remove childs
147 void editMapInfo(); // dialog to enter author, ...
148 void updateActions(); // update e.g. format buttons
149 void updateNoteFlag(); // when TextEditor changes
150 void setLinkStyle (LinkStyle); // Set style of link
151 LinkStyle getLinkStyle (); // requested in LMO
152 void setLinkColor(QColor); // default color of links
153 void setLinkColorHint(); // color of links
154 void setLinkColorHint(LinkColorHint); // color of links
155 LinkColorHint getLinkColorHint();
156 QColor getDefLinkColor();
157 void setDefXLinkColor(QColor);
158 QColor getDefXLinkColor();
159 void setDefXLinkWidth (int);
160 int getDefXLinkWidth();
161 void toggleLinkColorHint(); // after changing linkStyles
162 void selectLinkColor();
165 void loadFloatImage ();
166 void saveFloatImage (int);
167 void setFrame(const FrameType &);
168 void setIncludeImagesVer(bool);
169 void setIncludeImagesHor(bool);
170 void setHideLinkUnselected (bool);
171 bool getHideLinkUnselected ();
173 void importDir(BranchObj *,QDir);
176 void followXLink (int);
177 void editXLink (int);
178 void testFunction(); // FIXME just testing
181 void ensureSelectionVisible();
182 virtual void updateViewCenter(); // needed for zooming
183 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
184 virtual void contentsMousePressEvent(QMouseEvent*);
185 virtual void contentsMouseReleaseEvent(QMouseEvent*);
186 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
187 virtual void contentsMouseMoveEvent(QMouseEvent*);
189 virtual void contentsDragEnterEvent(QDragEnterEvent *event);
190 virtual void contentsDropEvent(QDropEvent *event);
193 MapCenterObj* mapCenter;
195 bool adjustCanvasRequested; // collect requests until end of user event
196 BranchObj *editingBO; // entering Text into BO
199 QColor actColor; // actual color
200 QColor defLinkColor; // default color for links
201 QColor defXLinkColor; // default color for xlinks
202 int defXLinkWidth; // default width for xlinks
203 LinkColorHint linkcolorhint;// use heading color or own color
204 LinkStyle linkstyle; // default style for links
206 QCursor handOpenCursor; // cursor while moving canvas view
207 QCursor pickColorCursor; // cursor while picking color
209 bool drawingLink; // true while creating a link
210 bool copyingObj; // true while creating a link
213 LinkableMapObj* selection; // select a LinkableMapObj
214 LinkableMapObj* selectionLast; // last selection
215 MapObj* movingObj; // moving a MapObj
216 MapObj* linkingObj_src; // part of a link
217 QPoint movingObj_orgPos; // org. pos of mouse before move
218 QPoint movingObj_start; // rel. pos of mouse to absPos
219 QPoint movingCont_start; // inital pos of moving Content or
220 QPoint movingVec; // how far has Content moved
221 QPoint movingCenter; // used when zooming
222 QPrinter* printer; // Printing
224 bool mapDefault; // Flag if map is untouched
225 bool mapChanged; // Flag if undo is possible
226 bool mapUnsaved; // Flag if map should be saved
228 bool printFrame; // Print frame around map
229 bool printFooter; // Print footer below map
231 bool zipped; // should map be zipped
232 static int mapNum; // unique number for Editor
233 QString fileName; // short name of file (for tab)
234 QString filePath; // path to file which will be saved
235 QString fileDir; // dir where file is saved
236 QString destPath; // path to .vym file (needed for vymlinks)
237 QString mapName; // fileName without ".vym"
238 QString lastImageDir; // save dir for adding images
240 bool isInteractive; // non interactive don't need tmpdirs
241 QString tmpMapDir; // tmp directory with data for undo/redo
242 int undosTotal; // total number of undos
243 int undoNum; // current number of bakMapDir to be used
244 int undosAvail; // how many actions can currently be undone
245 bool blockReposition; // block while load or undo
246 bool blockSaveState; // block while load or undo
248 BranchObj* itFind; // next object in find process
249 bool EOFind; // true, if search failed
251 QPoint exportOffset; // set before export, used in save
252 HideTmpMode hidemode; // true while exporting to hide some stuff
254 void resizeEvent( QResizeEvent * );
256 Q3UrlOperator *urlOperator;
257 QDataStream *imageData;
258 QBuffer *imageBuffer;
260 ShowTextDialog *historyWindow;