forked from analogdevicesinc/scopy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuffer_previewer.hpp
130 lines (105 loc) · 3.2 KB
/
buffer_previewer.hpp
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
* Copyright (c) 2019 Analog Devices Inc.
*
* This file is part of Scopy
* (see http://www.github.com/analogdevicesinc/scopy).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BUFFER_PREVIEWER_H
#define BUFFER_PREVIEWER_H
#include <QFrame>
namespace adiscope{
class BufferPreviewer: public QFrame
{
Q_OBJECT
public:
explicit BufferPreviewer(QWidget *parent = 0);
explicit BufferPreviewer(int pixelsPerPeriod, double wavePhase,
QWidget *parent = 0);
virtual ~BufferPreviewer();
double waveformPos() const;
void setWaveformPos(double);
double waveformWidth() const;
void setWaveformWidth(double);
double highlighPos() const;
void setHighlightPos(double);
double highlightWidth() const;
void setHighlightWidth(double);
double cursorPos() const;
void setCursorPos(double);
int verticalSpacing() const;
void setVerticalSpacing(int);
int pixelsPerPeriod() const;
double wavePhase() const;
void setGatingEnabled(bool);
void setLeftGateWidth(double);
void setRightGateWidth(double);
void setCursorVisible(bool visible);
Q_SIGNALS:
void bufferMovedBy(int);
void bufferStopDrag();
void bufferResetPosition();
protected:
void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
virtual void buildFullWaveform(QPointF *wavePoints, int numPts) = 0;
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void enterEvent(QEvent *event);
void leaveEvent(QEvent *event);
private:
double m_waveformPos;
double m_waveformWidth;
double m_highlightPos;
double m_highlightWidth;
double m_cursorPos;
int m_verticalSpacing;
int m_pixelsPerPeriod;
double m_startingPhase;
int m_fullWaveNumPoints;
QPointF *m_fullWavePoints;
QPoint m_offset;
int m_pixelLeft;
int m_pixelRight;
bool m_rightBtnClick;
bool m_gatingEnabled;
double m_leftGateWidth;
double m_rightGateWidth;
bool m_cursorVisible;
};
class AnalogBufferPreviewer: public BufferPreviewer
{
public:
explicit AnalogBufferPreviewer(QWidget *parent = 0);
explicit AnalogBufferPreviewer(int pixelsPerPeriod, double wavePhase,
QWidget *parent = 0);
protected:
virtual void buildFullWaveform(QPointF *wavePoints, int numPts);
};
class DigitalBufferPreviewer: public BufferPreviewer
{
public:
explicit DigitalBufferPreviewer(QWidget *parent = 0);
explicit DigitalBufferPreviewer(int pixelsPerPeriod, QWidget *parent = 0);
void setNoOfSteps(double val);
double noOfSteps();
protected:
virtual void buildFullWaveform(QPointF *wavePoints, int numPts);
private:
double m_noOfSteps;
};
} // namespace adiscope
#endif // BUFFER_PREVIEWER_H