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,
97 float value, int logincrement);
98 CWindowCoord(CWindowToolGUI *gui, int x, int y,
101 // Calls the window's handle_event
107 class CWindowCropOK : public BC_GenericButton
110 CWindowCropOK(MWindow *mwindow, CWindowToolGUI *gui,
112 // Perform the cropping operation
114 int keypress_event();
119 class CWindowCropGUI : public CWindowToolGUI
122 CWindowCropGUI(MWindow *mwindow, CWindowTool *thread);
124 void create_objects();
128 CWindowCoord *x1, *y1, *width, *height;
131 class CWindowMaskItems : public ArrayList<BC_ListBoxItem*>
134 CWindowMaskItems() {}
135 ~CWindowMaskItems() { remove_all_objects(); }
138 class CWindowMaskName : public BC_PopupTextBox
141 CWindowMaskName(MWindow *mwindow, CWindowMaskGUI *gui,
142 int x, int y, const char *text);
146 CWindowMaskItems mask_items;
149 void update_items(MaskAuto *keyframe);
152 class CWindowMaskDelMask : public BC_GenericButton
155 CWindowMaskDelMask(MWindow *mwindow, CWindowToolGUI *gui,
162 class CWindowMaskClrMask : public BC_Button
165 CWindowMaskClrMask(MWindow *mwindow, CWindowMaskGUI *gui,
167 ~CWindowMaskClrMask();
168 static int calculate_w(MWindow *mwindow);
174 class CWindowMaskButton : public BC_CheckBox
177 CWindowMaskButton(MWindow *mwindow, CWindowMaskGUI *gui,
178 int x, int y, int no, int v);
179 ~CWindowMaskButton();
187 class CWindowMaskThumbler : public BC_Tumbler
190 CWindowMaskThumbler(MWindow *mwindow, CWindowMaskGUI *gui,
192 ~CWindowMaskThumbler();
193 int handle_up_event();
194 int handle_down_event();
195 int do_event(int dir);
201 class CWindowMaskFade : public BC_TumbleTextBox
204 CWindowMaskFade(MWindow *mwindow, CWindowToolGUI *gui,
208 int update_value(float v);
214 class CWindowMaskFadeSlider : public BC_ISlider
217 CWindowMaskFadeSlider(MWindow *mwindow, CWindowToolGUI *gui,
218 int x, int y, int w);
219 ~CWindowMaskFadeSlider();
221 int update(int64_t v);
222 char *get_caption() { return 0; }
230 class CWindowMaskGangFader : public BC_Toggle
233 CWindowMaskGangFader(MWindow *mwindow, CWindowToolGUI *gui,
235 ~CWindowMaskGangFader();
241 class CWindowMaskAffectedPoint : public BC_TumbleTextBox
244 CWindowMaskAffectedPoint(MWindow *mwindow, CWindowToolGUI *gui,
246 ~CWindowMaskAffectedPoint();
252 class CWindowMaskFocus : public BC_CheckBox
255 CWindowMaskFocus(MWindow *mwindow, CWindowToolGUI *gui,
263 class CWindowMaskDrawMarkers : public BC_CheckBox
266 CWindowMaskDrawMarkers(MWindow *mwindow, CWindowToolGUI *gui,
268 ~CWindowMaskDrawMarkers();
274 class CWindowMaskDrawBoundary : public BC_CheckBox
277 CWindowMaskDrawBoundary(MWindow *mwindow, CWindowToolGUI *gui,
279 ~CWindowMaskDrawBoundary();
285 class CWindowMaskDelPoint : public BC_GenericButton
288 CWindowMaskDelPoint(MWindow *mwindow, CWindowToolGUI *gui,
291 int keypress_event();
296 class CWindowMaskFeather : public BC_TumbleTextBox
299 CWindowMaskFeather(MWindow *mwindow, CWindowToolGUI *gui,
301 ~CWindowMaskFeather();
303 int update_value(float v);
309 class CWindowMaskFeatherSlider : public BC_FSlider
312 CWindowMaskFeatherSlider(MWindow *mwindow, CWindowToolGUI *gui,
313 int x, int y, int w, float v);
314 ~CWindowMaskFeatherSlider();
317 char *get_caption() { return 0; }
325 class CWindowMaskGangFeather : public BC_Toggle
328 CWindowMaskGangFeather(MWindow *mwindow, CWindowToolGUI *gui,
330 ~CWindowMaskGangFeather();
336 class CWindowMaskBeforePlugins : public BC_CheckBox
339 CWindowMaskBeforePlugins(CWindowToolGUI *gui,
345 class CWindowDisableOpenGLMasking : public BC_CheckBox
348 CWindowDisableOpenGLMasking(CWindowToolGUI *gui,
354 class CWindowMaskGUI : public CWindowToolGUI
357 CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread);
359 void create_objects();
361 void set_focused(int v, float cx, float cy);
363 void get_keyframe(Track* &track, MaskAutos* &autos, MaskAuto* &keyframe,
364 SubMask* &mask, MaskPoint* &point, int create_it);
365 void update_preview();
367 CWindowMaskName *name;
368 CWindowMaskButton *mask_buttons[SUBMASKS];
369 CWindowMaskThumbler *mask_thumbler;
370 BC_Title *mask_blabels[SUBMASKS];
371 CWindowMaskDelMask *del_mask;
372 CWindowMaskClrMask *clr_mask;
373 CWindowMaskFade *fade;
374 CWindowMaskFadeSlider *fade_slider;
375 CWindowMaskGangFader *gang_fader;
376 CWindowMaskAffectedPoint *active_point;
377 CWindowMaskDelPoint *del_point;
379 CWindowMaskFocus *focus;
381 CWindowMaskDrawMarkers *draw_markers;
383 CWindowMaskDrawBoundary *draw_boundary;
385 CWindowCoord *focus_x, *focus_y;
386 CWindowMaskFeather *feather;
387 CWindowMaskFeatherSlider *feather_slider;
388 CWindowMaskGangFeather *gang_feather;
389 CWindowMaskBeforePlugins *apply_before_plugins;
390 CWindowDisableOpenGLMasking *disable_opengl_masking;
394 class CWindowEyedropGUI : public CWindowToolGUI
397 CWindowEyedropGUI(MWindow *mwindow, CWindowTool *thread);
398 ~CWindowEyedropGUI();
401 void create_objects();
405 CWindowCoord *radius;
406 CWindowEyedropCheckBox *use_max;
407 BC_Title *red, *green, *blue, *y, *u, *v;
408 BC_Title *rgb_hex, *yuv_hex;
409 BC_SubWindow *sample;
413 class CWindowEyedropCheckBox : public BC_CheckBox
416 CWindowEyedropCheckBox(MWindow *mwindow,
417 CWindowEyedropGUI *gui,
423 CWindowEyedropGUI *gui;
428 class CWindowCameraGUI : public CWindowToolGUI
431 CWindowCameraGUI(MWindow *mwindow, CWindowTool *thread);
433 void create_objects();
435 void update_preview();
437 // Update the keyframe from text boxes
439 // BezierAuto* get_keyframe();
440 CWindowCoord *x, *y, *z;
442 // Toggles for keyframe curve mode (for camera automation only)
443 CWindowCurveToggle *t_smooth, *t_linear;
446 class CWindowCameraLeft : public BC_Button
449 CWindowCameraLeft(MWindow *mwindow, CWindowCameraGUI *gui,
453 CWindowCameraGUI *gui;
456 class CWindowCameraCenter : public BC_Button
459 CWindowCameraCenter(MWindow *mwindow, CWindowCameraGUI *gui,
463 CWindowCameraGUI *gui;
466 class CWindowCameraRight : public BC_Button
469 CWindowCameraRight(MWindow *mwindow, CWindowCameraGUI *gui,
473 CWindowCameraGUI *gui;
476 class CWindowCameraTop : public BC_Button
479 CWindowCameraTop(MWindow *mwindow, CWindowCameraGUI *gui,
483 CWindowCameraGUI *gui;
486 class CWindowCameraMiddle : public BC_Button
489 CWindowCameraMiddle(MWindow *mwindow, CWindowCameraGUI *gui,
493 CWindowCameraGUI *gui;
496 class CWindowCameraBottom : public BC_Button
499 CWindowCameraBottom(MWindow *mwindow, CWindowCameraGUI *gui,
503 CWindowCameraGUI *gui;
506 class CWindowProjectorGUI : public CWindowToolGUI
509 CWindowProjectorGUI(MWindow *mwindow, CWindowTool *thread);
510 ~CWindowProjectorGUI();
511 void create_objects();
513 void update_preview();
515 // BezierAuto* get_keyframe();
516 CWindowCoord *x, *y, *z;
518 // Toggles for keyframe curve mode (projector automation only)
519 CWindowCurveToggle *t_smooth, *t_linear;
522 class CWindowProjectorLeft : public BC_Button
525 CWindowProjectorLeft(MWindow *mwindow, CWindowProjectorGUI *gui,
529 CWindowProjectorGUI *gui;
532 class CWindowProjectorCenter : public BC_Button
535 CWindowProjectorCenter(MWindow *mwindow, CWindowProjectorGUI *gui,
539 CWindowProjectorGUI *gui;
542 class CWindowProjectorRight : public BC_Button
545 CWindowProjectorRight(MWindow *mwindow, CWindowProjectorGUI *gui,
549 CWindowProjectorGUI *gui;
552 class CWindowProjectorTop : public BC_Button
555 CWindowProjectorTop(MWindow *mwindow, CWindowProjectorGUI *gui,
559 CWindowProjectorGUI *gui;
562 class CWindowProjectorMiddle : public BC_Button
565 CWindowProjectorMiddle(MWindow *mwindow, CWindowProjectorGUI *gui,
569 CWindowProjectorGUI *gui;
572 class CWindowProjectorBottom : public BC_Button
575 CWindowProjectorBottom(MWindow *mwindow, CWindowProjectorGUI *gui,
579 CWindowProjectorGUI *gui;
585 class CWindowRulerGUI : public CWindowToolGUI
588 CWindowRulerGUI(MWindow *mwindow, CWindowTool *thread);
590 void create_objects();
599 BC_TextBox *distance;