Removed some FIXMEs. Added translations
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 colorItem(QColor);
130 void colorBranch(QColor);
131 void toggleStandardFlag(QString);
132 virtual void setViewCenter(); // needed for zooming
133 BranchObj* findText(QString,bool); // Find object
134 void findReset(); // Reset Find
135 void setURL(const QString &); // set the URL
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 setHideExport(bool); // toggle the export flag
147 void toggleHideExport(); // toggle the export flag
148 void deleteKeepChilds(); // remove but keep childs
149 void deleteChilds(); // remove childs
150 void editMapInfo(); // dialog to enter author, ...
151 void updateActions(); // update e.g. format buttons
152 void updateNoteFlag(); // when TextEditor changes
153 void setMapAuthor (const QString &);
154 void setMapComment(const QString &);
155 void setMapLinkStyle (const QString &); // Set style of link
156 LinkStyle getMapLinkStyle (); // requested in LMO
157 void setMapDefLinkColor(QColor); // default color of links
158 void setMapLinkColorHintInt(); // color of links
159 void setMapLinkColorHint(LinkColorHint);// color of links
160 LinkColorHint getMapLinkColorHint();
161 QColor getMapDefLinkColor();
162 void setMapDefXLinkColor(QColor);
163 QColor getMapDefXLinkColor();
164 void setMapDefXLinkWidth (int);
165 int getMapDefXLinkWidth();
166 void toggleMapLinkColorHint(); // after changing linkStyles
167 void selectMapLinkColor();
170 void loadFloatImage ();
171 void saveFloatImage ();
172 void setFrame(const FrameType &);
173 void setIncludeImagesVer(bool);
174 void setIncludeImagesHor(bool);
175 void setHideLinkUnselected (bool);
176 bool getHideLinkUnselected ();
178 void importDirInt(BranchObj *,QDir);
181 void followXLink (int);
182 void editXLink (int);
183 void testFunction(); // just testing new stuff
184 // set /mainwindo/showTestMenu=true...
187 void ensureSelectionVisible();
188 virtual void updateViewCenter(); // needed for zooming
189 virtual void contextMenuEvent ( QContextMenuEvent *e );
190 virtual void keyPressEvent(QKeyEvent*);
191 virtual void keyReleaseEvent(QKeyEvent*);
192 virtual void mousePressEvent(QMouseEvent*);
193 virtual void mouseReleaseEvent(QMouseEvent*);
194 virtual void mouseDoubleClickEvent(QMouseEvent*);
195 virtual void mouseMoveEvent(QMouseEvent*);
197 virtual void dragEnterEvent (QDragEnterEvent *);
198 virtual void dropEvent (QDropEvent *);
200 virtual void contentsDragEnterEvent(QDragEnterEvent *event);
201 virtual void contentsDropEvent(QDropEvent *event);
203 QGraphicsScene *mapScene;
204 MapCenterObj* mapCenter;
206 bool adjustCanvasRequested; // collect requests until end of user event
207 BranchObj *editingBO; // entering Text into BO
209 QColor defLinkColor; // default color for links
210 QColor defXLinkColor; // default color for xlinks
211 int defXLinkWidth; // default width for xlinks
212 LinkColorHint linkcolorhint;// use heading color or own color
213 LinkStyle linkstyle; // default style for links
215 QCursor HandOpenCursor; // cursor while moving canvas view
216 QCursor PickColorCursor; // cursor while picking color
217 QCursor CopyCursor; // cursor while picking color
218 QCursor XLinkCursor; // cursor while picking color
220 bool drawingLink; // true while creating a link
221 bool copyingObj; // true while creating a link
225 LinkableMapObj* selection; // select a LinkableMapObj
226 LinkableMapObj* selectionLast; // last selection
227 MapObj* movingObj; // moving a MapObj
228 MapObj* linkingObj_src; // part of a link
229 QPointF movingObj_orgPos; // org. pos of mouse before move
230 QPointF movingObj_orgRelPos; // org. relative pos of mouse before move
231 QPointF movingObj_start; // rel. pos of mouse to absPos
232 QPointF movingCont_start; // inital pos of moving Content or
233 QPointF movingVec; // how far has Content moved
234 QPointF movingCenter; // used when zooming
235 QPrinter* printer; // Printing
237 bool mapDefault; // Flag if map is untouched
238 bool mapChanged; // Flag if undo is possible
239 bool mapUnsaved; // Flag if map should be saved
241 bool printFrame; // Print frame around map
242 bool printFooter; // Print footer below map
244 bool zipped; // should map be zipped
245 static int mapNum; // unique number for Editor
246 QString fileName; // short name of file (for tab)
247 QString filePath; // path to file which will be saved
248 QString fileDir; // dir where file is saved
249 QString destPath; // path to .vym file (needed for vymlinks)
250 QString mapName; // fileName without ".vym"
252 QString tmpMapDir; // tmp directory with undo history
253 QString histPath; // Path to history file
254 int stepsTotal; // total number of steps (undos+redos)
255 SimpleSettings undoSet; // undo/redo commands
256 bool blockReposition; // block while load or undo
257 bool blockSaveState; // block while load or undo
259 BranchObj* itFind; // next object in find process
260 bool EOFind; // true, if search failed
262 QPoint exportOffset; // set before export, used in save
263 HideTmpMode hidemode; // true while exporting to hide some stuff
265 void resizeEvent( QResizeEvent * );
267 Q3UrlOperator *urlOperator;
268 QDataStream *imageData;
269 QBuffer *imageBuffer;