X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Feditpopup.C;h=60dcafb8ae8a09a5814ca423e8a275f1029ad350;hb=166867a58d74619aa11aeb562a994cc364d62231;hp=11299c29e081dff0fb9ff3ecef131c7daff94c25;hpb=9668279ccef86a9cc9138aaa1a659f158698f829;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/editpopup.C b/cinelerra-5.1/cinelerra/editpopup.C index 11299c29..60dcafb8 100644 --- a/cinelerra-5.1/cinelerra/editpopup.C +++ b/cinelerra-5.1/cinelerra/editpopup.C @@ -29,6 +29,7 @@ #include "edl.h" #include "edlsession.h" #include "file.h" +#include "filexml.h" #include "keys.h" #include "language.h" #include "localsession.h" @@ -55,6 +56,7 @@ EditPopup::EditPopup(MWindow *mwindow, MWindowGUI *gui) plugin = 0; pluginset = 0; position = 0; + open_edl = 0; } EditPopup::~EditPopup() @@ -63,7 +65,9 @@ EditPopup::~EditPopup() void EditPopup::create_objects() { + add_item(open_edl = new EditPopupOpenEDL(mwindow, this)); add_item(new EditPopupClearSelect(mwindow, this)); + add_item(new EditPopupSelectEdits(mwindow, this)); add_item(new EditPopupCopy(mwindow, this)); add_item(new EditPopupCut(mwindow, this)); add_item(new EditPopupMute(mwindow, this)); @@ -72,7 +76,11 @@ void EditPopup::create_objects() add_item(new EditPopupMutePack(mwindow, this)); add_item(new EditPopupPaste(mwindow, this)); add_item(new EditPopupOverwrite(mwindow, this)); + add_item(new BC_MenuItem("-")); add_item(new EditPopupOverwritePlugins(mwindow, this)); + add_item(new EditCollectEffects(mwindow, this)); + add_item(new EditPasteEffects(mwindow, this)); + add_item(new EditPopupTimecode(mwindow, this)); } int EditPopup::activate_menu(Track *track, Edit *edit, @@ -83,9 +91,60 @@ int EditPopup::activate_menu(Track *track, Edit *edit, this->pluginset = pluginset; this->plugin = plugin; this->position = position; + int enable = !edit ? 0 : + edit->nested_edl ? 1 : + !edit->asset ? 0 : + edit->asset->format == FILE_REF ? 1 : 0; + open_edl->set_enabled(enable); return BC_PopupMenu::activate_menu(); } +EditPopupOpenEDL::EditPopupOpenEDL(MWindow *mwindow, EditPopup *popup) + : BC_MenuItem(_("Open EDL")) +{ + this->mwindow = mwindow; + this->popup = popup; + set_ctrl(1); + set_shift(1); +} + +int EditPopupOpenEDL::handle_event() +{ + Edit *edit = popup->edit; + if( !edit ) return 1; + EDL *edl = 0; + Indexable *idxbl = 0; + if( edit->asset && edit->asset->format == FILE_REF ) { + FileXML xml_file; + const char *filename = edit->asset->path; + if( xml_file.read_from_file(filename, 1) ) { + eprintf(_("Error: unable to open:\n %s"), filename); + return 1; + } + edl = new EDL; + edl->create_objects(); + if( edl->load_xml(&xml_file, LOAD_ALL) ) { + eprintf(_("Error: unable to load:\n %s"), filename); + edl->remove_user(); + return 1; + } + idxbl = edit->asset; + } + else if( edit->nested_edl ) { + edl = edit->nested_edl; + edl->add_user(); + idxbl = edl; + } + else { + char edit_title[BCTEXTLEN]; + edit->get_title(edit_title); + eprintf(_("Edit is not EDL: %s"), edit_title); + return 1; + } + mwindow->stack_push(edl, idxbl); + return 1; +} + EditPopupClearSelect::EditPopupClearSelect(MWindow *mwindow, EditPopup *popup) : BC_MenuItem(_("Clear Select"),_("Ctrl-Shift-A"),'A') { @@ -101,6 +160,21 @@ int EditPopupClearSelect::handle_event() return 1; } +EditPopupSelectEdits::EditPopupSelectEdits(MWindow *mwindow, EditPopup *popup) + : BC_MenuItem(_("Select Edits"),_("Ctrl-Alt-a"),'a') +{ + this->mwindow = mwindow; + this->popup = popup; + set_ctrl(1); + set_alt(1); +} + +int EditPopupSelectEdits::handle_event() +{ + mwindow->select_edits(); + return 1; +} + EditPopupCopy::EditPopupCopy(MWindow *mwindow, EditPopup *popup) : BC_MenuItem(_("Copy"),_("Ctrl-c"),'c') { @@ -145,11 +219,12 @@ int EditPopupCut::handle_event() } EditPopupCutPack::EditPopupCutPack(MWindow *mwindow, EditPopup *popup) - : BC_MenuItem(_("Cut pack"),_("Ctrl-z"),'z') + : BC_MenuItem(_("Cut pack"),_("Ctrl-Alt-z"),'z') { this->mwindow = mwindow; this->popup = popup; set_ctrl(1); + set_alt(); } int EditPopupCutPack::handle_event() @@ -159,7 +234,7 @@ int EditPopupCutPack::handle_event() } EditPopupMute::EditPopupMute(MWindow *mwindow, EditPopup *popup) - : BC_MenuItem(_("Mute"),_("Ctrl-m"),'m') + : BC_MenuItem(C_("Mute"),_("Ctrl-m"),'m') { this->mwindow = mwindow; this->popup = popup; @@ -250,3 +325,64 @@ int EditPopupOverwritePlugins::handle_event() return 1; } + +EditCollectEffects::EditCollectEffects(MWindow *mwindow, EditPopup *popup) + : BC_MenuItem(_("Collect Effects")) +{ + this->mwindow = mwindow; + this->popup = popup; + set_ctrl(1); +} + +int EditCollectEffects::handle_event() +{ + if( mwindow->session->current_operation == NO_OPERATION ) + mwindow->collect_effects(); + return 1; +} + +EditPasteEffects::EditPasteEffects(MWindow *mwindow, EditPopup *popup) + : BC_MenuItem(_("Paste Effects")) +{ + this->mwindow = mwindow; + this->popup = popup; + set_ctrl(1); + set_shift(1); +} + +int EditPasteEffects::handle_event() +{ + if( mwindow->session->current_operation == NO_OPERATION ) + mwindow->paste_effects(); + return 1; +} + +EditPopupTimecode::EditPopupTimecode(MWindow *mwindow, EditPopup *popup) + : BC_MenuItem(_("Timecode"),_("Ctrl-!"),'!') +{ + this->mwindow = mwindow; + this->popup = popup; + set_ctrl(1); +} + +int EditPopupTimecode::handle_event() +{ + if( mwindow->session->current_operation != NO_OPERATION ) return 1; + Edit *edit = popup->edit; + if( !edit || !edit->asset ) return 1; + Asset *asset = edit->asset; + double timecode = asset->timecode != -2 ? asset->timecode : + FFMPEG::get_timecode(asset->path, + edit->track->data_type, edit->channel, + mwindow->edl->session->frame_rate); + asset->timecode = timecode; + if( timecode >= 0 ) { + int64_t pos = edit->startproject + edit->startsource; + double position = edit->track->from_units(pos); + mwindow->set_timecode_offset(timecode - position); + } + else + mwindow->set_timecode_offset(0); + return 1; +} +