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
24 #include "batchrender.h"
25 #include "bcdisplayinfo.h"
27 #include "bcsignals.h"
30 #include "channelinfo.h"
31 #include "cplayback.h"
32 #include "cropvideo.h"
34 #include "cwindowgui.h"
36 #include "dvdcreate.h"
38 #include "edlsession.h"
40 #include "filesystem.h"
42 #include "floatauto.h"
45 #include "levelwindow.h"
47 #include "localsession.h"
48 #include "mainclock.h"
50 #include "mainsession.h"
52 #include "menuattacheffect.h"
53 #include "menuattachtransition.h"
54 #include "menuaeffects.h"
55 #include "menueditlength.h"
56 #include "menutransitionlength.h"
57 #include "menuveffects.h"
58 #include "mwindowgui.h"
62 #include "playbackengine.h"
63 #include "preferences.h"
65 #include "preferencesthread.h"
70 #include "setformat.h"
73 #include "trackcanvas.h"
75 #include "transition.h"
76 #include "transportque.h"
79 #include "exportedl.h"
84 MainMenu::MainMenu(MWindow *mwindow, MWindowGUI *gui, int w)
88 this->mwindow = mwindow;
95 void MainMenu::create_objects()
97 BC_Menu *viewmenu, *windowmenu, *settingsmenu, *trackmenu;
98 PreferencesMenuitem *preferences;
101 add_menu(filemenu = new BC_Menu(_("File")));
102 filemenu->add_item(new_project = new NewProject(mwindow));
103 new_project->create_objects();
106 filemenu->add_item(load_file = new Load(mwindow, this));
107 load_file->create_objects();
109 // new and load can be undone so no need to prompt save
110 Save *save; // affected by saveas
111 filemenu->add_item(save = new Save(mwindow));
113 filemenu->add_item(saveas = new SaveAs(mwindow));
114 save->create_objects(saveas);
115 saveas->set_mainmenu(this);
116 SaveProject *save_project;
117 filemenu->add_item(save_project = new SaveProject(mwindow));
119 filemenu->add_item(record_menu_item = new RecordMenuItem(mwindow));
121 filemenu->add_item(new ChannelScan(mwindow));
123 #ifdef HAVE_COMMERCIAL
124 if( mwindow->has_commercials() )
125 filemenu->add_item(new DbWindowScan(mwindow));
127 filemenu->add_item(new SubttlSWin(mwindow));
129 filemenu->add_item(render = new RenderItem(mwindow));
130 filemenu->add_item(new ExportEDLItem(mwindow));
131 filemenu->add_item(new BatchRenderMenuItem(mwindow));
132 filemenu->add_item(new CreateBD_MenuItem(mwindow));
133 filemenu->add_item(new CreateDVD_MenuItem(mwindow));
134 filemenu->add_item(new BC_MenuItem("-"));
135 filemenu->add_item(quit_program = new Quit(mwindow));
136 quit_program->create_objects(save);
137 filemenu->add_item(dump_menu = new MainDumpsMenu(mwindow));
138 dump_menu->create_objects();
139 filemenu->add_item(new LoadBackup(mwindow));
140 filemenu->add_item(new SaveBackup(mwindow));
143 add_menu(editmenu = new BC_Menu(_("Edit")));
144 editmenu->add_item(undo = new Undo(mwindow));
145 editmenu->add_item(redo = new Redo(mwindow));
146 editmenu->add_item(new BC_MenuItem("-"));
147 editmenu->add_item(new Cut(mwindow));
148 editmenu->add_item(new Copy(mwindow));
149 editmenu->add_item(new Paste(mwindow));
150 editmenu->add_item(new Clear(mwindow));
151 editmenu->add_item(new PasteSilence(mwindow));
152 editmenu->add_item(new MuteSelection(mwindow));
153 editmenu->add_item(new TrimSelection(mwindow));
154 editmenu->add_item(new SelectAll(mwindow));
155 editmenu->add_item(new BC_MenuItem("-"));
156 editmenu->add_item(new MenuEditShuffle(mwindow));
157 editmenu->add_item(new MenuEditReverse(mwindow));
158 editmenu->add_item(new MenuEditLength(mwindow));
159 editmenu->add_item(new MenuEditAlign(mwindow));
160 editmenu->add_item(new MenuTransitionLength(mwindow));
161 editmenu->add_item(new DetachTransitions(mwindow));
162 editmenu->add_item(new BC_MenuItem("-"));
163 editmenu->add_item(new ClearLabels(mwindow));
164 editmenu->add_item(new CutCommercials(mwindow));
165 editmenu->add_item(new PasteSubttl(mwindow));
167 BC_Menu *keyframemenu;
168 add_menu(keyframemenu = new BC_Menu(_("Keyframes")));
169 keyframemenu->add_item(new CutKeyframes(mwindow));
170 keyframemenu->add_item(new CopyKeyframes(mwindow));
171 keyframemenu->add_item(new PasteKeyframes(mwindow));
172 keyframemenu->add_item(new ClearKeyframes(mwindow));
173 keyframemenu->add_item(new StraightenKeyframes(mwindow));
174 keyframemenu->add_item(new BendKeyframes(mwindow));
175 keyframemenu->add_item(keyframe_curve_type = new KeyframeCurveType(mwindow));
176 keyframe_curve_type->create_objects();
177 keyframe_curve_type->update(mwindow->edl->local_session->floatauto_type);
178 keyframemenu->add_item(new BC_MenuItem("-"));
179 keyframemenu->add_item(new CopyDefaultKeyframe(mwindow));
180 keyframemenu->add_item(new PasteDefaultKeyframe(mwindow));
185 add_menu(audiomenu = new BC_Menu(_("Audio")));
186 audiomenu->add_item(new AddAudioTrack(mwindow));
187 audiomenu->add_item(new DefaultATransition(mwindow));
188 audiomenu->add_item(new MapAudio1(mwindow));
189 audiomenu->add_item(new MapAudio2(mwindow));
190 audiomenu->add_item(new MenuAttachTransition(mwindow, TRACK_AUDIO));
191 audiomenu->add_item(new MenuAttachEffect(mwindow, TRACK_AUDIO));
192 audiomenu->add_item(aeffects = new MenuAEffects(mwindow));
194 add_menu(videomenu = new BC_Menu(_("Video")));
195 videomenu->add_item(new AddVideoTrack(mwindow));
196 videomenu->add_item(new DefaultVTransition(mwindow));
197 videomenu->add_item(new MenuAttachTransition(mwindow, TRACK_VIDEO));
198 videomenu->add_item(new MenuAttachEffect(mwindow, TRACK_VIDEO));
199 videomenu->add_item(veffects = new MenuVEffects(mwindow));
201 add_menu(trackmenu = new BC_Menu(_("Tracks")));
202 trackmenu->add_item(new MoveTracksUp(mwindow));
203 trackmenu->add_item(new MoveTracksDown(mwindow));
204 trackmenu->add_item(new DeleteTracks(mwindow));
205 trackmenu->add_item(new DeleteTrack(mwindow));
206 trackmenu->add_item(new ConcatenateTracks(mwindow));
207 AppendTracks *append_tracks;
208 trackmenu->add_item(append_tracks = new AppendTracks(mwindow));
209 append_tracks->create_objects();
210 trackmenu->add_item(new AddSubttlTrack(mwindow));
212 add_menu(settingsmenu = new BC_Menu(_("Settings")));
214 settingsmenu->add_item(new SetFormat(mwindow));
215 settingsmenu->add_item(preferences = new PreferencesMenuitem(mwindow));
216 ProxyMenuItem *proxy;
217 settingsmenu->add_item(proxy = new ProxyMenuItem(mwindow));
218 proxy->create_objects();
219 mwindow->preferences_thread = preferences->thread;
220 settingsmenu->add_item(cursor_on_frames = new CursorOnFrames(mwindow));
221 settingsmenu->add_item(labels_follow_edits = new LabelsFollowEdits(mwindow));
222 settingsmenu->add_item(plugins_follow_edits = new PluginsFollowEdits(mwindow));
223 settingsmenu->add_item(keyframes_follow_edits = new KeyframesFollowEdits(mwindow));
224 settingsmenu->add_item(typeless_keyframes = new TypelessKeyframes(mwindow));
225 settingsmenu->add_item(new BC_MenuItem("-"));
226 settingsmenu->add_item(new SaveSettingsNow(mwindow));
227 settingsmenu->add_item(loop_playback = new LoopPlayback(mwindow));
228 settingsmenu->add_item(brender_active = new SetBRenderActive(mwindow));
229 // set scrubbing speed
230 // ScrubSpeed *scrub_speed;
231 // settingsmenu->add_item(scrub_speed = new ScrubSpeed(mwindow));
232 // if(mwindow->edl->session->scrub_speed == .5)
233 // scrub_speed->set_text(_("Fast Shuttle"));
240 add_menu(viewmenu = new BC_Menu(_("View")));
241 viewmenu->add_item(show_assets = new ShowAssets(mwindow, "0"));
242 viewmenu->add_item(show_titles = new ShowTitles(mwindow, "1"));
243 viewmenu->add_item(show_transitions = new ShowTransitions(mwindow, "2"));
244 viewmenu->add_item(fade_automation = new ShowAutomation(mwindow, _("Fade"), "3", AUTOMATION_FADE));
245 viewmenu->add_item(mute_automation = new ShowAutomation(mwindow, _("Mute"), "4", AUTOMATION_MUTE));
246 viewmenu->add_item(mode_automation = new ShowAutomation(mwindow, _("Overlay mode"), "5", AUTOMATION_MODE));
247 viewmenu->add_item(pan_automation = new ShowAutomation(mwindow, _("Pan"), "6", AUTOMATION_PAN));
248 viewmenu->add_item(plugin_automation = new PluginAutomation(mwindow, "7"));
249 viewmenu->add_item(mask_automation = new ShowAutomation(mwindow, _("Mask"), "8", AUTOMATION_MASK));
250 viewmenu->add_item(speed_automation = new ShowAutomation(mwindow, _("Speed"), "9", AUTOMATION_SPEED));
252 camera_x = new ShowAutomation(mwindow, _("Camera X"), "Ctrl-Shift-X", AUTOMATION_CAMERA_X);
253 camera_x->set_ctrl(); camera_x->set_shift(); viewmenu->add_item(camera_x);
254 camera_y = new ShowAutomation(mwindow, _("Camera Y"), "Ctrl-Shift-Y", AUTOMATION_CAMERA_Y);
255 camera_y->set_ctrl(); camera_y->set_shift(); viewmenu->add_item(camera_y);
256 camera_z = new ShowAutomation(mwindow, _("Camera Z"), "Ctrl-Shift-Z", AUTOMATION_CAMERA_Z);
257 camera_z->set_ctrl(); camera_z->set_shift(); viewmenu->add_item(camera_z);
258 project_x = new ShowAutomation(mwindow, _("Projector X"), "Alt-Shift-X", AUTOMATION_PROJECTOR_X);
259 project_x->set_alt(); project_x->set_shift(); viewmenu->add_item(project_x);
260 project_y = new ShowAutomation(mwindow, _("Projector Y"), "Alt-Shift-Y", AUTOMATION_PROJECTOR_Y);
261 project_y->set_alt(); project_y->set_shift(); viewmenu->add_item(project_y);
262 project_z = new ShowAutomation(mwindow, _("Projector Z"), "Alt-Shift-Z", AUTOMATION_PROJECTOR_Z);
263 project_z->set_alt(); project_z->set_shift(); viewmenu->add_item(project_z);
265 add_menu(windowmenu = new BC_Menu(_("Window")));
266 windowmenu->add_item(show_vwindow = new ShowVWindow(mwindow));
267 windowmenu->add_item(show_awindow = new ShowAWindow(mwindow));
268 windowmenu->add_item(show_cwindow = new ShowCWindow(mwindow));
269 windowmenu->add_item(show_gwindow = new ShowGWindow(mwindow));
270 windowmenu->add_item(show_lwindow = new ShowLWindow(mwindow));
271 windowmenu->add_item(new BC_MenuItem("-"));
272 windowmenu->add_item(split_x = new SplitX(mwindow));
273 windowmenu->add_item(split_y = new SplitY(mwindow));
274 windowmenu->add_item(mixer_viewer = new MixerViewer(mwindow));
275 windowmenu->add_item(new TileMixers(mwindow));
276 windowmenu->add_item(new TileWindows(mwindow,_("Tile left"),0));
277 windowmenu->add_item(new TileWindows(mwindow,_("Tile right"),1));
278 windowmenu->add_item(new BC_MenuItem("-"));
280 windowmenu->add_item(new TileWindows(mwindow,_("Default positions"),-1,_("Ctrl-P"),'p'));
281 windowmenu->add_item(load_layout = new LoadLayout(mwindow, _("Load layout..."),LAYOUT_LOAD));
282 load_layout->create_objects();
283 windowmenu->add_item(save_layout = new LoadLayout(mwindow, _("Save layout..."),LAYOUT_SAVE));
284 save_layout->create_objects();
287 int MainMenu::load_defaults(BC_Hash *defaults)
289 init_loads(defaults);
290 init_aeffects(defaults);
291 init_veffects(defaults);
295 void MainMenu::update_toggles(int use_lock)
297 if(use_lock) lock_window("MainMenu::update_toggles");
298 labels_follow_edits->set_checked(mwindow->edl->session->labels_follow_edits);
299 plugins_follow_edits->set_checked(mwindow->edl->session->plugins_follow_edits);
300 keyframes_follow_edits->set_checked(mwindow->edl->session->autos_follow_edits);
301 typeless_keyframes->set_checked(mwindow->edl->session->typeless_keyframes);
302 cursor_on_frames->set_checked(mwindow->edl->session->cursor_on_frames);
303 loop_playback->set_checked(mwindow->edl->local_session->loop_playback);
305 show_assets->set_checked(mwindow->edl->session->show_assets);
306 show_titles->set_checked(mwindow->edl->session->show_titles);
307 show_transitions->set_checked(mwindow->edl->session->auto_conf->transitions);
308 fade_automation->update_toggle();
309 mute_automation->update_toggle();
310 pan_automation->update_toggle();
311 camera_x->update_toggle();
312 camera_y->update_toggle();
313 camera_z->update_toggle();
314 project_x->update_toggle();
315 project_y->update_toggle();
316 project_z->update_toggle();
317 plugin_automation->set_checked(mwindow->edl->session->auto_conf->plugins);
318 mode_automation->update_toggle();
319 mask_automation->update_toggle();
320 speed_automation->update_toggle();
321 split_x->set_checked(mwindow->gui->pane[TOP_RIGHT_PANE] != 0);
322 split_y->set_checked(mwindow->gui->pane[BOTTOM_LEFT_PANE] != 0);
324 if(use_lock) mwindow->gui->unlock_window();
327 int MainMenu::save_defaults(BC_Hash *defaults)
329 save_loads(defaults);
330 save_aeffects(defaults);
331 save_veffects(defaults);
341 quit_program->handle_event();
349 // ================================== load most recent
351 int MainMenu::init_aeffects(BC_Hash *defaults)
353 total_aeffects = defaults->get((char*)"TOTAL_AEFFECTS", 0);
355 char string[BCTEXTLEN], title[BCTEXTLEN];
356 if(total_aeffects) audiomenu->add_item(new BC_MenuItem("-"));
358 for(int i = 0; i < total_aeffects; i++)
360 sprintf(string, "AEFFECTRECENT%d", i);
361 defaults->get(string, title);
362 audiomenu->add_item(aeffect[i] = new MenuAEffectItem(aeffects, title));
367 int MainMenu::init_veffects(BC_Hash *defaults)
369 total_veffects = defaults->get((char*)"TOTAL_VEFFECTS", 0);
371 char string[BCTEXTLEN], title[BCTEXTLEN];
372 if(total_veffects) videomenu->add_item(new BC_MenuItem("-"));
374 for(int i = 0; i < total_veffects; i++)
376 sprintf(string, "VEFFECTRECENT%d", i);
377 defaults->get(string, title);
378 videomenu->add_item(veffect[i] = new MenuVEffectItem(veffects, title));
383 void MainMenu::init_loads(BC_Hash *defaults)
385 total_loads = defaults->get((char*)"TOTAL_LOADS", 0);
386 if( !total_loads ) return;
387 filemenu->add_item(new BC_MenuItem("-"));
389 char string[BCTEXTLEN], path[BCTEXTLEN], filename[BCTEXTLEN];
391 //printf("MainMenu::init_loads 2\n");
393 for(int i = 0; i < total_loads; i++) {
394 sprintf(string, "LOADPREVIOUS%d", i);
395 //printf("MainMenu::init_loads 3\n");
396 defaults->get(string, path);
397 filemenu->add_item(load[i] = new LoadPrevious(mwindow, load_file));
398 dir.extract_name(filename, path, 0);
399 load[i]->set_text(filename);
400 load[i]->set_path(path);
404 // ============================ save most recent
406 int MainMenu::save_aeffects(BC_Hash *defaults)
408 defaults->update((char*)"TOTAL_AEFFECTS", total_aeffects);
409 char string[BCTEXTLEN];
410 for(int i = 0; i < total_aeffects; i++)
412 sprintf(string, "AEFFECTRECENT%d", i);
413 defaults->update(string, aeffect[i]->get_text());
418 int MainMenu::save_veffects(BC_Hash *defaults)
420 defaults->update((char*)"TOTAL_VEFFECTS", total_veffects);
421 char string[BCTEXTLEN];
422 for(int i = 0; i < total_veffects; i++)
424 sprintf(string, "VEFFECTRECENT%d", i);
425 defaults->update(string, veffect[i]->get_text());
430 int MainMenu::save_loads(BC_Hash *defaults)
432 defaults->update((char*)"TOTAL_LOADS", total_loads);
433 char string[BCTEXTLEN];
434 for(int i = 0; i < total_loads; i++)
436 sprintf(string, "LOADPREVIOUS%d", i);
437 defaults->update(string, load[i]->path);
442 // =================================== add most recent
444 int MainMenu::add_aeffect(char *title)
446 // add bar for first effect
447 if(total_aeffects == 0)
449 audiomenu->add_item(new BC_MenuItem("-"));
452 // test for existing copy of effect
453 for(int i = 0; i < total_aeffects; i++)
455 if(!strcmp(aeffect[i]->get_text(), title)) // already exists
456 { // swap for top effect
457 for(int j = i; j > 0; j--) // move preceeding effects down
459 aeffect[j]->set_text(aeffect[j - 1]->get_text());
461 aeffect[0]->set_text(title);
466 // add another blank effect
467 if(total_aeffects < TOTAL_EFFECTS)
470 aeffect[total_aeffects] = new MenuAEffectItem(aeffects, (char*)""));
475 for(int i = total_aeffects - 1; i > 0; i--)
477 // set menu item text
478 aeffect[i]->set_text(aeffect[i - 1]->get_text());
481 // set up the new effect
482 aeffect[0]->set_text(title);
486 int MainMenu::add_veffect(char *title)
488 // add bar for first effect
489 if(total_veffects == 0)
491 videomenu->add_item(new BC_MenuItem("-"));
494 // test for existing copy of effect
495 for(int i = 0; i < total_veffects; i++)
497 if(!strcmp(veffect[i]->get_text(), title)) // already exists
498 { // swap for top effect
499 for(int j = i; j > 0; j--) // move preceeding effects down
501 veffect[j]->set_text(veffect[j - 1]->get_text());
503 veffect[0]->set_text(title);
508 // add another blank effect
509 if(total_veffects < TOTAL_EFFECTS)
511 videomenu->add_item(veffect[total_veffects] =
512 new MenuVEffectItem(veffects, (char*)""));
517 for(int i = total_veffects - 1; i > 0; i--)
519 // set menu item text
520 veffect[i]->set_text(veffect[i - 1]->get_text());
523 // set up the new effect
524 veffect[0]->set_text(title);
528 int MainMenu::add_load(char *path)
532 filemenu->add_item(new BC_MenuItem("-"));
535 // test for existing copy
537 char text[BCTEXTLEN], new_path[BCTEXTLEN]; // get text and path
538 fs.extract_name(text, path);
539 strcpy(new_path, path);
541 for(int i = 0; i < total_loads; i++)
543 if(!strcmp(load[i]->get_text(), text)) // already exists
544 { // swap for top load
545 for(int j = i; j > 0; j--) // move preceeding loads down
547 load[j]->set_text(load[j - 1]->get_text());
548 load[j]->set_path(load[j - 1]->path);
550 load[0]->set_text(text);
551 load[0]->set_path(new_path);
558 if(total_loads < TOTAL_LOADS)
560 filemenu->add_item(load[total_loads] = new LoadPrevious(mwindow, load_file));
565 for(int i = total_loads - 1; i > 0; i--)
567 // set menu item text
568 load[i]->set_text(load[i - 1]->get_text());
570 load[i]->set_path(load[i - 1]->path);
573 // set up the new load
574 load[0]->set_text(text);
575 load[0]->set_path(new_path);
586 // ================================== menu items
588 MainDumpsSubMenu::MainDumpsSubMenu(BC_MenuItem *menu_item)
591 this->menu_item = menu_item;
593 MainDumpsSubMenu::~MainDumpsSubMenu()
598 MainDumpsMenu::MainDumpsMenu(MWindow *mwindow)
599 : BC_MenuItem(_("Dumps..."))
601 this->mwindow = mwindow;
602 this->dumps_menu = 0;
604 MainDumpsMenu::~MainDumpsMenu()
608 void MainDumpsMenu::create_objects()
610 add_submenu(dumps_menu = new MainDumpsSubMenu(this));
611 // dumps_menu->add_item(new DumpCICache(mwindow));
612 dumps_menu->add_item(new DumpEDL(mwindow));
613 dumps_menu->add_item(new DumpPlugins(mwindow));
614 dumps_menu->add_item(new DumpAssets(mwindow));
615 dumps_menu->add_item(new DumpUndo(mwindow));
619 DumpCICache::DumpCICache(MWindow *mwindow)
620 : BC_MenuItem(_("Dump CICache"))
621 { this->mwindow = mwindow; }
623 int DumpCICache::handle_event()
625 // mwindow->cache->dump();
629 DumpEDL::DumpEDL(MWindow *mwindow)
630 : BC_MenuItem(_("Dump EDL"))
632 this->mwindow = mwindow;
635 int DumpEDL::handle_event()
641 DumpPlugins::DumpPlugins(MWindow *mwindow)
642 : BC_MenuItem(_("Dump Plugins"))
644 this->mwindow = mwindow;
647 int DumpPlugins::handle_event()
649 mwindow->dump_plugins();
653 DumpAssets::DumpAssets(MWindow *mwindow)
654 : BC_MenuItem(_("Dump Assets"))
655 { this->mwindow = mwindow; }
657 int DumpAssets::handle_event()
659 mwindow->edl->assets->dump();
663 DumpUndo::DumpUndo(MWindow *mwindow)
664 : BC_MenuItem(_("Dump Undo"))
666 this->mwindow = mwindow;
669 int DumpUndo::handle_event()
671 mwindow->dump_undo();
675 // ================================================= edit
677 Undo::Undo(MWindow *mwindow) : BC_MenuItem(_("Undo"), "z", 'z')
679 this->mwindow = mwindow;
681 int Undo::handle_event()
683 if( mwindow->session->current_operation == NO_OPERATION )
684 mwindow->undo_entry(mwindow->gui);
687 int Undo::update_caption(const char *new_caption)
689 char string[BCTEXTLEN];
690 sprintf(string, _("Undo %s"), new_caption);
696 Redo::Redo(MWindow *mwindow) : BC_MenuItem(_("Redo"), _("Shift-Z"), 'Z')
699 this->mwindow = mwindow;
702 int Redo::handle_event()
704 if( mwindow->session->current_operation == NO_OPERATION )
705 mwindow->redo_entry(mwindow->gui);
708 int Redo::update_caption(const char *new_caption)
710 char string[BCTEXTLEN];
711 sprintf(string, _("Redo %s"), new_caption);
716 CutKeyframes::CutKeyframes(MWindow *mwindow)
717 : BC_MenuItem(_("Cut keyframes"), _("Shift-X"), 'X')
720 this->mwindow = mwindow;
723 int CutKeyframes::handle_event()
725 if( mwindow->session->current_operation == NO_OPERATION )
726 mwindow->cut_automation();
730 CopyKeyframes::CopyKeyframes(MWindow *mwindow)
731 : BC_MenuItem(_("Copy keyframes"), _("Shift-C"), 'C')
734 this->mwindow = mwindow;
737 int CopyKeyframes::handle_event()
739 if( mwindow->session->current_operation == NO_OPERATION )
740 mwindow->copy_automation();
744 PasteKeyframes::PasteKeyframes(MWindow *mwindow)
745 : BC_MenuItem(_("Paste keyframes"), _("Shift-V"), 'V')
748 this->mwindow = mwindow;
751 int PasteKeyframes::handle_event()
753 if( mwindow->session->current_operation == NO_OPERATION )
754 mwindow->paste_automation();
758 ClearKeyframes::ClearKeyframes(MWindow *mwindow)
759 : BC_MenuItem(_("Clear keyframes"), _("Shift-Del"), DELETE)
762 this->mwindow = mwindow;
765 int ClearKeyframes::handle_event()
767 if( mwindow->session->current_operation == NO_OPERATION )
768 mwindow->clear_automation();
774 StraightenKeyframes::StraightenKeyframes(MWindow *mwindow)
775 : BC_MenuItem(_("Change to linear"))
777 this->mwindow = mwindow;
780 int StraightenKeyframes::handle_event()
782 mwindow->set_automation_mode(FloatAuto::LINEAR);
789 BendKeyframes::BendKeyframes(MWindow *mwindow)
790 : BC_MenuItem(_("Change to smooth"))
792 this->mwindow = mwindow;
795 int BendKeyframes::handle_event()
797 mwindow->set_automation_mode(FloatAuto::SMOOTH);
803 KeyframeCurveType::KeyframeCurveType(MWindow *mwindow)
804 : BC_MenuItem(_("Create curve type..."))
806 this->mwindow = mwindow;
807 this->curve_menu = 0;
809 KeyframeCurveType::~KeyframeCurveType()
813 void KeyframeCurveType::create_objects()
815 add_submenu(curve_menu = new KeyframeCurveTypeMenu(this));
816 for( int i=FloatAuto::SMOOTH; i<=FloatAuto::FREE; ++i ) {
817 KeyframeCurveTypeItem *curve_type_item = new KeyframeCurveTypeItem(i, this);
818 curve_menu->add_submenuitem(curve_type_item);
822 void KeyframeCurveType::update(int curve_type)
824 for( int i=0; i<curve_menu->total_items(); ++i ) {
825 KeyframeCurveTypeItem *curve_type_item = (KeyframeCurveTypeItem *)curve_menu->get_item(i);
826 curve_type_item->set_checked(curve_type_item->type == curve_type);
830 int KeyframeCurveType::handle_event()
835 KeyframeCurveTypeMenu::KeyframeCurveTypeMenu(KeyframeCurveType *menu_item)
838 this->menu_item = menu_item;
840 KeyframeCurveTypeMenu::~KeyframeCurveTypeMenu()
844 KeyframeCurveTypeItem::KeyframeCurveTypeItem(int type, KeyframeCurveType *main_item)
845 : BC_MenuItem(FloatAuto::curve_name(type))
848 this->main_item = main_item;
850 KeyframeCurveTypeItem::~KeyframeCurveTypeItem()
854 int KeyframeCurveTypeItem::handle_event()
856 main_item->update(type);
857 main_item->mwindow->set_keyframe_type(type);
862 CutDefaultKeyframe::CutDefaultKeyframe(MWindow *mwindow)
863 : BC_MenuItem(_("Cut default keyframe"), _("Alt-x"), 'x')
866 this->mwindow = mwindow;
869 int CutDefaultKeyframe::handle_event()
871 if( mwindow->session->current_operation == NO_OPERATION )
872 mwindow->cut_default_keyframe();
876 CopyDefaultKeyframe::CopyDefaultKeyframe(MWindow *mwindow)
877 : BC_MenuItem(_("Copy default keyframe"), _("Alt-c"), 'c')
880 this->mwindow = mwindow;
883 int CopyDefaultKeyframe::handle_event()
885 if( mwindow->session->current_operation == NO_OPERATION )
886 mwindow->copy_default_keyframe();
890 PasteDefaultKeyframe::PasteDefaultKeyframe(MWindow *mwindow)
891 : BC_MenuItem(_("Paste default keyframe"), _("Alt-v"), 'v')
894 this->mwindow = mwindow;
897 int PasteDefaultKeyframe::handle_event()
899 if( mwindow->session->current_operation == NO_OPERATION )
900 mwindow->paste_default_keyframe();
904 ClearDefaultKeyframe::ClearDefaultKeyframe(MWindow *mwindow)
905 : BC_MenuItem(_("Clear default keyframe"), _("Alt-Del"), DELETE)
908 this->mwindow = mwindow;
911 int ClearDefaultKeyframe::handle_event()
913 if( mwindow->session->current_operation == NO_OPERATION )
914 mwindow->clear_default_keyframe();
918 Cut::Cut(MWindow *mwindow)
919 : BC_MenuItem(_("Split | Cut"), "x", 'x')
921 this->mwindow = mwindow;
924 int Cut::handle_event()
926 if( mwindow->session->current_operation == NO_OPERATION )
931 Copy::Copy(MWindow *mwindow)
932 : BC_MenuItem(_("Copy"), "c", 'c')
934 this->mwindow = mwindow;
937 int Copy::handle_event()
939 if( mwindow->session->current_operation == NO_OPERATION )
944 Paste::Paste(MWindow *mwindow)
945 : BC_MenuItem(_("Paste"), "v", 'v')
947 this->mwindow = mwindow;
950 int Paste::handle_event()
952 if( mwindow->session->current_operation == NO_OPERATION )
957 Clear::Clear(MWindow *mwindow)
958 : BC_MenuItem(_("Clear"), _("Del"), DELETE)
960 this->mwindow = mwindow;
963 int Clear::handle_event()
965 if( mwindow->session->current_operation == NO_OPERATION ) {
966 mwindow->cwindow->gui->lock_window("Clear::handle_event");
967 mwindow->clear_entry();
968 mwindow->cwindow->gui->unlock_window();
973 PasteSilence::PasteSilence(MWindow *mwindow)
974 : BC_MenuItem(_("Paste silence"), _("Shift-Space"), ' ')
976 this->mwindow = mwindow;
980 int PasteSilence::handle_event()
982 if( mwindow->session->current_operation == NO_OPERATION )
983 mwindow->paste_silence();
987 SelectAll::SelectAll(MWindow *mwindow)
988 : BC_MenuItem(_("Select All"), "a", 'a')
990 this->mwindow = mwindow;
993 int SelectAll::handle_event()
995 if( mwindow->session->current_operation == NO_OPERATION )
996 mwindow->select_all();
1000 ClearLabels::ClearLabels(MWindow *mwindow) : BC_MenuItem(_("Clear labels"))
1002 this->mwindow = mwindow;
1005 int ClearLabels::handle_event()
1007 mwindow->clear_labels();
1011 CutCommercials::CutCommercials(MWindow *mwindow) : BC_MenuItem(_("Cut ads"))
1013 this->mwindow = mwindow;
1016 int CutCommercials::handle_event()
1018 mwindow->cut_commercials();
1022 DetachTransitions::DetachTransitions(MWindow *mwindow)
1023 : BC_MenuItem(_("Detach transitions"))
1025 this->mwindow = mwindow;
1028 int DetachTransitions::handle_event()
1030 mwindow->detach_transitions();
1034 MuteSelection::MuteSelection(MWindow *mwindow)
1035 : BC_MenuItem(_("Mute Region"), "m", 'm')
1037 this->mwindow = mwindow;
1040 int MuteSelection::handle_event()
1042 if( mwindow->session->current_operation == NO_OPERATION )
1043 mwindow->mute_selection();
1048 TrimSelection::TrimSelection(MWindow *mwindow)
1049 : BC_MenuItem(_("Trim Selection"))
1051 this->mwindow = mwindow;
1054 int TrimSelection::handle_event()
1056 mwindow->trim_selection();
1071 // ============================================= audio
1073 AddAudioTrack::AddAudioTrack(MWindow *mwindow)
1074 : BC_MenuItem(_("Add track"), "t", 't')
1076 this->mwindow = mwindow;
1079 int AddAudioTrack::handle_event()
1081 if( mwindow->session->current_operation == NO_OPERATION )
1082 mwindow->add_audio_track_entry(0, 0);
1086 DeleteAudioTrack::DeleteAudioTrack(MWindow *mwindow)
1087 : BC_MenuItem(_("Delete track"))
1089 this->mwindow = mwindow;
1092 int DeleteAudioTrack::handle_event()
1097 DefaultATransition::DefaultATransition(MWindow *mwindow)
1098 : BC_MenuItem(_("Default Transition"), "u", 'u')
1100 this->mwindow = mwindow;
1103 int DefaultATransition::handle_event()
1105 if( mwindow->session->current_operation == NO_OPERATION )
1106 mwindow->paste_audio_transition();
1111 MapAudio1::MapAudio1(MWindow *mwindow)
1112 : BC_MenuItem(_("Map 1:1"))
1114 this->mwindow = mwindow;
1117 int MapAudio1::handle_event()
1119 mwindow->map_audio(MWindow::AUDIO_1_TO_1);
1123 MapAudio2::MapAudio2(MWindow *mwindow)
1124 : BC_MenuItem(_("Map 5.1:2"))
1126 this->mwindow = mwindow;
1129 int MapAudio2::handle_event()
1131 mwindow->map_audio(MWindow::AUDIO_5_1_TO_2);
1138 // ============================================= video
1141 AddVideoTrack::AddVideoTrack(MWindow *mwindow)
1142 : BC_MenuItem(_("Add track"), _("Shift-T"), 'T')
1145 this->mwindow = mwindow;
1148 int AddVideoTrack::handle_event()
1150 if( mwindow->session->current_operation == NO_OPERATION )
1151 mwindow->add_video_track_entry();
1156 DeleteVideoTrack::DeleteVideoTrack(MWindow *mwindow)
1157 : BC_MenuItem(_("Delete track"))
1159 this->mwindow = mwindow;
1162 int DeleteVideoTrack::handle_event()
1169 ResetTranslation::ResetTranslation(MWindow *mwindow)
1170 : BC_MenuItem(_("Reset Translation"))
1172 this->mwindow = mwindow;
1175 int ResetTranslation::handle_event()
1182 DefaultVTransition::DefaultVTransition(MWindow *mwindow)
1183 : BC_MenuItem(_("Default Transition"), _("Shift-U"), 'U')
1186 this->mwindow = mwindow;
1189 int DefaultVTransition::handle_event()
1191 if( mwindow->session->current_operation == NO_OPERATION )
1192 mwindow->paste_video_transition();
1209 // ============================================ settings
1211 DeleteTracks::DeleteTracks(MWindow *mwindow)
1212 : BC_MenuItem(_("Delete tracks"))
1214 this->mwindow = mwindow;
1217 int DeleteTracks::handle_event()
1219 mwindow->delete_tracks();
1223 DeleteTrack::DeleteTrack(MWindow *mwindow)
1224 : BC_MenuItem(_("Delete last track"), "d", 'd')
1226 this->mwindow = mwindow;
1229 int DeleteTrack::handle_event()
1231 if( mwindow->session->current_operation == NO_OPERATION )
1232 mwindow->delete_track();
1236 MoveTracksUp::MoveTracksUp(MWindow *mwindow)
1237 : BC_MenuItem(_("Move tracks up"), _("Shift-Up"), UP)
1239 set_shift(); this->mwindow = mwindow;
1242 int MoveTracksUp::handle_event()
1244 if( mwindow->session->current_operation == NO_OPERATION )
1245 mwindow->move_tracks_up();
1249 MoveTracksDown::MoveTracksDown(MWindow *mwindow)
1250 : BC_MenuItem(_("Move tracks down"), _("Shift-Down"), DOWN)
1252 set_shift(); this->mwindow = mwindow;
1255 int MoveTracksDown::handle_event()
1257 if( mwindow->session->current_operation == NO_OPERATION )
1258 mwindow->move_tracks_down();
1265 ConcatenateTracks::ConcatenateTracks(MWindow *mwindow)
1266 : BC_MenuItem(_("Concatenate tracks"))
1269 this->mwindow = mwindow;
1272 int ConcatenateTracks::handle_event()
1274 mwindow->concatenate_tracks();
1282 LoopPlayback::LoopPlayback(MWindow *mwindow)
1283 : BC_MenuItem(_("Loop Playback"), _("Shift-L"), 'L')
1285 this->mwindow = mwindow;
1286 set_checked(mwindow->edl->local_session->loop_playback);
1290 int LoopPlayback::handle_event()
1292 if( mwindow->session->current_operation == NO_OPERATION ) {
1293 mwindow->toggle_loop_playback();
1294 set_checked(mwindow->edl->local_session->loop_playback);
1301 // ============================================= subtitle
1304 AddSubttlTrack::AddSubttlTrack(MWindow *mwindow)
1305 : BC_MenuItem(_("Add subttl"), _("Shift-Y"), 'Y')
1308 this->mwindow = mwindow;
1311 int AddSubttlTrack::handle_event()
1313 if( mwindow->session->current_operation == NO_OPERATION )
1314 mwindow->add_subttl_track_entry();
1318 PasteSubttl::PasteSubttl(MWindow *mwindow)
1319 : BC_MenuItem(_("paste subttl"), "y", 'y')
1321 this->mwindow = mwindow;
1324 int PasteSubttl::handle_event()
1326 if( mwindow->session->current_operation == NO_OPERATION )
1327 mwindow->gui->swindow->paste_subttl();
1332 SetBRenderActive::SetBRenderActive(MWindow *mwindow)
1333 : BC_MenuItem(_("Toggle background rendering"),_("Shift-G"),'G')
1335 this->mwindow = mwindow;
1339 int SetBRenderActive::handle_event()
1341 if( mwindow->session->current_operation == NO_OPERATION ) {
1342 int v = mwindow->brender_active ? 0 : 1;
1344 mwindow->set_brender_active(v);
1350 LabelsFollowEdits::LabelsFollowEdits(MWindow *mwindow)
1351 : BC_MenuItem(_("Edit labels"))
1353 this->mwindow = mwindow;
1354 set_checked(mwindow->edl->session->labels_follow_edits);
1357 int LabelsFollowEdits::handle_event()
1359 set_checked(get_checked() ^ 1);
1360 mwindow->set_labels_follow_edits(get_checked());
1367 PluginsFollowEdits::PluginsFollowEdits(MWindow *mwindow)
1368 : BC_MenuItem(_("Edit effects"))
1370 this->mwindow = mwindow;
1371 set_checked(mwindow->edl->session->plugins_follow_edits);
1374 int PluginsFollowEdits::handle_event()
1376 set_checked(get_checked() ^ 1);
1377 mwindow->edl->session->plugins_follow_edits = get_checked();
1384 KeyframesFollowEdits::KeyframesFollowEdits(MWindow *mwindow)
1385 : BC_MenuItem(_("Keyframes follow edits"))
1387 this->mwindow = mwindow;
1388 set_checked(mwindow->edl->session->autos_follow_edits);
1391 int KeyframesFollowEdits::handle_event()
1393 mwindow->edl->session->autos_follow_edits ^= 1;
1394 set_checked(!get_checked());
1399 CursorOnFrames::CursorOnFrames(MWindow *mwindow)
1400 : BC_MenuItem(_("Align cursor on frames"),_("Ctrl-a"),'a')
1402 this->mwindow = mwindow;
1403 set_checked(mwindow->edl->session->cursor_on_frames);
1407 int CursorOnFrames::handle_event()
1409 mwindow->edl->session->cursor_on_frames = !mwindow->edl->session->cursor_on_frames;
1410 set_checked(mwindow->edl->session->cursor_on_frames);
1415 TypelessKeyframes::TypelessKeyframes(MWindow *mwindow)
1416 : BC_MenuItem(_("Typeless keyframes"))
1418 this->mwindow = mwindow;
1419 set_checked(mwindow->edl->session->typeless_keyframes);
1422 int TypelessKeyframes::handle_event()
1424 mwindow->edl->session->typeless_keyframes = !mwindow->edl->session->typeless_keyframes;
1425 set_checked(mwindow->edl->session->typeless_keyframes);
1430 ScrubSpeed::ScrubSpeed(MWindow *mwindow)
1431 : BC_MenuItem(_("Slow Shuttle"))
1433 this->mwindow = mwindow;
1436 int ScrubSpeed::handle_event()
1438 if(mwindow->edl->session->scrub_speed == .5)
1440 mwindow->edl->session->scrub_speed = 2;
1441 set_text(_("Slow Shuttle"));
1445 mwindow->edl->session->scrub_speed = .5;
1446 set_text(_("Fast Shuttle"));
1451 SaveSettingsNow::SaveSettingsNow(MWindow *mwindow)
1452 : BC_MenuItem(_("Save settings now"),_("Ctrl-s"),'s')
1454 this->mwindow = mwindow;
1458 int SaveSettingsNow::handle_event()
1460 mwindow->save_defaults();
1461 mwindow->save_backup();
1462 mwindow->gui->show_message(_("Saved settings."));
1468 // ============================================ window
1474 ShowVWindow::ShowVWindow(MWindow *mwindow)
1475 : BC_MenuItem(_("Show Viewer"))
1477 this->mwindow = mwindow;
1478 set_checked(mwindow->session->show_vwindow);
1480 int ShowVWindow::handle_event()
1482 mwindow->show_vwindow();
1486 ShowAWindow::ShowAWindow(MWindow *mwindow)
1487 : BC_MenuItem(_("Show Resources"))
1489 this->mwindow = mwindow;
1490 set_checked(mwindow->session->show_awindow);
1492 int ShowAWindow::handle_event()
1494 mwindow->show_awindow();
1498 ShowCWindow::ShowCWindow(MWindow *mwindow)
1499 : BC_MenuItem(_("Show Compositor"))
1501 this->mwindow = mwindow;
1502 set_checked(mwindow->session->show_cwindow);
1504 int ShowCWindow::handle_event()
1506 mwindow->show_cwindow();
1511 ShowGWindow::ShowGWindow(MWindow *mwindow)
1512 : BC_MenuItem(_("Show Overlays"), _("Ctrl-0"), '0')
1514 this->mwindow = mwindow;
1516 set_checked(mwindow->session->show_gwindow);
1518 int ShowGWindow::handle_event()
1520 if( mwindow->session->current_operation == NO_OPERATION ) {
1521 if( !mwindow->session->show_gwindow )
1522 mwindow->show_gwindow();
1524 mwindow->hide_gwindow();
1525 set_checked(mwindow->session->show_gwindow);
1531 ShowLWindow::ShowLWindow(MWindow *mwindow)
1532 : BC_MenuItem(_("Show Levels"))
1534 this->mwindow = mwindow;
1535 set_checked(mwindow->session->show_lwindow);
1537 int ShowLWindow::handle_event()
1539 mwindow->show_lwindow();
1543 TileWindows::TileWindows(MWindow *mwindow, const char *item_title, int config,
1544 const char *hot_keytext, int hot_key)
1545 : BC_MenuItem(item_title, hot_keytext, hot_key)
1547 this->mwindow = mwindow;
1548 this->config = config;
1549 if( hot_key ) set_ctrl(1);
1551 int TileWindows::handle_event()
1553 if( mwindow->session->current_operation == NO_OPERATION ) {
1554 int window_config = config >= 0 ? config :
1555 mwindow->session->window_config;
1556 if( mwindow->tile_windows(window_config) ) {
1557 mwindow->restart_status = 1;
1558 mwindow->gui->set_done(0);
1564 SplitX::SplitX(MWindow *mwindow)
1565 : BC_MenuItem(_("Split X pane"), _("Ctrl-1"), '1')
1567 this->mwindow = mwindow;
1569 set_checked(mwindow->gui->pane[TOP_RIGHT_PANE] != 0);
1571 int SplitX::handle_event()
1573 if( mwindow->session->current_operation == NO_OPERATION )
1578 SplitY::SplitY(MWindow *mwindow)
1579 : BC_MenuItem(_("Split Y pane"), _("Ctrl-2"), '2')
1581 this->mwindow = mwindow;
1583 set_checked(mwindow->gui->pane[BOTTOM_LEFT_PANE] != 0);
1585 int SplitY::handle_event()
1587 if( mwindow->session->current_operation == NO_OPERATION )
1593 MixerViewer::MixerViewer(MWindow *mwindow)
1594 : BC_MenuItem(_("Mixer Viewer"), _("Shift-M"), 'M')
1596 this->mwindow = mwindow;
1600 int MixerViewer::handle_event()
1602 mwindow->start_mixer();
1606 TileMixers::TileMixers(MWindow *mwindow)
1607 : BC_MenuItem(_("Tile mixers"), "Alt-t", 't')
1609 this->mwindow = mwindow;
1613 int TileMixers::handle_event()
1615 mwindow->tile_mixers();
1620 LoadLayoutItem::LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey)
1621 : BC_MenuItem(text, "", hotkey)
1624 this->load_layout = load_layout;
1626 char hot_txt[BCSTRLEN];
1627 sprintf(hot_txt, _("Ctrl-Shift+F%d"), hotkey-KEY_F1+1);
1628 set_ctrl(); set_shift();
1629 set_hotkey_text(hot_txt);
1633 int LoadLayoutItem::handle_event()
1635 MWindow *mwindow = load_layout->mwindow;
1636 switch( load_layout->action ) {
1638 mwindow->load_layout(no);
1641 mwindow->save_layout(no);
1647 LoadLayout::LoadLayout(MWindow *mwindow, const char *text, int action)
1650 this->mwindow = mwindow;
1651 this->action = action;
1654 void LoadLayout::create_objects()
1656 BC_SubMenu *layout_submenu = new BC_SubMenu();
1657 add_submenu(layout_submenu);
1658 for( int i=1; i<=4; ++i ) {
1659 char text[BCSTRLEN];
1660 sprintf(text, _("Layout %d"), i);
1661 LoadLayoutItem *load_layout_item =
1662 new LoadLayoutItem(this, text, i,
1663 action==LAYOUT_LOAD ? KEY_F1-1+i : 0);
1664 layout_submenu->add_submenuitem(load_layout_item);