1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/mapeditor.h Thu Jul 17 12:55:24 2008 +0000
1.3 @@ -0,0 +1,197 @@
1.4 +#ifndef MAPEDITOR_H
1.5 +#define MAPEDITOR_H
1.6 +
1.7 +#include <qcanvas.h>
1.8 +#include <qlineedit.h>
1.9 +#include <qcursor.h>
1.10 +#include <qfiledialog.h>
1.11 +#include <qevent.h>
1.12 +#include <qprocess.h>
1.13 +
1.14 +#include "mapcenterobj.h"
1.15 +#include "misc.h"
1.16 +
1.17 +class MapEditor : public QCanvasView , public xmlObj {
1.18 + Q_OBJECT
1.19 +
1.20 +public:
1.21 + MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, WFlags f=0);
1.22 + ~MapEditor();
1.23 + QColor color();
1.24 + QColor backgroundColor();
1.25 + MapCenterObj* getMapCenter();
1.26 + QCanvas* getCanvas();
1.27 + void adjustCanvasSize();// adjust canvas size to map and scrollview
1.28 + bool blockReposition(); // block while load or undo
1.29 +
1.30 +private:
1.31 + void makeTmpDirs(); // create temporary directories
1.32 + void delTmpDirs(); // delete temporary directories
1.33 + void makeSubDirs(const QString&);
1.34 + // create subdirs in dir
1.35 + QString saveToDir(const QString&,const QString &,bool, const QPoint
1.36 + &,SaveMode);
1.37 + void saveState(); // save actual state to backup
1.38 + void saveState(const SaveMode&, LinkableMapObj *);
1.39 +
1.40 +private slots:
1.41 + void finishedLineEditNoSave();
1.42 +
1.43 +public:
1.44 + bool isDefault(); // false, if map was changed once
1.45 + bool isUnsaved(); // save necessary
1.46 + bool hasChanged(); // undo possible
1.47 + void setChanged(); // called from NoteEditor via LMO
1.48 + void closeMap();
1.49 + void setFilePath (QString);
1.50 + void setFilePath (QString,QString);
1.51 + QString getFilePath (); // Full path e.g. "/home/tux/map.xml"
1.52 + QString getFileName (); // e.g. "map.xml"
1.53 + QString getMapName (); // e.g. "map"
1.54 + QString getDestPath (); // e.g. "/home/tux/map.vym"
1.55 + int load (QString&, const LoadMode &); // newmap, import/replace selection
1.56 + int save(const SaveMode &); // Save map
1.57 + void setZipped(bool); // save map zipped
1.58 + bool saveZipped(); // 1 if file will be saved zipped
1.59 + void print(); // print canvas
1.60 +private:
1.61 + QPixmap getPixmap();
1.62 +public:
1.63 + void exportImage (QString fn); // export as PNG
1.64 + void exportImage (QString fn, int); // export in given format
1.65 + void exportASCII();
1.66 + void exportXML(const QString&); // export to directory
1.67 + void clear(); // clear map
1.68 + void undo(); // undo last action
1.69 + void copy(); // copy branch to clipboard
1.70 +private:
1.71 + LinkableMapObj* pasteNoSave(); // paste clipboard to branch
1.72 + LinkableMapObj* pasteAtNoSave(int); // paste clipboard to branch at position i
1.73 + void cutNoSave(); // cut to clipboard
1.74 +public:
1.75 + void paste(); // paste clipboard to branch and backup
1.76 + void cut(); // cut to clipboard and backup
1.77 + void moveBranchUp();
1.78 + void moveBranchDown();
1.79 + void editHeading();
1.80 + void addNewBranch(int); // pos allows to add above/below selection
1.81 + void deleteSelection();
1.82 + LinkableMapObj* getSelection(); // returns selection
1.83 + bool select(QString ); // Select
1.84 + void unselect(); // before changing current noteedit
1.85 + void reselect(); // after changing current noteedit
1.86 +private:
1.87 + void selectNextBranch(); // Increment number of branch
1.88 + void selectPrevBranch(); // Decrement number of branch
1.89 +public:
1.90 + void selectUpperBranch();
1.91 + void selectLowerBranch();
1.92 + void selectLeftBranch();
1.93 + void selectRightBranch();
1.94 + void selectFirstBranch();
1.95 + void selectLastBranch();
1.96 + void setColor(QColor);
1.97 + void selectBackgroundColor();
1.98 + void setBackgroundColor(QColor);
1.99 + QColor pickColor();
1.100 + void colorItem();
1.101 + void colorBranch();
1.102 + void toggleStandardFlag(QString);
1.103 + virtual void setViewCenter(); // needed for zooming
1.104 + BranchObj* findText(QString,bool); // Find object
1.105 + void findReset(); // Reset Find
1.106 + void openURL(); // open URL in external browser
1.107 + void editURL(); // edit the URL
1.108 + void editHeading2URL(); // copy heading to URL
1.109 + void editBugzilla2URL(); // create URL to Bugzilla
1.110 + void editVymLink(); // edit link to another map
1.111 + void deleteVymLink(); // delete link to another map
1.112 + QString getVymLink(); // return path to map
1.113 + void editMapInfo(); // dialog to enter author, ...
1.114 + void updateActions(); // update e.g. format buttons
1.115 + void setLinkStyle (LinkStyle); // Set style of link
1.116 + LinkStyle getLinkStyle (); // requested in LMO
1.117 + void setLinkColor(QColor); // default color of links
1.118 + void setLinkColorHint(); // color of links
1.119 + void setLinkColorHint(LinkColorHint); // color of links
1.120 + LinkColorHint getLinkColorHint();
1.121 + QColor getDefLinkColor();
1.122 + void toggleLinkColorHint(); // after changing linkStyles
1.123 + void selectLinkColor();
1.124 + void toggleScroll();
1.125 + void unScrollAll();
1.126 + void loadFloatImage ();
1.127 + void saveFloatImage (int);
1.128 + void toggleFloatExport();
1.129 + void setFrame(const FrameType &);
1.130 +private:
1.131 + void importDir(BranchObj *,QDir);
1.132 +public:
1.133 + void importDir();
1.134 + void testFunction(); // FIXME just testing
1.135 +
1.136 +protected:
1.137 + void ensureSelectionVisible();
1.138 + virtual void updateViewCenter(); // needed for zooming
1.139 + virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
1.140 + virtual void contentsMousePressEvent(QMouseEvent*);
1.141 + virtual void contentsMouseReleaseEvent(QMouseEvent*);
1.142 + virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
1.143 + virtual void contentsMouseMoveEvent(QMouseEvent*);
1.144 +
1.145 +private:
1.146 + QCanvas* mapCanvas;
1.147 + MapCenterObj* mapCenter;
1.148 +
1.149 + bool adjustCanvasRequested; // collect requests until end of user event
1.150 + BranchObj *editingBO; // entering Text into BO
1.151 + QLineEdit* lineedit;
1.152 +
1.153 + QColor actColor; // actual color
1.154 + QColor deflinkcolor; // default color for links
1.155 + LinkColorHint linkcolorhint;// use heading color or own color
1.156 + LinkStyle linkstyle; // default style for links
1.157 +
1.158 + QCursor handOpenCursor; // cursor while moving canvas view
1.159 + QCursor pickColorCursor; // cursor while picking color
1.160 + bool pickingColor; // true while picking Color CTRL-LeftButton
1.161 +
1.162 + LinkableMapObj* selection; // select a LinkableMapObj
1.163 + LinkableMapObj* selectionLast; // last selection
1.164 + MapObj* movingObj; // moving a MapObj
1.165 + QPoint movingObj_start; // rel. pos of mouse to absPos
1.166 + QPoint movingCont_start; // inital pos of moving Content or
1.167 + QPoint movingVec; // how far has Content moved
1.168 + QPoint movingCenter; // used when zooming
1.169 + QPrinter* printer; // Printing
1.170 +
1.171 + bool mapDefault; // Flag if map is untouched
1.172 + bool mapChanged; // Flag if undo is possible
1.173 + bool mapUnsaved; // Flag if map should be saved
1.174 + QString backupXML; // backup (XML) for undo
1.175 + LinkableMapObj* undoSelection; // replace this LMO with vympart from backup
1.176 + // if != NULL
1.177 +
1.178 + bool printFrame; // Print frame around map
1.179 + bool printFooter; // Print footer below map
1.180 +
1.181 + bool zipped; // should map be zipped
1.182 + QString fileName; // short name of file (for tab)
1.183 + QString filePath; // path to file which will be saved
1.184 + QString fileDir; // dir where file is saved
1.185 + QString destPath; // path to .vym file (needed for vymlinks)
1.186 + QString mapName; // fileName without ".vym"
1.187 + QString lastImageDir; // save dir for adding images
1.188 +
1.189 + bool isInteractive; // non interactive don't need tmpdirs
1.190 + QString bakMapDir; // tmp directory with data for undo
1.191 + bool blockreposition; // block while load or undo
1.192 +
1.193 + BranchObj* itFind; // next object in find process
1.194 + bool EOFind; // true, if search failed
1.195 +
1.196 + QPoint exportOffset; // set before export, used in save
1.197 + void resizeEvent( QResizeEvent * );
1.198 +};
1.199 +#endif
1.200 +