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();
507 class MixerViewer : public BC_MenuItem
510 MixerViewer(MWindow *mwindow);
515 class TileMixers : public BC_MenuItem
518 TileMixers(MWindow *mwindow);
523 class AlignMixers : public BC_MenuItem
526 AlignMixers(MWindow *mwindow);
531 // ======================================== audio
533 class AddAudioTrack : public BC_MenuItem
536 AddAudioTrack(MWindow *mwindow);
541 class DeleteAudioTrack : public BC_MenuItem
544 DeleteAudioTrack(MWindow *mwindow);
549 class DefaultATransition : public BC_MenuItem
552 DefaultATransition(MWindow *mwindow);
557 class MapAudio1 : public BC_MenuItem
560 MapAudio1(MWindow *mwindow);
565 class MapAudio2 : public BC_MenuItem
568 MapAudio2(MWindow *mwindow);
573 // ========================================== video
576 class AddVideoTrack : public BC_MenuItem
579 AddVideoTrack(MWindow *mwindow);
585 class DeleteVideoTrack : public BC_MenuItem
588 DeleteVideoTrack(MWindow *mwindow);
593 class ResetTranslation : public BC_MenuItem
596 ResetTranslation(MWindow *mwindow);
601 class DefaultVTransition : public BC_MenuItem
604 DefaultVTransition(MWindow *mwindow);
610 // ========================================== subtitle
612 class AddSubttlTrack : public BC_MenuItem
615 AddSubttlTrack(MWindow *mwindow);
620 class PasteSubttl : public BC_MenuItem
623 PasteSubttl(MWindow *mwindow);
629 // ========================================== settings
632 class MoveTracksUp : public BC_MenuItem
635 MoveTracksUp(MWindow *mwindow);
640 class MoveTracksDown : public BC_MenuItem
643 MoveTracksDown(MWindow *mwindow);
648 class DeleteTracks : public BC_MenuItem
651 DeleteTracks(MWindow *mwindow);
656 class ConcatenateTracks : public BC_MenuItem
659 ConcatenateTracks(MWindow *mwindow);
664 class DeleteFirstTrack : public BC_MenuItem
667 DeleteFirstTrack(MWindow *mwindow);
672 class DeleteLastTrack : public BC_MenuItem
675 DeleteLastTrack(MWindow *mwindow);
680 class LoopPlayback : public BC_MenuItem
683 LoopPlayback(MWindow *mwindow);
689 class SetBRenderActive : public BC_MenuItem
692 SetBRenderActive(MWindow *mwindow);
697 class LabelsFollowEdits : public BC_MenuItem
700 LabelsFollowEdits(MWindow *mwindow);
705 class PluginsFollowEdits : public BC_MenuItem
708 PluginsFollowEdits(MWindow *mwindow);
713 class KeyframesFollowEdits : public BC_MenuItem
716 KeyframesFollowEdits(MWindow *mwindow);
721 class CursorOnFrames : public BC_MenuItem
724 CursorOnFrames(MWindow *mwindow);
729 class TypelessKeyframes : public BC_MenuItem
732 TypelessKeyframes(MWindow *mwindow);
737 class ScrubSpeed : public BC_MenuItem
740 ScrubSpeed(MWindow *mwindow);
745 class SaveSettingsNow : public BC_MenuItem
748 SaveSettingsNow(MWindow *mwindow);
753 // ========================================== window
754 class ShowVWindow : public BC_MenuItem
757 ShowVWindow(MWindow *mwindow);
762 class ShowAWindow : public BC_MenuItem
765 ShowAWindow(MWindow *mwindow);
770 class ShowGWindow : public BC_MenuItem
773 ShowGWindow(MWindow *mwindow);
778 class ShowCWindow : public BC_MenuItem
781 ShowCWindow(MWindow *mwindow);
786 class ShowLWindow : public BC_MenuItem
789 ShowLWindow(MWindow *mwindow);
794 class TileWindows : public BC_MenuItem
797 TileWindows(MWindow *mwindow, const char *item_title, int config,
798 const char *hot_keytext="", int hot_key=0);
804 class SplitX : public BC_MenuItem
807 SplitX(MWindow *mwindow);
812 class SplitY : public BC_MenuItem
815 SplitY(MWindow *mwindow);
821 class LoadLayoutItem : public BC_MenuItem
824 LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey);
828 char layout_text[BCSTRLEN];
829 char layout_file[BCSTRLEN];
830 LoadLayout *load_layout;
833 class LoadLayout : public BC_MenuItem
836 LoadLayout(MWindow *mwindow, const char *text, int action);
838 void create_objects();
840 int activate_submenu();
843 LoadLayoutDialog *layout_dialog;
847 class LoadLayoutDialog : public BC_DialogThread
850 LoadLayoutDialog(LoadLayout *load_layout);
853 void start_confirm_dialog(int wx, int wy, int idx);
854 void handle_done_event(int result);
855 void handle_close_event(int result);
856 BC_Window* new_gui();
858 LoadLayout *load_layout;
859 LoadLayoutConfirm *lgui;
863 class LoadLayoutNameText : public BC_TextBox
866 LoadLayoutNameText(LoadLayoutConfirm *confirm,
867 int x, int y, int w, const char *text);
868 ~LoadLayoutNameText();
872 LoadLayoutConfirm *confirm;
875 class LoadLayoutConfirm : public BC_Window
878 LoadLayoutConfirm(LoadLayoutDialog *load_dialog, int x, int y);
879 ~LoadLayoutConfirm();
880 void create_objects();
882 LoadLayoutDialog *layout_dialog;
883 LoadLayoutNameText *name_text;