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
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@720
    29
	void toggleStandardFlag(QString);
insilmaril@520
    30
insilmaril@723
    31
	void updateSelection();				// update geometry of selection
insilmaril@514
    32
insilmaril@628
    33
	AttributeTable* attributeTable();
insilmaril@723
    34
    void testFunction1();				// just testing new stuff
insilmaril@723
    35
    void testFunction2();				// just testing new stuff
insilmaril@0
    36
insilmaril@720
    37
public slots:
insilmaril@720
    38
	void editHeading();
insilmaril@720
    39
	void editHeadingFinished();
insilmaril@720
    40
private:
insilmaril@720
    41
	bool editingHeading;
insilmaril@720
    42
	QLineEdit *lineEdit;
insilmaril@720
    43
insilmaril@0
    44
protected:
insilmaril@408
    45
	virtual void contextMenuEvent ( QContextMenuEvent *e );
insilmaril@398
    46
    virtual void keyPressEvent(QKeyEvent*);
insilmaril@398
    47
    virtual void keyReleaseEvent(QKeyEvent*);
insilmaril@408
    48
    virtual void mousePressEvent(QMouseEvent*);
insilmaril@473
    49
    virtual void mouseMoveEvent(QMouseEvent*);
insilmaril@408
    50
    virtual void mouseReleaseEvent(QMouseEvent*);
insilmaril@408
    51
    virtual void mouseDoubleClickEvent(QMouseEvent*);
insilmaril@473
    52
    virtual void resizeEvent( QResizeEvent * );
insilmaril@0
    53
insilmaril@417
    54
	void dragEnterEvent (QDragEnterEvent *);
insilmaril@417
    55
	void dragMoveEvent (QDragMoveEvent *);
insilmaril@417
    56
	void dragLeaveEvent (QDragLeaveEvent *);
insilmaril@417
    57
	void dropEvent (QDropEvent *);
insilmaril@412
    58
insilmaril@473
    59
insilmaril@0
    60
private:
insilmaril@408
    61
	QGraphicsScene *mapScene;
insilmaril@723
    62
	VymModel *model;			//!< Vym Map, includding several mapCenters
insilmaril@0
    63
insilmaril@0
    64
	bool adjustCanvasRequested;	// collect requests until end of user event
insilmaril@0
    65
	BranchObj *editingBO;		// entering Text into BO
insilmaril@0
    66
insilmaril@398
    67
    QCursor HandOpenCursor;		// cursor while moving canvas view
insilmaril@398
    68
	QCursor PickColorCursor;	// cursor while picking color 
insilmaril@398
    69
	QCursor CopyCursor;			// cursor while picking color 
insilmaril@398
    70
	QCursor XLinkCursor;		// cursor while picking color 
insilmaril@83
    71
	bool pickingColor;
insilmaril@83
    72
	bool drawingLink;			// true while creating a link
insilmaril@93
    73
	bool copyingObj;			// true while creating a link
insilmaril@95
    74
	XLinkObj* tmpXLink;
insilmaril@366
    75
insilmaril@720
    76
	MapObj* movingObj;				// moving a MapObj
insilmaril@83
    77
	MapObj* linkingObj_src;			// part of a link
insilmaril@408
    78
    QPointF movingObj_orgPos;		// org. pos of mouse before move
insilmaril@408
    79
    QPointF movingObj_orgRelPos;	// org. relative pos of mouse before move
insilmaril@408
    80
    QPointF movingObj_start;		// rel. pos of mouse to absPos 
insilmaril@408
    81
    QPointF movingCont_start;		// inital pos of moving Content or
insilmaril@408
    82
    QPointF movingVec;				// how far has Content moved
insilmaril@684
    83
insilmaril@720
    84
	QPointF contextMenuPos;			// position where context event was triggered
insilmaril@684
    85
insilmaril@0
    86
    QPrinter* printer;				// Printing
insilmaril@0
    87
insilmaril@628
    88
	AttributeTable *attrTable;
insilmaril@628
    89
insilmaril@0
    90
	bool printFrame;			// Print frame around map
insilmaril@0
    91
	bool printFooter;			// Print footer below map
insilmaril@0
    92
insilmaril@720
    93
	QPoint exportOffset;		// set before export, used in save
insilmaril@0
    94
insilmaril@726
    95
public:
insilmaril@726
    96
	void setSelectionModel (QItemSelectionModel*);
insilmaril@726
    97
	QItemSelectionModel* selectionModel();
insilmaril@726
    98
private:	
insilmaril@726
    99
    QItemSelectionModel* selModel;	// we treat MapEditor as View here...
insilmaril@726
   100
insilmaril@0
   101
};
insilmaril@0
   102
#endif
insilmaril@0
   103