4 * Copyright (C) 1997-2014 Adam Williams <broadcast at earthling dot net>
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.
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.
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
25 #include "arraylist.h"
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"
37 #include "plugindialog.inc"
41 #include "threadloader.inc"
42 #include "viewmenu.inc"
44 #define TOTAL_LOADS 10 // number of files to cache
45 #define TOTAL_EFFECTS 10 // number of effects to cache
50 class MainMenu : public BC_MenuBar
53 MainMenu(MWindow *mwindow, MWindowGUI *gui, int w);
55 void create_objects();
56 int load_defaults(BC_Hash *defaults);
57 int save_defaults(BC_Hash *defaults);
60 int add_load(char *path);
61 void init_loads(BC_Hash *defaults);
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);
73 // show only one of these at a time
75 void update_toggles(int use_lock);
79 ThreadLoader *threadloader;
80 MenuAEffects *aeffects;
81 MenuVEffects *veffects;
84 LoadPrevious *load[TOTAL_LOADS];
87 RecordMenuItem *record_menu_item;
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;
99 BC_Menu *filemenu, *audiomenu, *videomenu; // needed by most recents
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;
132 MixerItems *mixer_items;
133 LoadLayout *load_layout;
134 LoadLayout *save_layout;
137 // ========================================= edit
139 class Undo : public BC_MenuItem
142 Undo(MWindow *mwindow);
144 int update_caption(const char *new_caption = "");
148 class MainDumpsSubMenu : public BC_SubMenu
151 MainDumpsSubMenu(BC_MenuItem *menu_item);
154 BC_MenuItem *menu_item;
157 class MainDumpsMenu : public BC_MenuItem
160 MainDumpsMenu(MWindow *mwindow);
162 void create_objects();
165 MainDumpsSubMenu *dumps_menu;
168 class DumpCICache : public BC_MenuItem
171 DumpCICache(MWindow *mwindow);
176 class DumpEDL : public BC_MenuItem
179 DumpEDL(MWindow *mwindow);
184 class DumpPlugins : public BC_MenuItem
187 DumpPlugins(MWindow *mwindow);
192 class DumpAssets : public BC_MenuItem
195 DumpAssets(MWindow *mwindow);
200 class DumpUndo : public BC_MenuItem
203 DumpUndo(MWindow *mwindow);
208 class Redo : public BC_MenuItem
211 Redo(MWindow *mwindow);
213 int update_caption(const char *new_caption = "");
217 class Cut : public BC_MenuItem
220 Cut(MWindow *mwindow);
225 class Copy : public BC_MenuItem
228 Copy(MWindow *mwindow);
233 class Paste : public BC_MenuItem
236 Paste(MWindow *mwindow);
241 class EditClearSubMenu : public BC_SubMenu
244 EditClearSubMenu(BC_MenuItem *menu_item);
247 BC_MenuItem *menu_item;
250 class EditClearMenu : public BC_MenuItem
253 EditClearMenu(MWindow *mwindow);
255 void create_objects();
258 EditClearSubMenu *clear_sub_menu;
261 class Clear : public BC_MenuItem
264 Clear(MWindow *mwindow);
269 class CutKeyframes : public BC_MenuItem
272 CutKeyframes(MWindow *mwindow);
277 class CopyKeyframes : public BC_MenuItem
280 CopyKeyframes(MWindow *mwindow);
285 class PasteKeyframes : public BC_MenuItem
288 PasteKeyframes(MWindow *mwindow);
294 class ClearKeyframes : public BC_MenuItem
297 ClearKeyframes(MWindow *mwindow);
302 class StraightenKeyframes : public BC_MenuItem
305 StraightenKeyframes(MWindow *mwindow);
310 class BendKeyframes : public BC_MenuItem
313 BendKeyframes(MWindow *mwindow);
318 class KeyframeCurveType : public BC_MenuItem
321 KeyframeCurveType(MWindow *mwindow);
322 ~KeyframeCurveType();
324 void create_objects();
325 void update(int curve_type);
329 KeyframeCurveTypeMenu *curve_menu;
332 class KeyframeCurveTypeMenu : public BC_SubMenu
335 KeyframeCurveTypeMenu(KeyframeCurveType *menu_item);
336 ~KeyframeCurveTypeMenu();
338 KeyframeCurveType *menu_item;
341 class KeyframeCurveTypeItem : public BC_MenuItem
344 KeyframeCurveTypeItem(int type, KeyframeCurveType *main_item);
345 ~KeyframeCurveTypeItem();
347 KeyframeCurveType *main_item;
353 class CutDefaultKeyframe : public BC_MenuItem
356 CutDefaultKeyframe(MWindow *mwindow);
361 class CopyDefaultKeyframe : public BC_MenuItem
364 CopyDefaultKeyframe(MWindow *mwindow);
369 class PasteDefaultKeyframe : public BC_MenuItem
372 PasteDefaultKeyframe(MWindow *mwindow);
377 class ClearDefaultKeyframe : public BC_MenuItem
380 ClearDefaultKeyframe(MWindow *mwindow);
385 class PasteSilence : public BC_MenuItem
388 PasteSilence(MWindow *mwindow);
393 class SelectAll : public BC_MenuItem
396 SelectAll(MWindow *mwindow);
401 class ClearHardEdges : public BC_MenuItem
404 ClearHardEdges(MWindow *mwindow);
409 class ClearLabels : public BC_MenuItem
412 ClearLabels(MWindow *mwindow);
417 class ClearSelect : public BC_MenuItem
420 ClearSelect(MWindow *mwindow);
425 class CutCommercials : public BC_MenuItem
428 CutCommercials(MWindow *mwindow);
433 class DetachTransitions : public BC_MenuItem
436 DetachTransitions(MWindow *mwindow);
441 class MuteSelection : public BC_MenuItem
444 MuteSelection(MWindow *mwindow);
449 class TrimSelection : public BC_MenuItem
452 TrimSelection(MWindow *mwindow);
457 class MixerItems : public BC_MenuItem
460 MixerItems(MWindow *mwindow);
461 void create_objects();
465 class MixerViewer : public BC_MenuItem
468 MixerViewer(MWindow *mwindow);
473 class TileMixers : public BC_MenuItem
476 TileMixers(MWindow *mwindow);
481 class AlignMixers : public BC_MenuItem
484 AlignMixers(MWindow *mwindow);
489 // ======================================== audio
491 class AddAudioTrack : public BC_MenuItem
494 AddAudioTrack(MWindow *mwindow);
499 class DeleteAudioTrack : public BC_MenuItem
502 DeleteAudioTrack(MWindow *mwindow);
507 class DefaultATransition : public BC_MenuItem
510 DefaultATransition(MWindow *mwindow);
515 class MapAudio1 : public BC_MenuItem
518 MapAudio1(MWindow *mwindow);
523 class MapAudio2 : public BC_MenuItem
526 MapAudio2(MWindow *mwindow);
531 // ========================================== video
534 class AddVideoTrack : public BC_MenuItem
537 AddVideoTrack(MWindow *mwindow);
543 class DeleteVideoTrack : public BC_MenuItem
546 DeleteVideoTrack(MWindow *mwindow);
551 class ResetTranslation : public BC_MenuItem
554 ResetTranslation(MWindow *mwindow);
559 class DefaultVTransition : public BC_MenuItem
562 DefaultVTransition(MWindow *mwindow);
568 // ========================================== subtitle
570 class AddSubttlTrack : public BC_MenuItem
573 AddSubttlTrack(MWindow *mwindow);
578 class PasteSubttl : public BC_MenuItem
581 PasteSubttl(MWindow *mwindow);
587 // ========================================== settings
590 class MoveTracksUp : public BC_MenuItem
593 MoveTracksUp(MWindow *mwindow);
598 class MoveTracksDown : public BC_MenuItem
601 MoveTracksDown(MWindow *mwindow);
606 class DeleteTracks : public BC_MenuItem
609 DeleteTracks(MWindow *mwindow);
614 class ConcatenateTracks : public BC_MenuItem
617 ConcatenateTracks(MWindow *mwindow);
622 class DeleteFirstTrack : public BC_MenuItem
625 DeleteFirstTrack(MWindow *mwindow);
630 class DeleteLastTrack : public BC_MenuItem
633 DeleteLastTrack(MWindow *mwindow);
638 class LoopPlayback : public BC_MenuItem
641 LoopPlayback(MWindow *mwindow);
647 class SetBRenderActive : public BC_MenuItem
650 SetBRenderActive(MWindow *mwindow);
655 class LabelsFollowEdits : public BC_MenuItem
658 LabelsFollowEdits(MWindow *mwindow);
663 class PluginsFollowEdits : public BC_MenuItem
666 PluginsFollowEdits(MWindow *mwindow);
671 class KeyframesFollowEdits : public BC_MenuItem
674 KeyframesFollowEdits(MWindow *mwindow);
679 class CursorOnFrames : public BC_MenuItem
682 CursorOnFrames(MWindow *mwindow);
687 class TypelessKeyframes : public BC_MenuItem
690 TypelessKeyframes(MWindow *mwindow);
695 class ScrubSpeed : public BC_MenuItem
698 ScrubSpeed(MWindow *mwindow);
703 class SaveSettingsNow : public BC_MenuItem
706 SaveSettingsNow(MWindow *mwindow);
711 // ========================================== window
712 class ShowVWindow : public BC_MenuItem
715 ShowVWindow(MWindow *mwindow);
720 class ShowAWindow : public BC_MenuItem
723 ShowAWindow(MWindow *mwindow);
728 class ShowGWindow : public BC_MenuItem
731 ShowGWindow(MWindow *mwindow);
736 class ShowCWindow : public BC_MenuItem
739 ShowCWindow(MWindow *mwindow);
744 class ShowLWindow : public BC_MenuItem
747 ShowLWindow(MWindow *mwindow);
752 class TileWindows : public BC_MenuItem
755 TileWindows(MWindow *mwindow, const char *item_title, int config,
756 const char *hot_keytext="", int hot_key=0);
762 class SplitX : public BC_MenuItem
765 SplitX(MWindow *mwindow);
770 class SplitY : public BC_MenuItem
773 SplitY(MWindow *mwindow);
779 class LoadLayoutItem : public BC_MenuItem
782 LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey);
786 char layout_text[BCSTRLEN];
787 char layout_file[BCSTRLEN];
788 LoadLayout *load_layout;
791 class LoadLayout : public BC_MenuItem
794 LoadLayout(MWindow *mwindow, const char *text, int action);
796 void create_objects();
798 int activate_submenu();
801 LoadLayoutDialog *layout_dialog;
805 class LoadLayoutDialog : public BC_DialogThread
808 LoadLayoutDialog(LoadLayout *load_layout);
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();
816 LoadLayout *load_layout;
817 LoadLayoutConfirm *lgui;
821 class LoadLayoutNameText : public BC_TextBox
824 LoadLayoutNameText(LoadLayoutConfirm *confirm,
825 int x, int y, int w, const char *text);
826 ~LoadLayoutNameText();
830 LoadLayoutConfirm *confirm;
833 class LoadLayoutConfirm : public BC_Window
836 LoadLayoutConfirm(LoadLayoutDialog *load_dialog, int x, int y);
837 ~LoadLayoutConfirm();
838 void create_objects();
840 LoadLayoutDialog *layout_dialog;
841 LoadLayoutNameText *name_text;