summaryrefslogtreecommitdiffstats
path: root/clients/tde/src/widgets/tracewidget.h
blob: c2a4c1d9e9d549e4798dc9cd6fda8c2540ad9fa5 (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
53
54
55
56
57
58
59
60
61
62
63
64
//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 TraceData
{
	public:
		TraceData();
		void drawTrace(TQPainter* p, int graticule_width, int graticule_height);

	public:
		TQDoubleArray sampleArray;
		unsigned int numberOfSamples;
		TQColor color;
		bool enabled;
		double leftEdge;
		double rightEdge;
		double topEdge;
		double bottomEdge;
};

typedef TQMemArray<TraceData*> TraceList;

class TraceWidget : public TQWidget
{
	Q_OBJECT
	
	public:
		TraceWidget(TQWidget* = 0, const char* = 0);
		~TraceWidget();

		void setNumberOfSamples(unsigned int samples, uint traceNumber);
		void setNumberOfHorizontalDivisions(unsigned int divisions);
		void setNumberOfVerticalDivisions(unsigned int divisions);
		void setDisplayLimits(double x, double y, double w, double h, uint traceNumber);

		TQDoubleArray& samples(uint traceNumber);
		void setSamples(TQDoubleArray&, uint traceNumber);
		TQColor& traceColor(uint traceNumber);
		void setTraceColor(TQColor&, uint traceNumber);
		bool traceEnabled(uint traceNumber);
		void setTraceEnabled(bool enabled, uint traceNumber);

	protected:
		virtual void paintEvent(TQPaintEvent*);
		virtual void resizeEvent(TQResizeEvent *);

	private slots:
		void updateGraticule();

	private:
		void resizeTraceArray(uint newsize);

	private:
		unsigned int m_horizDivs;
		unsigned int m_vertDivs;
		TraceList m_traceArray;
		TQPixmap* m_graticulePixmap;
};