r1009: Move the dependencies to newer package names
[cinelerra_cv/mob.git] / cinelerra / mainmenu.C
blob00cc1a26238d8d19256d692f04df84e41fa06365
1 #include "assets.h"
2 #include "batchrender.h"
3 #include "bcsignals.h"
4 #include "cache.h"
5 #include "cplayback.h"
6 #include "cropvideo.h"
7 #include "cwindow.h"
8 #include "cwindowgui.h"
9 #include "bchash.h"
10 #include "edl.h"
11 #include "edlsession.h"
12 #include "featheredits.h"
13 #include "filesystem.h"
14 #include "filexml.h"
15 #include "keys.h"
16 #include "language.h"
17 #include "levelwindow.h"
18 #include "loadfile.h"
19 #include "localsession.h"
20 #include "mainclock.h"
21 #include "mainmenu.h"
22 #include "mainsession.h"
23 #include "mainundo.h"
24 #include "menuaeffects.h"
25 #include "menuveffects.h"
26 #include "mwindowgui.h"
27 #include "mwindow.h"
28 #include "new.h"
29 #include "patchbay.h"
30 #include "playbackengine.h"
31 #include "preferences.h"
32 #include "preferencesthread.h"
33 #include "quit.h"
34 #include "record.h"
35 #include "render.h"
36 #include "savefile.h"
37 #include "setformat.h"
38 #include "timebar.h"
39 #include "trackcanvas.h"
40 #include "tracks.h"
41 #include "transition.h"
42 #include "transportque.h"
43 #include "viewmenu.h"
44 #include "zoombar.h"
45 #include "exportedl.h"
47 #include <string.h>
50 MainMenu::MainMenu(MWindow *mwindow, MWindowGUI *gui)
51  : BC_MenuBar(0, 0, gui->get_w())
53         this->gui = gui;
54         this->mwindow = mwindow; 
57 MainMenu::~MainMenu()
61 int MainMenu::create_objects()
63         BC_Menu *viewmenu, *windowmenu, *settingsmenu, *trackmenu;
64         PreferencesMenuitem *preferences;
66         recent_load = new BC_RecentList("PATH", mwindow->defaults);
67 SET_TRACE
69         add_menu(filemenu = new BC_Menu(_("File")));
70         filemenu->add_item(new_project = new New(mwindow));
71         new_project->create_objects();
73 SET_TRACE
74 // file loaders
75         filemenu->add_item(load_file = new Load(mwindow, this));
76         load_file->create_objects();
78 SET_TRACE
79 // new and load can be undone so no need to prompt save
80         Save *save;                   //  affected by saveas
81         filemenu->add_item(save = new Save(mwindow));
82         SaveAs *saveas;
83         filemenu->add_item(saveas = new SaveAs(mwindow));
84         save->create_objects(saveas);
85         saveas->set_mainmenu(this);
86         filemenu->add_item(record = new RecordMenuItem(mwindow));
88         filemenu->add_item(render = new RenderItem(mwindow));
89         filemenu->add_item(new ExportEDLItem(mwindow));
90         filemenu->add_item(new BatchRenderMenuItem(mwindow));
91         filemenu->add_item(new BC_MenuItem("-"));
92         filemenu->add_item(quit_program = new Quit(mwindow));
93         quit_program->create_objects(save);
94         filemenu->add_item(new DumpEDL(mwindow));
95         filemenu->add_item(new DumpPlugins(mwindow));
96         filemenu->add_item(new LoadBackup(mwindow));
97         filemenu->add_item(new SaveBackup(mwindow));
99         BC_Menu *editmenu;
100         add_menu(editmenu = new BC_Menu(_("Edit")));
101         editmenu->add_item(undo = new Undo(mwindow));
102         editmenu->add_item(redo = new Redo(mwindow));
103         editmenu->add_item(new BC_MenuItem("-"));
104         editmenu->add_item(new Cut(mwindow));
105         editmenu->add_item(new Copy(mwindow));
106         editmenu->add_item(new Paste(mwindow));
107         editmenu->add_item(new Clear(mwindow));
108         editmenu->add_item(new PasteSilence(mwindow));
109         editmenu->add_item(new MuteSelection(mwindow));
110         editmenu->add_item(new TrimSelection(mwindow));
111         editmenu->add_item(new SelectAll(mwindow));
112         editmenu->add_item(new BC_MenuItem("-"));
113         editmenu->add_item(new ClearLabels(mwindow));
115         BC_Menu *keyframemenu;
116         add_menu(keyframemenu = new BC_Menu(_("Keyframes")));
117         keyframemenu->add_item(new CutKeyframes(mwindow));
118         keyframemenu->add_item(new CopyKeyframes(mwindow));
119         keyframemenu->add_item(new PasteKeyframes(mwindow));
120         keyframemenu->add_item(new ClearKeyframes(mwindow));
121         keyframemenu->add_item(new StraightenKeyframes(mwindow));
122         keyframemenu->add_item(new BC_MenuItem("-"));
123         keyframemenu->add_item(new CopyDefaultKeyframe(mwindow));
124         keyframemenu->add_item(new PasteDefaultKeyframe(mwindow));
129         add_menu(audiomenu = new BC_Menu(_("Audio")));
130         audiomenu->add_item(new AddAudioTrack(mwindow));
131         audiomenu->add_item(new DefaultATransition(mwindow));
132         audiomenu->add_item(new MapAudio1(mwindow));
133         audiomenu->add_item(new MapAudio2(mwindow));
134         audiomenu->add_item(aeffects = new MenuAEffects(mwindow));
136         add_menu(videomenu = new BC_Menu(_("Video")));
137         videomenu->add_item(new AddVideoTrack(mwindow));
138         videomenu->add_item(new DefaultVTransition(mwindow));
139         videomenu->add_item(veffects = new MenuVEffects(mwindow));
141         add_menu(trackmenu = new BC_Menu(_("Tracks")));
142         trackmenu->add_item(new MoveTracksUp(mwindow));
143         trackmenu->add_item(new MoveTracksDown(mwindow));
144         trackmenu->add_item(new DeleteTracks(mwindow));
145         trackmenu->add_item(new DeleteTrack(mwindow));
146         trackmenu->add_item(new ConcatenateTracks(mwindow));
148         add_menu(settingsmenu = new BC_Menu(_("Settings")));
150         settingsmenu->add_item(new SetFormat(mwindow));
151         settingsmenu->add_item(preferences = new PreferencesMenuitem(mwindow));
152         mwindow->preferences_thread = preferences->thread;
153         settingsmenu->add_item(labels_follow_edits = new LabelsFollowEdits(mwindow));
154         settingsmenu->add_item(plugins_follow_edits = new PluginsFollowEdits(mwindow));
155         settingsmenu->add_item(cursor_on_frames = new CursorOnFrames(mwindow));
156         settingsmenu->add_item(new SaveSettingsNow(mwindow));
157         settingsmenu->add_item(loop_playback = new LoopPlayback(mwindow));
158         settingsmenu->add_item(new SetBRenderStart(mwindow));
159 // set scrubbing speed
160 //      ScrubSpeed *scrub_speed;
161 //      settingsmenu->add_item(scrub_speed = new ScrubSpeed(mwindow));
162 //      if(mwindow->edl->session->scrub_speed == .5) 
163 //              scrub_speed->set_text(_("Fast Shuttle"));
170         add_menu(viewmenu = new BC_Menu(_("View")));
171         viewmenu->add_item(show_assets = new ShowAssets(mwindow, "0"));
172         viewmenu->add_item(show_titles = new ShowTitles(mwindow, "1"));
173         viewmenu->add_item(show_transitions = new ShowTransitions(mwindow, "2"));
174         viewmenu->add_item(fade_automation = new ShowAutomation(mwindow, _("Fade"), "3", AUTOMATION_FADE));
175         viewmenu->add_item(mute_automation = new ShowAutomation(mwindow, _("Mute"), "4", AUTOMATION_MUTE));
176         viewmenu->add_item(mode_automation = new ShowAutomation(mwindow, _("Mode"), "5", AUTOMATION_MODE));
177         viewmenu->add_item(pan_automation = new ShowAutomation(mwindow, _("Pan"), "6", AUTOMATION_PAN));
178         viewmenu->add_item(plugin_automation = new PluginAutomation(mwindow, "7"));
179         viewmenu->add_item(mask_automation = new ShowAutomation(mwindow, _("Mask"), "8", AUTOMATION_MASK));
180         viewmenu->add_item(camera_x = new ShowAutomation(mwindow, _("Camera X"), "", AUTOMATION_CAMERA_X));
181         viewmenu->add_item(camera_y = new ShowAutomation(mwindow, _("Camera Y"), "", AUTOMATION_CAMERA_Y));
182         viewmenu->add_item(camera_z = new ShowAutomation(mwindow, _("Camera Z"), "", AUTOMATION_CAMERA_Z));
183         viewmenu->add_item(project_x = new ShowAutomation(mwindow, _("Projector X"), "", AUTOMATION_PROJECTOR_X));
184         viewmenu->add_item(project_y = new ShowAutomation(mwindow, _("Projector Y"), "", AUTOMATION_PROJECTOR_Y));
185         viewmenu->add_item(project_z = new ShowAutomation(mwindow, _("Projector Z"), "", AUTOMATION_PROJECTOR_Z));
188         add_menu(windowmenu = new BC_Menu(_("Window")));
189         windowmenu->add_item(show_vwindow = new ShowVWindow(mwindow));
190         windowmenu->add_item(show_awindow = new ShowAWindow(mwindow));
191         windowmenu->add_item(show_cwindow = new ShowCWindow(mwindow));
192         windowmenu->add_item(show_gwindow = new ShowGWindow(mwindow));
193         windowmenu->add_item(show_lwindow = new ShowLWindow(mwindow));
194         windowmenu->add_item(new TileWindows(mwindow));
196 SET_TRACE
197         return 0;
200 int MainMenu::load_defaults(BC_Hash *defaults)
202         init_loads(defaults);
203         init_aeffects(defaults);
204         init_veffects(defaults);
205         return 0;
208 void MainMenu::update_toggles(int use_lock)
210         if(use_lock) lock_window("MainMenu::update_toggles");
211         labels_follow_edits->set_checked(mwindow->edl->session->labels_follow_edits);
212         plugins_follow_edits->set_checked(mwindow->edl->session->plugins_follow_edits);
213         cursor_on_frames->set_checked(mwindow->edl->session->cursor_on_frames);
214         loop_playback->set_checked(mwindow->edl->local_session->loop_playback);
215         show_titles->set_checked(mwindow->edl->session->show_titles);
216         show_transitions->set_checked(mwindow->edl->session->auto_conf->transitions);
217         fade_automation->update_toggle();
218         mute_automation->update_toggle();
219         pan_automation->update_toggle();
220         camera_x->update_toggle();
221         camera_y->update_toggle();
222         camera_z->update_toggle();
223         project_x->update_toggle();
224         project_y->update_toggle();
225         project_z->update_toggle();
226         plugin_automation->set_checked(mwindow->edl->session->auto_conf->plugins);
227         mode_automation->update_toggle();
228         mask_automation->update_toggle();
229         if(use_lock) mwindow->gui->unlock_window();
232 int MainMenu::save_defaults(BC_Hash *defaults)
234         save_aeffects(defaults);
235         save_veffects(defaults);
236         return 0;
243 int MainMenu::quit()
245         quit_program->handle_event();
246         return 0;
253 // ================================== load most recent
255 int MainMenu::init_aeffects(BC_Hash *defaults)
257         total_aeffects = defaults->get("TOTAL_AEFFECTS", 0);
258         
259         char string[1024], title[1024];
260         if(total_aeffects) audiomenu->add_item(new BC_MenuItem("-"));
261         
262         for(int i = 0; i < total_aeffects; i++)
263         {
264                 sprintf(string, "AEFFECTRECENT%d", i);
265                 defaults->get(string, title);
266                 audiomenu->add_item(aeffect[i] = new MenuAEffectItem(aeffects, title));
267         }
268         return 0;
271 int MainMenu::init_veffects(BC_Hash *defaults)
273         total_veffects = defaults->get("TOTAL_VEFFECTS", 0);
274         
275         char string[1024], title[1024];
276         if(total_veffects) videomenu->add_item(new BC_MenuItem("-"));
277         
278         for(int i = 0; i < total_veffects; i++)
279         {
280                 sprintf(string, "VEFFECTRECENT%d", i);
281                 defaults->get(string, title);
282                 videomenu->add_item(veffect[i] = new MenuVEffectItem(veffects, title));
283         }
284         return 0;
287 int MainMenu::init_loads(BC_Hash *defaults)
289 //printf("MainMenu::init_loads 1\n");
290 //printf("MainMenu::init_loads 1\n");
291         char string[BCTEXTLEN], path[BCTEXTLEN], filename[BCTEXTLEN];
292 //printf("MainMenu::init_loads 1\n");
293         FileSystem dir;
294         
295         recent_load->load_items();
297         int total_loads = recent_load->items.total;
298 //printf("MainMenu::init_loads 2\n");
299         if(total_loads > 0) filemenu->add_item(new BC_MenuItem("-"));
301         for(int i = 0; i < total_loads; i++)
302         {
303                 char *path = recent_load->items.values[i]->get_text();
305                 filemenu->add_item(load[i] = new LoadPrevious(mwindow));
306 //printf("MainMenu::init_loads 5\n");
307                 dir.extract_name(filename, path, 0);
308 //printf("MainMenu::init_loads 6\n");
309                 load[i]->set_text(filename);
310 //printf("MainMenu::init_loads 7\n");
311                 load[i]->set_path(path);
312 //printf("MainMenu::init_loads 8\n");
313         }
314 //printf("MainMenu::init_loads 9\n");
315         return 0;
318 // ============================ save most recent
320 int MainMenu::save_aeffects(BC_Hash *defaults)
322         defaults->update("TOTAL_AEFFECTS", total_aeffects);
323         char string[1024];
324         for(int i = 0; i < total_aeffects; i++)
325         {
326                 sprintf(string, "AEFFECTRECENT%d", i);
327                 defaults->update(string, aeffect[i]->get_text());
328         }
329         return 0;
332 int MainMenu::save_veffects(BC_Hash *defaults)
334         defaults->update("TOTAL_VEFFECTS", total_veffects);
335         char string[1024];
336         for(int i = 0; i < total_veffects; i++)
337         {
338                 sprintf(string, "VEFFECTRECENT%d", i);
339                 defaults->update(string, veffect[i]->get_text());
340         }
341         return 0;
344 // =================================== add most recent
346 int MainMenu::add_aeffect(char *title)
348 // add bar for first effect
349         if(total_aeffects == 0)
350         {
351                 audiomenu->add_item(new BC_MenuItem("-"));
352         }
354 // test for existing copy of effect
355         for(int i = 0; i < total_aeffects; i++)
356         {
357                 if(!strcmp(aeffect[i]->get_text(), title))     // already exists
358                 {                                // swap for top effect
359                         for(int j = i; j > 0; j--)   // move preceeding effects down
360                         {
361                                 aeffect[j]->set_text(aeffect[j - 1]->get_text());
362                         }
363                         aeffect[0]->set_text(title);
364                         return 1;
365                 }
366         }
368 // add another blank effect
369         if(total_aeffects < TOTAL_EFFECTS)
370         {
371                 audiomenu->add_item(aeffect[total_aeffects] = new MenuAEffectItem(aeffects, ""));
372                 total_aeffects++;
373         }
375 // cycle effect down
376         for(int i = total_aeffects - 1; i > 0; i--)
377         {
378         // set menu item text
379                 aeffect[i]->set_text(aeffect[i - 1]->get_text());
380         }
382 // set up the new effect
383         aeffect[0]->set_text(title);
384         return 0;
387 int MainMenu::add_veffect(char *title)
389 // add bar for first effect
390         if(total_veffects == 0)
391         {
392                 videomenu->add_item(new BC_MenuItem("-"));
393         }
395 // test for existing copy of effect
396         for(int i = 0; i < total_veffects; i++)
397         {
398                 if(!strcmp(veffect[i]->get_text(), title))     // already exists
399                 {                                // swap for top effect
400                         for(int j = i; j > 0; j--)   // move preceeding effects down
401                         {
402                                 veffect[j]->set_text(veffect[j - 1]->get_text());
403                         }
404                         veffect[0]->set_text(title);
405                         return 1;
406                 }
407         }
409 // add another blank effect
410         if(total_veffects < TOTAL_EFFECTS)
411         {
412                 videomenu->add_item(veffect[total_veffects] = new MenuVEffectItem(veffects, ""));
413                 total_veffects++;
414         }
416 // cycle effect down
417         for(int i = total_veffects - 1; i > 0; i--)
418         {
419 // set menu item text
420                 veffect[i]->set_text(veffect[i - 1]->get_text());
421         }
423 // set up the new effect
424         veffect[0]->set_text(title);
425         return 0;
428 int MainMenu::add_load(char *new_path)
430         char filename[BCTEXTLEN];
431         FileSystem dir;
433         int total_loads = recent_load->items.total;
435         if(total_loads == 0)
436         {
437                 filemenu->add_item(new BC_MenuItem("-"));
438         }
440         int new_total = recent_load->add_item(NULL, new_path);
442         if (new_total > total_loads) {
443                 // just create a new item if there is room for it
444                 int i = new_total - 1;
445                 load[i] = new LoadPrevious(mwindow);
446                 dir.extract_name(filename, new_path, 0);
447                 load[i]->set_text(filename);
448                 load[i]->set_path(new_path);
449                 filemenu->add_item(load[i]);
450         }
452         // reassign the paths to adjust for the shift down
453         for(int i = 0; i < new_total; i++) {
454                 char *path = recent_load->items.values[i]->get_text();
455                 dir.extract_name(filename, path, 0);
456                 load[i]->set_text(filename);
457                 load[i]->set_path(path);
458         }
460         return 0;
470 // ================================== menu items
473 DumpCICache::DumpCICache(MWindow *mwindow)
474  : BC_MenuItem(_("Dump CICache"))
475 { this->mwindow = mwindow; }
477 int DumpCICache::handle_event()
479 //      mwindow->cache->dump();
482 DumpEDL::DumpEDL(MWindow *mwindow)
483  : BC_MenuItem(_("Dump EDL"))
485         this->mwindow = mwindow;
488 int DumpEDL::handle_event()
490 //printf("DumpEDL::handle_event 1\n");
491         mwindow->edl->dump();
492 //printf("DumpEDL::handle_event 2\n");
493         return 1;
496 DumpPlugins::DumpPlugins(MWindow *mwindow)
497  : BC_MenuItem(_("Dump Plugins"))
499         this->mwindow = mwindow;
502 int DumpPlugins::handle_event()
504 //printf("DumpEDL::handle_event 1\n");
505         mwindow->dump_plugins();
506 //printf("DumpEDL::handle_event 2\n");
507         return 1;
511 DumpAssets::DumpAssets(MWindow *mwindow)
512  : BC_MenuItem(_("Dump Assets"))
513 { this->mwindow = mwindow; }
515 int DumpAssets::handle_event()
517         mwindow->assets->dump();
520 // ================================================= edit
522 Undo::Undo(MWindow *mwindow) : BC_MenuItem(_("Undo"), "z", 'z') 
524         this->mwindow = mwindow; 
526 int Undo::handle_event()
528         mwindow->undo_entry(mwindow->gui);
529         return 1;
531 int Undo::update_caption(char *new_caption)
533         char string[1024];
534         sprintf(string, _("Undo %s"), new_caption);
535         set_text(string);
539 Redo::Redo(MWindow *mwindow) : BC_MenuItem(_("Redo"), "Shift+Z", 'Z') 
541         set_shift(1); 
542         this->mwindow = mwindow; 
545 int Redo::handle_event()
547         mwindow->redo_entry(mwindow->gui);
549         return 1;
551 int Redo::update_caption(char *new_caption)
553         char string[1024];
554         sprintf(string, _("Redo %s"), new_caption);
555         set_text(string);
558 CutKeyframes::CutKeyframes(MWindow *mwindow)
559  : BC_MenuItem(_("Cut keyframes"), "Shift-X", 'X')
561         set_shift(); 
562         this->mwindow = mwindow; 
565 int CutKeyframes::handle_event()
567         mwindow->cut_automation(); 
570 CopyKeyframes::CopyKeyframes(MWindow *mwindow)
571  : BC_MenuItem(_("Copy keyframes"), "Shift-C", 'C')
573         set_shift(); 
574         this->mwindow = mwindow; 
577 int CopyKeyframes::handle_event()
579         mwindow->copy_automation();
580         return 1;
583 PasteKeyframes::PasteKeyframes(MWindow *mwindow)
584  : BC_MenuItem(_("Paste keyframes"), "Shift-V", 'V')
586         set_shift(); 
587         this->mwindow = mwindow; 
590 int PasteKeyframes::handle_event()
592         mwindow->paste_automation(); 
595 ClearKeyframes::ClearKeyframes(MWindow *mwindow)
596  : BC_MenuItem(_("Clear keyframes"), "Shift-Del", DELETE)
598         set_shift(); 
599         this->mwindow = mwindow; 
602 int ClearKeyframes::handle_event()
604         mwindow->clear_automation();
605         return 1;
609 StraightenKeyframes::StraightenKeyframes(MWindow *mwindow)
610  : BC_MenuItem(_("Straighten curves"))
612         this->mwindow = mwindow; 
615 int StraightenKeyframes::handle_event()
617         mwindow->straighten_automation();
618         return 1;
628 CutDefaultKeyframe::CutDefaultKeyframe(MWindow *mwindow)
629  : BC_MenuItem(_("Cut default keyframe"), "Alt-X", 'X')
631         set_alt(); 
632         this->mwindow = mwindow; 
635 int CutDefaultKeyframe::handle_event()
637         mwindow->cut_default_keyframe(); 
638         return 1;
641 CopyDefaultKeyframe::CopyDefaultKeyframe(MWindow *mwindow)
642  : BC_MenuItem(_("Copy default keyframe"), "Alt-c", 'c')
644         set_alt(); 
645         this->mwindow = mwindow; 
648 int CopyDefaultKeyframe::handle_event()
650         mwindow->copy_default_keyframe();
651         return 1;
654 PasteDefaultKeyframe::PasteDefaultKeyframe(MWindow *mwindow)
655  : BC_MenuItem(_("Paste default keyframe"), "Alt-v", 'v')
657         set_alt(); 
658         this->mwindow = mwindow; 
661 int PasteDefaultKeyframe::handle_event()
663         mwindow->paste_default_keyframe(); 
664         return 1;
667 ClearDefaultKeyframe::ClearDefaultKeyframe(MWindow *mwindow)
668  : BC_MenuItem(_("Clear default keyframe"), "Alt-Del", DELETE)
670         set_alt(); 
671         this->mwindow = mwindow; 
674 int ClearDefaultKeyframe::handle_event()
676         mwindow->clear_default_keyframe();
677         return 1;
680 Cut::Cut(MWindow *mwindow)
681  : BC_MenuItem(_("Cut"), "x", 'x') 
683         this->mwindow = mwindow; 
686 int Cut::handle_event()
688         mwindow->cut();
689         return 1;
692 Copy::Copy(MWindow *mwindow)
693  : BC_MenuItem(_("Copy"), "c", 'c') 
695         this->mwindow = mwindow; 
698 int Copy::handle_event()
700         mwindow->copy();
701         return 1;
704 Paste::Paste(MWindow *mwindow)
705  : BC_MenuItem(_("Paste"), "v", 'v') 
707         this->mwindow = mwindow; 
710 int Paste::handle_event()
712         mwindow->paste();
713         return 1;
716 Clear::Clear(MWindow *mwindow)
717  : BC_MenuItem(_("Clear"), "Del", DELETE) 
719         this->mwindow = mwindow; 
722 int Clear::handle_event()
724         mwindow->cwindow->gui->lock_window("Clear::handle_event");
725         mwindow->clear_entry();
726         mwindow->cwindow->gui->unlock_window();
727         return 1;
730 PasteSilence::PasteSilence(MWindow *mwindow)
731  : BC_MenuItem(_("Paste silence"), "Shift+Space", ' ')
733         this->mwindow = mwindow; 
734         set_shift(); 
737 int PasteSilence::handle_event()
739         mwindow->paste_silence();
740         return 1;
743 SelectAll::SelectAll(MWindow *mwindow)
744  : BC_MenuItem(_("Select All"), "a", 'a')
746         this->mwindow = mwindow; 
749 int SelectAll::handle_event()
751         mwindow->select_all();
752         return 1;
755 ClearLabels::ClearLabels(MWindow *mwindow) : BC_MenuItem(_("Clear labels")) 
757         this->mwindow = mwindow; 
760 int ClearLabels::handle_event()
762         mwindow->clear_labels();
763         return 1;
766 MuteSelection::MuteSelection(MWindow *mwindow)
767  : BC_MenuItem(_("Mute Region"), "m", 'm')
769         this->mwindow = mwindow;
772 int MuteSelection::handle_event()
774         mwindow->mute_selection();
775         return 1;
779 TrimSelection::TrimSelection(MWindow *mwindow)
780  : BC_MenuItem(_("Trim Selection"))
782         this->mwindow = mwindow;
785 int TrimSelection::handle_event()
787         mwindow->trim_selection();
788         return 1;
802 // ============================================= audio
804 AddAudioTrack::AddAudioTrack(MWindow *mwindow)
805  : BC_MenuItem(_("Add track"), "t", 't')
807         this->mwindow = mwindow;
810 int AddAudioTrack::handle_event()
812         mwindow->add_audio_track_entry(0, 0);
813         return 1;
816 DeleteAudioTrack::DeleteAudioTrack(MWindow *mwindow)
817  : BC_MenuItem(_("Delete track"))
819         this->mwindow = mwindow;
822 int DeleteAudioTrack::handle_event()
824         return 1;
827 DefaultATransition::DefaultATransition(MWindow *mwindow)
828  : BC_MenuItem(_("Default Transition"), "u", 'u')
830         this->mwindow = mwindow;
833 int DefaultATransition::handle_event()
835         mwindow->paste_audio_transition();
836         return 1;
840 MapAudio1::MapAudio1(MWindow *mwindow)
841  : BC_MenuItem(_("Map 1:1"))
843         this->mwindow = mwindow;
846 int MapAudio1::handle_event()
848         mwindow->map_audio(MWindow::AUDIO_1_TO_1);
849         return 1;
852 MapAudio2::MapAudio2(MWindow *mwindow)
853  : BC_MenuItem(_("Map 5.1:2"))
855         this->mwindow = mwindow;
858 int MapAudio2::handle_event()
860         mwindow->map_audio(MWindow::AUDIO_5_1_TO_2);
861         return 1;
867 // ============================================= video
870 AddVideoTrack::AddVideoTrack(MWindow *mwindow)
871  : BC_MenuItem(_("Add track"), "Shift-T", 'T')
873         set_shift();
874         this->mwindow = mwindow;
877 int AddVideoTrack::handle_event()
879         mwindow->add_video_track_entry();
880         return 1;
884 DeleteVideoTrack::DeleteVideoTrack(MWindow *mwindow)
885  : BC_MenuItem(_("Delete track"))
887         this->mwindow = mwindow;
890 int DeleteVideoTrack::handle_event()
892         return 1;
897 ResetTranslation::ResetTranslation(MWindow *mwindow)
898  : BC_MenuItem(_("Reset Translation"))
900         this->mwindow = mwindow;
903 int ResetTranslation::handle_event()
905         return 1;
910 DefaultVTransition::DefaultVTransition(MWindow *mwindow)
911  : BC_MenuItem(_("Default Transition"), "Shift-U", 'U')
913         set_shift();
914         this->mwindow = mwindow;
917 int DefaultVTransition::handle_event()
919         mwindow->paste_video_transition();
920         return 1;
936 // ============================================ settings
938 DeleteTracks::DeleteTracks(MWindow *mwindow)
939  : BC_MenuItem(_("Delete tracks"))
941         this->mwindow = mwindow;
944 int DeleteTracks::handle_event()
946         mwindow->delete_tracks();
947         return 1;
950 DeleteTrack::DeleteTrack(MWindow *mwindow)
951  : BC_MenuItem(_("Delete last track"), "d", 'd')
953         this->mwindow = mwindow;
956 int DeleteTrack::handle_event()
958         mwindow->delete_track();
959         return 1;
962 MoveTracksUp::MoveTracksUp(MWindow *mwindow)
963  : BC_MenuItem(_("Move tracks up"))
965         set_shift(); this->mwindow = mwindow;
968 int MoveTracksUp::handle_event()
970         mwindow->move_tracks_up();
971         return 1;
974 MoveTracksDown::MoveTracksDown(MWindow *mwindow)
975  : BC_MenuItem(_("Move tracks down"))
977         set_shift(); this->mwindow = mwindow;
980 int MoveTracksDown::handle_event()
982         mwindow->move_tracks_down();
983         return 1;
989 ConcatenateTracks::ConcatenateTracks(MWindow *mwindow)
990  : BC_MenuItem(_("Concatenate tracks"))
992         set_shift(); 
993         this->mwindow = mwindow;
996 int ConcatenateTracks::handle_event()
998         mwindow->concatenate_tracks();
999         return 1;
1006 LoopPlayback::LoopPlayback(MWindow *mwindow)
1007  : BC_MenuItem(_("Loop Playback"), "Shift+L", 'L')
1009         this->mwindow = mwindow;
1010         set_checked(mwindow->edl->local_session->loop_playback);
1011         set_shift();
1014 int LoopPlayback::handle_event()
1016         mwindow->toggle_loop_playback();
1017         set_checked(mwindow->edl->local_session->loop_playback);
1018         return 1;
1025 SetBRenderStart::SetBRenderStart(MWindow *mwindow)
1026  : BC_MenuItem(_("Set background render"))
1028         this->mwindow = mwindow;
1031 int SetBRenderStart::handle_event()
1033         mwindow->set_brender_start();
1034         return 1;
1043 LabelsFollowEdits::LabelsFollowEdits(MWindow *mwindow)
1044  : BC_MenuItem(_("Edit labels")) 
1046         this->mwindow = mwindow; 
1047         set_checked(mwindow->edl->session->labels_follow_edits);
1050 int LabelsFollowEdits::handle_event()
1052         set_checked(get_checked() ^ 1);
1053         mwindow->set_labels_follow_edits(get_checked());
1059 PluginsFollowEdits::PluginsFollowEdits(MWindow *mwindow)
1060  : BC_MenuItem(_("Edit effects")) 
1062         this->mwindow = mwindow; 
1063         set_checked(mwindow->edl->session->plugins_follow_edits);
1066 int PluginsFollowEdits::handle_event()
1068         set_checked(get_checked() ^ 1);
1069         mwindow->edl->session->plugins_follow_edits = get_checked(); 
1075 AutosFollowEdits::AutosFollowEdits(MWindow *mwindow)
1076  : BC_MenuItem(_("Autos follow edits")) 
1078         this->mwindow = mwindow; 
1079         set_checked(mwindow->edl->session->autos_follow_edits);
1082 int AutosFollowEdits::handle_event()
1084         mwindow->edl->session->autos_follow_edits ^= 1; 
1085         set_checked(!get_checked());
1089 CursorOnFrames::CursorOnFrames(MWindow *mwindow)
1090  : BC_MenuItem(_("Align cursor on frames")) 
1092         this->mwindow = mwindow; 
1093         set_checked(mwindow->edl->session->cursor_on_frames);
1096 int CursorOnFrames::handle_event()
1098         mwindow->edl->session->cursor_on_frames = !mwindow->edl->session->cursor_on_frames; 
1099         set_checked(mwindow->edl->session->cursor_on_frames);
1103 ScrubSpeed::ScrubSpeed(MWindow *mwindow) : BC_MenuItem(_("Slow Shuttle"))
1105         this->mwindow = mwindow;
1108 int ScrubSpeed::handle_event()
1110         if(mwindow->edl->session->scrub_speed == .5)
1111         {
1112                 mwindow->edl->session->scrub_speed = 2;
1113                 set_text(_("Slow Shuttle"));
1114         }
1115         else
1116         {
1117                 mwindow->edl->session->scrub_speed = .5;
1118                 set_text(_("Fast Shuttle"));
1119         }
1122 SaveSettingsNow::SaveSettingsNow(MWindow *mwindow) : BC_MenuItem(_("Save settings now")) 
1124         this->mwindow = mwindow; 
1127 int SaveSettingsNow::handle_event()
1129         mwindow->save_defaults();
1130         mwindow->save_backup();
1131         mwindow->gui->show_message(_("Saved settings."));
1132         return 1;
1137 // ============================================ window
1143 ShowVWindow::ShowVWindow(MWindow *mwindow)
1144  : BC_MenuItem(_("Show Viewer"))
1146         this->mwindow = mwindow;
1147         set_checked(mwindow->session->show_vwindow);
1149 int ShowVWindow::handle_event()
1151         mwindow->show_vwindow();
1152         return 1;
1155 ShowAWindow::ShowAWindow(MWindow *mwindow)
1156  : BC_MenuItem(_("Show Resources"))
1158         this->mwindow = mwindow;
1159         set_checked(mwindow->session->show_awindow);
1161 int ShowAWindow::handle_event()
1163         mwindow->show_awindow();
1164         return 1;
1167 ShowCWindow::ShowCWindow(MWindow *mwindow)
1168  : BC_MenuItem(_("Show Compositor"))
1170         this->mwindow = mwindow;
1171         set_checked(mwindow->session->show_cwindow);
1173 int ShowCWindow::handle_event()
1175         mwindow->show_cwindow();
1176         return 1;
1180 ShowGWindow::ShowGWindow(MWindow *mwindow)
1181  : BC_MenuItem(_("Show Overlays"))
1183         this->mwindow = mwindow;
1184         set_checked(mwindow->session->show_gwindow);
1186 int ShowGWindow::handle_event()
1188         mwindow->show_gwindow();
1189         return 1;
1193 ShowLWindow::ShowLWindow(MWindow *mwindow)
1194  : BC_MenuItem(_("Show Levels"))
1196         this->mwindow = mwindow;
1197         set_checked(mwindow->session->show_lwindow);
1199 int ShowLWindow::handle_event()
1201         mwindow->show_lwindow();
1202         return 1;
1205 TileWindows::TileWindows(MWindow *mwindow)
1206  : BC_MenuItem(_("Default positions"))
1208         this->mwindow = mwindow;
1210 int TileWindows::handle_event()
1212         mwindow->tile_windows();
1213         return 1;