3498c2adcdcab785f9537e07c2d440e38d31725a
[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         int activate_submenu();
505
506         MWindow *mwindow;
507 };
508
509 class MixerItem : public BC_MenuItem
510 {
511 public:
512         MixerItem(MixerItems *mixer_items, const char *text, int idx);
513         MixerItem(MixerItems *mixer_items, const char *text, const char *hotkey_text, int hotkey);
514         virtual int handle_event();
515
516         MixerItems *mixer_items;
517         int idx;
518 };
519
520 class MixerViewer : public MixerItem
521 {
522 public:
523         MixerViewer(MixerItems *mixer_items);
524         int handle_event();
525 };
526
527 class TileMixers : public MixerItem
528 {
529 public:
530         TileMixers(MixerItems *mixer_items);
531         int handle_event();
532 };
533
534 class AlignMixers : public MixerItem
535 {
536 public:
537         AlignMixers(MixerItems *mixer_items);
538         int handle_event();
539 };
540
541 class MixMasters : public MixerItem
542 {
543 public:
544         MixMasters(MixerItems *mixer_items);
545         int handle_event();
546 };
547
548 class AlignTimecodes : public BC_MenuItem
549 {
550 public:
551         AlignTimecodes(MWindow *mwindow);
552         int handle_event();
553         MWindow *mwindow;
554 };
555
556 // ======================================== audio
557
558 class AddAudioTrack : public BC_MenuItem
559 {
560 public:
561         AddAudioTrack(MWindow *mwindow);
562         int handle_event();
563         MWindow *mwindow;
564 };
565
566 class DeleteAudioTrack : public BC_MenuItem
567 {
568 public:
569         DeleteAudioTrack(MWindow *mwindow);
570         int handle_event();
571         MWindow *mwindow;
572 };
573
574 class DefaultATransition : public BC_MenuItem
575 {
576 public:
577         DefaultATransition(MWindow *mwindow);
578         int handle_event();
579         MWindow *mwindow;
580 };
581
582 class MapAudio1 : public BC_MenuItem
583 {
584 public:
585         MapAudio1(MWindow *mwindow);
586         int handle_event();
587         MWindow *mwindow;
588 };
589
590 class MapAudio2 : public BC_MenuItem
591 {
592 public:
593         MapAudio2(MWindow *mwindow);
594         int handle_event();
595         MWindow *mwindow;
596 };
597
598 // ========================================== video
599
600
601 class AddVideoTrack : public BC_MenuItem
602 {
603 public:
604         AddVideoTrack(MWindow *mwindow);
605         int handle_event();
606         MWindow *mwindow;
607 };
608
609
610 class DeleteVideoTrack : public BC_MenuItem
611 {
612 public:
613         DeleteVideoTrack(MWindow *mwindow);
614         int handle_event();
615         MWindow *mwindow;
616 };
617
618 class ResetTranslation : public BC_MenuItem
619 {
620 public:
621         ResetTranslation(MWindow *mwindow);
622         int handle_event();
623         MWindow *mwindow;
624 };
625
626 class DefaultVTransition : public BC_MenuItem
627 {
628 public:
629         DefaultVTransition(MWindow *mwindow);
630         int handle_event();
631         MWindow *mwindow;
632 };
633
634
635 // ========================================== subtitle
636
637 class AddSubttlTrack : public BC_MenuItem
638 {
639 public:
640         AddSubttlTrack(MWindow *mwindow);
641         int handle_event();
642         MWindow *mwindow;
643 };
644
645 class PasteSubttl : public BC_MenuItem
646 {
647 public:
648         PasteSubttl(MWindow *mwindow);
649         int handle_event();
650         MWindow *mwindow;
651 };
652
653
654 // ========================================== settings
655
656
657 class MoveTracksUp : public BC_MenuItem
658 {
659 public:
660         MoveTracksUp(MWindow *mwindow);
661         int handle_event();
662         MWindow *mwindow;
663 };
664
665 class MoveTracksDown : public BC_MenuItem
666 {
667 public:
668         MoveTracksDown(MWindow *mwindow);
669         int handle_event();
670         MWindow *mwindow;
671 };
672
673 class SwapTracksUp : public BC_MenuItem
674 {
675 public:
676         SwapTracksUp(MWindow *mwindow);
677         int handle_event();
678         MWindow *mwindow;
679 };
680
681 class SwapTracksDown : public BC_MenuItem
682 {
683 public:
684         SwapTracksDown(MWindow *mwindow);
685         int handle_event();
686         MWindow *mwindow;
687 };
688
689 class DeleteTracks : public BC_MenuItem
690 {
691 public:
692         DeleteTracks(MWindow *mwindow);
693         int handle_event();
694         MWindow *mwindow;
695 };
696
697 class ConcatenateTracks : public BC_MenuItem
698 {
699 public:
700         ConcatenateTracks(MWindow *mwindow);
701         int handle_event();
702         MWindow *mwindow;
703 };
704
705 class DeleteFirstTrack : public BC_MenuItem
706 {
707 public:
708         DeleteFirstTrack(MWindow *mwindow);
709         int handle_event();
710         MWindow *mwindow;
711 };
712
713 class DeleteLastTrack : public BC_MenuItem
714 {
715 public:
716         DeleteLastTrack(MWindow *mwindow);
717         int handle_event();
718         MWindow *mwindow;
719 };
720
721 class LoopPlayback : public BC_MenuItem
722 {
723 public:
724         LoopPlayback(MWindow *mwindow);
725
726         int handle_event();
727         MWindow *mwindow;
728 };
729
730 class SetBRenderActive : public BC_MenuItem
731 {
732 public:
733         SetBRenderActive(MWindow *mwindow);
734         int handle_event();
735         MWindow *mwindow;
736 };
737
738 class LabelsFollowEdits : public BC_MenuItem
739 {
740 public:
741         LabelsFollowEdits(MWindow *mwindow);
742         int handle_event();
743         MWindow *mwindow;
744 };
745
746 class PluginsFollowEdits : public BC_MenuItem
747 {
748 public:
749         PluginsFollowEdits(MWindow *mwindow);
750         int handle_event();
751         MWindow *mwindow;
752 };
753
754 class KeyframesFollowEdits : public BC_MenuItem
755 {
756 public:
757         KeyframesFollowEdits(MWindow *mwindow);
758         int handle_event();
759         MWindow *mwindow;
760 };
761
762 class CursorOnFrames : public BC_MenuItem
763 {
764 public:
765         CursorOnFrames(MWindow *mwindow);
766         int handle_event();
767         MWindow *mwindow;
768 };
769
770 class TypelessKeyframes : public BC_MenuItem
771 {
772 public:
773         TypelessKeyframes(MWindow *mwindow);
774         int handle_event();
775         MWindow *mwindow;
776 };
777
778 class ScrubSpeed : public BC_MenuItem
779 {
780 public:
781         ScrubSpeed(MWindow *mwindow);
782         int handle_event();
783         MWindow *mwindow;
784 };
785
786 class SaveSettingsNow : public BC_MenuItem
787 {
788 public:
789         SaveSettingsNow(MWindow *mwindow);
790         int handle_event();
791         MWindow *mwindow;
792 };
793
794 // ========================================== window
795 class ShowVWindow : public BC_MenuItem
796 {
797 public:
798         ShowVWindow(MWindow *mwindow);
799         int handle_event();
800         MWindow *mwindow;
801 };
802
803 class ShowAWindow : public BC_MenuItem
804 {
805 public:
806         ShowAWindow(MWindow *mwindow);
807         int handle_event();
808         MWindow *mwindow;
809 };
810
811 class ShowGWindow : public BC_MenuItem
812 {
813 public:
814         ShowGWindow(MWindow *mwindow);
815         int handle_event();
816         MWindow *mwindow;
817 };
818
819 class ShowCWindow : public BC_MenuItem
820 {
821 public:
822         ShowCWindow(MWindow *mwindow);
823         int handle_event();
824         MWindow *mwindow;
825 };
826
827 class ShowLWindow : public BC_MenuItem
828 {
829 public:
830         ShowLWindow(MWindow *mwindow);
831         int handle_event();
832         MWindow *mwindow;
833 };
834
835 class TileWindows : public BC_MenuItem
836 {
837 public:
838         TileWindows(MWindow *mwindow, const char *item_title, int config,
839                 const char *hot_keytext="", int hot_key=0);
840         int handle_event();
841         MWindow *mwindow;
842         int config;
843 };
844
845 class SplitX : public BC_MenuItem
846 {
847 public:
848         SplitX(MWindow *mwindow);
849         int handle_event();
850         MWindow *mwindow;
851 };
852
853 class SplitY : public BC_MenuItem
854 {
855 public:
856         SplitY(MWindow *mwindow);
857         int handle_event();
858         MWindow *mwindow;
859 };
860
861
862 class LoadLayoutItem : public BC_MenuItem
863 {
864 public:
865         LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey);
866         int handle_event();
867
868         int idx;
869         char layout_text[BCSTRLEN];
870         char layout_file[BCSTRLEN];
871         LoadLayout *load_layout;
872 };
873
874 class LoadLayout : public BC_MenuItem
875 {
876 public:
877         LoadLayout(MWindow *mwindow, const char *text, int action);
878         ~LoadLayout();
879         void create_objects();
880         void update();
881         int activate_submenu();
882
883         MWindow *mwindow; 
884         LoadLayoutDialog *layout_dialog;
885         int action;
886 };
887
888 class LoadLayoutDialog : public BC_DialogThread
889 {
890 public:
891         LoadLayoutDialog(LoadLayout *load_layout);
892         ~LoadLayoutDialog();
893
894         void start_confirm_dialog(int wx, int wy, int idx);
895         void handle_done_event(int result);
896         void handle_close_event(int result);
897         BC_Window* new_gui();
898
899         LoadLayout *load_layout;
900         LoadLayoutConfirm *lgui;
901         int wx, wy, idx;
902 };
903
904 class LoadLayoutNameText : public BC_TextBox
905 {
906 public:
907         LoadLayoutNameText(LoadLayoutConfirm *confirm,
908                 int x, int y, int w, const char *text);
909         ~LoadLayoutNameText();
910
911         int handle_event();
912
913         LoadLayoutConfirm *confirm;
914 };
915
916 class LoadLayoutConfirm : public BC_Window
917 {
918 public:
919         LoadLayoutConfirm(LoadLayoutDialog *load_dialog, int x, int y);
920         ~LoadLayoutConfirm();
921         void create_objects();
922
923         LoadLayoutDialog *layout_dialog;
924         LoadLayoutNameText *name_text;
925 };
926
927 #endif