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 CWindowMaskTrack : public BC_Title
134 CWindowMaskTrack(MWindow *mwindow, CWindowMaskGUI *gui,
135 int x, int y, const char *text);
141 class CWindowMaskItems : public ArrayList<BC_ListBoxItem*>
144 CWindowMaskItems() {}
145 ~CWindowMaskItems() { remove_all_objects(); }
148 class CWindowMaskName : public BC_PopupTextBox
151 CWindowMaskName(MWindow *mwindow, CWindowMaskGUI *gui,
152 int x, int y, const char *text);
156 CWindowMaskItems mask_items;
159 void update_items(MaskAuto *keyframe);
162 class CWindowMaskDelMask : public BC_GenericButton
165 CWindowMaskDelMask(MWindow *mwindow, CWindowToolGUI *gui,
172 class CWindowMaskClrMask : public BC_Button
175 CWindowMaskClrMask(MWindow *mwindow, CWindowMaskGUI *gui,
177 ~CWindowMaskClrMask();
178 static int calculate_w(MWindow *mwindow);
184 class CWindowMaskButton : public BC_CheckBox
187 CWindowMaskButton(MWindow *mwindow, CWindowMaskGUI *gui,
188 int x, int y, int no, int v);
189 ~CWindowMaskButton();
197 class CWindowMaskThumbler : public BC_Tumbler
200 CWindowMaskThumbler(MWindow *mwindow, CWindowMaskGUI *gui,
202 ~CWindowMaskThumbler();
203 int handle_up_event();
204 int handle_down_event();
205 int do_event(int dir);
211 class CWindowMaskFade : public BC_TumbleTextBox
214 CWindowMaskFade(MWindow *mwindow, CWindowToolGUI *gui,
218 int update_value(float v);
224 class CWindowMaskFadeSlider : public BC_ISlider
227 CWindowMaskFadeSlider(MWindow *mwindow, CWindowToolGUI *gui,
228 int x, int y, int w);
229 ~CWindowMaskFadeSlider();
231 int update(int64_t v);
232 char *get_caption() { return 0; }
240 class CWindowMaskGangFader : public BC_Toggle
243 CWindowMaskGangFader(MWindow *mwindow, CWindowToolGUI *gui,
245 ~CWindowMaskGangFader();
251 class CWindowMaskAffectedPoint : public BC_TumbleTextBox
254 CWindowMaskAffectedPoint(MWindow *mwindow, CWindowToolGUI *gui,
256 ~CWindowMaskAffectedPoint();
262 class CWindowMaskFocus : public BC_CheckBox
265 CWindowMaskFocus(MWindow *mwindow, CWindowToolGUI *gui,
273 class CWindowMaskDrawCenter : public BC_CheckBox
276 CWindowMaskDrawCenter(MWindow *mwindow, CWindowToolGUI *gui,
278 ~CWindowMaskDrawCenter();
284 class CWindowMaskDrawMarkers : public BC_CheckBox
287 CWindowMaskDrawMarkers(MWindow *mwindow, CWindowToolGUI *gui,
289 ~CWindowMaskDrawMarkers();
295 class CWindowMaskDrawBoundary : public BC_CheckBox
298 CWindowMaskDrawBoundary(MWindow *mwindow, CWindowToolGUI *gui,
300 ~CWindowMaskDrawBoundary();
306 class CWindowMaskDelPoint : public BC_GenericButton
309 CWindowMaskDelPoint(MWindow *mwindow, CWindowToolGUI *gui,
312 int keypress_event();
317 class CWindowMaskFeather : public BC_TumbleTextBox
320 CWindowMaskFeather(MWindow *mwindow, CWindowToolGUI *gui,
322 ~CWindowMaskFeather();
324 int update_value(float v);
330 class CWindowMaskFeatherSlider : public BC_FSlider
333 CWindowMaskFeatherSlider(MWindow *mwindow, CWindowToolGUI *gui,
334 int x, int y, int w, float v);
335 ~CWindowMaskFeatherSlider();
338 char *get_caption() { return 0; }
346 class CWindowMaskGangFeather : public BC_Toggle
349 CWindowMaskGangFeather(MWindow *mwindow, CWindowToolGUI *gui,
351 ~CWindowMaskGangFeather();
357 class CWindowMaskBeforePlugins : public BC_CheckBox
360 CWindowMaskBeforePlugins(CWindowToolGUI *gui,
366 class CWindowDisableOpenGLMasking : public BC_CheckBox
369 CWindowDisableOpenGLMasking(CWindowToolGUI *gui,
375 class CWindowMaskGUI : public CWindowToolGUI
378 CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread);
380 void create_objects();
382 void set_focused(int v, float cx, float cy);
383 void update_buttons(MaskAuto *keyframe, int k);
385 void get_keyframe(Track* &track, MaskAutos* &autos, MaskAuto* &keyframe,
386 SubMask* &mask, MaskPoint* &point, int create_it);
387 void update_preview();
389 CWindowMaskTrack *mask_track;
390 CWindowMaskName *name;
391 CWindowMaskButton *mask_buttons[SUBMASKS];
392 CWindowMaskThumbler *mask_thumbler;
393 BC_Title *mask_blabels[SUBMASKS];
394 CWindowMaskDelMask *del_mask;
395 CWindowMaskClrMask *clr_mask;
396 CWindowMaskFade *fade;
397 CWindowMaskFadeSlider *fade_slider;
398 CWindowMaskGangFader *gang_fader;
399 CWindowMaskAffectedPoint *active_point;
400 CWindowMaskDelPoint *del_point;
402 CWindowMaskFocus *focus;
404 CWindowMaskDrawCenter *draw_center;
406 CWindowMaskDrawMarkers *draw_markers;
408 CWindowMaskDrawBoundary *draw_boundary;
410 CWindowCoord *focus_x, *focus_y;
411 CWindowMaskFeather *feather;
412 CWindowMaskFeatherSlider *feather_slider;
413 CWindowMaskGangFeather *gang_feather;
414 CWindowMaskBeforePlugins *apply_before_plugins;
415 CWindowDisableOpenGLMasking *disable_opengl_masking;
419 class CWindowEyedropGUI : public CWindowToolGUI
422 CWindowEyedropGUI(MWindow *mwindow, CWindowTool *thread);
423 ~CWindowEyedropGUI();
426 void create_objects();
430 CWindowCoord *radius;
431 CWindowEyedropCheckBox *use_max;
432 BC_Title *red, *green, *blue, *y, *u, *v;
433 BC_Title *rgb_hex, *yuv_hex;
434 BC_SubWindow *sample;
438 class CWindowEyedropCheckBox : public BC_CheckBox
441 CWindowEyedropCheckBox(MWindow *mwindow,
442 CWindowEyedropGUI *gui,
448 CWindowEyedropGUI *gui;
453 class CWindowCameraGUI : public CWindowToolGUI
456 CWindowCameraGUI(MWindow *mwindow, CWindowTool *thread);
458 void create_objects();
460 void update_preview();
462 // Update the keyframe from text boxes
464 // BezierAuto* get_keyframe();
465 CWindowCoord *x, *y, *z;
467 // Toggles for keyframe curve mode (for camera automation only)
468 CWindowCurveToggle *t_smooth, *t_linear;
471 class CWindowCameraLeft : public BC_Button
474 CWindowCameraLeft(MWindow *mwindow, CWindowCameraGUI *gui,
478 CWindowCameraGUI *gui;
481 class CWindowCameraCenter : public BC_Button
484 CWindowCameraCenter(MWindow *mwindow, CWindowCameraGUI *gui,
488 CWindowCameraGUI *gui;
491 class CWindowCameraRight : public BC_Button
494 CWindowCameraRight(MWindow *mwindow, CWindowCameraGUI *gui,
498 CWindowCameraGUI *gui;
501 class CWindowCameraTop : public BC_Button
504 CWindowCameraTop(MWindow *mwindow, CWindowCameraGUI *gui,
508 CWindowCameraGUI *gui;
511 class CWindowCameraMiddle : public BC_Button
514 CWindowCameraMiddle(MWindow *mwindow, CWindowCameraGUI *gui,
518 CWindowCameraGUI *gui;
521 class CWindowCameraBottom : public BC_Button
524 CWindowCameraBottom(MWindow *mwindow, CWindowCameraGUI *gui,
528 CWindowCameraGUI *gui;
531 class CWindowProjectorGUI : public CWindowToolGUI
534 CWindowProjectorGUI(MWindow *mwindow, CWindowTool *thread);
535 ~CWindowProjectorGUI();
536 void create_objects();
538 void update_preview();
540 // BezierAuto* get_keyframe();
541 CWindowCoord *x, *y, *z;
543 // Toggles for keyframe curve mode (projector automation only)
544 CWindowCurveToggle *t_smooth, *t_linear;
547 class CWindowProjectorLeft : public BC_Button
550 CWindowProjectorLeft(MWindow *mwindow, CWindowProjectorGUI *gui,
554 CWindowProjectorGUI *gui;
557 class CWindowProjectorCenter : public BC_Button
560 CWindowProjectorCenter(MWindow *mwindow, CWindowProjectorGUI *gui,
564 CWindowProjectorGUI *gui;
567 class CWindowProjectorRight : public BC_Button
570 CWindowProjectorRight(MWindow *mwindow, CWindowProjectorGUI *gui,
574 CWindowProjectorGUI *gui;
577 class CWindowProjectorTop : public BC_Button
580 CWindowProjectorTop(MWindow *mwindow, CWindowProjectorGUI *gui,
584 CWindowProjectorGUI *gui;
587 class CWindowProjectorMiddle : public BC_Button
590 CWindowProjectorMiddle(MWindow *mwindow, CWindowProjectorGUI *gui,
594 CWindowProjectorGUI *gui;
597 class CWindowProjectorBottom : public BC_Button
600 CWindowProjectorBottom(MWindow *mwindow, CWindowProjectorGUI *gui,
604 CWindowProjectorGUI *gui;
610 class CWindowRulerGUI : public CWindowToolGUI
613 CWindowRulerGUI(MWindow *mwindow, CWindowTool *thread);
615 void create_objects();
624 BC_TextBox *distance;