File: CtrlOScope.h

package info (click to toggle)
audmes 0%2Bgit20200429-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 632 kB
  • sloc: cpp: 10,536; ansic: 275; makefile: 7
file content (97 lines) | stat: -rw-r--r-- 3,052 bytes parent folder | download
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
// CtrlOScope.h : header file
/*
 * Copyright (C) 2008 Vaclav Peroutka <vaclavpe@seznam.cz>
 *
 * Licensed under the GNU General Public License Version 2
 *
 * 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 2 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 <https://www.gnu.org/licenses/>.
 */

#ifndef __CTRLOSCOPE_H__
#define __CTRLOSCOPE_H__

#include <wx/wx.h>
#include <wx/dynarray.h>



class CtrlOScope : public wxControl
{
public:
	CtrlOScope( wxWindow* parent, wxString xname = _T("X"), wxString yname = _T("Y"), int tracks = 1);

	virtual ~CtrlOScope();
	//void OnTimer(wxTimerEvent& event);
	void OnPaint(wxPaintEvent& event);
	void OnSize(wxSizeEvent& event);
	void PaintAll( wxDC & dc);
	void PaintAllFunction( wxDC & dc, int rectX, int rectY);
	void OnEraseBackground( wxEraseEvent& WXUNUSED(event) ) { };

	void AppendPoints(double dNewPoint[], int iTrack = 0);
	//	void SetRange(double dLower, double dUpper, int iTrack = 0, int logrange = false);
	void SetTrack(double dTrack [], int iTrack = 0);
	void SetXRange(double dLower, double dUpper, int logrange);
	void SetYRange(double dLower, double dUpper, int logrange, int itrack);



	void SetXUnits(wxString string, wxString XMin = "", wxString XMax = "");
	void SetYUnits(wxString string, wxString YMin = "", wxString YMax = "");
	void SetGridColor(wxColour color);
	void SetPlotColor(wxColour color, int iTrack = 0);
	void SetBackgroundColor(wxColour color);
	void Reset( int iTrack = 0);
	void SetTrack( wxArrayDouble ardbl);
	void SetTrack2( wxArrayDouble ardbl);
	void SetNumOfVerticals( int num) { m_NumberOfVerticals = num; };

	void ShowUserText( wxString text, int xpos, int ypos) { m_UserText = text; m_UserTextPosX = xpos; m_UserTextPosY = ypos; };

	virtual wxSize GetSize() const;
	virtual wxSize DoGetBestSize() const;
/* 	void GetSize( int *w, int *h) { *w = 300; *h = 150; } */
/* 	wxSize GetMinSize( void) { return wxSize( 300,150); } */
/* 	wxSize GetClientSize( void) { return wxSize( 300,150); } */
/* 	wxSize GetAdjustedBestSize( void) { return wxSize( 300,150); } */

protected:
	int m_tracks;
	int m_width, m_height;

	wxArrayDouble m_points;
	wxArrayDouble m_points2;
	double m_MaxXValue;
	double m_MinXValue;
	double m_MaxYValue;
	double m_MinYValue;
	int m_LogX;
	int m_LogY;
	wxString m_XUnit;
	wxString m_YUnit;

	wxColour m_bgColor;
	wxColour m_plColor;
	wxColour m_trColor;
	wxColour m_tr2Color;
	wxColour m_whColor;

	int m_NumberOfVerticals;

	wxString m_UserText;
	int m_UserTextPosX;
	int m_UserTextPosY;

};
#endif // __CTRLOSCOPE_H__