-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsignalcurve.h
180 lines (142 loc) · 4.16 KB
/
signalcurve.h
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/*
***************************************************************************
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2020 Teunis van Beelen
*
* Email: [email protected]
*
***************************************************************************
*
* 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 SIGNALCURVE_H
#define SIGNALCURVE_H
#include <QtGlobal>
#include <QWidget>
#include <QMouseEvent>
#include <QPainter>
#include <QPainterPath>
#include <QPushButton>
#include <QPen>
#include <QString>
#include <QStringList>
#include <QFont>
#include <QTimer>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "mainwindow.h"
#include "global.h"
#include "connection.h"
#include "tmc_dev.h"
#include "utils.h"
class UI_Mainwindow;
class SignalCurve: public QWidget
{
Q_OBJECT
public:
SignalCurve(QWidget *parent=0);
QSize sizeHint() const {return minimumSizeHint(); }
QSize minimumSizeHint() const {return QSize(30,10); }
int label_active,
trig_line_visible;
unsigned int scr_update_cntr;
void setSignalColor1(QColor);
void setSignalColor2(QColor);
void setSignalColor3(QColor);
void setSignalColor4(QColor);
void setTraceWidth(int);
void setBackgroundColor(QColor);
void setRasterColor(QColor);
void setTextColor(QColor);
void setBorderSize(int);
void drawCurve(struct device_settings *, struct tmcdev *);
void clear();
void setUpdatesEnabled(bool);
void setTrigLineVisible(void);
void setDeviceParameters(struct device_settings *);
bool hasMoveEvent(void);
signals: void chan1Clicked();
void chan2Clicked();
void chan3Clicked();
void chan4Clicked();
private slots:
void trig_line_timer_handler();
void trig_stat_timer_handler();
private:
QColor SignalColor[MAX_CHNS],
BackgroundColor,
RasterColor,
TextColor;
QTimer *trig_line_timer,
*trig_stat_timer;
QFont smallfont;
double v_sense,
fft_v_sense,
fft_v_offset;
int bufsize,
bordersize,
tracewidth,
w,
h,
old_w,
updates_enabled,
chan_arrow_moving[MAX_CHNS],
trig_level_arrow_moving,
trig_pos_arrow_moving,
use_move_events,
chan_arrow_pos[MAX_CHNS],
chan_tmp_y_pixel_offset[MAX_CHNS],
chan_tmp_old_y_pixel_offset[MAX_CHNS],
trig_level_arrow_pos,
trig_pos_arrow_pos,
trig_stat_flash,
fft_arrow_pos,
fft_arrow_moving,
mouse_x,
mouse_y,
mouse_old_x,
mouse_old_y;
clock_t clk_start,
clk_end;
double cpu_time_used;
void drawWidget(QPainter *, int, int);
void drawArrow(QPainter *, int, int, int, QColor, char);
void drawSmallTriggerArrow(QPainter *, int, int, int, QColor);
void drawTrigCenterArrow(QPainter *, int, int);
void drawChanLabel(QPainter *, int, int, int);
void drawTopLabels(QPainter *);
void paintLabel(QPainter *, int, int, int, int, const char *, QColor);
void paintCounterLabel(QPainter *, int, int);
void paintPlaybackLabel(QPainter *, int, int);
void drawFFT(QPainter *, int, int);
void drawfpsLabel(QPainter *, int, int);
void draw_decoder(QPainter *, int, int);
int ascii_decode_control_char(char, char *, int);
struct device_settings *devparms;
struct tmcdev *device;
UI_Mainwindow *mainwindow;
protected:
void paintEvent(QPaintEvent *);
void mousePressEvent(QMouseEvent *);
void mouseReleaseEvent(QMouseEvent *);
void mouseMoveEvent(QMouseEvent *);
void resizeEvent(QResizeEvent *);
};
#endif