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"
39 #include "filesystem.h"
41 #include "floatauto.h"
44 #include "levelwindow.h"
46 #include "localsession.h"
47 #include "mainclock.h"
49 #include "mainsession.h"
51 #include "menuattacheffect.h"
52 #include "menuattachtransition.h"
53 #include "menuaeffects.h"
54 #include "menueditlength.h"
55 #include "menutransitionlength.h"
56 #include "menuveffects.h"
57 #include "mwindowgui.h"
61 #include "playbackengine.h"
62 #include "preferences.h"
63 #include "preferencesthread.h"
68 #include "setformat.h"
71 #include "trackcanvas.h"
73 #include "transition.h"
74 #include "transportque.h"
77 #include "exportedl.h"
82 MainMenu::MainMenu(MWindow *mwindow, MWindowGUI *gui, int w)
86 this->mwindow = mwindow;
93 void MainMenu::create_objects()
95 BC_Menu *viewmenu, *windowmenu, *settingsmenu, *trackmenu;
96 PreferencesMenuitem *preferences;
99 add_menu(filemenu = new BC_Menu(_("File")));
100 filemenu->add_item(new_project = new New(mwindow));
101 new_project->create_objects();
104 filemenu->add_item(load_file = new Load(mwindow, this));
105 load_file->create_objects();
107 // new and load can be undone so no need to prompt save
108 Save *save; // affected by saveas
109 filemenu->add_item(save = new Save(mwindow));
111 filemenu->add_item(saveas = new SaveAs(mwindow));
112 save->create_objects(saveas);
113 saveas->set_mainmenu(this);
114 filemenu->add_item(record_menu_item = new RecordMenuItem(mwindow));
116 filemenu->add_item(new ChannelScan(mwindow));
118 if( mwindow->has_commercials() )
119 filemenu->add_item(new DbWindowScan(mwindow));
120 filemenu->add_item(new SubttlSWin(mwindow));
122 filemenu->add_item(render = new RenderItem(mwindow));
123 filemenu->add_item(new ExportEDLItem(mwindow));
124 filemenu->add_item(new BatchRenderMenuItem(mwindow));
125 filemenu->add_item(new CreateBD_MenuItem(mwindow));
126 filemenu->add_item(new CreateDVD_MenuItem(mwindow));
127 filemenu->add_item(new BC_MenuItem("-"));
128 filemenu->add_item(quit_program = new Quit(mwindow));
129 quit_program->create_objects(save);
130 filemenu->add_item(new DumpEDL(mwindow));
131 filemenu->add_item(new DumpPlugins(mwindow));
132 filemenu->add_item(new LoadBackup(mwindow));
133 filemenu->add_item(new SaveBackup(mwindow));
136 add_menu(editmenu = new BC_Menu(_("Edit")));
137 editmenu->add_item(undo = new Undo(mwindow));
138 editmenu->add_item(redo = new Redo(mwindow));
139 editmenu->add_item(new BC_MenuItem("-"));
140 editmenu->add_item(new Cut(mwindow));
141 editmenu->add_item(new Copy(mwindow));
142 editmenu->add_item(new Paste(mwindow));
143 editmenu->add_item(new Clear(mwindow));
144 editmenu->add_item(new PasteSilence(mwindow));
145 editmenu->add_item(new MuteSelection(mwindow));
146 editmenu->add_item(new TrimSelection(mwindow));
147 editmenu->add_item(new SelectAll(mwindow));
148 editmenu->add_item(new BC_MenuItem("-"));
149 editmenu->add_item(new MenuEditShuffle(mwindow));
150 editmenu->add_item(new MenuEditReverse(mwindow));
151 editmenu->add_item(new MenuEditLength(mwindow));
152 editmenu->add_item(new MenuEditAlign(mwindow));
153 editmenu->add_item(new MenuTransitionLength(mwindow));
154 editmenu->add_item(new DetachTransitions(mwindow));
155 editmenu->add_item(new BC_MenuItem("-"));
156 editmenu->add_item(new ClearLabels(mwindow));
157 editmenu->add_item(new CutCommercials(mwindow));
158 editmenu->add_item(new PasteSubttl(mwindow));
160 BC_Menu *keyframemenu;
161 add_menu(keyframemenu = new BC_Menu(_("Keyframes")));
162 keyframemenu->add_item(new CutKeyframes(mwindow));
163 keyframemenu->add_item(new CopyKeyframes(mwindow));
164 keyframemenu->add_item(new PasteKeyframes(mwindow));
165 keyframemenu->add_item(new ClearKeyframes(mwindow));
166 keyframemenu->add_item(new StraightenKeyframes(mwindow));
167 keyframemenu->add_item(new BendKeyframes(mwindow));
168 keyframemenu->add_item(keyframe_curve_type = new KeyframeCurveType(mwindow));
169 keyframe_curve_type->create_objects();
170 keyframe_curve_type->update(mwindow->edl->local_session->floatauto_type);
171 keyframemenu->add_item(new BC_MenuItem("-"));
172 keyframemenu->add_item(new CopyDefaultKeyframe(mwindow));
173 keyframemenu->add_item(new PasteDefaultKeyframe(mwindow));
178 add_menu(audiomenu = new BC_Menu(_("Audio")));
179 audiomenu->add_item(new AddAudioTrack(mwindow));
180 audiomenu->add_item(new DefaultATransition(mwindow));
181 audiomenu->add_item(new MapAudio1(mwindow));
182 audiomenu->add_item(new MapAudio2(mwindow));
183 audiomenu->add_item(new MenuAttachTransition(mwindow, TRACK_AUDIO));
184 audiomenu->add_item(new MenuAttachEffect(mwindow, TRACK_AUDIO));
185 audiomenu->add_item(aeffects = new MenuAEffects(mwindow));
187 add_menu(videomenu = new BC_Menu(_("Video")));
188 videomenu->add_item(new AddVideoTrack(mwindow));
189 videomenu->add_item(new DefaultVTransition(mwindow));
190 videomenu->add_item(new MenuAttachTransition(mwindow, TRACK_VIDEO));
191 videomenu->add_item(new MenuAttachEffect(mwindow, TRACK_VIDEO));
192 videomenu->add_item(veffects = new MenuVEffects(mwindow));
194 add_menu(trackmenu = new BC_Menu(_("Tracks")));
195 trackmenu->add_item(new MoveTracksUp(mwindow));
196 trackmenu->add_item(new MoveTracksDown(mwindow));
197 trackmenu->add_item(new DeleteTracks(mwindow));
198 trackmenu->add_item(new DeleteTrack(mwindow));
199 trackmenu->add_item(new ConcatenateTracks(mwindow));
200 trackmenu->add_item(new AddSubttlTrack(mwindow));
202 add_menu(settingsmenu = new BC_Menu(_("Settings")));
204 settingsmenu->add_item(new SetFormat(mwindow));
205 settingsmenu->add_item(preferences = new PreferencesMenuitem(mwindow));
206 mwindow->preferences_thread = preferences->thread;
207 settingsmenu->add_item(labels_follow_edits = new LabelsFollowEdits(mwindow));
208 settingsmenu->add_item(plugins_follow_edits = new PluginsFollowEdits(mwindow));
209 settingsmenu->add_item(keyframes_follow_edits = new KeyframesFollowEdits(mwindow));
210 settingsmenu->add_item(cursor_on_frames = new CursorOnFrames(mwindow));
211 settingsmenu->add_item(typeless_keyframes = new TypelessKeyframes(mwindow));
212 settingsmenu->add_item(new BC_MenuItem("-"));
213 settingsmenu->add_item(new SaveSettingsNow(mwindow));
214 settingsmenu->add_item(loop_playback = new LoopPlayback(mwindow));
215 settingsmenu->add_item(new SetBRenderRange(mwindow));
216 // set scrubbing speed
217 // ScrubSpeed *scrub_speed;
218 // settingsmenu->add_item(scrub_speed = new ScrubSpeed(mwindow));
219 // if(mwindow->edl->session->scrub_speed == .5)
220 // scrub_speed->set_text(_("Fast Shuttle"));
227 add_menu(viewmenu = new BC_Menu(_("View")));
228 viewmenu->add_item(show_assets = new ShowAssets(mwindow, "0"));
229 viewmenu->add_item(show_titles = new ShowTitles(mwindow, "1"));
230 viewmenu->add_item(show_transitions = new ShowTransitions(mwindow, "2"));
231 viewmenu->add_item(fade_automation = new ShowAutomation(mwindow, _("Fade"), "3", AUTOMATION_FADE));
232 viewmenu->add_item(mute_automation = new ShowAutomation(mwindow, _("Mute"), "4", AUTOMATION_MUTE));
233 viewmenu->add_item(mode_automation = new ShowAutomation(mwindow, _("Overlay mode"), "5", AUTOMATION_MODE));
234 viewmenu->add_item(pan_automation = new ShowAutomation(mwindow, _("Pan"), "6", AUTOMATION_PAN));
235 viewmenu->add_item(plugin_automation = new PluginAutomation(mwindow, "7"));
236 viewmenu->add_item(mask_automation = new ShowAutomation(mwindow, _("Mask"), "8", AUTOMATION_MASK));
237 viewmenu->add_item(speed_automation = new ShowAutomation(mwindow, _("Speed"), "9", AUTOMATION_SPEED));
238 viewmenu->add_item(camera_x = new ShowAutomation(mwindow, _("Camera X"), "", AUTOMATION_CAMERA_X));
239 viewmenu->add_item(camera_y = new ShowAutomation(mwindow, _("Camera Y"), "", AUTOMATION_CAMERA_Y));
240 viewmenu->add_item(camera_z = new ShowAutomation(mwindow, _("Camera Z"), "", AUTOMATION_CAMERA_Z));
241 viewmenu->add_item(project_x = new ShowAutomation(mwindow, _("Projector X"), "", AUTOMATION_PROJECTOR_X));
242 viewmenu->add_item(project_y = new ShowAutomation(mwindow, _("Projector Y"), "", AUTOMATION_PROJECTOR_Y));
243 viewmenu->add_item(project_z = new ShowAutomation(mwindow, _("Projector Z"), "", AUTOMATION_PROJECTOR_Z));
246 add_menu(windowmenu = new BC_Menu(_("Window")));
247 windowmenu->add_item(show_vwindow = new ShowVWindow(mwindow));
248 windowmenu->add_item(show_awindow = new ShowAWindow(mwindow));
249 windowmenu->add_item(show_cwindow = new ShowCWindow(mwindow));
250 windowmenu->add_item(show_gwindow = new ShowGWindow(mwindow));
251 windowmenu->add_item(show_lwindow = new ShowLWindow(mwindow));
252 windowmenu->add_item(new BC_MenuItem("-"));
253 windowmenu->add_item(split_x = new SplitX(mwindow));
254 windowmenu->add_item(split_y = new SplitY(mwindow));
255 windowmenu->add_item(new TileWindows(mwindow,_("Default positions"),-1,_("Ctrl-P"),'p'));
256 windowmenu->add_item(new TileWindows(mwindow,_("Tile left"),0));
257 windowmenu->add_item(new TileWindows(mwindow,_("Tile right"),1));
260 int MainMenu::load_defaults(BC_Hash *defaults)
262 init_loads(defaults);
263 init_aeffects(defaults);
264 init_veffects(defaults);
268 void MainMenu::update_toggles(int use_lock)
270 if(use_lock) lock_window("MainMenu::update_toggles");
271 labels_follow_edits->set_checked(mwindow->edl->session->labels_follow_edits);
272 plugins_follow_edits->set_checked(mwindow->edl->session->plugins_follow_edits);
273 keyframes_follow_edits->set_checked(mwindow->edl->session->autos_follow_edits);
274 typeless_keyframes->set_checked(mwindow->edl->session->typeless_keyframes);
275 cursor_on_frames->set_checked(mwindow->edl->session->cursor_on_frames);
276 loop_playback->set_checked(mwindow->edl->local_session->loop_playback);
278 show_assets->set_checked(mwindow->edl->session->show_assets);
279 show_titles->set_checked(mwindow->edl->session->show_titles);
280 show_transitions->set_checked(mwindow->edl->session->auto_conf->transitions);
281 fade_automation->update_toggle();
282 mute_automation->update_toggle();
283 pan_automation->update_toggle();
284 camera_x->update_toggle();
285 camera_y->update_toggle();
286 camera_z->update_toggle();
287 project_x->update_toggle();
288 project_y->update_toggle();
289 project_z->update_toggle();
290 plugin_automation->set_checked(mwindow->edl->session->auto_conf->plugins);
291 mode_automation->update_toggle();
292 mask_automation->update_toggle();
293 speed_automation->update_toggle();
294 split_x->set_checked(mwindow->gui->pane[TOP_RIGHT_PANE] != 0);
295 split_y->set_checked(mwindow->gui->pane[BOTTOM_LEFT_PANE] != 0);
297 if(use_lock) mwindow->gui->unlock_window();
300 int MainMenu::save_defaults(BC_Hash *defaults)
302 save_loads(defaults);
303 save_aeffects(defaults);
304 save_veffects(defaults);
314 quit_program->handle_event();
322 // ================================== load most recent
324 int MainMenu::init_aeffects(BC_Hash *defaults)
326 total_aeffects = defaults->get((char*)"TOTAL_AEFFECTS", 0);
328 char string[BCTEXTLEN], title[BCTEXTLEN];
329 if(total_aeffects) audiomenu->add_item(new BC_MenuItem("-"));
331 for(int i = 0; i < total_aeffects; i++)
333 sprintf(string, "AEFFECTRECENT%d", i);
334 defaults->get(string, title);
335 audiomenu->add_item(aeffect[i] = new MenuAEffectItem(aeffects, title));
340 int MainMenu::init_veffects(BC_Hash *defaults)
342 total_veffects = defaults->get((char*)"TOTAL_VEFFECTS", 0);
344 char string[BCTEXTLEN], title[BCTEXTLEN];
345 if(total_veffects) videomenu->add_item(new BC_MenuItem("-"));
347 for(int i = 0; i < total_veffects; i++)
349 sprintf(string, "VEFFECTRECENT%d", i);
350 defaults->get(string, title);
351 videomenu->add_item(veffect[i] = new MenuVEffectItem(veffects, title));
356 void MainMenu::init_loads(BC_Hash *defaults)
358 total_loads = defaults->get((char*)"TOTAL_LOADS", 0);
359 if( !total_loads ) return;
360 filemenu->add_item(new BC_MenuItem("-"));
362 char string[BCTEXTLEN], path[BCTEXTLEN], filename[BCTEXTLEN];
364 //printf("MainMenu::init_loads 2\n");
366 for(int i = 0; i < total_loads; i++) {
367 sprintf(string, "LOADPREVIOUS%d", i);
368 //printf("MainMenu::init_loads 3\n");
369 defaults->get(string, path);
370 filemenu->add_item(load[i] = new LoadPrevious(mwindow, load_file));
371 dir.extract_name(filename, path, 0);
372 load[i]->set_text(filename);
373 load[i]->set_path(path);
377 // ============================ save most recent
379 int MainMenu::save_aeffects(BC_Hash *defaults)
381 defaults->update((char*)"TOTAL_AEFFECTS", total_aeffects);
382 char string[BCTEXTLEN];
383 for(int i = 0; i < total_aeffects; i++)
385 sprintf(string, "AEFFECTRECENT%d", i);
386 defaults->update(string, aeffect[i]->get_text());
391 int MainMenu::save_veffects(BC_Hash *defaults)
393 defaults->update((char*)"TOTAL_VEFFECTS", total_veffects);
394 char string[BCTEXTLEN];
395 for(int i = 0; i < total_veffects; i++)
397 sprintf(string, "VEFFECTRECENT%d", i);
398 defaults->update(string, veffect[i]->get_text());
403 int MainMenu::save_loads(BC_Hash *defaults)
405 defaults->update((char*)"TOTAL_LOADS", total_loads);
406 char string[BCTEXTLEN];
407 for(int i = 0; i < total_loads; i++)
409 sprintf(string, "LOADPREVIOUS%d", i);
410 defaults->update(string, load[i]->path);
415 // =================================== add most recent
417 int MainMenu::add_aeffect(char *title)
419 // add bar for first effect
420 if(total_aeffects == 0)
422 audiomenu->add_item(new BC_MenuItem("-"));
425 // test for existing copy of effect
426 for(int i = 0; i < total_aeffects; i++)
428 if(!strcmp(aeffect[i]->get_text(), title)) // already exists
429 { // swap for top effect
430 for(int j = i; j > 0; j--) // move preceeding effects down
432 aeffect[j]->set_text(aeffect[j - 1]->get_text());
434 aeffect[0]->set_text(title);
439 // add another blank effect
440 if(total_aeffects < TOTAL_EFFECTS)
443 aeffect[total_aeffects] = new MenuAEffectItem(aeffects, (char*)""));
448 for(int i = total_aeffects - 1; i > 0; i--)
450 // set menu item text
451 aeffect[i]->set_text(aeffect[i - 1]->get_text());
454 // set up the new effect
455 aeffect[0]->set_text(title);
459 int MainMenu::add_veffect(char *title)
461 // add bar for first effect
462 if(total_veffects == 0)
464 videomenu->add_item(new BC_MenuItem("-"));
467 // test for existing copy of effect
468 for(int i = 0; i < total_veffects; i++)
470 if(!strcmp(veffect[i]->get_text(), title)) // already exists
471 { // swap for top effect
472 for(int j = i; j > 0; j--) // move preceeding effects down
474 veffect[j]->set_text(veffect[j - 1]->get_text());
476 veffect[0]->set_text(title);
481 // add another blank effect
482 if(total_veffects < TOTAL_EFFECTS)
484 videomenu->add_item(veffect[total_veffects] =
485 new MenuVEffectItem(veffects, (char*)""));
490 for(int i = total_veffects - 1; i > 0; i--)
492 // set menu item text
493 veffect[i]->set_text(veffect[i - 1]->get_text());
496 // set up the new effect
497 veffect[0]->set_text(title);
501 int MainMenu::add_load(char *path)
505 filemenu->add_item(new BC_MenuItem("-"));
508 // test for existing copy
510 char text[BCTEXTLEN], new_path[BCTEXTLEN]; // get text and path
511 fs.extract_name(text, path);
512 strcpy(new_path, path);
514 for(int i = 0; i < total_loads; i++)
516 if(!strcmp(load[i]->get_text(), text)) // already exists
517 { // swap for top load
518 for(int j = i; j > 0; j--) // move preceeding loads down
520 load[j]->set_text(load[j - 1]->get_text());
521 load[j]->set_path(load[j - 1]->path);
523 load[0]->set_text(text);
524 load[0]->set_path(new_path);
531 if(total_loads < TOTAL_LOADS)
533 filemenu->add_item(load[total_loads] = new LoadPrevious(mwindow, load_file));
538 for(int i = total_loads - 1; i > 0; i--)
540 // set menu item text
541 load[i]->set_text(load[i - 1]->get_text());
543 load[i]->set_path(load[i - 1]->path);
546 // set up the new load
547 load[0]->set_text(text);
548 load[0]->set_path(new_path);
559 // ================================== menu items
562 DumpCICache::DumpCICache(MWindow *mwindow)
563 : BC_MenuItem(_("Dump CICache"))
564 { this->mwindow = mwindow; }
566 int DumpCICache::handle_event()
568 // mwindow->cache->dump();
572 DumpEDL::DumpEDL(MWindow *mwindow)
573 : BC_MenuItem(_("Dump EDL"))
575 this->mwindow = mwindow;
578 int DumpEDL::handle_event()
580 //printf("DumpEDL::handle_event 1\n");
582 //printf("DumpEDL::handle_event 2\n");
586 DumpPlugins::DumpPlugins(MWindow *mwindow)
587 : BC_MenuItem(_("Dump Plugins"))
589 this->mwindow = mwindow;
592 int DumpPlugins::handle_event()
594 //printf("DumpEDL::handle_event 1\n");
595 mwindow->dump_plugins();
596 //printf("DumpEDL::handle_event 2\n");
601 DumpAssets::DumpAssets(MWindow *mwindow)
602 : BC_MenuItem(_("Dump Assets"))
603 { this->mwindow = mwindow; }
605 int DumpAssets::handle_event()
607 mwindow->assets->dump();
611 // ================================================= edit
613 Undo::Undo(MWindow *mwindow) : BC_MenuItem(_("Undo"), "z", 'z')
615 this->mwindow = mwindow;
617 int Undo::handle_event()
619 mwindow->undo_entry(mwindow->gui);
622 int Undo::update_caption(const char *new_caption)
624 char string[BCTEXTLEN];
625 sprintf(string, _("Undo %s"), new_caption);
631 Redo::Redo(MWindow *mwindow) : BC_MenuItem(_("Redo"), _("Shift-Z"), 'Z')
634 this->mwindow = mwindow;
637 int Redo::handle_event()
639 mwindow->redo_entry(mwindow->gui);
643 int Redo::update_caption(const char *new_caption)
645 char string[BCTEXTLEN];
646 sprintf(string, _("Redo %s"), new_caption);
651 CutKeyframes::CutKeyframes(MWindow *mwindow)
652 : BC_MenuItem(_("Cut keyframes"), _("Shift-X"), 'X')
655 this->mwindow = mwindow;
658 int CutKeyframes::handle_event()
660 mwindow->cut_automation();
664 CopyKeyframes::CopyKeyframes(MWindow *mwindow)
665 : BC_MenuItem(_("Copy keyframes"), _("Shift-C"), 'C')
668 this->mwindow = mwindow;
671 int CopyKeyframes::handle_event()
673 mwindow->copy_automation();
677 PasteKeyframes::PasteKeyframes(MWindow *mwindow)
678 : BC_MenuItem(_("Paste keyframes"), _("Shift-V"), 'V')
681 this->mwindow = mwindow;
684 int PasteKeyframes::handle_event()
686 mwindow->paste_automation();
690 ClearKeyframes::ClearKeyframes(MWindow *mwindow)
691 : BC_MenuItem(_("Clear keyframes"), _("Shift-Del"), DELETE)
694 this->mwindow = mwindow;
697 int ClearKeyframes::handle_event()
699 mwindow->clear_automation();
705 StraightenKeyframes::StraightenKeyframes(MWindow *mwindow)
706 : BC_MenuItem(_("Change to linear"))
708 this->mwindow = mwindow;
711 int StraightenKeyframes::handle_event()
713 mwindow->set_automation_mode(FloatAuto::LINEAR);
720 BendKeyframes::BendKeyframes(MWindow *mwindow)
721 : BC_MenuItem(_("Change to smooth"))
723 this->mwindow = mwindow;
726 int BendKeyframes::handle_event()
728 mwindow->set_automation_mode(FloatAuto::SMOOTH);
734 KeyframeCurveType::KeyframeCurveType(MWindow *mwindow)
735 : BC_MenuItem(_("Create curve type..."))
737 this->mwindow = mwindow;
738 this->curve_menu = 0;
740 KeyframeCurveType::~KeyframeCurveType()
744 void KeyframeCurveType::create_objects()
746 add_submenu(curve_menu = new KeyframeCurveTypeMenu(this));
747 for( int i=FloatAuto::SMOOTH; i<=FloatAuto::FREE; ++i ) {
748 KeyframeCurveTypeItem *curve_type_item = new KeyframeCurveTypeItem(i, this);
749 curve_menu->add_submenuitem(curve_type_item);
753 void KeyframeCurveType::update(int curve_type)
755 for( int i=0; i<curve_menu->total_items(); ++i ) {
756 KeyframeCurveTypeItem *curve_type_item = (KeyframeCurveTypeItem *)curve_menu->get_item(i);
757 curve_type_item->set_checked(curve_type_item->type == curve_type);
761 int KeyframeCurveType::handle_event()
766 KeyframeCurveTypeMenu::KeyframeCurveTypeMenu(KeyframeCurveType *menu_item)
769 this->menu_item = menu_item;
771 KeyframeCurveTypeMenu::~KeyframeCurveTypeMenu()
775 KeyframeCurveTypeItem::KeyframeCurveTypeItem(int type, KeyframeCurveType *main_item)
776 : BC_MenuItem(FloatAuto::curve_name(type))
779 this->main_item = main_item;
781 KeyframeCurveTypeItem::~KeyframeCurveTypeItem()
785 int KeyframeCurveTypeItem::handle_event()
787 main_item->update(type);
788 main_item->mwindow->set_keyframe_type(type);
793 CutDefaultKeyframe::CutDefaultKeyframe(MWindow *mwindow)
794 : BC_MenuItem(_("Cut default keyframe"), _("Alt-X"), 'X')
797 this->mwindow = mwindow;
800 int CutDefaultKeyframe::handle_event()
802 mwindow->cut_default_keyframe();
806 CopyDefaultKeyframe::CopyDefaultKeyframe(MWindow *mwindow)
807 : BC_MenuItem(_("Copy default keyframe"), _("Alt-c"), 'c')
810 this->mwindow = mwindow;
813 int CopyDefaultKeyframe::handle_event()
815 mwindow->copy_default_keyframe();
819 PasteDefaultKeyframe::PasteDefaultKeyframe(MWindow *mwindow)
820 : BC_MenuItem(_("Paste default keyframe"), _("Alt-v"), 'v')
823 this->mwindow = mwindow;
826 int PasteDefaultKeyframe::handle_event()
828 mwindow->paste_default_keyframe();
832 ClearDefaultKeyframe::ClearDefaultKeyframe(MWindow *mwindow)
833 : BC_MenuItem(_("Clear default keyframe"), _("Alt-Del"), DELETE)
836 this->mwindow = mwindow;
839 int ClearDefaultKeyframe::handle_event()
841 mwindow->clear_default_keyframe();
845 Cut::Cut(MWindow *mwindow)
846 : BC_MenuItem(_("Cut"), "x", 'x')
848 this->mwindow = mwindow;
851 int Cut::handle_event()
857 Copy::Copy(MWindow *mwindow)
858 : BC_MenuItem(_("Copy"), "c", 'c')
860 this->mwindow = mwindow;
863 int Copy::handle_event()
869 Paste::Paste(MWindow *mwindow)
870 : BC_MenuItem(_("Paste"), "v", 'v')
872 this->mwindow = mwindow;
875 int Paste::handle_event()
881 Clear::Clear(MWindow *mwindow)
882 : BC_MenuItem(_("Clear"), _("Del"), DELETE)
884 this->mwindow = mwindow;
887 int Clear::handle_event()
889 mwindow->cwindow->gui->lock_window("Clear::handle_event");
890 mwindow->clear_entry();
891 mwindow->cwindow->gui->unlock_window();
895 PasteSilence::PasteSilence(MWindow *mwindow)
896 : BC_MenuItem(_("Paste silence"), _("Shift-Space"), ' ')
898 this->mwindow = mwindow;
902 int PasteSilence::handle_event()
904 mwindow->paste_silence();
908 SelectAll::SelectAll(MWindow *mwindow)
909 : BC_MenuItem(_("Select All"), "a", 'a')
911 this->mwindow = mwindow;
914 int SelectAll::handle_event()
916 mwindow->select_all();
920 ClearLabels::ClearLabels(MWindow *mwindow) : BC_MenuItem(_("Clear labels"))
922 this->mwindow = mwindow;
925 int ClearLabels::handle_event()
927 mwindow->clear_labels();
931 CutCommercials::CutCommercials(MWindow *mwindow) : BC_MenuItem(_("Cut ads"))
933 this->mwindow = mwindow;
936 int CutCommercials::handle_event()
938 mwindow->cut_commercials();
942 DetachTransitions::DetachTransitions(MWindow *mwindow)
943 : BC_MenuItem(_("Detach transitions"))
945 this->mwindow = mwindow;
948 int DetachTransitions::handle_event()
950 mwindow->detach_transitions();
954 MuteSelection::MuteSelection(MWindow *mwindow)
955 : BC_MenuItem(_("Mute Region"), "m", 'm')
957 this->mwindow = mwindow;
960 int MuteSelection::handle_event()
962 mwindow->mute_selection();
967 TrimSelection::TrimSelection(MWindow *mwindow)
968 : BC_MenuItem(_("Trim Selection"))
970 this->mwindow = mwindow;
973 int TrimSelection::handle_event()
975 mwindow->trim_selection();
990 // ============================================= audio
992 AddAudioTrack::AddAudioTrack(MWindow *mwindow)
993 : BC_MenuItem(_("Add track"), "t", 't')
995 this->mwindow = mwindow;
998 int AddAudioTrack::handle_event()
1000 mwindow->add_audio_track_entry(0, 0);
1004 DeleteAudioTrack::DeleteAudioTrack(MWindow *mwindow)
1005 : BC_MenuItem(_("Delete track"))
1007 this->mwindow = mwindow;
1010 int DeleteAudioTrack::handle_event()
1015 DefaultATransition::DefaultATransition(MWindow *mwindow)
1016 : BC_MenuItem(_("Default Transition"), "u", 'u')
1018 this->mwindow = mwindow;
1021 int DefaultATransition::handle_event()
1023 mwindow->paste_audio_transition();
1028 MapAudio1::MapAudio1(MWindow *mwindow)
1029 : BC_MenuItem(_("Map 1:1"))
1031 this->mwindow = mwindow;
1034 int MapAudio1::handle_event()
1036 mwindow->map_audio(MWindow::AUDIO_1_TO_1);
1040 MapAudio2::MapAudio2(MWindow *mwindow)
1041 : BC_MenuItem(_("Map 5.1:2"))
1043 this->mwindow = mwindow;
1046 int MapAudio2::handle_event()
1048 mwindow->map_audio(MWindow::AUDIO_5_1_TO_2);
1055 // ============================================= video
1058 AddVideoTrack::AddVideoTrack(MWindow *mwindow)
1059 : BC_MenuItem(_("Add track"), _("Shift-T"), 'T')
1062 this->mwindow = mwindow;
1065 int AddVideoTrack::handle_event()
1067 mwindow->add_video_track_entry();
1072 DeleteVideoTrack::DeleteVideoTrack(MWindow *mwindow)
1073 : BC_MenuItem(_("Delete track"))
1075 this->mwindow = mwindow;
1078 int DeleteVideoTrack::handle_event()
1085 ResetTranslation::ResetTranslation(MWindow *mwindow)
1086 : BC_MenuItem(_("Reset Translation"))
1088 this->mwindow = mwindow;
1091 int ResetTranslation::handle_event()
1098 DefaultVTransition::DefaultVTransition(MWindow *mwindow)
1099 : BC_MenuItem(_("Default Transition"), _("Shift-U"), 'U')
1102 this->mwindow = mwindow;
1105 int DefaultVTransition::handle_event()
1107 mwindow->paste_video_transition();
1124 // ============================================ settings
1126 DeleteTracks::DeleteTracks(MWindow *mwindow)
1127 : BC_MenuItem(_("Delete tracks"))
1129 this->mwindow = mwindow;
1132 int DeleteTracks::handle_event()
1134 mwindow->delete_tracks();
1138 DeleteTrack::DeleteTrack(MWindow *mwindow)
1139 : BC_MenuItem(_("Delete last track"), "d", 'd')
1141 this->mwindow = mwindow;
1144 int DeleteTrack::handle_event()
1146 mwindow->delete_track();
1150 MoveTracksUp::MoveTracksUp(MWindow *mwindow)
1151 : BC_MenuItem(_("Move tracks up"), _("Shift-Up"), UP)
1153 set_shift(); this->mwindow = mwindow;
1156 int MoveTracksUp::handle_event()
1158 mwindow->move_tracks_up();
1162 MoveTracksDown::MoveTracksDown(MWindow *mwindow)
1163 : BC_MenuItem(_("Move tracks down"), _("Shift-Down"), DOWN)
1165 set_shift(); this->mwindow = mwindow;
1168 int MoveTracksDown::handle_event()
1170 mwindow->move_tracks_down();
1177 ConcatenateTracks::ConcatenateTracks(MWindow *mwindow)
1178 : BC_MenuItem(_("Concatenate tracks"))
1181 this->mwindow = mwindow;
1184 int ConcatenateTracks::handle_event()
1186 mwindow->concatenate_tracks();
1194 LoopPlayback::LoopPlayback(MWindow *mwindow)
1195 : BC_MenuItem(_("Loop Playback"), _("Shift-L"), 'L')
1197 this->mwindow = mwindow;
1198 set_checked(mwindow->edl->local_session->loop_playback);
1202 int LoopPlayback::handle_event()
1204 mwindow->toggle_loop_playback();
1205 set_checked(mwindow->edl->local_session->loop_playback);
1211 // ============================================= subtitle
1214 AddSubttlTrack::AddSubttlTrack(MWindow *mwindow)
1215 : BC_MenuItem(_("Add subttl"), _("Shift-Y"), 'Y')
1218 this->mwindow = mwindow;
1221 int AddSubttlTrack::handle_event()
1223 mwindow->add_subttl_track_entry();
1227 PasteSubttl::PasteSubttl(MWindow *mwindow)
1228 : BC_MenuItem(_("paste subttl"), "y", 'y')
1230 this->mwindow = mwindow;
1233 int PasteSubttl::handle_event()
1235 mwindow->gui->swindow->paste_subttl();
1244 SetBRenderRange::SetBRenderRange(MWindow *mwindow)
1245 : BC_MenuItem(_("Set background rendering"))
1247 this->mwindow = mwindow;
1250 int SetBRenderRange::handle_event()
1252 mwindow->set_brender_range();
1262 LabelsFollowEdits::LabelsFollowEdits(MWindow *mwindow)
1263 : BC_MenuItem(_("Edit labels"))
1265 this->mwindow = mwindow;
1266 set_checked(mwindow->edl->session->labels_follow_edits);
1269 int LabelsFollowEdits::handle_event()
1271 set_checked(get_checked() ^ 1);
1272 mwindow->set_labels_follow_edits(get_checked());
1279 PluginsFollowEdits::PluginsFollowEdits(MWindow *mwindow)
1280 : BC_MenuItem(_("Edit effects"))
1282 this->mwindow = mwindow;
1283 set_checked(mwindow->edl->session->plugins_follow_edits);
1286 int PluginsFollowEdits::handle_event()
1288 set_checked(get_checked() ^ 1);
1289 mwindow->edl->session->plugins_follow_edits = get_checked();
1296 KeyframesFollowEdits::KeyframesFollowEdits(MWindow *mwindow)
1297 : BC_MenuItem(_("Keyframes follow edits"))
1299 this->mwindow = mwindow;
1300 set_checked(mwindow->edl->session->autos_follow_edits);
1303 int KeyframesFollowEdits::handle_event()
1305 mwindow->edl->session->autos_follow_edits ^= 1;
1306 set_checked(!get_checked());
1311 CursorOnFrames::CursorOnFrames(MWindow *mwindow)
1312 : BC_MenuItem(_("Align cursor on frames"))
1314 this->mwindow = mwindow;
1315 set_checked(mwindow->edl->session->cursor_on_frames);
1318 int CursorOnFrames::handle_event()
1320 mwindow->edl->session->cursor_on_frames = !mwindow->edl->session->cursor_on_frames;
1321 set_checked(mwindow->edl->session->cursor_on_frames);
1326 TypelessKeyframes::TypelessKeyframes(MWindow *mwindow)
1327 : BC_MenuItem(_("Typeless keyframes"))
1329 this->mwindow = mwindow;
1330 set_checked(mwindow->edl->session->typeless_keyframes);
1333 int TypelessKeyframes::handle_event()
1335 mwindow->edl->session->typeless_keyframes = !mwindow->edl->session->typeless_keyframes;
1336 set_checked(mwindow->edl->session->typeless_keyframes);
1341 ScrubSpeed::ScrubSpeed(MWindow *mwindow) : BC_MenuItem(_("Slow Shuttle"))
1343 this->mwindow = mwindow;
1346 int ScrubSpeed::handle_event()
1348 if(mwindow->edl->session->scrub_speed == .5)
1350 mwindow->edl->session->scrub_speed = 2;
1351 set_text(_("Slow Shuttle"));
1355 mwindow->edl->session->scrub_speed = .5;
1356 set_text(_("Fast Shuttle"));
1361 SaveSettingsNow::SaveSettingsNow(MWindow *mwindow) : BC_MenuItem(_("Save settings now"))
1363 this->mwindow = mwindow;
1366 int SaveSettingsNow::handle_event()
1368 mwindow->save_defaults();
1369 mwindow->save_backup();
1370 mwindow->gui->show_message(_("Saved settings."));
1376 // ============================================ window
1382 ShowVWindow::ShowVWindow(MWindow *mwindow)
1383 : BC_MenuItem(_("Show Viewer"))
1385 this->mwindow = mwindow;
1386 set_checked(mwindow->session->show_vwindow);
1388 int ShowVWindow::handle_event()
1390 mwindow->show_vwindow();
1394 ShowAWindow::ShowAWindow(MWindow *mwindow)
1395 : BC_MenuItem(_("Show Resources"))
1397 this->mwindow = mwindow;
1398 set_checked(mwindow->session->show_awindow);
1400 int ShowAWindow::handle_event()
1402 mwindow->show_awindow();
1406 ShowCWindow::ShowCWindow(MWindow *mwindow)
1407 : BC_MenuItem(_("Show Compositor"))
1409 this->mwindow = mwindow;
1410 set_checked(mwindow->session->show_cwindow);
1412 int ShowCWindow::handle_event()
1414 mwindow->show_cwindow();
1419 ShowGWindow::ShowGWindow(MWindow *mwindow)
1420 : BC_MenuItem(_("Show Overlays"), _("Ctrl-0"), '0')
1422 this->mwindow = mwindow;
1424 set_checked(mwindow->session->show_gwindow);
1426 int ShowGWindow::handle_event()
1428 if( !mwindow->session->show_gwindow )
1429 mwindow->show_gwindow();
1431 mwindow->hide_gwindow();
1432 set_checked(mwindow->session->show_gwindow);
1437 ShowLWindow::ShowLWindow(MWindow *mwindow)
1438 : BC_MenuItem(_("Show Levels"))
1440 this->mwindow = mwindow;
1441 set_checked(mwindow->session->show_lwindow);
1443 int ShowLWindow::handle_event()
1445 mwindow->show_lwindow();
1449 TileWindows::TileWindows(MWindow *mwindow, const char *item_title, int config,
1450 const char *hot_keytext, int hot_key)
1451 : BC_MenuItem(item_title, hot_keytext, hot_key)
1453 this->mwindow = mwindow;
1454 this->config = config;
1455 if( hot_key ) set_ctrl(1);
1457 int TileWindows::handle_event()
1459 int window_config = config >= 0 ? config :
1460 mwindow->session->window_config;
1461 if( mwindow->tile_windows(window_config) ) {
1462 mwindow->restart_status = 1;
1463 mwindow->gui->set_done(0);
1468 SplitX::SplitX(MWindow *mwindow)
1469 : BC_MenuItem(_("Split X pane"), _("Ctrl-1"), '1')
1471 this->mwindow = mwindow;
1473 set_checked(mwindow->gui->pane[TOP_RIGHT_PANE] != 0);
1475 int SplitX::handle_event()
1481 SplitY::SplitY(MWindow *mwindow)
1482 : BC_MenuItem(_("Split Y pane"), _("Ctrl-2"), '2')
1484 this->mwindow = mwindow;
1486 set_checked(mwindow->gui->pane[BOTTOM_LEFT_PANE] != 0);
1488 int SplitY::handle_event()