mapeditor.h
author insilmaril
Wed, 16 Jul 2008 10:46:14 +0000
changeset 721 12958f987bcf
parent 720 192e1392ba6a
child 723 11f9124c1cca
permissions -rw-r--r--
Started to restructure for later use of Model/View
     1 #ifndef MAPEDITOR_H
     2 #define MAPEDITOR_H
     3 
     4 #include <QGraphicsView>
     5 
     6 #include "attribute.h"
     7 #include "ornamentedobj.h"
     8 #include "selection.h"		// FIXME should not be needed
     9 #include "settings.h"
    10 #include "vymmodel.h"
    11 
    12 
    13 /*! \brief Main widget in vym to display and edit a map */
    14 
    15 class MapEditor : public QGraphicsView  {	
    16     Q_OBJECT
    17 
    18 public:
    19     MapEditor(VymModel *vm);
    20 	~MapEditor();
    21 	VymModel* getModel();
    22 	QGraphicsScene * getScene();
    23 
    24 public:
    25     void print();				//!< Print the map
    26 	void setAntiAlias (bool);	//!< Set or unset antialiasing
    27 	void setSmoothPixmap(bool); //!< Set or unset smoothing of pixmaps
    28 public:
    29 	void toggleStandardFlag(QString);
    30 
    31 	void updateSelection();					// update geometry of selection
    32 
    33 	AttributeTable* attributeTable();
    34     void testFunction1();					// just testing new stuff
    35     void testFunction2();					// just testing new stuff
    36 											// set /mainwindo/showTestMenu=true...
    37 
    38 public slots:
    39 	void editHeading();
    40 	void editHeadingFinished();
    41 private:
    42 	bool editingHeading;
    43 	QLineEdit *lineEdit;
    44 
    45 protected:
    46 	virtual void contextMenuEvent ( QContextMenuEvent *e );
    47     virtual void keyPressEvent(QKeyEvent*);
    48     virtual void keyReleaseEvent(QKeyEvent*);
    49     virtual void mousePressEvent(QMouseEvent*);
    50     virtual void mouseMoveEvent(QMouseEvent*);
    51     virtual void mouseReleaseEvent(QMouseEvent*);
    52     virtual void mouseDoubleClickEvent(QMouseEvent*);
    53     virtual void resizeEvent( QResizeEvent * );
    54 
    55 	void dragEnterEvent (QDragEnterEvent *);
    56 	void dragMoveEvent (QDragMoveEvent *);
    57 	void dragLeaveEvent (QDragLeaveEvent *);
    58 	void dropEvent (QDropEvent *);
    59 
    60 
    61 private:
    62 	QGraphicsScene *mapScene;
    63 	VymModel *model;					// Vym Map, includding several mapCenters
    64 
    65 	bool adjustCanvasRequested;	// collect requests until end of user event
    66 	BranchObj *editingBO;		// entering Text into BO
    67 
    68     QCursor HandOpenCursor;		// cursor while moving canvas view
    69 	QCursor PickColorCursor;	// cursor while picking color 
    70 	QCursor CopyCursor;			// cursor while picking color 
    71 	QCursor XLinkCursor;		// cursor while picking color 
    72 	bool pickingColor;
    73 	bool drawingLink;			// true while creating a link
    74 	bool copyingObj;			// true while creating a link
    75 	XLinkObj* tmpXLink;
    76 
    77 	MapObj* movingObj;				// moving a MapObj
    78 	MapObj* linkingObj_src;			// part of a link
    79     QPointF movingObj_orgPos;		// org. pos of mouse before move
    80     QPointF movingObj_orgRelPos;	// org. relative pos of mouse before move
    81     QPointF movingObj_start;		// rel. pos of mouse to absPos 
    82     QPointF movingCont_start;		// inital pos of moving Content or
    83     QPointF movingVec;				// how far has Content moved
    84 
    85 	QPointF contextMenuPos;			// position where context event was triggered
    86 
    87     QPrinter* printer;				// Printing
    88 
    89 	AttributeTable *attrTable;
    90 
    91 	bool printFrame;			// Print frame around map
    92 	bool printFooter;			// Print footer below map
    93 
    94 	QPoint exportOffset;		// set before export, used in save
    95 
    96 	Selection xelection;					// FIXME only here to get rid of some gcc errors...
    97 	QString getName(const LinkableMapObj*);	// FIXME see above, renamed to getObjectName in VymModel...
    98 };
    99 #endif
   100