usb_direct fix for rev2 shuttle, playbackengine locks again, viewer cursor fix
[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 "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
182 class CWindowMaskAffectedPoint : public BC_TumbleTextBox
183 {
184 public:
185         CWindowMaskAffectedPoint(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
186         ~CWindowMaskAffectedPoint();
187         int handle_event();
188         MWindow *mwindow;
189         CWindowToolGUI *gui;
190 };
191
192
193 class CWindowMaskFeather : public BC_TumbleTextBox
194 {
195 public:
196         CWindowMaskFeather(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
197         ~CWindowMaskFeather();
198         int handle_event();
199         MWindow *mwindow;
200         CWindowToolGUI *gui;
201 };
202
203 class CWindowMaskValue : public BC_ISlider
204 {
205 public:
206         CWindowMaskValue(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
207         ~CWindowMaskValue();
208         int handle_event();
209         MWindow *mwindow;
210         CWindowToolGUI *gui;
211 };
212
213 class CWindowMaskBeforePlugins : public BC_CheckBox
214 {
215 public:
216         CWindowMaskBeforePlugins(CWindowToolGUI *gui, int x, int y);
217         int handle_event();
218         CWindowToolGUI *gui;
219 };
220
221 class CWindowDisableOpenGLMasking : public BC_CheckBox
222 {
223 public:
224         CWindowDisableOpenGLMasking(CWindowToolGUI *gui, int x, int y);
225         int handle_event();
226         CWindowToolGUI *gui;
227 };
228
229 class CWindowMaskGUI : public CWindowToolGUI
230 {
231 public:
232         CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread);
233         ~CWindowMaskGUI();
234         void create_objects();
235         void update();
236         void handle_event();
237         void get_keyframe(Track* &track, MaskAutos* &autos, MaskAuto* &keyframe,
238                 SubMask* &mask, MaskPoint* &point, int create_it);
239         void update_preview();
240
241         CWindowCoord *x, *y;
242         CWindowMaskMode *mode;
243         CWindowMaskFeather *feather;
244         CWindowMaskDelete *delete_point;
245         CWindowMaskAffectedPoint *active_point;
246 // Not necessary if all keyframes have same points
247 //      CWindowMaskCycleNext *next_point;
248 //      CWindowMaskCyclePrev *prev_point;
249         CWindowMaskNumber *number;
250         CWindowMaskValue *value;
251         CWindowMaskBeforePlugins *apply_before_plugins;
252         CWindowDisableOpenGLMasking *disable_opengl_masking;
253 };
254
255
256 class CWindowEyedropCheckBox;
257 class CWindowEyedropGUI : public CWindowToolGUI
258 {
259 public:
260         CWindowEyedropGUI(MWindow *mwindow, CWindowTool *thread);
261         ~CWindowEyedropGUI();
262
263         void handle_event();
264         void create_objects();
265         void update();
266
267         BC_Title *current;
268         CWindowCoord *radius;
269         CWindowEyedropCheckBox *use_max;
270         BC_Title *red, *green, *blue, *y, *u, *v;
271         BC_Title *rgb_hex, *yuv_hex;
272         BC_SubWindow *sample;
273 };
274
275
276 class CWindowEyedropCheckBox : public BC_CheckBox
277 {
278 public:
279         CWindowEyedropCheckBox(MWindow *mwindow, 
280                 CWindowEyedropGUI *gui,
281                 int x, 
282                 int y);
283
284         int handle_event();
285         MWindow *mwindow;
286         CWindowEyedropGUI *gui;
287 };
288
289
290
291 class CWindowCameraGUI : public CWindowToolGUI
292 {
293 public:
294         CWindowCameraGUI(MWindow *mwindow, CWindowTool *thread);
295         ~CWindowCameraGUI();
296         void create_objects();
297         void update();
298         void update_preview();
299
300 // Update the keyframe from text boxes
301         void handle_event();
302 //      BezierAuto* get_keyframe();
303         CWindowCoord *x, *y, *z;
304 private:
305 // Toggles for keyframe curve mode (for camera automation only)
306         CWindowCurveToggle *t_smooth, *t_linear;
307 };
308
309 class CWindowCameraLeft : public BC_Button
310 {
311 public:
312         CWindowCameraLeft(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
313         int handle_event();
314         MWindow *mwindow;
315         CWindowCameraGUI *gui;
316 };
317
318 class CWindowCameraCenter : public BC_Button
319 {
320 public:
321         CWindowCameraCenter(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
322         int handle_event();
323         MWindow *mwindow;
324         CWindowCameraGUI *gui;
325 };
326
327 class CWindowCameraRight : public BC_Button
328 {
329 public:
330         CWindowCameraRight(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
331         int handle_event();
332         MWindow *mwindow;
333         CWindowCameraGUI *gui;
334 };
335
336 class CWindowCameraTop : public BC_Button
337 {
338 public:
339         CWindowCameraTop(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
340         int handle_event();
341         MWindow *mwindow;
342         CWindowCameraGUI *gui;
343 };
344
345 class CWindowCameraMiddle : public BC_Button
346 {
347 public:
348         CWindowCameraMiddle(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
349         int handle_event();
350         MWindow *mwindow;
351         CWindowCameraGUI *gui;
352 };
353
354 class CWindowCameraBottom : public BC_Button
355 {
356 public:
357         CWindowCameraBottom(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
358         int handle_event();
359         MWindow *mwindow;
360         CWindowCameraGUI *gui;
361 };
362
363 class CWindowProjectorGUI : public CWindowToolGUI
364 {
365 public:
366         CWindowProjectorGUI(MWindow *mwindow, CWindowTool *thread);
367         ~CWindowProjectorGUI();
368         void create_objects();
369         void update();
370         void update_preview();
371         void handle_event();
372 //      BezierAuto* get_keyframe();
373         CWindowCoord *x, *y, *z;
374 private:
375 // Toggles for keyframe curve mode (projector automation only)
376         CWindowCurveToggle *t_smooth, *t_linear;
377 };
378
379 class CWindowProjectorLeft : public BC_Button
380 {
381 public:
382         CWindowProjectorLeft(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
383         int handle_event();
384         MWindow *mwindow;
385         CWindowProjectorGUI *gui;
386 };
387
388 class CWindowProjectorCenter : public BC_Button
389 {
390 public:
391         CWindowProjectorCenter(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
392         int handle_event();
393         MWindow *mwindow;
394         CWindowProjectorGUI *gui;
395 };
396
397 class CWindowProjectorRight : public BC_Button
398 {
399 public:
400         CWindowProjectorRight(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
401         int handle_event();
402         MWindow *mwindow;
403         CWindowProjectorGUI *gui;
404 };
405
406 class CWindowProjectorTop : public BC_Button
407 {
408 public:
409         CWindowProjectorTop(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
410         int handle_event();
411         MWindow *mwindow;
412         CWindowProjectorGUI *gui;
413 };
414
415 class CWindowProjectorMiddle : public BC_Button
416 {
417 public:
418         CWindowProjectorMiddle(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
419         int handle_event();
420         MWindow *mwindow;
421         CWindowProjectorGUI *gui;
422 };
423
424 class CWindowProjectorBottom : public BC_Button
425 {
426 public:
427         CWindowProjectorBottom(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
428         int handle_event();
429         MWindow *mwindow;
430         CWindowProjectorGUI *gui;
431 };
432
433
434
435
436 class CWindowRulerGUI : public CWindowToolGUI
437 {
438 public:
439         CWindowRulerGUI(MWindow *mwindow, CWindowTool *thread);
440         ~CWindowRulerGUI();
441         void create_objects();
442         void update();
443 // Update the gui
444         void handle_event();
445
446         BC_TextBox *current;
447         BC_TextBox *point1;
448         BC_TextBox *point2;
449         BC_TextBox *deltas;
450         BC_TextBox *distance;
451         BC_TextBox *angle;
452 };
453
454
455
456 #endif