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 AlignTimecodes *align_timecodes;
176 LoadLayout *load_layout;
177 LoadLayout *save_layout;
180 // ========================================= edit
182 class Undo : public BC_MenuItem
185 Undo(MWindow *mwindow);
187 int update_caption(const char *new_caption = "");
191 class MainDumpsSubMenu : public BC_SubMenu
194 MainDumpsSubMenu(BC_MenuItem *menu_item);
197 BC_MenuItem *menu_item;
200 class MainDumpsMenu : public BC_MenuItem
203 MainDumpsMenu(MWindow *mwindow);
205 void create_objects();
208 MainDumpsSubMenu *dumps_menu;
211 class DumpCICache : public BC_MenuItem
214 DumpCICache(MWindow *mwindow);
219 class DumpEDL : public BC_MenuItem
222 DumpEDL(MWindow *mwindow);
227 class DumpPlugins : public BC_MenuItem
230 DumpPlugins(MWindow *mwindow);
235 class DumpAssets : public BC_MenuItem
238 DumpAssets(MWindow *mwindow);
243 class DumpUndo : public BC_MenuItem
246 DumpUndo(MWindow *mwindow);
251 class Redo : public BC_MenuItem
254 Redo(MWindow *mwindow);
256 int update_caption(const char *new_caption = "");
260 class Cut : public BC_MenuItem
263 Cut(MWindow *mwindow);
268 class Copy : public BC_MenuItem
271 Copy(MWindow *mwindow);
276 class Paste : public BC_MenuItem
279 Paste(MWindow *mwindow);
284 class EditClearSubMenu : public BC_SubMenu
287 EditClearSubMenu(BC_MenuItem *menu_item);
290 BC_MenuItem *menu_item;
293 class EditClearMenu : public BC_MenuItem
296 EditClearMenu(MWindow *mwindow);
298 void create_objects();
301 EditClearSubMenu *clear_sub_menu;
304 class Clear : public BC_MenuItem
307 Clear(MWindow *mwindow);
312 class CutKeyframes : public BC_MenuItem
315 CutKeyframes(MWindow *mwindow);
320 class CopyKeyframes : public BC_MenuItem
323 CopyKeyframes(MWindow *mwindow);
328 class PasteKeyframes : public BC_MenuItem
331 PasteKeyframes(MWindow *mwindow);
337 class ClearKeyframes : public BC_MenuItem
340 ClearKeyframes(MWindow *mwindow);
345 class StraightenKeyframes : public BC_MenuItem
348 StraightenKeyframes(MWindow *mwindow);
353 class BendKeyframes : public BC_MenuItem
356 BendKeyframes(MWindow *mwindow);
361 class KeyframeCurveType : public BC_MenuItem
364 KeyframeCurveType(MWindow *mwindow);
365 ~KeyframeCurveType();
367 void create_objects();
368 void update(int curve_type);
372 KeyframeCurveTypeMenu *curve_menu;
375 class KeyframeCurveTypeMenu : public BC_SubMenu
378 KeyframeCurveTypeMenu(KeyframeCurveType *menu_item);
379 ~KeyframeCurveTypeMenu();
381 KeyframeCurveType *menu_item;
384 class KeyframeCurveTypeItem : public BC_MenuItem
387 KeyframeCurveTypeItem(int type, KeyframeCurveType *main_item);
388 ~KeyframeCurveTypeItem();
390 KeyframeCurveType *main_item;
396 class CutDefaultKeyframe : public BC_MenuItem
399 CutDefaultKeyframe(MWindow *mwindow);
404 class CopyDefaultKeyframe : public BC_MenuItem
407 CopyDefaultKeyframe(MWindow *mwindow);
412 class PasteDefaultKeyframe : public BC_MenuItem
415 PasteDefaultKeyframe(MWindow *mwindow);
420 class ClearDefaultKeyframe : public BC_MenuItem
423 ClearDefaultKeyframe(MWindow *mwindow);
428 class PasteSilence : public BC_MenuItem
431 PasteSilence(MWindow *mwindow);
436 class SelectAll : public BC_MenuItem
439 SelectAll(MWindow *mwindow);
444 class ClearHardEdges : public BC_MenuItem
447 ClearHardEdges(MWindow *mwindow);
452 class ClearLabels : public BC_MenuItem
455 ClearLabels(MWindow *mwindow);
460 class ClearSelect : public BC_MenuItem
463 ClearSelect(MWindow *mwindow);
468 class CutCommercials : public BC_MenuItem
471 CutCommercials(MWindow *mwindow);
476 class DetachTransitions : public BC_MenuItem
479 DetachTransitions(MWindow *mwindow);
484 class MuteSelection : public BC_MenuItem
487 MuteSelection(MWindow *mwindow);
492 class TrimSelection : public BC_MenuItem
495 TrimSelection(MWindow *mwindow);
500 class MixerItems : public BC_MenuItem
503 MixerItems(MWindow *mwindow);
504 void create_objects();
505 int activate_submenu();
510 class MixerItem : public BC_MenuItem
513 MixerItem(MixerItems *mixer_items, const char *text, int idx);
514 MixerItem(MixerItems *mixer_items, const char *text, const char *hotkey_text, int hotkey);
515 virtual int handle_event();
517 MixerItems *mixer_items;
521 class MixerViewer : public MixerItem
524 MixerViewer(MixerItems *mixer_items);
528 class TileMixers : public MixerItem
531 TileMixers(MixerItems *mixer_items);
535 class AlignMixers : public MixerItem
538 AlignMixers(MixerItems *mixer_items);
542 class AlignTimecodes : public BC_MenuItem
545 AlignTimecodes(MWindow *mwindow);
550 // ======================================== audio
552 class AddAudioTrack : public BC_MenuItem
555 AddAudioTrack(MWindow *mwindow);
560 class DeleteAudioTrack : public BC_MenuItem
563 DeleteAudioTrack(MWindow *mwindow);
568 class DefaultATransition : public BC_MenuItem
571 DefaultATransition(MWindow *mwindow);
576 class MapAudio1 : public BC_MenuItem
579 MapAudio1(MWindow *mwindow);
584 class MapAudio2 : public BC_MenuItem
587 MapAudio2(MWindow *mwindow);
592 // ========================================== video
595 class AddVideoTrack : public BC_MenuItem
598 AddVideoTrack(MWindow *mwindow);
604 class DeleteVideoTrack : public BC_MenuItem
607 DeleteVideoTrack(MWindow *mwindow);
612 class ResetTranslation : public BC_MenuItem
615 ResetTranslation(MWindow *mwindow);
620 class DefaultVTransition : public BC_MenuItem
623 DefaultVTransition(MWindow *mwindow);
629 // ========================================== subtitle
631 class AddSubttlTrack : public BC_MenuItem
634 AddSubttlTrack(MWindow *mwindow);
639 class PasteSubttl : public BC_MenuItem
642 PasteSubttl(MWindow *mwindow);
648 // ========================================== settings
651 class MoveTracksUp : public BC_MenuItem
654 MoveTracksUp(MWindow *mwindow);
659 class MoveTracksDown : public BC_MenuItem
662 MoveTracksDown(MWindow *mwindow);
667 class SwapTracksUp : public BC_MenuItem
670 SwapTracksUp(MWindow *mwindow);
675 class SwapTracksDown : public BC_MenuItem
678 SwapTracksDown(MWindow *mwindow);
683 class DeleteTracks : public BC_MenuItem
686 DeleteTracks(MWindow *mwindow);
691 class ConcatenateTracks : public BC_MenuItem
694 ConcatenateTracks(MWindow *mwindow);
699 class DeleteFirstTrack : public BC_MenuItem
702 DeleteFirstTrack(MWindow *mwindow);
707 class DeleteLastTrack : public BC_MenuItem
710 DeleteLastTrack(MWindow *mwindow);
715 class LoopPlayback : public BC_MenuItem
718 LoopPlayback(MWindow *mwindow);
724 class SetBRenderActive : public BC_MenuItem
727 SetBRenderActive(MWindow *mwindow);
732 class LabelsFollowEdits : public BC_MenuItem
735 LabelsFollowEdits(MWindow *mwindow);
740 class PluginsFollowEdits : public BC_MenuItem
743 PluginsFollowEdits(MWindow *mwindow);
748 class KeyframesFollowEdits : public BC_MenuItem
751 KeyframesFollowEdits(MWindow *mwindow);
756 class CursorOnFrames : public BC_MenuItem
759 CursorOnFrames(MWindow *mwindow);
764 class TypelessKeyframes : public BC_MenuItem
767 TypelessKeyframes(MWindow *mwindow);
772 class ScrubSpeed : public BC_MenuItem
775 ScrubSpeed(MWindow *mwindow);
780 class SaveSettingsNow : public BC_MenuItem
783 SaveSettingsNow(MWindow *mwindow);
788 // ========================================== window
789 class ShowVWindow : public BC_MenuItem
792 ShowVWindow(MWindow *mwindow);
797 class ShowAWindow : public BC_MenuItem
800 ShowAWindow(MWindow *mwindow);
805 class ShowGWindow : public BC_MenuItem
808 ShowGWindow(MWindow *mwindow);
813 class ShowCWindow : public BC_MenuItem
816 ShowCWindow(MWindow *mwindow);
821 class ShowLWindow : public BC_MenuItem
824 ShowLWindow(MWindow *mwindow);
829 class TileWindows : public BC_MenuItem
832 TileWindows(MWindow *mwindow, const char *item_title, int config,
833 const char *hot_keytext="", int hot_key=0);
839 class SplitX : public BC_MenuItem
842 SplitX(MWindow *mwindow);
847 class SplitY : public BC_MenuItem
850 SplitY(MWindow *mwindow);
856 class LoadLayoutItem : public BC_MenuItem
859 LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey);
863 char layout_text[BCSTRLEN];
864 char layout_file[BCSTRLEN];
865 LoadLayout *load_layout;
868 class LoadLayout : public BC_MenuItem
871 LoadLayout(MWindow *mwindow, const char *text, int action);
873 void create_objects();
875 int activate_submenu();
878 LoadLayoutDialog *layout_dialog;
882 class LoadLayoutDialog : public BC_DialogThread
885 LoadLayoutDialog(LoadLayout *load_layout);
888 void start_confirm_dialog(int wx, int wy, int idx);
889 void handle_done_event(int result);
890 void handle_close_event(int result);
891 BC_Window* new_gui();
893 LoadLayout *load_layout;
894 LoadLayoutConfirm *lgui;
898 class LoadLayoutNameText : public BC_TextBox
901 LoadLayoutNameText(LoadLayoutConfirm *confirm,
902 int x, int y, int w, const char *text);
903 ~LoadLayoutNameText();
907 LoadLayoutConfirm *confirm;
910 class LoadLayoutConfirm : public BC_Window
913 LoadLayoutConfirm(LoadLayoutDialog *load_dialog, int x, int y);
914 ~LoadLayoutConfirm();
915 void create_objects();
917 LoadLayoutDialog *layout_dialog;
918 LoadLayoutNameText *name_text;