Credit Andrew - improve in-tree documentation
[goodguy/cinelerra.git] / cinelerra / mainmenu.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 1997-2014 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #include "assets.h"
23 #include "auto.h"
24 #include "batchrender.h"
25 #include "bcdisplayinfo.h"
26 #include "bchash.h"
27 #include "bcsignals.h"
28 #include "bdcreate.h"
29 #include "cache.h"
30 #include "channelinfo.h"
31 #include "cplayback.h"
32 #include "cropvideo.h"
33 #include "cwindow.h"
34 #include "cwindowgui.h"
35 #include "dbwindow.h"
36 #include "dvdcreate.h"
37 #include "edl.h"
38 #include "edlsession.h"
39 #include "file.h"
40 #include "filesystem.h"
41 #include "filexml.h"
42 #include "floatauto.h"
43 #include "keys.h"
44 #include "language.h"
45 #include "levelwindow.h"
46 #include "loadfile.h"
47 #include "localsession.h"
48 #include "mainclock.h"
49 #include "mainmenu.h"
50 #include "mainsession.h"
51 #include "mainundo.h"
52 #include "menuattacheffect.h"
53 #include "menuattachtransition.h"
54 #include "menuaeffects.h"
55 #include "menueditlength.h"
56 #include "menutransitionlength.h"
57 #include "menuveffects.h"
58 #include "mwindowgui.h"
59 #include "mwindow.h"
60 #include "new.h"
61 #include "patchbay.h"
62 #include "playbackengine.h"
63 #include "preferences.h"
64 #include "proxy.h"
65 #include "preferencesthread.h"
66 #include "quit.h"
67 #include "record.h"
68 #include "render.h"
69 #include "savefile.h"
70 #include "setformat.h"
71 #include "swindow.h"
72 #include "timebar.h"
73 #include "trackcanvas.h"
74 #include "tracks.h"
75 #include "transition.h"
76 #include "transportque.h"
77 #include "viewmenu.h"
78 #include "zoombar.h"
79 #include "exportedl.h"
80
81 #include <string.h>
82
83
84 MainMenu::MainMenu(MWindow *mwindow, MWindowGUI *gui, int w)
85  : BC_MenuBar(0, 0, w)
86 {
87         this->gui = gui;
88         this->mwindow = mwindow;
89 }
90
91 MainMenu::~MainMenu()
92 {
93 }
94
95 void MainMenu::create_objects()
96 {
97         BC_Menu *viewmenu, *windowmenu, *settingsmenu, *trackmenu;
98         PreferencesMenuitem *preferences;
99         total_loads = 0;
100
101         add_menu(filemenu = new BC_Menu(_("File")));
102         filemenu->add_item(new_project = new NewProject(mwindow));
103         new_project->create_objects();
104
105 // file loaders
106         filemenu->add_item(load_file = new Load(mwindow, this));
107         load_file->create_objects();
108
109 // new and load can be undone so no need to prompt save
110         Save *save;                   //  affected by saveas
111         filemenu->add_item(save = new Save(mwindow));
112         SaveAs *saveas;
113         filemenu->add_item(saveas = new SaveAs(mwindow));
114         save->create_objects(saveas);
115         saveas->set_mainmenu(this);
116         SaveProject *save_project;
117         filemenu->add_item(save_project = new SaveProject(mwindow));
118
119         filemenu->add_item(record_menu_item = new RecordMenuItem(mwindow));
120 #ifdef HAVE_DVB
121         filemenu->add_item(new ChannelScan(mwindow));
122 #endif
123 #ifdef HAVE_COMMERCIAL
124         if( mwindow->has_commercials() )
125                 filemenu->add_item(new DbWindowScan(mwindow));
126 #endif
127         filemenu->add_item(new SubttlSWin(mwindow));
128
129         filemenu->add_item(render = new RenderItem(mwindow));
130         filemenu->add_item(new ExportEDLItem(mwindow));
131         filemenu->add_item(new BatchRenderMenuItem(mwindow));
132         filemenu->add_item(new CreateBD_MenuItem(mwindow));
133         filemenu->add_item(new CreateDVD_MenuItem(mwindow));
134         filemenu->add_item(new BC_MenuItem("-"));
135         filemenu->add_item(quit_program = new Quit(mwindow));
136         quit_program->create_objects(save);
137         filemenu->add_item(dump_menu = new MainDumpsMenu(mwindow));
138         dump_menu->create_objects();
139         filemenu->add_item(new LoadBackup(mwindow));
140         filemenu->add_item(new SaveBackup(mwindow));
141
142         BC_Menu *editmenu;
143         add_menu(editmenu = new BC_Menu(_("Edit")));
144         editmenu->add_item(undo = new Undo(mwindow));
145         editmenu->add_item(redo = new Redo(mwindow));
146         editmenu->add_item(new BC_MenuItem("-"));
147         editmenu->add_item(new Cut(mwindow));
148         editmenu->add_item(new Copy(mwindow));
149         editmenu->add_item(new Paste(mwindow));
150         editmenu->add_item(new Clear(mwindow));
151         editmenu->add_item(new PasteSilence(mwindow));
152         editmenu->add_item(new MuteSelection(mwindow));
153         editmenu->add_item(new TrimSelection(mwindow));
154         editmenu->add_item(new SelectAll(mwindow));
155         editmenu->add_item(new BC_MenuItem("-"));
156         editmenu->add_item(new MenuEditShuffle(mwindow));
157         editmenu->add_item(new MenuEditReverse(mwindow));
158         editmenu->add_item(new MenuEditLength(mwindow));
159         editmenu->add_item(new MenuEditAlign(mwindow));
160         editmenu->add_item(new MenuTransitionLength(mwindow));
161         editmenu->add_item(new DetachTransitions(mwindow));
162         editmenu->add_item(new BC_MenuItem("-"));
163         editmenu->add_item(new ClearLabels(mwindow));
164         editmenu->add_item(new CutCommercials(mwindow));
165         editmenu->add_item(new PasteSubttl(mwindow));
166
167         BC_Menu *keyframemenu;
168         add_menu(keyframemenu = new BC_Menu(_("Keyframes")));
169         keyframemenu->add_item(new CutKeyframes(mwindow));
170         keyframemenu->add_item(new CopyKeyframes(mwindow));
171         keyframemenu->add_item(new PasteKeyframes(mwindow));
172         keyframemenu->add_item(new ClearKeyframes(mwindow));
173         keyframemenu->add_item(new StraightenKeyframes(mwindow));
174         keyframemenu->add_item(new BendKeyframes(mwindow));
175         keyframemenu->add_item(keyframe_curve_type = new KeyframeCurveType(mwindow));
176         keyframe_curve_type->create_objects();
177         keyframe_curve_type->update(mwindow->edl->local_session->floatauto_type);
178         keyframemenu->add_item(new BC_MenuItem("-"));
179         keyframemenu->add_item(new CopyDefaultKeyframe(mwindow));
180         keyframemenu->add_item(new PasteDefaultKeyframe(mwindow));
181
182
183
184
185         add_menu(audiomenu = new BC_Menu(_("Audio")));
186         audiomenu->add_item(new AddAudioTrack(mwindow));
187         audiomenu->add_item(new DefaultATransition(mwindow));
188         audiomenu->add_item(new MapAudio1(mwindow));
189         audiomenu->add_item(new MapAudio2(mwindow));
190         audiomenu->add_item(new MenuAttachTransition(mwindow, TRACK_AUDIO));
191         audiomenu->add_item(new MenuAttachEffect(mwindow, TRACK_AUDIO));
192         audiomenu->add_item(aeffects = new MenuAEffects(mwindow));
193
194         add_menu(videomenu = new BC_Menu(_("Video")));
195         videomenu->add_item(new AddVideoTrack(mwindow));
196         videomenu->add_item(new DefaultVTransition(mwindow));
197         videomenu->add_item(new MenuAttachTransition(mwindow, TRACK_VIDEO));
198         videomenu->add_item(new MenuAttachEffect(mwindow, TRACK_VIDEO));
199         videomenu->add_item(veffects = new MenuVEffects(mwindow));
200
201         add_menu(trackmenu = new BC_Menu(_("Tracks")));
202         trackmenu->add_item(new MoveTracksUp(mwindow));
203         trackmenu->add_item(new MoveTracksDown(mwindow));
204         trackmenu->add_item(new DeleteTracks(mwindow));
205         trackmenu->add_item(new DeleteTrack(mwindow));
206         trackmenu->add_item(new ConcatenateTracks(mwindow));
207         AppendTracks *append_tracks;
208         trackmenu->add_item(append_tracks = new AppendTracks(mwindow));
209         append_tracks->create_objects();
210         trackmenu->add_item(new AddSubttlTrack(mwindow));
211
212         add_menu(settingsmenu = new BC_Menu(_("Settings")));
213
214         settingsmenu->add_item(new SetFormat(mwindow));
215         settingsmenu->add_item(preferences = new PreferencesMenuitem(mwindow));
216         ProxyMenuItem *proxy;
217         settingsmenu->add_item(proxy = new ProxyMenuItem(mwindow));
218         proxy->create_objects();
219         mwindow->preferences_thread = preferences->thread;
220         settingsmenu->add_item(cursor_on_frames = new CursorOnFrames(mwindow));
221         settingsmenu->add_item(labels_follow_edits = new LabelsFollowEdits(mwindow));
222         settingsmenu->add_item(plugins_follow_edits = new PluginsFollowEdits(mwindow));
223         settingsmenu->add_item(keyframes_follow_edits = new KeyframesFollowEdits(mwindow));
224         settingsmenu->add_item(typeless_keyframes = new TypelessKeyframes(mwindow));
225         settingsmenu->add_item(new BC_MenuItem("-"));
226         settingsmenu->add_item(new SaveSettingsNow(mwindow));
227         settingsmenu->add_item(loop_playback = new LoopPlayback(mwindow));
228         settingsmenu->add_item(brender_active = new SetBRenderActive(mwindow));
229 // set scrubbing speed
230 //      ScrubSpeed *scrub_speed;
231 //      settingsmenu->add_item(scrub_speed = new ScrubSpeed(mwindow));
232 //      if(mwindow->edl->session->scrub_speed == .5)
233 //              scrub_speed->set_text(_("Fast Shuttle"));
234
235
236
237
238
239
240         add_menu(viewmenu = new BC_Menu(_("View")));
241         viewmenu->add_item(show_assets = new ShowAssets(mwindow, "0"));
242         viewmenu->add_item(show_titles = new ShowTitles(mwindow, "1"));
243         viewmenu->add_item(show_transitions = new ShowTransitions(mwindow, "2"));
244         viewmenu->add_item(fade_automation = new ShowAutomation(mwindow, _("Fade"), "3", AUTOMATION_FADE));
245         viewmenu->add_item(mute_automation = new ShowAutomation(mwindow, _("Mute"), "4", AUTOMATION_MUTE));
246         viewmenu->add_item(mode_automation = new ShowAutomation(mwindow, _("Overlay mode"), "5", AUTOMATION_MODE));
247         viewmenu->add_item(pan_automation = new ShowAutomation(mwindow, _("Pan"), "6", AUTOMATION_PAN));
248         viewmenu->add_item(plugin_automation = new PluginAutomation(mwindow, "7"));
249         viewmenu->add_item(mask_automation = new ShowAutomation(mwindow, _("Mask"), "8", AUTOMATION_MASK));
250         viewmenu->add_item(speed_automation = new ShowAutomation(mwindow, _("Speed"), "9", AUTOMATION_SPEED));
251
252         camera_x = new ShowAutomation(mwindow, _("Camera X"), "Ctrl-Shift-X", AUTOMATION_CAMERA_X);
253         camera_x->set_ctrl();  camera_x->set_shift();   viewmenu->add_item(camera_x);
254         camera_y = new ShowAutomation(mwindow, _("Camera Y"), "Ctrl-Shift-Y", AUTOMATION_CAMERA_Y);
255         camera_y->set_ctrl();  camera_y->set_shift();   viewmenu->add_item(camera_y);
256         camera_z = new ShowAutomation(mwindow, _("Camera Z"), "Ctrl-Shift-Z", AUTOMATION_CAMERA_Z);
257         camera_z->set_ctrl();  camera_z->set_shift();  viewmenu->add_item(camera_z);
258         project_x = new ShowAutomation(mwindow, _("Projector X"), "Alt-Shift-X", AUTOMATION_PROJECTOR_X);
259         project_x->set_alt();  project_x->set_shift();  viewmenu->add_item(project_x);
260         project_y = new ShowAutomation(mwindow, _("Projector Y"), "Alt-Shift-Y", AUTOMATION_PROJECTOR_Y);
261         project_y->set_alt();  project_y->set_shift();  viewmenu->add_item(project_y);
262         project_z = new ShowAutomation(mwindow, _("Projector Z"), "Alt-Shift-Z", AUTOMATION_PROJECTOR_Z);
263         project_z->set_alt();  project_z->set_shift();  viewmenu->add_item(project_z);
264
265         add_menu(windowmenu = new BC_Menu(_("Window")));
266         windowmenu->add_item(show_vwindow = new ShowVWindow(mwindow));
267         windowmenu->add_item(show_awindow = new ShowAWindow(mwindow));
268         windowmenu->add_item(show_cwindow = new ShowCWindow(mwindow));
269         windowmenu->add_item(show_gwindow = new ShowGWindow(mwindow));
270         windowmenu->add_item(show_lwindow = new ShowLWindow(mwindow));
271         windowmenu->add_item(new BC_MenuItem("-"));
272         windowmenu->add_item(split_x = new SplitX(mwindow));
273         windowmenu->add_item(split_y = new SplitY(mwindow));
274         windowmenu->add_item(mixer_viewer = new MixerViewer(mwindow));
275         windowmenu->add_item(new TileMixers(mwindow));
276         windowmenu->add_item(new TileWindows(mwindow,_("Tile left"),0));
277         windowmenu->add_item(new TileWindows(mwindow,_("Tile right"),1));
278         windowmenu->add_item(new BC_MenuItem("-"));
279
280         windowmenu->add_item(new TileWindows(mwindow,_("Default positions"),-1,_("Ctrl-P"),'p'));
281         windowmenu->add_item(load_layout = new LoadLayout(mwindow, _("Load layout..."),LAYOUT_LOAD));
282         load_layout->create_objects();
283         windowmenu->add_item(save_layout = new LoadLayout(mwindow, _("Save layout..."),LAYOUT_SAVE));
284         save_layout->create_objects();
285 }
286
287 int MainMenu::load_defaults(BC_Hash *defaults)
288 {
289         init_loads(defaults);
290         init_aeffects(defaults);
291         init_veffects(defaults);
292         return 0;
293 }
294
295 void MainMenu::update_toggles(int use_lock)
296 {
297         if(use_lock) lock_window("MainMenu::update_toggles");
298         labels_follow_edits->set_checked(mwindow->edl->session->labels_follow_edits);
299         plugins_follow_edits->set_checked(mwindow->edl->session->plugins_follow_edits);
300         keyframes_follow_edits->set_checked(mwindow->edl->session->autos_follow_edits);
301         typeless_keyframes->set_checked(mwindow->edl->session->typeless_keyframes);
302         cursor_on_frames->set_checked(mwindow->edl->session->cursor_on_frames);
303         loop_playback->set_checked(mwindow->edl->local_session->loop_playback);
304
305         show_assets->set_checked(mwindow->edl->session->show_assets);
306         show_titles->set_checked(mwindow->edl->session->show_titles);
307         show_transitions->set_checked(mwindow->edl->session->auto_conf->transitions);
308         fade_automation->update_toggle();
309         mute_automation->update_toggle();
310         pan_automation->update_toggle();
311         camera_x->update_toggle();
312         camera_y->update_toggle();
313         camera_z->update_toggle();
314         project_x->update_toggle();
315         project_y->update_toggle();
316         project_z->update_toggle();
317         plugin_automation->set_checked(mwindow->edl->session->auto_conf->plugins);
318         mode_automation->update_toggle();
319         mask_automation->update_toggle();
320         speed_automation->update_toggle();
321         split_x->set_checked(mwindow->gui->pane[TOP_RIGHT_PANE] != 0);
322         split_y->set_checked(mwindow->gui->pane[BOTTOM_LEFT_PANE] != 0);
323
324         if(use_lock) mwindow->gui->unlock_window();
325 }
326
327 int MainMenu::save_defaults(BC_Hash *defaults)
328 {
329         save_loads(defaults);
330         save_aeffects(defaults);
331         save_veffects(defaults);
332         return 0;
333 }
334
335
336
337
338
339 int MainMenu::quit()
340 {
341         quit_program->handle_event();
342         return 0;
343 }
344
345
346
347
348
349 // ================================== load most recent
350
351 int MainMenu::init_aeffects(BC_Hash *defaults)
352 {
353         total_aeffects = defaults->get((char*)"TOTAL_AEFFECTS", 0);
354
355         char string[BCTEXTLEN], title[BCTEXTLEN];
356         if(total_aeffects) audiomenu->add_item(new BC_MenuItem("-"));
357
358         for(int i = 0; i < total_aeffects; i++)
359         {
360                 sprintf(string, "AEFFECTRECENT%d", i);
361                 defaults->get(string, title);
362                 audiomenu->add_item(aeffect[i] = new MenuAEffectItem(aeffects, title));
363         }
364         return 0;
365 }
366
367 int MainMenu::init_veffects(BC_Hash *defaults)
368 {
369         total_veffects = defaults->get((char*)"TOTAL_VEFFECTS", 0);
370
371         char string[BCTEXTLEN], title[BCTEXTLEN];
372         if(total_veffects) videomenu->add_item(new BC_MenuItem("-"));
373
374         for(int i = 0; i < total_veffects; i++)
375         {
376                 sprintf(string, "VEFFECTRECENT%d", i);
377                 defaults->get(string, title);
378                 videomenu->add_item(veffect[i] = new MenuVEffectItem(veffects, title));
379         }
380         return 0;
381 }
382
383 void MainMenu::init_loads(BC_Hash *defaults)
384 {
385         total_loads = defaults->get((char*)"TOTAL_LOADS", 0);
386         if( !total_loads ) return;
387         filemenu->add_item(new BC_MenuItem("-"));
388
389         char string[BCTEXTLEN], path[BCTEXTLEN], filename[BCTEXTLEN];
390         FileSystem dir;
391 //printf("MainMenu::init_loads 2\n");
392
393         for(int i = 0; i < total_loads; i++) {
394                 sprintf(string, "LOADPREVIOUS%d", i);
395 //printf("MainMenu::init_loads 3\n");
396                 defaults->get(string, path);
397                 filemenu->add_item(load[i] = new LoadPrevious(mwindow, load_file));
398                 dir.extract_name(filename, path, 0);
399                 load[i]->set_text(filename);
400                 load[i]->set_path(path);
401         }
402 }
403
404 // ============================ save most recent
405
406 int MainMenu::save_aeffects(BC_Hash *defaults)
407 {
408         defaults->update((char*)"TOTAL_AEFFECTS", total_aeffects);
409         char string[BCTEXTLEN];
410         for(int i = 0; i < total_aeffects; i++)
411         {
412                 sprintf(string, "AEFFECTRECENT%d", i);
413                 defaults->update(string, aeffect[i]->get_text());
414         }
415         return 0;
416 }
417
418 int MainMenu::save_veffects(BC_Hash *defaults)
419 {
420         defaults->update((char*)"TOTAL_VEFFECTS", total_veffects);
421         char string[BCTEXTLEN];
422         for(int i = 0; i < total_veffects; i++)
423         {
424                 sprintf(string, "VEFFECTRECENT%d", i);
425                 defaults->update(string, veffect[i]->get_text());
426         }
427         return 0;
428 }
429
430 int MainMenu::save_loads(BC_Hash *defaults)
431 {
432         defaults->update((char*)"TOTAL_LOADS", total_loads);
433         char string[BCTEXTLEN];
434         for(int i = 0; i < total_loads; i++)
435         {
436                 sprintf(string, "LOADPREVIOUS%d", i);
437                 defaults->update(string, load[i]->path);
438         }
439         return 0;
440 }
441
442 // =================================== add most recent
443
444 int MainMenu::add_aeffect(char *title)
445 {
446 // add bar for first effect
447         if(total_aeffects == 0)
448         {
449                 audiomenu->add_item(new BC_MenuItem("-"));
450         }
451
452 // test for existing copy of effect
453         for(int i = 0; i < total_aeffects; i++)
454         {
455                 if(!strcmp(aeffect[i]->get_text(), title))     // already exists
456                 {                                // swap for top effect
457                         for(int j = i; j > 0; j--)   // move preceeding effects down
458                         {
459                                 aeffect[j]->set_text(aeffect[j - 1]->get_text());
460                         }
461                         aeffect[0]->set_text(title);
462                         return 1;
463                 }
464         }
465
466 // add another blank effect
467         if(total_aeffects < TOTAL_EFFECTS)
468         {
469                 audiomenu->add_item(
470                         aeffect[total_aeffects] = new MenuAEffectItem(aeffects, (char*)""));
471                 total_aeffects++;
472         }
473
474 // cycle effect down
475         for(int i = total_aeffects - 1; i > 0; i--)
476         {
477         // set menu item text
478                 aeffect[i]->set_text(aeffect[i - 1]->get_text());
479         }
480
481 // set up the new effect
482         aeffect[0]->set_text(title);
483         return 0;
484 }
485
486 int MainMenu::add_veffect(char *title)
487 {
488 // add bar for first effect
489         if(total_veffects == 0)
490         {
491                 videomenu->add_item(new BC_MenuItem("-"));
492         }
493
494 // test for existing copy of effect
495         for(int i = 0; i < total_veffects; i++)
496         {
497                 if(!strcmp(veffect[i]->get_text(), title))     // already exists
498                 {                                // swap for top effect
499                         for(int j = i; j > 0; j--)   // move preceeding effects down
500                         {
501                                 veffect[j]->set_text(veffect[j - 1]->get_text());
502                         }
503                         veffect[0]->set_text(title);
504                         return 1;
505                 }
506         }
507
508 // add another blank effect
509         if(total_veffects < TOTAL_EFFECTS)
510         {
511                 videomenu->add_item(veffect[total_veffects] =
512                         new MenuVEffectItem(veffects, (char*)""));
513                 total_veffects++;
514         }
515
516 // cycle effect down
517         for(int i = total_veffects - 1; i > 0; i--)
518         {
519 // set menu item text
520                 veffect[i]->set_text(veffect[i - 1]->get_text());
521         }
522
523 // set up the new effect
524         veffect[0]->set_text(title);
525         return 0;
526 }
527
528 int MainMenu::add_load(char *path)
529 {
530         if(total_loads == 0)
531 {
532                 filemenu->add_item(new BC_MenuItem("-"));
533         }
534
535 // test for existing copy
536         FileSystem fs;
537         char text[BCTEXTLEN], new_path[BCTEXTLEN];      // get text and path
538         fs.extract_name(text, path);
539         strcpy(new_path, path);
540
541         for(int i = 0; i < total_loads; i++)
542         {
543                 if(!strcmp(load[i]->get_text(), text))     // already exists
544                 {                                // swap for top load
545                         for(int j = i; j > 0; j--)   // move preceeding loads down
546                         {
547                                 load[j]->set_text(load[j - 1]->get_text());
548                                 load[j]->set_path(load[j - 1]->path);
549         }
550                         load[0]->set_text(text);
551                         load[0]->set_path(new_path);
552
553                         return 1;
554                 }
555         }
556
557 // add another load
558         if(total_loads < TOTAL_LOADS)
559         {
560                 filemenu->add_item(load[total_loads] = new LoadPrevious(mwindow, load_file));
561                 total_loads++;
562         }
563
564 // cycle loads down
565         for(int i = total_loads - 1; i > 0; i--)
566         {
567         // set menu item text
568                 load[i]->set_text(load[i - 1]->get_text());
569         // set filename
570                 load[i]->set_path(load[i - 1]->path);
571         }
572
573 // set up the new load
574         load[0]->set_text(text);
575         load[0]->set_path(new_path);
576         return 0;
577 }
578
579
580
581
582
583
584
585
586 // ================================== menu items
587
588 MainDumpsSubMenu::MainDumpsSubMenu(BC_MenuItem *menu_item)
589  : BC_SubMenu()
590 {
591         this->menu_item = menu_item;
592 }
593 MainDumpsSubMenu::~MainDumpsSubMenu()
594 {
595 }
596
597
598 MainDumpsMenu::MainDumpsMenu(MWindow *mwindow)
599  : BC_MenuItem(_("Dumps..."))
600 {
601         this->mwindow = mwindow;
602         this->dumps_menu = 0;
603 }
604 MainDumpsMenu::~MainDumpsMenu()
605 {
606 }
607
608 void MainDumpsMenu::create_objects()
609 {
610         add_submenu(dumps_menu = new MainDumpsSubMenu(this));
611 //      dumps_menu->add_item(new DumpCICache(mwindow));
612         dumps_menu->add_item(new DumpEDL(mwindow));
613         dumps_menu->add_item(new DumpPlugins(mwindow));
614         dumps_menu->add_item(new DumpAssets(mwindow));
615         dumps_menu->add_item(new DumpUndo(mwindow));
616 };
617
618
619 DumpCICache::DumpCICache(MWindow *mwindow)
620  : BC_MenuItem(_("Dump CICache"))
621 { this->mwindow = mwindow; }
622
623 int DumpCICache::handle_event()
624 {
625 //      mwindow->cache->dump();
626         return 1;
627 }
628
629 DumpEDL::DumpEDL(MWindow *mwindow)
630  : BC_MenuItem(_("Dump EDL"))
631 {
632         this->mwindow = mwindow;
633 }
634
635 int DumpEDL::handle_event()
636 {
637         mwindow->dump_edl();
638         return 1;
639 }
640
641 DumpPlugins::DumpPlugins(MWindow *mwindow)
642  : BC_MenuItem(_("Dump Plugins"))
643 {
644         this->mwindow = mwindow;
645 }
646
647 int DumpPlugins::handle_event()
648 {
649         mwindow->dump_plugins();
650         return 1;
651 }
652
653 DumpAssets::DumpAssets(MWindow *mwindow)
654  : BC_MenuItem(_("Dump Assets"))
655 { this->mwindow = mwindow; }
656
657 int DumpAssets::handle_event()
658 {
659         mwindow->edl->assets->dump();
660         return 1;
661 }
662
663 DumpUndo::DumpUndo(MWindow *mwindow)
664  : BC_MenuItem(_("Dump Undo"))
665 {
666         this->mwindow = mwindow;
667 }
668
669 int DumpUndo::handle_event()
670 {
671         mwindow->dump_undo();
672         return 1;
673 }
674
675 // ================================================= edit
676
677 Undo::Undo(MWindow *mwindow) : BC_MenuItem(_("Undo"), "z", 'z')
678 {
679         this->mwindow = mwindow;
680 }
681 int Undo::handle_event()
682 {
683         if( mwindow->session->current_operation == NO_OPERATION )
684                 mwindow->undo_entry(mwindow->gui);
685         return 1;
686 }
687 int Undo::update_caption(const char *new_caption)
688 {
689         char string[BCTEXTLEN];
690         sprintf(string, _("Undo %s"), new_caption);
691         set_text(string);
692         return 0;
693 }
694
695
696 Redo::Redo(MWindow *mwindow) : BC_MenuItem(_("Redo"), _("Shift-Z"), 'Z')
697 {
698         set_shift(1);
699         this->mwindow = mwindow;
700 }
701
702 int Redo::handle_event()
703 {
704         if( mwindow->session->current_operation == NO_OPERATION )
705                 mwindow->redo_entry(mwindow->gui);
706         return 1;
707 }
708 int Redo::update_caption(const char *new_caption)
709 {
710         char string[BCTEXTLEN];
711         sprintf(string, _("Redo %s"), new_caption);
712         set_text(string);
713         return 0;
714 }
715
716 CutKeyframes::CutKeyframes(MWindow *mwindow)
717  : BC_MenuItem(_("Cut keyframes"), _("Shift-X"), 'X')
718 {
719         set_shift();
720         this->mwindow = mwindow;
721 }
722
723 int CutKeyframes::handle_event()
724 {
725         if( mwindow->session->current_operation == NO_OPERATION )
726                 mwindow->cut_automation();
727         return 1;
728 }
729
730 CopyKeyframes::CopyKeyframes(MWindow *mwindow)
731  : BC_MenuItem(_("Copy keyframes"), _("Shift-C"), 'C')
732 {
733         set_shift();
734         this->mwindow = mwindow;
735 }
736
737 int CopyKeyframes::handle_event()
738 {
739         if( mwindow->session->current_operation == NO_OPERATION )
740                 mwindow->copy_automation();
741         return 1;
742 }
743
744 PasteKeyframes::PasteKeyframes(MWindow *mwindow)
745  : BC_MenuItem(_("Paste keyframes"), _("Shift-V"), 'V')
746 {
747         set_shift();
748         this->mwindow = mwindow;
749 }
750
751 int PasteKeyframes::handle_event()
752 {
753         if( mwindow->session->current_operation == NO_OPERATION )
754                 mwindow->paste_automation();
755         return 1;
756 }
757
758 ClearKeyframes::ClearKeyframes(MWindow *mwindow)
759  : BC_MenuItem(_("Clear keyframes"), _("Shift-Del"), DELETE)
760 {
761         set_shift();
762         this->mwindow = mwindow;
763 }
764
765 int ClearKeyframes::handle_event()
766 {
767         if( mwindow->session->current_operation == NO_OPERATION )
768                 mwindow->clear_automation();
769         return 1;
770 }
771
772
773
774 StraightenKeyframes::StraightenKeyframes(MWindow *mwindow)
775  : BC_MenuItem(_("Change to linear"))
776 {
777         this->mwindow = mwindow;
778 }
779
780 int StraightenKeyframes::handle_event()
781 {
782         mwindow->set_automation_mode(FloatAuto::LINEAR);
783         return 1;
784 }
785
786
787
788
789 BendKeyframes::BendKeyframes(MWindow *mwindow)
790  : BC_MenuItem(_("Change to smooth"))
791 {
792         this->mwindow = mwindow;
793 }
794
795 int BendKeyframes::handle_event()
796 {
797         mwindow->set_automation_mode(FloatAuto::SMOOTH);
798         return 1;
799 }
800
801
802
803 KeyframeCurveType::KeyframeCurveType(MWindow *mwindow)
804  : BC_MenuItem(_("Create curve type..."))
805 {
806         this->mwindow = mwindow;
807         this->curve_menu = 0;
808 }
809 KeyframeCurveType::~KeyframeCurveType()
810 {
811 }
812
813 void KeyframeCurveType::create_objects()
814 {
815         add_submenu(curve_menu = new KeyframeCurveTypeMenu(this));
816         for( int i=FloatAuto::SMOOTH; i<=FloatAuto::FREE; ++i ) {
817                 KeyframeCurveTypeItem *curve_type_item = new KeyframeCurveTypeItem(i, this);
818                 curve_menu->add_submenuitem(curve_type_item);
819         }
820 }
821
822 void KeyframeCurveType::update(int curve_type)
823 {
824         for( int i=0; i<curve_menu->total_items(); ++i ) {
825                 KeyframeCurveTypeItem *curve_type_item = (KeyframeCurveTypeItem *)curve_menu->get_item(i);
826                 curve_type_item->set_checked(curve_type_item->type == curve_type);
827         }
828 }
829
830 int KeyframeCurveType::handle_event()
831 {
832         return 1;
833 }
834
835 KeyframeCurveTypeMenu::KeyframeCurveTypeMenu(KeyframeCurveType *menu_item)
836  : BC_SubMenu()
837 {
838         this->menu_item = menu_item;
839 }
840 KeyframeCurveTypeMenu::~KeyframeCurveTypeMenu()
841 {
842 }
843
844 KeyframeCurveTypeItem::KeyframeCurveTypeItem(int type, KeyframeCurveType *main_item)
845  : BC_MenuItem(FloatAuto::curve_name(type))
846 {
847         this->type = type;
848         this->main_item = main_item;
849 }
850 KeyframeCurveTypeItem::~KeyframeCurveTypeItem()
851 {
852 }
853
854 int KeyframeCurveTypeItem::handle_event()
855 {
856         main_item->update(type);
857         main_item->mwindow->set_keyframe_type(type);
858         return 1;
859 }
860
861
862 CutDefaultKeyframe::CutDefaultKeyframe(MWindow *mwindow)
863  : BC_MenuItem(_("Cut default keyframe"), _("Alt-x"), 'x')
864 {
865         set_alt();
866         this->mwindow = mwindow;
867 }
868
869 int CutDefaultKeyframe::handle_event()
870 {
871         if( mwindow->session->current_operation == NO_OPERATION )
872                 mwindow->cut_default_keyframe();
873         return 1;
874 }
875
876 CopyDefaultKeyframe::CopyDefaultKeyframe(MWindow *mwindow)
877  : BC_MenuItem(_("Copy default keyframe"), _("Alt-c"), 'c')
878 {
879         set_alt();
880         this->mwindow = mwindow;
881 }
882
883 int CopyDefaultKeyframe::handle_event()
884 {
885         if( mwindow->session->current_operation == NO_OPERATION )
886                 mwindow->copy_default_keyframe();
887         return 1;
888 }
889
890 PasteDefaultKeyframe::PasteDefaultKeyframe(MWindow *mwindow)
891  : BC_MenuItem(_("Paste default keyframe"), _("Alt-v"), 'v')
892 {
893         set_alt();
894         this->mwindow = mwindow;
895 }
896
897 int PasteDefaultKeyframe::handle_event()
898 {
899         if( mwindow->session->current_operation == NO_OPERATION )
900                 mwindow->paste_default_keyframe();
901         return 1;
902 }
903
904 ClearDefaultKeyframe::ClearDefaultKeyframe(MWindow *mwindow)
905  : BC_MenuItem(_("Clear default keyframe"), _("Alt-Del"), DELETE)
906 {
907         set_alt();
908         this->mwindow = mwindow;
909 }
910
911 int ClearDefaultKeyframe::handle_event()
912 {
913         if( mwindow->session->current_operation == NO_OPERATION )
914                 mwindow->clear_default_keyframe();
915         return 1;
916 }
917
918 Cut::Cut(MWindow *mwindow)
919  : BC_MenuItem(_("Split | Cut"), "x", 'x')
920 {
921         this->mwindow = mwindow;
922 }
923
924 int Cut::handle_event()
925 {
926         if( mwindow->session->current_operation == NO_OPERATION )
927                 mwindow->cut();
928         return 1;
929 }
930
931 Copy::Copy(MWindow *mwindow)
932  : BC_MenuItem(_("Copy"), "c", 'c')
933 {
934         this->mwindow = mwindow;
935 }
936
937 int Copy::handle_event()
938 {
939         if( mwindow->session->current_operation == NO_OPERATION )
940                 mwindow->copy();
941         return 1;
942 }
943
944 Paste::Paste(MWindow *mwindow)
945  : BC_MenuItem(_("Paste"), "v", 'v')
946 {
947         this->mwindow = mwindow;
948 }
949
950 int Paste::handle_event()
951 {
952         if( mwindow->session->current_operation == NO_OPERATION )
953                 mwindow->paste();
954         return 1;
955 }
956
957 Clear::Clear(MWindow *mwindow)
958  : BC_MenuItem(_("Clear"), _("Del"), DELETE)
959 {
960         this->mwindow = mwindow;
961 }
962
963 int Clear::handle_event()
964 {
965         if( mwindow->session->current_operation == NO_OPERATION ) {
966                 mwindow->cwindow->gui->lock_window("Clear::handle_event");
967                 mwindow->clear_entry();
968                 mwindow->cwindow->gui->unlock_window();
969         }
970         return 1;
971 }
972
973 PasteSilence::PasteSilence(MWindow *mwindow)
974  : BC_MenuItem(_("Paste silence"), _("Shift-Space"), ' ')
975 {
976         this->mwindow = mwindow;
977         set_shift();
978 }
979
980 int PasteSilence::handle_event()
981 {
982         if( mwindow->session->current_operation == NO_OPERATION )
983                 mwindow->paste_silence();
984         return 1;
985 }
986
987 SelectAll::SelectAll(MWindow *mwindow)
988  : BC_MenuItem(_("Select All"), "a", 'a')
989 {
990         this->mwindow = mwindow;
991 }
992
993 int SelectAll::handle_event()
994 {
995         if( mwindow->session->current_operation == NO_OPERATION )
996                 mwindow->select_all();
997         return 1;
998 }
999
1000 ClearLabels::ClearLabels(MWindow *mwindow) : BC_MenuItem(_("Clear labels"))
1001 {
1002         this->mwindow = mwindow;
1003 }
1004
1005 int ClearLabels::handle_event()
1006 {
1007         mwindow->clear_labels();
1008         return 1;
1009 }
1010
1011 CutCommercials::CutCommercials(MWindow *mwindow) : BC_MenuItem(_("Cut ads"))
1012 {
1013         this->mwindow = mwindow;
1014 }
1015
1016 int CutCommercials::handle_event()
1017 {
1018         mwindow->cut_commercials();
1019         return 1;
1020 }
1021
1022 DetachTransitions::DetachTransitions(MWindow *mwindow)
1023  : BC_MenuItem(_("Detach transitions"))
1024 {
1025         this->mwindow = mwindow;
1026 }
1027
1028 int DetachTransitions::handle_event()
1029 {
1030         mwindow->detach_transitions();
1031         return 1;
1032 }
1033
1034 MuteSelection::MuteSelection(MWindow *mwindow)
1035  : BC_MenuItem(_("Mute Region"), "m", 'm')
1036 {
1037         this->mwindow = mwindow;
1038 }
1039
1040 int MuteSelection::handle_event()
1041 {
1042         if( mwindow->session->current_operation == NO_OPERATION )
1043                 mwindow->mute_selection();
1044         return 1;
1045 }
1046
1047
1048 TrimSelection::TrimSelection(MWindow *mwindow)
1049  : BC_MenuItem(_("Trim Selection"))
1050 {
1051         this->mwindow = mwindow;
1052 }
1053
1054 int TrimSelection::handle_event()
1055 {
1056         mwindow->trim_selection();
1057         return 1;
1058 }
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071 // ============================================= audio
1072
1073 AddAudioTrack::AddAudioTrack(MWindow *mwindow)
1074  : BC_MenuItem(_("Add track"), "t", 't')
1075 {
1076         this->mwindow = mwindow;
1077 }
1078
1079 int AddAudioTrack::handle_event()
1080 {
1081         if( mwindow->session->current_operation == NO_OPERATION )
1082                 mwindow->add_audio_track_entry(0, 0);
1083         return 1;
1084 }
1085
1086 DeleteAudioTrack::DeleteAudioTrack(MWindow *mwindow)
1087  : BC_MenuItem(_("Delete track"))
1088 {
1089         this->mwindow = mwindow;
1090 }
1091
1092 int DeleteAudioTrack::handle_event()
1093 {
1094         return 1;
1095 }
1096
1097 DefaultATransition::DefaultATransition(MWindow *mwindow)
1098  : BC_MenuItem(_("Default Transition"), "u", 'u')
1099 {
1100         this->mwindow = mwindow;
1101 }
1102
1103 int DefaultATransition::handle_event()
1104 {
1105         if( mwindow->session->current_operation == NO_OPERATION )
1106                 mwindow->paste_audio_transition();
1107         return 1;
1108 }
1109
1110
1111 MapAudio1::MapAudio1(MWindow *mwindow)
1112  : BC_MenuItem(_("Map 1:1"))
1113 {
1114         this->mwindow = mwindow;
1115 }
1116
1117 int MapAudio1::handle_event()
1118 {
1119         mwindow->map_audio(MWindow::AUDIO_1_TO_1);
1120         return 1;
1121 }
1122
1123 MapAudio2::MapAudio2(MWindow *mwindow)
1124  : BC_MenuItem(_("Map 5.1:2"))
1125 {
1126         this->mwindow = mwindow;
1127 }
1128
1129 int MapAudio2::handle_event()
1130 {
1131         mwindow->map_audio(MWindow::AUDIO_5_1_TO_2);
1132         return 1;
1133 }
1134
1135
1136
1137
1138 // ============================================= video
1139
1140
1141 AddVideoTrack::AddVideoTrack(MWindow *mwindow)
1142  : BC_MenuItem(_("Add track"), _("Shift-T"), 'T')
1143 {
1144         set_shift();
1145         this->mwindow = mwindow;
1146 }
1147
1148 int AddVideoTrack::handle_event()
1149 {
1150         if( mwindow->session->current_operation == NO_OPERATION )
1151                 mwindow->add_video_track_entry();
1152         return 1;
1153 }
1154
1155
1156 DeleteVideoTrack::DeleteVideoTrack(MWindow *mwindow)
1157  : BC_MenuItem(_("Delete track"))
1158 {
1159         this->mwindow = mwindow;
1160 }
1161
1162 int DeleteVideoTrack::handle_event()
1163 {
1164         return 1;
1165 }
1166
1167
1168
1169 ResetTranslation::ResetTranslation(MWindow *mwindow)
1170  : BC_MenuItem(_("Reset Translation"))
1171 {
1172         this->mwindow = mwindow;
1173 }
1174
1175 int ResetTranslation::handle_event()
1176 {
1177         return 1;
1178 }
1179
1180
1181
1182 DefaultVTransition::DefaultVTransition(MWindow *mwindow)
1183  : BC_MenuItem(_("Default Transition"), _("Shift-U"), 'U')
1184 {
1185         set_shift();
1186         this->mwindow = mwindow;
1187 }
1188
1189 int DefaultVTransition::handle_event()
1190 {
1191         if( mwindow->session->current_operation == NO_OPERATION )
1192                 mwindow->paste_video_transition();
1193         return 1;
1194 }
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209 // ============================================ settings
1210
1211 DeleteTracks::DeleteTracks(MWindow *mwindow)
1212  : BC_MenuItem(_("Delete tracks"))
1213 {
1214         this->mwindow = mwindow;
1215 }
1216
1217 int DeleteTracks::handle_event()
1218 {
1219         mwindow->delete_tracks();
1220         return 1;
1221 }
1222
1223 DeleteTrack::DeleteTrack(MWindow *mwindow)
1224  : BC_MenuItem(_("Delete last track"), "d", 'd')
1225 {
1226         this->mwindow = mwindow;
1227 }
1228
1229 int DeleteTrack::handle_event()
1230 {
1231         if( mwindow->session->current_operation == NO_OPERATION )
1232                 mwindow->delete_track();
1233         return 1;
1234 }
1235
1236 MoveTracksUp::MoveTracksUp(MWindow *mwindow)
1237  : BC_MenuItem(_("Move tracks up"), _("Shift-Up"), UP)
1238 {
1239         set_shift(); this->mwindow = mwindow;
1240 }
1241
1242 int MoveTracksUp::handle_event()
1243 {
1244         if( mwindow->session->current_operation == NO_OPERATION )
1245                 mwindow->move_tracks_up();
1246         return 1;
1247 }
1248
1249 MoveTracksDown::MoveTracksDown(MWindow *mwindow)
1250  : BC_MenuItem(_("Move tracks down"), _("Shift-Down"), DOWN)
1251 {
1252         set_shift(); this->mwindow = mwindow;
1253 }
1254
1255 int MoveTracksDown::handle_event()
1256 {
1257         if( mwindow->session->current_operation == NO_OPERATION )
1258                 mwindow->move_tracks_down();
1259         return 1;
1260 }
1261
1262
1263
1264
1265 ConcatenateTracks::ConcatenateTracks(MWindow *mwindow)
1266  : BC_MenuItem(_("Concatenate tracks"))
1267 {
1268         set_shift();
1269         this->mwindow = mwindow;
1270 }
1271
1272 int ConcatenateTracks::handle_event()
1273 {
1274         mwindow->concatenate_tracks();
1275         return 1;
1276 }
1277
1278
1279
1280
1281
1282 LoopPlayback::LoopPlayback(MWindow *mwindow)
1283  : BC_MenuItem(_("Loop Playback"), _("Shift-L"), 'L')
1284 {
1285         this->mwindow = mwindow;
1286         set_checked(mwindow->edl->local_session->loop_playback);
1287         set_shift();
1288 }
1289
1290 int LoopPlayback::handle_event()
1291 {
1292         if( mwindow->session->current_operation == NO_OPERATION ) {
1293                 mwindow->toggle_loop_playback();
1294                 set_checked(mwindow->edl->local_session->loop_playback);
1295         }
1296         return 1;
1297 }
1298
1299
1300
1301 // ============================================= subtitle
1302
1303
1304 AddSubttlTrack::AddSubttlTrack(MWindow *mwindow)
1305  : BC_MenuItem(_("Add subttl"), _("Shift-Y"), 'Y')
1306 {
1307         set_shift();
1308         this->mwindow = mwindow;
1309 }
1310
1311 int AddSubttlTrack::handle_event()
1312 {
1313         if( mwindow->session->current_operation == NO_OPERATION )
1314                 mwindow->add_subttl_track_entry();
1315         return 1;
1316 }
1317
1318 PasteSubttl::PasteSubttl(MWindow *mwindow)
1319  : BC_MenuItem(_("paste subttl"), "y", 'y')
1320 {
1321         this->mwindow = mwindow;
1322 }
1323
1324 int PasteSubttl::handle_event()
1325 {
1326         if( mwindow->session->current_operation == NO_OPERATION )
1327                 mwindow->gui->swindow->paste_subttl();
1328         return 1;
1329 }
1330
1331
1332 SetBRenderActive::SetBRenderActive(MWindow *mwindow)
1333  : BC_MenuItem(_("Toggle background rendering"),_("Shift-G"),'G')
1334 {
1335         this->mwindow = mwindow;
1336         set_shift(1);
1337 }
1338
1339 int SetBRenderActive::handle_event()
1340 {
1341         if( mwindow->session->current_operation == NO_OPERATION ) {
1342                 int v = mwindow->brender_active ? 0 : 1;
1343                 set_checked(v);
1344                 mwindow->set_brender_active(v);
1345         }
1346         return 1;
1347 }
1348
1349
1350 LabelsFollowEdits::LabelsFollowEdits(MWindow *mwindow)
1351  : BC_MenuItem(_("Edit labels"))
1352 {
1353         this->mwindow = mwindow;
1354         set_checked(mwindow->edl->session->labels_follow_edits);
1355 }
1356
1357 int LabelsFollowEdits::handle_event()
1358 {
1359         set_checked(get_checked() ^ 1);
1360         mwindow->set_labels_follow_edits(get_checked());
1361         return 1;
1362 }
1363
1364
1365
1366
1367 PluginsFollowEdits::PluginsFollowEdits(MWindow *mwindow)
1368  : BC_MenuItem(_("Edit effects"))
1369 {
1370         this->mwindow = mwindow;
1371         set_checked(mwindow->edl->session->plugins_follow_edits);
1372 }
1373
1374 int PluginsFollowEdits::handle_event()
1375 {
1376         set_checked(get_checked() ^ 1);
1377         mwindow->edl->session->plugins_follow_edits = get_checked();
1378         return 1;
1379 }
1380
1381
1382
1383
1384 KeyframesFollowEdits::KeyframesFollowEdits(MWindow *mwindow)
1385  : BC_MenuItem(_("Keyframes follow edits"))
1386 {
1387         this->mwindow = mwindow;
1388         set_checked(mwindow->edl->session->autos_follow_edits);
1389 }
1390
1391 int KeyframesFollowEdits::handle_event()
1392 {
1393         mwindow->edl->session->autos_follow_edits ^= 1;
1394         set_checked(!get_checked());
1395         return 1;
1396 }
1397
1398
1399 CursorOnFrames::CursorOnFrames(MWindow *mwindow)
1400  : BC_MenuItem(_("Align cursor on frames"),_("Ctrl-a"),'a')
1401 {
1402         this->mwindow = mwindow;
1403         set_checked(mwindow->edl->session->cursor_on_frames);
1404         set_ctrl(1);
1405 }
1406
1407 int CursorOnFrames::handle_event()
1408 {
1409         mwindow->edl->session->cursor_on_frames = !mwindow->edl->session->cursor_on_frames;
1410         set_checked(mwindow->edl->session->cursor_on_frames);
1411         return 1;
1412 }
1413
1414
1415 TypelessKeyframes::TypelessKeyframes(MWindow *mwindow)
1416  : BC_MenuItem(_("Typeless keyframes"))
1417 {
1418         this->mwindow = mwindow;
1419         set_checked(mwindow->edl->session->typeless_keyframes);
1420 }
1421
1422 int TypelessKeyframes::handle_event()
1423 {
1424         mwindow->edl->session->typeless_keyframes = !mwindow->edl->session->typeless_keyframes;
1425         set_checked(mwindow->edl->session->typeless_keyframes);
1426         return 1;
1427 }
1428
1429
1430 ScrubSpeed::ScrubSpeed(MWindow *mwindow)
1431  : BC_MenuItem(_("Slow Shuttle"))
1432 {
1433         this->mwindow = mwindow;
1434 }
1435
1436 int ScrubSpeed::handle_event()
1437 {
1438         if(mwindow->edl->session->scrub_speed == .5)
1439         {
1440                 mwindow->edl->session->scrub_speed = 2;
1441                 set_text(_("Slow Shuttle"));
1442         }
1443         else
1444         {
1445                 mwindow->edl->session->scrub_speed = .5;
1446                 set_text(_("Fast Shuttle"));
1447         }
1448         return 1;
1449 }
1450
1451 SaveSettingsNow::SaveSettingsNow(MWindow *mwindow)
1452  : BC_MenuItem(_("Save settings now"),_("Ctrl-s"),'s')
1453 {
1454         this->mwindow = mwindow;
1455         set_ctrl(1);
1456 }
1457
1458 int SaveSettingsNow::handle_event()
1459 {
1460         mwindow->save_defaults();
1461         mwindow->save_backup();
1462         mwindow->gui->show_message(_("Saved settings."));
1463         return 1;
1464 }
1465
1466
1467
1468 // ============================================ window
1469
1470
1471
1472
1473
1474 ShowVWindow::ShowVWindow(MWindow *mwindow)
1475  : BC_MenuItem(_("Show Viewer"))
1476 {
1477         this->mwindow = mwindow;
1478         set_checked(mwindow->session->show_vwindow);
1479 }
1480 int ShowVWindow::handle_event()
1481 {
1482         mwindow->show_vwindow();
1483         return 1;
1484 }
1485
1486 ShowAWindow::ShowAWindow(MWindow *mwindow)
1487  : BC_MenuItem(_("Show Resources"))
1488 {
1489         this->mwindow = mwindow;
1490         set_checked(mwindow->session->show_awindow);
1491 }
1492 int ShowAWindow::handle_event()
1493 {
1494         mwindow->show_awindow();
1495         return 1;
1496 }
1497
1498 ShowCWindow::ShowCWindow(MWindow *mwindow)
1499  : BC_MenuItem(_("Show Compositor"))
1500 {
1501         this->mwindow = mwindow;
1502         set_checked(mwindow->session->show_cwindow);
1503 }
1504 int ShowCWindow::handle_event()
1505 {
1506         mwindow->show_cwindow();
1507         return 1;
1508 }
1509
1510
1511 ShowGWindow::ShowGWindow(MWindow *mwindow)
1512  : BC_MenuItem(_("Show Overlays"), _("Ctrl-0"), '0')
1513 {
1514         this->mwindow = mwindow;
1515         set_ctrl(1);
1516         set_checked(mwindow->session->show_gwindow);
1517 }
1518 int ShowGWindow::handle_event()
1519 {
1520         if( mwindow->session->current_operation == NO_OPERATION ) {
1521                 if( !mwindow->session->show_gwindow )
1522                         mwindow->show_gwindow();
1523                 else
1524                         mwindow->hide_gwindow();
1525                 set_checked(mwindow->session->show_gwindow);
1526         }
1527         return 1;
1528 }
1529
1530
1531 ShowLWindow::ShowLWindow(MWindow *mwindow)
1532  : BC_MenuItem(_("Show Levels"))
1533 {
1534         this->mwindow = mwindow;
1535         set_checked(mwindow->session->show_lwindow);
1536 }
1537 int ShowLWindow::handle_event()
1538 {
1539         mwindow->show_lwindow();
1540         return 1;
1541 }
1542
1543 TileWindows::TileWindows(MWindow *mwindow, const char *item_title, int config,
1544                 const char *hot_keytext, int hot_key)
1545  : BC_MenuItem(item_title, hot_keytext, hot_key)
1546 {
1547         this->mwindow = mwindow;
1548         this->config = config;
1549         if( hot_key ) set_ctrl(1);
1550 }
1551 int TileWindows::handle_event()
1552 {
1553         if( mwindow->session->current_operation == NO_OPERATION ) {
1554                 int window_config = config >= 0 ? config :
1555                         mwindow->session->window_config;
1556                 if( mwindow->tile_windows(window_config) ) {
1557                         mwindow->restart_status = 1;
1558                         mwindow->gui->set_done(0);
1559                 }
1560         }
1561         return 1;
1562 }
1563
1564 SplitX::SplitX(MWindow *mwindow)
1565  : BC_MenuItem(_("Split X pane"), _("Ctrl-1"), '1')
1566 {
1567         this->mwindow = mwindow;
1568         set_ctrl(1);
1569         set_checked(mwindow->gui->pane[TOP_RIGHT_PANE] != 0);
1570 }
1571 int SplitX::handle_event()
1572 {
1573         if( mwindow->session->current_operation == NO_OPERATION )
1574                 mwindow->split_x();
1575         return 1;
1576 }
1577
1578 SplitY::SplitY(MWindow *mwindow)
1579  : BC_MenuItem(_("Split Y pane"), _("Ctrl-2"), '2')
1580 {
1581         this->mwindow = mwindow;
1582         set_ctrl(1);
1583         set_checked(mwindow->gui->pane[BOTTOM_LEFT_PANE] != 0);
1584 }
1585 int SplitY::handle_event()
1586 {
1587         if( mwindow->session->current_operation == NO_OPERATION )
1588                 mwindow->split_y();
1589         return 1;
1590 }
1591
1592
1593 MixerViewer::MixerViewer(MWindow *mwindow)
1594  : BC_MenuItem(_("Mixer Viewer"), _("Shift-M"), 'M')
1595 {
1596         this->mwindow = mwindow;
1597         set_shift(1);
1598 }
1599
1600 int MixerViewer::handle_event()
1601 {
1602         mwindow->start_mixer();
1603         return 1;
1604 }
1605
1606 TileMixers::TileMixers(MWindow *mwindow)
1607  : BC_MenuItem(_("Tile mixers"), "Alt-t", 't')
1608 {
1609         this->mwindow = mwindow;
1610         set_alt();
1611 }
1612
1613 int TileMixers::handle_event()
1614 {
1615         mwindow->tile_mixers();
1616         return 1;
1617 }
1618
1619
1620 LoadLayoutItem::LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey)
1621  : BC_MenuItem(text, "", hotkey)
1622 {
1623         this->no = no;
1624         this->load_layout = load_layout;
1625         if( hotkey ) {
1626                 char hot_txt[BCSTRLEN];
1627                 sprintf(hot_txt, _("Ctrl-Shift+F%d"), hotkey-KEY_F1+1);
1628                 set_ctrl();  set_shift();
1629                 set_hotkey_text(hot_txt);
1630         }
1631 }
1632
1633 int LoadLayoutItem::handle_event()
1634 {
1635         MWindow *mwindow = load_layout->mwindow;
1636         switch( load_layout->action ) {
1637         case LAYOUT_LOAD:
1638                 mwindow->load_layout(no);
1639                 break;
1640         case LAYOUT_SAVE:
1641                 mwindow->save_layout(no);
1642                 break;
1643         }
1644         return 1;
1645 }
1646
1647 LoadLayout::LoadLayout(MWindow *mwindow, const char *text, int action)
1648  : BC_MenuItem(text)
1649 {
1650         this->mwindow = mwindow;
1651         this->action = action;
1652 }
1653
1654 void LoadLayout::create_objects()
1655 {
1656         BC_SubMenu *layout_submenu = new BC_SubMenu();
1657         add_submenu(layout_submenu);
1658         for( int i=1; i<=4; ++i ) {
1659                 char text[BCSTRLEN];
1660                 sprintf(text, _("Layout %d"), i);
1661                 LoadLayoutItem *load_layout_item =
1662                         new LoadLayoutItem(this, text, i,
1663                                 action==LAYOUT_LOAD ? KEY_F1-1+i : 0);
1664                 layout_submenu->add_submenuitem(load_layout_item);
1665         }
1666 }
1667