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 QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
35 void saveState(); // save actual state to backup
36 void saveState(LinkableMapObj *);
37 void saveState(const QString &, const QString &);
38 void saveState(const QString &, LinkableMapObj *);
39 void saveState(const SaveMode&, const QString &, LinkableMapObj *, const QString &, LinkableMapObj *);
40 void parseAtom(const QString &);
42 void addFloatImage(const QPixmap &img);
45 void finishedLineEditNoSave();
46 void fetchImage(const QString &img);
47 void imageDataFetched(const QByteArray &, QNetworkOperation *);
48 void imageDataFinished(QNetworkOperation *);
51 bool isDefault(); // false, if map was changed once
52 bool isUnsaved(); // save necessary
53 bool hasChanged(); // undo possible
54 void setChanged(); // called from NoteEditor via LMO
56 void setFilePath (QString);
57 void setFilePath (QString,QString);
58 QString getFilePath (); // Full path e.g. "/home/tux/map.xml"
59 QString getFileName (); // e.g. "map.xml"
60 QString getMapName (); // e.g. "map"
61 QString getDestPath (); // e.g. "/home/tux/map.vym"
62 ErrorCode load (QString, 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
73 void exportOOPresentation(const QString &,const QString &);
74 void exportXML(const QString&); // export to directory
75 void clear(); // clear map
76 void copy(); // copy branch to clipboard
77 void redo(); // redo last action
78 void undo(); // undo last action
80 void undoXML(const QString &, const QString &);
81 void pasteNoSave(); // paste clipboard to branch
82 void cutNoSave(); // cut to clipboard
84 void paste(); // paste clipboard to branch and backup
85 void cut(); // cut to clipboard and backup
86 void move(const int &,const int&);
88 void moveBranchDown();
89 void editHeading(); // Start editing heading
91 void setHeading(const QString &); // Just set the heading for selection
92 void setURL(const QString &); // Just set the URL for selection
93 void setVymLink(const QString &); // Set vymLink for selection
95 void addNewBranch(int); // pos allows to add above/below selection
96 void addNewBranchHere(); // insert and make selection its
97 void deleteSelection();
98 LinkableMapObj* getSelection(); // returns selection
99 bool select(const QString &); // Select
100 void unselect(); // before changing current noteedit
101 void reselect(); // after changing current noteedit
103 void selectNextBranch(); // Increment number of branch
104 void selectPrevBranch(); // Decrement number of branch
106 void selectUpperBranch();
107 void selectLowerBranch();
108 void selectLeftBranch();
109 void selectRightBranch();
110 void selectFirstBranch();
111 void selectLastBranch();
112 void setColor(QColor);
113 void selectBackgroundColor();
114 void setBackgroundColor(QColor);
118 void toggleStandardFlag(QString);
119 virtual void setViewCenter(); // needed for zooming
120 BranchObj* findText(QString,bool); // Find object
121 void findReset(); // Reset Find
122 void openURL(); // open URL in external browser
123 void editURL(); // edit the URL
124 void editHeading2URL(); // copy heading to URL
125 void editBugzilla2URL(); // create URL to Bugzilla
126 void editFATE2URL(); // create URL to FATE
127 void editVymLink(); // edit link to another map
128 void deleteVymLink(); // delete link to another map
129 QString getVymLink(); // return path to map
130 void setHideExport(); // toggle the export flag
132 void toggleHideExport(); // toggle the export flag
134 void removeBranchHere(); // remove but keep childs
135 void removeChilds(); // remove childs
136 void editMapInfo(); // dialog to enter author, ...
137 void updateActions(); // update e.g. format buttons
138 void updateNoteFlag(); // when TextEditor changes
139 void setLinkStyle (LinkStyle); // Set style of link
140 LinkStyle getLinkStyle (); // requested in LMO
141 void setLinkColor(QColor); // default color of links
142 void setLinkColorHint(); // color of links
143 void setLinkColorHint(LinkColorHint); // color of links
144 LinkColorHint getLinkColorHint();
145 QColor getDefLinkColor();
146 void setDefXLinkColor(QColor);
147 QColor getDefXLinkColor();
148 void setDefXLinkWidth (int);
149 int getDefXLinkWidth();
150 void toggleLinkColorHint(); // after changing linkStyles
151 void selectLinkColor();
154 void loadFloatImage ();
155 void saveFloatImage (int);
156 void setFrame(const FrameType &);
157 void setIncludeImagesVer(bool);
158 void setIncludeImagesHor(bool);
159 void setHideLinkUnselected (bool);
160 bool getHideLinkUnselected ();
162 void importDir(BranchObj *,QDir);
165 void followXLink (int);
166 void editXLink (int);
167 void testFunction(); // FIXME just testing
170 void ensureSelectionVisible();
171 virtual void updateViewCenter(); // needed for zooming
172 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
173 virtual void contentsMousePressEvent(QMouseEvent*);
174 virtual void contentsMouseReleaseEvent(QMouseEvent*);
175 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
176 virtual void contentsMouseMoveEvent(QMouseEvent*);
178 virtual void contentsDragEnterEvent(QDragEnterEvent *event);
179 virtual void contentsDropEvent(QDropEvent *event);
182 MapCenterObj* mapCenter;
184 bool adjustCanvasRequested; // collect requests until end of user event
185 BranchObj *editingBO; // entering Text into BO
188 QColor actColor; // actual color
189 QColor defLinkColor; // default color for links
190 QColor defXLinkColor; // default color for xlinks
191 int defXLinkWidth; // default width for xlinks
192 LinkColorHint linkcolorhint;// use heading color or own color
193 LinkStyle linkstyle; // default style for links
195 QCursor handOpenCursor; // cursor while moving canvas view
196 QCursor pickColorCursor; // cursor while picking color
198 bool drawingLink; // true while creating a link
199 bool copyingObj; // true while creating a link
202 LinkableMapObj* selection; // select a LinkableMapObj
203 LinkableMapObj* selectionLast; // last selection
204 MapObj* movingObj; // moving a MapObj
205 MapObj* linkingObj_src; // part of a link
206 QPoint movingObj_orgPos; // org. pos of mouse before move
207 QPoint movingObj_start; // rel. pos of mouse to absPos
208 QPoint movingCont_start; // inital pos of moving Content or
209 QPoint movingVec; // how far has Content moved
210 QPoint movingCenter; // used when zooming
211 QPrinter* printer; // Printing
213 bool mapDefault; // Flag if map is untouched
214 bool mapChanged; // Flag if undo is possible
215 bool mapUnsaved; // Flag if map should be saved
217 bool printFrame; // Print frame around map
218 bool printFooter; // Print footer below map
220 bool zipped; // should map be zipped
221 static int mapNum; // unique number for Editor
222 QString fileName; // short name of file (for tab)
223 QString filePath; // path to file which will be saved
224 QString fileDir; // dir where file is saved
225 QString destPath; // path to .vym file (needed for vymlinks)
226 QString mapName; // fileName without ".vym"
227 QString lastImageDir; // save dir for adding images
229 bool isInteractive; // non interactive don't need tmpdirs
230 QString tmpMapDir; // tmp directory with data for undo/redo
231 int undosTotal; // total number of undos
232 int undoNum; // current number of bakMapDir to be used
233 int undosAvail; // how many actions can currently be undone
234 bool blockReposition; // block while load or undo
235 bool blockSaveState; // block while load or undo
237 BranchObj* itFind; // next object in find process
238 bool EOFind; // true, if search failed
240 QPoint exportOffset; // set before export, used in save
241 void resizeEvent( QResizeEvent * );
243 QUrlOperator *urlOperator;
244 QDataStream *imageData;
245 QBuffer *imageBuffer;