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 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 int 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
75 void exportOOPresentation();
76 void exportXML(const QString&); // export to directory
77 void clear(); // clear map
78 void copy(); // copy branch to clipboard
79 void redo(); // redo last action
80 void undo(); // undo last action
82 void undoXML(const QString &, const QString &);
83 void pasteNoSave(); // paste clipboard to branch
84 void cutNoSave(); // cut to clipboard
86 void paste(); // paste clipboard to branch and backup
87 void cut(); // cut to clipboard and backup
88 void move(const int &,const int&);
90 void moveBranchDown();
91 void editHeading(); // Start editing heading
93 void setHeading(const QString &); // Just set the heading for selection
94 void setURL(const QString &); // Just set the URL for selection
95 void setVymLink(const QString &); // Set vymLink for selection
97 void addNewBranch(int); // pos allows to add above/below selection
98 void addNewBranchHere(); // insert and make selection its
99 void deleteSelection();
100 LinkableMapObj* getSelection(); // returns selection
101 bool select(const QString &); // Select
102 void unselect(); // before changing current noteedit
103 void reselect(); // after changing current noteedit
105 void selectNextBranch(); // Increment number of branch
106 void selectPrevBranch(); // Decrement number of branch
108 void selectUpperBranch();
109 void selectLowerBranch();
110 void selectLeftBranch();
111 void selectRightBranch();
112 void selectFirstBranch();
113 void selectLastBranch();
114 void setColor(QColor);
115 void selectBackgroundColor();
116 void setBackgroundColor(QColor);
120 void toggleStandardFlag(QString);
121 virtual void setViewCenter(); // needed for zooming
122 BranchObj* findText(QString,bool); // Find object
123 void findReset(); // Reset Find
124 void openURL(); // open URL in external browser
125 void editURL(); // edit the URL
126 void editHeading2URL(); // copy heading to URL
127 void editBugzilla2URL(); // create URL to Bugzilla
128 void editVymLink(); // edit link to another map
129 void deleteVymLink(); // delete link to another map
130 QString getVymLink(); // return path to map
131 void removeBranchHere(); // remove but keep childs
132 void removeChilds(); // remove childs
133 void editMapInfo(); // dialog to enter author, ...
134 void updateActions(); // update e.g. format buttons
135 void updateNoteFlag(); // when TextEditor changes
136 void setLinkStyle (LinkStyle); // Set style of link
137 LinkStyle getLinkStyle (); // requested in LMO
138 void setLinkColor(QColor); // default color of links
139 void setLinkColorHint(); // color of links
140 void setLinkColorHint(LinkColorHint); // color of links
141 LinkColorHint getLinkColorHint();
142 QColor getDefLinkColor();
143 void setDefXLinkColor(QColor);
144 QColor getDefXLinkColor();
145 void setDefXLinkWidth (int);
146 int getDefXLinkWidth();
147 void toggleLinkColorHint(); // after changing linkStyles
148 void selectLinkColor();
151 void loadFloatImage ();
152 void saveFloatImage (int);
153 void toggleFloatExport();
154 void setFrame(const FrameType &);
155 void setHideLinkUnselected (bool);
156 bool getHideLinkUnselected ();
158 void importDir(BranchObj *,QDir);
161 void followXLink (int);
162 void editXLink (int);
163 void testFunction(); // FIXME just testing
166 void ensureSelectionVisible();
167 virtual void updateViewCenter(); // needed for zooming
168 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
169 virtual void contentsMousePressEvent(QMouseEvent*);
170 virtual void contentsMouseReleaseEvent(QMouseEvent*);
171 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
172 virtual void contentsMouseMoveEvent(QMouseEvent*);
174 virtual void contentsDragEnterEvent(QDragEnterEvent *event);
175 virtual void contentsDropEvent(QDropEvent *event);
178 MapCenterObj* mapCenter;
180 bool adjustCanvasRequested; // collect requests until end of user event
181 BranchObj *editingBO; // entering Text into BO
184 QColor actColor; // actual color
185 QColor defLinkColor; // default color for links
186 QColor defXLinkColor; // default color for xlinks
187 int defXLinkWidth; // default width for xlinks
188 LinkColorHint linkcolorhint;// use heading color or own color
189 LinkStyle linkstyle; // default style for links
191 QCursor handOpenCursor; // cursor while moving canvas view
192 QCursor pickColorCursor; // cursor while picking color
194 bool drawingLink; // true while creating a link
195 bool copyingObj; // true while creating a link
198 LinkableMapObj* selection; // select a LinkableMapObj
199 LinkableMapObj* selectionLast; // last selection
200 MapObj* movingObj; // moving a MapObj
201 MapObj* linkingObj_src; // part of a link
202 QPoint movingObj_orgPos; // org. pos of mouse before move
203 QPoint movingObj_start; // rel. pos of mouse to absPos
204 QPoint movingCont_start; // inital pos of moving Content or
205 QPoint movingVec; // how far has Content moved
206 QPoint movingCenter; // used when zooming
207 QPrinter* printer; // Printing
209 bool mapDefault; // Flag if map is untouched
210 bool mapChanged; // Flag if undo is possible
211 bool mapUnsaved; // Flag if map should be saved
213 bool printFrame; // Print frame around map
214 bool printFooter; // Print footer below map
216 bool zipped; // should map be zipped
217 static int mapNum; // unique number for Editor
218 QString fileName; // short name of file (for tab)
219 QString filePath; // path to file which will be saved
220 QString fileDir; // dir where file is saved
221 QString destPath; // path to .vym file (needed for vymlinks)
222 QString mapName; // fileName without ".vym"
223 QString lastImageDir; // save dir for adding images
225 bool isInteractive; // non interactive don't need tmpdirs
226 QString tmpMapDir; // tmp directory with data for undo/redo
227 int undosTotal; // total number of undos
228 int undoNum; // current number of bakMapDir to be used
229 int undosAvail; // how many actions can currently be undone
230 bool blockReposition; // block while load or undo
231 bool blockSaveState; // block while load or undo
233 BranchObj* itFind; // next object in find process
234 bool EOFind; // true, if search failed
236 QPoint exportOffset; // set before export, used in save
237 void resizeEvent( QResizeEvent * );
239 QUrlOperator *urlOperator;
240 QDataStream *imageData;
241 QBuffer *imageBuffer;