5 //#include <q3filedialog.h>
6 //#include <q3process.h>
8 #include <QContextMenuEvent>
10 #include <QDragEnterEvent>
14 #include <QMouseEvent>
16 #include <QResizeEvent>
18 #include "mapcenterobj.h"
21 #include "selection.h"
23 #include "showtextdialog.h"
25 class Q3NetworkOperation;
28 class MapEditor : public Q3CanvasView , public xmlObj {
32 MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, Qt::WFlags f=0);
35 QColor backgroundColor();
36 MapCenterObj* getMapCenter();
37 Q3Canvas* getCanvas();
38 void adjustCanvasSize();// adjust canvas size to map and scrollview
39 bool isRepositionBlocked(); // block while load or undo
42 QString getName(LinkableMapObj*); // Get e.g. heading or filename
43 void makeTmpDirs(); // create temporary directories
44 QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
45 void saveStateComplete (const QString &);
46 void saveStatePart (LinkableMapObj *, const QString &);
47 void saveStateConstSelection (const QString &, const QString &, const QString &);
48 void saveStateComData (LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &, LinkableMapObj *);
49 void saveState(LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &);
50 void saveState(const QString &, const QString &, const QString &, const QString &, const QString &);
51 void saveState(const SaveMode&, const QString &, const QString &, const QString &, const QString &, const QString &, LinkableMapObj *);
52 void parseAtom(const QString &);
54 void addFloatImage(const QPixmap &img);
57 void fetchImage(const QString &img);
58 void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
59 void imageDataFinished(Q3NetworkOperation *);
62 void toggleHistoryWindow();
63 bool isDefault(); // false, if map was changed once
64 bool isUnsaved(); // save necessary
65 bool hasChanged(); // undo possible
66 void setChanged(); // called from NoteEditor via LMO
68 void setFilePath (QString);
69 void setFilePath (QString,QString);
70 QString getFilePath (); // Full path e.g. "/home/tux/map.xml"
71 QString getFileName (); // e.g. "map.xml"
72 QString getMapName (); // e.g. "map"
73 QString getDestPath (); // e.g. "/home/tux/map.vym"
74 ErrorCode load (QString, LoadMode ); // newmap, import/replace selection
76 int save(const SaveMode &); // Save map
77 void setZipped(bool); // save map zipped
78 bool saveZipped(); // 1 if file will be saved zipped
79 void print(); // print canvas
82 void setHideTmpMode (HideTmpMode); // temporary hide stuff
83 HideTmpMode getHideTmpMode(); // temporary hide stuff
85 void setExportMode (bool); // temporary hide stuff during export
86 void exportImage (QString fn); // export as PNG
87 void exportImage (QString fn, QString); // export in given format
88 void exportOOPresentation(const QString &,const QString &);
89 void exportXML(const QString&); // export to directory
90 void clear(); // clear map
91 void copy(); // copy branch to clipboard
92 void redo(); // redo last action
93 void undo(); // undo last action
95 void undoXML(const QString &, const QString &);
96 void pasteNoSave(); // paste clipboard to branch
97 void cutNoSave(); // cut to clipboard
99 void paste(); // paste clipboard to branch and backup
100 void cut(); // cut to clipboard and backup
101 void move (const int &,const int&);
102 void moveRel (const int &,const int&);
104 void moveBranchDown();
105 QString getHeading (bool &,QPoint &); // Get heading, ok if selection is branch
106 void setHeading(const QString &);
108 void setHeadingInt(const QString &);
109 void setURLInt(const QString &); // Just set the URL for selection
110 void setVymLinkInt(const QString &); // Set vymLink for selection
111 BranchObj* addNewBranchInt(int); // pos allows to add above/below selection
113 void addNewBranch(int); // pos allows to add above/below selection
114 void addNewBranchHere(); // insert and make selection its
115 void deleteSelection();
116 LinkableMapObj* getSelection(); // returns selection
117 void unselect(); // before changing current noteedit
118 void reselect(); // after changing current noteedit
119 bool select(const QString &); // Select by string
120 QString getSelectString();
122 void selectInt(LinkableMapObj*);
123 void selectNextBranchInt(); // Increment number of branch
124 void selectPrevBranchInt(); // Decrement number of branch
126 void selectUpperBranch();
127 void selectLowerBranch();
128 void selectLeftBranch();
129 void selectRightBranch();
130 void selectFirstBranch();
131 void selectLastBranch();
132 void setColor(QColor);
133 void selectBackgroundColor();
134 void setBackgroundColor(QColor);
138 void toggleStandardFlag(QString);
139 virtual void setViewCenter(); // needed for zooming
140 BranchObj* findText(QString,bool); // Find object
141 void findReset(); // Reset Find
142 void editURL(); // edit the URL
143 QString getURL(); // returns URL of selection or ""
144 QStringList getURLs(); // returns URLs of subtree
145 void editHeading2URL(); // copy heading to URL
146 void editBugzilla2URL(); // create URL to Bugzilla
147 void editFATE2URL(); // create URL to FATE
148 void editVymLink(); // edit link to another map
149 void deleteVymLink(); // delete link to another map
150 QString getVymLink(); // return path to map
151 QStringList getVymLinks(); // return paths in subtree
152 void toggleHideExport(); // toggle the export flag
153 void removeBranchKeepChilds(); // remove but keep childs
154 void removeChilds(); // remove childs
155 void editMapInfo(); // dialog to enter author, ...
156 void updateActions(); // update e.g. format buttons
157 void updateNoteFlag(); // when TextEditor changes
158 void setLinkStyle (LinkStyle); // Set style of link
159 LinkStyle getLinkStyle (); // requested in LMO
160 void setLinkColor(QColor); // default color of links
161 void setLinkColorHint(); // color of links
162 void setLinkColorHint(LinkColorHint); // color of links
163 LinkColorHint getLinkColorHint();
164 QColor getDefLinkColor();
165 void setDefXLinkColor(QColor);
166 QColor getDefXLinkColor();
167 void setDefXLinkWidth (int);
168 int getDefXLinkWidth();
169 void toggleLinkColorHint(); // after changing linkStyles
170 void selectLinkColor();
173 void loadFloatImage ();
174 void saveFloatImage ();
175 void setFrame(const FrameType &);
176 void setIncludeImagesVer(bool);
177 void setIncludeImagesHor(bool);
178 void setHideLinkUnselected (bool);
179 bool getHideLinkUnselected ();
181 void importDirInt(BranchObj *,QDir);
184 void followXLink (int);
185 void editXLink (int);
186 void testFunction(); // just testing new stuff
187 // set /mainwindo/showTestMenu=true...
190 void ensureSelectionVisible();
191 virtual void updateViewCenter(); // needed for zooming
192 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
193 virtual void contentsMousePressEvent(QMouseEvent*);
194 virtual void contentsMouseReleaseEvent(QMouseEvent*);
195 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
196 virtual void contentsMouseMoveEvent(QMouseEvent*);
198 virtual void contentsDragEnterEvent(QDragEnterEvent *event);
199 virtual void contentsDropEvent(QDropEvent *event);
202 MapCenterObj* mapCenter;
204 bool adjustCanvasRequested; // collect requests until end of user event
205 BranchObj *editingBO; // entering Text into BO
207 QColor actColor; // actual color
208 QColor defLinkColor; // default color for links
209 QColor defXLinkColor; // default color for xlinks
210 int defXLinkWidth; // default width for xlinks
211 LinkColorHint linkcolorhint;// use heading color or own color
212 LinkStyle linkstyle; // default style for links
214 QCursor handOpenCursor; // cursor while moving canvas view
215 QCursor pickColorCursor; // cursor while picking color
217 bool drawingLink; // true while creating a link
218 bool copyingObj; // true while creating a link
222 LinkableMapObj* selection; // select a LinkableMapObj
223 LinkableMapObj* selectionLast; // last selection
224 MapObj* movingObj; // moving a MapObj
225 MapObj* linkingObj_src; // part of a link
226 QPoint movingObj_orgPos; // org. pos of mouse before move
227 QPoint movingObj_orgRelPos; // org. relative pos of mouse before move
228 QPoint movingObj_start; // rel. pos of mouse to absPos
229 QPoint movingCont_start; // inital pos of moving Content or
230 QPoint movingVec; // how far has Content moved
231 QPoint movingCenter; // used when zooming
232 QPrinter* printer; // Printing
234 bool mapDefault; // Flag if map is untouched
235 bool mapChanged; // Flag if undo is possible
236 bool mapUnsaved; // Flag if map should be saved
238 bool printFrame; // Print frame around map
239 bool printFooter; // Print footer below map
241 bool zipped; // should map be zipped
242 static int mapNum; // unique number for Editor
243 QString fileName; // short name of file (for tab)
244 QString filePath; // path to file which will be saved
245 QString fileDir; // dir where file is saved
246 QString destPath; // path to .vym file (needed for vymlinks)
247 QString mapName; // fileName without ".vym"
249 bool isInteractive; // non interactive don't need tmpdirs
250 QString tmpMapDir; // tmp directory with data for undo/redo
251 QString histPath; // Path to history file
252 int undosTotal; // total number of undos
253 SimpleSettings undoSet; // undo/redo commands
254 bool blockReposition; // block while load or undo
255 bool blockSaveState; // block while load or undo
257 BranchObj* itFind; // next object in find process
258 bool EOFind; // true, if search failed
260 QPoint exportOffset; // set before export, used in save
261 HideTmpMode hidemode; // true while exporting to hide some stuff
263 void resizeEvent( QResizeEvent * );
265 Q3UrlOperator *urlOperator;
266 QDataStream *imageData;
267 QBuffer *imageBuffer;
269 ShowTextDialog *historyWindow;