1 /* Spectool signal graph
2  *
3  * GTK widget implementation
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 
21 #include "config.h"
22 
23 #ifndef __SPECTOOL_SPECTRAL_WIDGET_H__
24 #define __SPECTOOL_SPECTRAL_WIDGET_H__
25 
26 #ifdef HAVE_GTK
27 
28 #include <glib.h>
29 #include <glib-object.h>
30 
31 #include "spectool_container.h"
32 #include "spectool_gtk_hw_registry.h"
33 #include "spectool_gtk_widget.h"
34 
35 G_BEGIN_DECLS
36 
37 #define SPECTOOL_TYPE_SPECTRAL \
38 	(spectool_spectral_get_type())
39 #define SPECTOOL_SPECTRAL(obj) \
40 	(G_TYPE_CHECK_INSTANCE_CAST((obj), \
41 	SPECTOOL_TYPE_SPECTRAL, SpectoolSpectral))
42 #define SPECTOOL_SPECTRAL_CLASS(klass) \
43 	(G_TYPE_CHECK_CLASS_CAST((klass), \
44 	SPECTOOL_TYPE_SPECTRAL, SpectoolSpectralClass))
45 #define IS_SPECTOOL_SPECTRAL(obj) \
46 	(G_TYPE_CHECK_INSTANCE_TYPE((obj), \
47 	SPECTOOL_TYPE_SPECTRAL))
48 #define IS_SPECTOOL_SPECTRAL_CLASS(klass) \
49 	(G_TYPE_CHECK_CLASS_TYPE((class), \
50 	SPECTOOL_TYPE_SPECTRAL))
51 
52 typedef struct _SpectoolSpectral SpectoolSpectral;
53 typedef struct _SpectoolSpectralClass SpectoolSpectralClass;
54 
55 #define SPECTOOL_SPECTRAL_NUM_SAMPLES		100
56 
57 /* Access the color array */
58 #define SPECTOOL_SPECTRAL_COLOR(a, b, c)	((a)[((b) * 3) + c])
59 
60 struct _SpectoolSpectral {
61 	SpectoolWidget parent;
62 
63 	GtkWidget *sweepinfo;
64 
65 	GtkWidget *legend_pix;
66 
67 	float *colormap;
68 	int colormap_len;
69 
70 	GdkPixmap **line_cache;
71 	int line_cache_len;
72 	int n_sweeps_delta;
73 
74 	int oldx, oldy;
75 };
76 
77 struct _SpectoolSpectralClass {
78 	SpectoolWidgetClass parent_class;
79 };
80 
81 GType spectool_spectral_get_type(void);
82 GtkWidget *spectool_spectral_new(void);
83 void spectool_spectral_clear(void);
84 
85 G_END_DECLS
86 
87 #endif
88 #endif
89 
90