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 20 // number of files to cache
45 #define TOTAL_EFFECTS 10 // number of effects to cache
53 LoadRecentItem(const char *path);
58 class LoadRecentItems : public ArrayList<LoadRecentItem *>
63 int add_load(char *path);
66 class LoadRecentSubMenu : public BC_SubMenu
69 LoadRecentSubMenu(LoadRecent *load_recent);
72 LoadRecent *load_recent;
75 class LoadRecent : public BC_MenuItem
78 LoadRecent(MWindow *mwindow, MainMenu *main_menu);
80 void create_objects();
81 LoadPrevious *get_next_item();
82 int activate_submenu();
83 void scan_items(int use_xml);
87 LoadRecentSubMenu *submenu;
92 class MainMenu : public BC_MenuBar
95 MainMenu(MWindow *mwindow, MWindowGUI *gui, int w);
97 void create_objects();
98 int load_defaults(BC_Hash *defaults);
99 int save_defaults(BC_Hash *defaults);
102 int add_load(char *path);
103 void init_loads(BC_Hash *defaults);
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);
115 // show only one of these at a time
116 int set_show_autos();
117 void update_toggles(int use_lock);
121 ThreadLoader *threadloader;
122 MenuAEffects *aeffects;
123 MenuVEffects *veffects;
126 LoadRecentItems load;
127 LoadRecent *load_recent;
129 RecordMenuItem *record_menu_item;
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;
140 BC_Menu *audiomenu, *videomenu; // needed by most recents
141 int total_aeffects, total_veffects;
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;
174 MixerItems *mixer_items;
175 LoadLayout *load_layout;
176 LoadLayout *save_layout;
179 // ========================================= edit
181 class Undo : public BC_MenuItem
184 Undo(MWindow *mwindow);
186 int update_caption(const char *new_caption = "");
190 class MainDumpsSubMenu : public BC_SubMenu
193 MainDumpsSubMenu(BC_MenuItem *menu_item);
196 BC_MenuItem *menu_item;
199 class MainDumpsMenu : public BC_MenuItem
202 MainDumpsMenu(MWindow *mwindow);
204 void create_objects();
207 MainDumpsSubMenu *dumps_menu;
210 class DumpCICache : public BC_MenuItem
213 DumpCICache(MWindow *mwindow);
218 class DumpEDL : public BC_MenuItem
221 DumpEDL(MWindow *mwindow);
226 class DumpPlugins : public BC_MenuItem
229 DumpPlugins(MWindow *mwindow);
234 class DumpAssets : public BC_MenuItem
237 DumpAssets(MWindow *mwindow);
242 class DumpUndo : public BC_MenuItem
245 DumpUndo(MWindow *mwindow);
250 class Redo : public BC_MenuItem
253 Redo(MWindow *mwindow);
255 int update_caption(const char *new_caption = "");
259 class Cut : public BC_MenuItem
262 Cut(MWindow *mwindow);
267 class Copy : public BC_MenuItem
270 Copy(MWindow *mwindow);
275 class Paste : public BC_MenuItem
278 Paste(MWindow *mwindow);
283 class EditClearSubMenu : public BC_SubMenu
286 EditClearSubMenu(BC_MenuItem *menu_item);
289 BC_MenuItem *menu_item;
292 class EditClearMenu : public BC_MenuItem
295 EditClearMenu(MWindow *mwindow);
297 void create_objects();
300 EditClearSubMenu *clear_sub_menu;
303 class Clear : public BC_MenuItem
306 Clear(MWindow *mwindow);
311 class CutKeyframes : public BC_MenuItem
314 CutKeyframes(MWindow *mwindow);
319 class CopyKeyframes : public BC_MenuItem
322 CopyKeyframes(MWindow *mwindow);
327 class PasteKeyframes : public BC_MenuItem
330 PasteKeyframes(MWindow *mwindow);
336 class ClearKeyframes : public BC_MenuItem
339 ClearKeyframes(MWindow *mwindow);
344 class StraightenKeyframes : public BC_MenuItem
347 StraightenKeyframes(MWindow *mwindow);
352 class BendKeyframes : public BC_MenuItem
355 BendKeyframes(MWindow *mwindow);
360 class KeyframeCurveType : public BC_MenuItem
363 KeyframeCurveType(MWindow *mwindow);
364 ~KeyframeCurveType();
366 void create_objects();
367 void update(int curve_type);
371 KeyframeCurveTypeMenu *curve_menu;
374 class KeyframeCurveTypeMenu : public BC_SubMenu
377 KeyframeCurveTypeMenu(KeyframeCurveType *menu_item);
378 ~KeyframeCurveTypeMenu();
380 KeyframeCurveType *menu_item;
383 class KeyframeCurveTypeItem : public BC_MenuItem
386 KeyframeCurveTypeItem(int type, KeyframeCurveType *main_item);
387 ~KeyframeCurveTypeItem();
389 KeyframeCurveType *main_item;
395 class CutDefaultKeyframe : public BC_MenuItem
398 CutDefaultKeyframe(MWindow *mwindow);
403 class CopyDefaultKeyframe : public BC_MenuItem
406 CopyDefaultKeyframe(MWindow *mwindow);
411 class PasteDefaultKeyframe : public BC_MenuItem
414 PasteDefaultKeyframe(MWindow *mwindow);
419 class ClearDefaultKeyframe : public BC_MenuItem
422 ClearDefaultKeyframe(MWindow *mwindow);
427 class PasteSilence : public BC_MenuItem
430 PasteSilence(MWindow *mwindow);
435 class SelectAll : public BC_MenuItem
438 SelectAll(MWindow *mwindow);
443 class ClearHardEdges : public BC_MenuItem
446 ClearHardEdges(MWindow *mwindow);
451 class ClearLabels : public BC_MenuItem
454 ClearLabels(MWindow *mwindow);
459 class ClearSelect : public BC_MenuItem
462 ClearSelect(MWindow *mwindow);
467 class CutCommercials : public BC_MenuItem
470 CutCommercials(MWindow *mwindow);
475 class DetachTransitions : public BC_MenuItem
478 DetachTransitions(MWindow *mwindow);
483 class MuteSelection : public BC_MenuItem
486 MuteSelection(MWindow *mwindow);
491 class TrimSelection : public BC_MenuItem
494 TrimSelection(MWindow *mwindow);
499 class MixerItems : public BC_MenuItem
502 MixerItems(MWindow *mwindow);
503 void create_objects();
504 int activate_submenu();
509 class MixerItem : public BC_MenuItem
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();
516 MixerItems *mixer_items;
520 class MixerViewer : public MixerItem
523 MixerViewer(MixerItems *mixer_items);
527 class TileMixers : public MixerItem
530 TileMixers(MixerItems *mixer_items);
534 class AlignMixers : public MixerItem
537 AlignMixers(MixerItems *mixer_items);
541 class MixMasters : public MixerItem
544 MixMasters(MixerItems *mixer_items);
548 class AlignTimecodes : public BC_MenuItem
551 AlignTimecodes(MWindow *mwindow);
556 // ======================================== audio
558 class AddAudioTrack : public BC_MenuItem
561 AddAudioTrack(MWindow *mwindow);
566 class DeleteAudioTrack : public BC_MenuItem
569 DeleteAudioTrack(MWindow *mwindow);
574 class DefaultATransition : public BC_MenuItem
577 DefaultATransition(MWindow *mwindow);
582 class MapAudio1 : public BC_MenuItem
585 MapAudio1(MWindow *mwindow);
590 class MapAudio2 : public BC_MenuItem
593 MapAudio2(MWindow *mwindow);
598 // ========================================== video
601 class AddVideoTrack : public BC_MenuItem
604 AddVideoTrack(MWindow *mwindow);
610 class DeleteVideoTrack : public BC_MenuItem
613 DeleteVideoTrack(MWindow *mwindow);
618 class ResetTranslation : public BC_MenuItem
621 ResetTranslation(MWindow *mwindow);
626 class DefaultVTransition : public BC_MenuItem
629 DefaultVTransition(MWindow *mwindow);
635 // ========================================== subtitle
637 class AddSubttlTrack : public BC_MenuItem
640 AddSubttlTrack(MWindow *mwindow);
645 class PasteSubttl : public BC_MenuItem
648 PasteSubttl(MWindow *mwindow);
654 // ========================================== settings
657 class MoveTracksUp : public BC_MenuItem
660 MoveTracksUp(MWindow *mwindow);
665 class MoveTracksDown : public BC_MenuItem
668 MoveTracksDown(MWindow *mwindow);
673 class SwapTracksUp : public BC_MenuItem
676 SwapTracksUp(MWindow *mwindow);
681 class SwapTracksDown : public BC_MenuItem
684 SwapTracksDown(MWindow *mwindow);
689 class DeleteTracks : public BC_MenuItem
692 DeleteTracks(MWindow *mwindow);
697 class ConcatenateTracks : public BC_MenuItem
700 ConcatenateTracks(MWindow *mwindow);
705 class DeleteFirstTrack : public BC_MenuItem
708 DeleteFirstTrack(MWindow *mwindow);
713 class DeleteLastTrack : public BC_MenuItem
716 DeleteLastTrack(MWindow *mwindow);
721 class LoopPlayback : public BC_MenuItem
724 LoopPlayback(MWindow *mwindow);
730 class SetBRenderActive : public BC_MenuItem
733 SetBRenderActive(MWindow *mwindow);
738 class LabelsFollowEdits : public BC_MenuItem
741 LabelsFollowEdits(MWindow *mwindow);
746 class PluginsFollowEdits : public BC_MenuItem
749 PluginsFollowEdits(MWindow *mwindow);
754 class KeyframesFollowEdits : public BC_MenuItem
757 KeyframesFollowEdits(MWindow *mwindow);
762 class CursorOnFrames : public BC_MenuItem
765 CursorOnFrames(MWindow *mwindow);
770 class TypelessKeyframes : public BC_MenuItem
773 TypelessKeyframes(MWindow *mwindow);
778 class ScrubSpeed : public BC_MenuItem
781 ScrubSpeed(MWindow *mwindow);
786 class SaveSettingsNow : public BC_MenuItem
789 SaveSettingsNow(MWindow *mwindow);
794 // ========================================== window
795 class ShowVWindow : public BC_MenuItem
798 ShowVWindow(MWindow *mwindow);
803 class ShowAWindow : public BC_MenuItem
806 ShowAWindow(MWindow *mwindow);
811 class ShowGWindow : public BC_MenuItem
814 ShowGWindow(MWindow *mwindow);
819 class ShowCWindow : public BC_MenuItem
822 ShowCWindow(MWindow *mwindow);
827 class ShowLWindow : public BC_MenuItem
830 ShowLWindow(MWindow *mwindow);
835 class TileWindows : public BC_MenuItem
838 TileWindows(MWindow *mwindow, const char *item_title, int config,
839 const char *hot_keytext="", int hot_key=0);
845 class SplitX : public BC_MenuItem
848 SplitX(MWindow *mwindow);
853 class SplitY : public BC_MenuItem
856 SplitY(MWindow *mwindow);
862 class LoadLayoutItem : public BC_MenuItem
865 LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey);
869 char layout_text[BCSTRLEN];
870 char layout_file[BCSTRLEN];
871 LoadLayout *load_layout;
874 class LoadLayout : public BC_MenuItem
877 LoadLayout(MWindow *mwindow, const char *text, int action);
879 void create_objects();
881 int activate_submenu();
884 LoadLayoutDialog *layout_dialog;
888 class LoadLayoutDialog : public BC_DialogThread
891 LoadLayoutDialog(LoadLayout *load_layout);
894 void start_confirm_dialog(int wx, int wy, int idx);
895 void handle_done_event(int result);
896 void handle_close_event(int result);
897 BC_Window* new_gui();
899 LoadLayout *load_layout;
900 LoadLayoutConfirm *lgui;
904 class LoadLayoutNameText : public BC_TextBox
907 LoadLayoutNameText(LoadLayoutConfirm *confirm,
908 int x, int y, int w, const char *text);
909 ~LoadLayoutNameText();
913 LoadLayoutConfirm *confirm;
916 class LoadLayoutConfirm : public BC_Window
919 LoadLayoutConfirm(LoadLayoutDialog *load_dialog, int x, int y);
920 ~LoadLayoutConfirm();
921 void create_objects();
923 LoadLayoutDialog *layout_dialog;
924 LoadLayoutNameText *name_text;