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 DragTileMixers : public MixerItem
574 DragTileMixers(MixerItems *mixer_items);
577 TileMixersDragBox *drag_box;
580 class TileMixersDragBox : public BC_DragBox
583 TileMixersDragBox(MWindowGUI *gui);
584 void start(DragTileMixers *tile_mixers);
585 int handle_done_event(int x0, int y0, int x1, int y1);
587 DragTileMixers *tile_mixers;
590 class AlignMixers : public MixerItem
593 AlignMixers(MixerItems *mixer_items);
597 class MixMasters : public MixerItem
600 MixMasters(MixerItems *mixer_items);
604 class AlignTimecodes : public BC_MenuItem
607 AlignTimecodes(MWindow *mwindow);
612 // ======================================== audio
614 class AddAudioTrack : public BC_MenuItem
617 AddAudioTrack(MWindow *mwindow);
622 class DeleteAudioTrack : public BC_MenuItem
625 DeleteAudioTrack(MWindow *mwindow);
630 class DefaultATransition : public BC_MenuItem
633 DefaultATransition(MWindow *mwindow);
638 class MapAudio1 : public BC_MenuItem
641 MapAudio1(MWindow *mwindow);
646 class MapAudio2 : public BC_MenuItem
649 MapAudio2(MWindow *mwindow);
654 // ========================================== video
657 class AddVideoTrack : public BC_MenuItem
660 AddVideoTrack(MWindow *mwindow);
666 class DeleteVideoTrack : public BC_MenuItem
669 DeleteVideoTrack(MWindow *mwindow);
674 class ResetTranslation : public BC_MenuItem
677 ResetTranslation(MWindow *mwindow);
682 class DefaultVTransition : public BC_MenuItem
685 DefaultVTransition(MWindow *mwindow);
691 // ========================================== subtitle
693 class AddSubttlTrack : public BC_MenuItem
696 AddSubttlTrack(MWindow *mwindow);
701 class PasteSubttl : public BC_MenuItem
704 PasteSubttl(MWindow *mwindow);
710 // ========================================== settings
713 class RollTracksUp : public BC_MenuItem
716 RollTracksUp(MWindow *mwindow);
721 class RollTracksDown : public BC_MenuItem
724 RollTracksDown(MWindow *mwindow);
729 class MoveTracksUp : public BC_MenuItem
732 MoveTracksUp(MWindow *mwindow);
737 class MoveTracksDown : public BC_MenuItem
740 MoveTracksDown(MWindow *mwindow);
745 class DeleteTracks : public BC_MenuItem
748 DeleteTracks(MWindow *mwindow);
753 class ConcatenateTracks : public BC_MenuItem
756 ConcatenateTracks(MWindow *mwindow);
761 class DeleteFirstTrack : public BC_MenuItem
764 DeleteFirstTrack(MWindow *mwindow);
769 class DeleteLastTrack : public BC_MenuItem
772 DeleteLastTrack(MWindow *mwindow);
777 class LoopPlayback : public BC_MenuItem
780 LoopPlayback(MWindow *mwindow);
786 class SetBRenderActive : public BC_MenuItem
789 SetBRenderActive(MWindow *mwindow);
794 class LabelsFollowEdits : public BC_MenuItem
797 LabelsFollowEdits(MWindow *mwindow);
802 class PluginsFollowEdits : public BC_MenuItem
805 PluginsFollowEdits(MWindow *mwindow);
810 class KeyframesFollowEdits : public BC_MenuItem
813 KeyframesFollowEdits(MWindow *mwindow);
818 class CursorOnFrames : public BC_MenuItem
821 CursorOnFrames(MWindow *mwindow);
826 class TypelessKeyframes : public BC_MenuItem
829 TypelessKeyframes(MWindow *mwindow);
834 class ScrubSpeed : public BC_MenuItem
837 ScrubSpeed(MWindow *mwindow);
842 class SaveSettingsNow : public BC_MenuItem
845 SaveSettingsNow(MWindow *mwindow);
850 // ========================================== window
851 class ShowVWindow : public BC_MenuItem
854 ShowVWindow(MWindow *mwindow);
859 class ShowAWindow : public BC_MenuItem
862 ShowAWindow(MWindow *mwindow);
867 class ShowGWindow : public BC_MenuItem
870 ShowGWindow(MWindow *mwindow);
875 class ShowCWindow : public BC_MenuItem
878 ShowCWindow(MWindow *mwindow);
883 class ShowLWindow : public BC_MenuItem
886 ShowLWindow(MWindow *mwindow);
891 class TileWindows : public BC_MenuItem
894 TileWindows(MWindow *mwindow, const char *item_title, int config,
895 const char *hot_keytext="", int hot_key=0);
901 class SplitX : public BC_MenuItem
904 SplitX(MWindow *mwindow);
909 class SplitY : public BC_MenuItem
912 SplitY(MWindow *mwindow);
918 class LoadLayoutItem : public BC_MenuItem
921 LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey);
925 char layout_text[BCSTRLEN];
926 char layout_file[BCSTRLEN];
927 LoadLayout *load_layout;
930 class LoadLayout : public BC_MenuItem
933 LoadLayout(MWindow *mwindow, const char *text, int action);
935 void create_objects();
937 int activate_submenu();
940 LoadLayoutDialog *layout_dialog;
944 class LoadLayoutDialog : public BC_DialogThread
947 LoadLayoutDialog(LoadLayout *load_layout);
950 void start_confirm_dialog(int wx, int wy, int idx);
951 void handle_done_event(int result);
952 void handle_close_event(int result);
953 BC_Window* new_gui();
955 LoadLayout *load_layout;
956 LoadLayoutConfirm *lgui;
960 class LoadLayoutNameText : public BC_TextBox
963 LoadLayoutNameText(LoadLayoutConfirm *confirm,
964 int x, int y, int w, const char *text);
965 ~LoadLayoutNameText();
969 LoadLayoutConfirm *confirm;
972 class LoadLayoutConfirm : public BC_Window
975 LoadLayoutConfirm(LoadLayoutDialog *load_dialog, int x, int y);
976 ~LoadLayoutConfirm();
977 void create_objects();
979 LoadLayoutDialog *layout_dialog;
980 LoadLayoutNameText *name_text;