Subversion Repositories Code-Repo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
335 Kevin 1
#ifndef CANVAS_H
2
#define CANVAS_H
3
 
4
#include "GlobalDefines.h"
5
#include "Circuit.h"
6
 
7
#define CANVAS_GATE_X_SPACING 240
8
#define CANVAS_GATE_Y_SPACING 20
9
 
10
#define COLOR_WIRE_REGION_OUTLINE 255,0,0,200
11
#define COLOR_WIRE_REGION_V 255,0,0,50
12
#define COLOR_WIRE_REGION_H	0,0,255,50
13
 
14
class Canvas : public QGraphicsView
15
{
16
        Q_OBJECT
17
    public:
18
        Canvas(QWidget *parent = 0);
19
 
20
        QSize minimumSizeHint() const;
21
        QSize sizeHint() const;
22
 
23
        void drawCircuit(Circuit *circuit);
24
 
25
    signals:
26
        void updateZoomSlider(int value);
27
        void updateStatus(QString status);
28
 
29
    public slots:
30
        void zoomCanvas(int);
31
 
32
    protected:
33
#ifndef QT_NO_WHEELEVENT
34
        virtual void wheelEvent(QWheelEvent *event);
35
#endif
36
        virtual void mousePressEvent(QMouseEvent *event);
37
        virtual void mouseMoveEvent(QMouseEvent *event);
38
        virtual void mouseReleaseEvent(QMouseEvent *event);
39
 
40
    private:
41
        QGraphicsScene *scene;
42
        QGraphicsTextItem *resolution;
43
 
44
        int zoomLevel;
45
 
46
        Circuit *circuit;
47
 
48
        bool _pan;
49
        int _panStartX, _panStartY;
50
 
51
#ifdef _DEBUG
52
        QPen debugPen;
53
#endif
54
};
55
 
56
#endif // CANVAS_H