mapeditor.h
author insilmaril
Mon, 06 Oct 2008 11:10:20 +0000
changeset 726 7f43b93242aa
parent 723 11f9124c1cca
child 728 a8a98a94899a
permissions -rw-r--r--
Various fixes, also from 1.12. branch
     1 #ifndef MAPEDITOR_H
     2 #define MAPEDITOR_H
     3 
     4 #include <QGraphicsView>
     5 #include <QItemSelectionModel>
     6 
     7 #include "attribute.h"
     8 #include "ornamentedobj.h"
     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 public:
    96 	void setSelectionModel (QItemSelectionModel*);
    97 	QItemSelectionModel* selectionModel();
    98 private:	
    99     QItemSelectionModel* selModel;	// we treat MapEditor as View here...
   100 
   101 };
   102 #endif
   103