482cce3abcd9c64eabd2953206647749e07a6220
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / mainmenu.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 1997-2014 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 MAINMENU_H
23 #define MAINMENU_H
24
25 #include "arraylist.h"
26 #include "guicast.h"
27 #include "bchash.inc"
28 #include "loadfile.inc"
29 #include "mainmenu.inc"
30 #include "mwindow.inc"
31 #include "mwindowgui.inc"
32 #include "maxchannels.h"
33 #include "menuaeffects.inc"
34 #include "menuveffects.inc"
35 #include "module.inc"
36 #include "new.inc"
37 #include "plugindialog.inc"
38 #include "quit.inc"
39 #include "record.inc"
40 #include "render.inc"
41 #include "threadloader.inc"
42 #include "viewmenu.inc"
43
44 #define TOTAL_LOADS 10      // number of files to cache
45 #define TOTAL_EFFECTS 10     // number of effects to cache
46
47 #define LAYOUT_LOAD 0
48 #define LAYOUT_SAVE 1
49
50 class MainMenu : public BC_MenuBar
51 {
52 public:
53         MainMenu(MWindow *mwindow, MWindowGUI *gui, int w);
54         ~MainMenu();
55         void create_objects();
56         int load_defaults(BC_Hash *defaults);
57         int save_defaults(BC_Hash *defaults);
58
59 // most recent loads
60         int add_load(char *path);
61         void init_loads(BC_Hash *defaults);
62
63 // most recent effects
64         int init_aeffects(BC_Hash *defaults);
65         int save_aeffects(BC_Hash *defaults);
66         int add_aeffect(char *title);
67         int init_veffects(BC_Hash *defaults);
68         int save_veffects(BC_Hash *defaults);
69         int save_loads(BC_Hash *defaults);
70         int add_veffect(char *title);
71
72         int quit();
73 // show only one of these at a time
74         int set_show_autos();
75         void update_toggles(int use_lock);
76
77         MWindowGUI *gui;
78         MWindow *mwindow;
79         ThreadLoader *threadloader;
80         MenuAEffects *aeffects;
81         MenuVEffects *veffects;
82
83         Load *load_file;
84         LoadPrevious *load[TOTAL_LOADS];
85         int total_loads;
86
87         RecordMenuItem *record_menu_item;
88         RenderItem *render;
89         NewProject *new_project;
90         MenuAEffectItem *aeffect[TOTAL_EFFECTS];
91         MenuVEffectItem *veffect[TOTAL_EFFECTS];
92         Quit *quit_program;              // affected by save
93         MainDumpsMenu *dump_menu;
94         Undo *undo;
95         Redo *redo;
96         int total_aeffects;
97         int total_veffects;
98         BC_Menu *filemenu, *audiomenu, *videomenu;      // needed by most recents
99
100         KeyframeCurveType *keyframe_curve_type;
101         LabelsFollowEdits *labels_follow_edits;
102         PluginsFollowEdits *plugins_follow_edits;
103         KeyframesFollowEdits *keyframes_follow_edits;
104         CursorOnFrames *cursor_on_frames;
105         TypelessKeyframes *typeless_keyframes;
106         SetBRenderActive *brender_active;
107         LoopPlayback *loop_playback;
108         ShowAssets *show_assets;
109         ShowTitles *show_titles;
110         ShowTransitions *show_transitions;
111         ShowAutomation *fade_automation;
112         ShowAutomation *mute_automation;
113         ShowAutomation *pan_automation;
114         ShowAutomation *camera_x;
115         ShowAutomation *camera_y;
116         ShowAutomation *camera_z;
117         ShowAutomation *project_x;
118         ShowAutomation *project_y;
119         ShowAutomation *project_z;
120         PluginAutomation *plugin_automation;
121         ShowAutomation *mask_automation;
122         ShowAutomation *mode_automation;
123         ShowAutomation *speed_automation;
124         ShowVWindow *show_vwindow;
125         ShowAWindow *show_awindow;
126         ShowCWindow *show_cwindow;
127         ShowGWindow *show_gwindow;
128         ShowLWindow *show_lwindow;
129         SplitX *split_x;
130         SplitY *split_y;
131         MixerItems *mixer_items;
132         LoadLayout *load_layout;
133         LoadLayout *save_layout;
134 };
135
136 // ========================================= edit
137
138 class Undo : public BC_MenuItem
139 {
140 public:
141         Undo(MWindow *mwindow);
142         int handle_event();
143         int update_caption(const char *new_caption = "");
144         MWindow *mwindow;
145 };
146
147 class MainDumpsSubMenu : public BC_SubMenu
148 {
149 public:
150         MainDumpsSubMenu(BC_MenuItem *menu_item);
151         ~MainDumpsSubMenu();
152
153         BC_MenuItem *menu_item;
154 };
155
156 class MainDumpsMenu : public BC_MenuItem
157 {
158 public:
159         MainDumpsMenu(MWindow *mwindow);
160         ~MainDumpsMenu();
161         void create_objects();
162
163         MWindow *mwindow;
164         MainDumpsSubMenu *dumps_menu;
165 };
166
167 class DumpCICache : public BC_MenuItem
168 {
169 public:
170         DumpCICache(MWindow *mwindow);
171         int handle_event();
172         MWindow *mwindow;
173 };
174
175 class DumpEDL : public BC_MenuItem
176 {
177 public:
178         DumpEDL(MWindow *mwindow);
179         int handle_event();
180         MWindow *mwindow;
181 };
182
183 class DumpPlugins : public BC_MenuItem
184 {
185 public:
186         DumpPlugins(MWindow *mwindow);
187         int handle_event();
188         MWindow *mwindow;
189 };
190
191 class DumpAssets : public BC_MenuItem
192 {
193 public:
194         DumpAssets(MWindow *mwindow);
195         int handle_event();
196         MWindow *mwindow;
197 };
198
199 class DumpUndo : public BC_MenuItem
200 {
201 public:
202         DumpUndo(MWindow *mwindow);
203         int handle_event();
204         MWindow *mwindow;
205 };
206
207 class Redo : public BC_MenuItem
208 {
209 public:
210         Redo(MWindow *mwindow);
211         int handle_event();
212         int update_caption(const char *new_caption = "");
213         MWindow *mwindow;
214 };
215
216 class Cut : public BC_MenuItem
217 {
218 public:
219         Cut(MWindow *mwindow);
220         int handle_event();
221         MWindow *mwindow;
222 };
223
224 class Copy : public BC_MenuItem
225 {
226 public:
227         Copy(MWindow *mwindow);
228         int handle_event();
229         MWindow *mwindow;
230 };
231
232 class Paste : public BC_MenuItem
233 {
234 public:
235         Paste(MWindow *mwindow);
236         int handle_event();
237         MWindow *mwindow;
238 };
239
240 class Clear : public BC_MenuItem
241 {
242 public:
243         Clear(MWindow *mwindow);
244         int handle_event();
245         MWindow *mwindow;
246 };
247
248 class CutKeyframes : public BC_MenuItem
249 {
250 public:
251         CutKeyframes(MWindow *mwindow);
252         int handle_event();
253         MWindow *mwindow;
254 };
255
256 class CopyKeyframes : public BC_MenuItem
257 {
258 public:
259         CopyKeyframes(MWindow *mwindow);
260         int handle_event();
261         MWindow *mwindow;
262 };
263
264 class PasteKeyframes : public BC_MenuItem
265 {
266 public:
267         PasteKeyframes(MWindow *mwindow);
268         int handle_event();
269         MWindow *mwindow;
270 };
271
272
273 class ClearKeyframes : public BC_MenuItem
274 {
275 public:
276         ClearKeyframes(MWindow *mwindow);
277         int handle_event();
278         MWindow *mwindow;
279 };
280
281 class StraightenKeyframes : public BC_MenuItem
282 {
283 public:
284         StraightenKeyframes(MWindow *mwindow);
285         int handle_event();
286         MWindow *mwindow;
287 };
288
289 class BendKeyframes : public BC_MenuItem
290 {
291 public:
292         BendKeyframes(MWindow *mwindow);
293         int handle_event();
294         MWindow *mwindow;
295 };
296
297 class KeyframeCurveType : public BC_MenuItem
298 {
299 public:
300         KeyframeCurveType(MWindow *mwindow);
301         ~KeyframeCurveType();
302
303         void create_objects();
304         void update(int curve_type);
305         int handle_event();
306
307         MWindow *mwindow;
308         KeyframeCurveTypeMenu *curve_menu;
309 };
310
311 class KeyframeCurveTypeMenu : public BC_SubMenu
312 {
313 public:
314         KeyframeCurveTypeMenu(KeyframeCurveType *menu_item);
315         ~KeyframeCurveTypeMenu();
316
317         KeyframeCurveType *menu_item;
318 };
319
320 class KeyframeCurveTypeItem : public BC_MenuItem
321 {
322 public:
323         KeyframeCurveTypeItem(int type, KeyframeCurveType *main_item);
324         ~KeyframeCurveTypeItem();
325
326         KeyframeCurveType *main_item;
327         int type;
328
329         int handle_event();
330 };
331
332 class CutDefaultKeyframe : public BC_MenuItem
333 {
334 public:
335         CutDefaultKeyframe(MWindow *mwindow);
336         int handle_event();
337         MWindow *mwindow;
338 };
339
340 class CopyDefaultKeyframe : public BC_MenuItem
341 {
342 public:
343         CopyDefaultKeyframe(MWindow *mwindow);
344         int handle_event();
345         MWindow *mwindow;
346 };
347
348 class PasteDefaultKeyframe : public BC_MenuItem
349 {
350 public:
351         PasteDefaultKeyframe(MWindow *mwindow);
352         int handle_event();
353         MWindow *mwindow;
354 };
355
356 class ClearDefaultKeyframe : public BC_MenuItem
357 {
358 public:
359         ClearDefaultKeyframe(MWindow *mwindow);
360         int handle_event();
361         MWindow *mwindow;
362 };
363
364 class PasteSilence : public BC_MenuItem
365 {
366 public:
367         PasteSilence(MWindow *mwindow);
368         int handle_event();
369         MWindow *mwindow;
370 };
371
372 class SelectAll : public BC_MenuItem
373 {
374 public:
375         SelectAll(MWindow *mwindow);
376         int handle_event();
377         MWindow *mwindow;
378 };
379
380 class ClearLabels : public BC_MenuItem
381 {
382 public:
383         ClearLabels(MWindow *mwindow);
384         int handle_event();
385         MWindow *mwindow;
386 };
387
388 class CutCommercials : public BC_MenuItem
389 {
390 public:
391         CutCommercials(MWindow *mwindow);
392         int handle_event();
393         MWindow *mwindow;
394 };
395
396 class DetachTransitions : public BC_MenuItem
397 {
398 public:
399         DetachTransitions(MWindow *mwindow);
400         int handle_event();
401         MWindow *mwindow;
402 };
403
404 class MuteSelection : public BC_MenuItem
405 {
406 public:
407         MuteSelection(MWindow *mwindow);
408         int handle_event();
409         MWindow *mwindow;
410 };
411
412 class TrimSelection : public BC_MenuItem
413 {
414 public:
415         TrimSelection(MWindow *mwindow);
416         int handle_event();
417         MWindow *mwindow;
418 };
419
420 class MixerItems : public BC_MenuItem
421 {
422 public:
423         MixerItems(MWindow *mwindow);
424         void create_objects();
425         MWindow *mwindow;
426 };
427
428 class MixerViewer : public BC_MenuItem
429 {
430 public:
431         MixerViewer(MWindow *mwindow);
432         int handle_event();
433         MWindow *mwindow;
434 };
435
436 class TileMixers : public BC_MenuItem
437 {
438 public:
439         TileMixers(MWindow *mwindow);
440         int handle_event();
441         MWindow *mwindow;
442 };
443
444 class AlignMixers : public BC_MenuItem
445 {
446 public:
447         AlignMixers(MWindow *mwindow);
448         int handle_event();
449         MWindow *mwindow;
450 };
451
452 // ======================================== audio
453
454 class AddAudioTrack : public BC_MenuItem
455 {
456 public:
457         AddAudioTrack(MWindow *mwindow);
458         int handle_event();
459         MWindow *mwindow;
460 };
461
462 class DeleteAudioTrack : public BC_MenuItem
463 {
464 public:
465         DeleteAudioTrack(MWindow *mwindow);
466         int handle_event();
467         MWindow *mwindow;
468 };
469
470 class DefaultATransition : public BC_MenuItem
471 {
472 public:
473         DefaultATransition(MWindow *mwindow);
474         int handle_event();
475         MWindow *mwindow;
476 };
477
478 class MapAudio1 : public BC_MenuItem
479 {
480 public:
481         MapAudio1(MWindow *mwindow);
482         int handle_event();
483         MWindow *mwindow;
484 };
485
486 class MapAudio2 : public BC_MenuItem
487 {
488 public:
489         MapAudio2(MWindow *mwindow);
490         int handle_event();
491         MWindow *mwindow;
492 };
493
494 // ========================================== video
495
496
497 class AddVideoTrack : public BC_MenuItem
498 {
499 public:
500         AddVideoTrack(MWindow *mwindow);
501         int handle_event();
502         MWindow *mwindow;
503 };
504
505
506 class DeleteVideoTrack : public BC_MenuItem
507 {
508 public:
509         DeleteVideoTrack(MWindow *mwindow);
510         int handle_event();
511         MWindow *mwindow;
512 };
513
514 class ResetTranslation : public BC_MenuItem
515 {
516 public:
517         ResetTranslation(MWindow *mwindow);
518         int handle_event();
519         MWindow *mwindow;
520 };
521
522 class DefaultVTransition : public BC_MenuItem
523 {
524 public:
525         DefaultVTransition(MWindow *mwindow);
526         int handle_event();
527         MWindow *mwindow;
528 };
529
530
531 // ========================================== subtitle
532
533 class AddSubttlTrack : public BC_MenuItem
534 {
535 public:
536         AddSubttlTrack(MWindow *mwindow);
537         int handle_event();
538         MWindow *mwindow;
539 };
540
541 class PasteSubttl : public BC_MenuItem
542 {
543 public:
544         PasteSubttl(MWindow *mwindow);
545         int handle_event();
546         MWindow *mwindow;
547 };
548
549
550 // ========================================== settings
551
552
553 class MoveTracksUp : public BC_MenuItem
554 {
555 public:
556         MoveTracksUp(MWindow *mwindow);
557         int handle_event();
558         MWindow *mwindow;
559 };
560
561 class MoveTracksDown : public BC_MenuItem
562 {
563 public:
564         MoveTracksDown(MWindow *mwindow);
565         int handle_event();
566         MWindow *mwindow;
567 };
568
569 class DeleteTracks : public BC_MenuItem
570 {
571 public:
572         DeleteTracks(MWindow *mwindow);
573         int handle_event();
574         MWindow *mwindow;
575 };
576
577 class ConcatenateTracks : public BC_MenuItem
578 {
579 public:
580         ConcatenateTracks(MWindow *mwindow);
581         int handle_event();
582         MWindow *mwindow;
583 };
584
585 class DeleteFirstTrack : public BC_MenuItem
586 {
587 public:
588         DeleteFirstTrack(MWindow *mwindow);
589         int handle_event();
590         MWindow *mwindow;
591 };
592
593 class DeleteLastTrack : public BC_MenuItem
594 {
595 public:
596         DeleteLastTrack(MWindow *mwindow);
597         int handle_event();
598         MWindow *mwindow;
599 };
600
601 class LoopPlayback : public BC_MenuItem
602 {
603 public:
604         LoopPlayback(MWindow *mwindow);
605
606         int handle_event();
607         MWindow *mwindow;
608 };
609
610 class SetBRenderActive : public BC_MenuItem
611 {
612 public:
613         SetBRenderActive(MWindow *mwindow);
614         int handle_event();
615         MWindow *mwindow;
616 };
617
618 class LabelsFollowEdits : public BC_MenuItem
619 {
620 public:
621         LabelsFollowEdits(MWindow *mwindow);
622         int handle_event();
623         MWindow *mwindow;
624 };
625
626 class PluginsFollowEdits : public BC_MenuItem
627 {
628 public:
629         PluginsFollowEdits(MWindow *mwindow);
630         int handle_event();
631         MWindow *mwindow;
632 };
633
634 class KeyframesFollowEdits : public BC_MenuItem
635 {
636 public:
637         KeyframesFollowEdits(MWindow *mwindow);
638         int handle_event();
639         MWindow *mwindow;
640 };
641
642 class CursorOnFrames : public BC_MenuItem
643 {
644 public:
645         CursorOnFrames(MWindow *mwindow);
646         int handle_event();
647         MWindow *mwindow;
648 };
649
650 class TypelessKeyframes : public BC_MenuItem
651 {
652 public:
653         TypelessKeyframes(MWindow *mwindow);
654         int handle_event();
655         MWindow *mwindow;
656 };
657
658 class ScrubSpeed : public BC_MenuItem
659 {
660 public:
661         ScrubSpeed(MWindow *mwindow);
662         int handle_event();
663         MWindow *mwindow;
664 };
665
666 class SaveSettingsNow : public BC_MenuItem
667 {
668 public:
669         SaveSettingsNow(MWindow *mwindow);
670         int handle_event();
671         MWindow *mwindow;
672 };
673
674 // ========================================== window
675 class ShowVWindow : public BC_MenuItem
676 {
677 public:
678         ShowVWindow(MWindow *mwindow);
679         int handle_event();
680         MWindow *mwindow;
681 };
682
683 class ShowAWindow : public BC_MenuItem
684 {
685 public:
686         ShowAWindow(MWindow *mwindow);
687         int handle_event();
688         MWindow *mwindow;
689 };
690
691 class ShowGWindow : public BC_MenuItem
692 {
693 public:
694         ShowGWindow(MWindow *mwindow);
695         int handle_event();
696         MWindow *mwindow;
697 };
698
699 class ShowCWindow : public BC_MenuItem
700 {
701 public:
702         ShowCWindow(MWindow *mwindow);
703         int handle_event();
704         MWindow *mwindow;
705 };
706
707 class ShowLWindow : public BC_MenuItem
708 {
709 public:
710         ShowLWindow(MWindow *mwindow);
711         int handle_event();
712         MWindow *mwindow;
713 };
714
715 class TileWindows : public BC_MenuItem
716 {
717 public:
718         TileWindows(MWindow *mwindow, const char *item_title, int config,
719                 const char *hot_keytext="", int hot_key=0);
720         int handle_event();
721         MWindow *mwindow;
722         int config;
723 };
724
725 class SplitX : public BC_MenuItem
726 {
727 public:
728         SplitX(MWindow *mwindow);
729         int handle_event();
730         MWindow *mwindow;
731 };
732
733 class SplitY : public BC_MenuItem
734 {
735 public:
736         SplitY(MWindow *mwindow);
737         int handle_event();
738         MWindow *mwindow;
739 };
740
741
742 class LoadLayoutItem : public BC_MenuItem
743 {
744 public:
745         LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey);
746         int handle_event();
747
748         int idx;
749         char layout_text[BCSTRLEN];
750         char layout_file[BCSTRLEN];
751         LoadLayout *load_layout;
752 };
753
754 class LoadLayout : public BC_MenuItem
755 {
756 public:
757         LoadLayout(MWindow *mwindow, const char *text, int action);
758         ~LoadLayout();
759         void create_objects();
760         void update();
761         int activate_submenu();
762
763         MWindow *mwindow; 
764         LoadLayoutDialog *layout_dialog;
765         int action;
766 };
767
768 class LoadLayoutDialog : public BC_DialogThread
769 {
770 public:
771         LoadLayoutDialog(LoadLayout *load_layout);
772         ~LoadLayoutDialog();
773
774         void start_confirm_dialog(int wx, int wy, int idx);
775         void handle_done_event(int result);
776         void handle_close_event(int result);
777         BC_Window* new_gui();
778
779         LoadLayout *load_layout;
780         LoadLayoutConfirm *lgui;
781         int wx, wy, idx;
782 };
783
784 class LoadLayoutNameText : public BC_TextBox
785 {
786 public:
787         LoadLayoutNameText(LoadLayoutConfirm *confirm,
788                 int x, int y, int w, const char *text);
789         ~LoadLayoutNameText();
790
791         int handle_event();
792
793         LoadLayoutConfirm *confirm;
794 };
795
796 class LoadLayoutConfirm : public BC_Window
797 {
798 public:
799         LoadLayoutConfirm(LoadLayoutDialog *load_dialog, int x, int y);
800         ~LoadLayoutConfirm();
801         void create_objects();
802
803         LoadLayoutDialog *layout_dialog;
804         LoadLayoutNameText *name_text;
805 };
806
807 #endif