asset drag/drop to viewers, bluebanana bug, listbox fontlist highlight
[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
66 // Events for the fullscreen canvas fall through to here.
67         int button_press_event();
68         int cursor_leave_event();
69         int cursor_enter_event();
70         int button_release_event();
71         int cursor_motion_event();
72
73
74         void zoom_canvas(int do_auto, double value, int update_menu);
75
76         int close_event();
77         int keypress_event();
78         int translation_event();
79         void set_operation(int value);
80         void update_tool();
81         void drag_motion();
82         int drag_stop();
83         void draw_status(int flush);
84 // Zero out pointers to affected auto
85         void reset_affected();
86         void keyboard_zoomin();
87         void keyboard_zoomout();
88         void update_meters();
89
90         MWindow *mwindow;
91         CWindow *cwindow;
92         const char *auto_zoom;
93         CWindowEditing *edit_panel;
94 //      APanel *automation_panel;
95         CPanel *composite_panel;
96         CWindowZoom *zoom_panel;
97         CWindowReset *reset;
98         CWindowTransport *transport;
99         CWindowCanvas *canvas;
100         CTimeBar *timebar;
101         BC_Pixmap *active;
102         BC_Pixmap *inactive;
103 //      MainClock *clock;
104
105
106         CWindowMeters *meters;
107
108
109         CWindowTool *tool_panel;
110
111 // Cursor motion modification being done
112         int current_operation;
113 // The pointers are only used for dragging.  Information for tool windows
114 // must be integers and recalculted for every keypress.
115 // Track being modified in canvas
116         Track *affected_track;
117 // Transformation keyframe being modified
118         FloatAuto *affected_x;
119         FloatAuto *affected_y;
120         FloatAuto *affected_z;
121 // Pointer to mask keyframe being modified in the EDL
122         MaskAuto *mask_keyframe;
123 // Copy of original value of mask keyframe for keyframe spanning
124         MaskAuto *orig_mask_keyframe;
125 // Mask point being modified
126         int affected_point;
127 // Scrollbar offsets during last button press relative to output
128         float x_offset, y_offset;
129 // Cursor location during the last button press relative to output
130 // and offset by scroll bars
131         float x_origin, y_origin;
132 // Crop handle being dragged
133         int crop_handle;
134 // If dragging crop translation
135         int crop_translate;
136 // Origin of crop handle during last button press
137         float crop_origin_x, crop_origin_y;
138 // Origin of all 4 crop points during last button press
139         float crop_origin_x1, crop_origin_y1;
140         float crop_origin_x2, crop_origin_y2;
141 // Center of last eyedrop drawing
142         int eyedrop_x, eyedrop_y;
143         int eyedrop_visible;
144
145         float ruler_origin_x, ruler_origin_y;
146         int ruler_handle;
147         int ruler_translate;
148
149 // Origin for camera and projector operations during last button press
150         float center_x, center_y, center_z;
151         float control_in_x, control_in_y, control_out_x, control_out_y;
152         int current_tool;
153 // Must recalculate the origin when pressing shift.
154 // Switch toggle on and off to recalculate origin.
155         int translating_zoom;
156         int highlighted;
157 };
158
159
160 class CWindowEditing : public EditPanel
161 {
162 public:
163         CWindowEditing(MWindow *mwindow, CWindow *cwindow);
164         virtual ~CWindowEditing() {}
165
166         void copy_selection();
167         void splice_selection();
168         void overwrite_selection();
169         void set_inpoint();
170         void set_outpoint();
171         void clear_inpoint();
172         void clear_outpoint();
173         void to_clip();
174         void toggle_label();
175         void prev_label();
176         void next_label();
177         void prev_edit();
178         void next_edit();
179
180         MWindow *mwindow;
181         CWindow *cwindow;
182 };
183
184
185 class CWindowMeters : public MeterPanel
186 {
187 public:
188         CWindowMeters(MWindow *mwindow, CWindowGUI *gui, int x, int y, int h);
189         virtual ~CWindowMeters();
190
191         int change_status_event(int new_status);
192
193         MWindow *mwindow;
194         CWindowGUI *gui;
195 };
196
197 class CWindowZoom : public ZoomPanel
198 {
199 public:
200         CWindowZoom(MWindow *mwindow, CWindowGUI *gui, int x, int y, int w);
201         virtual ~CWindowZoom();
202         int handle_event();
203         MWindow *mwindow;
204         CWindowGUI *gui;
205 };
206
207
208 class CWindowSlider : public BC_PercentageSlider
209 {
210 public:
211         CWindowSlider(MWindow *mwindow, CWindow *cwindow, int x, int y, int pixels);
212         ~CWindowSlider();
213
214         int handle_event();
215         void set_position();
216         int increase_value();
217         int decrease_value();
218
219         MWindow *mwindow;
220         CWindow *cwindow;
221 };
222
223 class CWindowReset : public BC_Button
224 {
225 public:
226         CWindowReset(MWindow *mwindow, CWindowGUI *cwindow, int x, int y);
227         ~CWindowReset();
228         int handle_event();
229         CWindowGUI *cwindow;
230         MWindow *mwindow;
231 };
232
233 // class CWindowDestination : public BC_PopupTextBox
234 // {
235 // public:
236 //      CWindowDestination(MWindow *mwindow, CWindowGUI *cwindow, int x, int y);
237 //      ~CWindowDestination();
238 //      int handle_event();
239 //      CWindowGUI *cwindow;
240 //      MWindow *mwindow;
241 // };
242
243 class CWindowTransport : public PlayTransport
244 {
245 public:
246         CWindowTransport(MWindow *mwindow,
247                 CWindowGUI *gui,
248                 int x,
249                 int y);
250         EDL* get_edl();
251         void goto_start();
252         void goto_end();
253
254         CWindowGUI *gui;
255 };
256
257
258 class CWindowCanvas : public Canvas
259 {
260 public:
261         CWindowCanvas(MWindow *mwindow, CWindowGUI *gui);
262
263         void status_event();
264         void zoom_resize_window(float percentage);
265         void update_zoom(int x, int y, float zoom);
266         int get_xscroll();
267         int get_yscroll();
268         float get_zoom();
269         int do_eyedrop(int &rerender, int button_press, int draw);
270         int do_mask(int &redraw,
271                 int &rerender,
272                 int button_press,
273                 int cursor_motion,
274                 int draw);
275         void draw_refresh(int flash = 1);
276         void draw_overlays();
277         void draw_safe_regions();
278 // Cursor may have to be drawn
279         int cursor_leave_event();
280         int cursor_enter_event();
281         int cursor_motion_event();
282         int button_press_event();
283         int button_release_event();
284         int get_fullscreen();
285         void set_fullscreen(int value);
286         int test_crop(int button_press, int &redraw);
287         int test_bezier(int button_press,
288                 int &redraw,
289                 int &redraw_canvas,
290                 int &rerender,
291                 int do_camera);
292         int do_ruler(int draw, int motion, int button_press, int button_release);
293         int test_zoom(int &redraw);
294         void reset_camera();
295         void reset_projector();
296         void reset_keyframe(int do_camera);
297         void draw_crophandle(int x, int y);
298         void zoom_auto();
299
300 // Draw the projector overlay in different colors.
301         void draw_bezier(int do_camera);
302         void draw_crop();
303         void calculate_origin();
304         void toggle_controls();
305         int get_cwindow_controls();
306
307         MWindow *mwindow;
308         CWindowGUI *gui;
309 };
310
311 #endif