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 CWindowMaskHelp : public BC_CheckBox
340 CWindowMaskHelp(MWindow *mwindow, CWindowMaskGUI *gui,
348 class CWindowMaskDrawMarkers : public BC_CheckBox
351 CWindowMaskDrawMarkers(MWindow *mwindow, CWindowMaskGUI *gui,
353 ~CWindowMaskDrawMarkers();
359 class CWindowMaskDrawBoundary : public BC_CheckBox
362 CWindowMaskDrawBoundary(MWindow *mwindow, CWindowMaskGUI *gui,
364 ~CWindowMaskDrawBoundary();
370 class CWindowMaskDelPoint : public BC_GenericButton
373 CWindowMaskDelPoint(MWindow *mwindow, CWindowMaskGUI *gui,
376 int keypress_event();
381 class CWindowMaskFeather : public BC_TumbleTextBox
384 CWindowMaskFeather(MWindow *mwindow, CWindowMaskGUI *gui,
386 ~CWindowMaskFeather();
388 int update_value(float v);
394 class CWindowMaskFeatherSlider : public BC_FSlider
397 CWindowMaskFeatherSlider(MWindow *mwindow, CWindowMaskGUI *gui,
398 int x, int y, int w, float v);
399 ~CWindowMaskFeatherSlider();
402 char *get_caption() { return 0; }
410 class CWindowMaskGangFeather : public BC_Toggle
413 CWindowMaskGangFeather(MWindow *mwindow, CWindowMaskGUI *gui,
415 ~CWindowMaskGangFeather();
421 class CWindowMaskBeforePlugins : public BC_CheckBox
424 CWindowMaskBeforePlugins(CWindowMaskGUI *gui,
430 class CWindowDisableOpenGLMasking : public BC_CheckBox
433 CWindowDisableOpenGLMasking(CWindowMaskGUI *gui,
439 class CWindowMaskGUI : public CWindowToolGUI
442 CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread);
444 void create_objects();
448 void set_focused(int v, float cx, float cy);
449 void update_buttons(MaskAuto *keyframe, int k);
451 void get_keyframe(Track* &track, MaskAutos* &autos, MaskAuto* &keyframe,
452 SubMask* &mask, MaskPoint* &point, int create_it);
454 CWindowMaskOnTrack *mask_on_track;
455 CWindowMaskTrackTumbler *mask_track_tumbler;
456 CWindowMaskName *mask_name;
457 CWindowMaskButton *mask_buttons[SUBMASKS];
458 CWindowMaskThumbler *mask_thumbler;
459 BC_Title *mask_blabels[SUBMASKS];
460 CWindowMaskEnable *mask_enables[SUBMASKS];
461 CWindowMaskSoloTrack *mask_solo_track;
462 CWindowMaskDelMask *del_mask;
463 CWindowMaskUnclear *unclr_mask;
464 CWindowMaskClrMask *clr_mask;
465 CWindowMaskFade *fade;
466 CWindowMaskFadeSlider *fade_slider;
467 CWindowMaskGangFader *gang_fader;
468 CWindowMaskAffectedPoint *active_point;
469 CWindowMaskDelPoint *del_point;
471 CWindowMaskFocus *focus;
473 CWindowMaskHelp *help;
474 int helped, help_y, help_h;
475 CWindowMaskDrawMarkers *draw_markers;
477 CWindowMaskDrawBoundary *draw_boundary;
479 CWindowCoord *focus_x, *focus_y;
480 CWindowMaskFeather *feather;
481 CWindowMaskFeatherSlider *feather_slider;
482 CWindowMaskGangFeather *gang_feather;
483 CWindowMaskBeforePlugins *apply_before_plugins;
484 CWindowDisableOpenGLMasking *disable_opengl_masking;
488 class CWindowEyedropGUI : public CWindowToolGUI
491 CWindowEyedropGUI(MWindow *mwindow, CWindowTool *thread);
492 ~CWindowEyedropGUI();
495 void create_objects();
499 CWindowCoord *radius;
500 CWindowEyedropCheckBox *use_max;
501 BC_Title *red, *green, *blue, *y, *u, *v;
502 BC_Title *rgb_hex, *yuv_hex;
503 BC_SubWindow *sample;
507 class CWindowEyedropCheckBox : public BC_CheckBox
510 CWindowEyedropCheckBox(MWindow *mwindow,
511 CWindowEyedropGUI *gui,
517 CWindowEyedropGUI *gui;
522 class CWindowCameraGUI : public CWindowToolGUI
525 CWindowCameraGUI(MWindow *mwindow, CWindowTool *thread);
527 void create_objects();
530 // Update the keyframe from text boxes
532 // BezierAuto* get_keyframe();
533 CWindowCoord *x, *y, *z;
535 // Toggles for keyframe curve mode (for camera automation only)
536 CWindowCurveToggle *t_smooth, *t_linear;
539 class CWindowCameraLeft : public BC_Button
542 CWindowCameraLeft(MWindow *mwindow, CWindowCameraGUI *gui,
546 CWindowCameraGUI *gui;
549 class CWindowCameraCenter : public BC_Button
552 CWindowCameraCenter(MWindow *mwindow, CWindowCameraGUI *gui,
556 CWindowCameraGUI *gui;
559 class CWindowCameraRight : public BC_Button
562 CWindowCameraRight(MWindow *mwindow, CWindowCameraGUI *gui,
566 CWindowCameraGUI *gui;
569 class CWindowCameraTop : public BC_Button
572 CWindowCameraTop(MWindow *mwindow, CWindowCameraGUI *gui,
576 CWindowCameraGUI *gui;
579 class CWindowCameraMiddle : public BC_Button
582 CWindowCameraMiddle(MWindow *mwindow, CWindowCameraGUI *gui,
586 CWindowCameraGUI *gui;
589 class CWindowCameraBottom : public BC_Button
592 CWindowCameraBottom(MWindow *mwindow, CWindowCameraGUI *gui,
596 CWindowCameraGUI *gui;
599 class CWindowProjectorGUI : public CWindowToolGUI
602 CWindowProjectorGUI(MWindow *mwindow, CWindowTool *thread);
603 ~CWindowProjectorGUI();
604 void create_objects();
607 // BezierAuto* get_keyframe();
608 CWindowCoord *x, *y, *z;
610 // Toggles for keyframe curve mode (projector automation only)
611 CWindowCurveToggle *t_smooth, *t_linear;
614 class CWindowProjectorLeft : public BC_Button
617 CWindowProjectorLeft(MWindow *mwindow, CWindowProjectorGUI *gui,
621 CWindowProjectorGUI *gui;
624 class CWindowProjectorCenter : public BC_Button
627 CWindowProjectorCenter(MWindow *mwindow, CWindowProjectorGUI *gui,
631 CWindowProjectorGUI *gui;
634 class CWindowProjectorRight : public BC_Button
637 CWindowProjectorRight(MWindow *mwindow, CWindowProjectorGUI *gui,
641 CWindowProjectorGUI *gui;
644 class CWindowProjectorTop : public BC_Button
647 CWindowProjectorTop(MWindow *mwindow, CWindowProjectorGUI *gui,
651 CWindowProjectorGUI *gui;
654 class CWindowProjectorMiddle : public BC_Button
657 CWindowProjectorMiddle(MWindow *mwindow, CWindowProjectorGUI *gui,
661 CWindowProjectorGUI *gui;
664 class CWindowProjectorBottom : public BC_Button
667 CWindowProjectorBottom(MWindow *mwindow, CWindowProjectorGUI *gui,
671 CWindowProjectorGUI *gui;
677 class CWindowRulerGUI : public CWindowToolGUI
680 CWindowRulerGUI(MWindow *mwindow, CWindowTool *thread);
682 void create_objects();
691 BC_TextBox *distance;