8ab72ac2c2a0bde800a7e0f442425ec86f32085d
[goodguy/history.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
89         MWindow *mwindow;
90         CWindow *cwindow;
91         const char *auto_zoom;
92         CWindowEditing *edit_panel;
93 //      APanel *automation_panel;
94         CPanel *composite_panel;
95         CWindowZoom *zoom_panel;
96         CWindowReset *reset;
97         CWindowTransport *transport;
98         CWindowCanvas *canvas;
99         CTimeBar *timebar;
100         BC_Pixmap *active;
101         BC_Pixmap *inactive;
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         void copy_selection();
165         void splice_selection();
166         void overwrite_selection();
167         void set_inpoint();
168         void set_outpoint();
169         void unset_inoutpoint();
170         void to_clip();
171         void toggle_label();
172         void prev_label();
173         void next_label();
174         void prev_edit();
175         void next_edit();
176
177         MWindow *mwindow;
178         CWindow *cwindow;
179 };
180
181
182 class CWindowMeters : public MeterPanel
183 {
184 public:
185         CWindowMeters(MWindow *mwindow, CWindowGUI *gui, int x, int y, int h);
186         virtual ~CWindowMeters();
187
188         int change_status_event(int new_status);
189
190         MWindow *mwindow;
191         CWindowGUI *gui;
192 };
193
194 class CWindowZoom : public ZoomPanel
195 {
196 public:
197         CWindowZoom(MWindow *mwindow, CWindowGUI *gui, int x, int y, int w);
198         virtual ~CWindowZoom();
199         int handle_event();
200         void update(double value);
201         MWindow *mwindow;
202         CWindowGUI *gui;
203 };
204
205
206 class CWindowSlider : public BC_PercentageSlider
207 {
208 public:
209         CWindowSlider(MWindow *mwindow, CWindow *cwindow, int x, int y, int pixels);
210         ~CWindowSlider();
211
212         int handle_event();
213         void set_position();
214         int increase_value();
215         int decrease_value();
216
217         MWindow *mwindow;
218         CWindow *cwindow;
219 };
220
221 class CWindowReset : public BC_Button
222 {
223 public:
224         CWindowReset(MWindow *mwindow, CWindowGUI *cwindow, int x, int y);
225         ~CWindowReset();
226         int handle_event();
227         CWindowGUI *cwindow;
228         MWindow *mwindow;
229 };
230
231 // class CWindowDestination : public BC_PopupTextBox
232 // {
233 // public:
234 //      CWindowDestination(MWindow *mwindow, CWindowGUI *cwindow, int x, int y);
235 //      ~CWindowDestination();
236 //      int handle_event();
237 //      CWindowGUI *cwindow;
238 //      MWindow *mwindow;
239 // };
240
241 class CWindowTransport : public PlayTransport
242 {
243 public:
244         CWindowTransport(MWindow *mwindow,
245                 CWindowGUI *gui,
246                 int x,
247                 int y);
248         EDL* get_edl();
249         void goto_start();
250         void goto_end();
251
252         CWindowGUI *gui;
253 };
254
255
256 class CWindowCanvas : public Canvas
257 {
258 public:
259         CWindowCanvas(MWindow *mwindow, CWindowGUI *gui);
260
261         void status_event();
262         void zoom_resize_window(float percentage);
263         void update_zoom(int x, int y, float zoom);
264         int get_xscroll();
265         int get_yscroll();
266         float get_zoom();
267         int do_eyedrop(int &rerender, int button_press, int draw);
268         int do_mask(int &redraw,
269                 int &rerender,
270                 int button_press,
271                 int cursor_motion,
272                 int draw);
273         void draw_refresh(int flash = 1);
274         void draw_overlays();
275         void draw_safe_regions();
276 // Cursor may have to be drawn
277         int cursor_leave_event();
278         int cursor_enter_event();
279         int cursor_motion_event();
280         int button_press_event();
281         int button_release_event();
282         int get_fullscreen();
283         void set_fullscreen(int value);
284         int test_crop(int button_press, int &redraw);
285         int test_bezier(int button_press,
286                 int &redraw,
287                 int &redraw_canvas,
288                 int &rerender,
289                 int do_camera);
290         int do_ruler(int draw, int motion, int button_press, int button_release);
291         int test_zoom(int &redraw);
292         void reset_camera();
293         void reset_projector();
294         void reset_keyframe(int do_camera);
295         void draw_crophandle(int x, int y);
296         void zoom_auto();
297
298 // Draw the projector overlay in different colors.
299         void draw_bezier(int do_camera);
300         void draw_crop();
301         void calculate_origin();
302         void toggle_controls();
303         int get_cwindow_controls();
304
305         MWindow *mwindow;
306         CWindowGUI *gui;
307 };
308
309 #endif