insilmaril@0
|
1 |
#ifndef MAPEDITOR_H
|
insilmaril@0
|
2 |
#define MAPEDITOR_H
|
insilmaril@0
|
3 |
|
insilmaril@2
|
4 |
#include <q3canvas.h>
|
insilmaril@0
|
5 |
#include <qlineedit.h>
|
insilmaril@0
|
6 |
#include <qcursor.h>
|
insilmaril@2
|
7 |
#include <q3filedialog.h>
|
insilmaril@0
|
8 |
#include <qevent.h>
|
insilmaril@2
|
9 |
#include <q3process.h>
|
insilmaril@2
|
10 |
#include <qbuffer.h>
|
insilmaril@2
|
11 |
//Added by qt3to4:
|
insilmaril@2
|
12 |
#include <QContextMenuEvent>
|
insilmaril@2
|
13 |
#include <QDropEvent>
|
insilmaril@2
|
14 |
#include <QResizeEvent>
|
insilmaril@2
|
15 |
#include <QPixmap>
|
insilmaril@2
|
16 |
#include <QMouseEvent>
|
insilmaril@2
|
17 |
#include <QDragEnterEvent>
|
insilmaril@0
|
18 |
|
insilmaril@0
|
19 |
#include "mapcenterobj.h"
|
insilmaril@2
|
20 |
#include "file.h"
|
insilmaril@0
|
21 |
#include "misc.h"
|
insilmaril@2
|
22 |
#include "showtextdialog.h"
|
insilmaril@0
|
23 |
|
insilmaril@2
|
24 |
class Q3NetworkOperation;
|
insilmaril@2
|
25 |
class Q3UrlOperator;
|
insilmaril@2
|
26 |
|
insilmaril@2
|
27 |
class MapEditor : public Q3CanvasView , public xmlObj {
|
insilmaril@0
|
28 |
Q_OBJECT
|
insilmaril@0
|
29 |
|
insilmaril@0
|
30 |
public:
|
insilmaril@2
|
31 |
MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, Qt::WFlags f=0);
|
insilmaril@0
|
32 |
~MapEditor();
|
insilmaril@0
|
33 |
QColor color();
|
insilmaril@0
|
34 |
QColor backgroundColor();
|
insilmaril@0
|
35 |
MapCenterObj* getMapCenter();
|
insilmaril@2
|
36 |
Q3Canvas* getCanvas();
|
insilmaril@0
|
37 |
void adjustCanvasSize();// adjust canvas size to map and scrollview
|
insilmaril@2
|
38 |
bool isRepositionBlocked(); // block while load or undo
|
insilmaril@0
|
39 |
|
insilmaril@0
|
40 |
private:
|
insilmaril@2
|
41 |
QString getName(LinkableMapObj*); // Get e.g. heading or filename
|
insilmaril@0
|
42 |
void makeTmpDirs(); // create temporary directories
|
insilmaril@2
|
43 |
QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
|
insilmaril@2
|
44 |
void saveState(const QString &); // save actual state to backup
|
insilmaril@2
|
45 |
void saveState(LinkableMapObj *, const QString &);
|
insilmaril@2
|
46 |
void saveState(const QString &, const QString &, const QString &);
|
insilmaril@2
|
47 |
void saveState(const QString &, LinkableMapObj *, const QString &);
|
insilmaril@2
|
48 |
void saveState(const SaveMode&, const QString &, LinkableMapObj *, const QString &, LinkableMapObj *, const QString &);
|
insilmaril@2
|
49 |
void parseAtom(const QString &);
|
insilmaril@0
|
50 |
|
insilmaril@2
|
51 |
void addFloatImage(const QPixmap &img);
|
insilmaril@2
|
52 |
|
insilmaril@2
|
53 |
private slots:
|
insilmaril@2
|
54 |
void finishedLineEdit();
|
insilmaril@2
|
55 |
void fetchImage(const QString &img);
|
insilmaril@2
|
56 |
void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
|
insilmaril@2
|
57 |
void imageDataFinished(Q3NetworkOperation *);
|
insilmaril@0
|
58 |
|
insilmaril@0
|
59 |
public:
|
insilmaril@2
|
60 |
void toggleHistoryWindow();
|
insilmaril@0
|
61 |
bool isDefault(); // false, if map was changed once
|
insilmaril@0
|
62 |
bool isUnsaved(); // save necessary
|
insilmaril@0
|
63 |
bool hasChanged(); // undo possible
|
insilmaril@0
|
64 |
void setChanged(); // called from NoteEditor via LMO
|
insilmaril@0
|
65 |
void closeMap();
|
insilmaril@0
|
66 |
void setFilePath (QString);
|
insilmaril@0
|
67 |
void setFilePath (QString,QString);
|
insilmaril@0
|
68 |
QString getFilePath (); // Full path e.g. "/home/tux/map.xml"
|
insilmaril@0
|
69 |
QString getFileName (); // e.g. "map.xml"
|
insilmaril@0
|
70 |
QString getMapName (); // e.g. "map"
|
insilmaril@0
|
71 |
QString getDestPath (); // e.g. "/home/tux/map.vym"
|
insilmaril@2
|
72 |
ErrorCode load (QString, LoadMode ); // newmap, import/replace selection
|
insilmaril@2
|
73 |
public:
|
insilmaril@0
|
74 |
int save(const SaveMode &); // Save map
|
insilmaril@0
|
75 |
void setZipped(bool); // save map zipped
|
insilmaril@0
|
76 |
bool saveZipped(); // 1 if file will be saved zipped
|
insilmaril@0
|
77 |
void print(); // print canvas
|
insilmaril@0
|
78 |
private:
|
insilmaril@0
|
79 |
QPixmap getPixmap();
|
insilmaril@2
|
80 |
void setHideTmpMode (HideTmpMode); // temporary hide stuff
|
insilmaril@2
|
81 |
HideTmpMode getHideTmpMode(); // temporary hide stuff
|
insilmaril@0
|
82 |
public:
|
insilmaril@2
|
83 |
void setExportMode (bool); // temporary hide stuff during export
|
insilmaril@4
|
84 |
void exportImage (QString fn); // export as PNG
|
insilmaril@4
|
85 |
void exportImage (QString fn, QString); // export in given format
|
insilmaril@2
|
86 |
void exportOOPresentation(const QString &,const QString &);
|
insilmaril@0
|
87 |
void exportXML(const QString&); // export to directory
|
insilmaril@0
|
88 |
void clear(); // clear map
|
insilmaril@2
|
89 |
void copy(); // copy branch to clipboard
|
insilmaril@2
|
90 |
void redo(); // redo last action
|
insilmaril@0
|
91 |
void undo(); // undo last action
|
insilmaril@0
|
92 |
private:
|
insilmaril@2
|
93 |
void undoXML(const QString &, const QString &);
|
insilmaril@2
|
94 |
void pasteNoSave(); // paste clipboard to branch
|
insilmaril@0
|
95 |
void cutNoSave(); // cut to clipboard
|
insilmaril@0
|
96 |
public:
|
insilmaril@0
|
97 |
void paste(); // paste clipboard to branch and backup
|
insilmaril@0
|
98 |
void cut(); // cut to clipboard and backup
|
insilmaril@2
|
99 |
void move(const int &,const int&);
|
insilmaril@0
|
100 |
void moveBranchUp();
|
insilmaril@0
|
101 |
void moveBranchDown();
|
insilmaril@2
|
102 |
void editHeading(); // Start editing heading
|
insilmaril@2
|
103 |
private:
|
insilmaril@2
|
104 |
void setHeading(const QString &); // Just set the heading for selection
|
insilmaril@2
|
105 |
void setURL(const QString &); // Just set the URL for selection
|
insilmaril@2
|
106 |
void setVymLink(const QString &); // Set vymLink for selection
|
insilmaril@2
|
107 |
public:
|
insilmaril@0
|
108 |
void addNewBranch(int); // pos allows to add above/below selection
|
insilmaril@2
|
109 |
void addNewBranchHere(); // insert and make selection its
|
insilmaril@0
|
110 |
void deleteSelection();
|
insilmaril@0
|
111 |
LinkableMapObj* getSelection(); // returns selection
|
insilmaril@0
|
112 |
void unselect(); // before changing current noteedit
|
insilmaril@0
|
113 |
void reselect(); // after changing current noteedit
|
insilmaril@2
|
114 |
bool select(const QString &); // Select
|
insilmaril@0
|
115 |
private:
|
insilmaril@2
|
116 |
void select(LinkableMapObj*);
|
insilmaril@0
|
117 |
void selectNextBranch(); // Increment number of branch
|
insilmaril@0
|
118 |
void selectPrevBranch(); // Decrement number of branch
|
insilmaril@0
|
119 |
public:
|
insilmaril@0
|
120 |
void selectUpperBranch();
|
insilmaril@0
|
121 |
void selectLowerBranch();
|
insilmaril@0
|
122 |
void selectLeftBranch();
|
insilmaril@0
|
123 |
void selectRightBranch();
|
insilmaril@0
|
124 |
void selectFirstBranch();
|
insilmaril@0
|
125 |
void selectLastBranch();
|
insilmaril@0
|
126 |
void setColor(QColor);
|
insilmaril@0
|
127 |
void selectBackgroundColor();
|
insilmaril@0
|
128 |
void setBackgroundColor(QColor);
|
insilmaril@0
|
129 |
QColor pickColor();
|
insilmaril@0
|
130 |
void colorItem();
|
insilmaril@0
|
131 |
void colorBranch();
|
insilmaril@0
|
132 |
void toggleStandardFlag(QString);
|
insilmaril@0
|
133 |
virtual void setViewCenter(); // needed for zooming
|
insilmaril@0
|
134 |
BranchObj* findText(QString,bool); // Find object
|
insilmaril@0
|
135 |
void findReset(); // Reset Find
|
insilmaril@0
|
136 |
void editURL(); // edit the URL
|
insilmaril@2
|
137 |
QString getURL(); // returns URL of selection or ""
|
insilmaril@0
|
138 |
void editHeading2URL(); // copy heading to URL
|
insilmaril@0
|
139 |
void editBugzilla2URL(); // create URL to Bugzilla
|
insilmaril@2
|
140 |
void editFATE2URL(); // create URL to FATE
|
insilmaril@0
|
141 |
void editVymLink(); // edit link to another map
|
insilmaril@0
|
142 |
void deleteVymLink(); // delete link to another map
|
insilmaril@0
|
143 |
QString getVymLink(); // return path to map
|
insilmaril@2
|
144 |
void toggleHideExport(); // toggle the export flag
|
insilmaril@2
|
145 |
void removeBranchKeepChilds(); // remove but keep childs
|
insilmaril@2
|
146 |
void removeChilds(); // remove childs
|
insilmaril@0
|
147 |
void editMapInfo(); // dialog to enter author, ...
|
insilmaril@0
|
148 |
void updateActions(); // update e.g. format buttons
|
insilmaril@2
|
149 |
void updateNoteFlag(); // when TextEditor changes
|
insilmaril@0
|
150 |
void setLinkStyle (LinkStyle); // Set style of link
|
insilmaril@0
|
151 |
LinkStyle getLinkStyle (); // requested in LMO
|
insilmaril@0
|
152 |
void setLinkColor(QColor); // default color of links
|
insilmaril@0
|
153 |
void setLinkColorHint(); // color of links
|
insilmaril@0
|
154 |
void setLinkColorHint(LinkColorHint); // color of links
|
insilmaril@0
|
155 |
LinkColorHint getLinkColorHint();
|
insilmaril@0
|
156 |
QColor getDefLinkColor();
|
insilmaril@2
|
157 |
void setDefXLinkColor(QColor);
|
insilmaril@2
|
158 |
QColor getDefXLinkColor();
|
insilmaril@2
|
159 |
void setDefXLinkWidth (int);
|
insilmaril@2
|
160 |
int getDefXLinkWidth();
|
insilmaril@0
|
161 |
void toggleLinkColorHint(); // after changing linkStyles
|
insilmaril@0
|
162 |
void selectLinkColor();
|
insilmaril@0
|
163 |
void toggleScroll();
|
insilmaril@0
|
164 |
void unScrollAll();
|
insilmaril@0
|
165 |
void loadFloatImage ();
|
insilmaril@0
|
166 |
void saveFloatImage (int);
|
insilmaril@0
|
167 |
void setFrame(const FrameType &);
|
insilmaril@2
|
168 |
void setIncludeImagesVer(bool);
|
insilmaril@2
|
169 |
void setIncludeImagesHor(bool);
|
insilmaril@2
|
170 |
void setHideLinkUnselected (bool);
|
insilmaril@2
|
171 |
bool getHideLinkUnselected ();
|
insilmaril@0
|
172 |
private:
|
insilmaril@0
|
173 |
void importDir(BranchObj *,QDir);
|
insilmaril@0
|
174 |
public:
|
insilmaril@0
|
175 |
void importDir();
|
insilmaril@2
|
176 |
void followXLink (int);
|
insilmaril@2
|
177 |
void editXLink (int);
|
insilmaril@0
|
178 |
void testFunction(); // FIXME just testing
|
insilmaril@0
|
179 |
|
insilmaril@0
|
180 |
protected:
|
insilmaril@0
|
181 |
void ensureSelectionVisible();
|
insilmaril@0
|
182 |
virtual void updateViewCenter(); // needed for zooming
|
insilmaril@0
|
183 |
virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
|
insilmaril@0
|
184 |
virtual void contentsMousePressEvent(QMouseEvent*);
|
insilmaril@0
|
185 |
virtual void contentsMouseReleaseEvent(QMouseEvent*);
|
insilmaril@0
|
186 |
virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
|
insilmaril@0
|
187 |
virtual void contentsMouseMoveEvent(QMouseEvent*);
|
insilmaril@0
|
188 |
|
insilmaril@2
|
189 |
virtual void contentsDragEnterEvent(QDragEnterEvent *event);
|
insilmaril@2
|
190 |
virtual void contentsDropEvent(QDropEvent *event);
|
insilmaril@0
|
191 |
private:
|
insilmaril@2
|
192 |
Q3Canvas* mapCanvas;
|
insilmaril@0
|
193 |
MapCenterObj* mapCenter;
|
insilmaril@0
|
194 |
|
insilmaril@0
|
195 |
bool adjustCanvasRequested; // collect requests until end of user event
|
insilmaril@0
|
196 |
BranchObj *editingBO; // entering Text into BO
|
insilmaril@0
|
197 |
QLineEdit* lineedit;
|
insilmaril@0
|
198 |
|
insilmaril@0
|
199 |
QColor actColor; // actual color
|
insilmaril@2
|
200 |
QColor defLinkColor; // default color for links
|
insilmaril@2
|
201 |
QColor defXLinkColor; // default color for xlinks
|
insilmaril@2
|
202 |
int defXLinkWidth; // default width for xlinks
|
insilmaril@0
|
203 |
LinkColorHint linkcolorhint;// use heading color or own color
|
insilmaril@0
|
204 |
LinkStyle linkstyle; // default style for links
|
insilmaril@0
|
205 |
|
insilmaril@0
|
206 |
QCursor handOpenCursor; // cursor while moving canvas view
|
insilmaril@0
|
207 |
QCursor pickColorCursor; // cursor while picking color
|
insilmaril@2
|
208 |
bool pickingColor;
|
insilmaril@2
|
209 |
bool drawingLink; // true while creating a link
|
insilmaril@2
|
210 |
bool copyingObj; // true while creating a link
|
insilmaril@2
|
211 |
XLinkObj* tmpXLink;
|
insilmaril@0
|
212 |
|
insilmaril@0
|
213 |
LinkableMapObj* selection; // select a LinkableMapObj
|
insilmaril@0
|
214 |
LinkableMapObj* selectionLast; // last selection
|
insilmaril@0
|
215 |
MapObj* movingObj; // moving a MapObj
|
insilmaril@2
|
216 |
MapObj* linkingObj_src; // part of a link
|
insilmaril@2
|
217 |
QPoint movingObj_orgPos; // org. pos of mouse before move
|
insilmaril@0
|
218 |
QPoint movingObj_start; // rel. pos of mouse to absPos
|
insilmaril@0
|
219 |
QPoint movingCont_start; // inital pos of moving Content or
|
insilmaril@0
|
220 |
QPoint movingVec; // how far has Content moved
|
insilmaril@0
|
221 |
QPoint movingCenter; // used when zooming
|
insilmaril@0
|
222 |
QPrinter* printer; // Printing
|
insilmaril@0
|
223 |
|
insilmaril@0
|
224 |
bool mapDefault; // Flag if map is untouched
|
insilmaril@0
|
225 |
bool mapChanged; // Flag if undo is possible
|
insilmaril@0
|
226 |
bool mapUnsaved; // Flag if map should be saved
|
insilmaril@0
|
227 |
|
insilmaril@0
|
228 |
bool printFrame; // Print frame around map
|
insilmaril@0
|
229 |
bool printFooter; // Print footer below map
|
insilmaril@0
|
230 |
|
insilmaril@0
|
231 |
bool zipped; // should map be zipped
|
insilmaril@2
|
232 |
static int mapNum; // unique number for Editor
|
insilmaril@0
|
233 |
QString fileName; // short name of file (for tab)
|
insilmaril@0
|
234 |
QString filePath; // path to file which will be saved
|
insilmaril@0
|
235 |
QString fileDir; // dir where file is saved
|
insilmaril@0
|
236 |
QString destPath; // path to .vym file (needed for vymlinks)
|
insilmaril@0
|
237 |
QString mapName; // fileName without ".vym"
|
insilmaril@0
|
238 |
|
insilmaril@0
|
239 |
bool isInteractive; // non interactive don't need tmpdirs
|
insilmaril@2
|
240 |
QString tmpMapDir; // tmp directory with data for undo/redo
|
insilmaril@2
|
241 |
int undosTotal; // total number of undos
|
insilmaril@2
|
242 |
int undoNum; // current number of bakMapDir to be used
|
insilmaril@2
|
243 |
int undosAvail; // how many actions can currently be undone
|
insilmaril@2
|
244 |
bool blockReposition; // block while load or undo
|
insilmaril@2
|
245 |
bool blockSaveState; // block while load or undo
|
insilmaril@0
|
246 |
|
insilmaril@0
|
247 |
BranchObj* itFind; // next object in find process
|
insilmaril@0
|
248 |
bool EOFind; // true, if search failed
|
insilmaril@0
|
249 |
|
insilmaril@0
|
250 |
QPoint exportOffset; // set before export, used in save
|
insilmaril@2
|
251 |
HideTmpMode hidemode; // true while exporting to hide some stuff
|
insilmaril@2
|
252 |
|
insilmaril@0
|
253 |
void resizeEvent( QResizeEvent * );
|
insilmaril@2
|
254 |
|
insilmaril@2
|
255 |
Q3UrlOperator *urlOperator;
|
insilmaril@2
|
256 |
QDataStream *imageData;
|
insilmaril@2
|
257 |
QBuffer *imageBuffer;
|
insilmaril@2
|
258 |
|
insilmaril@2
|
259 |
ShowTextDialog *historyWindow;
|
insilmaril@2
|
260 |
|
insilmaril@0
|
261 |
};
|
insilmaril@0
|
262 |
#endif
|
insilmaril@0
|
263 |
|