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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
|
//Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>, (C) 2012
//Copyright: See COPYING file that comes with this distribution
#include <tqwidget.h>
#include <tqtrla.h>
class TQPixmap;
class TQLabel;
class TQVBoxLayout;
class TQGridLayout;
class TQPushButton;
class TQToolButton;
class TraceWidget;
class TQRectF
{
public:
TQRectF();
TQRectF(double x, double y, double w, double h);
double x() const;
double y() const;
double width() const;
double height() const;
bool isNull() const;
bool operator!() const;
bool operator==(const TQRectF &r1);
bool operator!=(const TQRectF &r1);
void setX(double);
void setY(double);
void setWidth(double);
void setHeight(double);
private:
bool m_valid;
double m_x;
double m_y;
double m_w;
double m_h;
};
class TraceData : public TQObject
{
Q_OBJECT
public:
TraceData(TraceWidget* parent, TQWidget* labelParent=0);
~TraceData();
void drawTrace(TQPainter* p, int graticule_width, int graticule_height);
public slots:
void movePosOneTick();
void moveNegOneTick();
void resetVPosition();
signals:
void offsetChanged(double offset);
private:
TQDoubleArray sampleArray;
TQDoubleArray positionArray;
unsigned int numberOfSamples;
double offset;
TQColor color;
bool enabled;
double leftEdge;
double rightEdge;
double topEdge;
double bottomEdge;
TQString traceName;
TQString horizontalUnits;
TQString verticalUnits;
TQLabel* paramLabel;
TQLabel* graphStatusLabel;
TQLabel* graphStatusLabelInner;
TQToolButton* singleIncrBtn;
TQToolButton* singleDecrBtn;
TQToolButton* posResetBtn;
TraceWidget* parentWidget;
friend class TraceWidget;
friend class GraticuleWidget;
};
typedef TQMemArray<TraceData*> TraceList;
class CursorData : public TQObject
{
Q_OBJECT
public:
CursorData(TraceWidget* parent, TQWidget* labelParent=0);
~CursorData();
void drawCursor(TQPainter* p, int graticule_width, int graticule_height);
public slots:
void movePosOneTick();
void moveNegOneTick();
void movePosMultiTicks();
void moveNegMultiTicks();
private:
TQColor color;
bool enabled;
TQt::Orientation orientation;
double position;
TQString cursorName;
TQLabel* paramLabel;
TQPushButton* singleIncrBtn;
TQPushButton* singleDecrBtn;
TQPushButton* multiIncrBtn;
TQPushButton* multiDecrBtn;
TraceWidget* parentWidget;
friend class TraceWidget;
};
typedef TQMemArray<CursorData*> CursorList;
class GraticuleWidget : public TQWidget
{
Q_OBJECT
public:
GraticuleWidget(TraceWidget*, const char* = 0);
~GraticuleWidget();
protected:
virtual void paintEvent(TQPaintEvent*);
virtual void resizeEvent(TQResizeEvent *);
virtual void mousePressEvent(TQMouseEvent *);
virtual void mouseReleaseEvent(TQMouseEvent *);
virtual void mouseDoubleClickEvent(TQMouseEvent *);
virtual void mouseMoveEvent(TQMouseEvent *);
virtual void enterEvent(TQEvent *);
virtual void leaveEvent(TQEvent *);
private slots:
void updateGraticule();
private:
TraceWidget* m_base;
TQPixmap* m_graticulePixmap;
bool leftMouseDown;
bool middleMouseDown;
TQPoint m_prevDownPos;
TQRectF m_prevCursorRect;
friend class TraceWidget;
friend class TraceData;
friend class CursorData;
};
class TraceWidget : public TQWidget
{
Q_OBJECT
public:
TraceWidget(TQWidget* = 0, const char* = 0);
~TraceWidget();
void setNumberOfSamples(uint traceNumber, unsigned int samples);
void setNumberOfHorizontalDivisions(unsigned int divisions);
void setNumberOfVerticalDivisions(unsigned int divisions);
void setDisplayLimits(uint traceNumber, TQRectF limits);
TQRectF displayLimits(uint traceNumber);
void setNumberOfTraces(uint traceNumber);
void setNumberOfCursors(uint traceNumber);
TQDoubleArray& samples(uint traceNumber);
void setSamples(uint traceNumber, TQDoubleArray&);
TQDoubleArray& positions(uint traceNumber);
void setPositions(uint traceNumber, TQDoubleArray&);
TQColor& traceColor(uint traceNumber);
void setTraceColor(uint traceNumber, TQColor&);
bool traceEnabled(uint traceNumber);
void setTraceEnabled(uint traceNumber, bool enabled, bool showText=true);
TQString traceName(uint traceNumber);
void setTraceName(uint traceNumber, TQString name);
TQString traceHorizontalUnits(uint traceNumber);
void setTraceHorizontalUnits(uint traceNumber, TQString units);
TQString traceVerticalUnits(uint traceNumber);
void setTraceVerticalUnits(uint traceNumber, TQString units);
double cursorPosition(uint cursorNumber);
void setCursorPosition(uint cursorNumber, double position);
bool cursorEnabled(uint cursorNumber);
void setCursorEnabled(uint cursorNumber, bool enabled);
TQString cursorName(uint cursorNumber);
void setCursorName(uint cursorNumber, TQString name);
TQt::Orientation cursorOrientation(uint cursorNumber);
void setCursorOrientation(uint cursorNumber, TQt::Orientation orient);
TQRectF zoomBox();
void setZoomBoxEnabled(bool enabled);
TQRectF zoomCursorBox();
void setZoomCursorBox(const TQRectF rect);
static TQString prettyFormat(double value, double rangeDetectValue, TQString baseUnits, unsigned int precision=3);
public slots:
void setTraceOffset(uint traceNumber, double offset);
private slots:
void updateTraceText();
void updateCursorText();
void processChangedOffset(double offset);
signals:
void zoomBoxChanged(const TQRectF&);
void offsetChanged(uint traceNumber, double offset);
private:
void resizeTraceArray(uint newsize);
void resizeCursorArray(uint newsize);
private:
unsigned int m_horizDivs;
unsigned int m_vertDivs;
unsigned int m_cursorDarkness;
unsigned int m_zoomBoxDarkness;
bool m_zoomBoxEnabled;
TQRectF m_zoomBoxPrev;
TraceList m_traceArray;
CursorList m_cursorArray;
TQGridLayout* m_primaryLayout;
TQGridLayout* m_rightPaneLayout;
TQGridLayout* m_traceLabelLayout;
TQGridLayout* m_infoLabelLayout;
TQGridLayout* m_cursorLabelLayout;
TQGridLayout* m_statusLabelLayout;
TQGridLayout* m_statusLabelLayoutInner;
GraticuleWidget* m_graticuleWidget;
friend class GraticuleWidget;
friend class TraceData;
friend class CursorData;
};
|