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"
36 #include "mainclock.inc"
37 #include "maskauto.inc"
38 #include "meterpanel.h"
39 #include "mwindow.inc"
40 #include "playtransport.h"
43 #include "zoompanel.h"
48 class CWindowDestination;
50 class CWindowTransport;
55 #define AUTO_ZOOM N_("Auto")
57 class CWindowGUI : public BC_Window
60 CWindowGUI(MWindow *mwindow, CWindow *cwindow);
63 void create_objects();
64 int resize_event(int w, int h);
65 void zoom_canvas(double value, int update_menu);
66 float get_auto_zoom();
68 // Events for the fullscreen canvas fall through to here.
69 int button_press_event();
70 int cursor_leave_event();
71 int cursor_enter_event();
72 int button_release_event();
73 int cursor_motion_event();
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();
88 void stop_transport(const char *lock_msg);
89 void sync_parameters(int change_type, int redraw=0, int overlay=0);
93 const char *auto_zoom;
94 CWindowEditing *edit_panel;
95 // APanel *automation_panel;
96 CPanel *composite_panel;
97 CWindowZoom *zoom_panel;
99 CWindowTransport *transport;
100 CWindowCanvas *canvas;
107 CWindowMeters *meters;
110 CWindowTool *tool_panel;
112 // Cursor motion modification being done
113 int current_operation;
114 // The pointers are only used for dragging. Information for tool windows
115 // must be integers and recalculted for every keypress.
116 // Track being modified in canvas
117 Track *affected_track;
118 // Transformation keyframe being modified
119 FloatAuto *affected_x;
120 FloatAuto *affected_y;
121 FloatAuto *affected_z;
122 // Pointer to mask keyframe being modified in the EDL
123 MaskAuto *mask_keyframe;
124 // Copy of original value of mask keyframe for keyframe spanning
125 MaskAuto *orig_mask_keyframe;
126 // Mask point being modified
128 // Scrollbar offsets during last button press relative to output
129 float x_offset, y_offset;
130 // Cursor location during the last button press relative to output
131 // and offset by scroll bars
132 float x_origin, y_origin;
133 // Crop handle being dragged
135 // If dragging crop translation
137 // Origin of crop handle during last button press
138 float crop_origin_x, crop_origin_y;
139 // Origin of all 4 crop points during last button press
140 float crop_origin_x1, crop_origin_y1;
141 float crop_origin_x2, crop_origin_y2;
142 // Center of last eyedrop drawing
143 int eyedrop_x, eyedrop_y;
146 float ruler_origin_x, ruler_origin_y;
150 // Origin for camera and projector operations during last button press
151 float center_x, center_y, center_z;
152 float control_in_x, control_in_y, control_out_x, control_out_y;
153 // Must recalculate the origin when pressing shift.
154 // Switch toggle on and off to recalculate origin.
155 int translating_zoom;
160 class CWindowEditing : public EditPanel
163 CWindowEditing(MWindow *mwindow, CWindow *cwindow);
164 virtual ~CWindowEditing() {}
166 double get_position();
167 void set_position(double position);
168 void set_click_to_play(int v);
170 void panel_stop_transport();
171 void panel_toggle_label();
172 void panel_next_label(int cut);
173 void panel_prev_label(int cut);
174 void panel_prev_edit(int cut);
175 void panel_next_edit(int cut);
176 void panel_copy_selection();
177 void panel_overwrite_selection();
178 void panel_splice_selection();
179 void panel_set_inpoint();
180 void panel_set_outpoint();
181 void panel_unset_inoutpoint();
182 void panel_to_clip();
185 void panel_fit_selection();
186 void panel_fit_autos(int all);
187 void panel_set_editing_mode(int mode);
188 void panel_set_auto_keyframes(int v);
189 void panel_set_labels_follow_edits(int v);
196 class CWindowMeters : public MeterPanel
199 CWindowMeters(MWindow *mwindow, CWindowGUI *gui, int x, int y, int h);
200 virtual ~CWindowMeters();
202 int change_status_event(int new_status);
208 class CWindowZoom : public ZoomPanel
211 CWindowZoom(MWindow *mwindow, CWindowGUI *gui, int x, int y, int w);
212 virtual ~CWindowZoom();
214 void update(double value);
220 class CWindowSlider : public BC_PercentageSlider
223 CWindowSlider(MWindow *mwindow, CWindow *cwindow, int x, int y, int pixels);
228 int increase_value();
229 int decrease_value();
235 class CWindowReset : public BC_Button
238 CWindowReset(MWindow *mwindow, CWindowGUI *cwindow, int x, int y);
245 // class CWindowDestination : public BC_PopupTextBox
248 // CWindowDestination(MWindow *mwindow, CWindowGUI *cwindow, int x, int y);
249 // ~CWindowDestination();
250 // int handle_event();
251 // CWindowGUI *cwindow;
255 class CWindowTransport : public PlayTransport
258 CWindowTransport(MWindow *mwindow,
270 class CWindowCanvas : public Canvas
273 CWindowCanvas(MWindow *mwindow, CWindowGUI *gui);
276 void zoom_resize_window(float percentage);
277 void update_zoom(int x, int y, float zoom);
281 int do_eyedrop(int &rerender, int button_press, int draw);
282 int do_mask(int &redraw,
287 void draw_refresh(int flash = 1);
289 void draw_overlays();
290 void draw_safe_regions();
291 // Cursor may have to be drawn
292 int cursor_leave_event();
293 int cursor_enter_event();
294 int cursor_motion_event();
295 int button_press_event();
296 int button_release_event();
297 int get_fullscreen();
298 void set_fullscreen(int value);
299 int test_crop(int button_press, int &redraw);
300 int test_bezier(int button_press,
305 int do_ruler(int draw, int motion, int button_press, int button_release);
306 int test_zoom(int &redraw);
307 void create_keyframe(int do_camera);
308 void camera_keyframe();
309 void projector_keyframe();
310 void reset_keyframe(int do_camera);
312 void reset_projector();
313 void draw_crophandle(int x, int y);
316 // Draw the projector overlay in different colors.
317 void draw_bezier(int do_camera);
319 void calculate_origin();
320 void toggle_controls();
321 int get_cwindow_controls();