4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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.
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.
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
25 #include "condition.inc"
26 #include "cwindowgui.inc"
27 #include "cwindowtool.inc"
29 #include "keyframe.inc"
30 #include "maskauto.inc"
31 #include "maskautos.inc"
32 #include "mwindow.inc"
35 // This common thread supports all the tool GUI's.
36 class CWindowTool : public Thread
39 CWindowTool(MWindow *mwindow, CWindowGUI *gui);
42 // Called depending on state of toggle button
43 void start_tool(int operation);
46 // Called when window is visible
51 void update_show_window();
57 CWindowToolGUI *tool_gui;
60 Condition *input_lock;
61 Condition *output_lock;
62 // Lock run and update_values
66 class CWindowToolGUI : public BC_Window
69 CWindowToolGUI(MWindow *mwindow,
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;
86 int translation_event();
90 CWindowCoord *event_caller;
93 class CWindowCoord : public BC_TumbleTextBox
96 CWindowCoord(CWindowToolGUI *gui, int x, int y, float value, int logincrement);
97 CWindowCoord(CWindowToolGUI *gui, int x, int y, int value);
99 // Calls the window's handle_event
105 class CWindowCropOK : public BC_GenericButton
108 CWindowCropOK(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
109 // Perform the cropping operation
111 int keypress_event();
116 class CWindowCropGUI : public CWindowToolGUI
119 CWindowCropGUI(MWindow *mwindow, CWindowTool *thread);
121 void create_objects();
125 CWindowCoord *x1, *y1, *width, *height;
128 class CWindowMaskItems : public ArrayList<BC_ListBoxItem*>
131 CWindowMaskItems() {}
132 ~CWindowMaskItems() { remove_all_objects(); }
135 class CWindowMaskName : public BC_PopupTextBox
138 CWindowMaskName(MWindow *mwindow, CWindowToolGUI *gui, int x, int y, const char *text);
142 CWindowMaskItems mask_items;
145 void update_items(MaskAuto *keyframe);
148 class CWindowMaskFade : public BC_TumbleTextBox
151 CWindowMaskFade(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
154 int update_value(float v);
160 class CWindowMaskFadeSlider : public BC_ISlider
163 CWindowMaskFadeSlider(MWindow *mwindow, CWindowToolGUI *gui,
164 int x, int y, int w);
165 ~CWindowMaskFadeSlider();
167 int update(int64_t v);
168 char *get_caption() { return 0; }
175 class CWindowMaskMode : public BC_Toggle
178 CWindowMaskMode(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
185 class CWindowMaskDelMask : public BC_GenericButton
188 CWindowMaskDelMask(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
194 class CWindowMaskAffectedPoint : public BC_TumbleTextBox
197 CWindowMaskAffectedPoint(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
198 ~CWindowMaskAffectedPoint();
204 class CWindowMaskFocus : public BC_CheckBox
207 CWindowMaskFocus(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
214 class CWindowMaskDelPoint : public BC_GenericButton
217 CWindowMaskDelPoint(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
219 int keypress_event();
224 class CWindowMaskFeather : public BC_TumbleTextBox
227 CWindowMaskFeather(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
228 ~CWindowMaskFeather();
230 int update_value(float v);
236 class CWindowMaskFeatherSlider : public BC_FSlider
239 CWindowMaskFeatherSlider(MWindow *mwindow, CWindowToolGUI *gui,
240 int x, int y, int w, float v);
241 ~CWindowMaskFeatherSlider();
244 char *get_caption() { return 0; }
249 class CWindowMaskClrMask : public BC_Button
252 CWindowMaskClrMask(MWindow *mwindow, CWindowMaskGUI *gui, int x, int y);
253 ~CWindowMaskClrMask();
254 static int calculate_w(MWindow *mwindow);
260 class CWindowMaskClrFeather : public BC_Button
263 CWindowMaskClrFeather(MWindow *mwindow, CWindowMaskGUI *gui, int x, int y);
264 ~CWindowMaskClrFeather();
270 class CWindowMaskBeforePlugins : public BC_CheckBox
273 CWindowMaskBeforePlugins(CWindowToolGUI *gui, int x, int y);
278 class CWindowDisableOpenGLMasking : public BC_CheckBox
281 CWindowDisableOpenGLMasking(CWindowToolGUI *gui, int x, int y);
286 class CWindowMaskGUI : public CWindowToolGUI
289 CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread);
291 void create_objects();
293 void set_focused(int v, float cx, float cy);
295 void get_keyframe(Track* &track, MaskAutos* &autos, MaskAuto* &keyframe,
296 SubMask* &mask, MaskPoint* &point, int create_it);
297 void update_preview();
299 CWindowMaskName *name;
300 CWindowMaskClrMask *clr_mask;
301 CWindowMaskDelMask *del_mask;
302 CWindowMaskFade *fade;
303 CWindowMaskFadeSlider *fade_slider;
304 CWindowMaskMode *mode;
305 CWindowMaskAffectedPoint *active_point;
306 CWindowMaskDelPoint *del_point;
308 CWindowMaskFocus *focus;
310 CWindowCoord *focus_x, *focus_y;
311 CWindowMaskFeather *feather;
312 CWindowMaskFeatherSlider *feather_slider;
313 CWindowMaskBeforePlugins *apply_before_plugins;
314 CWindowDisableOpenGLMasking *disable_opengl_masking;
318 class CWindowEyedropGUI : public CWindowToolGUI
321 CWindowEyedropGUI(MWindow *mwindow, CWindowTool *thread);
322 ~CWindowEyedropGUI();
325 void create_objects();
329 CWindowCoord *radius;
330 CWindowEyedropCheckBox *use_max;
331 BC_Title *red, *green, *blue, *y, *u, *v;
332 BC_Title *rgb_hex, *yuv_hex;
333 BC_SubWindow *sample;
337 class CWindowEyedropCheckBox : public BC_CheckBox
340 CWindowEyedropCheckBox(MWindow *mwindow,
341 CWindowEyedropGUI *gui,
347 CWindowEyedropGUI *gui;
352 class CWindowCameraGUI : public CWindowToolGUI
355 CWindowCameraGUI(MWindow *mwindow, CWindowTool *thread);
357 void create_objects();
359 void update_preview();
361 // Update the keyframe from text boxes
363 // BezierAuto* get_keyframe();
364 CWindowCoord *x, *y, *z;
366 // Toggles for keyframe curve mode (for camera automation only)
367 CWindowCurveToggle *t_smooth, *t_linear;
370 class CWindowCameraLeft : public BC_Button
373 CWindowCameraLeft(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
376 CWindowCameraGUI *gui;
379 class CWindowCameraCenter : public BC_Button
382 CWindowCameraCenter(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
385 CWindowCameraGUI *gui;
388 class CWindowCameraRight : public BC_Button
391 CWindowCameraRight(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
394 CWindowCameraGUI *gui;
397 class CWindowCameraTop : public BC_Button
400 CWindowCameraTop(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
403 CWindowCameraGUI *gui;
406 class CWindowCameraMiddle : public BC_Button
409 CWindowCameraMiddle(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
412 CWindowCameraGUI *gui;
415 class CWindowCameraBottom : public BC_Button
418 CWindowCameraBottom(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
421 CWindowCameraGUI *gui;
424 class CWindowProjectorGUI : public CWindowToolGUI
427 CWindowProjectorGUI(MWindow *mwindow, CWindowTool *thread);
428 ~CWindowProjectorGUI();
429 void create_objects();
431 void update_preview();
433 // BezierAuto* get_keyframe();
434 CWindowCoord *x, *y, *z;
436 // Toggles for keyframe curve mode (projector automation only)
437 CWindowCurveToggle *t_smooth, *t_linear;
440 class CWindowProjectorLeft : public BC_Button
443 CWindowProjectorLeft(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
446 CWindowProjectorGUI *gui;
449 class CWindowProjectorCenter : public BC_Button
452 CWindowProjectorCenter(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
455 CWindowProjectorGUI *gui;
458 class CWindowProjectorRight : public BC_Button
461 CWindowProjectorRight(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
464 CWindowProjectorGUI *gui;
467 class CWindowProjectorTop : public BC_Button
470 CWindowProjectorTop(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
473 CWindowProjectorGUI *gui;
476 class CWindowProjectorMiddle : public BC_Button
479 CWindowProjectorMiddle(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
482 CWindowProjectorGUI *gui;
485 class CWindowProjectorBottom : public BC_Button
488 CWindowProjectorBottom(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
491 CWindowProjectorGUI *gui;
497 class CWindowRulerGUI : public CWindowToolGUI
500 CWindowRulerGUI(MWindow *mwindow, CWindowTool *thread);
502 void create_objects();
511 BC_TextBox *distance;