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
52 void update_show_window();
58 CWindowToolGUI *tool_gui;
61 Condition *input_lock;
62 Condition *output_lock;
63 // Lock run and update_values
67 class CWindowToolGUI : public BC_Window
70 CWindowToolGUI(MWindow *mwindow,
77 virtual void create_objects() {};
78 // Update the keyframe from text boxes
79 virtual void handle_event() {};
80 // Update text boxes from keyframe here
81 virtual void update() {};
82 // Update EDL and preview only
83 void update_preview(int changed_edl=0);
84 void draw_preview(int changed_edl);
85 int current_operation;
86 virtual int close_event();
88 int translation_event();
92 CWindowCoord *event_caller;
95 class CWindowCoord : public BC_TumbleTextBox
98 CWindowCoord(CWindowToolGUI *gui, int x, int y,
99 float value, int logincrement);
100 CWindowCoord(CWindowToolGUI *gui, int x, int y,
103 // Calls the window's handle_event
109 class CWindowCropOK : public BC_GenericButton
112 CWindowCropOK(MWindow *mwindow, CWindowToolGUI *gui,
114 // Perform the cropping operation
116 int keypress_event();
121 class CWindowCropGUI : public CWindowToolGUI
124 CWindowCropGUI(MWindow *mwindow, CWindowTool *thread);
126 void create_objects();
130 CWindowCoord *x1, *y1, *width, *height;
133 class CWindowMaskItem : public BC_ListBoxItem
136 CWindowMaskItem(const char *text, int id=-1, int color=-1)
137 : BC_ListBoxItem(text, color), id(id) {}
138 ~CWindowMaskItem() {}
142 class CWindowMaskItems : public ArrayList<BC_ListBoxItem*>
145 CWindowMaskItems() {}
146 ~CWindowMaskItems() { remove_all_objects(); }
149 class CWindowMaskOnTrack : public BC_PopupTextBox
152 CWindowMaskOnTrack(MWindow *mwindow, CWindowMaskGUI *gui,
153 int x, int y, int w, const char *text);
154 ~CWindowMaskOnTrack();
157 CWindowMaskItems track_items;
163 class CWindowMaskTrackTumbler : public BC_Tumbler
166 CWindowMaskTrackTumbler(MWindow *mwindow, CWindowMaskGUI *gui,
168 ~CWindowMaskTrackTumbler();
169 int handle_up_event();
170 int handle_down_event();
171 int do_event(int dir);
178 class CWindowMaskName : public BC_PopupTextBox
181 CWindowMaskName(MWindow *mwindow, CWindowMaskGUI *gui,
182 int x, int y, const char *text);
186 CWindowMaskItems mask_items;
189 void update_items(MaskAuto *keyframe);
192 class CWindowMaskUnclear : public BC_GenericButton
195 CWindowMaskUnclear(MWindow *mwindow, CWindowMaskGUI *gui,
196 int x, int y, int w);
202 class CWindowMaskSoloTrack : public BC_CheckBox
205 CWindowMaskSoloTrack(MWindow *mwindow, CWindowMaskGUI *gui,
206 int x, int y, int v);
207 static int calculate_w(BC_WindowBase *gui);
213 class CWindowMaskDelMask : public BC_GenericButton
216 CWindowMaskDelMask(MWindow *mwindow, CWindowMaskGUI *gui,
223 class CWindowMaskClrMask : public BC_Button
226 CWindowMaskClrMask(MWindow *mwindow, CWindowMaskGUI *gui,
228 ~CWindowMaskClrMask();
229 static int calculate_w(MWindow *mwindow);
235 class CWindowMaskButton : public BC_CheckBox
238 CWindowMaskButton(MWindow *mwindow, CWindowMaskGUI *gui,
239 int x, int y, int no, int v);
240 ~CWindowMaskButton();
248 class CWindowMaskThumbler : public BC_Tumbler
251 CWindowMaskThumbler(MWindow *mwindow, CWindowMaskGUI *gui,
253 ~CWindowMaskThumbler();
254 int handle_up_event();
255 int handle_down_event();
256 int do_event(int dir);
262 class CWindowMaskEnable : public BC_CheckBox
265 CWindowMaskEnable(MWindow *mwindow, CWindowMaskGUI *gui,
266 int x, int y, int no, int v);
267 ~CWindowMaskEnable();
275 class CWindowMaskFade : public BC_TumbleTextBox
278 CWindowMaskFade(MWindow *mwindow, CWindowMaskGUI *gui,
282 int update_value(float v);
288 class CWindowMaskFadeSlider : public BC_ISlider
291 CWindowMaskFadeSlider(MWindow *mwindow, CWindowMaskGUI *gui,
292 int x, int y, int w);
293 ~CWindowMaskFadeSlider();
295 int update(int64_t v);
296 char *get_caption() { return 0; }
304 class CWindowMaskGangFader : public BC_Toggle
307 CWindowMaskGangFader(MWindow *mwindow, CWindowMaskGUI *gui,
309 ~CWindowMaskGangFader();
315 class CWindowMaskGangFocus : public BC_Toggle
318 CWindowMaskGangFocus(MWindow *mwindow, CWindowMaskGUI *gui,
320 ~CWindowMaskGangFocus();
326 class CWindowMaskSmoothButton : public BC_Button
329 CWindowMaskSmoothButton(MWindow *mwindow, CWindowMaskGUI *gui,
330 const char *tip, int type, int on, int x, int y, const char *images);
337 class CWindowMaskAffectedPoint : public BC_TumbleTextBox
340 CWindowMaskAffectedPoint(MWindow *mwindow, CWindowMaskGUI *gui,
342 ~CWindowMaskAffectedPoint();
348 class CWindowMaskFocus : public BC_CheckBox
351 CWindowMaskFocus(MWindow *mwindow, CWindowMaskGUI *gui,
359 class CWindowMaskHelp : public BC_CheckBox
362 CWindowMaskHelp(MWindow *mwindow, CWindowMaskGUI *gui,
370 class CWindowMaskDrawMarkers : public BC_CheckBox
373 CWindowMaskDrawMarkers(MWindow *mwindow, CWindowMaskGUI *gui,
375 ~CWindowMaskDrawMarkers();
381 class CWindowMaskDrawBoundary : public BC_CheckBox
384 CWindowMaskDrawBoundary(MWindow *mwindow, CWindowMaskGUI *gui,
386 ~CWindowMaskDrawBoundary();
392 class CWindowMaskDelPoint : public BC_GenericButton
395 CWindowMaskDelPoint(MWindow *mwindow, CWindowMaskGUI *gui,
398 int keypress_event();
403 class CWindowMaskFeather : public BC_TumbleTextBox
406 CWindowMaskFeather(MWindow *mwindow, CWindowMaskGUI *gui,
408 ~CWindowMaskFeather();
410 int update_value(float v);
416 class CWindowMaskFeatherSlider : public BC_FSlider
419 CWindowMaskFeatherSlider(MWindow *mwindow, CWindowMaskGUI *gui,
420 int x, int y, int w, float v);
421 ~CWindowMaskFeatherSlider();
424 char *get_caption() { return 0; }
432 class CWindowMaskGangFeather : public BC_Toggle
435 CWindowMaskGangFeather(MWindow *mwindow, CWindowMaskGUI *gui,
437 ~CWindowMaskGangFeather();
443 class CWindowMaskBeforePlugins : public BC_CheckBox
446 CWindowMaskBeforePlugins(CWindowMaskGUI *gui,
452 class CWindowDisableOpenGLMasking : public BC_CheckBox
455 CWindowDisableOpenGLMasking(CWindowMaskGUI *gui,
461 class CWindowMaskGUI : public CWindowToolGUI
464 CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread);
466 void create_objects();
471 void set_focused(int v, float cx, float cy);
472 void update_buttons(MaskAuto *keyframe, int k);
473 int smooth_mask(int typ, int on);
474 void get_keyframe(Track* &track, MaskAutos* &autos, MaskAuto* &keyframe,
475 SubMask* &mask, MaskPoint* &point, int create_it);
477 CWindowMaskOnTrack *mask_on_track;
478 CWindowMaskTrackTumbler *mask_track_tumbler;
479 CWindowMaskName *mask_name;
480 CWindowMaskButton *mask_buttons[SUBMASKS];
481 CWindowMaskThumbler *mask_thumbler;
482 BC_Title *mask_blabels[SUBMASKS];
483 CWindowMaskEnable *mask_enables[SUBMASKS];
484 CWindowMaskSoloTrack *mask_solo_track;
485 CWindowMaskDelMask *del_mask;
486 CWindowMaskUnclear *unclr_mask;
487 CWindowMaskClrMask *clr_mask;
488 CWindowMaskFade *fade;
489 CWindowMaskFadeSlider *fade_slider;
490 CWindowMaskGangFader *gang_fader;
491 CWindowMaskAffectedPoint *active_point;
492 CWindowMaskDelPoint *del_point;
493 CWindowMaskSmoothButton *mask_pnt_linear, *mask_pnt_smooth;
494 CWindowMaskSmoothButton *mask_crv_linear, *mask_crv_smooth;
495 CWindowMaskSmoothButton *mask_all_linear, *mask_all_smooth;
497 CWindowMaskFocus *focus;
499 CWindowMaskGangFocus *gang_focus;
500 CWindowMaskHelp *help;
501 int helped, help_y, help_h;
502 CWindowMaskDrawMarkers *draw_markers;
504 CWindowMaskDrawBoundary *draw_boundary;
506 CWindowCoord *focus_x, *focus_y;
507 CWindowMaskFeather *feather;
508 CWindowMaskFeatherSlider *feather_slider;
509 CWindowMaskGangFeather *gang_feather;
510 CWindowMaskBeforePlugins *apply_before_plugins;
511 CWindowDisableOpenGLMasking *disable_opengl_masking;
515 class CWindowEyedropGUI : public CWindowToolGUI
518 CWindowEyedropGUI(MWindow *mwindow, CWindowTool *thread);
519 ~CWindowEyedropGUI();
522 void create_objects();
526 CWindowCoord *radius;
527 CWindowEyedropCheckBox *use_max;
528 BC_Title *red, *green, *blue, *y, *u, *v;
529 BC_Title *rgb_hex, *yuv_hex;
530 BC_SubWindow *sample;
534 class CWindowEyedropCheckBox : public BC_CheckBox
537 CWindowEyedropCheckBox(MWindow *mwindow,
538 CWindowEyedropGUI *gui,
544 CWindowEyedropGUI *gui;
549 class CWindowCameraGUI : public CWindowToolGUI
552 CWindowCameraGUI(MWindow *mwindow, CWindowTool *thread);
554 void create_objects();
557 // Update the keyframe from text boxes
559 // BezierAuto* get_keyframe();
560 CWindowCoord *x, *y, *z;
562 // Toggles for keyframe curve mode (for camera automation only)
563 CWindowCurveToggle *t_smooth, *t_linear;
566 class CWindowCameraLeft : public BC_Button
569 CWindowCameraLeft(MWindow *mwindow, CWindowCameraGUI *gui,
573 CWindowCameraGUI *gui;
576 class CWindowCameraCenter : public BC_Button
579 CWindowCameraCenter(MWindow *mwindow, CWindowCameraGUI *gui,
583 CWindowCameraGUI *gui;
586 class CWindowCameraRight : public BC_Button
589 CWindowCameraRight(MWindow *mwindow, CWindowCameraGUI *gui,
593 CWindowCameraGUI *gui;
596 class CWindowCameraTop : public BC_Button
599 CWindowCameraTop(MWindow *mwindow, CWindowCameraGUI *gui,
603 CWindowCameraGUI *gui;
606 class CWindowCameraMiddle : public BC_Button
609 CWindowCameraMiddle(MWindow *mwindow, CWindowCameraGUI *gui,
613 CWindowCameraGUI *gui;
616 class CWindowCameraBottom : public BC_Button
619 CWindowCameraBottom(MWindow *mwindow, CWindowCameraGUI *gui,
623 CWindowCameraGUI *gui;
626 class CWindowProjectorGUI : public CWindowToolGUI
629 CWindowProjectorGUI(MWindow *mwindow, CWindowTool *thread);
630 ~CWindowProjectorGUI();
631 void create_objects();
634 // BezierAuto* get_keyframe();
635 CWindowCoord *x, *y, *z;
637 // Toggles for keyframe curve mode (projector automation only)
638 CWindowCurveToggle *t_smooth, *t_linear;
641 class CWindowProjectorLeft : public BC_Button
644 CWindowProjectorLeft(MWindow *mwindow, CWindowProjectorGUI *gui,
648 CWindowProjectorGUI *gui;
651 class CWindowProjectorCenter : public BC_Button
654 CWindowProjectorCenter(MWindow *mwindow, CWindowProjectorGUI *gui,
658 CWindowProjectorGUI *gui;
661 class CWindowProjectorRight : public BC_Button
664 CWindowProjectorRight(MWindow *mwindow, CWindowProjectorGUI *gui,
668 CWindowProjectorGUI *gui;
671 class CWindowProjectorTop : public BC_Button
674 CWindowProjectorTop(MWindow *mwindow, CWindowProjectorGUI *gui,
678 CWindowProjectorGUI *gui;
681 class CWindowProjectorMiddle : public BC_Button
684 CWindowProjectorMiddle(MWindow *mwindow, CWindowProjectorGUI *gui,
688 CWindowProjectorGUI *gui;
691 class CWindowProjectorBottom : public BC_Button
694 CWindowProjectorBottom(MWindow *mwindow, CWindowProjectorGUI *gui,
698 CWindowProjectorGUI *gui;
704 class CWindowRulerGUI : public CWindowToolGUI
707 CWindowRulerGUI(MWindow *mwindow, CWindowTool *thread);
709 void create_objects();
718 BC_TextBox *distance;