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