remove whitespace at eol
[goodguy/history.git] / cinelerra-5.1 / plugins / timefront / timefront.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef TIMEFRONT_H
23 #define TIMEFRONT_H
24
25 class TimeFrontMain;
26 class TimeFrontEngine;
27 class TimeFrontThread;
28 class TimeFrontWindow;
29 class TimeFrontServer;
30
31
32 #include "bchash.inc"
33 #include "filexml.inc"
34 #include "guicast.h"
35 #include "loadbalance.h"
36 #include "overlayframe.inc"
37 #include "cicolors.h"
38 #include "pluginvclient.h"
39 #include "thread.h"
40 #include "vframe.inc"
41
42 class TimeFrontConfig
43 {
44 public:
45         TimeFrontConfig();
46
47         int equivalent(TimeFrontConfig &that);
48         void copy_from(TimeFrontConfig &that);
49         void interpolate(TimeFrontConfig &prev,
50                 TimeFrontConfig &next,
51                 long prev_frame,
52                 long next_frame,
53                 long current_frame);
54 // Int to hex triplet conversion
55         int get_in_color();
56         int get_out_color();
57
58 // LINEAR or RADIAL
59         int shape;
60 // LINEAR or LOG or SQUARE
61         int rate;
62         enum
63         {
64                 LINEAR,
65                 RADIAL,
66                 LOG,
67                 SQUARE,
68                 OTHERTRACK,
69                 ALPHA
70         };
71
72
73         double center_x;
74         double center_y;
75         double angle;
76         double in_radius;
77         double out_radius;
78         int frame_range;
79         int track_usage;
80         enum
81         {
82                 OTHERTRACK_INTENSITY,
83                 OTHERTRACK_ALPHA,
84         };
85         int invert;
86         int show_grayscale;
87 };
88
89
90 class TimeFrontShape : public BC_PopupMenu
91 {
92 public:
93         TimeFrontShape(TimeFrontMain *plugin,
94                 TimeFrontWindow *gui,
95                 int x,
96                 int y);
97         void create_objects();
98         static char* to_text(int shape);
99         static int from_text(char *text);
100         int handle_event();
101         TimeFrontMain *plugin;
102         TimeFrontWindow *gui;
103 };
104
105 class TimeFrontTrackUsage : public BC_PopupMenu
106 {
107 public:
108         TimeFrontTrackUsage(TimeFrontMain *plugin,
109                 TimeFrontWindow *gui,
110                 int x,
111                 int y);
112         void create_objects();
113         static char* to_text(int track_usage);
114         static int from_text(char *text);
115         int handle_event();
116         TimeFrontMain *plugin;
117         TimeFrontWindow *gui;
118 };
119
120
121 class TimeFrontRate : public BC_PopupMenu
122 {
123 public:
124         TimeFrontRate(TimeFrontMain *plugin,
125                 int x,
126                 int y);
127         void create_objects();
128         static char* to_text(int shape);
129         static int from_text(char *text);
130         int handle_event();
131         TimeFrontMain *plugin;
132         TimeFrontWindow *gui;
133 };
134
135 class TimeFrontCenterX : public BC_FPot
136 {
137 public:
138         TimeFrontCenterX(TimeFrontMain *plugin, int x, int y);
139         int handle_event();
140         TimeFrontMain *plugin;
141 };
142
143 class TimeFrontCenterY : public BC_FPot
144 {
145 public:
146         TimeFrontCenterY(TimeFrontMain *plugin, int x, int y);
147         int handle_event();
148         TimeFrontMain *plugin;
149 };
150
151 class TimeFrontAngle : public BC_FPot
152 {
153 public:
154         TimeFrontAngle(TimeFrontMain *plugin, int x, int y);
155         int handle_event();
156         TimeFrontMain *plugin;
157 };
158
159 class TimeFrontInRadius : public BC_FSlider
160 {
161 public:
162         TimeFrontInRadius(TimeFrontMain *plugin, int x, int y);
163         int handle_event();
164         TimeFrontMain *plugin;
165 };
166
167 class TimeFrontOutRadius : public BC_FSlider
168 {
169 public:
170         TimeFrontOutRadius(TimeFrontMain *plugin, int x, int y);
171         int handle_event();
172         TimeFrontMain *plugin;
173 };
174
175 class TimeFrontFrameRange : public BC_ISlider
176 {
177 public:
178         TimeFrontFrameRange(TimeFrontMain *plugin, int x, int y);
179         int handle_event();
180         TimeFrontMain *plugin;
181 };
182
183
184 class TimeFrontInvert : public BC_CheckBox
185 {
186 public:
187         TimeFrontInvert(TimeFrontMain *plugin, int x, int y);
188         int handle_event();
189         TimeFrontMain *plugin;
190 };
191
192 class TimeFrontShowGrayscale : public BC_CheckBox
193 {
194 public:
195         TimeFrontShowGrayscale(TimeFrontMain *plugin, int x, int y);
196         int handle_event();
197         TimeFrontMain *plugin;
198 };
199
200
201 class TimeFrontWindow : public PluginClientWindow
202 {
203 public:
204         TimeFrontWindow(TimeFrontMain *plugin);
205         ~TimeFrontWindow();
206
207         void create_objects();
208         void update_shape();
209
210         TimeFrontMain *plugin;
211         BC_Title *angle_title;
212         BC_Title *rate_title, *in_radius_title, *out_radius_title, *track_usage_title;
213         TimeFrontAngle *angle;
214         TimeFrontInRadius *in_radius;
215         TimeFrontOutRadius *out_radius;
216         TimeFrontFrameRange *frame_range;
217         TimeFrontShape *shape;
218         TimeFrontTrackUsage *track_usage;
219         BC_Title *shape_title;
220         TimeFrontCenterX *center_x;
221         BC_Title *center_x_title;
222         BC_Title *center_y_title;
223         TimeFrontCenterY *center_y;
224         TimeFrontRate *rate;
225         TimeFrontShowGrayscale *show_grayscale;
226         TimeFrontInvert *invert;
227         int frame_range_x, frame_range_y;
228         int shape_x, shape_y;
229 };
230
231
232
233
234
235
236 class TimeFrontMain : public PluginVClient
237 {
238 public:
239         TimeFrontMain(PluginServer *server);
240         ~TimeFrontMain();
241
242         int process_buffer(VFrame **frame,
243                 int64_t start_position,
244                 double frame_rate);
245
246         int is_realtime();
247         int is_multichannel();
248         void save_data(KeyFrame *keyframe);
249         void read_data(KeyFrame *keyframe);
250         void update_gui();
251         int is_synthesis();
252
253         PLUGIN_CLASS_MEMBERS(TimeFrontConfig)
254
255         int need_reconfigure;
256
257         OverlayFrame *overlayer;
258         VFrame *gradient;
259         VFrame *input, *output;
260         TimeFrontServer *engine;
261 };
262
263 class TimeFrontPackage : public LoadPackage
264 {
265 public:
266         TimeFrontPackage();
267         int y1;
268         int y2;
269 };
270
271 class TimeFrontUnit : public LoadClient
272 {
273 public:
274         TimeFrontUnit(TimeFrontServer *server, TimeFrontMain *plugin);
275         void process_package(LoadPackage *package);
276         TimeFrontServer *server;
277         TimeFrontMain *plugin;
278         YUV yuv;
279 };
280
281 class TimeFrontServer : public LoadServer
282 {
283 public:
284         TimeFrontServer(TimeFrontMain *plugin, int total_clients, int total_packages);
285         void init_packages();
286         LoadClient* new_client();
287         LoadPackage* new_package();
288         TimeFrontMain *plugin;
289 };
290
291
292
293 #endif