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);
24 QColor getBackgroundColor();
25 MapCenterObj* getMapCenter();
26 Q3Canvas* getCanvas();
27 void adjustCanvasSize();// adjust canvas size to map and scrollview
28 bool isRepositionBlocked(); // block while load or undo
31 QString getName(LinkableMapObj*); // Get e.g. heading or filename
32 void makeTmpDirs(); // create temporary directories
33 QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
34 void saveStateComplete (const QString &);
35 void saveStateChangingPart (LinkableMapObj *, const QString &);
36 void saveStateRemovingPart (LinkableMapObj *, const QString &);
37 void saveStateConstSelection (const QString &, const QString &, const QString &);
38 void saveState(LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &);
39 void saveState(const QString &, const QString &, const QString &, const QString &, const QString &);
40 void saveState(const SaveMode&, const QString &, const QString &, const QString &, const QString &, const QString &, LinkableMapObj *);
42 void parseAtom(const QString &);
44 void addFloatImage(const QPixmap &img);
47 void fetchImage(const QString &img);
48 void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
49 void imageDataFinished(Q3NetworkOperation *);
52 void toggleHistoryWindow();
53 bool isDefault(); // false, if map was changed once
54 bool isUnsaved(); // save necessary
55 bool hasChanged(); // undo possible
56 void setChanged(); // called from NoteEditor via LMO
58 void setFilePath (QString);
59 void setFilePath (QString,QString);
60 QString getFilePath (); // Full path e.g. "/home/tux/map.xml"
61 QString getFileName (); // e.g. "map.xml"
62 QString getMapName (); // e.g. "map"
63 QString getDestPath (); // e.g. "/home/tux/map.vym"
64 ErrorCode load (QString, LoadMode ); // newmap, import/replace selection
66 int save(const SaveMode &); // Save map
67 void setZipped(bool); // save map zipped
68 bool saveZipped(); // 1 if file will be saved zipped
69 void print(); // print canvas
72 void setHideTmpMode (HideTmpMode); // temporary hide stuff
73 HideTmpMode getHideTmpMode(); // temporary hide stuff
75 void setExportMode (bool); // temporary hide stuff during export
76 void exportImage (QString fn); // export as PNG
77 void exportImage (QString fn, QString); // export in given format
78 void exportOOPresentation(const QString &,const QString &);
79 void exportXML(const QString&); // export to directory
80 void clear(); // clear map
81 void copy(); // copy branch to clipboard
82 void redo(); // redo last action
83 bool isRedoAvailable();
84 void undo(); // undo last action
85 bool isUndoAvailable();
86 void gotoStep (int);// goto a step in history
88 void addMapReplaceInt(const QString & undoSel, const QString & path);
89 void addMapInsertInt (const QString & path, int pos);
90 void pasteNoSave(); // paste clipboard to branch
91 void cutNoSave(); // cut to clipboard
93 void paste(); // paste clipboard to branch and backup
94 void cut(); // cut to clipboard and backup
95 void move (const int &x, const int &y);
96 void moveRel (const int &x, const int &y);
98 void moveBranchDown();
99 QString getHeading (bool &ok,QPoint &p); // Get heading, ok if selection is branch
100 void setHeading(const QString &);
102 void setHeadingInt(const QString &);
103 void setURLInt(const QString &); // Just set the URL for selection
104 void setVymLinkInt(const QString &); // Set vymLink for selection
105 BranchObj* addNewBranchInt(int); // pos allows to add above/below selection
107 BranchObj* addNewBranch(int); // pos allows to add above/below selection
108 BranchObj* addNewBranchBefore(); // insert and make selection its
109 void deleteSelection();
110 LinkableMapObj* getSelection(); // returns selection
111 void unselect(); // before changing current noteedit
112 void reselect(); // after changing current noteedit
113 bool select(const QString &); // Select by string
114 QString getSelectString();
116 void selectInt(LinkableMapObj*);
117 void selectNextBranchInt(); // Increment number of branch
118 void selectPrevBranchInt(); // Decrement number of branch
120 void selectUpperBranch();
121 void selectLowerBranch();
122 void selectLeftBranch();
123 void selectRightBranch();
124 void selectFirstBranch();
125 void selectLastBranch();
126 void setColor(QColor);
127 void selectBackgroundColor();
128 void setBackgroundColor(QColor);
132 void toggleStandardFlag(QString);
133 virtual void setViewCenter(); // needed for zooming
134 BranchObj* findText(QString,bool); // Find object
135 void findReset(); // Reset Find
136 void editURL(); // edit the URL
137 QString getURL(); // returns URL of selection or ""
138 QStringList getURLs(); // returns URLs of subtree
139 void editHeading2URL(); // copy heading to URL
140 void editBugzilla2URL(); // create URL to Bugzilla
141 void editFATE2URL(); // create URL to FATE
142 void editVymLink(); // edit link to another map
143 void deleteVymLink(); // delete link to another map
144 QString getVymLink(); // return path to map
145 QStringList getVymLinks(); // return paths in subtree
146 void toggleHideExport(); // toggle the export flag
147 void removeBranchKeepChilds(); // remove but keep childs
148 void removeChilds(); // remove childs
149 void editMapInfo(); // dialog to enter author, ...
150 void updateActions(); // update e.g. format buttons
151 void updateNoteFlag(); // when TextEditor changes
152 void setLinkStyle (LinkStyle); // Set style of link
153 LinkStyle getLinkStyle (); // requested in LMO
154 void setLinkColor(QColor); // default color of links
155 void setLinkColorHint(); // color of links
156 void setLinkColorHint(LinkColorHint); // color of links
157 LinkColorHint getLinkColorHint();
158 QColor getDefLinkColor();
159 void setDefXLinkColor(QColor);
160 QColor getDefXLinkColor();
161 void setDefXLinkWidth (int);
162 int getDefXLinkWidth();
163 void toggleLinkColorHint(); // after changing linkStyles
164 void selectLinkColor();
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 contentsMousePressEvent(QMouseEvent*);
188 virtual void contentsMouseReleaseEvent(QMouseEvent*);
189 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
190 virtual void contentsMouseMoveEvent(QMouseEvent*);
192 virtual void contentsDragEnterEvent(QDragEnterEvent *event);
193 virtual void contentsDropEvent(QDropEvent *event);
196 MapCenterObj* mapCenter;
198 bool adjustCanvasRequested; // collect requests until end of user event
199 BranchObj *editingBO; // entering Text into BO
201 QColor actColor; // actual color
202 QColor defLinkColor; // default color for links
203 QColor defXLinkColor; // default color for xlinks
204 int defXLinkWidth; // default width for xlinks
205 LinkColorHint linkcolorhint;// use heading color or own color
206 LinkStyle linkstyle; // default style for links
208 QCursor handOpenCursor; // cursor while moving canvas view
209 QCursor pickColorCursor; // cursor while picking color
211 bool drawingLink; // true while creating a link
212 bool copyingObj; // true while creating a link
216 LinkableMapObj* selection; // select a LinkableMapObj
217 LinkableMapObj* selectionLast; // last selection
218 MapObj* movingObj; // moving a MapObj
219 MapObj* linkingObj_src; // part of a link
220 QPoint movingObj_orgPos; // org. pos of mouse before move
221 QPoint movingObj_orgRelPos; // org. relative pos of mouse before move
222 QPoint movingObj_start; // rel. pos of mouse to absPos
223 QPoint movingCont_start; // inital pos of moving Content or
224 QPoint movingVec; // how far has Content moved
225 QPoint movingCenter; // used when zooming
226 QPrinter* printer; // Printing
228 bool mapDefault; // Flag if map is untouched
229 bool mapChanged; // Flag if undo is possible
230 bool mapUnsaved; // Flag if map should be saved
232 bool printFrame; // Print frame around map
233 bool printFooter; // Print footer below map
235 bool zipped; // should map be zipped
236 static int mapNum; // unique number for Editor
237 QString fileName; // short name of file (for tab)
238 QString filePath; // path to file which will be saved
239 QString fileDir; // dir where file is saved
240 QString destPath; // path to .vym file (needed for vymlinks)
241 QString mapName; // fileName without ".vym"
243 QString tmpMapDir; // tmp directory with undo history
244 QString histPath; // Path to history file
245 int stepsTotal; // total number of steps (undos+redos)
246 SimpleSettings undoSet; // undo/redo commands
247 bool blockReposition; // block while load or undo
248 bool blockSaveState; // block while load or undo
250 BranchObj* itFind; // next object in find process
251 bool EOFind; // true, if search failed
253 QPoint exportOffset; // set before export, used in save
254 HideTmpMode hidemode; // true while exporting to hide some stuff
256 void resizeEvent( QResizeEvent * );
258 Q3UrlOperator *urlOperator;
259 QDataStream *imageData;
260 QBuffer *imageBuffer;
262 HistoryWindow historyWindow;