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