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 "cwindowgui.inc"
31 #include "cwindowtool.inc"
32 #include "editpanel.h"
33 #include "floatauto.inc"
34 #include "floatautos.inc"
37 #include "mainclock.inc"
38 #include "maskauto.inc"
39 #include "meterpanel.h"
40 #include "mwindow.inc"
41 #include "playtransport.h"
44 #include "zoompanel.h"
47 #define AUTO_ZOOM N_("Auto")
49 #define CROP_REFORMAT 0
55 class CWindowGUI : public BC_Window
58 CWindowGUI(MWindow *mwindow, CWindow *cwindow);
61 void create_objects();
62 int resize_event(int w, int h);
63 void update_canvas(int redraw=1);
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();
74 int translation_event();
75 void set_operation(int value);
79 void draw_status(int flush);
80 // Zero out pointers to affected auto
81 void reset_affected();
82 void keyboard_zoomin();
83 void keyboard_zoomout();
85 void stop_transport(const char *lock_msg);
86 void sync_parameters(int change_type, int redraw=0, int overlay=0);
90 const char *auto_zoom;
91 CWindowEditing *edit_panel;
92 // APanel *automation_panel;
93 CPanel *composite_panel;
94 CWindowZoom *zoom_panel;
96 CWindowTransport *transport;
97 CWindowCanvas *canvas;
105 CWindowMeters *meters;
108 CWindowTool *tool_panel;
110 // Cursor motion modification being done
111 int current_operation;
112 // The pointers are only used for dragging. Information for tool windows
113 // must be integers and recalculted for every keypress.
114 // Track being modified in canvas
115 Track *affected_track;
116 // Transformation keyframe being modified
117 FloatAuto *affected_x;
118 FloatAuto *affected_y;
119 FloatAuto *affected_z;
120 // Pointer to mask keyframe being modified in the EDL
121 MaskAuto *mask_keyframe;
122 // Copy of original value of mask keyframe for keyframe spanning
123 MaskAuto *orig_mask_keyframe;
124 // Mask point being modified
126 // Scrollbar offsets during last button press relative to output
127 float x_offset, y_offset;
128 // Cursor location during the last button press relative to output
129 // and offset by scroll bars
130 float x_origin, y_origin;
131 // Crop handle being dragged
133 // If dragging crop translation
135 // Origin of crop handle during last button press
136 float crop_origin_x, crop_origin_y;
137 // Origin of all 4 crop points during last button press
138 float crop_origin_x1, crop_origin_y1;
139 float crop_origin_x2, crop_origin_y2;
140 // Center of last eyedrop drawing
141 int eyedrop_x, eyedrop_y;
144 float ruler_origin_x, ruler_origin_y;
148 // Origin for camera and projector operations during last button press
149 float center_x, center_y, center_z;
150 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;
158 class CWindowEditing : public EditPanel
161 CWindowEditing(MWindow *mwindow, CWindow *cwindow);
162 virtual ~CWindowEditing() {}
164 double get_position();
165 void set_position(double position);
166 void set_click_to_play(int v);
168 void panel_stop_transport();
169 void panel_toggle_label();
170 void panel_next_label(int cut);
171 void panel_prev_label(int cut);
172 void panel_prev_edit(int cut);
173 void panel_next_edit(int cut);
174 void panel_copy_selection();
175 void panel_overwrite_selection();
176 void panel_splice_selection();
177 void panel_set_inpoint();
178 void panel_set_outpoint();
179 void panel_unset_inoutpoint();
180 void panel_to_clip();
183 void panel_fit_selection();
184 void panel_fit_autos(int all);
185 void panel_set_editing_mode(int mode);
186 void panel_set_auto_keyframes(int v);
187 void panel_set_span_keyframes(int v);
188 void panel_set_labels_follow_edits(int v);
189 void panel_set_gang_tracks(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 CWindowTransport : public PlayTransport
248 CWindowTransport(MWindow *mwindow,
249 CWindowGUI *gui, int x, int y);
250 bool use_mixers() { return true; }
258 class CWindowCanvasToggleControls : public BC_MenuItem
261 CWindowCanvasToggleControls(CWindowCanvas *canvas);
263 static const char *calculate_text(int cwindow_controls);
264 CWindowCanvas *canvas;
267 class CWindowCanvas : public Canvas
270 CWindowCanvas(MWindow *mwindow, CWindowGUI *gui);
272 void create_objects(EDL *edl);
274 void zoom_resize_window(float percentage);
275 void update_zoom(int x, int y, float zoom);
280 int do_scroll(EDL *edl, float cursor_x, float cursor_y);
281 int do_eyedrop(int &rerender, int button_press, int draw);
282 int do_mask(int &redraw, int &rerender,
283 int button_press, int cursor_motion, int draw);
285 void draw_refresh(int flash = 1);
287 void draw_overlays();
288 void draw_safe_regions();
289 // Cursor may have to be drawn
290 int cursor_leave_event();
291 int cursor_enter_event();
292 int cursor_motion_event();
293 int button_press_event();
294 int button_release_event();
295 int test_crop(int button_press, int &redraw);
296 int test_bezier(int button_press,
297 int &redraw, int &redraw_canvas, int &rerender, int do_camera);
298 int do_ruler(int draw, int motion, int button_press, int button_release);
299 int test_zoom(int &redraw);
300 void create_keyframe(int do_camera);
301 void camera_keyframe();
302 void projector_keyframe();
303 void reset_keyframe(int do_camera);
305 void reset_projector();
306 void draw_crophandle(int x, int y);
307 int set_fullscreen(int on, int unlock);
309 void draw_scope(VFrame *output, int refresh);
311 // Draw the camera/projector overlay in different colors.
312 void draw_outlines(int do_camera);
314 void calculate_origin();
315 int get_clear_color();
317 void toggle_controls();
321 CWindowCanvasToggleControls *controls;
322 float last_xscroll, last_yscroll;