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