historywindow moved to mainwindow. Started to get rid of Q3PtrList finally
7 #include "mapcenterobj.h"
10 #include "selection.h"
13 class Q3NetworkOperation;
16 class MapEditor : public Q3CanvasView , public xmlObj {
20 MapEditor(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
22 MapCenterObj* getMapCenter();
23 Q3Canvas* getCanvas();
24 void adjustCanvasSize();// adjust canvas size to map and scrollview
25 bool isRepositionBlocked(); // block while load or undo
28 QString getName(LinkableMapObj*); // Get e.g. heading or filename
29 void makeTmpDirs(); // create temporary directories
30 QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
31 void saveStateChangingPart (LinkableMapObj *, LinkableMapObj *, const QString &, const QString &);
32 void saveStateRemovingPart (LinkableMapObj *, const QString &);
33 void saveState(LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &);
34 void saveState(const QString &, const QString &, const QString &, const QString &, const QString &);
35 void saveState(const SaveMode&, const QString &, const QString &, const QString &, const QString &, const QString &, LinkableMapObj *);
37 void parseAtom(const QString &);
39 void addFloatImageInt(const QPixmap &img);
42 void fetchImage(const QString &img);
43 void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
44 void imageDataFinished(Q3NetworkOperation *);
47 void toggleHistoryWindow();
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
67 void setHideTmpMode (HideTmpMode); // temporary hide stuff
68 HideTmpMode getHideTmpMode(); // temporary hide stuff
70 void setExportMode (bool); // temporary hide stuff during export
71 void exportImage (QString fn); // export as PNG
72 void exportImage (QString fn, QString); // export in given format
73 void exportOOPresentation(const QString &,const QString &);
74 void exportXML(const QString&); // export to directory
75 void clear(); // clear map
76 void copy(); // copy branch to clipboard
77 void redo(); // redo last action
78 bool isRedoAvailable();
79 void undo(); // undo last action
80 bool isUndoAvailable();
81 void gotoHistoryStep (int);// goto a step in history
83 void addMapReplaceInt(const QString & undoSel, const QString & path);
84 void addMapInsertInt (const QString & path, int pos);
85 void pasteNoSave(); // paste clipboard to branch
86 void cutNoSave(); // cut to clipboard
88 void paste(); // paste clipboard to branch and backup
89 void cut(); // cut to clipboard and backup
90 void move (const int &x, const int &y);
91 void moveRel (const int &x, const int &y);
93 void moveBranchDown();
94 QString getHeading (bool &ok,QPoint &p); // Get heading, ok if selection is branch
95 void setHeading(const QString &);
97 void setHeadingInt(const QString &);
98 void setURLInt(const QString &); // Just set the URL for selection
99 void setVymLinkInt(const QString &); // Set vymLink for selection
100 BranchObj* addNewBranchInt(int); // pos allows to add above/below selection
102 BranchObj* addNewBranch(int); // pos allows to add above/below selection
103 BranchObj* addNewBranchBefore(); // insert and make selection its
104 void deleteSelection();
105 LinkableMapObj* getSelection(); // returns selection
106 void unselect(); // before changing current noteedit
107 void reselect(); // after changing current noteedit
108 bool select(const QString &); // Select by string
109 QString getSelectString();
111 void selectInt(LinkableMapObj*);
112 void selectNextBranchInt(); // Increment number of branch
113 void selectPrevBranchInt(); // Decrement number of branch
115 void selectUpperBranch();
116 void selectLowerBranch();
117 void selectLeftBranch();
118 void selectRightBranch();
119 void selectFirstBranch();
120 void selectLastBranch();
121 void selectMapBackgroundColor();
122 void setMapBackgroundColor(QColor);
123 QColor getMapBackgroundColor();
124 QColor getCurrentHeadingColor();
125 void colorItem(QColor);
126 void colorBranch(QColor);
127 void toggleStandardFlag(QString);
128 virtual void setViewCenter(); // needed for zooming
129 BranchObj* findText(QString,bool); // Find object
130 void findReset(); // Reset Find
131 void setURL(const QString &); // set the URL
132 void editURL(); // edit the URL
133 QString getURL(); // returns URL of selection or ""
134 QStringList getURLs(); // returns URLs of subtree
135 void editHeading2URL(); // copy heading to URL
136 void editBugzilla2URL(); // create URL to Bugzilla
137 void editFATE2URL(); // create URL to FATE
138 void editVymLink(); // edit link to another map
139 void deleteVymLink(); // delete link to another map
140 QString getVymLink(); // return path to map
141 QStringList getVymLinks(); // return paths in subtree
142 void setHideExport(bool); // toggle the export flag
143 void toggleHideExport(); // toggle the export flag
144 void deleteKeepChilds(); // remove but keep childs
145 void deleteChilds(); // 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 setMapAuthor (const QString &);
150 void setMapComment(const QString &);
151 void setMapLinkStyle (const QString &); // Set style of link
152 LinkStyle getMapLinkStyle (); // requested in LMO
153 void setMapDefLinkColor(QColor); // default color of links
154 void setMapLinkColorHintInt(); // color of links
155 void setMapLinkColorHint(LinkColorHint);// color of links
156 LinkColorHint getMapLinkColorHint();
157 QColor getMapDefLinkColor();
158 void setMapDefXLinkColor(QColor);
159 QColor getMapDefXLinkColor();
160 void setMapDefXLinkWidth (int);
161 int getMapDefXLinkWidth();
162 void toggleMapLinkColorHint(); // after changing linkStyles
163 void selectMapLinkColor();
166 void loadFloatImage ();
167 void saveFloatImage ();
168 void setFrame(const FrameType &);
169 void setIncludeImagesVer(bool);
170 void setIncludeImagesHor(bool);
171 void setHideLinkUnselected (bool);
172 bool getHideLinkUnselected ();
174 void importDirInt(BranchObj *,QDir);
177 void followXLink (int);
178 void editXLink (int);
179 void testFunction(); // just testing new stuff
180 // set /mainwindo/showTestMenu=true...
183 void ensureSelectionVisible();
184 virtual void updateViewCenter(); // needed for zooming
185 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
186 virtual void keyPressEvent(QKeyEvent*);
187 virtual void keyReleaseEvent(QKeyEvent*);
188 virtual void contentsMousePressEvent(QMouseEvent*);
189 virtual void contentsMouseReleaseEvent(QMouseEvent*);
190 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
191 virtual void contentsMouseMoveEvent(QMouseEvent*);
193 virtual void contentsDragEnterEvent(QDragEnterEvent *event);
194 virtual void contentsDropEvent(QDropEvent *event);
197 MapCenterObj* mapCenter;
199 bool adjustCanvasRequested; // collect requests until end of user event
200 BranchObj *editingBO; // entering Text into BO
202 QColor defLinkColor; // default color for links
203 QColor defXLinkColor; // default color for xlinks
204 int defXLinkWidth; // default width for xlinks
205 LinkColorHint linkcolorhint;// use heading color or own color
206 LinkStyle linkstyle; // default style for links
208 QCursor HandOpenCursor; // cursor while moving canvas view
209 QCursor PickColorCursor; // cursor while picking color
210 QCursor CopyCursor; // cursor while picking color
211 QCursor XLinkCursor; // cursor while picking color
213 bool drawingLink; // true while creating a link
214 bool copyingObj; // true while creating a link
218 LinkableMapObj* selection; // select a LinkableMapObj
219 LinkableMapObj* selectionLast; // last selection
220 MapObj* movingObj; // moving a MapObj
221 MapObj* linkingObj_src; // part of a link
222 QPoint movingObj_orgPos; // org. pos of mouse before move
223 QPoint movingObj_orgRelPos; // org. relative pos of mouse before move
224 QPoint movingObj_start; // rel. pos of mouse to absPos
225 QPoint movingCont_start; // inital pos of moving Content or
226 QPoint movingVec; // how far has Content moved
227 QPoint movingCenter; // used when zooming
228 QPrinter* printer; // Printing
230 bool mapDefault; // Flag if map is untouched
231 bool mapChanged; // Flag if undo is possible
232 bool mapUnsaved; // Flag if map should be saved
234 bool printFrame; // Print frame around map
235 bool printFooter; // Print footer below map
237 bool zipped; // should map be zipped
238 static int mapNum; // unique number for Editor
239 QString fileName; // short name of file (for tab)
240 QString filePath; // path to file which will be saved
241 QString fileDir; // dir where file is saved
242 QString destPath; // path to .vym file (needed for vymlinks)
243 QString mapName; // fileName without ".vym"
245 QString tmpMapDir; // tmp directory with undo history
246 QString histPath; // Path to history file
247 int stepsTotal; // total number of steps (undos+redos)
248 SimpleSettings undoSet; // undo/redo commands
249 bool blockReposition; // block while load or undo
250 bool blockSaveState; // block while load or undo
252 BranchObj* itFind; // next object in find process
253 bool EOFind; // true, if search failed
255 QPoint exportOffset; // set before export, used in save
256 HideTmpMode hidemode; // true while exporting to hide some stuff
258 void resizeEvent( QResizeEvent * );
260 Q3UrlOperator *urlOperator;
261 QDataStream *imageData;
262 QBuffer *imageBuffer;