Fixed editing of headings. Undo debug output still enabled
5 //#include <q3filedialog.h>
6 //#include <q3process.h>
8 #include <QContextMenuEvent>
10 #include <QDragEnterEvent>
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 saveStateComData (LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &, LinkableMapObj *);
50 void saveState(const SaveMode&, LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &, LinkableMapObj *);
51 void parseAtom(const QString &);
53 void addFloatImage(const QPixmap &img);
56 void fetchImage(const QString &img);
57 void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
58 void imageDataFinished(Q3NetworkOperation *);
61 void toggleHistoryWindow();
62 bool isDefault(); // false, if map was changed once
63 bool isUnsaved(); // save necessary
64 bool hasChanged(); // undo possible
65 void setChanged(); // called from NoteEditor via LMO
67 void setFilePath (QString);
68 void setFilePath (QString,QString);
69 QString getFilePath (); // Full path e.g. "/home/tux/map.xml"
70 QString getFileName (); // e.g. "map.xml"
71 QString getMapName (); // e.g. "map"
72 QString getDestPath (); // e.g. "/home/tux/map.vym"
73 ErrorCode load (QString, LoadMode ); // newmap, import/replace selection
75 int save(const SaveMode &); // Save map
76 void setZipped(bool); // save map zipped
77 bool saveZipped(); // 1 if file will be saved zipped
78 void print(); // print canvas
81 void setHideTmpMode (HideTmpMode); // temporary hide stuff
82 HideTmpMode getHideTmpMode(); // temporary hide stuff
84 void setExportMode (bool); // temporary hide stuff during export
85 void exportImage (QString fn); // export as PNG
86 void exportImage (QString fn, QString); // export in given format
87 void exportOOPresentation(const QString &,const QString &);
88 void exportXML(const QString&); // export to directory
89 void clear(); // clear map
90 void copy(); // copy branch to clipboard
91 void redo(); // redo last action
92 void undo(); // undo last action
94 void undoXML(const QString &, const QString &);
95 void pasteNoSave(); // paste clipboard to branch
96 void cutNoSave(); // cut to clipboard
98 void paste(); // paste clipboard to branch and backup
99 void cut(); // cut to clipboard and backup
100 void move(const int &,const int&);
102 void moveBranchDown();
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 by string
117 QString getSelectString();
119 void selectInt(LinkableMapObj*);
120 void selectNextBranchInt(); // Increment number of branch
121 void selectPrevBranchInt(); // Decrement number of branch
123 void selectUpperBranch();
124 void selectLowerBranch();
125 void selectLeftBranch();
126 void selectRightBranch();
127 void selectFirstBranch();
128 void selectLastBranch();
129 void setColor(QColor);
130 void selectBackgroundColor();
131 void setBackgroundColor(QColor);
135 void toggleStandardFlag(QString);
136 virtual void setViewCenter(); // needed for zooming
137 BranchObj* findText(QString,bool); // Find object
138 void findReset(); // Reset Find
139 void editURL(); // edit the URL
140 QString getURL(); // returns URL of selection or ""
141 QStringList getURLs(); // returns URLs of subtree
142 void editHeading2URL(); // copy heading to URL
143 void editBugzilla2URL(); // create URL to Bugzilla
144 void editFATE2URL(); // create URL to FATE
145 void editVymLink(); // edit link to another map
146 void deleteVymLink(); // delete link to another map
147 QString getVymLink(); // return path to map
148 QStringList getVymLinks(); // return paths in subtree
149 void toggleHideExport(); // toggle the export flag
150 void removeBranchKeepChilds(); // remove but keep childs
151 void removeChilds(); // remove childs
152 void editMapInfo(); // dialog to enter author, ...
153 void updateActions(); // update e.g. format buttons
154 void updateNoteFlag(); // when TextEditor changes
155 void setLinkStyle (LinkStyle); // Set style of link
156 LinkStyle getLinkStyle (); // requested in LMO
157 void setLinkColor(QColor); // default color of links
158 void setLinkColorHint(); // color of links
159 void setLinkColorHint(LinkColorHint); // color of links
160 LinkColorHint getLinkColorHint();
161 QColor getDefLinkColor();
162 void setDefXLinkColor(QColor);
163 QColor getDefXLinkColor();
164 void setDefXLinkWidth (int);
165 int getDefXLinkWidth();
166 void toggleLinkColorHint(); // after changing linkStyles
167 void selectLinkColor();
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(); // FIXME just testing
186 void ensureSelectionVisible();
187 virtual void updateViewCenter(); // needed for zooming
188 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
189 virtual void contentsMousePressEvent(QMouseEvent*);
190 virtual void contentsMouseReleaseEvent(QMouseEvent*);
191 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
192 virtual void contentsMouseMoveEvent(QMouseEvent*);
194 virtual void contentsDragEnterEvent(QDragEnterEvent *event);
195 virtual void contentsDropEvent(QDropEvent *event);
198 MapCenterObj* mapCenter;
200 bool adjustCanvasRequested; // collect requests until end of user event
201 BranchObj *editingBO; // entering Text into BO
203 QColor actColor; // actual color
204 QColor defLinkColor; // default color for links
205 QColor defXLinkColor; // default color for xlinks
206 int defXLinkWidth; // default width for xlinks
207 LinkColorHint linkcolorhint;// use heading color or own color
208 LinkStyle linkstyle; // default style for links
210 QCursor handOpenCursor; // cursor while moving canvas view
211 QCursor pickColorCursor; // 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_start; // rel. pos of mouse to absPos
224 QPoint movingCont_start; // inital pos of moving Content or
225 QPoint movingVec; // how far has Content moved
226 QPoint movingCenter; // used when zooming
227 QPrinter* printer; // Printing
229 bool mapDefault; // Flag if map is untouched
230 bool mapChanged; // Flag if undo is possible
231 bool mapUnsaved; // Flag if map should be saved
233 bool printFrame; // Print frame around map
234 bool printFooter; // Print footer below map
236 bool zipped; // should map be zipped
237 static int mapNum; // unique number for Editor
238 QString fileName; // short name of file (for tab)
239 QString filePath; // path to file which will be saved
240 QString fileDir; // dir where file is saved
241 QString destPath; // path to .vym file (needed for vymlinks)
242 QString mapName; // fileName without ".vym"
244 bool isInteractive; // non interactive don't need tmpdirs
245 QString tmpMapDir; // tmp directory with data for undo/redo
246 QString histPath; // Path to history file
247 int undosTotal; // total number of undos
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;
264 ShowTextDialog *historyWindow;