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