Exemplo n.º 1
0
        void Thumb_Move(FadeThumb sender, double change, double?total)
        {
            int i = thumbs.IndexOf(sender);

            if (i == 0 || i == thumbs.Count - 1)
            {
                return;
            }

            double left  = Canvas.GetLeft(thumbs[i - 1]) + 1;
            double right = Canvas.GetLeft(thumbs[i + 1]) - 1;

            double old = Canvas.GetLeft(sender);
            double x   = old + change;

            x = (x < left)? left : x;
            x = (x > right)? right : x;

            Fade.ThumbMoveUndoEntry entry = new Fade.ThumbMoveUndoEntry(
                _fade,
                i,
                (x - total ?? 0) / Gradient.Width,
                x / Gradient.Width
                );

            if (total != null)
            {
                Program.Project.Undo.Add(entry);
            }

            entry.Redo();
        }
Exemplo n.º 2
0
        void Thumb_Move(FadeThumb sender, double change, double?total)
        {
            int i = thumbs.IndexOf(sender);

            double left  = Canvas.GetLeft(thumbs[i - 1]) + 1;
            double right = Canvas.GetLeft(thumbs[i + 1]) - 1;

            double old = Canvas.GetLeft(sender);
            double x   = old + change;

            x = (x < left)? left : x;
            x = (x > right)? right : x;

            double pos = x / Gradient.Width;

            if (total != null)
            {
                double     u    = x - total.Value / Gradient.Width;
                List <int> path = Track.GetPath(_fade);

                Program.Project.Undo.Add($"Fade Color {i + 1} Moved", () => {
                    Track.TraversePath <Fade>(path).SetPosition(i, u);
                }, () => {
                    Track.TraversePath <Fade>(path).SetPosition(i, pos);
                });
            }

            _fade.SetPosition(i, pos);
        }
Exemplo n.º 3
0
        public void Contents_Insert(int index, Color color)
        {
            FadeThumb thumb = new FadeThumb()
            {
                Owner = this,
                Fill  = color.ToBrush()
            };

            thumbs.Insert(index, thumb);
            Canvas.SetLeft(thumb, _fade.GetPosition(index) * Gradient.Width);

            thumb.Moved       += Thumb_Move;
            thumb.Focused     += Thumb_Focus;
            thumb.Deleted     += Thumb_Delete;
            thumb.StartHere   += Thumb_StartHere;
            thumb.EndHere     += Thumb_EndHere;
            thumb.TypeChanged += Thumb_ChangeFadeType;

            canvas.Children.Add(thumb);
            if (_fade.Expanded != null && index <= _fade.Expanded)
            {
                _fade.Expanded++;
            }

            UpdateThumbMenus();
        }
Exemplo n.º 4
0
        private void Thumb_Move(FadeThumb sender, double change, double?total)
        {
            int i = thumbs.IndexOf(sender);

            double left  = Canvas.GetLeft(thumbs[i - 1]) + 1;
            double right = Canvas.GetLeft(thumbs[i + 1]) - 1;

            double old = Canvas.GetLeft(sender);
            double x   = old + change;

            x = (x < left)? left : x;
            x = (x > right)? right : x;

            decimal pos = (decimal)x / 200;

            if (total != null)
            {
                double     u    = x - total.Value;
                List <int> path = Track.GetPath(_fade);

                Program.Project.Undo.Add($"Fade Color {i + 1} Moved", () => {
                    ((Fade)Track.TraversePath(path)).SetPosition(i, (decimal)u / 200);
                }, () => {
                    ((Fade)Track.TraversePath(path)).SetPosition(i, pos);
                });
            }

            _fade.SetPosition(i, pos);
        }
Exemplo n.º 5
0
        public void thumbnails_MouseEnter(object sender, MouseEventArgs e)
        {
            FadeThumb.Stop();
            Image imgRef = (Image)sender;

            FadeThumb.SetValue(Storyboard.TargetNameProperty, imgRef.Name);
            FadeThumb.Begin();
        }
Exemplo n.º 6
0
        private void playVideo()
        {
            FadeThumb.Stop();
            vidStage.SetValue(MediaElement.SourceProperty, currentVidCategory[playIndex]);
            vidStage.AutoPlay = true;

            createThumbnails();

            FadeThumb.SetValue(Storyboard.TargetNameProperty, "thumb" + playIndex);
            FadeThumb.Begin();
            FadeIn.Begin();
        }
