public override void Run()
        {
            var imgFilename     = VidkaIO.MakeUniqueFilename_AuxSimpleText();
            var imgFilenameFull = VidkaIO.GetAuxillaryProjFile(Context.CurFileName, imgFilename);
            var newClip         = new VidkaClipTextSimple()
            {
                Text = "Hello :)",
                ArgbBackgroundColor = Color.Black.ToArgb(),
                ArgbFontColor       = Color.White.ToArgb(),
                FontSize            = 20,
                FileName            = imgFilenameFull,
                FileLengthSec       = Settings.Default.ImageClipLengthSeconds,
                FileLengthFrames    = Context.Proj.SecToFrame(Settings.Default.ImageClipLengthSeconds),
                FrameStart          = 0,
                FrameEnd            = Context.Proj.SecToFrame(Settings.Default.TextClipInitialLengthSeconds),
            };

            VidkaIO.RebuildAuxillaryFile_SimpleText(newClip, Context.Proj, Context.MetaGenerator);

            Context.AddUndoableAction_insertClipAtMarkerPosition(newClip);
        }
示例#2
0
        public override void MouseDragEnd(int x, int y, int deltaX, int deltaY, int w, int h)
        {
            performDefensiveProgrammingCheck();
            var clip                  = uiObjects.CurrentVideoClip;
            var clip_oldIndex         = oldIndex;
            int draggyVideoShoveIndex = dimdim.GetVideoClipDraggyShoveIndex(uiObjects.Draggy);

            if (copyMode)
            {
                var newClip = copyMode ? clip.MakeCopy_VideoClip() : null;
                iEditor.AddUndableAction_andFireRedo(new UndoableAction()
                {
                    Redo = () =>
                    {
                        cxzxc("copy: " + clip_oldIndex + "->" + draggyVideoShoveIndex);
                        proj.ClipsVideo.Insert(draggyVideoShoveIndex, newClip);
                        uiObjects.SetActiveVideo(newClip, proj);
                        // update width and marker on new clip
                        iEditor.UpdateCanvasWidthFromProjAndDimdim();
                        long frameMarker = proj.GetVideoClipAbsFramePositionLeft(newClip);
                        iEditor.SetFrameMarker_ShowFrameInPlayer(frameMarker);
                        if (clip is VidkaClipTextSimple)
                        {
                            clip.FileName = VidkaIO.GetAuxillaryProjFile(iEditor.CurFileName, VidkaIO.MakeUniqueFilename_AuxSimpleText());
                            VidkaIO.RebuildAuxillaryFile_SimpleText((VidkaClipTextSimple)clip, proj, metaGenerator);
                        }
                    },
                    Undo = () =>
                    {
                        cxzxc("UNDO copy");
                        proj.ClipsVideo.Remove(newClip);
                        uiObjects.SetActiveVideo(clip, proj);
                        // update width and marker on old clip
                        iEditor.UpdateCanvasWidthFromProjAndDimdim();
                        long frameMarker = proj.GetVideoClipAbsFramePositionLeft(clip);
                        iEditor.SetFrameMarker_ShowFrameInPlayer(frameMarker);
                    },
                });
            }
            else
            {
                if (draggyVideoShoveIndex > clip_oldIndex)
                {
                    draggyVideoShoveIndex--;
                }
                if (draggyVideoShoveIndex != clip_oldIndex)
                {
                    iEditor.AddUndableAction_andFireRedo(new UndoableAction()
                    {
                        Redo = () =>
                        {
                            cxzxc("move: " + clip_oldIndex + "->" + draggyVideoShoveIndex);
                            proj.ClipsVideo.Remove(clip);
                            proj.ClipsVideo.Insert(draggyVideoShoveIndex, clip);
                        },
                        Undo = () =>
                        {
                            cxzxc("UNDO move: " + draggyVideoShoveIndex + "->" + clip_oldIndex);
                            proj.ClipsVideo.Remove(clip);
                            proj.ClipsVideo.Insert(clip_oldIndex, clip);
                        },
                        PostAction = () =>
                        {
                            uiObjects.UpdateCurrentClipFrameAbsPos(proj);
                            long frameMarker = proj.GetVideoClipAbsFramePositionLeft(clip);
                            iEditor.SetFrameMarker_ShowFrameInPlayer(frameMarker);
                        }
                    });
                }
            }
            IsDone   = true;
            copyMode = false;
            uiObjects.ClearDraggy();
            uiObjects.UiStateChanged();
        }