Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

mainmenu.C

Go to the documentation of this file.
00001 #include "assets.h"
00002 #include "batchrender.h"
00003 #include "bcsignals.h"
00004 #include "cache.h"
00005 #include "cplayback.h"
00006 #include "cropvideo.h"
00007 #include "cwindow.h"
00008 #include "cwindowgui.h"
00009 #include "defaults.h"
00010 #include "edl.h"
00011 #include "edlsession.h"
00012 #include "featheredits.h"
00013 #include "filesystem.h"
00014 #include "filexml.h"
00015 #include "keys.h"
00016 #include "language.h"
00017 #include "levelwindow.h"
00018 #include "loadfile.h"
00019 #include "localsession.h"
00020 #include "mainclock.h"
00021 #include "mainmenu.h"
00022 #include "mainsession.h"
00023 #include "mainundo.h"
00024 #include "menuaeffects.h"
00025 #include "menuveffects.h"
00026 #include "mwindowgui.h"
00027 #include "mwindow.h"
00028 #include "new.h"
00029 #include "patchbay.h"
00030 #include "playbackengine.h"
00031 #include "preferences.h"
00032 #include "preferencesthread.h"
00033 #include "quit.h"
00034 #include "record.h"
00035 #include "render.h"
00036 #include "savefile.h"
00037 #include "setformat.h"
00038 #include "timebar.h"
00039 #include "trackcanvas.h"
00040 #include "tracks.h"
00041 #include "transition.h"
00042 #include "transportque.h"
00043 #include "viewmenu.h"
00044 #include "zoombar.h"
00045 
00046 #include <string.h>
00047 
00048 
00049 MainMenu::MainMenu(MWindow *mwindow, MWindowGUI *gui)
00050  : BC_MenuBar(0, 0, gui->get_w())
00051 {
00052         this->gui = gui;
00053         this->mwindow = mwindow; 
00054 }
00055 
00056 MainMenu::~MainMenu()
00057 {
00058 }
00059 
00060 int MainMenu::create_objects()
00061 {
00062         BC_Menu *viewmenu, *windowmenu, *settingsmenu, *trackmenu;
00063         PreferencesMenuitem *preferences;
00064 
00065         recent_load = new BC_RecentList("PATH", mwindow->defaults);
00066 SET_TRACE
00067 
00068         add_menu(filemenu = new BC_Menu(_("File")));
00069         filemenu->add_item(new_project = new New(mwindow));
00070         new_project->create_objects();
00071 
00072 SET_TRACE
00073 // file loaders
00074         filemenu->add_item(load_file = new Load(mwindow, this));
00075         load_file->create_objects();
00076 
00077 SET_TRACE
00078 // new and load can be undone so no need to prompt save
00079         Save *save;                   //  affected by saveas
00080         filemenu->add_item(save = new Save(mwindow));
00081         SaveAs *saveas;
00082         filemenu->add_item(saveas = new SaveAs(mwindow));
00083         save->create_objects(saveas);
00084         saveas->set_mainmenu(this);
00085         filemenu->add_item(record = new RecordMenuItem(mwindow));
00086 
00087         filemenu->add_item(render = new RenderItem(mwindow));
00088         filemenu->add_item(new BatchRenderMenuItem(mwindow));
00089         filemenu->add_item(new BC_MenuItem("-"));
00090         filemenu->add_item(quit_program = new Quit(mwindow));
00091         quit_program->create_objects(save);
00092         filemenu->add_item(new DumpEDL(mwindow));
00093         filemenu->add_item(new DumpPlugins(mwindow));
00094         filemenu->add_item(new LoadBackup(mwindow));
00095         filemenu->add_item(new SaveBackup(mwindow));
00096 
00097         BC_Menu *editmenu;
00098         add_menu(editmenu = new BC_Menu(_("Edit")));
00099         editmenu->add_item(undo = new Undo(mwindow));
00100         editmenu->add_item(redo = new Redo(mwindow));
00101         editmenu->add_item(new BC_MenuItem("-"));
00102         editmenu->add_item(new Cut(mwindow));
00103         editmenu->add_item(new Copy(mwindow));
00104         editmenu->add_item(new Paste(mwindow));
00105         editmenu->add_item(new Clear(mwindow));
00106         editmenu->add_item(new PasteSilence(mwindow));
00107         editmenu->add_item(new MuteSelection(mwindow));
00108         editmenu->add_item(new TrimSelection(mwindow));
00109         editmenu->add_item(new SelectAll(mwindow));
00110         editmenu->add_item(new BC_MenuItem("-"));
00111         editmenu->add_item(new ClearLabels(mwindow));
00112 
00113         BC_Menu *keyframemenu;
00114         add_menu(keyframemenu = new BC_Menu(_("Keyframes")));
00115         keyframemenu->add_item(new CutKeyframes(mwindow));
00116         keyframemenu->add_item(new CopyKeyframes(mwindow));
00117         keyframemenu->add_item(new PasteKeyframes(mwindow));
00118         keyframemenu->add_item(new ClearKeyframes(mwindow));
00119         keyframemenu->add_item(new BC_MenuItem("-"));
00120         keyframemenu->add_item(new CopyDefaultKeyframe(mwindow));
00121         keyframemenu->add_item(new PasteDefaultKeyframe(mwindow));
00122 
00123 
00124 
00125 
00126         add_menu(audiomenu = new BC_Menu(_("Audio")));
00127         audiomenu->add_item(new AddAudioTrack(mwindow));
00128         audiomenu->add_item(new DefaultATransition(mwindow));
00129         audiomenu->add_item(aeffects = new MenuAEffects(mwindow));
00130 
00131         add_menu(videomenu = new BC_Menu(_("Video")));
00132         videomenu->add_item(new AddVideoTrack(mwindow));
00133         videomenu->add_item(new DefaultVTransition(mwindow));
00134         videomenu->add_item(veffects = new MenuVEffects(mwindow));
00135 
00136         add_menu(trackmenu = new BC_Menu(_("Tracks")));
00137         trackmenu->add_item(new MoveTracksUp(mwindow));
00138         trackmenu->add_item(new MoveTracksDown(mwindow));
00139         trackmenu->add_item(new DeleteTracks(mwindow));
00140         trackmenu->add_item(new DeleteTrack(mwindow));
00141         trackmenu->add_item(new ConcatenateTracks(mwindow));
00142 
00143         add_menu(settingsmenu = new BC_Menu(_("Settings")));
00144 
00145         settingsmenu->add_item(new SetFormat(mwindow));
00146         settingsmenu->add_item(preferences = new PreferencesMenuitem(mwindow));
00147         mwindow->preferences_thread = preferences->thread;
00148         settingsmenu->add_item(labels_follow_edits = new LabelsFollowEdits(mwindow));
00149         settingsmenu->add_item(plugins_follow_edits = new PluginsFollowEdits(mwindow));
00150         settingsmenu->add_item(cursor_on_frames = new CursorOnFrames(mwindow));
00151         settingsmenu->add_item(new SaveSettingsNow(mwindow));
00152         settingsmenu->add_item(loop_playback = new LoopPlayback(mwindow));
00153         settingsmenu->add_item(new SetBRenderStart(mwindow));
00154 // set scrubbing speed
00155 //      ScrubSpeed *scrub_speed;
00156 //      settingsmenu->add_item(scrub_speed = new ScrubSpeed(mwindow));
00157 //      if(mwindow->edl->session->scrub_speed == .5) 
00158 //              scrub_speed->set_text(_("Fast Shuttle"));
00159 
00160 
00161 
00162 
00163 
00164 
00165         add_menu(viewmenu = new BC_Menu(_("View")));
00166         viewmenu->add_item(show_assets = new ShowAssets(mwindow, "0"));
00167         viewmenu->add_item(show_titles = new ShowTitles(mwindow, "1"));
00168         viewmenu->add_item(show_transitions = new ShowTransitions(mwindow, "2"));
00169         viewmenu->add_item(fade_automation = new ShowAutomation(mwindow, _("Fade"), "3", AUTOMATION_FADE));
00170         viewmenu->add_item(mute_automation = new ShowAutomation(mwindow, _("Mute"), "4", AUTOMATION_MUTE));
00171         viewmenu->add_item(mode_automation = new ShowAutomation(mwindow, _("Mode"), "5", AUTOMATION_MODE));
00172         viewmenu->add_item(pan_automation = new ShowAutomation(mwindow, _("Pan"), "6", AUTOMATION_PAN));
00173         viewmenu->add_item(plugin_automation = new PluginAutomation(mwindow, "7"));
00174         viewmenu->add_item(mask_automation = new ShowAutomation(mwindow, _("Mask"), "8", AUTOMATION_MASK));
00175         viewmenu->add_item(camera_x = new ShowAutomation(mwindow, _("Camera X"), "", AUTOMATION_CAMERA_X));
00176         viewmenu->add_item(camera_y = new ShowAutomation(mwindow, _("Camera Y"), "", AUTOMATION_CAMERA_Y));
00177         viewmenu->add_item(camera_z = new ShowAutomation(mwindow, _("Camera Z"), "", AUTOMATION_CAMERA_Z));
00178         viewmenu->add_item(project_x = new ShowAutomation(mwindow, _("Projector X"), "", AUTOMATION_PROJECTOR_X));
00179         viewmenu->add_item(project_y = new ShowAutomation(mwindow, _("Projector Y"), "", AUTOMATION_PROJECTOR_Y));
00180         viewmenu->add_item(project_z = new ShowAutomation(mwindow, _("Projector Z"), "", AUTOMATION_PROJECTOR_Z));
00181 
00182 
00183         add_menu(windowmenu = new BC_Menu(_("Window")));
00184         windowmenu->add_item(show_vwindow = new ShowVWindow(mwindow));
00185         windowmenu->add_item(show_awindow = new ShowAWindow(mwindow));
00186         windowmenu->add_item(show_cwindow = new ShowCWindow(mwindow));
00187         windowmenu->add_item(show_gwindow = new ShowGWindow(mwindow));
00188         windowmenu->add_item(show_lwindow = new ShowLWindow(mwindow));
00189         windowmenu->add_item(new TileWindows(mwindow));
00190 
00191 SET_TRACE
00192         return 0;
00193 }
00194 
00195 int MainMenu::load_defaults(Defaults *defaults)
00196 {
00197         init_loads(defaults);
00198         init_aeffects(defaults);
00199         init_veffects(defaults);
00200         return 0;
00201 }
00202 
00203 void MainMenu::update_toggles(int use_lock)
00204 {
00205         if(use_lock) lock_window("MainMenu::update_toggles");
00206         labels_follow_edits->set_checked(mwindow->edl->session->labels_follow_edits);
00207         plugins_follow_edits->set_checked(mwindow->edl->session->plugins_follow_edits);
00208         cursor_on_frames->set_checked(mwindow->edl->session->cursor_on_frames);
00209         loop_playback->set_checked(mwindow->edl->local_session->loop_playback);
00210         show_titles->set_checked(mwindow->edl->session->show_titles);
00211         show_transitions->set_checked(mwindow->edl->session->auto_conf->transitions);
00212         fade_automation->update_toggle();
00213         mute_automation->update_toggle();
00214         pan_automation->update_toggle();
00215         camera_x->update_toggle();
00216         camera_y->update_toggle();
00217         camera_z->update_toggle();
00218         project_x->update_toggle();
00219         project_y->update_toggle();
00220         project_z->update_toggle();
00221         plugin_automation->set_checked(mwindow->edl->session->auto_conf->plugins);
00222         mode_automation->update_toggle();
00223         mask_automation->update_toggle();
00224         if(use_lock) mwindow->gui->unlock_window();
00225 }
00226 
00227 int MainMenu::save_defaults(Defaults *defaults)
00228 {
00229         save_aeffects(defaults);
00230         save_veffects(defaults);
00231         return 0;
00232 }
00233 
00234 
00235 
00236 
00237 
00238 int MainMenu::quit()
00239 {
00240         quit_program->handle_event();
00241         return 0;
00242 }
00243 
00244 
00245 
00246 
00247 
00248 // ================================== load most recent
00249 
00250 int MainMenu::init_aeffects(Defaults *defaults)
00251 {
00252         total_aeffects = defaults->get("TOTAL_AEFFECTS", 0);
00253         
00254         char string[1024], title[1024];
00255         if(total_aeffects) audiomenu->add_item(new BC_MenuItem("-"));
00256         
00257         for(int i = 0; i < total_aeffects; i++)
00258         {
00259                 sprintf(string, "AEFFECTRECENT%d", i);
00260                 defaults->get(string, title);
00261                 audiomenu->add_item(aeffect[i] = new MenuAEffectItem(aeffects, title));
00262         }
00263         return 0;
00264 }
00265 
00266 int MainMenu::init_veffects(Defaults *defaults)
00267 {
00268         total_veffects = defaults->get("TOTAL_VEFFECTS", 0);
00269         
00270         char string[1024], title[1024];
00271         if(total_veffects) videomenu->add_item(new BC_MenuItem("-"));
00272         
00273         for(int i = 0; i < total_veffects; i++)
00274         {
00275                 sprintf(string, "VEFFECTRECENT%d", i);
00276                 defaults->get(string, title);
00277                 videomenu->add_item(veffect[i] = new MenuVEffectItem(veffects, title));
00278         }
00279         return 0;
00280 }
00281 
00282 int MainMenu::init_loads(Defaults *defaults)
00283 {
00284         char string[BCTEXTLEN], path[BCTEXTLEN], filename[BCTEXTLEN];
00285         FileSystem dir;
00286         
00287         recent_load->load_items();
00288 
00289         int total_loads = recent_load->items.total;
00290         if(total_loads > 0) filemenu->add_item(new BC_MenuItem("-"));
00291 
00292         for(int i = 0; i < total_loads; i++)
00293         {
00294                 char *path = recent_load->items.values[i]->get_text();
00295                 filemenu->add_item(load[i] = new LoadPrevious(mwindow));
00296                 dir.extract_name(filename, path, 0);
00297                 load[i]->set_text(filename);
00298                 load[i]->set_path(path);
00299         }
00300         return 0;
00301 }
00302 
00303 // ============================ save most recent
00304 
00305 int MainMenu::save_aeffects(Defaults *defaults)
00306 {
00307         defaults->update("TOTAL_AEFFECTS", total_aeffects);
00308         char string[1024];
00309         for(int i = 0; i < total_aeffects; i++)
00310         {
00311                 sprintf(string, "AEFFECTRECENT%d", i);
00312                 defaults->update(string, aeffect[i]->get_text());
00313         }
00314         return 0;
00315 }
00316 
00317 int MainMenu::save_veffects(Defaults *defaults)
00318 {
00319         defaults->update("TOTAL_VEFFECTS", total_veffects);
00320         char string[1024];
00321         for(int i = 0; i < total_veffects; i++)
00322         {
00323                 sprintf(string, "VEFFECTRECENT%d", i);
00324                 defaults->update(string, veffect[i]->get_text());
00325         }
00326         return 0;
00327 }
00328 
00329 // =================================== add most recent
00330 
00331 int MainMenu::add_aeffect(char *title)
00332 {
00333 // add bar for first effect
00334         if(total_aeffects == 0)
00335         {
00336                 audiomenu->add_item(new BC_MenuItem("-"));
00337         }
00338 
00339 // test for existing copy of effect
00340         for(int i = 0; i < total_aeffects; i++)
00341         {
00342                 if(!strcmp(aeffect[i]->get_text(), title))     // already exists
00343                 {                                // swap for top effect
00344                         for(int j = i; j > 0; j--)   // move preceeding effects down
00345                         {
00346                                 aeffect[j]->set_text(aeffect[j - 1]->get_text());
00347                         }
00348                         aeffect[0]->set_text(title);
00349                         return 1;
00350                 }
00351         }
00352 
00353 // add another blank effect
00354         if(total_aeffects < TOTAL_EFFECTS)
00355         {
00356                 audiomenu->add_item(aeffect[total_aeffects] = new MenuAEffectItem(aeffects, ""));
00357                 total_aeffects++;
00358         }
00359 
00360 // cycle effect down
00361         for(int i = total_aeffects - 1; i > 0; i--)
00362         {
00363         // set menu item text
00364                 aeffect[i]->set_text(aeffect[i - 1]->get_text());
00365         }
00366 
00367 // set up the new effect
00368         aeffect[0]->set_text(title);
00369         return 0;
00370 }
00371 
00372 int MainMenu::add_veffect(char *title)
00373 {
00374 // add bar for first effect
00375         if(total_veffects == 0)
00376         {
00377                 videomenu->add_item(new BC_MenuItem("-"));
00378         }
00379 
00380 // test for existing copy of effect
00381         for(int i = 0; i < total_veffects; i++)
00382         {
00383                 if(!strcmp(veffect[i]->get_text(), title))     // already exists
00384                 {                                // swap for top effect
00385                         for(int j = i; j > 0; j--)   // move preceeding effects down
00386                         {
00387                                 veffect[j]->set_text(veffect[j - 1]->get_text());
00388                         }
00389                         veffect[0]->set_text(title);
00390                         return 1;
00391                 }
00392         }
00393 
00394 // add another blank effect
00395         if(total_veffects < TOTAL_EFFECTS)
00396         {
00397                 videomenu->add_item(veffect[total_veffects] = new MenuVEffectItem(veffects, ""));
00398                 total_veffects++;
00399         }
00400 
00401 // cycle effect down
00402         for(int i = total_veffects - 1; i > 0; i--)
00403         {
00404 // set menu item text
00405                 veffect[i]->set_text(veffect[i - 1]->get_text());
00406         }
00407 
00408 // set up the new effect
00409         veffect[0]->set_text(title);
00410         return 0;
00411 }
00412 
00413 int MainMenu::add_load(char *new_path)
00414 {
00415         char filename[BCTEXTLEN];
00416         FileSystem dir;
00417 
00418         int total_loads = recent_load->items.total;
00419 
00420         if(total_loads == 0)
00421         {
00422                 filemenu->add_item(new BC_MenuItem("-"));
00423         }
00424 
00425         int new_total = recent_load->add_item(NULL, new_path);
00426 
00427         if (new_total > total_loads) {
00428                 // just create a new item if there is room for it
00429                 int i = new_total - 1;
00430                 load[i] = new LoadPrevious(mwindow);
00431                 dir.extract_name(filename, new_path, 0);
00432                 load[i]->set_text(filename);
00433                 load[i]->set_path(new_path);
00434                 filemenu->add_item(load[i]);
00435         }
00436 
00437         // reassign the paths to adjust for the shift down
00438         for(int i = 0; i < new_total; i++) {
00439                 char *path = recent_load->items.values[i]->get_text();
00440                 dir.extract_name(filename, path, 0);
00441                 load[i]->set_text(filename);
00442                 load[i]->set_path(path);
00443         }
00444 
00445         return 0;
00446 }
00447 
00448 
00449 
00450 
00451 
00452 
00453 
00454 
00455 // ================================== menu items
00456 
00457 
00458 DumpCICache::DumpCICache(MWindow *mwindow)
00459  : BC_MenuItem(_("Dump CICache"))
00460 { this->mwindow = mwindow; }
00461 
00462 int DumpCICache::handle_event()
00463 {
00464 //      mwindow->cache->dump();
00465 }
00466 
00467 DumpEDL::DumpEDL(MWindow *mwindow)
00468  : BC_MenuItem(_("Dump EDL"))
00469 { 
00470         this->mwindow = mwindow;
00471 }
00472 
00473 int DumpEDL::handle_event()
00474 {
00475 //printf("DumpEDL::handle_event 1\n");
00476         mwindow->edl->dump();
00477 //printf("DumpEDL::handle_event 2\n");
00478         return 1;
00479 }
00480 
00481 DumpPlugins::DumpPlugins(MWindow *mwindow)
00482  : BC_MenuItem(_("Dump Plugins"))
00483 { 
00484         this->mwindow = mwindow;
00485 }
00486 
00487 int DumpPlugins::handle_event()
00488 {
00489 //printf("DumpEDL::handle_event 1\n");
00490         mwindow->dump_plugins();
00491 //printf("DumpEDL::handle_event 2\n");
00492         return 1;
00493 }
00494 
00495 
00496 DumpAssets::DumpAssets(MWindow *mwindow)
00497  : BC_MenuItem(_("Dump Assets"))
00498 { this->mwindow = mwindow; }
00499 
00500 int DumpAssets::handle_event()
00501 {
00502         mwindow->assets->dump();
00503 }
00504 
00505 // ================================================= edit
00506 
00507 Undo::Undo(MWindow *mwindow) : BC_MenuItem(_("Undo"), "z", 'z') 
00508 { 
00509         this->mwindow = mwindow; 
00510 }
00511 int Undo::handle_event()
00512 { 
00513         mwindow->undo_entry(mwindow->gui);
00514         return 1;
00515 }
00516 int Undo::update_caption(char *new_caption)
00517 {
00518         char string[1024];
00519         sprintf(string, _("Undo %s"), new_caption);
00520         set_text(string);
00521 }
00522 
00523 
00524 Redo::Redo(MWindow *mwindow) : BC_MenuItem(_("Redo"), "Shift+Z", 'Z') 
00525 { 
00526         set_shift(1); 
00527         this->mwindow = mwindow; 
00528 }
00529 
00530 int Redo::handle_event()
00531 { 
00532         mwindow->redo_entry(mwindow->gui);
00533 
00534         return 1;
00535 }
00536 int Redo::update_caption(char *new_caption)
00537 {
00538         char string[1024];
00539         sprintf(string, _("Redo %s"), new_caption);
00540         set_text(string);
00541 }
00542 
00543 CutKeyframes::CutKeyframes(MWindow *mwindow)
00544  : BC_MenuItem(_("Cut keyframes"), "Shift-X", 'X')
00545 { 
00546         set_shift(); 
00547         this->mwindow = mwindow; 
00548 }
00549 
00550 int CutKeyframes::handle_event()
00551 {
00552         mwindow->cut_automation(); 
00553 }
00554 
00555 CopyKeyframes::CopyKeyframes(MWindow *mwindow)
00556  : BC_MenuItem(_("Copy keyframes"), "Shift-C", 'C')
00557 { 
00558         set_shift(); 
00559         this->mwindow = mwindow; 
00560 }
00561 
00562 int CopyKeyframes::handle_event()
00563 {
00564         mwindow->copy_automation();
00565         return 1;
00566 }
00567 
00568 PasteKeyframes::PasteKeyframes(MWindow *mwindow)
00569  : BC_MenuItem(_("Paste keyframes"), "Shift-V", 'V')
00570 {
00571         set_shift(); 
00572         this->mwindow = mwindow; 
00573 }
00574 
00575 int PasteKeyframes::handle_event()
00576 {
00577         mwindow->paste_automation(); 
00578 }
00579 
00580 ClearKeyframes::ClearKeyframes(MWindow *mwindow)
00581  : BC_MenuItem(_("Clear keyframes"), "Shift-Del", DELETE)
00582 {
00583         set_shift(); 
00584         this->mwindow = mwindow; 
00585 }
00586 
00587 int ClearKeyframes::handle_event()
00588 {
00589         mwindow->clear_automation();
00590         return 1;
00591 }
00592 
00593 
00594 
00595 
00596 
00597 CutDefaultKeyframe::CutDefaultKeyframe(MWindow *mwindow)
00598  : BC_MenuItem(_("Cut default keyframe"), "Alt-X", 'X')
00599 { 
00600         set_alt(); 
00601         this->mwindow = mwindow; 
00602 }
00603 
00604 int CutDefaultKeyframe::handle_event()
00605 {
00606         mwindow->cut_default_keyframe(); 
00607         return 1;
00608 }
00609 
00610 CopyDefaultKeyframe::CopyDefaultKeyframe(MWindow *mwindow)
00611  : BC_MenuItem(_("Copy default keyframe"), "Alt-c", 'c')
00612 { 
00613         set_alt(); 
00614         this->mwindow = mwindow; 
00615 }
00616 
00617 int CopyDefaultKeyframe::handle_event()
00618 {
00619         mwindow->copy_default_keyframe();
00620         return 1;
00621 }
00622 
00623 PasteDefaultKeyframe::PasteDefaultKeyframe(MWindow *mwindow)
00624  : BC_MenuItem(_("Paste default keyframe"), "Alt-v", 'v')
00625 {
00626         set_alt(); 
00627         this->mwindow = mwindow; 
00628 }
00629 
00630 int PasteDefaultKeyframe::handle_event()
00631 {
00632         mwindow->paste_default_keyframe(); 
00633         return 1;
00634 }
00635 
00636 ClearDefaultKeyframe::ClearDefaultKeyframe(MWindow *mwindow)
00637  : BC_MenuItem(_("Clear default keyframe"), "Alt-Del", DELETE)
00638 {
00639         set_alt(); 
00640         this->mwindow = mwindow; 
00641 }
00642 
00643 int ClearDefaultKeyframe::handle_event()
00644 {
00645         mwindow->clear_default_keyframe();
00646         return 1;
00647 }
00648 
00649 Cut::Cut(MWindow *mwindow)
00650  : BC_MenuItem(_("Cut"), "x", 'x') 
00651 {
00652         this->mwindow = mwindow; 
00653 }
00654 
00655 int Cut::handle_event()
00656 {
00657         mwindow->cut();
00658         return 1;
00659 }
00660 
00661 Copy::Copy(MWindow *mwindow)
00662  : BC_MenuItem(_("Copy"), "c", 'c') 
00663 {
00664         this->mwindow = mwindow; 
00665 }
00666 
00667 int Copy::handle_event()
00668 {
00669         mwindow->copy();
00670         return 1;
00671 }
00672 
00673 Paste::Paste(MWindow *mwindow)
00674  : BC_MenuItem(_("Paste"), "v", 'v') 
00675 {
00676         this->mwindow = mwindow; 
00677 }
00678 
00679 int Paste::handle_event()
00680 {
00681         mwindow->paste();
00682         return 1;
00683 }
00684 
00685 Clear::Clear(MWindow *mwindow)
00686  : BC_MenuItem(_("Clear"), "Del", DELETE) 
00687 {
00688         this->mwindow = mwindow; 
00689 }
00690 
00691 int Clear::handle_event()
00692 {
00693         mwindow->cwindow->gui->lock_window("Clear::handle_event");
00694         mwindow->clear_entry();
00695         mwindow->cwindow->gui->unlock_window();
00696         return 1;
00697 }
00698 
00699 PasteSilence::PasteSilence(MWindow *mwindow)
00700  : BC_MenuItem(_("Paste silence"), "Shift+Space", ' ')
00701 { 
00702         this->mwindow = mwindow; 
00703         set_shift(); 
00704 }
00705 
00706 int PasteSilence::handle_event()
00707 { 
00708         mwindow->paste_silence();
00709         return 1;
00710 }
00711 
00712 SelectAll::SelectAll(MWindow *mwindow)
00713  : BC_MenuItem(_("Select All"), "a", 'a')
00714 { 
00715         this->mwindow = mwindow; 
00716 }
00717 
00718 int SelectAll::handle_event()
00719 {
00720         mwindow->select_all();
00721         return 1;
00722 }
00723 
00724 ClearLabels::ClearLabels(MWindow *mwindow) : BC_MenuItem(_("Clear labels")) 
00725 { 
00726         this->mwindow = mwindow; 
00727 }
00728 
00729 int ClearLabels::handle_event()
00730 {
00731         mwindow->clear_labels();
00732         return 1;
00733 }
00734 
00735 MuteSelection::MuteSelection(MWindow *mwindow)
00736  : BC_MenuItem(_("Mute Region"), "m", 'm')
00737 {
00738         this->mwindow = mwindow;
00739 }
00740 
00741 int MuteSelection::handle_event()
00742 {
00743         mwindow->mute_selection();
00744         return 1;
00745 }
00746 
00747 
00748 TrimSelection::TrimSelection(MWindow *mwindow)
00749  : BC_MenuItem(_("Trim Selection"))
00750 {
00751         this->mwindow = mwindow;
00752 }
00753 
00754 int TrimSelection::handle_event()
00755 {
00756         mwindow->trim_selection();
00757         return 1;
00758 }
00759 
00760 
00761 
00762 
00763 
00764 
00765 
00766 
00767 
00768 
00769 
00770 
00771 // ============================================= audio
00772 
00773 AddAudioTrack::AddAudioTrack(MWindow *mwindow)
00774  : BC_MenuItem(_("Add track"), "t", 't')
00775 {
00776         this->mwindow = mwindow;
00777 }
00778 
00779 int AddAudioTrack::handle_event()
00780 {
00781         mwindow->add_audio_track_entry(0, 0);
00782         return 1;
00783 }
00784 
00785 DeleteAudioTrack::DeleteAudioTrack(MWindow *mwindow)
00786  : BC_MenuItem(_("Delete track"))
00787 {
00788         this->mwindow = mwindow;
00789 }
00790 
00791 int DeleteAudioTrack::handle_event()
00792 {
00793         return 1;
00794 }
00795 
00796 DefaultATransition::DefaultATransition(MWindow *mwindow)
00797  : BC_MenuItem(_("Default Transition"), "u", 'u')
00798 {
00799         this->mwindow = mwindow;
00800 }
00801 
00802 int DefaultATransition::handle_event()
00803 {
00804         mwindow->paste_audio_transition();
00805         return 1;
00806 }
00807 
00808 
00809 
00810 
00811 // ============================================= video
00812 
00813 
00814 AddVideoTrack::AddVideoTrack(MWindow *mwindow)
00815  : BC_MenuItem(_("Add track"), "Shift-T", 'T')
00816 {
00817         set_shift();
00818         this->mwindow = mwindow;
00819 }
00820 
00821 int AddVideoTrack::handle_event()
00822 {
00823         mwindow->add_video_track_entry();
00824         return 1;
00825 }
00826 
00827 
00828 DeleteVideoTrack::DeleteVideoTrack(MWindow *mwindow)
00829  : BC_MenuItem(_("Delete track"))
00830 {
00831         this->mwindow = mwindow;
00832 }
00833 
00834 int DeleteVideoTrack::handle_event()
00835 {
00836         return 1;
00837 }
00838 
00839 
00840 
00841 ResetTranslation::ResetTranslation(MWindow *mwindow)
00842  : BC_MenuItem(_("Reset Translation"))
00843 {
00844         this->mwindow = mwindow;
00845 }
00846 
00847 int ResetTranslation::handle_event()
00848 {
00849         return 1;
00850 }
00851 
00852 
00853 
00854 DefaultVTransition::DefaultVTransition(MWindow *mwindow)
00855  : BC_MenuItem(_("Default Transition"), "Shift-U", 'U')
00856 {
00857         set_shift();
00858         this->mwindow = mwindow;
00859 }
00860 
00861 int DefaultVTransition::handle_event()
00862 {
00863         mwindow->paste_video_transition();
00864         return 1;
00865 }
00866 
00867 
00868 
00869 
00870 
00871 
00872 
00873 
00874 
00875 
00876 
00877 
00878 
00879 
00880 // ============================================ settings
00881 
00882 DeleteTracks::DeleteTracks(MWindow *mwindow)
00883  : BC_MenuItem(_("Delete tracks"))
00884 {
00885         this->mwindow = mwindow;
00886 }
00887 
00888 int DeleteTracks::handle_event()
00889 {
00890         mwindow->delete_tracks();
00891         return 1;
00892 }
00893 
00894 DeleteTrack::DeleteTrack(MWindow *mwindow)
00895  : BC_MenuItem(_("Delete last track"), "d", 'd')
00896 {
00897         this->mwindow = mwindow;
00898 }
00899 
00900 int DeleteTrack::handle_event()
00901 {
00902         mwindow->delete_track();
00903         return 1;
00904 }
00905 
00906 MoveTracksUp::MoveTracksUp(MWindow *mwindow)
00907  : BC_MenuItem(_("Move tracks up"))
00908 {
00909         set_shift(); this->mwindow = mwindow;
00910 }
00911 
00912 int MoveTracksUp::handle_event()
00913 {
00914         mwindow->move_tracks_up();
00915         return 1;
00916 }
00917 
00918 MoveTracksDown::MoveTracksDown(MWindow *mwindow)
00919  : BC_MenuItem(_("Move tracks down"))
00920 {
00921         set_shift(); this->mwindow = mwindow;
00922 }
00923 
00924 int MoveTracksDown::handle_event()
00925 {
00926         mwindow->move_tracks_down();
00927         return 1;
00928 }
00929 
00930 
00931 
00932 
00933 ConcatenateTracks::ConcatenateTracks(MWindow *mwindow)
00934  : BC_MenuItem(_("Concatenate tracks"))
00935 {
00936         set_shift(); 
00937         this->mwindow = mwindow;
00938 }
00939 
00940 int ConcatenateTracks::handle_event()
00941 {
00942         mwindow->concatenate_tracks();
00943         return 1;
00944 }
00945 
00946 
00947 
00948 
00949 
00950 LoopPlayback::LoopPlayback(MWindow *mwindow)
00951  : BC_MenuItem(_("Loop Playback"), "Shift+L", 'L')
00952 {
00953         this->mwindow = mwindow;
00954         set_checked(mwindow->edl->local_session->loop_playback);
00955         set_shift();
00956 }
00957 
00958 int LoopPlayback::handle_event()
00959 {
00960         mwindow->toggle_loop_playback();
00961         set_checked(mwindow->edl->local_session->loop_playback);
00962         return 1;
00963 }
00964 
00965 
00966 
00967 
00968 
00969 SetBRenderStart::SetBRenderStart(MWindow *mwindow)
00970  : BC_MenuItem(_("Set background render"))
00971 {
00972         this->mwindow = mwindow;
00973 }
00974 
00975 int SetBRenderStart::handle_event()
00976 {
00977         mwindow->set_brender_start();
00978         return 1;
00979 }
00980 
00981 
00982 
00983 
00984 
00985 
00986 
00987 LabelsFollowEdits::LabelsFollowEdits(MWindow *mwindow)
00988  : BC_MenuItem(_("Edit labels")) 
00989 { 
00990         this->mwindow = mwindow; 
00991         set_checked(mwindow->edl->session->labels_follow_edits);
00992 }
00993 
00994 int LabelsFollowEdits::handle_event()
00995 {
00996         set_checked(get_checked() ^ 1);
00997         mwindow->edl->session->labels_follow_edits = get_checked(); 
00998 }
00999 
01000 
01001 
01002 
01003 PluginsFollowEdits::PluginsFollowEdits(MWindow *mwindow)
01004  : BC_MenuItem(_("Edit effects")) 
01005 { 
01006         this->mwindow = mwindow; 
01007         set_checked(mwindow->edl->session->plugins_follow_edits);
01008 }
01009 
01010 int PluginsFollowEdits::handle_event()
01011 {
01012         set_checked(get_checked() ^ 1);
01013         mwindow->edl->session->plugins_follow_edits = get_checked(); 
01014 }
01015 
01016 
01017 
01018 
01019 AutosFollowEdits::AutosFollowEdits(MWindow *mwindow)
01020  : BC_MenuItem(_("Autos follow edits")) 
01021 { 
01022         this->mwindow = mwindow; 
01023         set_checked(mwindow->edl->session->autos_follow_edits);
01024 }
01025 
01026 int AutosFollowEdits::handle_event()
01027 { 
01028         mwindow->edl->session->autos_follow_edits ^= 1; 
01029         set_checked(!get_checked());
01030 }
01031 
01032 
01033 CursorOnFrames::CursorOnFrames(MWindow *mwindow)
01034  : BC_MenuItem(_("Align cursor on frames")) 
01035 { 
01036         this->mwindow = mwindow; 
01037         set_checked(mwindow->edl->session->cursor_on_frames);
01038 }
01039 
01040 int CursorOnFrames::handle_event()
01041 {
01042         mwindow->edl->session->cursor_on_frames = !mwindow->edl->session->cursor_on_frames; 
01043         set_checked(mwindow->edl->session->cursor_on_frames);
01044 }
01045 
01046 
01047 ScrubSpeed::ScrubSpeed(MWindow *mwindow) : BC_MenuItem(_("Slow Shuttle"))
01048 {
01049         this->mwindow = mwindow;
01050 }
01051 
01052 int ScrubSpeed::handle_event()
01053 {
01054         if(mwindow->edl->session->scrub_speed == .5)
01055         {
01056                 mwindow->edl->session->scrub_speed = 2;
01057                 set_text(_("Slow Shuttle"));
01058         }
01059         else
01060         {
01061                 mwindow->edl->session->scrub_speed = .5;
01062                 set_text(_("Fast Shuttle"));
01063         }
01064 }
01065 
01066 SaveSettingsNow::SaveSettingsNow(MWindow *mwindow) : BC_MenuItem(_("Save settings now")) 
01067 { 
01068         this->mwindow = mwindow; 
01069 }
01070 
01071 int SaveSettingsNow::handle_event()
01072 {
01073         mwindow->save_defaults();
01074         mwindow->save_backup();
01075         mwindow->gui->show_message(_("Saved settings."));
01076         return 1;
01077 }
01078 
01079 
01080 
01081 // ============================================ window
01082 
01083 
01084 
01085 
01086 
01087 ShowVWindow::ShowVWindow(MWindow *mwindow)
01088  : BC_MenuItem(_("Show Viewer"))
01089 {
01090         this->mwindow = mwindow;
01091         set_checked(mwindow->session->show_vwindow);
01092 }
01093 int ShowVWindow::handle_event()
01094 {
01095         mwindow->show_vwindow();
01096         return 1;
01097 }
01098 
01099 ShowAWindow::ShowAWindow(MWindow *mwindow)
01100  : BC_MenuItem(_("Show Resources"))
01101 {
01102         this->mwindow = mwindow;
01103         set_checked(mwindow->session->show_awindow);
01104 }
01105 int ShowAWindow::handle_event()
01106 {
01107         mwindow->show_awindow();
01108         return 1;
01109 }
01110 
01111 ShowCWindow::ShowCWindow(MWindow *mwindow)
01112  : BC_MenuItem(_("Show Compositor"))
01113 {
01114         this->mwindow = mwindow;
01115         set_checked(mwindow->session->show_cwindow);
01116 }
01117 int ShowCWindow::handle_event()
01118 {
01119         mwindow->show_cwindow();
01120         return 1;
01121 }
01122 
01123 
01124 ShowGWindow::ShowGWindow(MWindow *mwindow)
01125  : BC_MenuItem(_("Show Overlays"))
01126 {
01127         this->mwindow = mwindow;
01128         set_checked(mwindow->session->show_gwindow);
01129 }
01130 int ShowGWindow::handle_event()
01131 {
01132         mwindow->show_gwindow();
01133         return 1;
01134 }
01135 
01136 
01137 ShowLWindow::ShowLWindow(MWindow *mwindow)
01138  : BC_MenuItem(_("Show Levels"))
01139 {
01140         this->mwindow = mwindow;
01141         set_checked(mwindow->session->show_lwindow);
01142 }
01143 int ShowLWindow::handle_event()
01144 {
01145         mwindow->show_lwindow();
01146         return 1;
01147 }
01148 
01149 TileWindows::TileWindows(MWindow *mwindow)
01150  : BC_MenuItem(_("Default positions"))
01151 {
01152         this->mwindow = mwindow;
01153 }
01154 int TileWindows::handle_event()
01155 {
01156         mwindow->tile_windows();
01157         return 1;
01158 }
01159 
01160 

Generated on Sun Jan 8 13:38:56 2006 for Cinelerra-svn by  doxygen 1.4.4