7 #include "mapcenterobj.h"
9 #include "historywindow.h"
11 #include "selection.h"
14 class Q3NetworkOperation;
17 class MapEditor : public Q3CanvasView , public xmlObj {
21 MapEditor(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
23 MapCenterObj* getMapCenter();
24 Q3Canvas* getCanvas();
25 void adjustCanvasSize();// adjust canvas size to map and scrollview
26 bool isRepositionBlocked(); // block while load or undo
29 QString getName(LinkableMapObj*); // Get e.g. heading or filename
30 void makeTmpDirs(); // create temporary directories
31 QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
32 void saveStateChangingPart (LinkableMapObj *, LinkableMapObj *, const QString &, const QString &);
33 void saveStateRemovingPart (LinkableMapObj *, const QString &);
34 void saveState(LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &);
35 void saveState(const QString &, const QString &, const QString &, const QString &, const QString &);
36 void saveState(const SaveMode&, const QString &, const QString &, const QString &, const QString &, const QString &, LinkableMapObj *);
38 void parseAtom(const QString &);
40 void addFloatImageInt(const QPixmap &img);
43 void fetchImage(const QString &img);
44 void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
45 void imageDataFinished(Q3NetworkOperation *);
48 void toggleHistoryWindow();
49 bool isDefault(); // false, if map was changed once
50 bool isUnsaved(); // save necessary
51 bool hasChanged(); // undo possible
52 void setChanged(); // called from NoteEditor via LMO
54 void setFilePath (QString);
55 void setFilePath (QString,QString);
56 QString getFilePath (); // Full path e.g. "/home/tux/map.xml"
57 QString getFileName (); // e.g. "map.xml"
58 QString getMapName (); // e.g. "map"
59 QString getDestPath (); // e.g. "/home/tux/map.vym"
60 ErrorCode load (QString, LoadMode ); // newmap, import/replace selection
62 int save(const SaveMode &); // Save map
63 void setZipped(bool); // save map zipped
64 bool saveZipped(); // 1 if file will be saved zipped
65 void print(); // print canvas
68 void setHideTmpMode (HideTmpMode); // temporary hide stuff
69 HideTmpMode getHideTmpMode(); // temporary hide stuff
71 void setExportMode (bool); // temporary hide stuff during export
72 void exportImage (QString fn); // export as PNG
73 void exportImage (QString fn, QString); // export in given format
74 void exportOOPresentation(const QString &,const QString &);
75 void exportXML(const QString&); // export to directory
76 void clear(); // clear map
77 void copy(); // copy branch to clipboard
78 void redo(); // redo last action
79 bool isRedoAvailable();
80 void undo(); // undo last action
81 bool isUndoAvailable();
82 void gotoStep (int);// goto a step in history
84 void addMapReplaceInt(const QString & undoSel, const QString & path);
85 void addMapInsertInt (const QString & path, int pos);
86 void pasteNoSave(); // paste clipboard to branch
87 void cutNoSave(); // cut to clipboard
89 void paste(); // paste clipboard to branch and backup
90 void cut(); // cut to clipboard and backup
91 void move (const int &x, const int &y);
92 void moveRel (const int &x, const int &y);
94 void moveBranchDown();
95 QString getHeading (bool &ok,QPoint &p); // Get heading, ok if selection is branch
96 void setHeading(const QString &);
98 void setHeadingInt(const QString &);
99 void setURLInt(const QString &); // Just set the URL for selection
100 void setVymLinkInt(const QString &); // Set vymLink for selection
101 BranchObj* addNewBranchInt(int); // pos allows to add above/below selection
103 BranchObj* addNewBranch(int); // pos allows to add above/below selection
104 BranchObj* addNewBranchBefore(); // insert and make selection its
105 void deleteSelection();
106 LinkableMapObj* getSelection(); // returns selection
107 void unselect(); // before changing current noteedit
108 void reselect(); // after changing current noteedit
109 bool select(const QString &); // Select by string
110 QString getSelectString();
112 void selectInt(LinkableMapObj*);
113 void selectNextBranchInt(); // Increment number of branch
114 void selectPrevBranchInt(); // Decrement number of branch
116 void selectUpperBranch();
117 void selectLowerBranch();
118 void selectLeftBranch();
119 void selectRightBranch();
120 void selectFirstBranch();
121 void selectLastBranch();
122 void selectMapBackgroundColor();
123 void setMapBackgroundColor(QColor);
124 QColor getMapBackgroundColor();
125 QColor getCurrentHeadingColor();
126 void colorItem(QColor);
127 void colorBranch(QColor);
128 void toggleStandardFlag(QString);
129 virtual void setViewCenter(); // needed for zooming
130 BranchObj* findText(QString,bool); // Find object
131 void findReset(); // Reset Find
132 void setURL(const QString &); // set the URL
133 void editURL(); // edit the URL
134 QString getURL(); // returns URL of selection or ""
135 QStringList getURLs(); // returns URLs of subtree
136 void editHeading2URL(); // copy heading to URL
137 void editBugzilla2URL(); // create URL to Bugzilla
138 void editFATE2URL(); // create URL to FATE
139 void editVymLink(); // edit link to another map
140 void deleteVymLink(); // delete link to another map
141 QString getVymLink(); // return path to map
142 QStringList getVymLinks(); // return paths in subtree
143 void setHideExport(bool); // toggle the export flag
144 void toggleHideExport(); // toggle the export flag
145 void deleteKeepChilds(); // remove but keep childs
146 void deleteChilds(); // remove childs
147 void editMapInfo(); // dialog to enter author, ...
148 void updateActions(); // update e.g. format buttons
149 void updateNoteFlag(); // when TextEditor changes
150 void setMapAuthor (const QString &);
151 void setMapComment(const QString &);
152 void setMapLinkStyle (const QString &); // Set style of link
153 LinkStyle getMapLinkStyle (); // requested in LMO
154 void setMapDefLinkColor(QColor); // default color of links
155 void setMapLinkColorHintInt(); // color of links
156 void setMapLinkColorHint(LinkColorHint);// color of links
157 LinkColorHint getMapLinkColorHint();
158 QColor getMapDefLinkColor();
159 void setMapDefXLinkColor(QColor);
160 QColor getMapDefXLinkColor();
161 void setMapDefXLinkWidth (int);
162 int getMapDefXLinkWidth();
163 void toggleMapLinkColorHint(); // after changing linkStyles
164 void selectMapLinkColor();
167 void loadFloatImage ();
168 void saveFloatImage ();
169 void setFrame(const FrameType &);
170 void setIncludeImagesVer(bool);
171 void setIncludeImagesHor(bool);
172 void setHideLinkUnselected (bool);
173 bool getHideLinkUnselected ();
175 void importDirInt(BranchObj *,QDir);
178 void followXLink (int);
179 void editXLink (int);
180 void testFunction(); // just testing new stuff
181 // set /mainwindo/showTestMenu=true...
184 void ensureSelectionVisible();
185 virtual void updateViewCenter(); // needed for zooming
186 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
187 virtual void keyPressEvent(QKeyEvent*);
188 virtual void keyReleaseEvent(QKeyEvent*);
189 virtual void contentsMousePressEvent(QMouseEvent*);
190 virtual void contentsMouseReleaseEvent(QMouseEvent*);
191 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
192 virtual void contentsMouseMoveEvent(QMouseEvent*);
194 virtual void contentsDragEnterEvent(QDragEnterEvent *event);
195 virtual void contentsDropEvent(QDropEvent *event);
198 MapCenterObj* mapCenter;
200 bool adjustCanvasRequested; // collect requests until end of user event
201 BranchObj *editingBO; // entering Text into BO
203 QColor defLinkColor; // default color for links
204 QColor defXLinkColor; // default color for xlinks
205 int defXLinkWidth; // default width for xlinks
206 LinkColorHint linkcolorhint;// use heading color or own color
207 LinkStyle linkstyle; // default style for links
209 QCursor HandOpenCursor; // cursor while moving canvas view
210 QCursor PickColorCursor; // cursor while picking color
211 QCursor CopyCursor; // cursor while picking color
212 QCursor XLinkCursor; // cursor while picking color
214 bool drawingLink; // true while creating a link
215 bool copyingObj; // true while creating a link
219 LinkableMapObj* selection; // select a LinkableMapObj
220 LinkableMapObj* selectionLast; // last selection
221 MapObj* movingObj; // moving a MapObj
222 MapObj* linkingObj_src; // part of a link
223 QPoint movingObj_orgPos; // org. pos of mouse before move
224 QPoint movingObj_orgRelPos; // org. relative pos of mouse before move
225 QPoint movingObj_start; // rel. pos of mouse to absPos
226 QPoint movingCont_start; // inital pos of moving Content or
227 QPoint movingVec; // how far has Content moved
228 QPoint movingCenter; // used when zooming
229 QPrinter* printer; // Printing
231 bool mapDefault; // Flag if map is untouched
232 bool mapChanged; // Flag if undo is possible
233 bool mapUnsaved; // Flag if map should be saved
235 bool printFrame; // Print frame around map
236 bool printFooter; // Print footer below map
238 bool zipped; // should map be zipped
239 static int mapNum; // unique number for Editor
240 QString fileName; // short name of file (for tab)
241 QString filePath; // path to file which will be saved
242 QString fileDir; // dir where file is saved
243 QString destPath; // path to .vym file (needed for vymlinks)
244 QString mapName; // fileName without ".vym"
246 QString tmpMapDir; // tmp directory with undo history
247 QString histPath; // Path to history file
248 int stepsTotal; // total number of steps (undos+redos)
249 SimpleSettings undoSet; // undo/redo commands
250 bool blockReposition; // block while load or undo
251 bool blockSaveState; // block while load or undo
253 BranchObj* itFind; // next object in find process
254 bool EOFind; // true, if search failed
256 QPoint exportOffset; // set before export, used in save
257 HideTmpMode hidemode; // true while exporting to hide some stuff
259 void resizeEvent( QResizeEvent * );
261 Q3UrlOperator *urlOperator;
262 QDataStream *imageData;
263 QBuffer *imageBuffer;
265 HistoryWindow historyWindow;