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 saveStatePart (LinkableMapObj *, const QString &);
36 void saveStateConstSelection (const QString &, const QString &, const QString &);
37 void saveState(LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &);
38 void saveState(const QString &, const QString &, const QString &, const QString &, const QString &);
39 void saveState(const SaveMode&, const QString &, const QString &, const QString &, const QString &, const QString &, LinkableMapObj *);
40 void parseAtom(const QString &);
42 void addFloatImage(const QPixmap &img);
45 void fetchImage(const QString &img);
46 void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
47 void imageDataFinished(Q3NetworkOperation *);
50 void toggleHistoryWindow();
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
70 void setHideTmpMode (HideTmpMode); // temporary hide stuff
71 HideTmpMode getHideTmpMode(); // temporary hide stuff
73 void setExportMode (bool); // temporary hide stuff during export
74 void exportImage (QString fn); // export as PNG
75 void exportImage (QString fn, QString); // 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 bool isRedoAvailable();
82 void undo(); // undo last action
83 bool isUndoAvailable();
84 void gotoStep (int);// goto a step in history
86 void undoXML(const QString &, const QString &);
87 void pasteNoSave(); // paste clipboard to branch
88 void cutNoSave(); // cut to clipboard
90 void paste(); // paste clipboard to branch and backup
91 void cut(); // cut to clipboard and backup
92 void move (const int &,const int&);
93 void moveRel (const int &,const int&);
95 void moveBranchDown();
96 QString getHeading (bool &,QPoint &); // Get heading, ok if selection is branch
97 void setHeading(const QString &);
99 void setHeadingInt(const QString &);
100 void setURLInt(const QString &); // Just set the URL for selection
101 void setVymLinkInt(const QString &); // Set vymLink for selection
102 BranchObj* addNewBranchInt(int); // pos allows to add above/below selection
104 void addNewBranch(int); // pos allows to add above/below selection
105 void addNewBranchHere(); // insert and make selection its
106 void deleteSelection();
107 LinkableMapObj* getSelection(); // returns selection
108 void unselect(); // before changing current noteedit
109 void reselect(); // after changing current noteedit
110 bool select(const QString &); // Select by string
111 QString getSelectString();
113 void selectInt(LinkableMapObj*);
114 void selectNextBranchInt(); // Increment number of branch
115 void selectPrevBranchInt(); // Decrement number of branch
117 void selectUpperBranch();
118 void selectLowerBranch();
119 void selectLeftBranch();
120 void selectRightBranch();
121 void selectFirstBranch();
122 void selectLastBranch();
123 void setColor(QColor);
124 void selectBackgroundColor();
125 void setBackgroundColor(QColor);
129 void toggleStandardFlag(QString);
130 virtual void setViewCenter(); // needed for zooming
131 BranchObj* findText(QString,bool); // Find object
132 void findReset(); // Reset Find
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 toggleHideExport(); // toggle the export flag
144 void removeBranchKeepChilds(); // remove but keep childs
145 void removeChilds(); // remove childs
146 void editMapInfo(); // dialog to enter author, ...
147 void updateActions(); // update e.g. format buttons
148 void updateNoteFlag(); // when TextEditor changes
149 void setLinkStyle (LinkStyle); // Set style of link
150 LinkStyle getLinkStyle (); // requested in LMO
151 void setLinkColor(QColor); // default color of links
152 void setLinkColorHint(); // color of links
153 void setLinkColorHint(LinkColorHint); // color of links
154 LinkColorHint getLinkColorHint();
155 QColor getDefLinkColor();
156 void setDefXLinkColor(QColor);
157 QColor getDefXLinkColor();
158 void setDefXLinkWidth (int);
159 int getDefXLinkWidth();
160 void toggleLinkColorHint(); // after changing linkStyles
161 void selectLinkColor();
164 void loadFloatImage ();
165 void saveFloatImage ();
166 void setFrame(const FrameType &);
167 void setIncludeImagesVer(bool);
168 void setIncludeImagesHor(bool);
169 void setHideLinkUnselected (bool);
170 bool getHideLinkUnselected ();
172 void importDirInt(BranchObj *,QDir);
175 void followXLink (int);
176 void editXLink (int);
177 void testFunction(); // just testing new stuff
178 // set /mainwindo/showTestMenu=true...
181 void ensureSelectionVisible();
182 virtual void updateViewCenter(); // needed for zooming
183 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
184 virtual void contentsMousePressEvent(QMouseEvent*);
185 virtual void contentsMouseReleaseEvent(QMouseEvent*);
186 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
187 virtual void contentsMouseMoveEvent(QMouseEvent*);
189 virtual void contentsDragEnterEvent(QDragEnterEvent *event);
190 virtual void contentsDropEvent(QDropEvent *event);
193 MapCenterObj* mapCenter;
195 bool adjustCanvasRequested; // collect requests until end of user event
196 BranchObj *editingBO; // entering Text into BO
198 QColor actColor; // actual color
199 QColor defLinkColor; // default color for links
200 QColor defXLinkColor; // default color for xlinks
201 int defXLinkWidth; // default width for xlinks
202 LinkColorHint linkcolorhint;// use heading color or own color
203 LinkStyle linkstyle; // default style for links
205 QCursor handOpenCursor; // cursor while moving canvas view
206 QCursor pickColorCursor; // cursor while picking color
208 bool drawingLink; // true while creating a link
209 bool copyingObj; // true while creating a link
213 LinkableMapObj* selection; // select a LinkableMapObj
214 LinkableMapObj* selectionLast; // last selection
215 MapObj* movingObj; // moving a MapObj
216 MapObj* linkingObj_src; // part of a link
217 QPoint movingObj_orgPos; // org. pos of mouse before move
218 QPoint movingObj_orgRelPos; // org. relative pos of mouse before move
219 QPoint movingObj_start; // rel. pos of mouse to absPos
220 QPoint movingCont_start; // inital pos of moving Content or
221 QPoint movingVec; // how far has Content moved
222 QPoint movingCenter; // used when zooming
223 QPrinter* printer; // Printing
225 bool mapDefault; // Flag if map is untouched
226 bool mapChanged; // Flag if undo is possible
227 bool mapUnsaved; // Flag if map should be saved
229 bool printFrame; // Print frame around map
230 bool printFooter; // Print footer below map
232 bool zipped; // should map be zipped
233 static int mapNum; // unique number for Editor
234 QString fileName; // short name of file (for tab)
235 QString filePath; // path to file which will be saved
236 QString fileDir; // dir where file is saved
237 QString destPath; // path to .vym file (needed for vymlinks)
238 QString mapName; // fileName without ".vym"
240 QString tmpMapDir; // tmp directory with undo history
241 QString histPath; // Path to history file
242 int stepsTotal; // total number of steps (undos+redos)
243 SimpleSettings undoSet; // undo/redo commands
244 bool blockReposition; // block while load or undo
245 bool blockSaveState; // block while load or undo
247 BranchObj* itFind; // next object in find process
248 bool EOFind; // true, if search failed
250 QPoint exportOffset; // set before export, used in save
251 HideTmpMode hidemode; // true while exporting to hide some stuff
253 void resizeEvent( QResizeEvent * );
255 Q3UrlOperator *urlOperator;
256 QDataStream *imageData;
257 QBuffer *imageBuffer;
259 HistoryWindow historyWindow;