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
insilmaril@0
     1
#ifndef MAPEDITOR_H
insilmaril@0
     2
#define MAPEDITOR_H
insilmaril@0
     3
insilmaril@408
     4
#include <QGraphicsView>
insilmaril@726
     5
#include <QItemSelectionModel>
insilmaril@0
     6
insilmaril@616
     7
#include "attribute.h"
insilmaril@473
     8
#include "ornamentedobj.h"
insilmaril@366
     9
#include "settings.h"
insilmaril@645
    10
#include "vymmodel.h"
insilmaril@0
    11
insilmaril@119
    12
insilmaril@486
    13
/*! \brief Main widget in vym to display and edit a map */
insilmaril@473
    14
insilmaril@720
    15
class MapEditor : public QGraphicsView  {	
insilmaril@0
    16
    Q_OBJECT
insilmaril@0
    17
insilmaril@0
    18
public:
insilmaril@720
    19
    MapEditor(VymModel *vm);
insilmaril@0
    20
	~MapEditor();
insilmaril@645
    21
	VymModel* getModel();
insilmaril@408
    22
	QGraphicsScene * getScene();
insilmaril@119
    23
insilmaril@0
    24
public:
insilmaril@491
    25
    void print();				//!< Print the map
insilmaril@491
    26
	void setAntiAlias (bool);	//!< Set or unset antialiasing
insilmaril@491
    27
	void setSmoothPixmap(bool); //!< Set or unset smoothing of pixmaps
insilmaril@0
    28
public:
insilmaril@754
    29
	TreeItem *findMapItem (QPointF p,TreeItem *exclude);	//! find item in map at position p. Ignore item exclude 
insilmaril@514
    30
insilmaril@628
    31
	AttributeTable* attributeTable();
insilmaril@723
    32
    void testFunction1();				// just testing new stuff
insilmaril@723
    33
    void testFunction2();				// just testing new stuff
insilmaril@0
    34
insilmaril@720
    35
public slots:
insilmaril@720
    36
	void editHeading();
insilmaril@720
    37
	void editHeadingFinished();
insilmaril@720
    38
private:
insilmaril@720
    39
	bool editingHeading;
insilmaril@720
    40
	QLineEdit *lineEdit;
insilmaril@720
    41
insilmaril@0
    42
protected:
insilmaril@408
    43
	virtual void contextMenuEvent ( QContextMenuEvent *e );
insilmaril@398
    44
    virtual void keyPressEvent(QKeyEvent*);
insilmaril@398
    45
    virtual void keyReleaseEvent(QKeyEvent*);
insilmaril@408
    46
    virtual void mousePressEvent(QMouseEvent*);
insilmaril@473
    47
    virtual void mouseMoveEvent(QMouseEvent*);
insilmaril@408
    48
    virtual void mouseReleaseEvent(QMouseEvent*);
insilmaril@408
    49
    virtual void mouseDoubleClickEvent(QMouseEvent*);
insilmaril@473
    50
    virtual void resizeEvent( QResizeEvent * );
insilmaril@0
    51
insilmaril@417
    52
	void dragEnterEvent (QDragEnterEvent *);
insilmaril@417
    53
	void dragMoveEvent (QDragMoveEvent *);
insilmaril@417
    54
	void dragLeaveEvent (QDragLeaveEvent *);
insilmaril@417
    55
	void dropEvent (QDropEvent *);
insilmaril@412
    56
insilmaril@473
    57
insilmaril@0
    58
private:
insilmaril@408
    59
	QGraphicsScene *mapScene;
insilmaril@723
    60
	VymModel *model;			//!< Vym Map, includding several mapCenters
insilmaril@0
    61
insilmaril@0
    62
	bool adjustCanvasRequested;	// collect requests until end of user event
insilmaril@0
    63
	BranchObj *editingBO;		// entering Text into BO
insilmaril@0
    64
insilmaril@398
    65
    QCursor HandOpenCursor;		// cursor while moving canvas view
insilmaril@398
    66
	QCursor PickColorCursor;	// cursor while picking color 
insilmaril@398
    67
	QCursor CopyCursor;			// cursor while picking color 
insilmaril@398
    68
	QCursor XLinkCursor;		// cursor while picking color 
insilmaril@83
    69
	bool pickingColor;
insilmaril@83
    70
	bool drawingLink;			// true while creating a link
insilmaril@93
    71
	bool copyingObj;			// true while creating a link
insilmaril@95
    72
	XLinkObj* tmpXLink;
insilmaril@366
    73
insilmaril@720
    74
	MapObj* movingObj;				// moving a MapObj
insilmaril@83
    75
	MapObj* linkingObj_src;			// part of a link
insilmaril@408
    76
    QPointF movingObj_orgPos;		// org. pos of mouse before move
insilmaril@408
    77
    QPointF movingObj_orgRelPos;	// org. relative pos of mouse before move
insilmaril@408
    78
    QPointF movingObj_start;		// rel. pos of mouse to absPos 
insilmaril@408
    79
    QPointF movingCont_start;		// inital pos of moving Content or
insilmaril@408
    80
    QPointF movingVec;				// how far has Content moved
insilmaril@684
    81
insilmaril@720
    82
	QPointF contextMenuPos;			// position where context event was triggered
insilmaril@684
    83
insilmaril@0
    84
    QPrinter* printer;				// Printing
insilmaril@0
    85
insilmaril@628
    86
	AttributeTable *attrTable;
insilmaril@628
    87
insilmaril@0
    88
	bool printFrame;			// Print frame around map
insilmaril@0
    89
	bool printFooter;			// Print footer below map
insilmaril@0
    90
insilmaril@720
    91
	QPoint exportOffset;		// set before export, used in save
insilmaril@0
    92
insilmaril@728
    93
//////////// Selection related
insilmaril@728
    94
signals:
insilmaril@729
    95
	void selectionChanged(const QItemSelection &, const QItemSelection &);
insilmaril@728
    96
insilmaril@726
    97
private:	
insilmaril@728
    98
	QList <QGraphicsRectItem*> selboxList;
insilmaril@728
    99
	QColor selectionColor;
insilmaril@728
   100
insilmaril@728
   101
public slots:
insilmaril@728
   102
	void updateSelection(const QItemSelection &,const QItemSelection &); // update selection
insilmaril@753
   103
	void updateData (const QModelIndex&); // update data
insilmaril@728
   104
public:
insilmaril@728
   105
	void setSelectionColor (QColor c);
insilmaril@728
   106
	QColor getSelectionColor ();
insilmaril@726
   107
insilmaril@0
   108
};
insilmaril@0
   109
#endif
insilmaril@0
   110