Cleaned up mmap import a bit. Started to convert flags there, too
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 void delTmpDirs(); // delete temporary directories
35 QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
36 void saveState(); // save actual state to backup
37 void saveState(LinkableMapObj *);
38 void saveState(const QString &, const QString &);
39 void saveState(const QString &, LinkableMapObj *);
40 void saveState(const SaveMode&, const QString &, LinkableMapObj *, const QString &, LinkableMapObj *);
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 ErrorCode load (QString, LoadMode ); // newmap, import/replace selection
65 int save(const SaveMode &); // Save map
66 void setZipped(bool); // save map zipped
67 bool saveZipped(); // 1 if file will be saved zipped
68 void print(); // print canvas
72 void exportImage (QString fn); // export as PNG
73 void exportImage (QString fn, int); // export in given format
76 void exportOOPresentation(const QString &,const QString &);
77 void exportXML(const QString&); // export to directory
78 void clear(); // clear map
79 void copy(); // copy branch to clipboard
80 void redo(); // redo last action
81 void undo(); // undo last action
83 void undoXML(const QString &, const QString &);
84 void pasteNoSave(); // paste clipboard to branch
85 void cutNoSave(); // cut to clipboard
87 void paste(); // paste clipboard to branch and backup
88 void cut(); // cut to clipboard and backup
89 void move(const int &,const int&);
91 void moveBranchDown();
92 void editHeading(); // Start editing heading
94 void setHeading(const QString &); // Just set the heading for selection
95 void setURL(const QString &); // Just set the URL for selection
96 void setVymLink(const QString &); // Set vymLink for selection
98 void addNewBranch(int); // pos allows to add above/below selection
99 void addNewBranchHere(); // insert and make selection its
100 void deleteSelection();
101 LinkableMapObj* getSelection(); // returns selection
102 bool select(const QString &); // Select
103 void unselect(); // before changing current noteedit
104 void reselect(); // after changing current noteedit
106 void selectNextBranch(); // Increment number of branch
107 void selectPrevBranch(); // Decrement number of branch
109 void selectUpperBranch();
110 void selectLowerBranch();
111 void selectLeftBranch();
112 void selectRightBranch();
113 void selectFirstBranch();
114 void selectLastBranch();
115 void setColor(QColor);
116 void selectBackgroundColor();
117 void setBackgroundColor(QColor);
121 void toggleStandardFlag(QString);
122 virtual void setViewCenter(); // needed for zooming
123 BranchObj* findText(QString,bool); // Find object
124 void findReset(); // Reset Find
125 void openURL(); // open URL in external browser
126 void editURL(); // edit the URL
127 void editHeading2URL(); // copy heading to URL
128 void editBugzilla2URL(); // create URL to Bugzilla
129 void editFATE2URL(); // create URL to FATE
130 void editVymLink(); // edit link to another map
131 void deleteVymLink(); // delete link to another map
132 QString getVymLink(); // return path to map
133 void removeBranchHere(); // remove but keep childs
134 void removeChilds(); // remove childs
135 void editMapInfo(); // dialog to enter author, ...
136 void updateActions(); // update e.g. format buttons
137 void updateNoteFlag(); // when TextEditor changes
138 void setLinkStyle (LinkStyle); // Set style of link
139 LinkStyle getLinkStyle (); // requested in LMO
140 void setLinkColor(QColor); // default color of links
141 void setLinkColorHint(); // color of links
142 void setLinkColorHint(LinkColorHint); // color of links
143 LinkColorHint getLinkColorHint();
144 QColor getDefLinkColor();
145 void setDefXLinkColor(QColor);
146 QColor getDefXLinkColor();
147 void setDefXLinkWidth (int);
148 int getDefXLinkWidth();
149 void toggleLinkColorHint(); // after changing linkStyles
150 void selectLinkColor();
153 void loadFloatImage ();
154 void saveFloatImage (int);
155 void toggleFloatExport();
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;