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"
42 #include "threadloader.inc"
43 #include "viewmenu.inc"
45 #define TOTAL_LOADS 20 // number of files to cache
46 #define TOTAL_EFFECTS 10 // number of effects to cache
54 LoadRecentItem(const char *path);
59 class LoadRecentItems : public ArrayList<LoadRecentItem *>
64 int add_load(char *path);
67 class LoadRecentSubMenu : public BC_SubMenu
70 LoadRecentSubMenu(LoadRecent *load_recent);
73 LoadRecent *load_recent;
76 class LoadRecent : public BC_MenuItem
79 LoadRecent(MWindow *mwindow, MainMenu *main_menu);
81 void create_objects();
82 LoadPrevious *get_next_item();
83 int activate_submenu();
84 void scan_items(int use_xml);
88 LoadRecentSubMenu *submenu;
93 class MainMenu : public BC_MenuBar
96 MainMenu(MWindow *mwindow, MWindowGUI *gui, int w);
98 void create_objects();
99 int load_defaults(BC_Hash *defaults);
100 int save_defaults(BC_Hash *defaults);
103 int add_load(char *path);
104 void init_loads(BC_Hash *defaults);
106 // most recent effects
107 int init_aeffects(BC_Hash *defaults);
108 int save_aeffects(BC_Hash *defaults);
109 int add_aeffect(char *title);
110 int init_veffects(BC_Hash *defaults);
111 int save_veffects(BC_Hash *defaults);
112 int save_loads(BC_Hash *defaults);
113 int add_veffect(char *title);
116 // show only one of these at a time
117 int set_show_autos();
118 void update_toggles(int use_lock);
122 ThreadLoader *threadloader;
123 MenuAEffects *aeffects;
124 MenuVEffects *veffects;
127 LoadRecentItems load;
128 LoadRecent *load_recent;
130 RecordMenuItem *record_menu_item;
132 NewProject *new_project;
133 MenuAEffectItem *aeffect[TOTAL_EFFECTS];
134 MenuVEffectItem *veffect[TOTAL_EFFECTS];
135 Quit *quit_program; // affected by save
136 MainDumpsMenu *dump_menu;
137 EditClearMenu *clear_menu;
141 BC_Menu *audiomenu, *videomenu; // needed by most recents
142 int total_aeffects, total_veffects;
144 KeyframeCurveType *keyframe_curve_type;
145 KeyframeCreate *keyframe_create;
146 SetAutomationCurveMode *set_auto_curves;
147 LabelsFollowEdits *labels_follow_edits;
148 PluginsFollowEdits *plugins_follow_edits;
149 KeyframesFollowEdits *keyframes_follow_edits;
150 CursorOnFrames *cursor_on_frames;
151 TypelessKeyframes *typeless_keyframes;
152 SetBRenderActive *brender_active;
153 LoopPlayback *loop_playback;
154 ShowAssets *show_assets;
155 ShowTitles *show_titles;
156 ShowTransitions *show_transitions;
157 ShowAutomation *fade_automation;
158 ShowAutomation *mute_automation;
159 ShowAutomation *pan_automation;
160 ShowAutomation *camera_x;
161 ShowAutomation *camera_y;
162 ShowAutomation *camera_z;
163 ShowAutomation *project_x;
164 ShowAutomation *project_y;
165 ShowAutomation *project_z;
166 PluginAutomation *plugin_automation;
167 ShowAutomation *mask_automation;
168 ShowAutomation *mode_automation;
169 ShowAutomation *speed_automation;
170 ShowVWindow *show_vwindow;
171 ShowAWindow *show_awindow;
172 ShowCWindow *show_cwindow;
173 ShowGWindow *show_gwindow;
174 ShowLWindow *show_lwindow;
177 MixerItems *mixer_items;
178 LoadLayout *load_layout;
179 LoadLayout *save_layout;
180 ProxyMenuItem *proxy;
183 // ========================================= edit
185 class Undo : public BC_MenuItem
188 Undo(MWindow *mwindow);
190 int update_caption(const char *new_caption = "");
194 class MainDumpsSubMenu : public BC_SubMenu
197 MainDumpsSubMenu(BC_MenuItem *menu_item);
200 BC_MenuItem *menu_item;
203 class MainDumpsMenu : public BC_MenuItem
206 MainDumpsMenu(MWindow *mwindow);
208 void create_objects();
211 MainDumpsSubMenu *dumps_menu;
214 class DumpCICache : public BC_MenuItem
217 DumpCICache(MWindow *mwindow);
222 class DumpEDL : public BC_MenuItem
225 DumpEDL(MWindow *mwindow);
230 class DumpPlugins : public BC_MenuItem
233 DumpPlugins(MWindow *mwindow);
238 class DumpAssets : public BC_MenuItem
241 DumpAssets(MWindow *mwindow);
246 class DumpUndo : public BC_MenuItem
249 DumpUndo(MWindow *mwindow);
254 class Redo : public BC_MenuItem
257 Redo(MWindow *mwindow);
259 int update_caption(const char *new_caption = "");
263 class Cut : public BC_MenuItem
266 Cut(MWindow *mwindow);
271 class Copy : public BC_MenuItem
274 Copy(MWindow *mwindow);
279 class Paste : public BC_MenuItem
282 Paste(MWindow *mwindow);
287 class EditClearSubMenu : public BC_SubMenu
290 EditClearSubMenu(BC_MenuItem *menu_item);
293 BC_MenuItem *menu_item;
296 class EditClearMenu : public BC_MenuItem
299 EditClearMenu(MWindow *mwindow);
301 void create_objects();
304 EditClearSubMenu *clear_sub_menu;
307 class Clear : public BC_MenuItem
310 Clear(MWindow *mwindow);
315 class CutKeyframes : public BC_MenuItem
318 CutKeyframes(MWindow *mwindow);
323 class CopyKeyframes : public BC_MenuItem
326 CopyKeyframes(MWindow *mwindow);
331 class PasteKeyframes : public BC_MenuItem
334 PasteKeyframes(MWindow *mwindow);
340 class ClearKeyframes : public BC_MenuItem
343 ClearKeyframes(MWindow *mwindow);
349 class SetAutomationCurveItem : public BC_MenuItem
352 SetAutomationCurveItem(SetAutomationCurveMode *set_curve_mode, int id);
354 SetAutomationCurveMode *set_curve_mode;
358 class SetAutoCurveModeMenu : public BC_SubMenu
361 SetAutoCurveModeMenu(SetAutomationCurveMode *curve_mode);
362 SetAutomationCurveMode *curve_mode;
365 class SetAutomationCurveMode : public BC_MenuItem
368 SetAutomationCurveMode(MWindow *mwindow);
369 void create_objects();
372 SetAutoCurveModeMenu *curve_mode_menu;
376 class KeyframeCurveType : public BC_MenuItem
379 KeyframeCurveType(MWindow *mwindow);
380 ~KeyframeCurveType();
382 void create_objects();
383 void update(int curve_type);
387 KeyframeCurveTypeMenu *curve_menu;
390 class KeyframeCurveTypeMenu : public BC_SubMenu
393 KeyframeCurveTypeMenu(KeyframeCurveType *menu_item);
394 ~KeyframeCurveTypeMenu();
396 KeyframeCurveType *menu_item;
399 class KeyframeCurveTypeItem : public BC_MenuItem
402 KeyframeCurveTypeItem(int type, KeyframeCurveType *main_item);
403 ~KeyframeCurveTypeItem();
405 KeyframeCurveType *main_item;
411 class KeyframeCreateItem : public BC_MenuItem
414 KeyframeCreateItem(KeyframeCreate *keyframe_create, const char *text, int mask);
417 KeyframeCreate *keyframe_create;
421 class KeyframeCreateMenu : public BC_SubMenu
424 KeyframeCreateMenu(KeyframeCreate *keyframe_create);
425 KeyframeCreate *keyframe_create;
428 class KeyframeCreate : public BC_MenuItem
431 KeyframeCreate(MWindow *mwindow);
432 void create_objects();
435 KeyframeCreateMenu *keyframe_create_menu;
439 class CutDefaultKeyframe : public BC_MenuItem
442 CutDefaultKeyframe(MWindow *mwindow);
447 class CopyDefaultKeyframe : public BC_MenuItem
450 CopyDefaultKeyframe(MWindow *mwindow);
455 class PasteDefaultKeyframe : public BC_MenuItem
458 PasteDefaultKeyframe(MWindow *mwindow);
463 class ClearDefaultKeyframe : public BC_MenuItem
466 ClearDefaultKeyframe(MWindow *mwindow);
471 class PasteSilence : public BC_MenuItem
474 PasteSilence(MWindow *mwindow);
479 class SelectAll : public BC_MenuItem
482 SelectAll(MWindow *mwindow);
487 class ClearHardEdges : public BC_MenuItem
490 ClearHardEdges(MWindow *mwindow);
495 class ClearLabels : public BC_MenuItem
498 ClearLabels(MWindow *mwindow);
503 class ClearSelect : public BC_MenuItem
506 ClearSelect(MWindow *mwindow);
511 class CutCommercials : public BC_MenuItem
514 CutCommercials(MWindow *mwindow);
519 class DetachTransitions : public BC_MenuItem
522 DetachTransitions(MWindow *mwindow);
527 class MuteSelection : public BC_MenuItem
530 MuteSelection(MWindow *mwindow);
535 class TrimSelection : public BC_MenuItem
538 TrimSelection(MWindow *mwindow);
543 class MixerItems : public BC_MenuItem
546 MixerItems(MWindow *mwindow);
547 void create_objects();
548 int activate_submenu();
553 class MixerItem : public BC_MenuItem
556 MixerItem(MixerItems *mixer_items, const char *text, int idx);
557 MixerItem(MixerItems *mixer_items, const char *text, const char *hotkey_text, int hotkey);
558 virtual int handle_event();
560 MixerItems *mixer_items;
564 class MixerViewer : public MixerItem
567 MixerViewer(MixerItems *mixer_items);
571 class TileMixers : public MixerItem
574 TileMixers(MixerItems *mixer_items);
578 class AlignMixers : public MixerItem
581 AlignMixers(MixerItems *mixer_items);
585 class MixMasters : public MixerItem
588 MixMasters(MixerItems *mixer_items);
592 class AlignTimecodes : public BC_MenuItem
595 AlignTimecodes(MWindow *mwindow);
600 // ======================================== audio
602 class AddAudioTrack : public BC_MenuItem
605 AddAudioTrack(MWindow *mwindow);
610 class DeleteAudioTrack : public BC_MenuItem
613 DeleteAudioTrack(MWindow *mwindow);
618 class DefaultATransition : public BC_MenuItem
621 DefaultATransition(MWindow *mwindow);
626 class MapAudio1 : public BC_MenuItem
629 MapAudio1(MWindow *mwindow);
634 class MapAudio2 : public BC_MenuItem
637 MapAudio2(MWindow *mwindow);
642 // ========================================== video
645 class AddVideoTrack : public BC_MenuItem
648 AddVideoTrack(MWindow *mwindow);
654 class DeleteVideoTrack : public BC_MenuItem
657 DeleteVideoTrack(MWindow *mwindow);
662 class ResetTranslation : public BC_MenuItem
665 ResetTranslation(MWindow *mwindow);
670 class DefaultVTransition : public BC_MenuItem
673 DefaultVTransition(MWindow *mwindow);
679 // ========================================== subtitle
681 class AddSubttlTrack : public BC_MenuItem
684 AddSubttlTrack(MWindow *mwindow);
689 class PasteSubttl : public BC_MenuItem
692 PasteSubttl(MWindow *mwindow);
698 // ========================================== settings
701 class RollTracksUp : public BC_MenuItem
704 RollTracksUp(MWindow *mwindow);
709 class RollTracksDown : public BC_MenuItem
712 RollTracksDown(MWindow *mwindow);
717 class MoveTracksUp : public BC_MenuItem
720 MoveTracksUp(MWindow *mwindow);
725 class MoveTracksDown : public BC_MenuItem
728 MoveTracksDown(MWindow *mwindow);
733 class DeleteTracks : public BC_MenuItem
736 DeleteTracks(MWindow *mwindow);
741 class ConcatenateTracks : public BC_MenuItem
744 ConcatenateTracks(MWindow *mwindow);
749 class DeleteFirstTrack : public BC_MenuItem
752 DeleteFirstTrack(MWindow *mwindow);
757 class DeleteLastTrack : public BC_MenuItem
760 DeleteLastTrack(MWindow *mwindow);
765 class LoopPlayback : public BC_MenuItem
768 LoopPlayback(MWindow *mwindow);
774 class SetBRenderActive : public BC_MenuItem
777 SetBRenderActive(MWindow *mwindow);
782 class LabelsFollowEdits : public BC_MenuItem
785 LabelsFollowEdits(MWindow *mwindow);
790 class PluginsFollowEdits : public BC_MenuItem
793 PluginsFollowEdits(MWindow *mwindow);
798 class KeyframesFollowEdits : public BC_MenuItem
801 KeyframesFollowEdits(MWindow *mwindow);
806 class CursorOnFrames : public BC_MenuItem
809 CursorOnFrames(MWindow *mwindow);
814 class TypelessKeyframes : public BC_MenuItem
817 TypelessKeyframes(MWindow *mwindow);
822 class ScrubSpeed : public BC_MenuItem
825 ScrubSpeed(MWindow *mwindow);
830 class SaveSettingsNow : public BC_MenuItem
833 SaveSettingsNow(MWindow *mwindow);
838 // ========================================== window
839 class ShowVWindow : public BC_MenuItem
842 ShowVWindow(MWindow *mwindow);
847 class ShowAWindow : public BC_MenuItem
850 ShowAWindow(MWindow *mwindow);
855 class ShowGWindow : public BC_MenuItem
858 ShowGWindow(MWindow *mwindow);
863 class ShowCWindow : public BC_MenuItem
866 ShowCWindow(MWindow *mwindow);
871 class ShowLWindow : public BC_MenuItem
874 ShowLWindow(MWindow *mwindow);
879 class TileWindows : public BC_MenuItem
882 TileWindows(MWindow *mwindow, const char *item_title, int config,
883 const char *hot_keytext="", int hot_key=0);
889 class SplitX : public BC_MenuItem
892 SplitX(MWindow *mwindow);
897 class SplitY : public BC_MenuItem
900 SplitY(MWindow *mwindow);
906 class LoadLayoutItem : public BC_MenuItem
909 LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey);
913 char layout_text[BCSTRLEN];
914 char layout_file[BCSTRLEN];
915 LoadLayout *load_layout;
918 class LoadLayout : public BC_MenuItem
921 LoadLayout(MWindow *mwindow, const char *text, int action);
923 void create_objects();
925 int activate_submenu();
928 LoadLayoutDialog *layout_dialog;
932 class LoadLayoutDialog : public BC_DialogThread
935 LoadLayoutDialog(LoadLayout *load_layout);
938 void start_confirm_dialog(int wx, int wy, int idx);
939 void handle_done_event(int result);
940 void handle_close_event(int result);
941 BC_Window* new_gui();
943 LoadLayout *load_layout;
944 LoadLayoutConfirm *lgui;
948 class LoadLayoutNameText : public BC_TextBox
951 LoadLayoutNameText(LoadLayoutConfirm *confirm,
952 int x, int y, int w, const char *text);
953 ~LoadLayoutNameText();
957 LoadLayoutConfirm *confirm;
960 class LoadLayoutConfirm : public BC_Window
963 LoadLayoutConfirm(LoadLayoutDialog *load_dialog, int x, int y);
964 ~LoadLayoutConfirm();
965 void create_objects();
967 LoadLayoutDialog *layout_dialog;
968 LoadLayoutNameText *name_text;