mapeditor.h
author insilmaril
Mon, 04 Aug 2008 10:43:06 +0000
changeset 723 11f9124c1cca
parent 720 192e1392ba6a
child 726 7f43b93242aa
permissions -rw-r--r--
Adding/moving MCO works again
     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 
    37 public slots:
    38 	void editHeading();
    39 	void editHeadingFinished();
    40 private:
    41 	bool editingHeading;
    42 	QLineEdit *lineEdit;
    43 
    44 protected:
    45 	virtual void contextMenuEvent ( QContextMenuEvent *e );
    46     virtual void keyPressEvent(QKeyEvent*);
    47     virtual void keyReleaseEvent(QKeyEvent*);
    48     virtual void mousePressEvent(QMouseEvent*);
    49     virtual void mouseMoveEvent(QMouseEvent*);
    50     virtual void mouseReleaseEvent(QMouseEvent*);
    51     virtual void mouseDoubleClickEvent(QMouseEvent*);
    52     virtual void resizeEvent( QResizeEvent * );
    53 
    54 	void dragEnterEvent (QDragEnterEvent *);
    55 	void dragMoveEvent (QDragMoveEvent *);
    56 	void dragLeaveEvent (QDragLeaveEvent *);
    57 	void dropEvent (QDropEvent *);
    58 
    59 
    60 private:
    61 	QGraphicsScene *mapScene;
    62 	VymModel *model;			//!< Vym Map, includding several mapCenters
    63 
    64 	bool adjustCanvasRequested;	// collect requests until end of user event
    65 	BranchObj *editingBO;		// entering Text into BO
    66 
    67     QCursor HandOpenCursor;		// cursor while moving canvas view
    68 	QCursor PickColorCursor;	// cursor while picking color 
    69 	QCursor CopyCursor;			// cursor while picking color 
    70 	QCursor XLinkCursor;		// cursor while picking color 
    71 	bool pickingColor;
    72 	bool drawingLink;			// true while creating a link
    73 	bool copyingObj;			// true while creating a link
    74 	XLinkObj* tmpXLink;
    75 
    76 	MapObj* movingObj;				// moving a MapObj
    77 	MapObj* linkingObj_src;			// part of a link
    78     QPointF movingObj_orgPos;		// org. pos of mouse before move
    79     QPointF movingObj_orgRelPos;	// org. relative pos of mouse before move
    80     QPointF movingObj_start;		// rel. pos of mouse to absPos 
    81     QPointF movingCont_start;		// inital pos of moving Content or
    82     QPointF movingVec;				// how far has Content moved
    83 
    84 	QPointF contextMenuPos;			// position where context event was triggered
    85 
    86     QPrinter* printer;				// Printing
    87 
    88 	AttributeTable *attrTable;
    89 
    90 	bool printFrame;			// Print frame around map
    91 	bool printFooter;			// Print footer below map
    92 
    93 	QPoint exportOffset;		// set before export, used in save
    94 
    95 	Selection xelection;					// FIXME only here to get rid of some gcc errors...
    96 	QString getName(const LinkableMapObj*);	// FIXME see above, renamed to getObjectName in VymModel...
    97 };
    98 #endif
    99