Exemplo n.º 7
0
        private void showPicture()
        {
            FadeThumb.Stop();
            //FadeIn.Stop();
            imgStage.SetValue(Image.SourceProperty, new BitmapImage(currentPicCategory[playIndex]));

            createThumbnails();

            FadeThumb.SetValue(Storyboard.TargetNameProperty, "thumb" + playIndex);
            FadeThumb.Begin();
            FadeIn.Begin();
        }
Exemplo n.º 8
0
        void Thumb_ChangeFadeType(FadeThumb sender, FadeType newType)
        {
            int index = thumbs.IndexOf(sender);

            FadeType oldType = _fade.GetFadeType(index);

            List <int> path = Track.GetPath(_fade);

            Program.Project.Undo.Add($"Fade Type {index + 1} Changed to {newType}", () => {
                Track.TraversePath <Fade>(path).SetFadeType(index, oldType);
            }, () => {
                Track.TraversePath <Fade>(path).SetFadeType(index, newType);
            });

            _fade.SetFadeType(index, newType);
        }
Exemplo n.º 9
0
        private void Thumb_Delete(FadeThumb sender)
        {
            int index = thumbs.IndexOf(sender);

            Color      uc   = _fade.GetColor(index).Clone();
            decimal    up   = _fade.GetPosition(index);
            List <int> path = Track.GetPath(_fade);

            Program.Project.Undo.Add($"Fade Color {index + 1} Removed", () => {
                ((Fade)Track.TraversePath(path)).Insert(index, uc, up);
            }, () => {
                ((Fade)Track.TraversePath(path)).Remove(index);
            });

            _fade.Remove(index);
        }
Exemplo n.º 10
0
        void Thumb_Delete(FadeThumb sender)
        {
            int index = thumbs.IndexOf(sender);

            Color      uc   = _fade.GetColor(index).Clone();
            double     up   = _fade.GetPosition(index);
            FadeType   ut   = _fade.GetFadeType(index);
            List <int> path = Track.GetPath(_fade);

            Program.Project.Undo.Add($"Fade Color {index + 1} Removed", () => {
                Track.TraversePath <Fade>(path).Insert(index, uc, up, ut);
            }, () => {
                Track.TraversePath <Fade>(path).Remove(index);
            });

            _fade.Remove(index);
        }
Exemplo n.º 11
0
        public void Contents_Insert(int index, Color color)
        {
            FadeThumb thumb = new FadeThumb();

            thumbs.Insert(index, thumb);
            Canvas.SetLeft(thumb, (double)_fade.GetPosition(index) * 200);

            thumb.Moved   += Thumb_Move;
            thumb.Focused += Thumb_Focus;
            thumb.Deleted += Thumb_Delete;
            thumb.Fill     = color.ToBrush();

            canvas.Children.Add(thumb);
            if (current != null && index <= current)
            {
                current++;
            }
        }
Exemplo n.º 12
0
 void Thumb_Focus(FadeThumb sender) => Expand(thumbs.IndexOf(sender));
Exemplo n.º 13
0
 public FadeType GetFadeType(FadeThumb sender) => _fade.GetFadeType(thumbs.IndexOf(sender));
Exemplo n.º 14
0
 void Thumb_ChangeFadeType(FadeThumb sender, FadeType newType) => Program.Project.Undo.AddAndExecute(new Fade.ThumbTypeUndoEntry(
                                                                                                         _fade,
                                                                                                         thumbs.IndexOf(sender),
                                                                                                         newType
                                                                                                         ));
Exemplo n.º 15
0
 void Thumb_EndHere(FadeThumb sender) => Program.Project.Undo.AddAndExecute(new Fade.EndHereUndoEntry(
                                                                                _fade,
                                                                                thumbs.IndexOf(sender)
                                                                                ));
Exemplo n.º 16
0
 void Thumb_Delete(FadeThumb sender) => Program.Project.Undo.AddAndExecute(new Fade.ThumbRemoveUndoEntry(
                                                                               _fade,
                                                                               thumbs.IndexOf(sender)
                                                                               ));