rework scopewindow, spanish xlat updates
[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 enum {
34         SCOPE_HISTOGRAM, SCOPE_HISTOGRAM_RGB,
35         SCOPE_WAVEFORM, SCOPE_WAVEFORM_RGB, SCOPE_WAVEFORM_PLY,
36         SCOPE_VECTORSCOPE,
37 };
38
39 // Number of divisions in histogram.
40 // 65536 + min and max range to speed up the tabulation
41 #define TOTAL_BINS 0x13333
42 #define HIST_SECTIONS 4
43 #define FLOAT_RANGE 1.2
44 // Minimum value in percentage
45 #define HISTOGRAM_MIN -10
46 #define FLOAT_MIN -0.1
47 // Maximum value in percentage
48 #define HISTOGRAM_MAX 110
49 #define FLOAT_MAX 1.1
50
51 #define MIN_SCOPE_W xS(640)
52 #define MIN_SCOPE_H yS(320)
53
54
55 #define WAVEFORM_DIVISIONS 12
56 #define VECTORSCOPE_DIVISIONS 11
57
58 class ScopePackage : public LoadPackage
59 {
60 public:
61         ScopePackage();
62         int row1, row2;
63 };
64
65
66 class ScopeUnit : public LoadClient
67 {
68 public:
69         ScopeUnit(ScopeGUI *gui, ScopeEngine *server);
70         void process_package(LoadPackage *package);
71         int bins[HIST_SECTIONS][TOTAL_BINS];
72         ScopeGUI *gui;
73 };
74
75 class ScopeEngine : public LoadServer
76 {
77 public:
78         ScopeEngine(ScopeGUI *gui, int cpus);
79         virtual ~ScopeEngine();
80         void init_packages();
81         LoadClient* new_client();
82         LoadPackage* new_package();
83         void process();
84         ScopeGUI *gui;
85 };
86
87 class ScopePanel : public BC_SubWindow
88 {
89 public:
90         ScopePanel(ScopeGUI *gui, int x, int y, int w, int h);
91         void create_objects();
92         virtual void update_point(int x, int y);
93         virtual void draw_point();
94         virtual void clear_point();
95         int button_press_event();
96         int cursor_motion_event();
97         int button_release_event();
98         int is_dragging;
99         ScopeGUI *gui;
100 };
101
102 class ScopeWaveform : public ScopePanel
103 {
104 public:
105         ScopeWaveform(ScopeGUI *gui, int x, int y, int w, int h);
106         virtual void update_point(int x, int y);
107         virtual void draw_point();
108         virtual void clear_point();
109         int drag_x;
110         int drag_y;
111 };
112
113
114 class ScopeVectorscope : public ScopePanel
115 {
116 public:
117         ScopeVectorscope(ScopeGUI *gui, int x, int y, int w, int h);
118         virtual void update_point(int x, int y);
119         virtual void draw_point();
120         virtual void clear_point();
121         int drag_radius;
122         float drag_angle;
123 };
124
125 class ScopeHistogram : public ScopePanel
126 {
127 public:
128         ScopeHistogram(ScopeGUI *gui, int x, int y, int w, int h);
129         void clear_point();
130         void update_point(int x, int y);
131         void draw_point();
132         void draw(int flash, int flush);
133         void draw_mode(int mode, int color, int y, int h);
134         int drag_x;
135 };
136
137
138 class ScopeScopesOn : public BC_MenuItem
139 {
140 public:
141         ScopeScopesOn(ScopeMenu *scope_menu, const char *text, int id);
142         int handle_event();
143
144         ScopeMenu *scope_menu;
145         int id;
146 };
147
148 class ScopeMenu : public BC_PopupMenu
149 {
150 public:
151         ScopeMenu(ScopeGUI *gui, int x, int y);
152         void create_objects();
153         void update_toggles();
154
155         ScopeGUI *gui;
156         ScopeScopesOn *hist_on;
157         ScopeScopesOn *hist_rgb_on;
158         ScopeScopesOn *wave_on;
159         ScopeScopesOn *wave_rgb_on;
160         ScopeScopesOn *wave_ply_on;
161         ScopeScopesOn *vect_on;
162 };
163
164 class ScopeWaveDial : public BC_FPot
165 {
166 public:
167         ScopeWaveDial(ScopeGUI *gui, int x, int y);
168         int handle_event();
169         ScopeGUI *gui;
170 };
171
172 class ScopeVectDial : public BC_FPot
173 {
174 public:
175         ScopeVectDial(ScopeGUI *gui, int x, int y);
176         int handle_event();
177         ScopeGUI *gui;
178 };
179
180 class ScopeGUI : public PluginClientWindow
181 {
182 public:
183         ScopeGUI(Theme *theme, int x, int y, int w, int h, int cpus);
184         ScopeGUI(PluginClient *plugin, int w, int h);
185         virtual ~ScopeGUI();
186
187         void reset();
188         virtual void create_objects();
189         void create_panels();
190         virtual int resize_event(int w, int h);
191         virtual int translation_event();
192         virtual void update_scope() {}
193
194 // Called for user storage when toggles change
195         virtual void toggle_event();
196
197 // update toggles
198         void update_toggles();
199         void calculate_sizes(int w, int h);
200         void allocate_vframes();
201         void draw_overlays(int overlays, int borders, int flush);
202         void process(VFrame *output_frame);
203         void draw(int flash, int flush);
204         void clear_points(int flash);
205
206         Theme *theme;
207         VFrame *output_frame;
208         ScopeEngine *engine;
209         VFrame *waveform_vframe;
210         VFrame *vector_vframe;
211         ScopeHistogram *histogram;
212         ScopeWaveform *waveform;
213         ScopeVectorscope *vectorscope;
214         ScopeMenu *scope_menu;
215         ScopeWaveDial *wave_dial;
216         ScopeVectDial *vect_dial;
217         BC_Title *value_text;
218
219         int x, y, w, h;
220         int vector_x, vector_y, vector_w, vector_h;
221         int wave_x, wave_y, wave_w, wave_h;
222         int hist_x, hist_y, hist_w, hist_h;
223         float wdial, vdial;
224
225         int cpus;
226         int use_hist, use_wave, use_vector;
227         int use_hist_parade, use_wave_parade;
228
229         int bins[HIST_SECTIONS][TOTAL_BINS];
230         int frame_w;
231 };
232
233 #endif