no longer need ffmpeg patch0 which was for Termux
[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 "cwindowgui.inc"
31 #include "cwindowtool.inc"
32 #include "editpanel.h"
33 #include "floatauto.inc"
34 #include "floatautos.inc"
35 #include "guicast.h"
36 #include "language.h"
37 #include "mainclock.inc"
38 #include "maskauto.inc"
39 #include "meterpanel.h"
40 #include "mwindow.inc"
41 #include "playtransport.h"
42 #include "thread.h"
43 #include "track.inc"
44 #include "zoompanel.h"
45
46
47 #define AUTO_ZOOM N_("Auto")
48
49 #define CROP_REFORMAT 0
50 #define CROP_RESIZE 1
51 #define CROP_SHRINK 2
52 #define CROP_MODES 3
53
54
55 class CWindowGUI : public BC_Window
56 {
57 public:
58         CWindowGUI(MWindow *mwindow, CWindow *cwindow);
59         ~CWindowGUI();
60
61         void create_objects();
62         int resize_event(int w, int h);
63         void update_canvas(int redraw=1);
64
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();
71
72         int close_event();
73         int keypress_event();
74         int translation_event();
75         void set_operation(int value);
76         void update_tool();
77         void drag_motion();
78         int drag_stop();
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();
84         void update_meters();
85         void stop_transport(const char *lock_msg);
86         void sync_parameters(int change_type, int redraw=0, int overlay=0);
87
88         MWindow *mwindow;
89         CWindow *cwindow;
90         const char *auto_zoom;
91         CWindowEditing *edit_panel;
92 //      APanel *automation_panel;
93         CPanel *composite_panel;
94         CWindowZoom *zoom_panel;
95         CWindowReset *reset;
96         CWindowTransport *transport;
97         CWindowCanvas *canvas;
98         CTimeBar *timebar;
99         BC_Pixmap *active;
100         BC_Pixmap *inactive;
101         VFrame *focus_frame;
102 //      MainClock *clock;
103
104
105         CWindowMeters *meters;
106
107
108         CWindowTool *tool_panel;
109
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
125         int affected_point;
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
132         int crop_handle;
133 // If dragging crop translation
134         int crop_translate;
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;
142         int eyedrop_visible;
143
144         float ruler_origin_x, ruler_origin_y;
145         int ruler_handle;
146         int ruler_translate;
147
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;
154         int highlighted;
155 };
156
157
158 class CWindowEditing : public EditPanel
159 {
160 public:
161         CWindowEditing(MWindow *mwindow, CWindow *cwindow);
162         virtual ~CWindowEditing() {}
163
164         double get_position();
165         void set_position(double position);
166         void set_click_to_play(int v);
167
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();
181         void panel_cut();
182         void panel_paste();
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);
190
191         MWindow *mwindow;
192         CWindow *cwindow;
193 };
194
195
196 class CWindowMeters : public MeterPanel
197 {
198 public:
199         CWindowMeters(MWindow *mwindow, CWindowGUI *gui, int x, int y, int h);
200         virtual ~CWindowMeters();
201
202         int change_status_event(int new_status);
203
204         MWindow *mwindow;
205         CWindowGUI *gui;
206 };
207
208 class CWindowZoom : public ZoomPanel
209 {
210 public:
211         CWindowZoom(MWindow *mwindow, CWindowGUI *gui, int x, int y, int w);
212         virtual ~CWindowZoom();
213         int handle_event();
214         void update(double value);
215         MWindow *mwindow;
216         CWindowGUI *gui;
217 };
218
219
220 class CWindowSlider : public BC_PercentageSlider
221 {
222 public:
223         CWindowSlider(MWindow *mwindow, CWindow *cwindow, int x, int y, int pixels);
224         ~CWindowSlider();
225
226         int handle_event();
227         void set_position();
228         int increase_value();
229         int decrease_value();
230
231         MWindow *mwindow;
232         CWindow *cwindow;
233 };
234
235 class CWindowReset : public BC_Button
236 {
237 public:
238         CWindowReset(MWindow *mwindow, CWindowGUI *cwindow, int x, int y);
239         ~CWindowReset();
240         int handle_event();
241         CWindowGUI *cwindow;
242         MWindow *mwindow;
243 };
244
245 class CWindowTransport : public PlayTransport
246 {
247 public:
248         CWindowTransport(MWindow *mwindow,
249                 CWindowGUI *gui, int x, int y);
250         bool use_mixers() { return true; }
251         EDL* get_edl();
252         void goto_start();
253         void goto_end();
254
255         CWindowGUI *gui;
256 };
257
258 class CWindowCanvasToggleControls : public BC_MenuItem
259 {
260 public:
261         CWindowCanvasToggleControls(CWindowCanvas *canvas);
262         int handle_event();
263         static const char *calculate_text(int cwindow_controls);
264         CWindowCanvas *canvas;
265 };
266
267 class CWindowCanvas : public Canvas
268 {
269 public:
270         CWindowCanvas(MWindow *mwindow, CWindowGUI *gui);
271
272         void create_objects(EDL *edl);
273         void status_event();
274         void zoom_resize_window(float percentage);
275         void update_zoom(int x, int y, float zoom);
276         int get_xscroll();
277         int get_yscroll();
278         float get_zoom();
279         void zoom_auto();
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);
284         int do_mask_focus();
285         void draw_refresh(int flash = 1);
286         int need_overlays();
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);
304         void reset_camera();
305         void reset_projector();
306         void draw_crophandle(int x, int y);
307         int set_fullscreen(int on, int unlock);
308         int scope_on();
309         void draw_scope(VFrame *output, int refresh);
310
311 // Draw the camera/projector overlay in different colors.
312         void draw_outlines(int do_camera);
313         void draw_crop();
314         void calculate_origin();
315         int get_clear_color();
316         int get_controls();
317         void toggle_controls();
318
319         MWindow *mwindow;
320         CWindowGUI *gui;
321         CWindowCanvasToggleControls *controls;
322         float last_xscroll, last_yscroll;
323         float last_zoom;
324 };
325
326 #endif