add master/armed_gang track operations, tweak appearanceprefs layout, fix vicon video...
[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 public:
386         EditPanelGangTracks(MWindow *mwindow, EditPanel *panel, int x, int y);
387         ~EditPanelGangTracks();
388         VFrame **get_images(MWindow *mwindow);
389         void update(int gang);
390         int handle_event();
391         EditPanel *panel;
392         MWindow *mwindow;
393 };
394
395
396 class EditPanelScope : public BC_Toggle
397 {
398 public:
399         EditPanelScope(MWindow *mwindow, EditPanel *panel, int x, int y);
400         ~EditPanelScope();
401         int handle_event();
402         EditPanel *panel;
403         MWindow *mwindow;
404 };
405
406
407 class EditPanel
408 {
409 public:
410         EditPanel(MWindow *mwindow, BC_WindowBase *subwindow,
411                 int window_id, int x, int y,
412                 int editing_mode,   // From edl.inc
413                 int use_editing_mode,
414                 int use_keyframe,
415                 int use_splice,   // Extra buttons
416                 int use_overwrite,
417                 int use_copy,  // Use copy when in EDITING_ARROW
418                 int use_paste,
419                 int use_undo,
420                 int use_fit,
421                 int use_locklabels,
422                 int use_labels,
423                 int use_toclip,
424                 int use_meters,
425                 int use_cut,
426                 int use_commerical,
427                 int use_goto,
428                 int use_clk2play,
429                 int use_scope,
430                 int use_gang_tracks);
431         ~EditPanel();
432
433         void set_meters(MeterPanel *meter_panel);
434         static int calculate_w(MWindow *mwindow, int use_keyframe, int total_buttons);
435         static int calculate_h(MWindow *mwindow);
436         void update();
437         void create_buttons();
438         void stop_transport(const char *lock_msg);
439         void reposition_buttons(int x, int y);
440         void create_objects();
441         int get_w();
442
443         virtual double get_position() = 0;
444         virtual void set_position(double position) = 0;
445         virtual void set_click_to_play(int v) = 0;
446
447         virtual void panel_stop_transport() = 0;
448         virtual void panel_toggle_label() = 0;
449         virtual void panel_next_label(int cut) = 0;
450         virtual void panel_prev_label(int cut) = 0;
451         virtual void panel_prev_edit(int cut) = 0;
452         virtual void panel_next_edit(int cut) = 0;
453         virtual void panel_copy_selection() = 0;
454         virtual void panel_overwrite_selection() = 0;
455         virtual void panel_splice_selection() = 0;
456         virtual void panel_set_inpoint() = 0;
457         virtual void panel_set_outpoint() = 0;
458         virtual void panel_unset_inoutpoint() = 0;
459         virtual void panel_to_clip() = 0;
460         virtual void panel_cut() = 0;
461         virtual void panel_paste() = 0;
462         virtual void panel_fit_selection() = 0;
463         virtual void panel_fit_autos(int all) = 0;
464         virtual void panel_set_editing_mode(int mode) = 0;
465         virtual void panel_set_auto_keyframes(int v) = 0;
466         virtual void panel_set_span_keyframes(int v) = 0;
467         virtual void panel_set_labels_follow_edits(int v) = 0;
468         virtual void panel_set_gang_tracks(int mode) = 0;
469
470         MWindow *mwindow;
471         BC_WindowBase *subwindow;
472         MeterPanel *meter_panel;
473
474         int window_id;
475         int x, y, x1, y1;
476         int editing_mode;
477         int use_editing_mode;
478         int use_keyframe;
479         int use_splice;
480         int use_overwrite;
481         int use_paste;
482         int use_undo;
483         int use_fit;
484         int use_copy;
485         int use_locklabels;
486         int use_labels;
487         int use_toclip;
488         int use_meters;
489         int use_cut;
490         int use_commercial;
491         int use_goto;
492         int use_clk2play;
493         int use_scope;
494         int use_gang_tracks;
495
496         EditFit *fit;
497         EditFitAutos *fit_autos;
498         EditInPoint *inpoint;
499         EditOutPoint *outpoint;
500 //      EditDelInPoint *delinpoint;
501 //      EditDelOutPoint *deloutpoint;
502         EditSplice *splice;
503         EditOverwrite *overwrite;
504         EditToClip *clip;
505         EditCut *cut;
506         EditCommercial *commercial;
507         EditManualGoto *mangoto;
508         EditClick2Play *click2play;
509         EditPanelScope *scope;
510         EditPanelScopeDialog *scope_dialog;
511         EditCopy *copy;
512         EditPaste *paste;
513         EditLabelbutton *labelbutton;
514         EditPrevLabel *prevlabel;
515         EditNextLabel *nextlabel;
516         EditPrevEdit *prevedit;
517         EditNextEdit *nextedit;
518         EditPanelGangTracks *gang_tracks;
519         EditUndo *undo;
520         EditRedo *redo;
521         MeterShow *meters;
522         ArrowButton *arrow;
523         IBeamButton *ibeam;
524         KeyFrameButton *keyframe;
525         SpanKeyFrameButton *span_keyframe;
526         LockLabelsButton *locklabels;
527
528         int is_mwindow() { return window_id == MWINDOW_ID; }
529         int is_cwindow() { return window_id == CWINDOW_ID; }
530         int is_vwindow() { return window_id == VWINDOW_ID; }
531 };
532
533 #endif