mapeditor.h
changeset 408 c2a05fa925a1
parent 407 5db8dfd30ea2
child 412 8059b6aa74d7
     1.1 --- a/mapeditor.h	Thu Nov 23 16:18:26 2006 +0000
     1.2 +++ b/mapeditor.h	Fri Dec 08 20:18:56 2006 +0000
     1.3 @@ -1,8 +1,8 @@
     1.4  #ifndef MAPEDITOR_H
     1.5  #define MAPEDITOR_H
     1.6  
     1.7 -#include <q3canvas.h>
     1.8  #include <QBuffer>
     1.9 +#include <QGraphicsView>
    1.10  
    1.11  #include "mapcenterobj.h"
    1.12  #include "file.h"
    1.13 @@ -10,22 +10,24 @@
    1.14  #include "selection.h"
    1.15  #include "settings.h"
    1.16  
    1.17 +class Q3NetworkOperation;
    1.18 +class Q3UrlOperator;
    1.19  
    1.20 -class MapEditor : public Q3CanvasView , public xmlObj {
    1.21 +class MapEditor : public QGraphicsView, public xmlObj {
    1.22      Q_OBJECT
    1.23  
    1.24  public:
    1.25 -    MapEditor(QWidget* parent=0,  const char* name=0, Qt::WFlags f=0);
    1.26 +    MapEditor(QWidget* parent=0);
    1.27  	~MapEditor();
    1.28      MapCenterObj* getMapCenter();
    1.29 -	Q3Canvas* getCanvas();
    1.30 +	QGraphicsScene * getScene();
    1.31  	void adjustCanvasSize();// adjust canvas size to map and scrollview
    1.32  	bool isRepositionBlocked(); // block while load or undo
    1.33  	
    1.34  private:
    1.35  	QString getName(LinkableMapObj*);	// Get e.g. heading or filename
    1.36  	void makeTmpDirs();		// create temporary directories
    1.37 -    QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
    1.38 +    QString saveToDir(const QString&,const QString &,bool, const QPointF &,LinkableMapObj*);
    1.39      void saveStateChangingPart (LinkableMapObj *, LinkableMapObj *, const QString &, const QString &);
    1.40      void saveStateRemovingPart (LinkableMapObj *, const QString &);
    1.41      void saveState(LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &);
    1.42 @@ -37,12 +39,11 @@
    1.43      void addFloatImageInt(const QPixmap &img);
    1.44  
    1.45    private slots:
    1.46 -//FIXME not needed QT4    void fetchImage(const QString &img);
    1.47 -//FIXME not needed QT4    void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
    1.48 -//FIXME not needed QT4    void imageDataFinished(Q3NetworkOperation *);
    1.49 +    void fetchImage(const QString &img);
    1.50 +    void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
    1.51 +    void imageDataFinished(Q3NetworkOperation *);
    1.52  
    1.53  public:
    1.54 -	void toggleHistoryWindow();
    1.55  	bool isDefault();		// false, if map was changed once
    1.56      bool isUnsaved();		// save necessary
    1.57      bool hasChanged();		// undo possible
    1.58 @@ -60,6 +61,8 @@
    1.59  	void setZipped(bool);		// save map zipped
    1.60  	bool saveZipped();			// 1 if file will be saved zipped
    1.61      void print();				// print canvas
    1.62 +	void setAntiAlias (bool);
    1.63 +	void setSmoothPixmap(bool);
    1.64  private:
    1.65      QPixmap getPixmap();
    1.66  	void setHideTmpMode (HideTmpMode);	// temporary hide stuff
    1.67 @@ -116,6 +119,8 @@
    1.68      void selectRightBranch();
    1.69      void selectFirstBranch();
    1.70      void selectLastBranch();
    1.71 +    void selectMapBackgroundImage();
    1.72 +    void setMapBackgroundImage(const QString &);
    1.73      void selectMapBackgroundColor();
    1.74      void setMapBackgroundColor(QColor);
    1.75      QColor getMapBackgroundColor();
    1.76 @@ -180,18 +185,18 @@
    1.77  protected:
    1.78  	void ensureSelectionVisible();		
    1.79  	virtual void updateViewCenter();	// needed for zooming
    1.80 -	virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
    1.81 +	virtual void contextMenuEvent ( QContextMenuEvent *e );
    1.82      virtual void keyPressEvent(QKeyEvent*);
    1.83      virtual void keyReleaseEvent(QKeyEvent*);
    1.84 -    virtual void contentsMousePressEvent(QMouseEvent*);
    1.85 -    virtual void contentsMouseReleaseEvent(QMouseEvent*);
    1.86 -    virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
    1.87 -    virtual void contentsMouseMoveEvent(QMouseEvent*);
    1.88 +    virtual void mousePressEvent(QMouseEvent*);
    1.89 +    virtual void mouseReleaseEvent(QMouseEvent*);
    1.90 +    virtual void mouseDoubleClickEvent(QMouseEvent*);
    1.91 +    virtual void mouseMoveEvent(QMouseEvent*);
    1.92  
    1.93 -	virtual void contentsDragEnterEvent(QDragEnterEvent *event);
    1.94 +    virtual void contentsDragEnterEvent(QDragEnterEvent *event);
    1.95      virtual void contentsDropEvent(QDropEvent *event);
    1.96  private:
    1.97 -    Q3Canvas* mapCanvas;
    1.98 +	QGraphicsScene *mapScene;
    1.99      MapCenterObj* mapCenter;
   1.100  
   1.101  	bool adjustCanvasRequested;	// collect requests until end of user event
   1.102 @@ -217,12 +222,12 @@
   1.103      LinkableMapObj* selectionLast;	// last selection 
   1.104      MapObj* movingObj;				// moving a MapObj
   1.105  	MapObj* linkingObj_src;			// part of a link
   1.106 -    QPoint movingObj_orgPos;		// org. pos of mouse before move
   1.107 -    QPoint movingObj_orgRelPos;		// org. relative pos of mouse before move
   1.108 -    QPoint movingObj_start;			// rel. pos of mouse to absPos 
   1.109 -    QPoint movingCont_start;		// inital pos of moving Content or
   1.110 -    QPoint movingVec;				// how far has Content moved
   1.111 -	QPoint movingCenter;			// used when zooming
   1.112 +    QPointF movingObj_orgPos;		// org. pos of mouse before move
   1.113 +    QPointF movingObj_orgRelPos;	// org. relative pos of mouse before move
   1.114 +    QPointF movingObj_start;		// rel. pos of mouse to absPos 
   1.115 +    QPointF movingCont_start;		// inital pos of moving Content or
   1.116 +    QPointF movingVec;				// how far has Content moved
   1.117 +	QPointF movingCenter;			// used when zooming
   1.118      QPrinter* printer;				// Printing
   1.119  
   1.120      bool mapDefault;				// Flag if map is untouched