Skip to content

Commit

Permalink
Add the ability to navigate to a specific timeline time and modify cut
Browse files Browse the repository at this point in the history
start/end via manual input
  • Loading branch information
philipbutkiewicz committed Mar 29, 2024
1 parent d9948ca commit fa95b4f
Show file tree
Hide file tree
Showing 18 changed files with 20,769 additions and 289 deletions.
101 changes: 72 additions & 29 deletions SharpCut/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

105 changes: 105 additions & 0 deletions SharpCut/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,58 @@ private void SetCutEndTime()
AutoSaveFile();
}

/// <summary>
/// Sets cut start time from user input.
/// </summary>
private void SetCutStartTimeFromInput()
{
if (timeline.SelectedSection == null) return;

using (TimeInputDialog timeInputDialog = new TimeInputDialog())
{
timeInputDialog.LabelText = Resources.SetCutStartTimeInput;
timeInputDialog.Time = timeline.SelectedSection.Start;
timeInputDialog.MinTime = 0d;
timeInputDialog.MaxTime = timeline.SelectedSection.End - 1d;

if (timeInputDialog.ShowDialog() == DialogResult.OK)
{
timeline.Time = timeInputDialog.Time;

timeline_TimeChanged(this, new TimeChangedEventArgs(false));

HidePreviewFrame();
SetCutStartTime();
}
}
}

/// <summary>
/// Sets cut end time from user input.
/// </summary>
private void SetCutEndTimeFromInput()
{
if (timeline.SelectedSection == null) return;

using (TimeInputDialog timeInputDialog = new TimeInputDialog())
{
timeInputDialog.LabelText = Resources.SetCutEndTimeInput;
timeInputDialog.Time = timeline.SelectedSection.End;
timeInputDialog.MinTime = timeline.SelectedSection.Start + 1d;
timeInputDialog.MaxTime = timeline.Duration;

if (timeInputDialog.ShowDialog() == DialogResult.OK)
{
timeline.Time = timeInputDialog.Time;

timeline_TimeChanged(this, new TimeChangedEventArgs(false));

HidePreviewFrame();
SetCutEndTime();
}
}
}

/// <summary>
/// Navigates to previous segment start/end.
/// </summary>
Expand Down Expand Up @@ -630,6 +682,29 @@ private void NavigateToMediaEnd()
HidePreviewFrame();
}

/// <summary>
/// Set timeline time from user input.
/// </summary>
private void SetTimelineTimeFromInput()
{
using (TimeInputDialog timeInputDialog = new TimeInputDialog())
{
timeInputDialog.LabelText = Resources.SetTimelineTimeInput;
timeInputDialog.Time = timeline.Time;
timeInputDialog.MinTime = 0d;
timeInputDialog.MaxTime = timeline.Duration;

if (timeInputDialog.ShowDialog() == DialogResult.OK)
{
timeline.Time = timeInputDialog.Time;

timeline_TimeChanged(this, new TimeChangedEventArgs(false));

HidePreviewFrame();
}
}
}

/// <summary>
/// Updates the selection label (current time).
/// </summary>
Expand Down Expand Up @@ -1183,6 +1258,36 @@ private void goToVideoEndToolStripMenuItem_Click(object sender, EventArgs e)
NavigateToMediaEnd();
}

/// <summary>
/// Enter cut start time toolstip item event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void enterCutStartTimeToolStripMenuItem_Click(object sender, EventArgs e)
{
SetCutStartTimeFromInput();
}

/// <summary>
/// Enter cut end time toolstip item event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void enterCutEndTimeToolStripMenuItem_Click(object sender, EventArgs e)
{
SetCutEndTimeFromInput();
}

/// <summary>
/// Navigate to specific timeline position toolstip item event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void navigateToSpecificTimelinePositionToolStripMenuItem_Click(object sender, EventArgs e)
{
SetTimelineTimeFromInput();
}

/// <summary>
/// Merge files toolstrip item event.
/// </summary>
Expand Down
Loading

0 comments on commit fa95b4f

Please sign in to comment.