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 CWindowMaskSmooth : public BC_GenericButton
329 CWindowMaskSmooth(MWindow *mwindow, CWindowMaskGUI *gui,
336 class CWindowMaskGangSmooth : public BC_Button
339 CWindowMaskGangSmooth(MWindow *mwindow, CWindowMaskGUI *gui,
346 class CWindowMaskAffectedPoint : public BC_TumbleTextBox
349 CWindowMaskAffectedPoint(MWindow *mwindow, CWindowMaskGUI *gui,
351 ~CWindowMaskAffectedPoint();
357 class CWindowMaskFocus : public BC_CheckBox
360 CWindowMaskFocus(MWindow *mwindow, CWindowMaskGUI *gui,
368 class CWindowMaskHelp : public BC_CheckBox
371 CWindowMaskHelp(MWindow *mwindow, CWindowMaskGUI *gui,
379 class CWindowMaskDrawMarkers : public BC_CheckBox
382 CWindowMaskDrawMarkers(MWindow *mwindow, CWindowMaskGUI *gui,
384 ~CWindowMaskDrawMarkers();
390 class CWindowMaskDrawBoundary : public BC_CheckBox
393 CWindowMaskDrawBoundary(MWindow *mwindow, CWindowMaskGUI *gui,
395 ~CWindowMaskDrawBoundary();
401 class CWindowMaskDelPoint : public BC_GenericButton
404 CWindowMaskDelPoint(MWindow *mwindow, CWindowMaskGUI *gui,
407 int keypress_event();
412 class CWindowMaskFeather : public BC_TumbleTextBox
415 CWindowMaskFeather(MWindow *mwindow, CWindowMaskGUI *gui,
417 ~CWindowMaskFeather();
419 int update_value(float v);
425 class CWindowMaskFeatherSlider : public BC_FSlider
428 CWindowMaskFeatherSlider(MWindow *mwindow, CWindowMaskGUI *gui,
429 int x, int y, int w, float v);
430 ~CWindowMaskFeatherSlider();
433 char *get_caption() { return 0; }
441 class CWindowMaskGangFeather : public BC_Toggle
444 CWindowMaskGangFeather(MWindow *mwindow, CWindowMaskGUI *gui,
446 ~CWindowMaskGangFeather();
452 class CWindowMaskBeforePlugins : public BC_CheckBox
455 CWindowMaskBeforePlugins(CWindowMaskGUI *gui,
461 class CWindowDisableOpenGLMasking : public BC_CheckBox
464 CWindowDisableOpenGLMasking(CWindowMaskGUI *gui,
470 class CWindowMaskGUI : public CWindowToolGUI
473 CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread);
475 void create_objects();
480 void set_focused(int v, float cx, float cy);
481 void update_buttons(MaskAuto *keyframe, int k);
482 int smooth_mask(int gang);
483 void get_keyframe(Track* &track, MaskAutos* &autos, MaskAuto* &keyframe,
484 SubMask* &mask, MaskPoint* &point, int create_it);
486 CWindowMaskOnTrack *mask_on_track;
487 CWindowMaskTrackTumbler *mask_track_tumbler;
488 CWindowMaskName *mask_name;
489 CWindowMaskButton *mask_buttons[SUBMASKS];
490 CWindowMaskThumbler *mask_thumbler;
491 BC_Title *mask_blabels[SUBMASKS];
492 CWindowMaskEnable *mask_enables[SUBMASKS];
493 CWindowMaskSoloTrack *mask_solo_track;
494 CWindowMaskDelMask *del_mask;
495 CWindowMaskUnclear *unclr_mask;
496 CWindowMaskClrMask *clr_mask;
497 CWindowMaskFade *fade;
498 CWindowMaskFadeSlider *fade_slider;
499 CWindowMaskGangFader *gang_fader;
500 CWindowMaskAffectedPoint *active_point;
501 CWindowMaskDelPoint *del_point;
503 CWindowMaskFocus *focus;
505 CWindowMaskGangFocus *gang_focus;
506 CWindowMaskSmooth *smooth;
507 CWindowMaskGangSmooth *gang_smooth;
508 CWindowMaskHelp *help;
509 int helped, help_y, help_h;
510 CWindowMaskDrawMarkers *draw_markers;
512 CWindowMaskDrawBoundary *draw_boundary;
514 CWindowCoord *focus_x, *focus_y;
515 CWindowMaskFeather *feather;
516 CWindowMaskFeatherSlider *feather_slider;
517 CWindowMaskGangFeather *gang_feather;
518 CWindowMaskBeforePlugins *apply_before_plugins;
519 CWindowDisableOpenGLMasking *disable_opengl_masking;
523 class CWindowEyedropGUI : public CWindowToolGUI
526 CWindowEyedropGUI(MWindow *mwindow, CWindowTool *thread);
527 ~CWindowEyedropGUI();
530 void create_objects();
534 CWindowCoord *radius;
535 CWindowEyedropCheckBox *use_max;
536 BC_Title *red, *green, *blue, *y, *u, *v;
537 BC_Title *rgb_hex, *yuv_hex;
538 BC_SubWindow *sample;
542 class CWindowEyedropCheckBox : public BC_CheckBox
545 CWindowEyedropCheckBox(MWindow *mwindow,
546 CWindowEyedropGUI *gui,
552 CWindowEyedropGUI *gui;
557 class CWindowCameraGUI : public CWindowToolGUI
560 CWindowCameraGUI(MWindow *mwindow, CWindowTool *thread);
562 void create_objects();
565 // Update the keyframe from text boxes
567 // BezierAuto* get_keyframe();
568 CWindowCoord *x, *y, *z;
570 // Toggles for keyframe curve mode (for camera automation only)
571 CWindowCurveToggle *t_smooth, *t_linear;
574 class CWindowCameraLeft : public BC_Button
577 CWindowCameraLeft(MWindow *mwindow, CWindowCameraGUI *gui,
581 CWindowCameraGUI *gui;
584 class CWindowCameraCenter : public BC_Button
587 CWindowCameraCenter(MWindow *mwindow, CWindowCameraGUI *gui,
591 CWindowCameraGUI *gui;
594 class CWindowCameraRight : public BC_Button
597 CWindowCameraRight(MWindow *mwindow, CWindowCameraGUI *gui,
601 CWindowCameraGUI *gui;
604 class CWindowCameraTop : public BC_Button
607 CWindowCameraTop(MWindow *mwindow, CWindowCameraGUI *gui,
611 CWindowCameraGUI *gui;
614 class CWindowCameraMiddle : public BC_Button
617 CWindowCameraMiddle(MWindow *mwindow, CWindowCameraGUI *gui,
621 CWindowCameraGUI *gui;
624 class CWindowCameraBottom : public BC_Button
627 CWindowCameraBottom(MWindow *mwindow, CWindowCameraGUI *gui,
631 CWindowCameraGUI *gui;
634 class CWindowProjectorGUI : public CWindowToolGUI
637 CWindowProjectorGUI(MWindow *mwindow, CWindowTool *thread);
638 ~CWindowProjectorGUI();
639 void create_objects();
642 // BezierAuto* get_keyframe();
643 CWindowCoord *x, *y, *z;
645 // Toggles for keyframe curve mode (projector automation only)
646 CWindowCurveToggle *t_smooth, *t_linear;
649 class CWindowProjectorLeft : public BC_Button
652 CWindowProjectorLeft(MWindow *mwindow, CWindowProjectorGUI *gui,
656 CWindowProjectorGUI *gui;
659 class CWindowProjectorCenter : public BC_Button
662 CWindowProjectorCenter(MWindow *mwindow, CWindowProjectorGUI *gui,
666 CWindowProjectorGUI *gui;
669 class CWindowProjectorRight : public BC_Button
672 CWindowProjectorRight(MWindow *mwindow, CWindowProjectorGUI *gui,
676 CWindowProjectorGUI *gui;
679 class CWindowProjectorTop : public BC_Button
682 CWindowProjectorTop(MWindow *mwindow, CWindowProjectorGUI *gui,
686 CWindowProjectorGUI *gui;
689 class CWindowProjectorMiddle : public BC_Button
692 CWindowProjectorMiddle(MWindow *mwindow, CWindowProjectorGUI *gui,
696 CWindowProjectorGUI *gui;
699 class CWindowProjectorBottom : public BC_Button
702 CWindowProjectorBottom(MWindow *mwindow, CWindowProjectorGUI *gui,
706 CWindowProjectorGUI *gui;
712 class CWindowRulerGUI : public CWindowToolGUI
715 CWindowRulerGUI(MWindow *mwindow, CWindowTool *thread);
717 void create_objects();
726 BC_TextBox *distance;