bartekmotyl / simple-video-cutter

Windows-based tool for efficient browsing and cutting video footage
MIT License
320 stars 42 forks source link

Selection info & buttons not updated when using right mouse click #1

Closed LwRed closed 5 years ago

LwRed commented 5 years ago

Hello, If you are interested, i noticed a bug: when you select with mouse right button the update buttons and label selection don’t Work.

Thanks a lot

bartekmotyl commented 5 years ago

Thanks. Indeed, the selection & buttons are not updated when you select with right mouse click.
Will be fixed in next release.

LwRed commented 5 years ago

Here is a possible fix First on VideoTimelineCutter.cs (See //Fix and also //Update if you want). Thanks again for your code, very useful for me

private void VideoCutterTimeline_MouseClick(object sender, MouseEventArgs e) { var clientLocation = e.Location; var pos = (Length == 0 ? (long)0 : (long)(clientLocation.X / (float)ClientRectangle.Width * (float)Length));

        if (e.Button == MouseButtons.Left)
        {
            TimelineClicked?.Invoke(this, new TimelineClickedEventArgs()
            {
                ClickedPosition = pos,

            });

        }
        if (e.Button == MouseButtons.Right)
        {
            if (SelectionStart != null && SelectionEnd != null) // est différent de null
            {
                SelectionStart = null;
                SelectionEnd = null;
            }

            if (SelectionStart == null)
            {

                SelectionStart = pos;

// First Fix TimelineClicked?.Invoke(this, new TimelineClickedEventArgs() { ClickedPosition = pos,

                });
            }

// Possible Update if the user want to move the Start Position else if (SelectionStart != null && pos < SelectionStart) {

                SelectionStart = pos;

//With the Fix TimelineClicked?.Invoke(this, new TimelineClickedEventArgs() { ClickedPosition = pos,

                });
            }
            else
            {
                SelectionEnd = pos;

//Fix TimelineClicked?.Invoke(this, new TimelineClickedEventArgs() { ClickedPosition = pos,

                });

            }

            Invalidate();
        }
    }
LwRed commented 5 years ago

Second on MainForm.cs

  private void VideoCutterTimeline1_TimelineClicked(object sender, TimelineClickedEventArgs e)
    {
        if (vlcControl1.VlcMediaPlayer.IsSeekable)
        {
            vlcControl1.VlcMediaPlayer.Time = e.ClickedPosition;
            videoCutterTimeline1.InvokeIfRequired(() =>
            {
                videoCutterTimeline1.Position = (int)(e.ClickedPosition);
            });
        }

//Bug Fix UpdateSelectionLabel(); EnableButtons(); }

bartekmotyl commented 5 years ago

Fixed in development in commit 0b2a3b42ff98005b0a31809c4dd9e4f807ca8957