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