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
34 void saveState(); // save actual state to backup
35 void saveState(const SaveMode&, LinkableMapObj *);
36 void saveState(const SaveMode&, LinkableMapObj *, const QString &);
39 void finishedLineEditNoSave();
42 bool isDefault(); // false, if map was changed once
43 bool isUnsaved(); // save necessary
44 bool hasChanged(); // undo possible
45 void setChanged(); // called from NoteEditor via LMO
47 void setFilePath (QString);
48 void setFilePath (QString,QString);
49 QString getFilePath (); // Full path e.g. "/home/tux/map.xml"
50 QString getFileName (); // e.g. "map.xml"
51 QString getMapName (); // e.g. "map"
52 QString getDestPath (); // e.g. "/home/tux/map.vym"
53 int load (QString&, const LoadMode &); // newmap, import/replace selection
54 int save(const SaveMode &); // Save map
55 void setZipped(bool); // save map zipped
56 bool saveZipped(); // 1 if file will be saved zipped
57 void print(); // print canvas
61 void exportImage (QString fn); // export as PNG
62 void exportImage (QString fn, int); // export in given format
64 void exportXML(const QString&); // export to directory
65 void clear(); // clear map
66 void undo(); // undo last action
67 void copy(); // copy branch to clipboard
69 LinkableMapObj* pasteNoSave(); // paste clipboard to branch
70 void cutNoSave(); // cut to clipboard
72 void paste(); // paste clipboard to branch and backup
73 void cut(); // cut to clipboard and backup
75 void moveBranchDown();
77 void addNewBranch(int); // pos allows to add above/below selection
78 void addNewBranchHere(); // insert and make selection its
79 void deleteSelection();
80 LinkableMapObj* getSelection(); // returns selection
81 bool select(const QString &); // Select
82 void unselect(); // before changing current noteedit
83 void reselect(); // after changing current noteedit
85 void selectNextBranch(); // Increment number of branch
86 void selectPrevBranch(); // Decrement number of branch
88 void selectUpperBranch();
89 void selectLowerBranch();
90 void selectLeftBranch();
91 void selectRightBranch();
92 void selectFirstBranch();
93 void selectLastBranch();
94 void setColor(QColor);
95 void selectBackgroundColor();
96 void setBackgroundColor(QColor);
100 void toggleStandardFlag(QString);
101 virtual void setViewCenter(); // needed for zooming
102 BranchObj* findText(QString,bool); // Find object
103 void findReset(); // Reset Find
104 void openURL(); // open URL in external browser
105 void editURL(); // edit the URL
106 void editHeading2URL(); // copy heading to URL
107 void editBugzilla2URL(); // create URL to Bugzilla
108 void editVymLink(); // edit link to another map
109 void deleteVymLink(); // delete link to another map
110 QString getVymLink(); // return path to map
111 void removeBranchHere(); // remove but keep childs
112 void removeChilds(); // remove childs
113 void editMapInfo(); // dialog to enter author, ...
114 void updateActions(); // update e.g. format buttons
115 void setLinkStyle (LinkStyle); // Set style of link
116 LinkStyle getLinkStyle (); // requested in LMO
117 void setLinkColor(QColor); // default color of links
118 void setLinkColorHint(); // color of links
119 void setLinkColorHint(LinkColorHint); // color of links
120 LinkColorHint getLinkColorHint();
121 QColor getDefLinkColor();
122 void setDefXLinkColor(QColor);
123 QColor getDefXLinkColor();
124 void setDefXLinkWidth (int);
125 int getDefXLinkWidth();
126 void toggleLinkColorHint(); // after changing linkStyles
127 void selectLinkColor();
130 void loadFloatImage ();
131 void saveFloatImage (int);
132 void toggleFloatExport();
133 void setFrame(const FrameType &);
135 void importDir(BranchObj *,QDir);
138 void followXLink (int);
139 void editXLink (int);
140 void testFunction(); // FIXME just testing
141 void parseTest(const QString &); // FIXME just testing
144 void ensureSelectionVisible();
145 virtual void updateViewCenter(); // needed for zooming
146 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
147 virtual void contentsMousePressEvent(QMouseEvent*);
148 virtual void contentsMouseReleaseEvent(QMouseEvent*);
149 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
150 virtual void contentsMouseMoveEvent(QMouseEvent*);
154 MapCenterObj* mapCenter;
156 bool adjustCanvasRequested; // collect requests until end of user event
157 BranchObj *editingBO; // entering Text into BO
160 QColor actColor; // actual color
161 QColor defLinkColor; // default color for links
162 QColor defXLinkColor; // default color for xlinks
163 int defXLinkWidth; // default width for xlinks
164 LinkColorHint linkcolorhint;// use heading color or own color
165 LinkStyle linkstyle; // default style for links
167 QCursor handOpenCursor; // cursor while moving canvas view
168 QCursor pickColorCursor; // cursor while picking color
170 bool drawingLink; // true while creating a link
171 bool copyingObj; // true while creating a link
174 LinkableMapObj* selection; // select a LinkableMapObj
175 LinkableMapObj* selectionLast; // last selection
176 MapObj* movingObj; // moving a MapObj
177 MapObj* linkingObj_src; // part of a link
178 QPoint movingObj_start; // rel. pos of mouse to absPos
179 QPoint movingCont_start; // inital pos of moving Content or
180 QPoint movingVec; // how far has Content moved
181 QPoint movingCenter; // used when zooming
182 QPrinter* printer; // Printing
184 bool mapDefault; // Flag if map is untouched
185 bool mapChanged; // Flag if undo is possible
186 bool mapUnsaved; // Flag if map should be saved
187 QString backupXML; // backup (XML) for undo
188 LinkableMapObj* undoSelection; // replace this LMO with vympart from backup
189 QString undoCommand; // FIXME testing
192 bool printFrame; // Print frame around map
193 bool printFooter; // Print footer below map
195 bool zipped; // should map be zipped
196 QString fileName; // short name of file (for tab)
197 QString filePath; // path to file which will be saved
198 QString fileDir; // dir where file is saved
199 QString destPath; // path to .vym file (needed for vymlinks)
200 QString mapName; // fileName without ".vym"
201 QString lastImageDir; // save dir for adding images
203 bool isInteractive; // non interactive don't need tmpdirs
204 QString bakMapDir; // tmp directory with data for undo
205 bool blockreposition; // block while load or undo
207 BranchObj* itFind; // next object in find process
208 bool EOFind; // true, if search failed
210 QPoint exportOffset; // set before export, used in save
211 void resizeEvent( QResizeEvent * );