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
28 #include "ctimebar.inc"
29 #include "cwindow.inc"
30 #include "cwindowtool.inc"
31 #include "editpanel.h"
32 #include "floatauto.inc"
33 #include "floatautos.inc"
35 #include "mainclock.inc"
36 #include "maskauto.inc"
37 #include "meterpanel.h"
38 #include "mwindow.inc"
39 #include "playtransport.h"
42 #include "zoompanel.h"
47 class CWindowDestination;
49 class CWindowTransport;
54 #define AUTO_ZOOM "Auto"
56 class CWindowGUI : public BC_Window
59 CWindowGUI(MWindow *mwindow, CWindow *cwindow);
62 void create_objects();
63 int resize_event(int w, int h);
65 // Events for the fullscreen canvas fall through to here.
66 int button_press_event();
67 int cursor_leave_event();
68 int cursor_enter_event();
69 int button_release_event();
70 int cursor_motion_event();
73 void zoom_canvas(int do_auto, double value, int update_menu);
77 int translation_event();
78 void set_operation(int value);
82 void draw_status(int flush);
83 // Zero out pointers to affected auto
84 void reset_affected();
85 void keyboard_zoomin();
86 void keyboard_zoomout();
91 CWindowEditing *edit_panel;
92 // APanel *automation_panel;
93 CPanel *composite_panel;
94 CWindowZoom *zoom_panel;
96 CWindowTransport *transport;
97 CWindowCanvas *canvas;
104 CWindowMeters *meters;
107 CWindowTool *tool_panel;
109 // Cursor motion modification being done
110 int current_operation;
111 // The pointers are only used for dragging. Information for tool windows
112 // must be integers and recalculted for every keypress.
113 // Track being modified in canvas
114 Track *affected_track;
115 // Transformation keyframe being modified
116 FloatAuto *affected_x;
117 FloatAuto *affected_y;
118 FloatAuto *affected_z;
119 // Pointer to mask keyframe being modified in the EDL
120 MaskAuto *mask_keyframe;
121 // Copy of original value of mask keyframe for keyframe spanning
122 MaskAuto *orig_mask_keyframe;
123 // Mask point being modified
125 // Scrollbar offsets during last button press relative to output
126 float x_offset, y_offset;
127 // Cursor location during the last button press relative to output
128 // and offset by scroll bars
129 float x_origin, y_origin;
130 // Crop handle being dragged
132 // If dragging crop translation
134 // Origin of crop handle during last button press
135 float crop_origin_x, crop_origin_y;
136 // Origin of all 4 crop points during last button press
137 float crop_origin_x1, crop_origin_y1;
138 float crop_origin_x2, crop_origin_y2;
139 // Center of last eyedrop drawing
140 int eyedrop_x, eyedrop_y;
143 float ruler_origin_x, ruler_origin_y;
147 // Origin for camera and projector operations during last button press
148 float center_x, center_y, center_z;
149 float control_in_x, control_in_y, control_out_x, control_out_y;
151 // Must recalculate the origin when pressing shift.
152 // Switch toggle on and off to recalculate origin.
153 int translating_zoom;
157 class CWindowEditing : public EditPanel
160 CWindowEditing(MWindow *mwindow, CWindow *cwindow);
161 virtual ~CWindowEditing() {}
163 void copy_selection();
164 void splice_selection();
165 void overwrite_selection();
168 void clear_inpoint();
169 void clear_outpoint();
182 class CWindowMeters : public MeterPanel
185 CWindowMeters(MWindow *mwindow, CWindowGUI *gui, int x, int y, int h);
186 virtual ~CWindowMeters();
188 int change_status_event(int new_status);
194 class CWindowZoom : public ZoomPanel
197 CWindowZoom(MWindow *mwindow, CWindowGUI *gui, int x, int y, int w);
198 virtual ~CWindowZoom();
205 class CWindowSlider : public BC_PercentageSlider
208 CWindowSlider(MWindow *mwindow, CWindow *cwindow, int x, int y, int pixels);
213 int increase_value();
214 int decrease_value();
220 class CWindowReset : public BC_Button
223 CWindowReset(MWindow *mwindow, CWindowGUI *cwindow, int x, int y);
230 // class CWindowDestination : public BC_PopupTextBox
233 // CWindowDestination(MWindow *mwindow, CWindowGUI *cwindow, int x, int y);
234 // ~CWindowDestination();
235 // int handle_event();
236 // CWindowGUI *cwindow;
240 class CWindowTransport : public PlayTransport
243 CWindowTransport(MWindow *mwindow,
255 class CWindowCanvas : public Canvas
258 CWindowCanvas(MWindow *mwindow, CWindowGUI *gui);
261 void zoom_resize_window(float percentage);
262 void update_zoom(int x, int y, float zoom);
266 int do_eyedrop(int &rerender, int button_press, int draw);
267 int do_mask(int &redraw,
272 void draw_refresh(int flash = 1);
273 void draw_overlays();
274 void draw_safe_regions();
275 // Cursor may have to be drawn
276 int cursor_leave_event();
277 int cursor_enter_event();
278 int cursor_motion_event();
279 int button_press_event();
280 int button_release_event();
281 int get_fullscreen();
282 void set_fullscreen(int value);
283 int test_crop(int button_press, int &redraw);
284 int test_bezier(int button_press,
289 int do_ruler(int draw, int motion, int button_press, int button_release);
290 int test_zoom(int &redraw);
292 void reset_projector();
293 void reset_keyframe(int do_camera);
294 void draw_crophandle(int x, int y);
297 // Draw the projector overlay in different colors.
298 void draw_bezier(int do_camera);
300 void calculate_origin();
301 void toggle_controls();
302 int get_cwindow_controls();