r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / mainmenu.C
blobf89c8e79610e5bcef3af485bbfc01ec23d441cb9
1 #include "assets.h"
2 #include "cache.h"
3 #include "cplayback.h"
4 #include "cropvideo.h"
5 #include "cwindow.h"
6 #include "cwindowgui.h"
7 #include "defaults.h"
8 #include "edl.h"
9 #include "edlsession.h"
10 #include "featheredits.h"
11 #include "filesystem.h"
12 #include "filexml.h"
13 #include "keys.h"
14 #include "levelwindow.h"
15 #include "loadfile.h"
16 #include "localsession.h"
17 #include "mainclock.h"
18 #include "mainmenu.h"
19 #include "mainsession.h"
20 #include "mainundo.h"
21 #include "menuaeffects.h"
22 #include "menuveffects.h"
23 #include "mwindowgui.h"
24 #include "mwindow.h"
25 #include "new.h"
26 #include "patchbay.h"
27 #include "playbackengine.h"
28 #include "preferences.h"
29 #include "preferencesthread.h"
30 #include "quit.h"
31 #include "record.h"
32 #include "render.h"
33 #include "savefile.h"
34 #include "setaudio.h"
35 #include "setformat.h"
36 #include "setvideo.h"
37 #include "timebar.h"
38 #include "trackcanvas.h"
39 #include "tracks.h"
40 #include "transition.h"
41 #include "transportque.h"
42 //#include "videowindowgui.h"
43 //#include "videowindow.h"
44 #include "viewmenu.h"
45 #include "zoombar.h"
47 #include <string.h>
49 #include <libintl.h>
50 #define _(String) gettext(String)
51 #define gettext_noop(String) String
52 #define N_(String) gettext_noop (String)
54 MainMenu::MainMenu(MWindow *mwindow, MWindowGUI *gui)
55  : BC_MenuBar(0, 0, gui->get_w())
57         this->gui = gui;
58         this->mwindow = mwindow; 
61 MainMenu::~MainMenu()
65 int MainMenu::create_objects()
67         BC_Menu *viewmenu, *windowmenu, *settingsmenu, *trackmenu;
68         PreferencesMenuitem *preferences;
69         Load *append_file;
70         total_loads = 0; 
72         add_menu(filemenu = new BC_Menu(_("File")));
73         filemenu->add_item(new_project = new New(mwindow));
74         new_project->create_objects();
76 // file loaders
77         filemenu->add_item(load_file = new Load(mwindow, this));
78         load_file->create_objects();
80 // new and load can be undone so no need to prompt save
81         Save *save;                   //  affected by saveas
82         filemenu->add_item(save = new Save(mwindow));
83         SaveAs *saveas;
84         filemenu->add_item(saveas = new SaveAs(mwindow));
85         save->create_objects(saveas);
86         saveas->set_mainmenu(this);
87         filemenu->add_item(record = new RecordMenuItem(mwindow));
89         filemenu->add_item(render = new RenderItem(mwindow));
90         filemenu->add_item(new BC_MenuItem("-"));
91         filemenu->add_item(quit_program = new Quit(mwindow));
92         quit_program->create_objects(save);
93         filemenu->add_item(new DumpEDL(mwindow));
94         filemenu->add_item(new DumpPlugins(mwindow));
95         filemenu->add_item(new LoadBackup(mwindow));
96         filemenu->add_item(new SaveBackup(mwindow));
98         BC_Menu *editmenu;
99         add_menu(editmenu = new BC_Menu(_("Edit")));
100         editmenu->add_item(undo = new Undo(mwindow));
101         editmenu->add_item(redo = new Redo(mwindow));
102         editmenu->add_item(new BC_MenuItem("-"));
103         editmenu->add_item(new Cut(mwindow));
104         editmenu->add_item(new Copy(mwindow));
105         editmenu->add_item(new Paste(mwindow));
106         editmenu->add_item(new Clear(mwindow));
107         editmenu->add_item(new PasteSilence(mwindow));
108         editmenu->add_item(new MuteSelection(mwindow));
109         editmenu->add_item(new TrimSelection(mwindow));
110         editmenu->add_item(new SelectAll(mwindow));
111         editmenu->add_item(new BC_MenuItem("-"));
112         editmenu->add_item(new ClearLabels(mwindow));
114         BC_Menu *keyframemenu;
115         add_menu(keyframemenu = new BC_Menu(_("Keyframes")));
116         keyframemenu->add_item(new CutKeyframes(mwindow));
117         keyframemenu->add_item(new CopyKeyframes(mwindow));
118         keyframemenu->add_item(new PasteKeyframes(mwindow));
119         keyframemenu->add_item(new ClearKeyframes(mwindow));
120         keyframemenu->add_item(new BC_MenuItem("-"));
121         keyframemenu->add_item(new CopyDefaultKeyframe(mwindow));
122         keyframemenu->add_item(new PasteDefaultKeyframe(mwindow));
127         add_menu(audiomenu = new BC_Menu(_("Audio")));
128         audiomenu->add_item(new AddAudioTrack(mwindow));
129         audiomenu->add_item(new DefaultATransition(mwindow));
130         audiomenu->add_item(aeffects = new MenuAEffects(mwindow));
132         add_menu(videomenu = new BC_Menu(_("Video")));
133         videomenu->add_item(new AddVideoTrack(mwindow));
134         videomenu->add_item(new DefaultVTransition(mwindow));
135         videomenu->add_item(veffects = new MenuVEffects(mwindow));
137         add_menu(trackmenu = new BC_Menu(_("Tracks")));
138         trackmenu->add_item(new MoveTracksUp(mwindow));
139         trackmenu->add_item(new MoveTracksDown(mwindow));
140         trackmenu->add_item(new DeleteTracks(mwindow));
141         trackmenu->add_item(new DeleteTrack(mwindow));
142         trackmenu->add_item(new ConcatenateTracks(mwindow));
144         add_menu(settingsmenu = new BC_Menu(_("Settings")));
146         settingsmenu->add_item(new SetFormat(mwindow));
147         settingsmenu->add_item(preferences = new PreferencesMenuitem(mwindow));
148         mwindow->preferences_thread = preferences->thread;
149         settingsmenu->add_item(labels_follow_edits = new LabelsFollowEdits(mwindow));
150         settingsmenu->add_item(plugins_follow_edits = new PluginsFollowEdits(mwindow));
151         settingsmenu->add_item(cursor_on_frames = new CursorOnFrames(mwindow));
152         settingsmenu->add_item(new SaveSettingsNow(mwindow));
153         settingsmenu->add_item(loop_playback = new LoopPlayback(mwindow));
154         settingsmenu->add_item(new SetBRenderStart(mwindow));
155 // set scrubbing speed
156 //      ScrubSpeed *scrub_speed;
157 //      settingsmenu->add_item(scrub_speed = new ScrubSpeed(mwindow));
158 //      if(mwindow->edl->session->scrub_speed == .5) 
159 //              scrub_speed->set_text(_("Fast Shuttle"));
166         add_menu(viewmenu = new BC_Menu(_("View")));
167         viewmenu->add_item(show_titles = new ShowTitles(mwindow, "1"));
168         viewmenu->add_item(show_transitions = new ShowTransitions(mwindow, "2"));
169         viewmenu->add_item(fade_automation = new FadeAutomation(mwindow, "3"));
170 //      viewmenu->add_item(play_automation = new PlayAutomation(mwindow, "4"));
171         viewmenu->add_item(mute_automation = new MuteAutomation(mwindow, "4"));
172         viewmenu->add_item(mode_automation = new ModeAutomation(mwindow, "5"));
173         viewmenu->add_item(pan_automation = new PanAutomation(mwindow, "6"));
174         viewmenu->add_item(camera_automation = new CameraAutomation(mwindow, "7"));
175         viewmenu->add_item(project_automation = new ProjectAutomation(mwindow, "8"));
176         viewmenu->add_item(plugin_automation = new PluginAutomation(mwindow, "9"));
177         viewmenu->add_item(mask_automation = new MaskAutomation(mwindow, "0"));
178         viewmenu->add_item(czoom_automation = new CZoomAutomation(mwindow, "-"));
179         viewmenu->add_item(pzoom_automation = new PZoomAutomation(mwindow, "="));
182         add_menu(windowmenu = new BC_Menu(_("Window")));
183         windowmenu->add_item(show_vwindow = new ShowVWindow(mwindow));
184         windowmenu->add_item(show_awindow = new ShowAWindow(mwindow));
185         windowmenu->add_item(show_cwindow = new ShowCWindow(mwindow));
186         windowmenu->add_item(show_lwindow = new ShowLWindow(mwindow));
187         windowmenu->add_item(new TileWindows(mwindow));
189         return 0;
192 int MainMenu::load_defaults(Defaults *defaults)
194         init_loads(defaults);
195         init_aeffects(defaults);
196         init_veffects(defaults);
197         return 0;
200 void MainMenu::update_toggles()
202         labels_follow_edits->set_checked(mwindow->edl->session->labels_follow_edits);
203         plugins_follow_edits->set_checked(mwindow->edl->session->plugins_follow_edits);
204         cursor_on_frames->set_checked(mwindow->edl->session->cursor_on_frames);
205         loop_playback->set_checked(mwindow->edl->local_session->loop_playback);
206         show_titles->set_checked(mwindow->edl->session->show_titles);
207         show_transitions->set_checked(mwindow->edl->session->auto_conf->transitions);
208         fade_automation->set_checked(mwindow->edl->session->auto_conf->fade);
209 //      play_automation->set_checked(mwindow->edl->session->auto_conf->play);
210         mute_automation->set_checked(mwindow->edl->session->auto_conf->mute);
211         pan_automation->set_checked(mwindow->edl->session->auto_conf->pan);
212         camera_automation->set_checked(mwindow->edl->session->auto_conf->camera);
213         project_automation->set_checked(mwindow->edl->session->auto_conf->projector);
214         plugin_automation->set_checked(mwindow->edl->session->auto_conf->plugins);
215         mode_automation->set_checked(mwindow->edl->session->auto_conf->mode);
216         mask_automation->set_checked(mwindow->edl->session->auto_conf->mask);
217         czoom_automation->set_checked(mwindow->edl->session->auto_conf->czoom);
218         pzoom_automation->set_checked(mwindow->edl->session->auto_conf->pzoom);
221 int MainMenu::save_defaults(Defaults *defaults)
223         save_loads(defaults);
224         save_aeffects(defaults);
225         save_veffects(defaults);
226         return 0;
233 int MainMenu::quit()
235         quit_program->handle_event();
236         return 0;
243 // ================================== load most recent
245 int MainMenu::init_aeffects(Defaults *defaults)
247         total_aeffects = defaults->get("TOTAL_AEFFECTS", 0);
248         
249         char string[1024], title[1024];
250         if(total_aeffects) audiomenu->add_item(new BC_MenuItem("-"));
251         
252         for(int i = 0; i < total_aeffects; i++)
253         {
254                 sprintf(string, "AEFFECTRECENT%d", i);
255                 defaults->get(string, title);
256                 audiomenu->add_item(aeffect[i] = new MenuAEffectItem(aeffects, title));
257         }
258         return 0;
261 int MainMenu::init_veffects(Defaults *defaults)
263         total_veffects = defaults->get("TOTAL_VEFFECTS", 0);
264         
265         char string[1024], title[1024];
266         if(total_veffects) videomenu->add_item(new BC_MenuItem("-"));
267         
268         for(int i = 0; i < total_veffects; i++)
269         {
270                 sprintf(string, "VEFFECTRECENT%d", i);
271                 defaults->get(string, title);
272                 videomenu->add_item(veffect[i] = new MenuVEffectItem(veffects, title));
273         }
274         return 0;
277 int MainMenu::init_loads(Defaults *defaults)
279 //printf("MainMenu::init_loads 1\n");
280         total_loads = defaults->get("TOTAL_LOADS", 0);
281 //printf("MainMenu::init_loads 1\n");
282         char string[1024], path[1024], filename[1024];
283 //printf("MainMenu::init_loads 1\n");
284         FileSystem dir;
285 //printf("MainMenu::init_loads 2\n");
286         if(total_loads > 0) filemenu->add_item(new BC_MenuItem("-"));
288         for(int i = 0; i < total_loads; i++)
289         {
290                 sprintf(string, "LOADPREVIOUS%d", i);
291 //printf("MainMenu::init_loads 3\n");
292                 defaults->get(string, path);
293 //printf("MainMenu::init_loads 4\n");
295                 filemenu->add_item(load[i] = new LoadPrevious(mwindow, load_file));
296 //printf("MainMenu::init_loads 5\n");
297                 dir.extract_name(filename, path, 0);
298 //printf("MainMenu::init_loads 6\n");
299                 load[i]->set_text(filename);
300 //printf("MainMenu::init_loads 7\n");
301                 load[i]->set_path(path);
302 //printf("MainMenu::init_loads 8\n");
303         }
304 //printf("MainMenu::init_loads 9\n");
305         return 0;
308 // ============================ save most recent
310 int MainMenu::save_aeffects(Defaults *defaults)
312         defaults->update("TOTAL_AEFFECTS", total_aeffects);
313         char string[1024];
314         for(int i = 0; i < total_aeffects; i++)
315         {
316                 sprintf(string, "AEFFECTRECENT%d", i);
317                 defaults->update(string, aeffect[i]->get_text());
318         }
319         return 0;
322 int MainMenu::save_veffects(Defaults *defaults)
324         defaults->update("TOTAL_VEFFECTS", total_veffects);
325         char string[1024];
326         for(int i = 0; i < total_veffects; i++)
327         {
328                 sprintf(string, "VEFFECTRECENT%d", i);
329                 defaults->update(string, veffect[i]->get_text());
330         }
331         return 0;
334 int MainMenu::save_loads(Defaults *defaults)
336         defaults->update("TOTAL_LOADS", total_loads);
337         char string[1024];
338         for(int i = 0; i < total_loads; i++)
339         {
340                 sprintf(string, "LOADPREVIOUS%d", i);
341                 defaults->update(string, load[i]->path);
342         }
343         return 0;
346 // =================================== add most recent
348 int MainMenu::add_aeffect(char *title)
350 // add bar for first effect
351         if(total_aeffects == 0)
352         {
353                 audiomenu->add_item(new BC_MenuItem("-"));
354         }
356 // test for existing copy of effect
357         for(int i = 0; i < total_aeffects; i++)
358         {
359                 if(!strcmp(aeffect[i]->get_text(), title))     // already exists
360                 {                                // swap for top effect
361                         for(int j = i; j > 0; j--)   // move preceeding effects down
362                         {
363                                 aeffect[j]->set_text(aeffect[j - 1]->get_text());
364                         }
365                         aeffect[0]->set_text(title);
366                         return 1;
367                 }
368         }
370 // add another blank effect
371         if(total_aeffects < TOTAL_EFFECTS)
372         {
373                 audiomenu->add_item(aeffect[total_aeffects] = new MenuAEffectItem(aeffects, ""));
374                 total_aeffects++;
375         }
377 // cycle effect down
378         for(int i = total_aeffects - 1; i > 0; i--)
379         {
380         // set menu item text
381                 aeffect[i]->set_text(aeffect[i - 1]->get_text());
382         }
384 // set up the new effect
385         aeffect[0]->set_text(title);
386         return 0;
389 int MainMenu::add_veffect(char *title)
391 // add bar for first effect
392         if(total_veffects == 0)
393         {
394                 videomenu->add_item(new BC_MenuItem("-"));
395         }
397 // test for existing copy of effect
398         for(int i = 0; i < total_veffects; i++)
399         {
400                 if(!strcmp(veffect[i]->get_text(), title))     // already exists
401                 {                                // swap for top effect
402                         for(int j = i; j > 0; j--)   // move preceeding effects down
403                         {
404                                 veffect[j]->set_text(veffect[j - 1]->get_text());
405                         }
406                         veffect[0]->set_text(title);
407                         return 1;
408                 }
409         }
411 // add another blank effect
412         if(total_veffects < TOTAL_EFFECTS)
413         {
414                 videomenu->add_item(veffect[total_veffects] = new MenuVEffectItem(veffects, ""));
415                 total_veffects++;
416         }
418 // cycle effect down
419         for(int i = total_veffects - 1; i > 0; i--)
420         {
421 // set menu item text
422                 veffect[i]->set_text(veffect[i - 1]->get_text());
423         }
425 // set up the new effect
426         veffect[0]->set_text(title);
427         return 0;
430 int MainMenu::add_load(char *path)
432         if(total_loads == 0)
433         {
434                 filemenu->add_item(new BC_MenuItem("-"));
435         }
437 // test for existing copy
438         FileSystem fs;
439         char text[1024], new_path[1024];      // get text and path
440         fs.extract_name(text, path);
441         strcpy(new_path, path);
443         for(int i = 0; i < total_loads; i++)
444         {
445                 if(!strcmp(load[i]->get_text(), text))     // already exists
446                 {                                // swap for top load
447                         for(int j = i; j > 0; j--)   // move preceeding loads down
448                         {
449                                 load[j]->set_text(load[j - 1]->get_text());
450                                 load[j]->set_path(load[j - 1]->path);
451                         }
452                         load[0]->set_text(text);
453                         load[0]->set_path(new_path);
454                         
455                         return 1;
456                 }
457         }
458         
459 // add another load
460         if(total_loads < TOTAL_LOADS)
461         {
462                 filemenu->add_item(load[total_loads] = new LoadPrevious(mwindow, load_file));
463                 total_loads++;
464         }
465         
466 // cycle loads down
467         for(int i = total_loads - 1; i > 0; i--)
468         {
469         // set menu item text
470                 load[i]->set_text(load[i - 1]->get_text());
471         // set filename
472                 load[i]->set_path(load[i - 1]->path);
473         }
475 // set up the new load
476         load[0]->set_text(text);
477         load[0]->set_path(new_path);
478         return 0;
488 // ================================== menu items
491 DumpCICache::DumpCICache(MWindow *mwindow)
492  : BC_MenuItem(_("Dump CICache"))
493 { this->mwindow = mwindow; }
495 int DumpCICache::handle_event()
497 //      mwindow->cache->dump();
500 DumpEDL::DumpEDL(MWindow *mwindow)
501  : BC_MenuItem(_("Dump EDL"))
503         this->mwindow = mwindow;
506 int DumpEDL::handle_event()
508 //printf("DumpEDL::handle_event 1\n");
509         mwindow->edl->dump();
510 //printf("DumpEDL::handle_event 2\n");
511         return 1;
514 DumpPlugins::DumpPlugins(MWindow *mwindow)
515  : BC_MenuItem(_("Dump Plugins"))
517         this->mwindow = mwindow;
520 int DumpPlugins::handle_event()
522 //printf("DumpEDL::handle_event 1\n");
523         mwindow->dump_plugins();
524 //printf("DumpEDL::handle_event 2\n");
525         return 1;
529 DumpAssets::DumpAssets(MWindow *mwindow)
530  : BC_MenuItem(_("Dump Assets"))
531 { this->mwindow = mwindow; }
533 int DumpAssets::handle_event()
535         mwindow->assets->dump();
538 // ================================================= edit
540 Undo::Undo(MWindow *mwindow) : BC_MenuItem(_("Undo"), "z", 'z') 
542         this->mwindow = mwindow; 
544 int Undo::handle_event()
546         mwindow->undo_entry(1);
547         return 1;
549 int Undo::update_caption(char *new_caption)
551         char string[1024];
552         sprintf(string, _("Undo %s"), new_caption);
553         set_text(string);
557 Redo::Redo(MWindow *mwindow) : BC_MenuItem(_("Redo"), "Shift+Z", 'Z') 
559         set_shift(1); 
560         this->mwindow = mwindow; 
563 int Redo::handle_event()
565         mwindow->redo_entry(1);
567         return 1;
569 int Redo::update_caption(char *new_caption)
571         char string[1024];
572         sprintf(string, _("Redo %s"), new_caption);
573         set_text(string);
576 CutKeyframes::CutKeyframes(MWindow *mwindow)
577  : BC_MenuItem(_("Cut keyframes"), "Shift-X", 'X')
579         set_shift(); 
580         this->mwindow = mwindow; 
583 int CutKeyframes::handle_event()
585         mwindow->cut_automation(); 
588 CopyKeyframes::CopyKeyframes(MWindow *mwindow)
589  : BC_MenuItem(_("Copy keyframes"), "Shift-C", 'C')
591         set_shift(); 
592         this->mwindow = mwindow; 
595 int CopyKeyframes::handle_event()
597         mwindow->copy_automation();
598         return 1;
601 PasteKeyframes::PasteKeyframes(MWindow *mwindow)
602  : BC_MenuItem(_("Paste keyframes"), "Shift-V", 'V')
604         set_shift(); 
605         this->mwindow = mwindow; 
608 int PasteKeyframes::handle_event()
610         mwindow->paste_automation(); 
613 ClearKeyframes::ClearKeyframes(MWindow *mwindow)
614  : BC_MenuItem(_("Clear keyframes"), "Shift-Del", BACKSPACE)
616         set_shift(); 
617         this->mwindow = mwindow; 
620 int ClearKeyframes::handle_event()
622         mwindow->clear_automation();
623         return 1;
630 CutDefaultKeyframe::CutDefaultKeyframe(MWindow *mwindow)
631  : BC_MenuItem(_("Cut default keyframe"), "Alt-X", 'X')
633         set_alt(); 
634         this->mwindow = mwindow; 
637 int CutDefaultKeyframe::handle_event()
639         mwindow->cut_default_keyframe(); 
640         return 1;
643 CopyDefaultKeyframe::CopyDefaultKeyframe(MWindow *mwindow)
644  : BC_MenuItem(_("Copy default keyframe"), "Alt-c", 'c')
646         set_alt(); 
647         this->mwindow = mwindow; 
650 int CopyDefaultKeyframe::handle_event()
652         mwindow->copy_default_keyframe();
653         return 1;
656 PasteDefaultKeyframe::PasteDefaultKeyframe(MWindow *mwindow)
657  : BC_MenuItem(_("Paste default keyframe"), "Alt-v", 'v')
659         set_alt(); 
660         this->mwindow = mwindow; 
663 int PasteDefaultKeyframe::handle_event()
665         mwindow->paste_default_keyframe(); 
666         return 1;
669 ClearDefaultKeyframe::ClearDefaultKeyframe(MWindow *mwindow)
670  : BC_MenuItem(_("Clear default keyframe"), "Alt-Del", BACKSPACE)
672         set_alt(); 
673         this->mwindow = mwindow; 
676 int ClearDefaultKeyframe::handle_event()
678         mwindow->clear_default_keyframe();
679         return 1;
682 Cut::Cut(MWindow *mwindow)
683  : BC_MenuItem(_("Cut"), "x", 'x') 
685         this->mwindow = mwindow; 
688 int Cut::handle_event()
690         mwindow->cut();
691         return 1;
694 Copy::Copy(MWindow *mwindow)
695  : BC_MenuItem(_("Copy"), "c", 'c') 
697         this->mwindow = mwindow; 
700 int Copy::handle_event()
702         mwindow->copy();
703         return 1;
706 Paste::Paste(MWindow *mwindow)
707  : BC_MenuItem(_("Paste"), "v", 'v') 
709         this->mwindow = mwindow; 
712 int Paste::handle_event()
714         mwindow->paste();
715         return 1;
718 Clear::Clear(MWindow *mwindow)
719  : BC_MenuItem(_("Clear"), "Del", BACKSPACE) 
721         this->mwindow = mwindow; 
724 int Clear::handle_event()
726         mwindow->cwindow->gui->lock_window();
727         mwindow->clear_entry();
728         mwindow->cwindow->gui->unlock_window();
729         return 1;
732 PasteSilence::PasteSilence(MWindow *mwindow)
733  : BC_MenuItem(_("Paste silence"), "Shift+Space", ' ')
735         this->mwindow = mwindow; 
736         set_shift(); 
739 int PasteSilence::handle_event()
741         mwindow->paste_silence();
742         return 1;
745 SelectAll::SelectAll(MWindow *mwindow)
746  : BC_MenuItem(_("Select All"), "a", 'a')
748         this->mwindow = mwindow; 
751 int SelectAll::handle_event()
753         mwindow->select_all();
754         return 1;
757 ClearLabels::ClearLabels(MWindow *mwindow) : BC_MenuItem(_("Clear labels")) 
759         this->mwindow = mwindow; 
762 int ClearLabels::handle_event()
764         mwindow->clear_labels();
765         return 1;
768 MuteSelection::MuteSelection(MWindow *mwindow)
769  : BC_MenuItem(_("Mute Region"), "m", 'm')
771         this->mwindow = mwindow;
774 int MuteSelection::handle_event()
776         mwindow->mute_selection();
777         return 1;
781 TrimSelection::TrimSelection(MWindow *mwindow)
782  : BC_MenuItem(_("Trim Selection"))
784         this->mwindow = mwindow;
787 int TrimSelection::handle_event()
789         mwindow->trim_selection();
790         return 1;
804 // ============================================= audio
806 AddAudioTrack::AddAudioTrack(MWindow *mwindow)
807  : BC_MenuItem(_("Add track"), "t", 't')
809         this->mwindow = mwindow;
812 int AddAudioTrack::handle_event()
814         mwindow->add_audio_track_entry(0, 0);
815         return 1;
818 DeleteAudioTrack::DeleteAudioTrack(MWindow *mwindow)
819  : BC_MenuItem(_("Delete track"))
821         this->mwindow = mwindow;
824 int DeleteAudioTrack::handle_event()
826         return 1;
829 DefaultATransition::DefaultATransition(MWindow *mwindow)
830  : BC_MenuItem(_("Default Transition"), "u", 'u')
832         this->mwindow = mwindow;
835 int DefaultATransition::handle_event()
837         mwindow->paste_audio_transition();
838         return 1;
844 // ============================================= video
847 AddVideoTrack::AddVideoTrack(MWindow *mwindow)
848  : BC_MenuItem(_("Add track"), "Shift-T", 'T')
850         set_shift();
851         this->mwindow = mwindow;
854 int AddVideoTrack::handle_event()
856         mwindow->add_video_track_entry();
857         return 1;
861 DeleteVideoTrack::DeleteVideoTrack(MWindow *mwindow)
862  : BC_MenuItem(_("Delete track"))
864         this->mwindow = mwindow;
867 int DeleteVideoTrack::handle_event()
869         return 1;
874 ResetTranslation::ResetTranslation(MWindow *mwindow)
875  : BC_MenuItem(_("Reset Translation"))
877         this->mwindow = mwindow;
880 int ResetTranslation::handle_event()
882         return 1;
887 DefaultVTransition::DefaultVTransition(MWindow *mwindow)
888  : BC_MenuItem(_("Default Transition"), "Shift-U", 'U')
890         set_shift();
891         this->mwindow = mwindow;
894 int DefaultVTransition::handle_event()
896         mwindow->paste_video_transition();
897         return 1;
913 // ============================================ settings
915 DeleteTracks::DeleteTracks(MWindow *mwindow)
916  : BC_MenuItem(_("Delete tracks"))
918         this->mwindow = mwindow;
921 int DeleteTracks::handle_event()
923         mwindow->delete_tracks();
924         return 1;
927 DeleteTrack::DeleteTrack(MWindow *mwindow)
928  : BC_MenuItem(_("Delete last track"), "d", 'd')
930         this->mwindow = mwindow;
933 int DeleteTrack::handle_event()
935         mwindow->delete_track();
936         return 1;
939 MoveTracksUp::MoveTracksUp(MWindow *mwindow)
940  : BC_MenuItem(_("Move tracks up"))
942         set_shift(); this->mwindow = mwindow;
945 int MoveTracksUp::handle_event()
947         mwindow->move_tracks_up();
948         return 1;
951 MoveTracksDown::MoveTracksDown(MWindow *mwindow)
952  : BC_MenuItem(_("Move tracks down"))
954         set_shift(); this->mwindow = mwindow;
957 int MoveTracksDown::handle_event()
959         mwindow->move_tracks_down();
960         return 1;
966 ConcatenateTracks::ConcatenateTracks(MWindow *mwindow)
967  : BC_MenuItem(_("Concatenate tracks"))
969         set_shift(); 
970         this->mwindow = mwindow;
973 int ConcatenateTracks::handle_event()
975         mwindow->concatenate_tracks();
976         return 1;
983 LoopPlayback::LoopPlayback(MWindow *mwindow)
984  : BC_MenuItem(_("Loop Playback"), "Shift+L", 'L')
986         this->mwindow = mwindow;
987         set_checked(mwindow->edl->local_session->loop_playback);
988         set_shift();
991 int LoopPlayback::handle_event()
993         mwindow->toggle_loop_playback();
994         set_checked(mwindow->edl->local_session->loop_playback);
995         return 1;
1002 SetBRenderStart::SetBRenderStart(MWindow *mwindow)
1003  : BC_MenuItem(_("Set background render"))
1005         this->mwindow = mwindow;
1008 int SetBRenderStart::handle_event()
1010         mwindow->set_brender_start();
1011         return 1;
1020 LabelsFollowEdits::LabelsFollowEdits(MWindow *mwindow)
1021  : BC_MenuItem(_("Edit labels")) 
1023         this->mwindow = mwindow; 
1024         set_checked(mwindow->edl->session->labels_follow_edits);
1027 int LabelsFollowEdits::handle_event()
1029         set_checked(get_checked() ^ 1);
1030         mwindow->edl->session->labels_follow_edits = get_checked(); 
1036 PluginsFollowEdits::PluginsFollowEdits(MWindow *mwindow)
1037  : BC_MenuItem(_("Edit effects")) 
1039         this->mwindow = mwindow; 
1040         set_checked(mwindow->edl->session->plugins_follow_edits);
1043 int PluginsFollowEdits::handle_event()
1045         set_checked(get_checked() ^ 1);
1046         mwindow->edl->session->plugins_follow_edits = get_checked(); 
1052 AutosFollowEdits::AutosFollowEdits(MWindow *mwindow)
1053  : BC_MenuItem(_("Autos follow edits")) 
1055         this->mwindow = mwindow; 
1056         set_checked(mwindow->edl->session->autos_follow_edits);
1059 int AutosFollowEdits::handle_event()
1061         mwindow->edl->session->autos_follow_edits ^= 1; 
1062         set_checked(!get_checked());
1066 CursorOnFrames::CursorOnFrames(MWindow *mwindow)
1067  : BC_MenuItem(_("Align cursor on frames")) 
1069         this->mwindow = mwindow; 
1070         set_checked(mwindow->edl->session->cursor_on_frames);
1073 int CursorOnFrames::handle_event()
1075         mwindow->edl->session->cursor_on_frames = !mwindow->edl->session->cursor_on_frames; 
1076         set_checked(mwindow->edl->session->cursor_on_frames);
1080 ScrubSpeed::ScrubSpeed(MWindow *mwindow) : BC_MenuItem(_("Slow Shuttle"))
1082         this->mwindow = mwindow;
1085 int ScrubSpeed::handle_event()
1087         if(mwindow->edl->session->scrub_speed == .5)
1088         {
1089                 mwindow->edl->session->scrub_speed = 2;
1090                 set_text(_("Slow Shuttle"));
1091         }
1092         else
1093         {
1094                 mwindow->edl->session->scrub_speed = .5;
1095                 set_text(_("Fast Shuttle"));
1096         }
1099 SaveSettingsNow::SaveSettingsNow(MWindow *mwindow) : BC_MenuItem(_("Save settings now")) 
1101         this->mwindow = mwindow; 
1104 int SaveSettingsNow::handle_event()
1106         mwindow->save_defaults();
1107         mwindow->save_backup();
1108         mwindow->gui->show_message(_("Saved settings."));
1109         return 1;
1114 // ============================================ window
1120 ShowVWindow::ShowVWindow(MWindow *mwindow)
1121  : BC_MenuItem(_("Show Viewer"))
1123         this->mwindow = mwindow;
1124         set_checked(mwindow->session->show_vwindow);
1126 int ShowVWindow::handle_event()
1128         mwindow->show_vwindow();
1129         return 1;
1132 ShowAWindow::ShowAWindow(MWindow *mwindow)
1133  : BC_MenuItem(_("Show Resources"))
1135         this->mwindow = mwindow;
1136         set_checked(mwindow->session->show_awindow);
1138 int ShowAWindow::handle_event()
1140         mwindow->show_awindow();
1141         return 1;
1144 ShowCWindow::ShowCWindow(MWindow *mwindow)
1145  : BC_MenuItem(_("Show Compositor"))
1147         this->mwindow = mwindow;
1148         set_checked(mwindow->session->show_cwindow);
1150 int ShowCWindow::handle_event()
1152         mwindow->show_cwindow();
1153         return 1;
1157 ShowLWindow::ShowLWindow(MWindow *mwindow)
1158  : BC_MenuItem(_("Show Levels"))
1160         this->mwindow = mwindow;
1161         set_checked(mwindow->session->show_lwindow);
1163 int ShowLWindow::handle_event()
1165         mwindow->show_lwindow();
1166         return 1;
1169 TileWindows::TileWindows(MWindow *mwindow)
1170  : BC_MenuItem(_("Default positions"))
1172         this->mwindow = mwindow;
1174 int TileWindows::handle_event()
1176         mwindow->tile_windows();
1177         return 1;
1181 PanMenu::PanMenu() : BC_SubMenu() {}
1183 PanItem::PanItem(MWindow *mwindow, char *text, int number)
1184  : BC_MenuItem(text) 
1186         this->mwindow = mwindow; 
1187         this->number = number; 
1188         set_checked(0);
1190 int PanItem::handle_event()
1192 //      mwindow->tracks->toggle_auto_pan(number);
1193         set_checked(get_checked() ^ 1);
1196 PluginMenu::PluginMenu() : BC_SubMenu() {}
1198 PluginItem::PluginItem(MWindow *mwindow, char *text, int number)
1199  : BC_MenuItem(text) 
1201         this->mwindow = mwindow; 
1202         this->number = number; 
1203         set_checked(0);
1205 int PluginItem::handle_event()
1207 //      mwindow->tracks->toggle_auto_plugin(number);
1208         set_checked(get_checked() ^ 1);