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 updateNoteFlag(); // when TextEditor changes
133 void setLinkStyle (LinkStyle); // Set style of link
134 LinkStyle getLinkStyle (); // requested in LMO
135 void setLinkColor(QColor); // default color of links
136 void setLinkColorHint(); // color of links
137 void setLinkColorHint(LinkColorHint); // color of links
138 LinkColorHint getLinkColorHint();
139 QColor getDefLinkColor();
140 void setDefXLinkColor(QColor);
141 QColor getDefXLinkColor();
142 void setDefXLinkWidth (int);
143 int getDefXLinkWidth();
144 void toggleLinkColorHint(); // after changing linkStyles
145 void selectLinkColor();
148 void loadFloatImage ();
149 void saveFloatImage (int);
150 void toggleFloatExport();
151 void setFrame(const FrameType &);
152 void setHideLinkUnselected (bool);
153 bool getHideLinkUnselected ();
155 void importDir(BranchObj *,QDir);
158 void followXLink (int);
159 void editXLink (int);
160 void testFunction(); // FIXME just testing
163 void ensureSelectionVisible();
164 virtual void updateViewCenter(); // needed for zooming
165 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
166 virtual void contentsMousePressEvent(QMouseEvent*);
167 virtual void contentsMouseReleaseEvent(QMouseEvent*);
168 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
169 virtual void contentsMouseMoveEvent(QMouseEvent*);
171 virtual void contentsDragEnterEvent(QDragEnterEvent *event);
172 virtual void contentsDropEvent(QDropEvent *event);
175 MapCenterObj* mapCenter;
177 bool adjustCanvasRequested; // collect requests until end of user event
178 BranchObj *editingBO; // entering Text into BO
181 QColor actColor; // actual color
182 QColor defLinkColor; // default color for links
183 QColor defXLinkColor; // default color for xlinks
184 int defXLinkWidth; // default width for xlinks
185 LinkColorHint linkcolorhint;// use heading color or own color
186 LinkStyle linkstyle; // default style for links
188 QCursor handOpenCursor; // cursor while moving canvas view
189 QCursor pickColorCursor; // cursor while picking color
191 bool drawingLink; // true while creating a link
192 bool copyingObj; // true while creating a link
195 LinkableMapObj* selection; // select a LinkableMapObj
196 LinkableMapObj* selectionLast; // last selection
197 QString undoSelection; // selection for undo
198 QString redoSelection; // selection for redo
199 MapObj* movingObj; // moving a MapObj
200 MapObj* linkingObj_src; // part of a link
201 QPoint movingObj_orgPos; // org. pos of mouse before move
202 QPoint movingObj_start; // rel. pos of mouse to absPos
203 QPoint movingCont_start; // inital pos of moving Content or
204 QPoint movingVec; // how far has Content moved
205 QPoint movingCenter; // used when zooming
206 QPrinter* printer; // Printing
208 bool mapDefault; // Flag if map is untouched
209 bool mapChanged; // Flag if undo is possible
210 bool mapUnsaved; // Flag if map should be saved
211 QString backupXML; // backup (XML) for undo
212 QString undoCommand; // FIXME testing
213 QString redoCommand; // FIXME testing
216 bool printFrame; // Print frame around map
217 bool printFooter; // Print footer below map
219 bool zipped; // should map be zipped
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 bakMapDir; // tmp directory with data for undo
229 bool blockReposition; // block while load or undo
230 bool blockSaveState; // block while load or undo
232 BranchObj* itFind; // next object in find process
233 bool EOFind; // true, if search failed
235 QPoint exportOffset; // set before export, used in save
236 void resizeEvent( QResizeEvent * );
238 QUrlOperator *urlOperator;
239 QDataStream *imageData;
240 QBuffer *imageBuffer;