File: Fl_Scope.h

package info (click to toggle)
rtai 3.1.0-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 23,560 kB
  • ctags: 19,698
  • sloc: ansic: 88,861; cpp: 31,340; tcl: 14,684; sh: 10,652; xml: 760; yacc: 575; lex: 537; makefile: 394; asm: 310; php: 300; perl: 108
file content (115 lines) | stat: -rw-r--r-- 2,963 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
COPYRIGHT (C) 2003  Lorenzo Dozio (dozio@aero.polimi.it)
                    Paolo Mantegazza (mantegazza@aero.polimi.it)

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library 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
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/

#ifndef _FL_SCOPE_H_
#define _FL_SCOPE_H_

#include <efltk/Fl.h>
#include <efltk/Fl_Gl_Window.h>
#include <efltk/Fl_Color.h>
#include <efltk/gl.h>
#include <GL/glu.h>

#define NDIV_GRID_X           10
#define NDIV_GRID_Y           8
#define MAX_TRACE_LENGTH      100000

typedef struct rtPointStruct rtPoint;

struct rtPointStruct {
        float x;
        float y;
};

class Fl_Scope : public Fl_Gl_Window
{
	public:
		Fl_Scope(int x, int y, int w, int h, int ntr, const char *title="rtScope");
		void sampling_frequency(float);
		float sampling_frequency();
		void setdx();
		float getdx();
		void trace_length(int);
		int trace_length();
		void trace_pointer(int pos);
		int trace_pointer();
		int increment_trace_pointer();
		void add_to_trace(int pos, int n, float val);
		void add_to_trace(int n, float val);
		void pause(int);
		int pause();
		void oneshot(int);
		int oneshot();
		void grid_visible(int);
		void grid_color(float r, float g, float b);
		Fl_Color grid_color();
		void grid_free_color();
		float grid_r();
		float grid_g();
		float grid_b();
		void bg_color(float r, float g, float b);
		Fl_Color bg_color();
		void bg_free_color();
		float bg_r();
		float bg_g();
		float bg_b();
		void time_range(float range);
		float time_range();
		void show_trace(int , int);
		void y_range_inf(int, float);
		void y_range_sup(int, float);
		void trace_color(int, float r, float g, float b);
		Fl_Color trace_color(int);
		void trace_free_color(int);
		float tr_r(int);
		float tr_g(int);
		float tr_b(int);
		void trace_offset(int, float);
	private:
		float Sampling_Frequency;
		float dx;
		int Trace_Len, Trace_Ptr;
		float **Trace;
		int Pause_Flag;
		int OneShot_Flag;
		int Grid_Visible;
		float Grid_rgb[3];
		Fl_Color Grid_Color;
		float Bg_rgb[3];
		Fl_Color Bg_Color;
		float Time_Range;
		int num_of_traces;
		int *Trace_Visible;
		float *Y_Div;
		float *Y_Range_Sup;
		float *Y_Range_Inf;
		float **Trace_rgb;
		Fl_Color *Trace_Color;
		float *Trace_Offset;
		float *Trace_Offset_Value;
	protected:
		void initgl();
		void drawticks();
		void drawgrid();
		void draw();
		float dxGrid;
		float dyGrid;
};

#endif