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);
362 void update_buttons(MaskAuto *keyframe, int k);
364 void get_keyframe(Track* &track, MaskAutos* &autos, MaskAuto* &keyframe,
365 SubMask* &mask, MaskPoint* &point, int create_it);
366 void update_preview();
368 CWindowMaskName *name;
369 CWindowMaskButton *mask_buttons[SUBMASKS];
370 CWindowMaskThumbler *mask_thumbler;
371 BC_Title *mask_blabels[SUBMASKS];
372 CWindowMaskDelMask *del_mask;
373 CWindowMaskClrMask *clr_mask;
374 CWindowMaskFade *fade;
375 CWindowMaskFadeSlider *fade_slider;
376 CWindowMaskGangFader *gang_fader;
377 CWindowMaskAffectedPoint *active_point;
378 CWindowMaskDelPoint *del_point;
380 CWindowMaskFocus *focus;
382 CWindowMaskDrawMarkers *draw_markers;
384 CWindowMaskDrawBoundary *draw_boundary;
386 CWindowCoord *focus_x, *focus_y;
387 CWindowMaskFeather *feather;
388 CWindowMaskFeatherSlider *feather_slider;
389 CWindowMaskGangFeather *gang_feather;
390 CWindowMaskBeforePlugins *apply_before_plugins;
391 CWindowDisableOpenGLMasking *disable_opengl_masking;
395 class CWindowEyedropGUI : public CWindowToolGUI
398 CWindowEyedropGUI(MWindow *mwindow, CWindowTool *thread);
399 ~CWindowEyedropGUI();
402 void create_objects();
406 CWindowCoord *radius;
407 CWindowEyedropCheckBox *use_max;
408 BC_Title *red, *green, *blue, *y, *u, *v;
409 BC_Title *rgb_hex, *yuv_hex;
410 BC_SubWindow *sample;
414 class CWindowEyedropCheckBox : public BC_CheckBox
417 CWindowEyedropCheckBox(MWindow *mwindow,
418 CWindowEyedropGUI *gui,
424 CWindowEyedropGUI *gui;
429 class CWindowCameraGUI : public CWindowToolGUI
432 CWindowCameraGUI(MWindow *mwindow, CWindowTool *thread);
434 void create_objects();
436 void update_preview();
438 // Update the keyframe from text boxes
440 // BezierAuto* get_keyframe();
441 CWindowCoord *x, *y, *z;
443 // Toggles for keyframe curve mode (for camera automation only)
444 CWindowCurveToggle *t_smooth, *t_linear;
447 class CWindowCameraLeft : public BC_Button
450 CWindowCameraLeft(MWindow *mwindow, CWindowCameraGUI *gui,
454 CWindowCameraGUI *gui;
457 class CWindowCameraCenter : public BC_Button
460 CWindowCameraCenter(MWindow *mwindow, CWindowCameraGUI *gui,
464 CWindowCameraGUI *gui;
467 class CWindowCameraRight : public BC_Button
470 CWindowCameraRight(MWindow *mwindow, CWindowCameraGUI *gui,
474 CWindowCameraGUI *gui;
477 class CWindowCameraTop : public BC_Button
480 CWindowCameraTop(MWindow *mwindow, CWindowCameraGUI *gui,
484 CWindowCameraGUI *gui;
487 class CWindowCameraMiddle : public BC_Button
490 CWindowCameraMiddle(MWindow *mwindow, CWindowCameraGUI *gui,
494 CWindowCameraGUI *gui;
497 class CWindowCameraBottom : public BC_Button
500 CWindowCameraBottom(MWindow *mwindow, CWindowCameraGUI *gui,
504 CWindowCameraGUI *gui;
507 class CWindowProjectorGUI : public CWindowToolGUI
510 CWindowProjectorGUI(MWindow *mwindow, CWindowTool *thread);
511 ~CWindowProjectorGUI();
512 void create_objects();
514 void update_preview();
516 // BezierAuto* get_keyframe();
517 CWindowCoord *x, *y, *z;
519 // Toggles for keyframe curve mode (projector automation only)
520 CWindowCurveToggle *t_smooth, *t_linear;
523 class CWindowProjectorLeft : public BC_Button
526 CWindowProjectorLeft(MWindow *mwindow, CWindowProjectorGUI *gui,
530 CWindowProjectorGUI *gui;
533 class CWindowProjectorCenter : public BC_Button
536 CWindowProjectorCenter(MWindow *mwindow, CWindowProjectorGUI *gui,
540 CWindowProjectorGUI *gui;
543 class CWindowProjectorRight : public BC_Button
546 CWindowProjectorRight(MWindow *mwindow, CWindowProjectorGUI *gui,
550 CWindowProjectorGUI *gui;
553 class CWindowProjectorTop : public BC_Button
556 CWindowProjectorTop(MWindow *mwindow, CWindowProjectorGUI *gui,
560 CWindowProjectorGUI *gui;
563 class CWindowProjectorMiddle : public BC_Button
566 CWindowProjectorMiddle(MWindow *mwindow, CWindowProjectorGUI *gui,
570 CWindowProjectorGUI *gui;
573 class CWindowProjectorBottom : public BC_Button
576 CWindowProjectorBottom(MWindow *mwindow, CWindowProjectorGUI *gui,
580 CWindowProjectorGUI *gui;
586 class CWindowRulerGUI : public CWindowToolGUI
589 CWindowRulerGUI(MWindow *mwindow, CWindowTool *thread);
591 void create_objects();
600 BC_TextBox *distance;