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