5 #include <QGraphicsView>
7 #include "mapcenterobj.h"
10 #include "selection.h"
13 class Q3NetworkOperation;
16 class MapEditor : public QGraphicsView, public xmlObj {
20 MapEditor(QWidget* parent=0);
22 MapCenterObj* getMapCenter();
23 QGraphicsScene * getScene();
24 bool isRepositionBlocked(); // block while load or undo
27 QString getName(LinkableMapObj*); // Get e.g. heading or filename
28 void makeTmpDirs(); // create temporary directories
29 QString saveToDir(const QString&,const QString &,bool, const QPointF &,LinkableMapObj*);
30 void saveStateChangingPart (LinkableMapObj *, LinkableMapObj *, const QString &, const QString &);
31 void saveStateRemovingPart (LinkableMapObj *, const QString &);
32 void saveState(LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &);
33 void saveState(const QString &, const QString &, const QString &, const QString &, const QString &);
34 void saveState(const SaveMode&, const QString &, const QString &, const QString &, const QString &, const QString &, LinkableMapObj *);
36 void parseAtom(const QString &);
38 void addFloatImageInt(const QPixmap &img);
42 void fetchImage(const QString &img);
43 void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
44 void imageDataFinished(Q3NetworkOperation *);
48 bool isDefault(); // false, if map was changed once
49 bool isUnsaved(); // save necessary
50 bool hasChanged(); // undo possible
51 void setChanged(); // called from NoteEditor via LMO
53 void setFilePath (QString);
54 void setFilePath (QString,QString);
55 QString getFilePath (); // Full path e.g. "/home/tux/map.xml"
56 QString getFileName (); // e.g. "map.xml"
57 QString getMapName (); // e.g. "map"
58 QString getDestPath (); // e.g. "/home/tux/map.vym"
59 ErrorCode load (QString, LoadMode ); // newmap, import/replace selection
61 int save(const SaveMode &); // Save map
62 void setZipped(bool); // save map zipped
63 bool saveZipped(); // 1 if file will be saved zipped
64 void print(); // print canvas
65 void setAntiAlias (bool);
66 void setSmoothPixmap(bool);
69 void setHideTmpMode (HideTmpMode); // temporary hide stuff
70 HideTmpMode getHideTmpMode(); // temporary hide stuff
72 void setExportMode (bool); // temporary hide stuff during export
73 void exportImage (QString fn); // export as PNG
74 void exportImage (QString fn, QString); // export in given format
75 void exportOOPresentation(const QString &,const QString &);
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 bool isRedoAvailable();
81 void undo(); // undo last action
82 bool isUndoAvailable();
83 void gotoHistoryStep (int);// goto a step in history
85 void addMapReplaceInt(const QString & undoSel, const QString & path);
86 void addMapInsertInt (const QString & path, int pos);
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 &x, const int &y);
93 void moveRel (const int &x, const int &y);
95 void moveBranchDown();
96 QString getHeading (bool &ok,QPoint &p); // 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 BranchObj* addNewBranch(int); // pos allows to add above/below selection
105 BranchObj* addNewBranchBefore(); // 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 selectMapBackgroundImage();
124 void setMapBackgroundImage(const QString &);
125 void selectMapBackgroundColor();
126 void setMapBackgroundColor(QColor);
127 QColor getMapBackgroundColor();
128 QColor getCurrentHeadingColor();
129 void colorBranch(QColor);
130 void colorSubtree(QColor);
131 void toggleStandardFlag(QString);
132 BranchObj* findText(QString,bool); // Find object
133 void findReset(); // Reset Find
134 void setURL(const QString &); // set the URL
135 void editURL(); // edit the URL
136 QString getURL(); // returns URL of selection or ""
137 QStringList getURLs(); // returns URLs of subtree
138 void editHeading2URL(); // copy heading to URL
139 void editBugzilla2URL(); // create URL to Bugzilla
140 void editFATE2URL(); // create URL to FATE
141 void editVymLink(); // edit link to another map
142 void deleteVymLink(); // delete link to another map
143 QString getVymLink(); // return path to map
144 QStringList getVymLinks(); // return paths in subtree
145 void setHideExport(bool); // toggle the export flag
146 void toggleHideExport(); // toggle the export flag
147 void deleteKeepChilds(); // remove but keep childs
148 void deleteChilds(); // 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 setMapAuthor (const QString &);
153 void setMapComment(const QString &);
154 void setMapLinkStyle (const QString &); // Set style of link
155 LinkStyle getMapLinkStyle (); // requested in LMO
156 void setMapDefLinkColor(QColor); // default color of links
157 void setMapLinkColorHintInt(); // color of links
158 void setMapLinkColorHint(LinkColorHint);// color of links
159 LinkColorHint getMapLinkColorHint();
160 QColor getMapDefLinkColor();
161 void setMapDefXLinkColor(QColor);
162 QColor getMapDefXLinkColor();
163 void setMapDefXLinkWidth (int);
164 int getMapDefXLinkWidth();
165 void toggleMapLinkColorHint(); // after changing linkStyles
166 void selectMapLinkColor();
169 void loadFloatImage ();
170 void saveFloatImage ();
171 void setFrame(const FrameType &);
172 void setIncludeImagesVer(bool);
173 void setIncludeImagesHor(bool);
174 void setHideLinkUnselected (bool);
175 bool getHideLinkUnselected ();
177 void importDirInt(BranchObj *,QDir);
180 void followXLink (int);
181 void editXLink (int);
182 void testFunction(); // just testing new stuff
183 // set /mainwindo/showTestMenu=true...
186 void ensureSelectionVisible();
187 virtual void contextMenuEvent ( QContextMenuEvent *e );
188 virtual void keyPressEvent(QKeyEvent*);
189 virtual void keyReleaseEvent(QKeyEvent*);
190 virtual void mousePressEvent(QMouseEvent*);
191 virtual void mouseReleaseEvent(QMouseEvent*);
192 virtual void mouseDoubleClickEvent(QMouseEvent*);
193 virtual void mouseMoveEvent(QMouseEvent*);
195 void dragEnterEvent (QDragEnterEvent *);
196 void dragMoveEvent (QDragMoveEvent *);
197 void dragLeaveEvent (QDragLeaveEvent *);
198 void dropEvent (QDropEvent *);
201 QGraphicsScene *mapScene;
202 MapCenterObj* mapCenter;
204 bool adjustCanvasRequested; // collect requests until end of user event
205 BranchObj *editingBO; // entering Text into BO
207 QColor defLinkColor; // default color for links
208 QColor defXLinkColor; // default color for xlinks
209 int defXLinkWidth; // default width for xlinks
210 LinkColorHint linkcolorhint;// use heading color or own color
211 LinkStyle linkstyle; // default style for links
213 QCursor HandOpenCursor; // cursor while moving canvas view
214 QCursor PickColorCursor; // cursor while picking color
215 QCursor CopyCursor; // cursor while picking color
216 QCursor XLinkCursor; // cursor while picking color
218 bool drawingLink; // true while creating a link
219 bool copyingObj; // true while creating a link
223 LinkableMapObj* selection; // select a LinkableMapObj
224 LinkableMapObj* selectionLast; // last selection
225 MapObj* movingObj; // moving a MapObj
226 MapObj* linkingObj_src; // part of a link
227 QPointF movingObj_orgPos; // org. pos of mouse before move
228 QPointF movingObj_orgRelPos; // org. relative pos of mouse before move
229 QPointF movingObj_start; // rel. pos of mouse to absPos
230 QPointF movingCont_start; // inital pos of moving Content or
231 QPointF movingVec; // how far has Content moved
232 QPrinter* printer; // Printing
234 bool mapDefault; // Flag if map is untouched
235 bool mapChanged; // Flag if undo is possible
236 bool mapUnsaved; // Flag if map should be saved
238 bool printFrame; // Print frame around map
239 bool printFooter; // Print footer below map
241 bool zipped; // should map be zipped
242 static int mapNum; // unique number for Editor
243 QString fileName; // short name of file (for tab)
244 QString filePath; // path to file which will be saved
245 QString fileDir; // dir where file is saved
246 QString destPath; // path to .vym file (needed for vymlinks)
247 QString mapName; // fileName without ".vym"
249 QString tmpMapDir; // tmp directory with undo history
250 QString histPath; // Path to history file
251 int stepsTotal; // total number of steps (undos+redos)
252 SimpleSettings undoSet; // undo/redo commands
253 bool blockReposition; // block while load or undo
254 bool blockSaveState; // block while load or undo
256 BranchObj* itFind; // next object in find process
257 bool EOFind; // true, if search failed
259 QPoint exportOffset; // set before export, used in save
260 HideTmpMode hidemode; // true while exporting to hide some stuff
262 void resizeEvent( QResizeEvent * );
264 Q3UrlOperator *urlOperator;
265 QDataStream *imageData;
266 QBuffer *imageBuffer;