mask tweaks, focus follows centroid, gradient/colorpicker rework, no hard edges in...
[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 ClearSelect : public BC_MenuItem
418 {
419 public:
420         ClearSelect(MWindow *mwindow);
421         int handle_event();
422         MWindow *mwindow;
423 };
424
425 class CutCommercials : public BC_MenuItem
426 {
427 public:
428         CutCommercials(MWindow *mwindow);
429         int handle_event();
430         MWindow *mwindow;
431 };
432
433 class DetachTransitions : public BC_MenuItem
434 {
435 public:
436         DetachTransitions(MWindow *mwindow);
437         int handle_event();
438         MWindow *mwindow;
439 };
440
441 class MuteSelection : public BC_MenuItem
442 {
443 public:
444         MuteSelection(MWindow *mwindow);
445         int handle_event();
446         MWindow *mwindow;
447 };
448
449 class TrimSelection : public BC_MenuItem
450 {
451 public:
452         TrimSelection(MWindow *mwindow);
453         int handle_event();
454         MWindow *mwindow;
455 };
456
457 class MixerItems : public BC_MenuItem
458 {
459 public:
460         MixerItems(MWindow *mwindow);
461         void create_objects();
462         MWindow *mwindow;
463 };
464
465 class MixerViewer : public BC_MenuItem
466 {
467 public:
468         MixerViewer(MWindow *mwindow);
469         int handle_event();
470         MWindow *mwindow;
471 };
472
473 class TileMixers : public BC_MenuItem
474 {
475 public:
476         TileMixers(MWindow *mwindow);
477         int handle_event();
478         MWindow *mwindow;
479 };
480
481 class AlignMixers : public BC_MenuItem
482 {
483 public:
484         AlignMixers(MWindow *mwindow);
485         int handle_event();
486         MWindow *mwindow;
487 };
488
489 // ======================================== audio
490
491 class AddAudioTrack : public BC_MenuItem
492 {
493 public:
494         AddAudioTrack(MWindow *mwindow);
495         int handle_event();
496         MWindow *mwindow;
497 };
498
499 class DeleteAudioTrack : public BC_MenuItem
500 {
501 public:
502         DeleteAudioTrack(MWindow *mwindow);
503         int handle_event();
504         MWindow *mwindow;
505 };
506
507 class DefaultATransition : public BC_MenuItem
508 {
509 public:
510         DefaultATransition(MWindow *mwindow);
511         int handle_event();
512         MWindow *mwindow;
513 };
514
515 class MapAudio1 : public BC_MenuItem
516 {
517 public:
518         MapAudio1(MWindow *mwindow);
519         int handle_event();
520         MWindow *mwindow;
521 };
522
523 class MapAudio2 : public BC_MenuItem
524 {
525 public:
526         MapAudio2(MWindow *mwindow);
527         int handle_event();
528         MWindow *mwindow;
529 };
530
531 // ========================================== video
532
533
534 class AddVideoTrack : public BC_MenuItem
535 {
536 public:
537         AddVideoTrack(MWindow *mwindow);
538         int handle_event();
539         MWindow *mwindow;
540 };
541
542
543 class DeleteVideoTrack : public BC_MenuItem
544 {
545 public:
546         DeleteVideoTrack(MWindow *mwindow);
547         int handle_event();
548         MWindow *mwindow;
549 };
550
551 class ResetTranslation : public BC_MenuItem
552 {
553 public:
554         ResetTranslation(MWindow *mwindow);
555         int handle_event();
556         MWindow *mwindow;
557 };
558
559 class DefaultVTransition : public BC_MenuItem
560 {
561 public:
562         DefaultVTransition(MWindow *mwindow);
563         int handle_event();
564         MWindow *mwindow;
565 };
566
567
568 // ========================================== subtitle
569
570 class AddSubttlTrack : public BC_MenuItem
571 {
572 public:
573         AddSubttlTrack(MWindow *mwindow);
574         int handle_event();
575         MWindow *mwindow;
576 };
577
578 class PasteSubttl : public BC_MenuItem
579 {
580 public:
581         PasteSubttl(MWindow *mwindow);
582         int handle_event();
583         MWindow *mwindow;
584 };
585
586
587 // ========================================== settings
588
589
590 class MoveTracksUp : public BC_MenuItem
591 {
592 public:
593         MoveTracksUp(MWindow *mwindow);
594         int handle_event();
595         MWindow *mwindow;
596 };
597
598 class MoveTracksDown : public BC_MenuItem
599 {
600 public:
601         MoveTracksDown(MWindow *mwindow);
602         int handle_event();
603         MWindow *mwindow;
604 };
605
606 class DeleteTracks : public BC_MenuItem
607 {
608 public:
609         DeleteTracks(MWindow *mwindow);
610         int handle_event();
611         MWindow *mwindow;
612 };
613
614 class ConcatenateTracks : public BC_MenuItem
615 {
616 public:
617         ConcatenateTracks(MWindow *mwindow);
618         int handle_event();
619         MWindow *mwindow;
620 };
621
622 class DeleteFirstTrack : public BC_MenuItem
623 {
624 public:
625         DeleteFirstTrack(MWindow *mwindow);
626         int handle_event();
627         MWindow *mwindow;
628 };
629
630 class DeleteLastTrack : public BC_MenuItem
631 {
632 public:
633         DeleteLastTrack(MWindow *mwindow);
634         int handle_event();
635         MWindow *mwindow;
636 };
637
638 class LoopPlayback : public BC_MenuItem
639 {
640 public:
641         LoopPlayback(MWindow *mwindow);
642
643         int handle_event();
644         MWindow *mwindow;
645 };
646
647 class SetBRenderActive : public BC_MenuItem
648 {
649 public:
650         SetBRenderActive(MWindow *mwindow);
651         int handle_event();
652         MWindow *mwindow;
653 };
654
655 class LabelsFollowEdits : public BC_MenuItem
656 {
657 public:
658         LabelsFollowEdits(MWindow *mwindow);
659         int handle_event();
660         MWindow *mwindow;
661 };
662
663 class PluginsFollowEdits : public BC_MenuItem
664 {
665 public:
666         PluginsFollowEdits(MWindow *mwindow);
667         int handle_event();
668         MWindow *mwindow;
669 };
670
671 class KeyframesFollowEdits : public BC_MenuItem
672 {
673 public:
674         KeyframesFollowEdits(MWindow *mwindow);
675         int handle_event();
676         MWindow *mwindow;
677 };
678
679 class CursorOnFrames : public BC_MenuItem
680 {
681 public:
682         CursorOnFrames(MWindow *mwindow);
683         int handle_event();
684         MWindow *mwindow;
685 };
686
687 class TypelessKeyframes : public BC_MenuItem
688 {
689 public:
690         TypelessKeyframes(MWindow *mwindow);
691         int handle_event();
692         MWindow *mwindow;
693 };
694
695 class ScrubSpeed : public BC_MenuItem
696 {
697 public:
698         ScrubSpeed(MWindow *mwindow);
699         int handle_event();
700         MWindow *mwindow;
701 };
702
703 class SaveSettingsNow : public BC_MenuItem
704 {
705 public:
706         SaveSettingsNow(MWindow *mwindow);
707         int handle_event();
708         MWindow *mwindow;
709 };
710
711 // ========================================== window
712 class ShowVWindow : public BC_MenuItem
713 {
714 public:
715         ShowVWindow(MWindow *mwindow);
716         int handle_event();
717         MWindow *mwindow;
718 };
719
720 class ShowAWindow : public BC_MenuItem
721 {
722 public:
723         ShowAWindow(MWindow *mwindow);
724         int handle_event();
725         MWindow *mwindow;
726 };
727
728 class ShowGWindow : public BC_MenuItem
729 {
730 public:
731         ShowGWindow(MWindow *mwindow);
732         int handle_event();
733         MWindow *mwindow;
734 };
735
736 class ShowCWindow : public BC_MenuItem
737 {
738 public:
739         ShowCWindow(MWindow *mwindow);
740         int handle_event();
741         MWindow *mwindow;
742 };
743
744 class ShowLWindow : public BC_MenuItem
745 {
746 public:
747         ShowLWindow(MWindow *mwindow);
748         int handle_event();
749         MWindow *mwindow;
750 };
751
752 class TileWindows : public BC_MenuItem
753 {
754 public:
755         TileWindows(MWindow *mwindow, const char *item_title, int config,
756                 const char *hot_keytext="", int hot_key=0);
757         int handle_event();
758         MWindow *mwindow;
759         int config;
760 };
761
762 class SplitX : public BC_MenuItem
763 {
764 public:
765         SplitX(MWindow *mwindow);
766         int handle_event();
767         MWindow *mwindow;
768 };
769
770 class SplitY : public BC_MenuItem
771 {
772 public:
773         SplitY(MWindow *mwindow);
774         int handle_event();
775         MWindow *mwindow;
776 };
777
778
779 class LoadLayoutItem : public BC_MenuItem
780 {
781 public:
782         LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey);
783         int handle_event();
784
785         int idx;
786         char layout_text[BCSTRLEN];
787         char layout_file[BCSTRLEN];
788         LoadLayout *load_layout;
789 };
790
791 class LoadLayout : public BC_MenuItem
792 {
793 public:
794         LoadLayout(MWindow *mwindow, const char *text, int action);
795         ~LoadLayout();
796         void create_objects();
797         void update();
798         int activate_submenu();
799
800         MWindow *mwindow; 
801         LoadLayoutDialog *layout_dialog;
802         int action;
803 };
804
805 class LoadLayoutDialog : public BC_DialogThread
806 {
807 public:
808         LoadLayoutDialog(LoadLayout *load_layout);
809         ~LoadLayoutDialog();
810
811         void start_confirm_dialog(int wx, int wy, int idx);
812         void handle_done_event(int result);
813         void handle_close_event(int result);
814         BC_Window* new_gui();
815
816         LoadLayout *load_layout;
817         LoadLayoutConfirm *lgui;
818         int wx, wy, idx;
819 };
820
821 class LoadLayoutNameText : public BC_TextBox
822 {
823 public:
824         LoadLayoutNameText(LoadLayoutConfirm *confirm,
825                 int x, int y, int w, const char *text);
826         ~LoadLayoutNameText();
827
828         int handle_event();
829
830         LoadLayoutConfirm *confirm;
831 };
832
833 class LoadLayoutConfirm : public BC_Window
834 {
835 public:
836         LoadLayoutConfirm(LoadLayoutDialog *load_dialog, int x, int y);
837         ~LoadLayoutConfirm();
838         void create_objects();
839
840         LoadLayoutDialog *layout_dialog;
841         LoadLayoutNameText *name_text;
842 };
843
844 #endif