Runs basically on Mac now. Undo debug output still enabled
6 //#include <q3filedialog.h>
8 //#include <q3process.h>
10 #include <QDragEnterEvent>
11 #include <QContextMenuEvent>
14 #include <QMouseEvent>
16 #include <QResizeEvent>
18 #include "mapcenterobj.h"
21 #include "selection.h"
23 #include "showtextdialog.h"
25 class Q3NetworkOperation;
28 class MapEditor : public Q3CanvasView , public xmlObj {
32 MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, Qt::WFlags f=0);
35 QColor backgroundColor();
36 MapCenterObj* getMapCenter();
37 Q3Canvas* getCanvas();
38 void adjustCanvasSize();// adjust canvas size to map and scrollview
39 bool isRepositionBlocked(); // block while load or undo
42 QString getName(LinkableMapObj*); // Get e.g. heading or filename
43 void makeTmpDirs(); // create temporary directories
44 QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
45 void saveStateComplete (const QString &);
46 void saveStatePart (LinkableMapObj *, const QString &);
47 void saveStateConstSelection (const QString &, const QString &, const QString &);
48 void saveStateX (LinkableMapObj *, const QString &, const QString &);
49 void saveState(const SaveMode&, const QString &, LinkableMapObj *, const QString &, LinkableMapObj *, const QString &);
50 void parseAtom(const QString &);
52 void addFloatImage(const QPixmap &img);
55 void fetchImage(const QString &img);
56 void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
57 void imageDataFinished(Q3NetworkOperation *);
60 void toggleHistoryWindow();
61 bool isDefault(); // false, if map was changed once
62 bool isUnsaved(); // save necessary
63 bool hasChanged(); // undo possible
64 void setChanged(); // called from NoteEditor via LMO
66 void setFilePath (QString);
67 void setFilePath (QString,QString);
68 QString getFilePath (); // Full path e.g. "/home/tux/map.xml"
69 QString getFileName (); // e.g. "map.xml"
70 QString getMapName (); // e.g. "map"
71 QString getDestPath (); // e.g. "/home/tux/map.vym"
72 ErrorCode load (QString, LoadMode ); // newmap, import/replace selection
74 int save(const SaveMode &); // Save map
75 void setZipped(bool); // save map zipped
76 bool saveZipped(); // 1 if file will be saved zipped
77 void print(); // print canvas
80 void setHideTmpMode (HideTmpMode); // temporary hide stuff
81 HideTmpMode getHideTmpMode(); // temporary hide stuff
83 void setExportMode (bool); // temporary hide stuff during export
84 void exportImage (QString fn); // export as PNG
85 void exportImage (QString fn, QString); // export in given format
86 void exportOOPresentation(const QString &,const QString &);
87 void exportXML(const QString&); // export to directory
88 void clear(); // clear map
89 void copy(); // copy branch to clipboard
90 void redo(); // redo last action
91 void undo(); // undo last action
93 void undoXML(const QString &, const QString &);
94 void pasteNoSave(); // paste clipboard to branch
95 void cutNoSave(); // cut to clipboard
97 void paste(); // paste clipboard to branch and backup
98 void cut(); // cut to clipboard and backup
99 void move(const int &,const int&);
101 void moveBranchDown();
102 void editHeading(); // Start editing heading
103 QString getHeading (bool &,QPoint &); // Get heading, ok if selection is branch
104 void setHeading(const QString &);
106 void setHeadingInt(const QString &);
107 void setURLInt(const QString &); // Just set the URL for selection
108 void setVymLinkInt(const QString &); // Set vymLink for selection
110 void addNewBranch(int); // pos allows to add above/below selection
111 void addNewBranchHere(); // insert and make selection its
112 void deleteSelection();
113 LinkableMapObj* getSelection(); // returns selection
114 void unselect(); // before changing current noteedit
115 void reselect(); // after changing current noteedit
116 bool select(const QString &); // Select
118 void selectInt(LinkableMapObj*);
119 void selectNextBranchInt(); // Increment number of branch
120 void selectPrevBranchInt(); // Decrement number of branch
122 void selectUpperBranch();
123 void selectLowerBranch();
124 void selectLeftBranch();
125 void selectRightBranch();
126 void selectFirstBranch();
127 void selectLastBranch();
128 void setColor(QColor);
129 void selectBackgroundColor();
130 void setBackgroundColor(QColor);
134 void toggleStandardFlag(QString);
135 virtual void setViewCenter(); // needed for zooming
136 BranchObj* findText(QString,bool); // Find object
137 void findReset(); // Reset Find
138 void editURL(); // edit the URL
139 QString getURL(); // returns URL of selection or ""
140 void editHeading2URL(); // copy heading to URL
141 void editBugzilla2URL(); // create URL to Bugzilla
142 void editFATE2URL(); // create URL to FATE
143 void editVymLink(); // edit link to another map
144 void deleteVymLink(); // delete link to another map
145 QString getVymLink(); // return path to map
146 void toggleHideExport(); // toggle the export flag
147 void removeBranchKeepChilds(); // remove but keep childs
148 void removeChilds(); // 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 setLinkStyle (LinkStyle); // Set style of link
153 LinkStyle getLinkStyle (); // requested in LMO
154 void setLinkColor(QColor); // default color of links
155 void setLinkColorHint(); // color of links
156 void setLinkColorHint(LinkColorHint); // color of links
157 LinkColorHint getLinkColorHint();
158 QColor getDefLinkColor();
159 void setDefXLinkColor(QColor);
160 QColor getDefXLinkColor();
161 void setDefXLinkWidth (int);
162 int getDefXLinkWidth();
163 void toggleLinkColorHint(); // after changing linkStyles
164 void selectLinkColor();
167 void loadFloatImage ();
168 void saveFloatImage ();
169 void setFrame(const FrameType &);
170 void setIncludeImagesVer(bool);
171 void setIncludeImagesHor(bool);
172 void setHideLinkUnselected (bool);
173 bool getHideLinkUnselected ();
175 void importDirInt(BranchObj *,QDir);
178 void followXLink (int);
179 void editXLink (int);
180 void testFunction(); // FIXME just testing
183 void ensureSelectionVisible();
184 virtual void updateViewCenter(); // needed for zooming
185 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
186 virtual void contentsMousePressEvent(QMouseEvent*);
187 virtual void contentsMouseReleaseEvent(QMouseEvent*);
188 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
189 virtual void contentsMouseMoveEvent(QMouseEvent*);
191 virtual void contentsDragEnterEvent(QDragEnterEvent *event);
192 virtual void contentsDropEvent(QDropEvent *event);
195 MapCenterObj* mapCenter;
197 bool adjustCanvasRequested; // collect requests until end of user event
198 BranchObj *editingBO; // entering Text into BO
200 QColor actColor; // actual color
201 QColor defLinkColor; // default color for links
202 QColor defXLinkColor; // default color for xlinks
203 int defXLinkWidth; // default width for xlinks
204 LinkColorHint linkcolorhint;// use heading color or own color
205 LinkStyle linkstyle; // default style for links
207 QCursor handOpenCursor; // cursor while moving canvas view
208 QCursor pickColorCursor; // cursor while picking color
210 bool drawingLink; // true while creating a link
211 bool copyingObj; // true while creating a link
215 LinkableMapObj* selection; // select a LinkableMapObj
216 LinkableMapObj* selectionLast; // last selection
217 MapObj* movingObj; // moving a MapObj
218 MapObj* linkingObj_src; // part of a link
219 QPoint movingObj_orgPos; // org. pos of mouse before move
220 QPoint movingObj_start; // rel. pos of mouse to absPos
221 QPoint movingCont_start; // inital pos of moving Content or
222 QPoint movingVec; // how far has Content moved
223 QPoint movingCenter; // used when zooming
224 QPrinter* printer; // Printing
226 bool mapDefault; // Flag if map is untouched
227 bool mapChanged; // Flag if undo is possible
228 bool mapUnsaved; // Flag if map should be saved
230 bool printFrame; // Print frame around map
231 bool printFooter; // Print footer below map
233 bool zipped; // should map be zipped
234 static int mapNum; // unique number for Editor
235 QString fileName; // short name of file (for tab)
236 QString filePath; // path to file which will be saved
237 QString fileDir; // dir where file is saved
238 QString destPath; // path to .vym file (needed for vymlinks)
239 QString mapName; // fileName without ".vym"
241 bool isInteractive; // non interactive don't need tmpdirs
242 QString tmpMapDir; // tmp directory with data for undo/redo
243 QString histPath; // Path to history file
244 int undosTotal; // total number of undos
245 SimpleSettings undoSet; // undo/redo commands
246 bool blockReposition; // block while load or undo
247 bool blockSaveState; // block while load or undo
249 BranchObj* itFind; // next object in find process
250 bool EOFind; // true, if search failed
252 QPoint exportOffset; // set before export, used in save
253 HideTmpMode hidemode; // true while exporting to hide some stuff
255 void resizeEvent( QResizeEvent * );
257 Q3UrlOperator *urlOperator;
258 QDataStream *imageData;
259 QBuffer *imageBuffer;
261 ShowTextDialog *historyWindow;