Merge CV, ver=5.1; ops/methods from HV, and interface from CV where possible
[goodguy/history.git] / cinelerra-5.1 / cinelerra / cwindowtool.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 CWINDOWTOOL_H
23 #define CWINDOWTOOL_H
24
25 #include "condition.inc"
26 #include "cwindowgui.inc"
27 #include "guicast.h"
28 #include "maskauto.inc"
29 #include "maskautos.inc"
30 #include "mwindow.inc"
31
32
33 class CWindowToolGUI;
34 class CWindowCoord;
35 class CWindowCurveToggle;
36
37
38 // This common thread supports all the tool GUI's.
39 class CWindowTool : public Thread
40 {
41 public:
42         CWindowTool(MWindow *mwindow, CWindowGUI *gui);
43         ~CWindowTool();
44
45 // Called depending on state of toggle button
46         void start_tool(int operation);
47         void stop_tool();
48
49 // Called when window is visible
50         void show_tool();
51         void hide_tool();
52
53         void run();
54         void update_show_window();
55         void raise_window();
56         void update_values();
57
58         MWindow *mwindow;
59         CWindowGUI *gui;
60         CWindowToolGUI *tool_gui;
61         int done;
62         int current_tool;
63         Condition *input_lock;
64         Condition *output_lock;
65 // Lock run and update_values
66         Mutex *tool_gui_lock;
67 };
68
69 class CWindowToolGUI : public BC_Window
70 {
71 public:
72         CWindowToolGUI(MWindow *mwindow,
73                 CWindowTool *thread,
74                 const char *title,
75                 int w,
76                 int h);
77         ~CWindowToolGUI();
78
79         virtual void create_objects() {};
80 // Update the keyframe from text boxes
81         virtual void handle_event() {};
82 // Update text boxes from keyframe here
83         virtual void update() {};
84 // Update EDL and preview only
85         virtual void update_preview() {};
86         int current_operation;
87         int close_event();
88         int keypress_event();
89         int translation_event();
90
91         MWindow *mwindow;
92         CWindowTool *thread;
93         CWindowCoord *event_caller;
94 };
95
96 class CWindowCoord : public BC_TumbleTextBox
97 {
98 public:
99         CWindowCoord(CWindowToolGUI *gui, int x, int y, float value, int logincrement);
100         CWindowCoord(CWindowToolGUI *gui, int x, int y, int value);
101
102 // Calls the window's handle_event
103         int handle_event();
104
105         CWindowToolGUI *gui;
106 };
107
108 class CWindowCropOK : public BC_GenericButton
109 {
110 public:
111         CWindowCropOK(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
112 // Perform the cropping operation
113         int handle_event();
114         int keypress_event();
115         MWindow *mwindow;
116         CWindowToolGUI *gui;
117 };
118
119 class CWindowCropGUI : public CWindowToolGUI
120 {
121 public:
122         CWindowCropGUI(MWindow *mwindow, CWindowTool *thread);
123         ~CWindowCropGUI();
124         void create_objects();
125         void update();
126 // Update the gui
127         void handle_event();
128         CWindowCoord *x1, *y1, *width, *height;
129 };
130
131 class CWindowMaskMode : public BC_PopupMenu
132 {
133 public:
134         CWindowMaskMode(MWindow *mwindow, CWindowToolGUI *gui, int x, int y, const char *text);
135         void create_objects();
136         int handle_event();
137         static char* mode_to_text(int mode);
138         int text_to_mode(char *text);
139         MWindow *mwindow;
140         CWindowToolGUI *gui;
141 };
142
143 class CWindowMaskDelete : public BC_GenericButton
144 {
145 public:
146         CWindowMaskDelete(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
147         int handle_event();
148         int keypress_event();
149         MWindow *mwindow;
150         CWindowToolGUI *gui;
151 };
152
153 class CWindowMaskCycleNext : public BC_GenericButton
154 {
155 public:
156         CWindowMaskCycleNext(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
157         int handle_event();
158         MWindow *mwindow;
159         CWindowToolGUI *gui;
160 };
161
162 class CWindowMaskCyclePrev : public BC_GenericButton
163 {
164 public:
165         CWindowMaskCyclePrev(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
166         int handle_event();
167         MWindow *mwindow;
168         CWindowToolGUI *gui;
169 };
170
171 class CWindowMaskNumber : public BC_TumbleTextBox
172 {
173 public:
174         CWindowMaskNumber(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
175         ~CWindowMaskNumber();
176         int handle_event();
177         MWindow *mwindow;
178         CWindowToolGUI *gui;
179 };
180
181 class CWindowMaskFeather : public BC_TumbleTextBox
182 {
183 public:
184         CWindowMaskFeather(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
185         ~CWindowMaskFeather();
186         int handle_event();
187         MWindow *mwindow;
188         CWindowToolGUI *gui;
189 };
190
191 class CWindowMaskValue : public BC_ISlider
192 {
193 public:
194         CWindowMaskValue(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
195         ~CWindowMaskValue();
196         int handle_event();
197         MWindow *mwindow;
198         CWindowToolGUI *gui;
199 };
200
201 class CWindowMaskBeforePlugins : public BC_CheckBox
202 {
203 public:
204         CWindowMaskBeforePlugins(CWindowToolGUI *gui, int x, int y);
205         int handle_event();
206         CWindowToolGUI *gui;
207 };
208
209
210
211
212 class CWindowMaskGUI : public CWindowToolGUI
213 {
214 public:
215         CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread);
216         ~CWindowMaskGUI();
217         void create_objects();
218         void update();
219         void handle_event();
220         void get_keyframe(Track* &track, MaskAutos* &autos, MaskAuto* &keyframe,
221                 SubMask* &mask, MaskPoint* &point, int create_it);
222         void update_preview();
223
224         CWindowCoord *x, *y;
225         CWindowMaskMode *mode;
226         CWindowMaskFeather *feather;
227         CWindowMaskDelete *delete_point;
228 // Not necessary if all keyframes have same points
229 //      CWindowMaskCycleNext *next_point;
230 //      CWindowMaskCyclePrev *prev_point;
231         CWindowMaskNumber *number;
232         CWindowMaskValue *value;
233         CWindowMaskBeforePlugins *apply_before_plugins;
234 };
235
236
237
238 class CWindowEyedropGUI : public CWindowToolGUI
239 {
240 public:
241         CWindowEyedropGUI(MWindow *mwindow, CWindowTool *thread);
242         ~CWindowEyedropGUI();
243
244         void handle_event();
245         void create_objects();
246         void update();
247
248         CWindowCoord *radius;
249         BC_Title *red, *green, *blue, *y, *u, *v;
250         BC_SubWindow *sample;
251 };
252
253
254
255 class CWindowCameraGUI : public CWindowToolGUI
256 {
257 public:
258         CWindowCameraGUI(MWindow *mwindow, CWindowTool *thread);
259         ~CWindowCameraGUI();
260         void create_objects();
261         void update();
262         void update_preview();
263
264 // Update the keyframe from text boxes
265         void handle_event();
266 //      BezierAuto* get_keyframe();
267         CWindowCoord *x, *y, *z;
268 private:
269 // Toggles for keyframe curve mode (for camera automation only)
270         CWindowCurveToggle *t_smooth, *t_linear;
271 };
272
273 class CWindowCameraLeft : public BC_Button
274 {
275 public:
276         CWindowCameraLeft(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
277         int handle_event();
278         MWindow *mwindow;
279         CWindowCameraGUI *gui;
280 };
281
282 class CWindowCameraCenter : public BC_Button
283 {
284 public:
285         CWindowCameraCenter(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
286         int handle_event();
287         MWindow *mwindow;
288         CWindowCameraGUI *gui;
289 };
290
291 class CWindowCameraRight : public BC_Button
292 {
293 public:
294         CWindowCameraRight(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
295         int handle_event();
296         MWindow *mwindow;
297         CWindowCameraGUI *gui;
298 };
299
300 class CWindowCameraTop : public BC_Button
301 {
302 public:
303         CWindowCameraTop(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
304         int handle_event();
305         MWindow *mwindow;
306         CWindowCameraGUI *gui;
307 };
308
309 class CWindowCameraMiddle : public BC_Button
310 {
311 public:
312         CWindowCameraMiddle(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
313         int handle_event();
314         MWindow *mwindow;
315         CWindowCameraGUI *gui;
316 };
317
318 class CWindowCameraBottom : public BC_Button
319 {
320 public:
321         CWindowCameraBottom(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
322         int handle_event();
323         MWindow *mwindow;
324         CWindowCameraGUI *gui;
325 };
326
327 class CWindowProjectorGUI : public CWindowToolGUI
328 {
329 public:
330         CWindowProjectorGUI(MWindow *mwindow, CWindowTool *thread);
331         ~CWindowProjectorGUI();
332         void create_objects();
333         void update();
334         void update_preview();
335         void handle_event();
336 //      BezierAuto* get_keyframe();
337         CWindowCoord *x, *y, *z;
338 private:
339 // Toggles for keyframe curve mode (projector automation only)
340         CWindowCurveToggle *t_smooth, *t_linear;
341 };
342
343 class CWindowProjectorLeft : public BC_Button
344 {
345 public:
346         CWindowProjectorLeft(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
347         int handle_event();
348         MWindow *mwindow;
349         CWindowProjectorGUI *gui;
350 };
351
352 class CWindowProjectorCenter : public BC_Button
353 {
354 public:
355         CWindowProjectorCenter(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
356         int handle_event();
357         MWindow *mwindow;
358         CWindowProjectorGUI *gui;
359 };
360
361 class CWindowProjectorRight : public BC_Button
362 {
363 public:
364         CWindowProjectorRight(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
365         int handle_event();
366         MWindow *mwindow;
367         CWindowProjectorGUI *gui;
368 };
369
370 class CWindowProjectorTop : public BC_Button
371 {
372 public:
373         CWindowProjectorTop(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
374         int handle_event();
375         MWindow *mwindow;
376         CWindowProjectorGUI *gui;
377 };
378
379 class CWindowProjectorMiddle : public BC_Button
380 {
381 public:
382         CWindowProjectorMiddle(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
383         int handle_event();
384         MWindow *mwindow;
385         CWindowProjectorGUI *gui;
386 };
387
388 class CWindowProjectorBottom : public BC_Button
389 {
390 public:
391         CWindowProjectorBottom(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
392         int handle_event();
393         MWindow *mwindow;
394         CWindowProjectorGUI *gui;
395 };
396
397
398
399
400 class CWindowRulerGUI : public CWindowToolGUI
401 {
402 public:
403         CWindowRulerGUI(MWindow *mwindow, CWindowTool *thread);
404         ~CWindowRulerGUI();
405         void create_objects();
406         void update();
407 // Update the gui
408         void handle_event();
409
410         BC_Title *current;
411         BC_Title *point1;
412         BC_Title *point2;
413         BC_Title *distance;
414         BC_Title *angle;
415 };
416
417
418
419 #endif