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, float value, int logincrement);
97 CWindowCoord(CWindowToolGUI *gui, int x, int y, int value);
99 // Calls the window's handle_event
105 class CWindowCropOK : public BC_GenericButton
108 CWindowCropOK(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
109 // Perform the cropping operation
111 int keypress_event();
116 class CWindowCropGUI : public CWindowToolGUI
119 CWindowCropGUI(MWindow *mwindow, CWindowTool *thread);
121 void create_objects();
125 CWindowCoord *x1, *y1, *width, *height;
128 class CWindowMaskItems : public ArrayList<BC_ListBoxItem*>
131 CWindowMaskItems() {}
132 ~CWindowMaskItems() { remove_all_objects(); }
135 class CWindowMaskName : public BC_PopupTextBox
138 CWindowMaskName(MWindow *mwindow, CWindowToolGUI *gui, int x, int y, const char *text);
142 CWindowMaskItems mask_items;
145 void update_items(MaskAuto *keyframe);
148 class CWindowMaskFade : public BC_TumbleTextBox
151 CWindowMaskFade(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
154 int update_value(float v);
160 class CWindowMaskFadeSlider : public BC_ISlider
163 CWindowMaskFadeSlider(MWindow *mwindow, CWindowToolGUI *gui,
164 int x, int y, int w);
165 ~CWindowMaskFadeSlider();
167 int update(int64_t v);
168 char *get_caption() { return 0; }
173 class CWindowMaskMode : public BC_Toggle
176 CWindowMaskMode(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
183 class CWindowMaskDelMask : public BC_GenericButton
186 CWindowMaskDelMask(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
192 class CWindowMaskAffectedPoint : public BC_TumbleTextBox
195 CWindowMaskAffectedPoint(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
196 ~CWindowMaskAffectedPoint();
202 class CWindowMaskDelPoint : public BC_GenericButton
205 CWindowMaskDelPoint(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
207 int keypress_event();
212 class CWindowMaskFeather : public BC_TumbleTextBox
215 CWindowMaskFeather(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
216 ~CWindowMaskFeather();
218 int update_value(float v);
224 class CWindowMaskFeatherSlider : public BC_FSlider
227 CWindowMaskFeatherSlider(MWindow *mwindow, CWindowToolGUI *gui,
228 int x, int y, int w, float v);
229 ~CWindowMaskFeatherSlider();
232 char *get_caption() { return 0; }
237 class CWindowMaskClrMask : public BC_Button
240 CWindowMaskClrMask(MWindow *mwindow, CWindowMaskGUI *gui, int x, int y);
241 ~CWindowMaskClrMask();
242 static int calculate_w(MWindow *mwindow);
248 class CWindowMaskClrPoint : public BC_Button
251 CWindowMaskClrPoint(MWindow *mwindow, CWindowMaskGUI *gui, int x, int y);
252 ~CWindowMaskClrPoint();
259 class CWindowMaskBeforePlugins : public BC_CheckBox
262 CWindowMaskBeforePlugins(CWindowToolGUI *gui, int x, int y);
267 class CWindowDisableOpenGLMasking : public BC_CheckBox
270 CWindowDisableOpenGLMasking(CWindowToolGUI *gui, int x, int y);
275 class CWindowMaskGUI : public CWindowToolGUI
278 CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread);
280 void create_objects();
283 void get_keyframe(Track* &track, MaskAutos* &autos, MaskAuto* &keyframe,
284 SubMask* &mask, MaskPoint* &point, int create_it);
285 void update_preview();
287 CWindowMaskName *name;
288 CWindowMaskClrMask *clr_mask;
289 CWindowMaskDelMask *del_mask;
290 CWindowMaskFade *fade;
291 CWindowMaskFadeSlider *fade_slider;
292 CWindowMaskMode *mode;
293 CWindowMaskAffectedPoint *active_point;
294 CWindowMaskClrPoint *clr_point;
295 CWindowMaskDelPoint *del_point;
297 CWindowMaskFeather *feather;
298 CWindowMaskFeatherSlider *feather_slider;
299 CWindowMaskBeforePlugins *apply_before_plugins;
300 CWindowDisableOpenGLMasking *disable_opengl_masking;
304 class CWindowEyedropGUI : public CWindowToolGUI
307 CWindowEyedropGUI(MWindow *mwindow, CWindowTool *thread);
308 ~CWindowEyedropGUI();
311 void create_objects();
315 CWindowCoord *radius;
316 CWindowEyedropCheckBox *use_max;
317 BC_Title *red, *green, *blue, *y, *u, *v;
318 BC_Title *rgb_hex, *yuv_hex;
319 BC_SubWindow *sample;
323 class CWindowEyedropCheckBox : public BC_CheckBox
326 CWindowEyedropCheckBox(MWindow *mwindow,
327 CWindowEyedropGUI *gui,
333 CWindowEyedropGUI *gui;
338 class CWindowCameraGUI : public CWindowToolGUI
341 CWindowCameraGUI(MWindow *mwindow, CWindowTool *thread);
343 void create_objects();
345 void update_preview();
347 // Update the keyframe from text boxes
349 // BezierAuto* get_keyframe();
350 CWindowCoord *x, *y, *z;
352 // Toggles for keyframe curve mode (for camera automation only)
353 CWindowCurveToggle *t_smooth, *t_linear;
356 class CWindowCameraLeft : public BC_Button
359 CWindowCameraLeft(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
362 CWindowCameraGUI *gui;
365 class CWindowCameraCenter : public BC_Button
368 CWindowCameraCenter(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
371 CWindowCameraGUI *gui;
374 class CWindowCameraRight : public BC_Button
377 CWindowCameraRight(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
380 CWindowCameraGUI *gui;
383 class CWindowCameraTop : public BC_Button
386 CWindowCameraTop(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
389 CWindowCameraGUI *gui;
392 class CWindowCameraMiddle : public BC_Button
395 CWindowCameraMiddle(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
398 CWindowCameraGUI *gui;
401 class CWindowCameraBottom : public BC_Button
404 CWindowCameraBottom(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
407 CWindowCameraGUI *gui;
410 class CWindowProjectorGUI : public CWindowToolGUI
413 CWindowProjectorGUI(MWindow *mwindow, CWindowTool *thread);
414 ~CWindowProjectorGUI();
415 void create_objects();
417 void update_preview();
419 // BezierAuto* get_keyframe();
420 CWindowCoord *x, *y, *z;
422 // Toggles for keyframe curve mode (projector automation only)
423 CWindowCurveToggle *t_smooth, *t_linear;
426 class CWindowProjectorLeft : public BC_Button
429 CWindowProjectorLeft(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
432 CWindowProjectorGUI *gui;
435 class CWindowProjectorCenter : public BC_Button
438 CWindowProjectorCenter(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
441 CWindowProjectorGUI *gui;
444 class CWindowProjectorRight : public BC_Button
447 CWindowProjectorRight(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
450 CWindowProjectorGUI *gui;
453 class CWindowProjectorTop : public BC_Button
456 CWindowProjectorTop(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
459 CWindowProjectorGUI *gui;
462 class CWindowProjectorMiddle : public BC_Button
465 CWindowProjectorMiddle(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
468 CWindowProjectorGUI *gui;
471 class CWindowProjectorBottom : public BC_Button
474 CWindowProjectorBottom(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
477 CWindowProjectorGUI *gui;
483 class CWindowRulerGUI : public CWindowToolGUI
486 CWindowRulerGUI(MWindow *mwindow, CWindowTool *thread);
488 void create_objects();
497 BC_TextBox *distance;