modify clr btn 16 plugins, add regdmp for sigtraps, rework mask_engine, mask rotate...
[goodguy/cinelerra.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 "cwindowtool.inc"
28 #include "guicast.h"
29 #include "keyframe.inc"
30 #include "maskauto.inc"
31 #include "maskautos.inc"
32 #include "mwindow.inc"
33
34
35 // This common thread supports all the tool GUI's.
36 class CWindowTool : public Thread
37 {
38 public:
39         CWindowTool(MWindow *mwindow, CWindowGUI *gui);
40         ~CWindowTool();
41
42 // Called depending on state of toggle button
43         void start_tool(int operation);
44         void stop_tool();
45
46 // Called when window is visible
47         void show_tool();
48         void hide_tool();
49
50         void run();
51         void update_show_window();
52         void raise_window();
53         void update_values();
54
55         MWindow *mwindow;
56         CWindowGUI *gui;
57         CWindowToolGUI *tool_gui;
58         int done;
59         int current_tool;
60         Condition *input_lock;
61         Condition *output_lock;
62 // Lock run and update_values
63         Mutex *tool_gui_lock;
64 };
65
66 class CWindowToolGUI : public BC_Window
67 {
68 public:
69         CWindowToolGUI(MWindow *mwindow,
70                 CWindowTool *thread,
71                 const char *title,
72                 int w,
73                 int h);
74         ~CWindowToolGUI();
75
76         virtual void create_objects() {};
77 // Update the keyframe from text boxes
78         virtual void handle_event() {};
79 // Update text boxes from keyframe here
80         virtual void update() {};
81 // Update EDL and preview only
82         virtual void update_preview() {};
83         int current_operation;
84         int close_event();
85         int keypress_event();
86         int translation_event();
87
88         MWindow *mwindow;
89         CWindowTool *thread;
90         CWindowCoord *event_caller;
91 };
92
93 class CWindowCoord : public BC_TumbleTextBox
94 {
95 public:
96         CWindowCoord(CWindowToolGUI *gui, int x, int y, float value, int logincrement);
97         CWindowCoord(CWindowToolGUI *gui, int x, int y, int value);
98
99 // Calls the window's handle_event
100         int handle_event();
101
102         CWindowToolGUI *gui;
103 };
104
105 class CWindowCropOK : public BC_GenericButton
106 {
107 public:
108         CWindowCropOK(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
109 // Perform the cropping operation
110         int handle_event();
111         int keypress_event();
112         MWindow *mwindow;
113         CWindowToolGUI *gui;
114 };
115
116 class CWindowCropGUI : public CWindowToolGUI
117 {
118 public:
119         CWindowCropGUI(MWindow *mwindow, CWindowTool *thread);
120         ~CWindowCropGUI();
121         void create_objects();
122         void update();
123 // Update the gui
124         void handle_event();
125         CWindowCoord *x1, *y1, *width, *height;
126 };
127
128 class CWindowMaskItems : public ArrayList<BC_ListBoxItem*>
129 {
130 public:
131         CWindowMaskItems() {}
132         ~CWindowMaskItems() { remove_all_objects(); }
133 };
134
135 class CWindowMaskName : public BC_PopupTextBox
136 {
137 public:
138         CWindowMaskName(MWindow *mwindow, CWindowToolGUI *gui, int x, int y, const char *text);
139         ~CWindowMaskName();
140         MWindow *mwindow;
141         CWindowToolGUI *gui;
142         CWindowMaskItems mask_items;
143
144         int handle_event();
145         void update_items(MaskAuto *keyframe);
146 };
147
148 class CWindowMaskFade : public BC_TumbleTextBox
149 {
150 public:
151         CWindowMaskFade(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
152         ~CWindowMaskFade();
153         int update(float v);
154         int update_value(float v);
155         int handle_event();
156         MWindow *mwindow;
157         CWindowToolGUI *gui;
158 };
159
160 class CWindowMaskFadeSlider : public BC_ISlider
161 {
162 public:
163         CWindowMaskFadeSlider(MWindow *mwindow, CWindowToolGUI *gui,
164                 int x, int y, int w);
165         ~CWindowMaskFadeSlider();
166         int handle_event();
167         int update(int64_t v);
168         char *get_caption() { return 0; }
169         MWindow *mwindow;
170         CWindowToolGUI *gui;
171 };
172
173 class CWindowMaskMode : public BC_Toggle
174 {
175 public:
176         CWindowMaskMode(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
177         ~CWindowMaskMode();
178         int handle_event();
179         MWindow *mwindow;
180         CWindowToolGUI *gui;
181 };
182
183 class CWindowMaskDelMask : public BC_GenericButton
184 {
185 public:
186         CWindowMaskDelMask(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
187         int handle_event();
188         MWindow *mwindow;
189         CWindowToolGUI *gui;
190 };
191
192 class CWindowMaskAffectedPoint : public BC_TumbleTextBox
193 {
194 public:
195         CWindowMaskAffectedPoint(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
196         ~CWindowMaskAffectedPoint();
197         int handle_event();
198         MWindow *mwindow;
199         CWindowToolGUI *gui;
200 };
201
202 class CWindowMaskDelPoint : public BC_GenericButton
203 {
204 public:
205         CWindowMaskDelPoint(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
206         int handle_event();
207         int keypress_event();
208         MWindow *mwindow;
209         CWindowToolGUI *gui;
210 };
211
212 class CWindowMaskFeather : public BC_TumbleTextBox
213 {
214 public:
215         CWindowMaskFeather(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
216         ~CWindowMaskFeather();
217         int update(float v);
218         int update_value(float v);
219         int handle_event();
220         MWindow *mwindow;
221         CWindowToolGUI *gui;
222 };
223
224 class CWindowMaskFeatherSlider : public BC_FSlider
225 {
226 public:
227         CWindowMaskFeatherSlider(MWindow *mwindow, CWindowToolGUI *gui,
228                 int x, int y, int w, float v);
229         ~CWindowMaskFeatherSlider();
230         int handle_event();
231         int update(float v);
232         char *get_caption() { return 0; }
233         MWindow *mwindow;
234         CWindowToolGUI *gui;
235 };
236
237 class CWindowMaskClrMask : public BC_Button
238 {
239 public:
240         CWindowMaskClrMask(MWindow *mwindow, CWindowMaskGUI *gui, int x, int y);
241         ~CWindowMaskClrMask();
242         static int calculate_w(MWindow *mwindow);
243         int handle_event();
244         MWindow *mwindow;
245         CWindowMaskGUI *gui;
246 };
247
248 class CWindowMaskClrPoint : public BC_Button
249 {
250 public:
251         CWindowMaskClrPoint(MWindow *mwindow, CWindowMaskGUI *gui, int x, int y);
252         ~CWindowMaskClrPoint();
253
254         int handle_event();
255         MWindow *mwindow;
256         CWindowMaskGUI *gui;
257 };
258
259 class CWindowMaskBeforePlugins : public BC_CheckBox
260 {
261 public:
262         CWindowMaskBeforePlugins(CWindowToolGUI *gui, int x, int y);
263         int handle_event();
264         CWindowToolGUI *gui;
265 };
266
267 class CWindowDisableOpenGLMasking : public BC_CheckBox
268 {
269 public:
270         CWindowDisableOpenGLMasking(CWindowToolGUI *gui, int x, int y);
271         int handle_event();
272         CWindowToolGUI *gui;
273 };
274
275 class CWindowMaskGUI : public CWindowToolGUI
276 {
277 public:
278         CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread);
279         ~CWindowMaskGUI();
280         void create_objects();
281         void update();
282         void handle_event();
283         void get_keyframe(Track* &track, MaskAutos* &autos, MaskAuto* &keyframe,
284                 SubMask* &mask, MaskPoint* &point, int create_it);
285         void update_preview();
286
287         CWindowMaskName *name;
288         CWindowMaskClrMask *clr_mask;
289         CWindowMaskDelMask *del_mask;
290         CWindowMaskFade *fade;
291         CWindowMaskFadeSlider *fade_slider;
292         CWindowMaskMode *mode;
293         CWindowMaskAffectedPoint *active_point;
294         CWindowMaskClrPoint *clr_point;
295         CWindowMaskDelPoint *del_point;
296         CWindowCoord *x, *y;
297         CWindowMaskFeather *feather;
298         CWindowMaskFeatherSlider *feather_slider;
299         CWindowMaskBeforePlugins *apply_before_plugins;
300         CWindowDisableOpenGLMasking *disable_opengl_masking;
301 };
302
303
304 class CWindowEyedropGUI : public CWindowToolGUI
305 {
306 public:
307         CWindowEyedropGUI(MWindow *mwindow, CWindowTool *thread);
308         ~CWindowEyedropGUI();
309
310         void handle_event();
311         void create_objects();
312         void update();
313
314         BC_Title *current;
315         CWindowCoord *radius;
316         CWindowEyedropCheckBox *use_max;
317         BC_Title *red, *green, *blue, *y, *u, *v;
318         BC_Title *rgb_hex, *yuv_hex;
319         BC_SubWindow *sample;
320 };
321
322
323 class CWindowEyedropCheckBox : public BC_CheckBox
324 {
325 public:
326         CWindowEyedropCheckBox(MWindow *mwindow, 
327                 CWindowEyedropGUI *gui,
328                 int x, 
329                 int y);
330
331         int handle_event();
332         MWindow *mwindow;
333         CWindowEyedropGUI *gui;
334 };
335
336
337
338 class CWindowCameraGUI : public CWindowToolGUI
339 {
340 public:
341         CWindowCameraGUI(MWindow *mwindow, CWindowTool *thread);
342         ~CWindowCameraGUI();
343         void create_objects();
344         void update();
345         void update_preview();
346
347 // Update the keyframe from text boxes
348         void handle_event();
349 //      BezierAuto* get_keyframe();
350         CWindowCoord *x, *y, *z;
351 private:
352 // Toggles for keyframe curve mode (for camera automation only)
353         CWindowCurveToggle *t_smooth, *t_linear;
354 };
355
356 class CWindowCameraLeft : public BC_Button
357 {
358 public:
359         CWindowCameraLeft(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
360         int handle_event();
361         MWindow *mwindow;
362         CWindowCameraGUI *gui;
363 };
364
365 class CWindowCameraCenter : public BC_Button
366 {
367 public:
368         CWindowCameraCenter(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
369         int handle_event();
370         MWindow *mwindow;
371         CWindowCameraGUI *gui;
372 };
373
374 class CWindowCameraRight : public BC_Button
375 {
376 public:
377         CWindowCameraRight(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
378         int handle_event();
379         MWindow *mwindow;
380         CWindowCameraGUI *gui;
381 };
382
383 class CWindowCameraTop : public BC_Button
384 {
385 public:
386         CWindowCameraTop(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
387         int handle_event();
388         MWindow *mwindow;
389         CWindowCameraGUI *gui;
390 };
391
392 class CWindowCameraMiddle : public BC_Button
393 {
394 public:
395         CWindowCameraMiddle(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
396         int handle_event();
397         MWindow *mwindow;
398         CWindowCameraGUI *gui;
399 };
400
401 class CWindowCameraBottom : public BC_Button
402 {
403 public:
404         CWindowCameraBottom(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
405         int handle_event();
406         MWindow *mwindow;
407         CWindowCameraGUI *gui;
408 };
409
410 class CWindowProjectorGUI : public CWindowToolGUI
411 {
412 public:
413         CWindowProjectorGUI(MWindow *mwindow, CWindowTool *thread);
414         ~CWindowProjectorGUI();
415         void create_objects();
416         void update();
417         void update_preview();
418         void handle_event();
419 //      BezierAuto* get_keyframe();
420         CWindowCoord *x, *y, *z;
421 private:
422 // Toggles for keyframe curve mode (projector automation only)
423         CWindowCurveToggle *t_smooth, *t_linear;
424 };
425
426 class CWindowProjectorLeft : public BC_Button
427 {
428 public:
429         CWindowProjectorLeft(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
430         int handle_event();
431         MWindow *mwindow;
432         CWindowProjectorGUI *gui;
433 };
434
435 class CWindowProjectorCenter : public BC_Button
436 {
437 public:
438         CWindowProjectorCenter(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
439         int handle_event();
440         MWindow *mwindow;
441         CWindowProjectorGUI *gui;
442 };
443
444 class CWindowProjectorRight : public BC_Button
445 {
446 public:
447         CWindowProjectorRight(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
448         int handle_event();
449         MWindow *mwindow;
450         CWindowProjectorGUI *gui;
451 };
452
453 class CWindowProjectorTop : public BC_Button
454 {
455 public:
456         CWindowProjectorTop(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
457         int handle_event();
458         MWindow *mwindow;
459         CWindowProjectorGUI *gui;
460 };
461
462 class CWindowProjectorMiddle : public BC_Button
463 {
464 public:
465         CWindowProjectorMiddle(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
466         int handle_event();
467         MWindow *mwindow;
468         CWindowProjectorGUI *gui;
469 };
470
471 class CWindowProjectorBottom : public BC_Button
472 {
473 public:
474         CWindowProjectorBottom(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
475         int handle_event();
476         MWindow *mwindow;
477         CWindowProjectorGUI *gui;
478 };
479
480
481
482
483 class CWindowRulerGUI : public CWindowToolGUI
484 {
485 public:
486         CWindowRulerGUI(MWindow *mwindow, CWindowTool *thread);
487         ~CWindowRulerGUI();
488         void create_objects();
489         void update();
490 // Update the gui
491         void handle_event();
492
493         BC_TextBox *current;
494         BC_TextBox *point1;
495         BC_TextBox *point2;
496         BC_TextBox *deltas;
497         BC_TextBox *distance;
498         BC_TextBox *angle;
499 };
500
501
502
503 #endif