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 CutCommercials : public BC_MenuItem
420 CutCommercials(MWindow *mwindow);
425 class DetachTransitions : public BC_MenuItem
428 DetachTransitions(MWindow *mwindow);
433 class MuteSelection : public BC_MenuItem
436 MuteSelection(MWindow *mwindow);
441 class TrimSelection : public BC_MenuItem
444 TrimSelection(MWindow *mwindow);
449 class MixerItems : public BC_MenuItem
452 MixerItems(MWindow *mwindow);
453 void create_objects();
457 class MixerViewer : public BC_MenuItem
460 MixerViewer(MWindow *mwindow);
465 class TileMixers : public BC_MenuItem
468 TileMixers(MWindow *mwindow);
473 class AlignMixers : public BC_MenuItem
476 AlignMixers(MWindow *mwindow);
481 // ======================================== audio
483 class AddAudioTrack : public BC_MenuItem
486 AddAudioTrack(MWindow *mwindow);
491 class DeleteAudioTrack : public BC_MenuItem
494 DeleteAudioTrack(MWindow *mwindow);
499 class DefaultATransition : public BC_MenuItem
502 DefaultATransition(MWindow *mwindow);
507 class MapAudio1 : public BC_MenuItem
510 MapAudio1(MWindow *mwindow);
515 class MapAudio2 : public BC_MenuItem
518 MapAudio2(MWindow *mwindow);
523 // ========================================== video
526 class AddVideoTrack : public BC_MenuItem
529 AddVideoTrack(MWindow *mwindow);
535 class DeleteVideoTrack : public BC_MenuItem
538 DeleteVideoTrack(MWindow *mwindow);
543 class ResetTranslation : public BC_MenuItem
546 ResetTranslation(MWindow *mwindow);
551 class DefaultVTransition : public BC_MenuItem
554 DefaultVTransition(MWindow *mwindow);
560 // ========================================== subtitle
562 class AddSubttlTrack : public BC_MenuItem
565 AddSubttlTrack(MWindow *mwindow);
570 class PasteSubttl : public BC_MenuItem
573 PasteSubttl(MWindow *mwindow);
579 // ========================================== settings
582 class MoveTracksUp : public BC_MenuItem
585 MoveTracksUp(MWindow *mwindow);
590 class MoveTracksDown : public BC_MenuItem
593 MoveTracksDown(MWindow *mwindow);
598 class DeleteTracks : public BC_MenuItem
601 DeleteTracks(MWindow *mwindow);
606 class ConcatenateTracks : public BC_MenuItem
609 ConcatenateTracks(MWindow *mwindow);
614 class DeleteFirstTrack : public BC_MenuItem
617 DeleteFirstTrack(MWindow *mwindow);
622 class DeleteLastTrack : public BC_MenuItem
625 DeleteLastTrack(MWindow *mwindow);
630 class LoopPlayback : public BC_MenuItem
633 LoopPlayback(MWindow *mwindow);
639 class SetBRenderActive : public BC_MenuItem
642 SetBRenderActive(MWindow *mwindow);
647 class LabelsFollowEdits : public BC_MenuItem
650 LabelsFollowEdits(MWindow *mwindow);
655 class PluginsFollowEdits : public BC_MenuItem
658 PluginsFollowEdits(MWindow *mwindow);
663 class KeyframesFollowEdits : public BC_MenuItem
666 KeyframesFollowEdits(MWindow *mwindow);
671 class CursorOnFrames : public BC_MenuItem
674 CursorOnFrames(MWindow *mwindow);
679 class TypelessKeyframes : public BC_MenuItem
682 TypelessKeyframes(MWindow *mwindow);
687 class ScrubSpeed : public BC_MenuItem
690 ScrubSpeed(MWindow *mwindow);
695 class SaveSettingsNow : public BC_MenuItem
698 SaveSettingsNow(MWindow *mwindow);
703 // ========================================== window
704 class ShowVWindow : public BC_MenuItem
707 ShowVWindow(MWindow *mwindow);
712 class ShowAWindow : public BC_MenuItem
715 ShowAWindow(MWindow *mwindow);
720 class ShowGWindow : public BC_MenuItem
723 ShowGWindow(MWindow *mwindow);
728 class ShowCWindow : public BC_MenuItem
731 ShowCWindow(MWindow *mwindow);
736 class ShowLWindow : public BC_MenuItem
739 ShowLWindow(MWindow *mwindow);
744 class TileWindows : public BC_MenuItem
747 TileWindows(MWindow *mwindow, const char *item_title, int config,
748 const char *hot_keytext="", int hot_key=0);
754 class SplitX : public BC_MenuItem
757 SplitX(MWindow *mwindow);
762 class SplitY : public BC_MenuItem
765 SplitY(MWindow *mwindow);
771 class LoadLayoutItem : public BC_MenuItem
774 LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey);
778 char layout_text[BCSTRLEN];
779 char layout_file[BCSTRLEN];
780 LoadLayout *load_layout;
783 class LoadLayout : public BC_MenuItem
786 LoadLayout(MWindow *mwindow, const char *text, int action);
788 void create_objects();
790 int activate_submenu();
793 LoadLayoutDialog *layout_dialog;
797 class LoadLayoutDialog : public BC_DialogThread
800 LoadLayoutDialog(LoadLayout *load_layout);
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();
808 LoadLayout *load_layout;
809 LoadLayoutConfirm *lgui;
813 class LoadLayoutNameText : public BC_TextBox
816 LoadLayoutNameText(LoadLayoutConfirm *confirm,
817 int x, int y, int w, const char *text);
818 ~LoadLayoutNameText();
822 LoadLayoutConfirm *confirm;
825 class LoadLayoutConfirm : public BC_Window
828 LoadLayoutConfirm(LoadLayoutDialog *load_dialog, int x, int y);
829 ~LoadLayoutConfirm();
830 void create_objects();
832 LoadLayoutDialog *layout_dialog;
833 LoadLayoutNameText *name_text;