span keyframes toggle, rect_audio tweaks, fix playbackengine clear output for audio...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / cwindowgui.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #ifndef CWINDOWGUI_H
23 #define CWINDOWGUI_H
24
25 #include "auto.inc"
26 #include "canvas.h"
27 #include "cpanel.inc"
28 #include "ctimebar.inc"
29 #include "cwindow.inc"
30 #include "cwindowtool.inc"
31 #include "editpanel.h"
32 #include "floatauto.inc"
33 #include "floatautos.inc"
34 #include "guicast.h"
35 #include "language.h"
36 #include "mainclock.inc"
37 #include "maskauto.inc"
38 #include "meterpanel.h"
39 #include "mwindow.inc"
40 #include "playtransport.h"
41 #include "thread.h"
42 #include "track.inc"
43 #include "zoompanel.h"
44
45 class CWindowZoom;
46 class CWindowSlider;
47 class CWindowReset;
48 class CWindowDestination;
49 class CWindowMeters;
50 class CWindowTransport;
51 class CWindowCanvas;
52 class CWindowEditing;
53
54
55 #define AUTO_ZOOM N_("Auto")
56
57 class CWindowGUI : public BC_Window
58 {
59 public:
60         CWindowGUI(MWindow *mwindow, CWindow *cwindow);
61         ~CWindowGUI();
62
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();
67
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();
74
75         int close_event();
76         int keypress_event();
77         int translation_event();
78         void set_operation(int value);
79         void update_tool();
80         void drag_motion();
81         int drag_stop();
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();
87         void update_meters();
88         void stop_transport(const char *lock_msg);
89         void sync_parameters(int change_type, int redraw=0, int overlay=0);
90
91         MWindow *mwindow;
92         CWindow *cwindow;
93         const char *auto_zoom;
94         CWindowEditing *edit_panel;
95 //      APanel *automation_panel;
96         CPanel *composite_panel;
97         CWindowZoom *zoom_panel;
98         CWindowReset *reset;
99         CWindowTransport *transport;
100         CWindowCanvas *canvas;
101         CTimeBar *timebar;
102         BC_Pixmap *active;
103         BC_Pixmap *inactive;
104         VFrame *focus_frame;
105 //      MainClock *clock;
106
107
108         CWindowMeters *meters;
109
110
111         CWindowTool *tool_panel;
112
113 // Cursor motion modification being done
114         int current_operation;
115 // The pointers are only used for dragging.  Information for tool windows
116 // must be integers and recalculted for every keypress.
117 // Track being modified in canvas
118         Track *affected_track;
119 // Transformation keyframe being modified
120         FloatAuto *affected_x;
121         FloatAuto *affected_y;
122         FloatAuto *affected_z;
123 // Pointer to mask keyframe being modified in the EDL
124         MaskAuto *mask_keyframe;
125 // Copy of original value of mask keyframe for keyframe spanning
126         MaskAuto *orig_mask_keyframe;
127 // Mask point being modified
128         int affected_point;
129 // Scrollbar offsets during last button press relative to output
130         float x_offset, y_offset;
131 // Cursor location during the last button press relative to output
132 // and offset by scroll bars
133         float x_origin, y_origin;
134 // Crop handle being dragged
135         int crop_handle;
136 // If dragging crop translation
137         int crop_translate;
138 // Origin of crop handle during last button press
139         float crop_origin_x, crop_origin_y;
140 // Origin of all 4 crop points during last button press
141         float crop_origin_x1, crop_origin_y1;
142         float crop_origin_x2, crop_origin_y2;
143 // Center of last eyedrop drawing
144         int eyedrop_x, eyedrop_y;
145         int eyedrop_visible;
146
147         float ruler_origin_x, ruler_origin_y;
148         int ruler_handle;
149         int ruler_translate;
150
151 // Origin for camera and projector operations during last button press
152         float center_x, center_y, center_z;
153         float control_in_x, control_in_y, control_out_x, control_out_y;
154 // Must recalculate the origin when pressing shift.
155 // Switch toggle on and off to recalculate origin.
156         int translating_zoom;
157         int highlighted;
158 };
159
160
161 class CWindowEditing : public EditPanel
162 {
163 public:
164         CWindowEditing(MWindow *mwindow, CWindow *cwindow);
165         virtual ~CWindowEditing() {}
166
167         double get_position();
168         void set_position(double position);
169         void set_click_to_play(int v);
170
171         void panel_stop_transport();
172         void panel_toggle_label();
173         void panel_next_label(int cut);
174         void panel_prev_label(int cut);
175         void panel_prev_edit(int cut);
176         void panel_next_edit(int cut);
177         void panel_copy_selection();
178         void panel_overwrite_selection();
179         void panel_splice_selection();
180         void panel_set_inpoint();
181         void panel_set_outpoint();
182         void panel_unset_inoutpoint();
183         void panel_to_clip();
184         void panel_cut();
185         void panel_paste();
186         void panel_fit_selection();
187         void panel_fit_autos(int all);
188         void panel_set_editing_mode(int mode);
189         void panel_set_auto_keyframes(int v);
190         void panel_set_span_keyframes(int v);
191         void panel_set_labels_follow_edits(int v);
192
193         MWindow *mwindow;
194         CWindow *cwindow;
195 };
196
197
198 class CWindowMeters : public MeterPanel
199 {
200 public:
201         CWindowMeters(MWindow *mwindow, CWindowGUI *gui, int x, int y, int h);
202         virtual ~CWindowMeters();
203
204         int change_status_event(int new_status);
205
206         MWindow *mwindow;
207         CWindowGUI *gui;
208 };
209
210 class CWindowZoom : public ZoomPanel
211 {
212 public:
213         CWindowZoom(MWindow *mwindow, CWindowGUI *gui, int x, int y, int w);
214         virtual ~CWindowZoom();
215         int handle_event();
216         void update(double value);
217         MWindow *mwindow;
218         CWindowGUI *gui;
219 };
220
221
222 class CWindowSlider : public BC_PercentageSlider
223 {
224 public:
225         CWindowSlider(MWindow *mwindow, CWindow *cwindow, int x, int y, int pixels);
226         ~CWindowSlider();
227
228         int handle_event();
229         void set_position();
230         int increase_value();
231         int decrease_value();
232
233         MWindow *mwindow;
234         CWindow *cwindow;
235 };
236
237 class CWindowReset : public BC_Button
238 {
239 public:
240         CWindowReset(MWindow *mwindow, CWindowGUI *cwindow, int x, int y);
241         ~CWindowReset();
242         int handle_event();
243         CWindowGUI *cwindow;
244         MWindow *mwindow;
245 };
246
247 // class CWindowDestination : public BC_PopupTextBox
248 // {
249 // public:
250 //      CWindowDestination(MWindow *mwindow, CWindowGUI *cwindow, int x, int y);
251 //      ~CWindowDestination();
252 //      int handle_event();
253 //      CWindowGUI *cwindow;
254 //      MWindow *mwindow;
255 // };
256
257 class CWindowTransport : public PlayTransport
258 {
259 public:
260         CWindowTransport(MWindow *mwindow,
261                 CWindowGUI *gui,
262                 int x,
263                 int y);
264         EDL* get_edl();
265         void goto_start();
266         void goto_end();
267
268         CWindowGUI *gui;
269 };
270
271
272 class CWindowCanvas : public Canvas
273 {
274 public:
275         CWindowCanvas(MWindow *mwindow, CWindowGUI *gui);
276
277         void status_event();
278         void zoom_resize_window(float percentage);
279         void update_zoom(int x, int y, float zoom);
280         int get_xscroll();
281         int get_yscroll();
282         float get_zoom();
283         int do_eyedrop(int &rerender, int button_press, int draw);
284         int do_mask(int &redraw,
285                 int &rerender,
286                 int button_press,
287                 int cursor_motion,
288                 int draw);
289         int do_mask_focus();
290         void draw_refresh(int flash = 1);
291         int need_overlays();
292         void draw_overlays();
293         void draw_safe_regions();
294 // Cursor may have to be drawn
295         int cursor_leave_event();
296         int cursor_enter_event();
297         int cursor_motion_event();
298         int button_press_event();
299         int button_release_event();
300         int test_crop(int button_press, int &redraw);
301         int test_bezier(int button_press,
302                 int &redraw,
303                 int &redraw_canvas,
304                 int &rerender,
305                 int do_camera);
306         int do_ruler(int draw, int motion, int button_press, int button_release);
307         int test_zoom(int &redraw);
308         void create_keyframe(int do_camera);
309         void camera_keyframe();
310         void projector_keyframe();
311         void reset_keyframe(int do_camera);
312         void reset_camera();
313         void reset_projector();
314         void draw_crophandle(int x, int y);
315         void zoom_auto();
316
317 // Draw the camera/projector overlay in different colors.
318         void draw_outlines(int do_camera);
319         void draw_crop();
320         void calculate_origin();
321         void toggle_controls();
322         int get_cwindow_controls();
323
324         MWindow *mwindow;
325         CWindowGUI *gui;
326 };
327
328 #endif