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 CWindowMaskAffectedPoint : public BC_TumbleTextBox
318 CWindowMaskAffectedPoint(MWindow *mwindow, CWindowMaskGUI *gui,
320 ~CWindowMaskAffectedPoint();
326 class CWindowMaskFocus : public BC_CheckBox
329 CWindowMaskFocus(MWindow *mwindow, CWindowMaskGUI *gui,
337 class CWindowMaskDrawMarkers : public BC_CheckBox
340 CWindowMaskDrawMarkers(MWindow *mwindow, CWindowMaskGUI *gui,
342 ~CWindowMaskDrawMarkers();
348 class CWindowMaskDrawBoundary : public BC_CheckBox
351 CWindowMaskDrawBoundary(MWindow *mwindow, CWindowMaskGUI *gui,
353 ~CWindowMaskDrawBoundary();
359 class CWindowMaskDelPoint : public BC_GenericButton
362 CWindowMaskDelPoint(MWindow *mwindow, CWindowMaskGUI *gui,
365 int keypress_event();
370 class CWindowMaskFeather : public BC_TumbleTextBox
373 CWindowMaskFeather(MWindow *mwindow, CWindowMaskGUI *gui,
375 ~CWindowMaskFeather();
377 int update_value(float v);
383 class CWindowMaskFeatherSlider : public BC_FSlider
386 CWindowMaskFeatherSlider(MWindow *mwindow, CWindowMaskGUI *gui,
387 int x, int y, int w, float v);
388 ~CWindowMaskFeatherSlider();
391 char *get_caption() { return 0; }
399 class CWindowMaskGangFeather : public BC_Toggle
402 CWindowMaskGangFeather(MWindow *mwindow, CWindowMaskGUI *gui,
404 ~CWindowMaskGangFeather();
410 class CWindowMaskBeforePlugins : public BC_CheckBox
413 CWindowMaskBeforePlugins(CWindowMaskGUI *gui,
419 class CWindowDisableOpenGLMasking : public BC_CheckBox
422 CWindowDisableOpenGLMasking(CWindowMaskGUI *gui,
428 class CWindowMaskGUI : public CWindowToolGUI
431 CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread);
433 void create_objects();
437 void set_focused(int v, float cx, float cy);
438 void update_buttons(MaskAuto *keyframe, int k);
440 void get_keyframe(Track* &track, MaskAutos* &autos, MaskAuto* &keyframe,
441 SubMask* &mask, MaskPoint* &point, int create_it);
443 CWindowMaskOnTrack *mask_on_track;
444 CWindowMaskTrackTumbler *mask_track_tumbler;
445 CWindowMaskName *mask_name;
446 CWindowMaskButton *mask_buttons[SUBMASKS];
447 CWindowMaskThumbler *mask_thumbler;
448 BC_Title *mask_blabels[SUBMASKS];
449 CWindowMaskEnable *mask_enables[SUBMASKS];
450 CWindowMaskSoloTrack *mask_solo_track;
451 CWindowMaskDelMask *del_mask;
452 CWindowMaskUnclear *unclr_mask;
453 CWindowMaskClrMask *clr_mask;
454 CWindowMaskFade *fade;
455 CWindowMaskFadeSlider *fade_slider;
456 CWindowMaskGangFader *gang_fader;
457 CWindowMaskAffectedPoint *active_point;
458 CWindowMaskDelPoint *del_point;
460 CWindowMaskFocus *focus;
462 CWindowMaskDrawMarkers *draw_markers;
464 CWindowMaskDrawBoundary *draw_boundary;
466 CWindowCoord *focus_x, *focus_y;
467 CWindowMaskFeather *feather;
468 CWindowMaskFeatherSlider *feather_slider;
469 CWindowMaskGangFeather *gang_feather;
470 CWindowMaskBeforePlugins *apply_before_plugins;
471 CWindowDisableOpenGLMasking *disable_opengl_masking;
475 class CWindowEyedropGUI : public CWindowToolGUI
478 CWindowEyedropGUI(MWindow *mwindow, CWindowTool *thread);
479 ~CWindowEyedropGUI();
482 void create_objects();
486 CWindowCoord *radius;
487 CWindowEyedropCheckBox *use_max;
488 BC_Title *red, *green, *blue, *y, *u, *v;
489 BC_Title *rgb_hex, *yuv_hex;
490 BC_SubWindow *sample;
494 class CWindowEyedropCheckBox : public BC_CheckBox
497 CWindowEyedropCheckBox(MWindow *mwindow,
498 CWindowEyedropGUI *gui,
504 CWindowEyedropGUI *gui;
509 class CWindowCameraGUI : public CWindowToolGUI
512 CWindowCameraGUI(MWindow *mwindow, CWindowTool *thread);
514 void create_objects();
517 // Update the keyframe from text boxes
519 // BezierAuto* get_keyframe();
520 CWindowCoord *x, *y, *z;
522 // Toggles for keyframe curve mode (for camera automation only)
523 CWindowCurveToggle *t_smooth, *t_linear;
526 class CWindowCameraLeft : public BC_Button
529 CWindowCameraLeft(MWindow *mwindow, CWindowCameraGUI *gui,
533 CWindowCameraGUI *gui;
536 class CWindowCameraCenter : public BC_Button
539 CWindowCameraCenter(MWindow *mwindow, CWindowCameraGUI *gui,
543 CWindowCameraGUI *gui;
546 class CWindowCameraRight : public BC_Button
549 CWindowCameraRight(MWindow *mwindow, CWindowCameraGUI *gui,
553 CWindowCameraGUI *gui;
556 class CWindowCameraTop : public BC_Button
559 CWindowCameraTop(MWindow *mwindow, CWindowCameraGUI *gui,
563 CWindowCameraGUI *gui;
566 class CWindowCameraMiddle : public BC_Button
569 CWindowCameraMiddle(MWindow *mwindow, CWindowCameraGUI *gui,
573 CWindowCameraGUI *gui;
576 class CWindowCameraBottom : public BC_Button
579 CWindowCameraBottom(MWindow *mwindow, CWindowCameraGUI *gui,
583 CWindowCameraGUI *gui;
586 class CWindowProjectorGUI : public CWindowToolGUI
589 CWindowProjectorGUI(MWindow *mwindow, CWindowTool *thread);
590 ~CWindowProjectorGUI();
591 void create_objects();
594 // BezierAuto* get_keyframe();
595 CWindowCoord *x, *y, *z;
597 // Toggles for keyframe curve mode (projector automation only)
598 CWindowCurveToggle *t_smooth, *t_linear;
601 class CWindowProjectorLeft : public BC_Button
604 CWindowProjectorLeft(MWindow *mwindow, CWindowProjectorGUI *gui,
608 CWindowProjectorGUI *gui;
611 class CWindowProjectorCenter : public BC_Button
614 CWindowProjectorCenter(MWindow *mwindow, CWindowProjectorGUI *gui,
618 CWindowProjectorGUI *gui;
621 class CWindowProjectorRight : public BC_Button
624 CWindowProjectorRight(MWindow *mwindow, CWindowProjectorGUI *gui,
628 CWindowProjectorGUI *gui;
631 class CWindowProjectorTop : public BC_Button
634 CWindowProjectorTop(MWindow *mwindow, CWindowProjectorGUI *gui,
638 CWindowProjectorGUI *gui;
641 class CWindowProjectorMiddle : public BC_Button
644 CWindowProjectorMiddle(MWindow *mwindow, CWindowProjectorGUI *gui,
648 CWindowProjectorGUI *gui;
651 class CWindowProjectorBottom : public BC_Button
654 CWindowProjectorBottom(MWindow *mwindow, CWindowProjectorGUI *gui,
658 CWindowProjectorGUI *gui;
664 class CWindowRulerGUI : public CWindowToolGUI
667 CWindowRulerGUI(MWindow *mwindow, CWindowTool *thread);
669 void create_objects();
678 BC_TextBox *distance;