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