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 KeyframeCreate *keyframe_create;
145 SetAutomationCurveMode *set_auto_curves;
146 LabelsFollowEdits *labels_follow_edits;
147 PluginsFollowEdits *plugins_follow_edits;
148 KeyframesFollowEdits *keyframes_follow_edits;
149 CursorOnFrames *cursor_on_frames;
150 TypelessKeyframes *typeless_keyframes;
151 SetBRenderActive *brender_active;
152 LoopPlayback *loop_playback;
153 ShowAssets *show_assets;
154 ShowTitles *show_titles;
155 ShowTransitions *show_transitions;
156 ShowAutomation *fade_automation;
157 ShowAutomation *mute_automation;
158 ShowAutomation *pan_automation;
159 ShowAutomation *camera_x;
160 ShowAutomation *camera_y;
161 ShowAutomation *camera_z;
162 ShowAutomation *project_x;
163 ShowAutomation *project_y;
164 ShowAutomation *project_z;
165 PluginAutomation *plugin_automation;
166 ShowAutomation *mask_automation;
167 ShowAutomation *mode_automation;
168 ShowAutomation *speed_automation;
169 ShowVWindow *show_vwindow;
170 ShowAWindow *show_awindow;
171 ShowCWindow *show_cwindow;
172 ShowGWindow *show_gwindow;
173 ShowLWindow *show_lwindow;
176 MixerItems *mixer_items;
177 LoadLayout *load_layout;
178 LoadLayout *save_layout;
181 // ========================================= edit
183 class Undo : public BC_MenuItem
186 Undo(MWindow *mwindow);
188 int update_caption(const char *new_caption = "");
192 class MainDumpsSubMenu : public BC_SubMenu
195 MainDumpsSubMenu(BC_MenuItem *menu_item);
198 BC_MenuItem *menu_item;
201 class MainDumpsMenu : public BC_MenuItem
204 MainDumpsMenu(MWindow *mwindow);
206 void create_objects();
209 MainDumpsSubMenu *dumps_menu;
212 class DumpCICache : public BC_MenuItem
215 DumpCICache(MWindow *mwindow);
220 class DumpEDL : public BC_MenuItem
223 DumpEDL(MWindow *mwindow);
228 class DumpPlugins : public BC_MenuItem
231 DumpPlugins(MWindow *mwindow);
236 class DumpAssets : public BC_MenuItem
239 DumpAssets(MWindow *mwindow);
244 class DumpUndo : public BC_MenuItem
247 DumpUndo(MWindow *mwindow);
252 class Redo : public BC_MenuItem
255 Redo(MWindow *mwindow);
257 int update_caption(const char *new_caption = "");
261 class Cut : public BC_MenuItem
264 Cut(MWindow *mwindow);
269 class Copy : public BC_MenuItem
272 Copy(MWindow *mwindow);
277 class Paste : public BC_MenuItem
280 Paste(MWindow *mwindow);
285 class EditClearSubMenu : public BC_SubMenu
288 EditClearSubMenu(BC_MenuItem *menu_item);
291 BC_MenuItem *menu_item;
294 class EditClearMenu : public BC_MenuItem
297 EditClearMenu(MWindow *mwindow);
299 void create_objects();
302 EditClearSubMenu *clear_sub_menu;
305 class Clear : public BC_MenuItem
308 Clear(MWindow *mwindow);
313 class CutKeyframes : public BC_MenuItem
316 CutKeyframes(MWindow *mwindow);
321 class CopyKeyframes : public BC_MenuItem
324 CopyKeyframes(MWindow *mwindow);
329 class PasteKeyframes : public BC_MenuItem
332 PasteKeyframes(MWindow *mwindow);
338 class ClearKeyframes : public BC_MenuItem
341 ClearKeyframes(MWindow *mwindow);
347 class SetAutomationCurveItem : public BC_MenuItem
350 SetAutomationCurveItem(SetAutomationCurveMode *set_curve_mode, int id);
352 SetAutomationCurveMode *set_curve_mode;
356 class SetAutoCurveModeMenu : public BC_SubMenu
359 SetAutoCurveModeMenu(SetAutomationCurveMode *curve_mode);
360 SetAutomationCurveMode *curve_mode;
363 class SetAutomationCurveMode : public BC_MenuItem
366 SetAutomationCurveMode(MWindow *mwindow);
367 void create_objects();
370 SetAutoCurveModeMenu *curve_mode_menu;
374 class KeyframeCurveType : public BC_MenuItem
377 KeyframeCurveType(MWindow *mwindow);
378 ~KeyframeCurveType();
380 void create_objects();
381 void update(int curve_type);
385 KeyframeCurveTypeMenu *curve_menu;
388 class KeyframeCurveTypeMenu : public BC_SubMenu
391 KeyframeCurveTypeMenu(KeyframeCurveType *menu_item);
392 ~KeyframeCurveTypeMenu();
394 KeyframeCurveType *menu_item;
397 class KeyframeCurveTypeItem : public BC_MenuItem
400 KeyframeCurveTypeItem(int type, KeyframeCurveType *main_item);
401 ~KeyframeCurveTypeItem();
403 KeyframeCurveType *main_item;
409 class KeyframeCreateItem : public BC_MenuItem
412 KeyframeCreateItem(KeyframeCreate *keyframe_create, const char *text, int mask);
415 KeyframeCreate *keyframe_create;
419 class KeyframeCreateMenu : public BC_SubMenu
422 KeyframeCreateMenu(KeyframeCreate *keyframe_create);
423 KeyframeCreate *keyframe_create;
426 class KeyframeCreate : public BC_MenuItem
429 KeyframeCreate(MWindow *mwindow);
430 void create_objects();
433 KeyframeCreateMenu *keyframe_create_menu;
437 class CutDefaultKeyframe : public BC_MenuItem
440 CutDefaultKeyframe(MWindow *mwindow);
445 class CopyDefaultKeyframe : public BC_MenuItem
448 CopyDefaultKeyframe(MWindow *mwindow);
453 class PasteDefaultKeyframe : public BC_MenuItem
456 PasteDefaultKeyframe(MWindow *mwindow);
461 class ClearDefaultKeyframe : public BC_MenuItem
464 ClearDefaultKeyframe(MWindow *mwindow);
469 class PasteSilence : public BC_MenuItem
472 PasteSilence(MWindow *mwindow);
477 class SelectAll : public BC_MenuItem
480 SelectAll(MWindow *mwindow);
485 class ClearHardEdges : public BC_MenuItem
488 ClearHardEdges(MWindow *mwindow);
493 class ClearLabels : public BC_MenuItem
496 ClearLabels(MWindow *mwindow);
501 class ClearSelect : public BC_MenuItem
504 ClearSelect(MWindow *mwindow);
509 class CutCommercials : public BC_MenuItem
512 CutCommercials(MWindow *mwindow);
517 class DetachTransitions : public BC_MenuItem
520 DetachTransitions(MWindow *mwindow);
525 class MuteSelection : public BC_MenuItem
528 MuteSelection(MWindow *mwindow);
533 class TrimSelection : public BC_MenuItem
536 TrimSelection(MWindow *mwindow);
541 class MixerItems : public BC_MenuItem
544 MixerItems(MWindow *mwindow);
545 void create_objects();
546 int activate_submenu();
551 class MixerItem : public BC_MenuItem
554 MixerItem(MixerItems *mixer_items, const char *text, int idx);
555 MixerItem(MixerItems *mixer_items, const char *text, const char *hotkey_text, int hotkey);
556 virtual int handle_event();
558 MixerItems *mixer_items;
562 class MixerViewer : public MixerItem
565 MixerViewer(MixerItems *mixer_items);
569 class TileMixers : public MixerItem
572 TileMixers(MixerItems *mixer_items);
576 class AlignMixers : public MixerItem
579 AlignMixers(MixerItems *mixer_items);
583 class MixMasters : public MixerItem
586 MixMasters(MixerItems *mixer_items);
590 class AlignTimecodes : public BC_MenuItem
593 AlignTimecodes(MWindow *mwindow);
598 // ======================================== audio
600 class AddAudioTrack : public BC_MenuItem
603 AddAudioTrack(MWindow *mwindow);
608 class DeleteAudioTrack : public BC_MenuItem
611 DeleteAudioTrack(MWindow *mwindow);
616 class DefaultATransition : public BC_MenuItem
619 DefaultATransition(MWindow *mwindow);
624 class MapAudio1 : public BC_MenuItem
627 MapAudio1(MWindow *mwindow);
632 class MapAudio2 : public BC_MenuItem
635 MapAudio2(MWindow *mwindow);
640 // ========================================== video
643 class AddVideoTrack : public BC_MenuItem
646 AddVideoTrack(MWindow *mwindow);
652 class DeleteVideoTrack : public BC_MenuItem
655 DeleteVideoTrack(MWindow *mwindow);
660 class ResetTranslation : public BC_MenuItem
663 ResetTranslation(MWindow *mwindow);
668 class DefaultVTransition : public BC_MenuItem
671 DefaultVTransition(MWindow *mwindow);
677 // ========================================== subtitle
679 class AddSubttlTrack : public BC_MenuItem
682 AddSubttlTrack(MWindow *mwindow);
687 class PasteSubttl : public BC_MenuItem
690 PasteSubttl(MWindow *mwindow);
696 // ========================================== settings
699 class MoveTracksUp : public BC_MenuItem
702 MoveTracksUp(MWindow *mwindow);
707 class MoveTracksDown : public BC_MenuItem
710 MoveTracksDown(MWindow *mwindow);
715 class SwapTracksUp : public BC_MenuItem
718 SwapTracksUp(MWindow *mwindow);
723 class SwapTracksDown : public BC_MenuItem
726 SwapTracksDown(MWindow *mwindow);
731 class DeleteTracks : public BC_MenuItem
734 DeleteTracks(MWindow *mwindow);
739 class ConcatenateTracks : public BC_MenuItem
742 ConcatenateTracks(MWindow *mwindow);
747 class DeleteFirstTrack : public BC_MenuItem
750 DeleteFirstTrack(MWindow *mwindow);
755 class DeleteLastTrack : public BC_MenuItem
758 DeleteLastTrack(MWindow *mwindow);
763 class LoopPlayback : public BC_MenuItem
766 LoopPlayback(MWindow *mwindow);
772 class SetBRenderActive : public BC_MenuItem
775 SetBRenderActive(MWindow *mwindow);
780 class LabelsFollowEdits : public BC_MenuItem
783 LabelsFollowEdits(MWindow *mwindow);
788 class PluginsFollowEdits : public BC_MenuItem
791 PluginsFollowEdits(MWindow *mwindow);
796 class KeyframesFollowEdits : public BC_MenuItem
799 KeyframesFollowEdits(MWindow *mwindow);
804 class CursorOnFrames : public BC_MenuItem
807 CursorOnFrames(MWindow *mwindow);
812 class TypelessKeyframes : public BC_MenuItem
815 TypelessKeyframes(MWindow *mwindow);
820 class ScrubSpeed : public BC_MenuItem
823 ScrubSpeed(MWindow *mwindow);
828 class SaveSettingsNow : public BC_MenuItem
831 SaveSettingsNow(MWindow *mwindow);
836 // ========================================== window
837 class ShowVWindow : public BC_MenuItem
840 ShowVWindow(MWindow *mwindow);
845 class ShowAWindow : public BC_MenuItem
848 ShowAWindow(MWindow *mwindow);
853 class ShowGWindow : public BC_MenuItem
856 ShowGWindow(MWindow *mwindow);
861 class ShowCWindow : public BC_MenuItem
864 ShowCWindow(MWindow *mwindow);
869 class ShowLWindow : public BC_MenuItem
872 ShowLWindow(MWindow *mwindow);
877 class TileWindows : public BC_MenuItem
880 TileWindows(MWindow *mwindow, const char *item_title, int config,
881 const char *hot_keytext="", int hot_key=0);
887 class SplitX : public BC_MenuItem
890 SplitX(MWindow *mwindow);
895 class SplitY : public BC_MenuItem
898 SplitY(MWindow *mwindow);
904 class LoadLayoutItem : public BC_MenuItem
907 LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey);
911 char layout_text[BCSTRLEN];
912 char layout_file[BCSTRLEN];
913 LoadLayout *load_layout;
916 class LoadLayout : public BC_MenuItem
919 LoadLayout(MWindow *mwindow, const char *text, int action);
921 void create_objects();
923 int activate_submenu();
926 LoadLayoutDialog *layout_dialog;
930 class LoadLayoutDialog : public BC_DialogThread
933 LoadLayoutDialog(LoadLayout *load_layout);
936 void start_confirm_dialog(int wx, int wy, int idx);
937 void handle_done_event(int result);
938 void handle_close_event(int result);
939 BC_Window* new_gui();
941 LoadLayout *load_layout;
942 LoadLayoutConfirm *lgui;
946 class LoadLayoutNameText : public BC_TextBox
949 LoadLayoutNameText(LoadLayoutConfirm *confirm,
950 int x, int y, int w, const char *text);
951 ~LoadLayoutNameText();
955 LoadLayoutConfirm *confirm;
958 class LoadLayoutConfirm : public BC_Window
961 LoadLayoutConfirm(LoadLayoutDialog *load_dialog, int x, int y);
962 ~LoadLayoutConfirm();
963 void create_objects();
965 LoadLayoutDialog *layout_dialog;
966 LoadLayoutNameText *name_text;