SeExpr

ExprGrapher2d.h
Go to the documentation of this file.
1 /*
2 * Copyright Disney Enterprises, Inc. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License
6 * and the following modification to it: Section 6 Trademarks.
7 * deleted and replaced with:
8 *
9 * 6. Trademarks. This License does not grant permission to use the
10 * trade names, trademarks, service marks, or product names of the
11 * Licensor and its affiliates, except as required for reproducing
12 * the content of the NOTICE file.
13 *
14 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
16 *
17 * @file ExprGrapher2d.h
18 * @brief A 2d image graph view for expression editing previewing
19 * @author jlacewel
20 */
21 #ifndef ExprGrapher2d_h
22 #define ExprGrapher2d_h
23
24 #include <QObject>
25 #include <QPalette>
26 #include <QGLWidget>
27 #include <QMouseEvent>
28
29 #include "BasicExpression.h"
30
31 class ExprGrapherWidget;
32 class QLineEdit;
33
34 class ExprGrapherView : public QGLWidget {
35 Q_OBJECT;
36 ExprGrapherWidget& widget;
37
38 public:
39 ExprGrapherView(ExprGrapherWidget& widget, QWidget* parent, int width, int height);
40 virtual ~ExprGrapherView();
41
42 void update();
43 void setWindow(float xmin, float xmax, float ymin, float ymax, float z);
44 void getWindow(float& xmin, float& xmax, float& ymin, float& ymax, float& z);
45
46 protected:
47 void clear();
48 void paintGL();
49 void mousePressEvent(QMouseEvent* event);
50 void mouseReleaseEvent(QMouseEvent* event);
51 void mouseMoveEvent(QMouseEvent* event);
52 int event_oldx, event_oldy;
53
54 signals:
55 void scaleValueManipulated();
56 void clicked();
57
58 private:
59 float* _image;
60 int _width;
61 int _height;
62
63 float xmin, xmax, ymin, ymax, z;
64 float dx, dy;
65
66 bool scaling, translating;
67 };
68
69 class ExprGrapherWidget : public QWidget {
70 Q_OBJECT
71 QLineEdit* scale;
72
73 public:
74 ExprGrapherView* view;
75 BasicExpression expr;
76
77 ExprGrapherWidget(QWidget* parent, int width, int height);
78
79 void update();
80 signals:
81 void preview();
82 private
83 slots:
84 void scaleValueEdited();
85 void scaleValueManipulated();
86 void forwardPreview();
87 };
88
89 #endif
ExprGrapherWidget::expr
BasicExpression expr
Definition: ExprGrapher2d.h:75
ExprGrapherView::ExprGrapherView
ExprGrapherView(ExprGrapherWidget &widget, QWidget *parent, int width, int height)
Definition: ExprGrapher2d.cpp:87
ExprGrapherView::clicked
void clicked()
ExprGrapherView::dy
float dy
Definition: ExprGrapher2d.h:64
ExprGrapherWidget::scaleValueEdited
void scaleValueEdited()
Definition: ExprGrapher2d.cpp:57
ExprGrapherView::translating
bool translating
Definition: ExprGrapher2d.h:66
ExprGrapherWidget
Definition: ExprGrapher2d.h:69
BasicExpression.h
ExprGrapherView::paintGL
void paintGL()
Definition: ExprGrapher2d.cpp:210
ExprGrapherView::widget
ExprGrapherWidget & widget
Definition: ExprGrapher2d.h:35
ExprGrapherWidget::scale
QLineEdit * scale
Definition: ExprGrapher2d.h:71
ExprGrapherWidget::update
void update()
Definition: ExprGrapher2d.cpp:79
ExprGrapherWidget::ExprGrapherWidget
ExprGrapherWidget(QWidget *parent, int width, int height)
Definition: ExprGrapher2d.cpp:29
ExprGrapherView::clear
void clear()
Definition: ExprGrapher2d.cpp:120
ExprGrapherView::_width
int _width
Definition: ExprGrapher2d.h:60
ExprGrapherView::event_oldx
int event_oldx
Definition: ExprGrapher2d.h:52
ExprGrapherView::dx
float dx
Definition: ExprGrapher2d.h:64
ExprGrapherView::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *event)
Definition: ExprGrapher2d.cpp:143
ExprGrapherView::_image
float * _image
Definition: ExprGrapher2d.h:59
ExprGrapherView::z
float z
Definition: ExprGrapher2d.h:63
ExprGrapherView::scaling
bool scaling
Definition: ExprGrapher2d.h:66
ExprGrapherView::_height
int _height
Definition: ExprGrapher2d.h:61
ExprGrapherWidget::preview
void preview()
ExprGrapherView::ymax
float ymax
Definition: ExprGrapher2d.h:63
ExprGrapherView::xmax
float xmax
Definition: ExprGrapher2d.h:63
ExprGrapherWidget::forwardPreview
void forwardPreview()
Definition: ExprGrapher2d.cpp:85
ExprGrapherWidget::view
ExprGrapherView * view
Definition: ExprGrapher2d.h:74
ExprGrapherView
Definition: ExprGrapher2d.h:34
ExprGrapherView::xmin
float xmin
Definition: ExprGrapher2d.h:63
ExprGrapherView::event_oldy
int event_oldy
Definition: ExprGrapher2d.h:52
ExprGrapherView::~ExprGrapherView
virtual ~ExprGrapherView()
Definition: ExprGrapher2d.cpp:99
BasicExpression
Definition: BasicExpression.h:30
ExprGrapherView::update
void update()
Definition: ExprGrapher2d.cpp:178
ExprGrapherView::setWindow
void setWindow(float xmin, float xmax, float ymin, float ymax, float z)
Definition: ExprGrapher2d.cpp:101
ExprGrapherView::ymin
float ymin
Definition: ExprGrapher2d.h:63
ExprGrapherView::mousePressEvent
void mousePressEvent(QMouseEvent *event)
Definition: ExprGrapher2d.cpp:131
ExprGrapherView::getWindow
void getWindow(float &xmin, float &xmax, float &ymin, float &ymax, float &z)
Definition: ExprGrapher2d.cpp:112
ExprGrapherWidget::scaleValueManipulated
void scaleValueManipulated()
Definition: ExprGrapher2d.cpp:73
ExprGrapherView::scaleValueManipulated
void scaleValueManipulated()
ExprGrapherView::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event)
Definition: ExprGrapher2d.cpp:148