add timecode units/alignment/probe, add prefs auto_rotate,
[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         AlignTimecodes *align_timecodes;
176         LoadLayout *load_layout;
177         LoadLayout *save_layout;
178 };
179
180 // ========================================= edit
181
182 class Undo : public BC_MenuItem
183 {
184 public:
185         Undo(MWindow *mwindow);
186         int handle_event();
187         int update_caption(const char *new_caption = "");
188         MWindow *mwindow;
189 };
190
191 class MainDumpsSubMenu : public BC_SubMenu
192 {
193 public:
194         MainDumpsSubMenu(BC_MenuItem *menu_item);
195         ~MainDumpsSubMenu();
196
197         BC_MenuItem *menu_item;
198 };
199
200 class MainDumpsMenu : public BC_MenuItem
201 {
202 public:
203         MainDumpsMenu(MWindow *mwindow);
204         ~MainDumpsMenu();
205         void create_objects();
206
207         MWindow *mwindow;
208         MainDumpsSubMenu *dumps_menu;
209 };
210
211 class DumpCICache : public BC_MenuItem
212 {
213 public:
214         DumpCICache(MWindow *mwindow);
215         int handle_event();
216         MWindow *mwindow;
217 };
218
219 class DumpEDL : public BC_MenuItem
220 {
221 public:
222         DumpEDL(MWindow *mwindow);
223         int handle_event();
224         MWindow *mwindow;
225 };
226
227 class DumpPlugins : public BC_MenuItem
228 {
229 public:
230         DumpPlugins(MWindow *mwindow);
231         int handle_event();
232         MWindow *mwindow;
233 };
234
235 class DumpAssets : public BC_MenuItem
236 {
237 public:
238         DumpAssets(MWindow *mwindow);
239         int handle_event();
240         MWindow *mwindow;
241 };
242
243 class DumpUndo : public BC_MenuItem
244 {
245 public:
246         DumpUndo(MWindow *mwindow);
247         int handle_event();
248         MWindow *mwindow;
249 };
250
251 class Redo : public BC_MenuItem
252 {
253 public:
254         Redo(MWindow *mwindow);
255         int handle_event();
256         int update_caption(const char *new_caption = "");
257         MWindow *mwindow;
258 };
259
260 class Cut : public BC_MenuItem
261 {
262 public:
263         Cut(MWindow *mwindow);
264         int handle_event();
265         MWindow *mwindow;
266 };
267
268 class Copy : public BC_MenuItem
269 {
270 public:
271         Copy(MWindow *mwindow);
272         int handle_event();
273         MWindow *mwindow;
274 };
275
276 class Paste : public BC_MenuItem
277 {
278 public:
279         Paste(MWindow *mwindow);
280         int handle_event();
281         MWindow *mwindow;
282 };
283
284 class EditClearSubMenu : public BC_SubMenu
285 {
286 public:
287         EditClearSubMenu(BC_MenuItem *menu_item);
288         ~EditClearSubMenu();
289
290         BC_MenuItem *menu_item;
291 };
292
293 class EditClearMenu : public BC_MenuItem
294 {
295 public:
296         EditClearMenu(MWindow *mwindow);
297         ~EditClearMenu();
298         void create_objects();
299
300         MWindow *mwindow;
301         EditClearSubMenu *clear_sub_menu;
302 };
303
304 class Clear : public BC_MenuItem
305 {
306 public:
307         Clear(MWindow *mwindow);
308         int handle_event();
309         MWindow *mwindow;
310 };
311
312 class CutKeyframes : public BC_MenuItem
313 {
314 public:
315         CutKeyframes(MWindow *mwindow);
316         int handle_event();
317         MWindow *mwindow;
318 };
319
320 class CopyKeyframes : public BC_MenuItem
321 {
322 public:
323         CopyKeyframes(MWindow *mwindow);
324         int handle_event();
325         MWindow *mwindow;
326 };
327
328 class PasteKeyframes : public BC_MenuItem
329 {
330 public:
331         PasteKeyframes(MWindow *mwindow);
332         int handle_event();
333         MWindow *mwindow;
334 };
335
336
337 class ClearKeyframes : public BC_MenuItem
338 {
339 public:
340         ClearKeyframes(MWindow *mwindow);
341         int handle_event();
342         MWindow *mwindow;
343 };
344
345 class StraightenKeyframes : public BC_MenuItem
346 {
347 public:
348         StraightenKeyframes(MWindow *mwindow);
349         int handle_event();
350         MWindow *mwindow;
351 };
352
353 class BendKeyframes : public BC_MenuItem
354 {
355 public:
356         BendKeyframes(MWindow *mwindow);
357         int handle_event();
358         MWindow *mwindow;
359 };
360
361 class KeyframeCurveType : public BC_MenuItem
362 {
363 public:
364         KeyframeCurveType(MWindow *mwindow);
365         ~KeyframeCurveType();
366
367         void create_objects();
368         void update(int curve_type);
369         int handle_event();
370
371         MWindow *mwindow;
372         KeyframeCurveTypeMenu *curve_menu;
373 };
374
375 class KeyframeCurveTypeMenu : public BC_SubMenu
376 {
377 public:
378         KeyframeCurveTypeMenu(KeyframeCurveType *menu_item);
379         ~KeyframeCurveTypeMenu();
380
381         KeyframeCurveType *menu_item;
382 };
383
384 class KeyframeCurveTypeItem : public BC_MenuItem
385 {
386 public:
387         KeyframeCurveTypeItem(int type, KeyframeCurveType *main_item);
388         ~KeyframeCurveTypeItem();
389
390         KeyframeCurveType *main_item;
391         int type;
392
393         int handle_event();
394 };
395
396 class CutDefaultKeyframe : public BC_MenuItem
397 {
398 public:
399         CutDefaultKeyframe(MWindow *mwindow);
400         int handle_event();
401         MWindow *mwindow;
402 };
403
404 class CopyDefaultKeyframe : public BC_MenuItem
405 {
406 public:
407         CopyDefaultKeyframe(MWindow *mwindow);
408         int handle_event();
409         MWindow *mwindow;
410 };
411
412 class PasteDefaultKeyframe : public BC_MenuItem
413 {
414 public:
415         PasteDefaultKeyframe(MWindow *mwindow);
416         int handle_event();
417         MWindow *mwindow;
418 };
419
420 class ClearDefaultKeyframe : public BC_MenuItem
421 {
422 public:
423         ClearDefaultKeyframe(MWindow *mwindow);
424         int handle_event();
425         MWindow *mwindow;
426 };
427
428 class PasteSilence : public BC_MenuItem
429 {
430 public:
431         PasteSilence(MWindow *mwindow);
432         int handle_event();
433         MWindow *mwindow;
434 };
435
436 class SelectAll : public BC_MenuItem
437 {
438 public:
439         SelectAll(MWindow *mwindow);
440         int handle_event();
441         MWindow *mwindow;
442 };
443
444 class ClearHardEdges : public BC_MenuItem
445 {
446 public:
447         ClearHardEdges(MWindow *mwindow);
448         int handle_event();
449         MWindow *mwindow;
450 };
451
452 class ClearLabels : public BC_MenuItem
453 {
454 public:
455         ClearLabels(MWindow *mwindow);
456         int handle_event();
457         MWindow *mwindow;
458 };
459
460 class ClearSelect : public BC_MenuItem
461 {
462 public:
463         ClearSelect(MWindow *mwindow);
464         int handle_event();
465         MWindow *mwindow;
466 };
467
468 class CutCommercials : public BC_MenuItem
469 {
470 public:
471         CutCommercials(MWindow *mwindow);
472         int handle_event();
473         MWindow *mwindow;
474 };
475
476 class DetachTransitions : public BC_MenuItem
477 {
478 public:
479         DetachTransitions(MWindow *mwindow);
480         int handle_event();
481         MWindow *mwindow;
482 };
483
484 class MuteSelection : public BC_MenuItem
485 {
486 public:
487         MuteSelection(MWindow *mwindow);
488         int handle_event();
489         MWindow *mwindow;
490 };
491
492 class TrimSelection : public BC_MenuItem
493 {
494 public:
495         TrimSelection(MWindow *mwindow);
496         int handle_event();
497         MWindow *mwindow;
498 };
499
500 class MixerItems : public BC_MenuItem
501 {
502 public:
503         MixerItems(MWindow *mwindow);
504         void create_objects();
505         int activate_submenu();
506
507         MWindow *mwindow;
508 };
509
510 class MixerItem : public BC_MenuItem
511 {
512 public:
513         MixerItem(MixerItems *mixer_items, const char *text, int idx);
514         MixerItem(MixerItems *mixer_items, const char *text, const char *hotkey_text, int hotkey);
515         virtual int handle_event();
516
517         MixerItems *mixer_items;
518         int idx;
519 };
520
521 class MixerViewer : public MixerItem
522 {
523 public:
524         MixerViewer(MixerItems *mixer_items);
525         int handle_event();
526 };
527
528 class TileMixers : public MixerItem
529 {
530 public:
531         TileMixers(MixerItems *mixer_items);
532         int handle_event();
533 };
534
535 class AlignMixers : public MixerItem
536 {
537 public:
538         AlignMixers(MixerItems *mixer_items);
539         int handle_event();
540 };
541
542 class AlignTimecodes : public BC_MenuItem
543 {
544 public:
545         AlignTimecodes(MWindow *mwindow);
546         int handle_event();
547         MWindow *mwindow;
548 };
549
550 // ======================================== audio
551
552 class AddAudioTrack : public BC_MenuItem
553 {
554 public:
555         AddAudioTrack(MWindow *mwindow);
556         int handle_event();
557         MWindow *mwindow;
558 };
559
560 class DeleteAudioTrack : public BC_MenuItem
561 {
562 public:
563         DeleteAudioTrack(MWindow *mwindow);
564         int handle_event();
565         MWindow *mwindow;
566 };
567
568 class DefaultATransition : public BC_MenuItem
569 {
570 public:
571         DefaultATransition(MWindow *mwindow);
572         int handle_event();
573         MWindow *mwindow;
574 };
575
576 class MapAudio1 : public BC_MenuItem
577 {
578 public:
579         MapAudio1(MWindow *mwindow);
580         int handle_event();
581         MWindow *mwindow;
582 };
583
584 class MapAudio2 : public BC_MenuItem
585 {
586 public:
587         MapAudio2(MWindow *mwindow);
588         int handle_event();
589         MWindow *mwindow;
590 };
591
592 // ========================================== video
593
594
595 class AddVideoTrack : public BC_MenuItem
596 {
597 public:
598         AddVideoTrack(MWindow *mwindow);
599         int handle_event();
600         MWindow *mwindow;
601 };
602
603
604 class DeleteVideoTrack : public BC_MenuItem
605 {
606 public:
607         DeleteVideoTrack(MWindow *mwindow);
608         int handle_event();
609         MWindow *mwindow;
610 };
611
612 class ResetTranslation : public BC_MenuItem
613 {
614 public:
615         ResetTranslation(MWindow *mwindow);
616         int handle_event();
617         MWindow *mwindow;
618 };
619
620 class DefaultVTransition : public BC_MenuItem
621 {
622 public:
623         DefaultVTransition(MWindow *mwindow);
624         int handle_event();
625         MWindow *mwindow;
626 };
627
628
629 // ========================================== subtitle
630
631 class AddSubttlTrack : public BC_MenuItem
632 {
633 public:
634         AddSubttlTrack(MWindow *mwindow);
635         int handle_event();
636         MWindow *mwindow;
637 };
638
639 class PasteSubttl : public BC_MenuItem
640 {
641 public:
642         PasteSubttl(MWindow *mwindow);
643         int handle_event();
644         MWindow *mwindow;
645 };
646
647
648 // ========================================== settings
649
650
651 class MoveTracksUp : public BC_MenuItem
652 {
653 public:
654         MoveTracksUp(MWindow *mwindow);
655         int handle_event();
656         MWindow *mwindow;
657 };
658
659 class MoveTracksDown : public BC_MenuItem
660 {
661 public:
662         MoveTracksDown(MWindow *mwindow);
663         int handle_event();
664         MWindow *mwindow;
665 };
666
667 class SwapTracksUp : public BC_MenuItem
668 {
669 public:
670         SwapTracksUp(MWindow *mwindow);
671         int handle_event();
672         MWindow *mwindow;
673 };
674
675 class SwapTracksDown : public BC_MenuItem
676 {
677 public:
678         SwapTracksDown(MWindow *mwindow);
679         int handle_event();
680         MWindow *mwindow;
681 };
682
683 class DeleteTracks : public BC_MenuItem
684 {
685 public:
686         DeleteTracks(MWindow *mwindow);
687         int handle_event();
688         MWindow *mwindow;
689 };
690
691 class ConcatenateTracks : public BC_MenuItem
692 {
693 public:
694         ConcatenateTracks(MWindow *mwindow);
695         int handle_event();
696         MWindow *mwindow;
697 };
698
699 class DeleteFirstTrack : public BC_MenuItem
700 {
701 public:
702         DeleteFirstTrack(MWindow *mwindow);
703         int handle_event();
704         MWindow *mwindow;
705 };
706
707 class DeleteLastTrack : public BC_MenuItem
708 {
709 public:
710         DeleteLastTrack(MWindow *mwindow);
711         int handle_event();
712         MWindow *mwindow;
713 };
714
715 class LoopPlayback : public BC_MenuItem
716 {
717 public:
718         LoopPlayback(MWindow *mwindow);
719
720         int handle_event();
721         MWindow *mwindow;
722 };
723
724 class SetBRenderActive : public BC_MenuItem
725 {
726 public:
727         SetBRenderActive(MWindow *mwindow);
728         int handle_event();
729         MWindow *mwindow;
730 };
731
732 class LabelsFollowEdits : public BC_MenuItem
733 {
734 public:
735         LabelsFollowEdits(MWindow *mwindow);
736         int handle_event();
737         MWindow *mwindow;
738 };
739
740 class PluginsFollowEdits : public BC_MenuItem
741 {
742 public:
743         PluginsFollowEdits(MWindow *mwindow);
744         int handle_event();
745         MWindow *mwindow;
746 };
747
748 class KeyframesFollowEdits : public BC_MenuItem
749 {
750 public:
751         KeyframesFollowEdits(MWindow *mwindow);
752         int handle_event();
753         MWindow *mwindow;
754 };
755
756 class CursorOnFrames : public BC_MenuItem
757 {
758 public:
759         CursorOnFrames(MWindow *mwindow);
760         int handle_event();
761         MWindow *mwindow;
762 };
763
764 class TypelessKeyframes : public BC_MenuItem
765 {
766 public:
767         TypelessKeyframes(MWindow *mwindow);
768         int handle_event();
769         MWindow *mwindow;
770 };
771
772 class ScrubSpeed : public BC_MenuItem
773 {
774 public:
775         ScrubSpeed(MWindow *mwindow);
776         int handle_event();
777         MWindow *mwindow;
778 };
779
780 class SaveSettingsNow : public BC_MenuItem
781 {
782 public:
783         SaveSettingsNow(MWindow *mwindow);
784         int handle_event();
785         MWindow *mwindow;
786 };
787
788 // ========================================== window
789 class ShowVWindow : public BC_MenuItem
790 {
791 public:
792         ShowVWindow(MWindow *mwindow);
793         int handle_event();
794         MWindow *mwindow;
795 };
796
797 class ShowAWindow : public BC_MenuItem
798 {
799 public:
800         ShowAWindow(MWindow *mwindow);
801         int handle_event();
802         MWindow *mwindow;
803 };
804
805 class ShowGWindow : public BC_MenuItem
806 {
807 public:
808         ShowGWindow(MWindow *mwindow);
809         int handle_event();
810         MWindow *mwindow;
811 };
812
813 class ShowCWindow : public BC_MenuItem
814 {
815 public:
816         ShowCWindow(MWindow *mwindow);
817         int handle_event();
818         MWindow *mwindow;
819 };
820
821 class ShowLWindow : public BC_MenuItem
822 {
823 public:
824         ShowLWindow(MWindow *mwindow);
825         int handle_event();
826         MWindow *mwindow;
827 };
828
829 class TileWindows : public BC_MenuItem
830 {
831 public:
832         TileWindows(MWindow *mwindow, const char *item_title, int config,
833                 const char *hot_keytext="", int hot_key=0);
834         int handle_event();
835         MWindow *mwindow;
836         int config;
837 };
838
839 class SplitX : public BC_MenuItem
840 {
841 public:
842         SplitX(MWindow *mwindow);
843         int handle_event();
844         MWindow *mwindow;
845 };
846
847 class SplitY : public BC_MenuItem
848 {
849 public:
850         SplitY(MWindow *mwindow);
851         int handle_event();
852         MWindow *mwindow;
853 };
854
855
856 class LoadLayoutItem : public BC_MenuItem
857 {
858 public:
859         LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey);
860         int handle_event();
861
862         int idx;
863         char layout_text[BCSTRLEN];
864         char layout_file[BCSTRLEN];
865         LoadLayout *load_layout;
866 };
867
868 class LoadLayout : public BC_MenuItem
869 {
870 public:
871         LoadLayout(MWindow *mwindow, const char *text, int action);
872         ~LoadLayout();
873         void create_objects();
874         void update();
875         int activate_submenu();
876
877         MWindow *mwindow; 
878         LoadLayoutDialog *layout_dialog;
879         int action;
880 };
881
882 class LoadLayoutDialog : public BC_DialogThread
883 {
884 public:
885         LoadLayoutDialog(LoadLayout *load_layout);
886         ~LoadLayoutDialog();
887
888         void start_confirm_dialog(int wx, int wy, int idx);
889         void handle_done_event(int result);
890         void handle_close_event(int result);
891         BC_Window* new_gui();
892
893         LoadLayout *load_layout;
894         LoadLayoutConfirm *lgui;
895         int wx, wy, idx;
896 };
897
898 class LoadLayoutNameText : public BC_TextBox
899 {
900 public:
901         LoadLayoutNameText(LoadLayoutConfirm *confirm,
902                 int x, int y, int w, const char *text);
903         ~LoadLayoutNameText();
904
905         int handle_event();
906
907         LoadLayoutConfirm *confirm;
908 };
909
910 class LoadLayoutConfirm : public BC_Window
911 {
912 public:
913         LoadLayoutConfirm(LoadLayoutDialog *load_dialog, int x, int y);
914         ~LoadLayoutConfirm();
915         void create_objects();
916
917         LoadLayoutDialog *layout_dialog;
918         LoadLayoutNameText *name_text;
919 };
920
921 #endif