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