2 * A few useful widgets - a line graph, a knob, a tube - Panama!
4 * Copyright (C) 2008-2010 Krzysztof Foltman, Torben Hohn, Markus
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General
18 * Public License along with this program; if not, write to the
19 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02111-1307, USA.
23 #ifndef _USE_MATH_DEFINES
24 #define _USE_MATH_DEFINES
26 #ifndef __CALF_CTL_LINEGRAPH
27 #define __CALF_CTL_LINEGRAPH
30 #include <calf/giface.h>
35 #define CALF_TYPE_LINE_GRAPH (calf_line_graph_get_type())
36 #define CALF_LINE_GRAPH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALF_TYPE_LINE_GRAPH, CalfLineGraph))
37 #define CALF_IS_LINE_GRAPH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALF_TYPE_LINE_GRAPH))
38 #define CALF_LINE_GRAPH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALF_TYPE_LINE_GRAPH, CalfLineGraphClass))
39 #define CALF_IS_LINE_GRAPH_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALF_TYPE_LINE_GRAPH))
40 #define CALF_LINE_GRAPH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALF_TYPE_LINE_GRAPH, CalfLineGraphClass))
59 double default_value_x
;
60 double default_value_y
;
61 double default_value_z
;
70 inline bool is_active() { return (param_active_no
< 0 || active
); }
73 #define FREQ_HANDLES 32
74 #define HANDLE_WIDTH 20.0
78 static const int debug
= 0; // 0 - 3
80 GtkDrawingArea parent
;
81 const calf_plugins::line_graph_iface
*source
;
85 int recreate_surfaces
;
91 static const int pad_x
= 0, pad_y
= 0;
94 int param_zoom
, param_offset
;
96 cairo_surface_t
*background_surface
;
97 cairo_surface_t
*grid_surface
;
98 cairo_surface_t
*cache_surface
;
99 cairo_surface_t
*moving_surface
[2];
100 cairo_surface_t
*handles_surface
;
101 cairo_surface_t
*realtime_surface
;
103 // crosshairs and FreqHandles
104 gdouble mouse_x
, mouse_y
;
106 bool crosshairs_active
;
109 bool use_freqhandles_buttons
;
110 bool enforce_handle_order
;
111 float min_handle_distance
;
115 FreqHandle freq_handles
[FREQ_HANDLES
];
116 /// Cached hand (drag) cursor
117 GdkCursor
*hand_cursor
;
118 /// Cached arrow (drag) cursor
119 GdkCursor
*arrow_cursor
;
122 struct CalfLineGraphClass
124 GtkDrawingAreaClass parent_class
;
127 extern GtkWidget
*calf_line_graph_new();
129 extern GType
calf_line_graph_get_type();
131 extern void calf_line_graph_set_square(CalfLineGraph
*graph
, bool is_square
);
133 extern void calf_line_graph_expose_request (GtkWidget
*widget
, bool force
= false);