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