aboutsummaryrefslogtreecommitdiffstats
path: root/gui/fpgaviewwidget.h
blob: 1d05afb7676edf3d85cf2e13cf994e77226a9a9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef MAPGLWIDGET_H
#define MAPGLWIDGET_H

#include <QMainWindow>
#include <QOpenGLFunctions>
#include <QOpenGLWidget>
#include <QPainter>
#include "nextpnr.h"

// FIXME
USING_NEXTPNR_NAMESPACE

class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
{
    Q_OBJECT

  public:
    FPGAViewWidget(QWidget *parent = 0);
    ~FPGAViewWidget();

    QSize minimumSizeHint() const override;
    QSize sizeHint() const override;

    void setXTranslation(float t_x);
    void setYTranslation(float t_y);
    void setZoom(float t_z);

    void xRotationChanged(int angle);
    void yRotationChanged(int angle);
    void zRotationChanged(int angle);

  protected:
    void initializeGL() Q_DECL_OVERRIDE;
    void paintGL() Q_DECL_OVERRIDE;
    void resizeGL(int width, int height) Q_DECL_OVERRIDE;
    void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
    void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
    void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
    void drawElement(const GraphicElement &el);
    QMainWindow *getMainWindow();

  private:
    int m_windowWidth;
    int m_windowHeight;
    float m_xMove;
    float m_yMove;
    float m_zDistance;
    QPoint m_lastPos;
    Design *design;
};

#endif