no longer need ffmpeg patch0 which was for Termux
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / editpanel.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * Copyright (C) 2003-2016 Cinelerra CV contributors
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  *
21  */
22
23 #ifndef EDITPANEL_H
24 #define EDITPANEL_H
25
26 #include "bcdialog.h"
27 #include "guicast.h"
28 #include "editpanel.inc"
29 #include "localsession.inc"
30 #include "meterpanel.inc"
31 #include "mwindow.inc"
32 #include "manualgoto.inc"
33 #include "scopewindow.h"
34
35
36
37 class EditPanel;
38
39
40 class EditInPoint : public BC_Button
41 {
42 public:
43         EditInPoint(MWindow *mwindow, EditPanel *panel, int x, int y);
44         ~EditInPoint();
45         int handle_event();
46         int keypress_event();
47         MWindow *mwindow;
48         EditPanel *panel;
49 };
50
51 class EditOutPoint : public BC_Button
52 {
53 public:
54         EditOutPoint(MWindow *mwindow, EditPanel *panel, int x, int y);
55         ~EditOutPoint();
56         int handle_event();
57         int keypress_event();
58         MWindow *mwindow;
59         EditPanel *panel;
60 };
61
62 class EditDelInPoint : public BC_Button
63 {
64 public:
65         EditDelInPoint(MWindow *mwindow, EditPanel *panel, int x, int y);
66         ~EditDelInPoint();
67         int handle_event();
68         int keypress_event();
69         MWindow *mwindow;
70         EditPanel *panel;
71 };
72
73 class EditDelOutPoint : public BC_Button
74 {
75 public:
76         EditDelOutPoint(MWindow *mwindow, EditPanel *panel, int x, int y);
77         ~EditDelOutPoint();
78         int handle_event();
79         int keypress_event();
80         MWindow *mwindow;
81         EditPanel *panel;
82 };
83
84 class EditSplice : public BC_Button
85 {
86 public:
87         EditSplice(MWindow *mwindow, EditPanel *panel, int x, int y);
88         ~EditSplice();
89         int handle_event();
90         int keypress_event();
91         MWindow *mwindow;
92         EditPanel *panel;
93 };
94
95 class EditOverwrite : public BC_Button
96 {
97 public:
98         EditOverwrite(MWindow *mwindow, EditPanel *panel, int x, int y);
99         ~EditOverwrite();
100         int handle_event();
101         int keypress_event();
102         MWindow *mwindow;
103         EditPanel *panel;
104 };
105
106 class EditToClip : public BC_Button
107 {
108 public:
109         EditToClip(MWindow *mwindow, EditPanel *panel, int x, int y);
110         ~EditToClip();
111         int handle_event();
112         int keypress_event();
113         MWindow *mwindow;
114         EditPanel *panel;
115 };
116
117 class EditManualGoto : public BC_Button
118 {
119 public:
120         EditManualGoto(MWindow *mwindow, EditPanel *panel, int x, int y);
121         ~EditManualGoto();
122         int handle_event();
123         int keypress_event();
124         MWindow *mwindow;
125         EditPanel *panel;
126         ManualGoto *mangoto;
127 };
128
129 class EditCut : public BC_Button
130 {
131 public:
132         EditCut(MWindow *mwindow, EditPanel *panel, int x, int y);
133         ~EditCut();
134
135         int keypress_event();
136         int handle_event();
137
138         MWindow *mwindow;
139         EditPanel *panel;
140 };
141
142 class EditCommercial : public BC_Button
143 {
144 public:
145         EditCommercial(MWindow *mwindow, EditPanel *panel, int x, int y);
146         ~EditCommercial();
147
148         int keypress_event();
149         int handle_event();
150
151         MWindow *mwindow;
152         EditPanel *panel;
153 };
154
155 class EditClick2Play : public BC_Toggle
156 {
157 public:
158         EditClick2Play(MWindow *mwindow, EditPanel *panel, int x, int y);
159         EditClick2Play();
160
161         int handle_event();
162         int keypress_event();
163
164         MWindow *mwindow;
165         EditPanel *panel;
166 };
167
168 class EditCopy : public BC_Button
169 {
170 public:
171         EditCopy(MWindow *mwindow, EditPanel *panel, int x, int y);
172         ~EditCopy();
173
174         int keypress_event();
175         int handle_event();
176
177         MWindow *mwindow;
178         EditPanel *panel;
179 };
180
181 class EditPaste : public BC_Button
182 {
183 public:
184         EditPaste(MWindow *mwindow, EditPanel *panel, int x, int y);
185         ~EditPaste();
186
187         int keypress_event();
188         int handle_event();
189
190         MWindow *mwindow;
191         EditPanel *panel;
192 };
193
194 class EditUndo : public BC_Button
195 {
196 public:
197         EditUndo(MWindow *mwindow, EditPanel *panel, int x, int y);
198         ~EditUndo();
199         int keypress_event();
200         int handle_event();
201         MWindow *mwindow;
202         EditPanel *panel;
203 };
204
205 class EditRedo : public BC_Button
206 {
207 public:
208         EditRedo(MWindow *mwindow, EditPanel *panel, int x, int y);
209         ~EditRedo();
210         int keypress_event();
211         int handle_event();
212         MWindow *mwindow;
213         EditPanel *panel;
214 };
215
216 class EditLabelbutton : public BC_Button
217 {
218 public:
219         EditLabelbutton(MWindow *mwindow, EditPanel *panel, int x, int y);
220         ~EditLabelbutton();
221         int keypress_event();
222         int handle_event();
223         MWindow *mwindow;
224         EditPanel *panel;
225 };
226
227 class EditFit : public BC_Button
228 {
229 public:
230         EditFit(MWindow *mwindow, EditPanel *panel, int x, int y);
231         ~EditFit();
232         int keypress_event();
233         int handle_event();
234         MWindow *mwindow;
235         EditPanel *panel;
236 };
237
238 class EditFitAutos : public BC_Button
239 {
240 public:
241         EditFitAutos(MWindow *mwindow, EditPanel *panel, int x, int y);
242         ~EditFitAutos();
243         int keypress_event();
244         int handle_event();
245         MWindow *mwindow;
246         EditPanel *panel;
247 };
248
249
250 class EditPrevLabel : public BC_Button
251 {
252 public:
253         EditPrevLabel(MWindow *mwindow, EditPanel *panel, int x, int y);
254         ~EditPrevLabel();
255
256         int keypress_event();
257         int handle_event();
258
259         MWindow *mwindow;
260         EditPanel *panel;
261 };
262
263 class EditNextLabel : public BC_Button
264 {
265 public:
266         EditNextLabel(MWindow *mwindow, EditPanel *panel, int x, int y);
267         ~EditNextLabel();
268
269         int keypress_event();
270         int handle_event();
271
272         MWindow *mwindow;
273         EditPanel *panel;
274 };
275
276 class EditPrevEdit : public BC_Button
277 {
278 public:
279         EditPrevEdit(MWindow *mwindow, EditPanel *panel, int x, int y);
280         ~EditPrevEdit();
281
282         int keypress_event();
283         int handle_event();
284
285         MWindow *mwindow;
286         EditPanel *panel;
287 };
288
289 class EditNextEdit : public BC_Button
290 {
291 public:
292         EditNextEdit(MWindow *mwindow, EditPanel *panel, int x, int y);
293         ~EditNextEdit();
294
295         int keypress_event();
296         int handle_event();
297
298         MWindow *mwindow;
299         EditPanel *panel;
300 };
301
302
303 class ArrowButton : public BC_Toggle
304 {
305 public:
306         ArrowButton(MWindow *mwindow, EditPanel *panel, int x, int y);
307         int handle_event();
308         MWindow *mwindow;
309         EditPanel *panel;
310 };
311
312 class IBeamButton : public BC_Toggle
313 {
314 public:
315         IBeamButton(MWindow *mwindow, EditPanel *panel, int x, int y);
316         int handle_event();
317         MWindow *mwindow;
318         EditPanel *panel;
319 };
320
321 class KeyFrameButton : public BC_Toggle
322 {
323 public:
324         KeyFrameButton(MWindow *mwindow, EditPanel *panel, int x, int y);
325         int handle_event();
326         int keypress_event();
327         MWindow *mwindow;
328         EditPanel *panel;
329 };
330
331 class SpanKeyFrameButton : public BC_Toggle
332 {
333 public:
334         SpanKeyFrameButton(MWindow *mwindow, EditPanel *panel, int x, int y);
335         int handle_event();
336         MWindow *mwindow;
337         EditPanel *panel;
338 };
339
340 class LockLabelsButton : public BC_Toggle
341 {
342 public:
343         LockLabelsButton(MWindow *mwindow, EditPanel *panel, int x, int y);
344         int handle_event();
345         MWindow *mwindow;
346         EditPanel *panel;
347 };
348
349
350 class EditPanelScopeGUI : public ScopeGUI
351 {
352 public:
353         EditPanelScopeGUI(MWindow *mwindow, EditPanelScopeDialog *dialog);
354         ~EditPanelScopeGUI();
355
356         void create_objects();
357         void toggle_event();
358         int translation_event();
359         int resize_event(int w, int h);
360         void update_scope();
361
362         MWindow *mwindow;
363         EditPanelScopeDialog *dialog;
364 };
365
366 class EditPanelScopeDialog : public BC_DialogThread
367 {
368 public:
369         EditPanelScopeDialog(MWindow *mwindow, EditPanel *panel);
370         ~EditPanelScopeDialog();
371
372         void handle_close_event(int result);
373         void handle_done_event(int result);
374         BC_Window* new_gui();
375         void process(VFrame *output_frame);
376
377         MWindow *mwindow;
378         EditPanel *panel;
379         EditPanelScopeGUI *scope_gui;
380         Mutex *gui_lock;
381         VFrame *output_frame;
382 };
383
384 class EditPanelGangTracks : public BC_Button
385 {
386         static VFrame **gang_images[TOTAL_GANGS];
387         static const char *gang_tips[TOTAL_GANGS];
388 public:
389         EditPanelGangTracks(MWindow *mwindow, EditPanel *panel, int x, int y);
390         ~EditPanelGangTracks();
391         VFrame **get_images(MWindow *mwindow);
392         void update(int gang);
393         int handle_event();
394         EditPanel *panel;
395         MWindow *mwindow;
396 };
397
398
399 class EditPanelScope : public BC_Toggle
400 {
401 public:
402         EditPanelScope(MWindow *mwindow, EditPanel *panel, int x, int y);
403         ~EditPanelScope();
404         int handle_event();
405         EditPanel *panel;
406         MWindow *mwindow;
407 };
408
409 class EditPanelTimecode : public BC_Button
410 {
411 public:
412         EditPanelTimecode(MWindow *mwindow, EditPanel *panel, int x, int y);
413         ~EditPanelTimecode();
414         int handle_event();
415         MWindow *mwindow;
416         EditPanel *panel;
417         EditPanelTcDialog *tc_dialog;
418 };
419
420 class EditPanelTcDialog : public BC_DialogThread
421 {
422 public:
423         EditPanelTcDialog(MWindow *mwindow, EditPanel *panel);
424         ~EditPanelTcDialog();
425         BC_Window *new_gui();
426         void start_dialog(int px, int py);
427         void handle_done_event(int result);
428
429         MWindow *mwindow;
430         EditPanel *panel;
431         EditPanelTcWindow *tc_gui;
432         int px, py;
433 };
434
435 class EditPanelTcWindow : public BC_Window
436 {
437 public:
438         EditPanelTcWindow(EditPanelTcDialog *tc_dialog, int x, int y);
439         ~EditPanelTcWindow();
440         void create_objects();
441         double get_timecode();
442         void update(double timecode);
443
444         EditPanelTcDialog *tc_dialog;
445         EditPanelTcInt *hours;
446         EditPanelTcInt *minutes;
447         EditPanelTcInt *seconds;
448         EditPanelTcInt *frames;
449 };
450
451 class EditPanelTcInt : public BC_TextBox
452 {
453 public:
454         EditPanelTcInt(EditPanelTcWindow *window, int x, int y, int w,
455                 int max, const char *format);
456         ~EditPanelTcInt();
457         int handle_event();
458         int keypress_event();
459         void update(int v);
460
461         EditPanelTcWindow *window;
462         int max, digits;
463         const char *format;
464 };
465
466 class EditPanelTcReset : public BC_Button
467 {
468 public:
469         EditPanelTcReset(EditPanelTcWindow *window, int x, int y);
470         int handle_event();
471
472         EditPanelTcWindow *window;
473 };
474
475 class EditPanel
476 {
477 public:
478         EditPanel(MWindow *mwindow, BC_WindowBase *subwindow,
479                 int window_id, int x, int y,
480                 int editing_mode,   // From edl.inc
481                 int use_editing_mode,
482                 int use_keyframe,
483                 int use_splice,   // Extra buttons
484                 int use_overwrite,
485                 int use_copy,  // Use copy when in EDITING_ARROW
486                 int use_paste,
487                 int use_undo,
488                 int use_fit,
489                 int use_locklabels,
490                 int use_labels,
491                 int use_toclip,
492                 int use_meters,
493                 int use_cut,
494                 int use_commerical,
495                 int use_goto,
496                 int use_clk2play,
497                 int use_scope,
498                 int use_gang_tracks,
499                 int use_timecode);
500         ~EditPanel();
501
502         void set_meters(MeterPanel *meter_panel);
503         static int calculate_w(MWindow *mwindow, int use_keyframe, int total_buttons);
504         static int calculate_h(MWindow *mwindow);
505         void update();
506         void create_buttons();
507         void stop_transport(const char *lock_msg);
508         void reposition_buttons(int x, int y);
509         void create_objects();
510         int get_w();
511
512         virtual double get_position() = 0;
513         virtual void set_position(double position) = 0;
514         virtual void set_click_to_play(int v) = 0;
515
516         virtual void panel_stop_transport() = 0;
517         virtual void panel_toggle_label() = 0;
518         virtual void panel_next_label(int cut) = 0;
519         virtual void panel_prev_label(int cut) = 0;
520         virtual void panel_prev_edit(int cut) = 0;
521         virtual void panel_next_edit(int cut) = 0;
522         virtual void panel_copy_selection() = 0;
523         virtual void panel_overwrite_selection() = 0;
524         virtual void panel_splice_selection() = 0;
525         virtual void panel_set_inpoint() = 0;
526         virtual void panel_set_outpoint() = 0;
527         virtual void panel_unset_inoutpoint() = 0;
528         virtual void panel_to_clip() = 0;
529         virtual void panel_cut() = 0;
530         virtual void panel_paste() = 0;
531         virtual void panel_fit_selection() = 0;
532         virtual void panel_fit_autos(int all) = 0;
533         virtual void panel_set_editing_mode(int mode) = 0;
534         virtual void panel_set_auto_keyframes(int v) = 0;
535         virtual void panel_set_span_keyframes(int v) = 0;
536         virtual void panel_set_labels_follow_edits(int v) = 0;
537         virtual void panel_set_gang_tracks(int mode) = 0;
538
539         MWindow *mwindow;
540         BC_WindowBase *subwindow;
541         MeterPanel *meter_panel;
542
543         int window_id;
544         int x, y, x1, y1;
545         int editing_mode;
546         int use_editing_mode;
547         int use_keyframe;
548         int use_splice;
549         int use_overwrite;
550         int use_paste;
551         int use_undo;
552         int use_fit;
553         int use_copy;
554         int use_locklabels;
555         int use_labels;
556         int use_toclip;
557         int use_meters;
558         int use_cut;
559         int use_commercial;
560         int use_goto;
561         int use_clk2play;
562         int use_scope;
563         int use_gang_tracks;
564         int use_timecode;
565
566         EditFit *fit;
567         EditFitAutos *fit_autos;
568         EditInPoint *inpoint;
569         EditOutPoint *outpoint;
570 //      EditDelInPoint *delinpoint;
571 //      EditDelOutPoint *deloutpoint;
572         EditSplice *splice;
573         EditOverwrite *overwrite;
574         EditToClip *clip;
575         EditCut *cut;
576         EditCommercial *commercial;
577         EditManualGoto *mangoto;
578         EditClick2Play *click2play;
579         EditPanelScope *scope;
580         EditPanelTimecode *timecode;
581         EditPanelScopeDialog *scope_dialog;
582         EditCopy *copy;
583         EditPaste *paste;
584         EditLabelbutton *labelbutton;
585         EditPrevLabel *prevlabel;
586         EditNextLabel *nextlabel;
587         EditPrevEdit *prevedit;
588         EditNextEdit *nextedit;
589         EditPanelGangTracks *gang_tracks;
590         EditUndo *undo;
591         EditRedo *redo;
592         MeterShow *meters;
593         ArrowButton *arrow;
594         IBeamButton *ibeam;
595         KeyFrameButton *keyframe;
596         SpanKeyFrameButton *span_keyframe;
597         LockLabelsButton *locklabels;
598
599         int is_mwindow() { return window_id == MWINDOW_ID; }
600         int is_cwindow() { return window_id == CWINDOW_ID; }
601         int is_vwindow() { return window_id == VWINDOW_ID; }
602 };
603
604 #endif