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 LinkableMapObj* pasteAtNoSave(int); // paste clipboard to branch at position i
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 deleteSelection();
79 LinkableMapObj* getSelection(); // returns selection
80 bool select(QString ); // Select
81 void unselect(); // before changing current noteedit
82 void reselect(); // after changing current noteedit
84 void selectNextBranch(); // Increment number of branch
85 void selectPrevBranch(); // Decrement number of branch
87 void selectUpperBranch();
88 void selectLowerBranch();
89 void selectLeftBranch();
90 void selectRightBranch();
91 void selectFirstBranch();
92 void selectLastBranch();
93 void setColor(QColor);
94 void selectBackgroundColor();
95 void setBackgroundColor(QColor);
99 void toggleStandardFlag(QString);
100 virtual void setViewCenter(); // needed for zooming
101 BranchObj* findText(QString,bool); // Find object
102 void findReset(); // Reset Find
103 void openURL(); // open URL in external browser
104 void editURL(); // edit the URL
105 void editHeading2URL(); // copy heading to URL
106 void editBugzilla2URL(); // create URL to Bugzilla
107 void editVymLink(); // edit link to another map
108 void deleteVymLink(); // delete link to another map
109 QString getVymLink(); // return path to map
110 void editMapInfo(); // dialog to enter author, ...
111 void updateActions(); // update e.g. format buttons
112 void setLinkStyle (LinkStyle); // Set style of link
113 LinkStyle getLinkStyle (); // requested in LMO
114 void setLinkColor(QColor); // default color of links
115 void setLinkColorHint(); // color of links
116 void setLinkColorHint(LinkColorHint); // color of links
117 LinkColorHint getLinkColorHint();
118 QColor getDefLinkColor();
119 void toggleLinkColorHint(); // after changing linkStyles
120 void selectLinkColor();
123 void loadFloatImage ();
124 void saveFloatImage (int);
125 void toggleFloatExport();
126 void setFrame(const FrameType &);
128 void importDir(BranchObj *,QDir);
131 void testFunction(); // FIXME just testing
134 void ensureSelectionVisible();
135 virtual void updateViewCenter(); // needed for zooming
136 virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
137 virtual void contentsMousePressEvent(QMouseEvent*);
138 virtual void contentsMouseReleaseEvent(QMouseEvent*);
139 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
140 virtual void contentsMouseMoveEvent(QMouseEvent*);
144 MapCenterObj* mapCenter;
146 bool adjustCanvasRequested; // collect requests until end of user event
147 BranchObj *editingBO; // entering Text into BO
150 QColor actColor; // actual color
151 QColor deflinkcolor; // default color for links
152 LinkColorHint linkcolorhint;// use heading color or own color
153 LinkStyle linkstyle; // default style for links
155 QCursor handOpenCursor; // cursor while moving canvas view
156 QCursor pickColorCursor; // cursor while picking color
157 bool pickingColor; // true while picking Color CTRL-LeftButton
159 LinkableMapObj* selection; // select a LinkableMapObj
160 LinkableMapObj* selectionLast; // last selection
161 MapObj* movingObj; // moving a MapObj
162 QPoint movingObj_start; // rel. pos of mouse to absPos
163 QPoint movingCont_start; // inital pos of moving Content or
164 QPoint movingVec; // how far has Content moved
165 QPoint movingCenter; // used when zooming
166 QPrinter* printer; // Printing
168 bool mapDefault; // Flag if map is untouched
169 bool mapChanged; // Flag if undo is possible
170 bool mapUnsaved; // Flag if map should be saved
171 QString backupXML; // backup (XML) for undo
172 LinkableMapObj* undoSelection; // replace this LMO with vympart from backup
175 bool printFrame; // Print frame around map
176 bool printFooter; // Print footer below map
178 bool zipped; // should map be zipped
179 QString fileName; // short name of file (for tab)
180 QString filePath; // path to file which will be saved
181 QString fileDir; // dir where file is saved
182 QString destPath; // path to .vym file (needed for vymlinks)
183 QString mapName; // fileName without ".vym"
184 QString lastImageDir; // save dir for adding images
186 bool isInteractive; // non interactive don't need tmpdirs
187 QString bakMapDir; // tmp directory with data for undo
188 bool blockreposition; // block while load or undo
190 BranchObj* itFind; // next object in find process
191 bool EOFind; // true, if search failed
193 QPoint exportOffset; // set before export, used in save
194 void resizeEvent( QResizeEvent * );