mapeditor.h
author insilmaril
Wed, 16 Jul 2008 10:44:44 +0000
changeset 720 192e1392ba6a
parent 692 c5e3cb54b9db
child 723 11f9124c1cca
permissions -rw-r--r--
Started to restructure for later use of Model/View
insilmaril@0
     1
#ifndef MAPEDITOR_H
insilmaril@0
     2
#define MAPEDITOR_H
insilmaril@0
     3
insilmaril@408
     4
#include <QGraphicsView>
insilmaril@0
     5
insilmaril@616
     6
#include "attribute.h"
insilmaril@473
     7
#include "ornamentedobj.h"
insilmaril@720
     8
#include "selection.h"		// FIXME should not be needed
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@720
    31
	void updateSelection();					// update geometry of selection
insilmaril@514
    32
insilmaril@628
    33
	AttributeTable* attributeTable();
insilmaril@527
    34
    void testFunction1();					// just testing new stuff
insilmaril@527
    35
    void testFunction2();					// just testing new stuff
insilmaril@366
    36
											// set /mainwindo/showTestMenu=true...
insilmaril@0
    37
insilmaril@720
    38
public slots:
insilmaril@720
    39
	void editHeading();
insilmaril@720
    40
	void editHeadingFinished();
insilmaril@720
    41
private:
insilmaril@720
    42
	bool editingHeading;
insilmaril@720
    43
	QLineEdit *lineEdit;
insilmaril@720
    44
insilmaril@0
    45
protected:
insilmaril@408
    46
	virtual void contextMenuEvent ( QContextMenuEvent *e );
insilmaril@398
    47
    virtual void keyPressEvent(QKeyEvent*);
insilmaril@398
    48
    virtual void keyReleaseEvent(QKeyEvent*);
insilmaril@408
    49
    virtual void mousePressEvent(QMouseEvent*);
insilmaril@473
    50
    virtual void mouseMoveEvent(QMouseEvent*);
insilmaril@408
    51
    virtual void mouseReleaseEvent(QMouseEvent*);
insilmaril@408
    52
    virtual void mouseDoubleClickEvent(QMouseEvent*);
insilmaril@473
    53
    virtual void resizeEvent( QResizeEvent * );
insilmaril@0
    54
insilmaril@417
    55
	void dragEnterEvent (QDragEnterEvent *);
insilmaril@417
    56
	void dragMoveEvent (QDragMoveEvent *);
insilmaril@417
    57
	void dragLeaveEvent (QDragLeaveEvent *);
insilmaril@417
    58
	void dropEvent (QDropEvent *);
insilmaril@412
    59
insilmaril@473
    60
insilmaril@0
    61
private:
insilmaril@408
    62
	QGraphicsScene *mapScene;
insilmaril@645
    63
	VymModel *model;					// Vym Map, includding several mapCenters
insilmaril@0
    64
insilmaril@0
    65
	bool adjustCanvasRequested;	// collect requests until end of user event
insilmaril@0
    66
	BranchObj *editingBO;		// entering Text into BO
insilmaril@0
    67
insilmaril@398
    68
    QCursor HandOpenCursor;		// cursor while moving canvas view
insilmaril@398
    69
	QCursor PickColorCursor;	// cursor while picking color 
insilmaril@398
    70
	QCursor CopyCursor;			// cursor while picking color 
insilmaril@398
    71
	QCursor XLinkCursor;		// cursor while picking color 
insilmaril@83
    72
	bool pickingColor;
insilmaril@83
    73
	bool drawingLink;			// true while creating a link
insilmaril@93
    74
	bool copyingObj;			// true while creating a link
insilmaril@95
    75
	XLinkObj* tmpXLink;
insilmaril@366
    76
insilmaril@720
    77
	MapObj* movingObj;				// moving a MapObj
insilmaril@83
    78
	MapObj* linkingObj_src;			// part of a link
insilmaril@408
    79
    QPointF movingObj_orgPos;		// org. pos of mouse before move
insilmaril@408
    80
    QPointF movingObj_orgRelPos;	// org. relative pos of mouse before move
insilmaril@408
    81
    QPointF movingObj_start;		// rel. pos of mouse to absPos 
insilmaril@408
    82
    QPointF movingCont_start;		// inital pos of moving Content or
insilmaril@408
    83
    QPointF movingVec;				// how far has Content moved
insilmaril@684
    84
insilmaril@720
    85
	QPointF contextMenuPos;			// position where context event was triggered
insilmaril@684
    86
insilmaril@0
    87
    QPrinter* printer;				// Printing
insilmaril@0
    88
insilmaril@628
    89
	AttributeTable *attrTable;
insilmaril@628
    90
insilmaril@0
    91
	bool printFrame;			// Print frame around map
insilmaril@0
    92
	bool printFooter;			// Print footer below map
insilmaril@0
    93
insilmaril@720
    94
	QPoint exportOffset;		// set before export, used in save
insilmaril@0
    95
insilmaril@720
    96
	Selection xelection;					// FIXME only here to get rid of some gcc errors...
insilmaril@720
    97
	QString getName(const LinkableMapObj*);	// FIXME see above, renamed to getObjectName in VymModel...
insilmaril@0
    98
};
insilmaril@0
    99
#endif
insilmaril@0
   100