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 CWindowMaskDelMask : public BC_GenericButton
151 CWindowMaskDelMask(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
157 class CWindowMaskClrMask : public BC_Button
160 CWindowMaskClrMask(MWindow *mwindow, CWindowMaskGUI *gui, int x, int y);
161 ~CWindowMaskClrMask();
162 static int calculate_w(MWindow *mwindow);
168 class CWindowMaskFade : public BC_TumbleTextBox
171 CWindowMaskFade(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
174 int update_value(float v);
180 class CWindowMaskFadeSlider : public BC_ISlider
183 CWindowMaskFadeSlider(MWindow *mwindow, CWindowToolGUI *gui,
184 int x, int y, int w);
185 ~CWindowMaskFadeSlider();
187 int update(int64_t v);
188 char *get_caption() { return 0; }
196 class CWindowMaskGangFader : public BC_Toggle
199 CWindowMaskGangFader(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
200 ~CWindowMaskGangFader();
206 class CWindowMaskAffectedPoint : public BC_TumbleTextBox
209 CWindowMaskAffectedPoint(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
210 ~CWindowMaskAffectedPoint();
216 class CWindowMaskFocus : public BC_CheckBox
219 CWindowMaskFocus(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
226 class CWindowMaskDrawMarkers : public BC_CheckBox
229 CWindowMaskDrawMarkers(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
230 ~CWindowMaskDrawMarkers();
236 class CWindowMaskDrawBoundary : public BC_CheckBox
239 CWindowMaskDrawBoundary(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
240 ~CWindowMaskDrawBoundary();
246 class CWindowMaskDelPoint : public BC_GenericButton
249 CWindowMaskDelPoint(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
251 int keypress_event();
256 class CWindowMaskFeather : public BC_TumbleTextBox
259 CWindowMaskFeather(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
260 ~CWindowMaskFeather();
262 int update_value(float v);
268 class CWindowMaskFeatherSlider : public BC_FSlider
271 CWindowMaskFeatherSlider(MWindow *mwindow, CWindowToolGUI *gui,
272 int x, int y, int w, float v);
273 ~CWindowMaskFeatherSlider();
276 char *get_caption() { return 0; }
284 class CWindowMaskGangFeather : public BC_Toggle
287 CWindowMaskGangFeather(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
288 ~CWindowMaskGangFeather();
294 class CWindowMaskBeforePlugins : public BC_CheckBox
297 CWindowMaskBeforePlugins(CWindowToolGUI *gui, int x, int y);
302 class CWindowDisableOpenGLMasking : public BC_CheckBox
305 CWindowDisableOpenGLMasking(CWindowToolGUI *gui, int x, int y);
310 class CWindowMaskGUI : public CWindowToolGUI
313 CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread);
315 void create_objects();
317 void set_focused(int v, float cx, float cy);
319 void get_keyframe(Track* &track, MaskAutos* &autos, MaskAuto* &keyframe,
320 SubMask* &mask, MaskPoint* &point, int create_it);
321 void update_preview();
323 CWindowMaskName *name;
324 CWindowMaskDelMask *del_mask;
325 CWindowMaskClrMask *clr_mask;
326 CWindowMaskFade *fade;
327 CWindowMaskFadeSlider *fade_slider;
328 CWindowMaskGangFader *gang_fader;
329 CWindowMaskAffectedPoint *active_point;
330 CWindowMaskDelPoint *del_point;
332 CWindowMaskFocus *focus;
334 CWindowMaskDrawMarkers *draw_markers;
336 CWindowMaskDrawBoundary *draw_boundary;
338 CWindowCoord *focus_x, *focus_y;
339 CWindowMaskFeather *feather;
340 CWindowMaskFeatherSlider *feather_slider;
341 CWindowMaskGangFeather *gang_feather;
342 CWindowMaskBeforePlugins *apply_before_plugins;
343 CWindowDisableOpenGLMasking *disable_opengl_masking;
347 class CWindowEyedropGUI : public CWindowToolGUI
350 CWindowEyedropGUI(MWindow *mwindow, CWindowTool *thread);
351 ~CWindowEyedropGUI();
354 void create_objects();
358 CWindowCoord *radius;
359 CWindowEyedropCheckBox *use_max;
360 BC_Title *red, *green, *blue, *y, *u, *v;
361 BC_Title *rgb_hex, *yuv_hex;
362 BC_SubWindow *sample;
366 class CWindowEyedropCheckBox : public BC_CheckBox
369 CWindowEyedropCheckBox(MWindow *mwindow,
370 CWindowEyedropGUI *gui,
376 CWindowEyedropGUI *gui;
381 class CWindowCameraGUI : public CWindowToolGUI
384 CWindowCameraGUI(MWindow *mwindow, CWindowTool *thread);
386 void create_objects();
388 void update_preview();
390 // Update the keyframe from text boxes
392 // BezierAuto* get_keyframe();
393 CWindowCoord *x, *y, *z;
395 // Toggles for keyframe curve mode (for camera automation only)
396 CWindowCurveToggle *t_smooth, *t_linear;
399 class CWindowCameraLeft : public BC_Button
402 CWindowCameraLeft(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
405 CWindowCameraGUI *gui;
408 class CWindowCameraCenter : public BC_Button
411 CWindowCameraCenter(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
414 CWindowCameraGUI *gui;
417 class CWindowCameraRight : public BC_Button
420 CWindowCameraRight(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
423 CWindowCameraGUI *gui;
426 class CWindowCameraTop : public BC_Button
429 CWindowCameraTop(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
432 CWindowCameraGUI *gui;
435 class CWindowCameraMiddle : public BC_Button
438 CWindowCameraMiddle(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
441 CWindowCameraGUI *gui;
444 class CWindowCameraBottom : public BC_Button
447 CWindowCameraBottom(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
450 CWindowCameraGUI *gui;
453 class CWindowProjectorGUI : public CWindowToolGUI
456 CWindowProjectorGUI(MWindow *mwindow, CWindowTool *thread);
457 ~CWindowProjectorGUI();
458 void create_objects();
460 void update_preview();
462 // BezierAuto* get_keyframe();
463 CWindowCoord *x, *y, *z;
465 // Toggles for keyframe curve mode (projector automation only)
466 CWindowCurveToggle *t_smooth, *t_linear;
469 class CWindowProjectorLeft : public BC_Button
472 CWindowProjectorLeft(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
475 CWindowProjectorGUI *gui;
478 class CWindowProjectorCenter : public BC_Button
481 CWindowProjectorCenter(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
484 CWindowProjectorGUI *gui;
487 class CWindowProjectorRight : public BC_Button
490 CWindowProjectorRight(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
493 CWindowProjectorGUI *gui;
496 class CWindowProjectorTop : public BC_Button
499 CWindowProjectorTop(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
502 CWindowProjectorGUI *gui;
505 class CWindowProjectorMiddle : public BC_Button
508 CWindowProjectorMiddle(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
511 CWindowProjectorGUI *gui;
514 class CWindowProjectorBottom : public BC_Button
517 CWindowProjectorBottom(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
520 CWindowProjectorGUI *gui;
526 class CWindowRulerGUI : public CWindowToolGUI
529 CWindowRulerGUI(MWindow *mwindow, CWindowTool *thread);
531 void create_objects();
540 BC_TextBox *distance;