fast drag mode honours follow_edits labels/plugins/keyframes
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / scopewindow.h
1 /*
2  * CINELERRA
3  * Copyright (C) 1997-2011 Adam Williams <broadcast at earthling dot net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program 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
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  */
20
21 #ifndef SCOPEWINDOW_H
22 #define SCOPEWINDOW_H
23
24
25 #include "guicast.h"
26 #include "loadbalance.h"
27 #include "mwindow.h"
28 #include "pluginclient.h"
29 #include "recordmonitor.inc"
30 #include "scopewindow.inc"
31 #include "theme.inc"
32
33
34 // Number of divisions in histogram.
35 // 65536 + min and max range to speed up the tabulation
36 #define TOTAL_BINS 0x13333
37 #define HIST_SECTIONS 4
38 #define FLOAT_RANGE 1.2
39 // Minimum value in percentage
40 #define HISTOGRAM_MIN -10
41 #define FLOAT_MIN -0.1
42 // Maximum value in percentage
43 #define HISTOGRAM_MAX 110
44 #define FLOAT_MAX 1.1
45
46 #define MIN_SCOPE_W 320
47 #define MIN_SCOPE_H 320
48
49
50
51 #define WAVEFORM_DIVISIONS 12
52 #define VECTORSCOPE_DIVISIONS 11
53
54 class ScopePackage : public LoadPackage
55 {
56 public:
57         ScopePackage();
58         int row1, row2;
59 };
60
61
62 class ScopeUnit : public LoadClient
63 {
64 public:
65         ScopeUnit(ScopeGUI *gui, ScopeEngine *server);
66         void draw_point(unsigned char **rows,
67                 int x,
68                 int y,
69                 int r,
70                 int g,
71                 int b);
72         void process_package(LoadPackage *package);
73         int bins[HIST_SECTIONS][TOTAL_BINS];
74         ScopeGUI *gui;
75 };
76
77 class ScopeEngine : public LoadServer
78 {
79 public:
80         ScopeEngine(ScopeGUI *gui, int cpus);
81         virtual ~ScopeEngine();
82         void init_packages();
83         LoadClient* new_client();
84         LoadPackage* new_package();
85         void process();
86         ScopeGUI *gui;
87 };
88
89 class ScopePanel : public BC_SubWindow
90 {
91 public:
92         ScopePanel(ScopeGUI *gui,
93                 int x,
94                 int y,
95                 int w,
96                 int h);
97         void create_objects();
98         virtual void update_point(int x, int y);
99         virtual void draw_point();
100         virtual void clear_point();
101         int button_press_event();
102         int cursor_motion_event();
103         int button_release_event();
104         int is_dragging;
105         ScopeGUI *gui;
106 };
107
108 class ScopeWaveform : public ScopePanel
109 {
110 public:
111         ScopeWaveform(ScopeGUI *gui,
112                 int x,
113                 int y,
114                 int w,
115                 int h);
116         virtual void update_point(int x, int y);
117         virtual void draw_point();
118         virtual void clear_point();
119         int drag_x;
120         int drag_y;
121 };
122
123
124 class ScopeVectorscope : public ScopePanel
125 {
126 public:
127         ScopeVectorscope(ScopeGUI *gui,
128                 int x,
129                 int y,
130                 int w,
131                 int h);
132         virtual void update_point(int x, int y);
133         virtual void draw_point();
134         virtual void clear_point();
135         int drag_radius;
136         float drag_angle;
137 };
138
139 class ScopeHistogram : public ScopePanel
140 {
141 public:
142         ScopeHistogram(ScopeGUI *gui,
143                 int x,
144                 int y,
145                 int w,
146                 int h);
147         void clear_point();
148         void update_point(int x, int y);
149         void draw_point();
150         void draw(int flash, int flush);
151         void draw_mode(int mode, int color, int y, int h);
152         int drag_x;
153 };
154
155 class ScopeToggle : public BC_Toggle
156 {
157 public:
158         ScopeToggle(ScopeGUI *gui,
159                 int x,
160                 int y,
161                 int *value);
162         static VFrame** get_image_set(ScopeGUI *gui, int *value);
163         int handle_event();
164         ScopeGUI *gui;
165         int *value;
166 };
167
168
169 class ScopeGUI : public PluginClientWindow
170 {
171 public:
172         ScopeGUI(Theme *theme,
173                 int x,
174                 int y,
175                 int w,
176                 int h,
177                 int cpus);
178         ScopeGUI(PluginClient *plugin,
179                 int w,
180                 int h);
181         virtual ~ScopeGUI();
182
183         void reset();
184         virtual void create_objects();
185         void create_panels();
186         virtual int resize_event(int w, int h);
187         virtual int translation_event();
188
189 // Called for user storage when toggles change
190         virtual void toggle_event();
191
192 // update toggles
193         void update_toggles();
194         void calculate_sizes(int w, int h);
195         void allocate_bitmaps();
196         void draw_overlays(int overlays, int borders, int flush);
197         void process(VFrame *output_frame);
198         void draw(int flash, int flush);
199         void clear_points(int flash);
200
201
202         Theme *theme;
203         VFrame *output_frame;
204         ScopeEngine *engine;
205         BC_Bitmap *waveform_bitmap;
206         BC_Bitmap *vector_bitmap;
207         ScopeHistogram *histogram;
208         ScopeWaveform *waveform;
209         ScopeVectorscope *vectorscope;
210         ScopeToggle *hist_parade_on;
211         ScopeToggle *hist_on;
212         ScopeToggle *waveform_parade_on;
213         ScopeToggle *waveform_on;
214         ScopeToggle *vector_on;
215         BC_Title *value_text;
216
217         int x, y, w, h;
218         int vector_x, vector_y, vector_w, vector_h;
219         int wave_x, wave_y, wave_w, wave_h;
220         int hist_x, hist_y, hist_w, hist_h;
221
222         int cpus;
223         int use_hist, use_wave, use_vector;
224         int use_hist_parade, use_wave_parade;
225
226         int bins[HIST_SECTIONS][TOTAL_BINS];
227         int frame_w;
228 };
229
230
231
232
233 #endif
234
235
236