rework edge plugin, add crikey plugin, text tumbler tweak, eyedropper coords
[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
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
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         BC_Title *red, *green, *blue, *y, *u, *v;
270         BC_SubWindow *sample;
271 };
272
273
274
275 class CWindowCameraGUI : public CWindowToolGUI
276 {
277 public:
278         CWindowCameraGUI(MWindow *mwindow, CWindowTool *thread);
279         ~CWindowCameraGUI();
280         void create_objects();
281         void update();
282         void update_preview();
283
284 // Update the keyframe from text boxes
285         void handle_event();
286 //      BezierAuto* get_keyframe();
287         CWindowCoord *x, *y, *z;
288 private:
289 // Toggles for keyframe curve mode (for camera automation only)
290         CWindowCurveToggle *t_smooth, *t_linear;
291 };
292
293 class CWindowCameraLeft : public BC_Button
294 {
295 public:
296         CWindowCameraLeft(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
297         int handle_event();
298         MWindow *mwindow;
299         CWindowCameraGUI *gui;
300 };
301
302 class CWindowCameraCenter : public BC_Button
303 {
304 public:
305         CWindowCameraCenter(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
306         int handle_event();
307         MWindow *mwindow;
308         CWindowCameraGUI *gui;
309 };
310
311 class CWindowCameraRight : public BC_Button
312 {
313 public:
314         CWindowCameraRight(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
315         int handle_event();
316         MWindow *mwindow;
317         CWindowCameraGUI *gui;
318 };
319
320 class CWindowCameraTop : public BC_Button
321 {
322 public:
323         CWindowCameraTop(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
324         int handle_event();
325         MWindow *mwindow;
326         CWindowCameraGUI *gui;
327 };
328
329 class CWindowCameraMiddle : public BC_Button
330 {
331 public:
332         CWindowCameraMiddle(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
333         int handle_event();
334         MWindow *mwindow;
335         CWindowCameraGUI *gui;
336 };
337
338 class CWindowCameraBottom : public BC_Button
339 {
340 public:
341         CWindowCameraBottom(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
342         int handle_event();
343         MWindow *mwindow;
344         CWindowCameraGUI *gui;
345 };
346
347 class CWindowProjectorGUI : public CWindowToolGUI
348 {
349 public:
350         CWindowProjectorGUI(MWindow *mwindow, CWindowTool *thread);
351         ~CWindowProjectorGUI();
352         void create_objects();
353         void update();
354         void update_preview();
355         void handle_event();
356 //      BezierAuto* get_keyframe();
357         CWindowCoord *x, *y, *z;
358 private:
359 // Toggles for keyframe curve mode (projector automation only)
360         CWindowCurveToggle *t_smooth, *t_linear;
361 };
362
363 class CWindowProjectorLeft : public BC_Button
364 {
365 public:
366         CWindowProjectorLeft(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
367         int handle_event();
368         MWindow *mwindow;
369         CWindowProjectorGUI *gui;
370 };
371
372 class CWindowProjectorCenter : public BC_Button
373 {
374 public:
375         CWindowProjectorCenter(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
376         int handle_event();
377         MWindow *mwindow;
378         CWindowProjectorGUI *gui;
379 };
380
381 class CWindowProjectorRight : public BC_Button
382 {
383 public:
384         CWindowProjectorRight(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
385         int handle_event();
386         MWindow *mwindow;
387         CWindowProjectorGUI *gui;
388 };
389
390 class CWindowProjectorTop : public BC_Button
391 {
392 public:
393         CWindowProjectorTop(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
394         int handle_event();
395         MWindow *mwindow;
396         CWindowProjectorGUI *gui;
397 };
398
399 class CWindowProjectorMiddle : public BC_Button
400 {
401 public:
402         CWindowProjectorMiddle(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
403         int handle_event();
404         MWindow *mwindow;
405         CWindowProjectorGUI *gui;
406 };
407
408 class CWindowProjectorBottom : public BC_Button
409 {
410 public:
411         CWindowProjectorBottom(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
412         int handle_event();
413         MWindow *mwindow;
414         CWindowProjectorGUI *gui;
415 };
416
417
418
419
420 class CWindowRulerGUI : public CWindowToolGUI
421 {
422 public:
423         CWindowRulerGUI(MWindow *mwindow, CWindowTool *thread);
424         ~CWindowRulerGUI();
425         void create_objects();
426         void update();
427 // Update the gui
428         void handle_event();
429
430         BC_Title *current;
431         BC_Title *point1;
432         BC_Title *point2;
433         BC_Title *distance;
434         BC_Title *angle;
435 };
436
437
438
439 #endif