コード例 #1
0
 /// <summary>
 /// Returns what the delta should be not to violate the trimming of this clip
 /// </summary>
 public static long HowMuchCanBeTrimmed(this VidkaClip clip, TrimDirection side, long delta)
 {
     if (clip == null)
     {
         return(0);
     }
     if (side == TrimDirection.Left)
     {
         if (clip.FrameStart + delta < 0)                               // left bound...
         {
             return(-clip.FrameStart);                                  // ...to make 0
         }
         else if (clip.FrameStartNoEase + delta >= clip.FrameEndNoEase) // right bound...
         {
             return(-clip.FrameStartNoEase + clip.FrameEndNoEase - 1);  // ...to make frameEndNoEase-1
         }
         return(delta);
     }
     else if (side == TrimDirection.Right)
     {
         if (clip.FrameEndNoEase + delta <= clip.FrameStartNoEase)     // left bound...
         {
             return(-clip.FrameEndNoEase + clip.FrameStartNoEase + 1); // ...to male frameStartNoEase+1
         }
         else if (clip.FrameEnd + delta >= clip.FileLengthFrames)      // right bound...
         {
             return(-clip.FrameEnd + clip.FileLengthFrames);           // ...to make clip.LengthFrameCalc
         }
         return(delta);
     }
     return(0);
 }
コード例 #2
0
ファイル: VideoShitbox.cs プロジェクト: miktemk/VidkaEditor
        public void OpenClipProperties(VidkaClip clip)
        {
            if (clip == null)
                return;
            VidkaClip newClip = null;
            Form windowDialog = null;
            if (clip is VidkaClipVideoAbstract)
            {
                var window = new ClipPropertiesWindowVideo
                {
                    Text = "Advanced clip properties",
                };
                windowDialog = window;
                if (clip is VidkaClipVideo)
                {
                    var vclip = (VidkaClipVideo)clip;
                    var vclip2 = vclip.MakeCopy_VideoClip();
                    newClip = vclip2;
                    window.CommonPropertiesControl.SetParticulars(vclip2);
                    window.CommonCustomAudioControl.SetParticulars(vclip2, Logic.MetaGenerator, Logic.FileMapping, Logic.Proj);
                }
                else if (clip is VidkaClipImage)
                {
                    var vclip = (VidkaClipImage)clip;
                    var vclip2 = vclip.MakeCopy_VideoClip();
                    newClip = vclip2;
                    window.CommonPropertiesControl.SetParticulars(vclip2);
                    window.CommonCustomAudioControl.SetParticulars(vclip2, Logic.MetaGenerator, Logic.FileMapping, Logic.Proj);
                    //window.AddImportantTab("");
                }
                else if (clip is VidkaClipTextSimple)
                {
                    var vclip = (VidkaClipTextSimple)clip;
                    var vclip2 = (VidkaClipTextSimple)vclip.MakeCopy_VideoClip();
                    newClip = vclip2;
                    window.CommonPropertiesControl.SetParticulars(vclip2);
                    window.CommonCustomAudioControl.SetParticulars(vclip2, Logic.MetaGenerator, Logic.FileMapping, Logic.Proj);
                    var textCreationControl = new SimpleTextSettings();
                    textCreationControl.SetVideoClip(vclip2);
                    window.AddImportantTab("Text", textCreationControl);
                }
            }
            else if (clip is VidkaClipAudio)
            {
                var window = new ClipPropertiesWindowAudio
                {
                    Text = "Advanced clip properties",
                };
                windowDialog = window;
                var aclip = (VidkaClipAudio)clip;
                var aclip2 = aclip.MakeCopy_AudioClip();
                newClip = aclip2;
                window.CommonPropertiesControl.SetParticulars(aclip2);
            }

            // use this dialog window to edit this clip
            if (newClip != null && windowDialog != null)
            {
                var result = windowDialog.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK)
                    Logic.ReplaceClip(clip, newClip);
            }
        }
コード例 #3
0
 private long WhereWouldEndBe(long origFrame1, long origFrame2, VidkaClip clip)
 {
     var end = Math.Max(origFrame1, origFrame2);
     if (end > clip.FileLengthFrames)
         end = clip.FileLengthFrames;
     return end;
 }
コード例 #4
0
 /// <summary>
 /// Uses proj.ClipsAudio.Contains(hoverClip) to determine which to set HoverAudio or HoverVideo
 /// </summary>
 public void SetHoverGeneric(VidkaClip hoverClip, VidkaProj proj)
 {
     if (proj.ClipsAudio.Contains(hoverClip))
         SetHoverAudio((VidkaClipAudio)hoverClip);
     else // video!!!
         SetHoverVideo((VidkaClipVideoAbstract)hoverClip);
 }
コード例 #5
0
ファイル: EditorLogic.cs プロジェクト: miktemk/VidkaEditor
 public void ReplaceClip(VidkaClip clip, VidkaClip newClip)
 {
     if (Proj.ClipsVideo.Contains(clip))
     {
         var vclip = (VidkaClipVideoAbstract)clip;
         var vclip2 = (VidkaClipVideoAbstract)newClip;
         AddUndableAction_andFireRedo(new UndoableAction
         {
             Redo = () =>
             {
                 if (Proj.ClipsVideo.ReplaceElement(vclip, vclip2))
                     UiObjects.SetActiveVideo(vclip2, Proj);
             },
             Undo = () =>
             {
                 if (Proj.ClipsVideo.ReplaceElement(vclip2, vclip))
                     UiObjects.SetActiveVideo(vclip, Proj);
             },
             PostAction = () =>
             {
                 if (UiObjects.CurrentVideoClip is VidkaClipTextSimple)
                     VidkaIO.RebuildAuxillaryFile_SimpleText((VidkaClipTextSimple)UiObjects.CurrentVideoClip, Proj, MetaGenerator);
                 if (vclip.IsRenderBreakupPoint != vclip2.IsRenderBreakupPoint)
                     Fire_ProjectUpdated_AsFarAsMenusAreConcerned();
             }
         });
     }
     else if (Proj.ClipsAudio.Contains(clip))
     {
         var aclip = (VidkaClipAudio)clip;
         var aclip2 = (VidkaClipAudio)newClip;
         AddUndableAction_andFireRedo(new UndoableAction
         {
             Redo = () =>
             {
                 if (Proj.ClipsAudio.ReplaceElement(aclip, aclip2))
                     UiObjects.SetActiveAudio(aclip2);
             },
             Undo = () =>
             {
                 if (Proj.ClipsAudio.ReplaceElement(aclip2, aclip))
                     UiObjects.SetActiveAudio(aclip);
             },
         });
     }
     //TODO: audio..
 }