7 #include <qfiledialog.h>
11 #include "mapcenterobj.h"
14 class MapEditor : public QCanvasView , public xmlObj {
18 MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, WFlags f=0);
21 QColor backgroundColor();
22 MapCenterObj* getMapCenter();
24 void adjustCanvasSize();// adjust canvas size to map and scrollview
25 bool blockReposition(); // block while load or undo
28 void makeTmpDirs(); // create temporary directories
29 void delTmpDirs(); // delete temporary directories
30 void makeSubDirs(const QString&);
31 // create subdirs in dir
32 QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
33 void saveState(); // save actual state to backup
34 void saveState(LinkableMapObj *);
35 void saveState(const QString &);
36 void saveState(const SaveMode&, LinkableMapObj *, const QString &);
37 void parseAtom(const QString &);
40 void finishedLineEditNoSave();
43 bool isDefault(); // false, if map was changed once
44 bool isUnsaved(); // save necessary
45 bool hasChanged(); // undo possible
46 void setChanged(); // called from NoteEditor via LMO
48 void setFilePath (QString);
49 void setFilePath (QString,QString);
50 QString getFilePath (); // Full path e.g. "/home/tux/map.xml"
51 QString getFileName (); // e.g. "map.xml"
52 QString getMapName (); // e.g. "map"
53 QString getDestPath (); // e.g. "/home/tux/map.vym"
54 int load (QString&, const LoadMode &); // newmap, import/replace selection
55 int save(const SaveMode &); // Save map
56 void setZipped(bool); // save map zipped
57 bool saveZipped(); // 1 if file will be saved zipped
58 void print(); // print canvas
62 void exportImage (QString fn); // export as PNG
63 void exportImage (QString fn, int); // export in given format
65 void exportXML(const QString&); // export to directory
66 void clear(); // clear map
67 void copy(); // copy branch to clipboard
68 void undo(); // undo last action
70 void undoXML(const QString &); // undo by replacing with saved data
71 LinkableMapObj* pasteNoSave(); // paste clipboard to branch
72 void cutNoSave(); // cut to clipboard
74 void paste(); // paste clipboard to branch and backup
75 void cut(); // cut to clipboard and backup
77 void moveBranchDown();
78 void editHeading(); // Start editing heading
80 void setHeading(const QString &); // Just set the heading for selection
82 void addNewBranch(int); // pos allows to add above/below selection
83 void addNewBranchHere(); // insert and make selection its
84 void deleteSelection();
85 LinkableMapObj* getSelection(); // returns selection
86 bool select(const QString &); // Select
87 void unselect(); // before changing current noteedit
88 void reselect(); // after changing current noteedit
90 void selectNextBranch(); // Increment number of branch
91 void selectPrevBranch(); // Decrement number of branch
93 void selectUpperBranch();
94 void selectLowerBranch();
95 void selectLeftBranch();
96 void selectRightBranch();
97 void selectFirstBranch();
98 void selectLastBranch();
99 void setColor(QColor);
100 void selectBackgroundColor();
101 void setBackgroundColor(QColor);
105 void toggleStandardFlag(QString);
106 virtual void setViewCenter(); // needed for zooming
107 BranchObj* findText(QString,bool); // Find object
108 void findReset(); // Reset Find
109 void openURL(); // open URL in external browser
110 void editURL(); // edit the URL
111 void editHeading2URL(); // copy heading to URL
112 void editBugzilla2URL(); // create URL to Bugzilla
113 void editVymLink(); // edit link to another map
114 void deleteVymLink(); // delete link to another map
115 QString getVymLink(); // return path to map
116 void removeBranchHere(); // remove but keep childs
117 void removeChilds(); // remove childs
118 void editMapInfo(); // dialog to enter author, ...
119 void updateActions(); // update e.g. format buttons
120 void setLinkStyle (LinkStyle); // Set style of link
121 LinkStyle getLinkStyle (); // requested in LMO
122 void setLinkColor(QColor); // default color of links
123 void setLinkColorHint(); // color of links
124 void setLinkColorHint(LinkColorHint); // color of links
125 LinkColorHint getLinkColorHint();
126 QColor getDefLinkColor();
127 void setDefXLinkColor(QColor);
128 QColor getDefXLinkColor();
129 void setDefXLinkWidth (int);
130 int getDefXLinkWidth();
131 void toggleLinkColorHint(); // after changing linkStyles
132 void selectLinkColor();
135 void loadFloatImage ();
136 void saveFloatImage (int);
137 void toggleFloatExport();
138 void setFrame(const FrameType &);
140 void importDir(BranchObj *,QDir);
143 void followXLink (int);
144 void editXLink (int);
145 void testFunction(); // FIXME just testing
148 void ensureSelectionVisible();
149 virtual void updateViewCenter(); // needed for zooming
150 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
151 virtual void contentsMousePressEvent(QMouseEvent*);
152 virtual void contentsMouseReleaseEvent(QMouseEvent*);
153 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
154 virtual void contentsMouseMoveEvent(QMouseEvent*);
158 MapCenterObj* mapCenter;
160 bool adjustCanvasRequested; // collect requests until end of user event
161 BranchObj *editingBO; // entering Text into BO
164 QColor actColor; // actual color
165 QColor defLinkColor; // default color for links
166 QColor defXLinkColor; // default color for xlinks
167 int defXLinkWidth; // default width for xlinks
168 LinkColorHint linkcolorhint;// use heading color or own color
169 LinkStyle linkstyle; // default style for links
171 QCursor handOpenCursor; // cursor while moving canvas view
172 QCursor pickColorCursor; // cursor while picking color
174 bool drawingLink; // true while creating a link
175 bool copyingObj; // true while creating a link
178 LinkableMapObj* selection; // select a LinkableMapObj
179 LinkableMapObj* selectionLast; // last selection
180 MapObj* movingObj; // moving a MapObj
181 MapObj* linkingObj_src; // part of a link
182 QPoint movingObj_start; // rel. pos of mouse to absPos
183 QPoint movingCont_start; // inital pos of moving Content or
184 QPoint movingVec; // how far has Content moved
185 QPoint movingCenter; // used when zooming
186 QPrinter* printer; // Printing
188 bool mapDefault; // Flag if map is untouched
189 bool mapChanged; // Flag if undo is possible
190 bool mapUnsaved; // Flag if map should be saved
191 QString backupXML; // backup (XML) for undo
192 QString undoCommand; // FIXME testing
195 bool printFrame; // Print frame around map
196 bool printFooter; // Print footer below map
198 bool zipped; // should map be zipped
199 QString fileName; // short name of file (for tab)
200 QString filePath; // path to file which will be saved
201 QString fileDir; // dir where file is saved
202 QString destPath; // path to .vym file (needed for vymlinks)
203 QString mapName; // fileName without ".vym"
204 QString lastImageDir; // save dir for adding images
206 bool isInteractive; // non interactive don't need tmpdirs
207 QString bakMapDir; // tmp directory with data for undo
208 bool blockreposition; // block while load or undo
210 BranchObj* itFind; // next object in find process
211 bool EOFind; // true, if search failed
213 QPoint exportOffset; // set before export, used in save
214 void resizeEvent( QResizeEvent * );