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