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