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
38 void saveState(LinkableMapObj *);
39 void saveState(const QString &);
40 void saveState(const SaveMode&, LinkableMapObj *, 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
86 void moveBranchDown();
87 void editHeading(); // Start editing heading
89 void setHeading(const QString &); // Just set the heading for selection
91 void addNewBranch(int); // pos allows to add above/below selection
92 void addNewBranchHere(); // insert and make selection its
93 void deleteSelection();
94 LinkableMapObj* getSelection(); // returns selection
95 bool select(const QString &); // Select
96 void unselect(); // before changing current noteedit
97 void reselect(); // after changing current noteedit
99 void selectNextBranch(); // Increment number of branch
100 void selectPrevBranch(); // Decrement number of branch
102 void selectUpperBranch();
103 void selectLowerBranch();
104 void selectLeftBranch();
105 void selectRightBranch();
106 void selectFirstBranch();
107 void selectLastBranch();
108 void setColor(QColor);
109 void selectBackgroundColor();
110 void setBackgroundColor(QColor);
114 void toggleStandardFlag(QString);
115 virtual void setViewCenter(); // needed for zooming
116 BranchObj* findText(QString,bool); // Find object
117 void findReset(); // Reset Find
118 void openURL(); // open URL in external browser
119 void editURL(); // edit the URL
120 void editHeading2URL(); // copy heading to URL
121 void editBugzilla2URL(); // create URL to Bugzilla
122 void editVymLink(); // edit link to another map
123 void deleteVymLink(); // delete link to another map
124 QString getVymLink(); // return path to map
125 void removeBranchHere(); // remove but keep childs
126 void removeChilds(); // remove childs
127 void editMapInfo(); // dialog to enter author, ...
128 void updateActions(); // update e.g. format buttons
129 void setLinkStyle (LinkStyle); // Set style of link
130 LinkStyle getLinkStyle (); // requested in LMO
131 void setLinkColor(QColor); // default color of links
132 void setLinkColorHint(); // color of links
133 void setLinkColorHint(LinkColorHint); // color of links
134 LinkColorHint getLinkColorHint();
135 QColor getDefLinkColor();
136 void setDefXLinkColor(QColor);
137 QColor getDefXLinkColor();
138 void setDefXLinkWidth (int);
139 int getDefXLinkWidth();
140 void toggleLinkColorHint(); // after changing linkStyles
141 void selectLinkColor();
144 void loadFloatImage ();
145 void saveFloatImage (int);
146 void toggleFloatExport();
147 void setFrame(const FrameType &);
149 void importDir(BranchObj *,QDir);
152 void followXLink (int);
153 void editXLink (int);
154 void testFunction(); // FIXME just testing
157 void ensureSelectionVisible();
158 virtual void updateViewCenter(); // needed for zooming
159 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
160 virtual void contentsMousePressEvent(QMouseEvent*);
161 virtual void contentsMouseReleaseEvent(QMouseEvent*);
162 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
163 virtual void contentsMouseMoveEvent(QMouseEvent*);
165 virtual void contentsDragEnterEvent(QDragEnterEvent *event);
166 virtual void contentsDropEvent(QDropEvent *event);
169 MapCenterObj* mapCenter;
171 bool adjustCanvasRequested; // collect requests until end of user event
172 BranchObj *editingBO; // entering Text into BO
175 QColor actColor; // actual color
176 QColor defLinkColor; // default color for links
177 QColor defXLinkColor; // default color for xlinks
178 int defXLinkWidth; // default width for xlinks
179 LinkColorHint linkcolorhint;// use heading color or own color
180 LinkStyle linkstyle; // default style for links
182 QCursor handOpenCursor; // cursor while moving canvas view
183 QCursor pickColorCursor; // cursor while picking color
185 bool drawingLink; // true while creating a link
186 bool copyingObj; // true while creating a link
189 LinkableMapObj* selection; // select a LinkableMapObj
190 LinkableMapObj* selectionLast; // last selection
191 MapObj* movingObj; // moving a MapObj
192 MapObj* linkingObj_src; // part of a link
193 QPoint movingObj_start; // rel. pos of mouse to absPos
194 QPoint movingCont_start; // inital pos of moving Content or
195 QPoint movingVec; // how far has Content moved
196 QPoint movingCenter; // used when zooming
197 QPrinter* printer; // Printing
199 bool mapDefault; // Flag if map is untouched
200 bool mapChanged; // Flag if undo is possible
201 bool mapUnsaved; // Flag if map should be saved
202 QString backupXML; // backup (XML) for undo
203 QString undoCommand; // FIXME testing
206 bool printFrame; // Print frame around map
207 bool printFooter; // Print footer below map
209 bool zipped; // should map be zipped
210 QString fileName; // short name of file (for tab)
211 QString filePath; // path to file which will be saved
212 QString fileDir; // dir where file is saved
213 QString destPath; // path to .vym file (needed for vymlinks)
214 QString mapName; // fileName without ".vym"
215 QString lastImageDir; // save dir for adding images
217 bool isInteractive; // non interactive don't need tmpdirs
218 QString bakMapDir; // tmp directory with data for undo
219 bool blockreposition; // block while load or undo
221 BranchObj* itFind; // next object in find process
222 bool EOFind; // true, if search failed
224 QPoint exportOffset; // set before export, used in save
225 void resizeEvent( QResizeEvent * );
227 QUrlOperator *urlOperator;
228 QDataStream *imageData;
229 QBuffer *imageBuffer;