mapeditor.h
author insilmaril
Thu, 07 May 2009 08:48:53 +0000
changeset 766 7a71a914afdb
parent 754 db0ec4bcf416
child 767 6d2b32f305f9
permissions -rw-r--r--
Started to reanimate flags
     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 	TreeItem *findMapItem (QPointF p,TreeItem *exclude);	//! find item in map at position p. Ignore item exclude 
    30 
    31 	AttributeTable* attributeTable();
    32     void testFunction1();				// just testing new stuff
    33     void testFunction2();				// just testing new stuff
    34 
    35 public slots:
    36 	void editHeading();
    37 	void editHeadingFinished();
    38 private:
    39 	bool editingHeading;
    40 	QLineEdit *lineEdit;
    41 
    42 protected:
    43 	virtual void contextMenuEvent ( QContextMenuEvent *e );
    44     virtual void keyPressEvent(QKeyEvent*);
    45     virtual void keyReleaseEvent(QKeyEvent*);
    46     virtual void mousePressEvent(QMouseEvent*);
    47     virtual void mouseMoveEvent(QMouseEvent*);
    48     virtual void mouseReleaseEvent(QMouseEvent*);
    49     virtual void mouseDoubleClickEvent(QMouseEvent*);
    50     virtual void resizeEvent( QResizeEvent * );
    51 
    52 	void dragEnterEvent (QDragEnterEvent *);
    53 	void dragMoveEvent (QDragMoveEvent *);
    54 	void dragLeaveEvent (QDragLeaveEvent *);
    55 	void dropEvent (QDropEvent *);
    56 
    57 
    58 private:
    59 	QGraphicsScene *mapScene;
    60 	VymModel *model;			//!< Vym Map, includding several mapCenters
    61 
    62 	bool adjustCanvasRequested;	// collect requests until end of user event
    63 	BranchObj *editingBO;		// entering Text into BO
    64 
    65     QCursor HandOpenCursor;		// cursor while moving canvas view
    66 	QCursor PickColorCursor;	// cursor while picking color 
    67 	QCursor CopyCursor;			// cursor while picking color 
    68 	QCursor XLinkCursor;		// cursor while picking color 
    69 	bool pickingColor;
    70 	bool drawingLink;			// true while creating a link
    71 	bool copyingObj;			// true while creating a link
    72 	XLinkObj* tmpXLink;
    73 
    74 	MapObj* movingObj;				// moving a MapObj
    75 	MapObj* linkingObj_src;			// part of a link
    76     QPointF movingObj_orgPos;		// org. pos of mouse before move
    77     QPointF movingObj_orgRelPos;	// org. relative pos of mouse before move
    78     QPointF movingObj_start;		// rel. pos of mouse to absPos 
    79     QPointF movingCont_start;		// inital pos of moving Content or
    80     QPointF movingVec;				// how far has Content moved
    81 
    82 	QPointF contextMenuPos;			// position where context event was triggered
    83 
    84     QPrinter* printer;				// Printing
    85 
    86 	AttributeTable *attrTable;
    87 
    88 	bool printFrame;			// Print frame around map
    89 	bool printFooter;			// Print footer below map
    90 
    91 	QPoint exportOffset;		// set before export, used in save
    92 
    93 //////////// Selection related
    94 signals:
    95 	void selectionChanged(const QItemSelection &, const QItemSelection &);
    96 
    97 private:	
    98 	QList <QGraphicsRectItem*> selboxList;
    99 	QColor selectionColor;
   100 
   101 public slots:
   102 	void updateSelection(const QItemSelection &,const QItemSelection &); // update selection
   103 	void updateData (const QModelIndex&); // update data
   104 public:
   105 	void setSelectionColor (QColor c);
   106 	QColor getSelectionColor ();
   107 
   108 };
   109 #endif
   110