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 #define CROP_REFORMAT 0
63 class CWindowGUI : public BC_Window
66 CWindowGUI(MWindow *mwindow, CWindow *cwindow);
69 void create_objects();
70 int resize_event(int w, int h);
71 void zoom_canvas(double value, int update_menu);
72 float get_auto_zoom();
74 // Events for the fullscreen canvas fall through to here.
75 int button_press_event();
76 int cursor_leave_event();
77 int cursor_enter_event();
78 int button_release_event();
79 int cursor_motion_event();
83 int translation_event();
84 void set_operation(int value);
88 void draw_status(int flush);
89 // Zero out pointers to affected auto
90 void reset_affected();
91 void keyboard_zoomin();
92 void keyboard_zoomout();
94 void stop_transport(const char *lock_msg);
95 void sync_parameters(int change_type, int redraw=0, int overlay=0);
99 const char *auto_zoom;
100 CWindowEditing *edit_panel;
101 // APanel *automation_panel;
102 CPanel *composite_panel;
103 CWindowZoom *zoom_panel;
105 CWindowTransport *transport;
106 CWindowCanvas *canvas;
114 CWindowMeters *meters;
117 CWindowTool *tool_panel;
119 // Cursor motion modification being done
120 int current_operation;
121 // The pointers are only used for dragging. Information for tool windows
122 // must be integers and recalculted for every keypress.
123 // Track being modified in canvas
124 Track *affected_track;
125 // Transformation keyframe being modified
126 FloatAuto *affected_x;
127 FloatAuto *affected_y;
128 FloatAuto *affected_z;
129 // Pointer to mask keyframe being modified in the EDL
130 MaskAuto *mask_keyframe;
131 // Copy of original value of mask keyframe for keyframe spanning
132 MaskAuto *orig_mask_keyframe;
133 // Mask point being modified
135 // Scrollbar offsets during last button press relative to output
136 float x_offset, y_offset;
137 // Cursor location during the last button press relative to output
138 // and offset by scroll bars
139 float x_origin, y_origin;
140 // Crop handle being dragged
142 // If dragging crop translation
144 // Origin of crop handle during last button press
145 float crop_origin_x, crop_origin_y;
146 // Origin of all 4 crop points during last button press
147 float crop_origin_x1, crop_origin_y1;
148 float crop_origin_x2, crop_origin_y2;
149 // Center of last eyedrop drawing
150 int eyedrop_x, eyedrop_y;
153 float ruler_origin_x, ruler_origin_y;
157 // Origin for camera and projector operations during last button press
158 float center_x, center_y, center_z;
159 float control_in_x, control_in_y, control_out_x, control_out_y;
160 // Must recalculate the origin when pressing shift.
161 // Switch toggle on and off to recalculate origin.
162 int translating_zoom;
167 class CWindowEditing : public EditPanel
170 CWindowEditing(MWindow *mwindow, CWindow *cwindow);
171 virtual ~CWindowEditing() {}
173 double get_position();
174 void set_position(double position);
175 void set_click_to_play(int v);
177 void panel_stop_transport();
178 void panel_toggle_label();
179 void panel_next_label(int cut);
180 void panel_prev_label(int cut);
181 void panel_prev_edit(int cut);
182 void panel_next_edit(int cut);
183 void panel_copy_selection();
184 void panel_overwrite_selection();
185 void panel_splice_selection();
186 void panel_set_inpoint();
187 void panel_set_outpoint();
188 void panel_unset_inoutpoint();
189 void panel_to_clip();
192 void panel_fit_selection();
193 void panel_fit_autos(int all);
194 void panel_set_editing_mode(int mode);
195 void panel_set_auto_keyframes(int v);
196 void panel_set_span_keyframes(int v);
197 void panel_set_labels_follow_edits(int v);
204 class CWindowMeters : public MeterPanel
207 CWindowMeters(MWindow *mwindow, CWindowGUI *gui, int x, int y, int h);
208 virtual ~CWindowMeters();
210 int change_status_event(int new_status);
216 class CWindowZoom : public ZoomPanel
219 CWindowZoom(MWindow *mwindow, CWindowGUI *gui, int x, int y, int w);
220 virtual ~CWindowZoom();
222 void update(double value);
228 class CWindowSlider : public BC_PercentageSlider
231 CWindowSlider(MWindow *mwindow, CWindow *cwindow, int x, int y, int pixels);
236 int increase_value();
237 int decrease_value();
243 class CWindowReset : public BC_Button
246 CWindowReset(MWindow *mwindow, CWindowGUI *cwindow, int x, int y);
253 // class CWindowDestination : public BC_PopupTextBox
256 // CWindowDestination(MWindow *mwindow, CWindowGUI *cwindow, int x, int y);
257 // ~CWindowDestination();
258 // int handle_event();
259 // CWindowGUI *cwindow;
263 class CWindowTransport : public PlayTransport
266 CWindowTransport(MWindow *mwindow,
278 class CWindowCanvas : public Canvas
281 CWindowCanvas(MWindow *mwindow, CWindowGUI *gui);
284 void zoom_resize_window(float percentage);
285 void update_zoom(int x, int y, float zoom);
289 int do_eyedrop(int &rerender, int button_press, int draw);
290 int do_mask(int &redraw,
296 void draw_refresh(int flash = 1);
298 void draw_overlays();
299 void draw_safe_regions();
300 // Cursor may have to be drawn
301 int cursor_leave_event();
302 int cursor_enter_event();
303 int cursor_motion_event();
304 int button_press_event();
305 int button_release_event();
306 int test_crop(int button_press, int &redraw);
307 int test_bezier(int button_press,
312 int do_ruler(int draw, int motion, int button_press, int button_release);
313 int test_zoom(int &redraw);
314 void create_keyframe(int do_camera);
315 void camera_keyframe();
316 void projector_keyframe();
317 void reset_keyframe(int do_camera);
319 void reset_projector();
320 void draw_crophandle(int x, int y);
323 // Draw the camera/projector overlay in different colors.
324 void draw_outlines(int do_camera);
326 void calculate_origin();
327 void toggle_controls();
328 int get_cwindow_controls();
329 int get_clear_color();