Work on "scene change list window"

This commit is contained in:
niksedk 2021-11-19 15:46:19 +01:00
parent 782089a4e2
commit 9ca29ec8aa
15 changed files with 543 additions and 21 deletions

View File

@ -16,6 +16,7 @@
* Add "Count" label in "Go to bookmark" - thx OmrSi
* Speed up slow loading mp4 without subs as sub - thx Leon
* Auto-load audio file after import plain text - thx Leon
* "Remove sceen changes" now has overview window w export - thx Marek
* FIXED:
* Fix selected line in "set start and offset the rest" - thx Janusz/Tom
* Fix issue with "Fix invalid italic tags" - thx Charvelx04

View File

@ -1218,7 +1218,7 @@ To use an API key go to "Options -> Settings -> Tools" to enter your Googl
<GenerateVideoWithBurnedInSub>Generate video with burned-in sub...</GenerateVideoWithBurnedInSub>
<ImportChaptersFromVideo>Import chapters from video</ImportChaptersFromVideo>
<GenerateImportSceneChanges>Generate/import scene changes...</GenerateImportSceneChanges>
<RemoveSceneChanges>Remove scene changes</RemoveSceneChanges>
<RemoveOrExportSceneChanges>Remove/export scene changes...</RemoveOrExportSceneChanges>
<WaveformBatchGenerate>Batch generate waveforms...</WaveformBatchGenerate>
<ShowHideVideo>Show/hide video</ShowHideVideo>
<ShowHideWaveform>Show/hide waveform</ShowHideWaveform>
@ -2360,6 +2360,7 @@ can edit in same subtitle file (collaboration)</Information>
<WaveformGoToPreviousSceneChange>Go to previous scene change</WaveformGoToPreviousSceneChange>
<WaveformGoToNextSceneChange>Go to next scene change</WaveformGoToNextSceneChange>
<WaveformToggleSceneChange>Toggle scene change</WaveformToggleSceneChange>
<WaveformRemoveOrExportSceneChanges>Remove/export scene changes</WaveformRemoveOrExportSceneChanges>
<WaveformGuessStart>Auto adjust start via volume/scene change</WaveformGuessStart>
<GoBack1Frame>One frame back</GoBack1Frame>
<GoForward1Frame>One frame forward</GoForward1Frame>

View File

@ -2269,6 +2269,7 @@ $HorzAlign = Center
public string WaveformGoToPreviousSceneChange { get; set; }
public string WaveformGoToNextSceneChange { get; set; }
public string WaveformToggleSceneChange { get; set; }
public string WaveformListSceneChanges { get; set; }
public string WaveformGuessStart { get; set; }
public string Waveform100MsLeft { get; set; }
public string Waveform100MsRight { get; set; }
@ -8680,6 +8681,12 @@ $HorzAlign = Center
shortcuts.WaveformToggleSceneChange = subNode.InnerText;
}
subNode = node.SelectSingleNode("WaveformListSceneChanges");
if (subNode != null)
{
shortcuts.WaveformListSceneChanges = subNode.InnerText;
}
subNode = node.SelectSingleNode("WaveformGuessStart");
if (subNode != null)
{
@ -9913,6 +9920,7 @@ $HorzAlign = Center
textWriter.WriteElementString("WaveformGoToPreviousSceneChange", shortcuts.WaveformGoToPreviousSceneChange);
textWriter.WriteElementString("WaveformGoToNextSceneChange", shortcuts.WaveformGoToNextSceneChange);
textWriter.WriteElementString("WaveformToggleSceneChange", shortcuts.WaveformToggleSceneChange);
textWriter.WriteElementString("WaveformListSceneChanges", shortcuts.WaveformListSceneChanges);
textWriter.WriteElementString("WaveformGuessStart", shortcuts.WaveformGuessStart);
textWriter.WriteElementString("Waveform100MsLeft", shortcuts.Waveform100MsLeft);
textWriter.WriteElementString("Waveform100MsRight", shortcuts.Waveform100MsRight);

View File

@ -227,7 +227,7 @@ namespace Nikse.SubtitleEdit.Forms
this.smpteTimeModedropFrameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemImportChapters = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemImportSceneChanges = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemRemoveSceneChanges = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemListSceneChanges = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemAddWaveformBatch = new System.Windows.Forms.ToolStripMenuItem();
this.generateBlankVideoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.generateVideoWithHardcodedSubtitleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -2125,7 +2125,7 @@ namespace Nikse.SubtitleEdit.Forms
this.smpteTimeModedropFrameToolStripMenuItem,
this.toolStripMenuItemImportChapters,
this.toolStripMenuItemImportSceneChanges,
this.toolStripMenuItemRemoveSceneChanges,
this.toolStripMenuItemListSceneChanges,
this.toolStripMenuItemAddWaveformBatch,
this.generateBlankVideoToolStripMenuItem,
this.generateVideoWithHardcodedSubtitleToolStripMenuItem,
@ -2210,12 +2210,12 @@ namespace Nikse.SubtitleEdit.Forms
this.toolStripMenuItemImportSceneChanges.Text = "Import scene changes...";
this.toolStripMenuItemImportSceneChanges.Click += new System.EventHandler(this.toolStripMenuItemImportSceneChanges_Click);
//
// toolStripMenuItemRemoveSceneChanges
// toolStripMenuItemListSceneChanges
//
this.toolStripMenuItemRemoveSceneChanges.Name = "toolStripMenuItemRemoveSceneChanges";
this.toolStripMenuItemRemoveSceneChanges.Size = new System.Drawing.Size(295, 22);
this.toolStripMenuItemRemoveSceneChanges.Text = "Remove scene changes";
this.toolStripMenuItemRemoveSceneChanges.Click += new System.EventHandler(this.toolStripMenuItemRemoveSceneChanges_Click);
this.toolStripMenuItemListSceneChanges.Name = "toolStripMenuItemListSceneChanges";
this.toolStripMenuItemListSceneChanges.Size = new System.Drawing.Size(295, 22);
this.toolStripMenuItemListSceneChanges.Text = "List scene changes";
this.toolStripMenuItemListSceneChanges.Click += new System.EventHandler(this.toolStripMenuItemListSceneChanges_Click);
//
// toolStripMenuItemAddWaveformBatch
//
@ -5854,7 +5854,7 @@ namespace Nikse.SubtitleEdit.Forms
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemMeasurementConverter;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemImportChapters;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemImportSceneChanges;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemRemoveSceneChanges;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemListSceneChanges;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSubtitlesBridgeGaps;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemOpenDvd;
private System.Windows.Forms.ToolStripMenuItem styleToolStripMenuItem;

View File

@ -1644,7 +1644,7 @@ namespace Nikse.SubtitleEdit.Forms
smpteTimeModedropFrameToolStripMenuItem.Text = _language.Menu.Video.SmptTimeMode;
toolStripMenuItemImportChapters.Text = _language.Menu.Video.ImportChaptersFromVideo;
toolStripMenuItemImportSceneChanges.Text = _language.Menu.Video.GenerateImportSceneChanges;
toolStripMenuItemRemoveSceneChanges.Text = _language.Menu.Video.RemoveSceneChanges;
toolStripMenuItemListSceneChanges.Text = _language.Menu.Video.RemoveOrExportSceneChanges;
toolStripMenuItemAddWaveformBatch.Text = _language.Menu.Video.WaveformBatchGenerate;
@ -23213,6 +23213,7 @@ namespace Nikse.SubtitleEdit.Forms
closeVideoToolStripMenuItem.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoClose);
showhideVideoToolStripMenuItem.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoShowHideVideo);
showhideWaveformToolStripMenuItem.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoShowWaveform);
toolStripMenuItemListSceneChanges.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformListSceneChanges);
toolStripMenuItemBookmark.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralToggleBookmarksWithText);
toolStripMenuItemGoToSourceView.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralToggleView);
toolStripMenuItemEmptyGoToSourceView.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralToggleView);
@ -26314,12 +26315,12 @@ namespace Nikse.SubtitleEdit.Forms
if (mediaPlayer.VideoPlayer != null && audioVisualizer.WavePeaks != null && audioVisualizer.WavePeaks.Peaks.Count > 0)
{
toolStripMenuItemImportSceneChanges.Visible = true;
toolStripMenuItemRemoveSceneChanges.Visible = audioVisualizer.SceneChanges.Count > 0;
toolStripMenuItemListSceneChanges.Visible = audioVisualizer.SceneChanges.Count > 0;
}
else
{
toolStripMenuItemImportSceneChanges.Visible = false;
toolStripMenuItemRemoveSceneChanges.Visible = false;
toolStripMenuItemListSceneChanges.Visible = false;
}
if (mediaPlayer.VideoPlayer != null && VideoFileName.EndsWith(".mkv", StringComparison.OrdinalIgnoreCase))
@ -30026,12 +30027,19 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void toolStripMenuItemRemoveSceneChanges_Click(object sender, EventArgs e)
private void toolStripMenuItemListSceneChanges_Click(object sender, EventArgs e)
{
if (audioVisualizer.SceneChanges != null)
using (var form = new SceneChangesList(_fileName, audioVisualizer.SceneChanges))
{
audioVisualizer.SceneChanges = new List<double>();
SceneChangeHelper.DeleteSceneChanges(VideoFileName);
if (form.ShowDialog(this) == DialogResult.OK)
{
audioVisualizer.SceneChanges = form.SceneChanges;
SceneChangeHelper.SaveSceneChanges(VideoFileName, audioVisualizer.SceneChanges);
if (mediaPlayer.VideoPlayer != null && form.SceneChangeSeconds >= 0)
{
mediaPlayer.VideoPlayer.CurrentPosition = form.SceneChangeSeconds;
}
}
}
}

View File

@ -791,7 +791,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
CAAAAk1TRnQBSQFMAgEBAgEAATQBLAE0ASwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAgEAATwBLAE8ASwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -1564,6 +1564,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
AddNode(audioVisualizerNode, language.WaveformGoToPreviousSceneChange, nameof(Configuration.Settings.Shortcuts.WaveformGoToPreviousSceneChange));
AddNode(audioVisualizerNode, language.WaveformGoToNextSceneChange, nameof(Configuration.Settings.Shortcuts.WaveformGoToNextSceneChange));
AddNode(audioVisualizerNode, language.WaveformToggleSceneChange, nameof(Configuration.Settings.Shortcuts.WaveformToggleSceneChange));
AddNode(audioVisualizerNode, language.WaveformRemoveOrExportSceneChanges, nameof(Configuration.Settings.Shortcuts.WaveformListSceneChanges), true);
AddNode(audioVisualizerNode, language.WaveformGuessStart, nameof(Configuration.Settings.Shortcuts.WaveformGuessStart));
AddNode(audioVisualizerNode, language.GoBack100Milliseconds, nameof(Configuration.Settings.Shortcuts.Waveform100MsLeft));
AddNode(audioVisualizerNode, language.GoForward100Milliseconds, nameof(Configuration.Settings.Shortcuts.Waveform100MsRight));

173
src/ui/Forms/SceneChangesList.Designer.cs generated Normal file
View File

@ -0,0 +1,173 @@
namespace Nikse.SubtitleEdit.Forms
{
sealed partial class SceneChangesList
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.buttonCancel = new System.Windows.Forms.Button();
this.buttonOK = new System.Windows.Forms.Button();
this.buttonExport = new System.Windows.Forms.Button();
this.labelCount = new System.Windows.Forms.Label();
this.listViewSceneChanges = new System.Windows.Forms.ListView();
this.columnHeaderNumber = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderStartTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonCancel.Location = new System.Drawing.Point(410, 308);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 40;
this.buttonCancel.Text = "C&ancel";
this.buttonCancel.UseVisualStyleBackColor = true;
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonOK.Location = new System.Drawing.Point(329, 308);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 30;
this.buttonOK.Text = "&OK";
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// buttonExport
//
this.buttonExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonExport.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonExport.Location = new System.Drawing.Point(226, 308);
this.buttonExport.Name = "buttonExport";
this.buttonExport.Size = new System.Drawing.Size(97, 23);
this.buttonExport.TabIndex = 20;
this.buttonExport.Text = "Export...";
this.buttonExport.UseVisualStyleBackColor = true;
this.buttonExport.Click += new System.EventHandler(this.buttonExport_Click);
//
// labelCount
//
this.labelCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.labelCount.AutoSize = true;
this.labelCount.Location = new System.Drawing.Point(13, 310);
this.labelCount.Name = "labelCount";
this.labelCount.Size = new System.Drawing.Size(55, 13);
this.labelCount.TabIndex = 10;
this.labelCount.Text = "Count: {0}";
//
// listViewSceneChanges
//
this.listViewSceneChanges.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listViewSceneChanges.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeaderNumber,
this.columnHeaderStartTime});
this.listViewSceneChanges.ContextMenuStrip = this.contextMenuStrip1;
this.listViewSceneChanges.FullRowSelect = true;
this.listViewSceneChanges.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.listViewSceneChanges.HideSelection = false;
this.listViewSceneChanges.Location = new System.Drawing.Point(13, 12);
this.listViewSceneChanges.Name = "listViewSceneChanges";
this.listViewSceneChanges.Size = new System.Drawing.Size(472, 289);
this.listViewSceneChanges.TabIndex = 0;
this.listViewSceneChanges.UseCompatibleStateImageBehavior = false;
this.listViewSceneChanges.View = System.Windows.Forms.View.Details;
this.listViewSceneChanges.DoubleClick += new System.EventHandler(this.listViewSceneChanges_DoubleClick);
//
// columnHeaderNumber
//
this.columnHeaderNumber.Width = 50;
//
// columnHeaderStartTime
//
this.columnHeaderStartTime.Width = 75;
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.removeToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(142, 26);
//
// removeToolStripMenuItem
//
this.removeToolStripMenuItem.Name = "removeToolStripMenuItem";
this.removeToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Delete;
this.removeToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
this.removeToolStripMenuItem.Text = "Remove";
this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click);
//
// SceneChangesList
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(497, 341);
this.Controls.Add(this.labelCount);
this.Controls.Add(this.buttonExport);
this.Controls.Add(this.listViewSceneChanges);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.buttonCancel);
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(458, 380);
this.Name = "SceneChangesList";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Scene change list";
this.Shown += new System.EventHandler(this.SceneChangesList_Shown);
this.ResizeEnd += new System.EventHandler(this.SceneChangesList_ResizeEnd);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SceneChangesList_KeyDown);
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Button buttonExport;
private System.Windows.Forms.Label labelCount;
private System.Windows.Forms.ListView listViewSceneChanges;
private System.Windows.Forms.ColumnHeader columnHeaderNumber;
private System.Windows.Forms.ColumnHeader columnHeaderStartTime;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem;
}
}

View File

@ -0,0 +1,191 @@
using Nikse.SubtitleEdit.Core.Common;
using Nikse.SubtitleEdit.Core.SubtitleFormats;
using Nikse.SubtitleEdit.Logic;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Nikse.SubtitleEdit.Forms
{
public sealed partial class SceneChangesList : Form
{
public List<double> SceneChanges { get; set; }
private readonly string _subtitleFileName;
public double SceneChangeSeconds { get; private set; }
public SceneChangesList(string subtitleFileName, List<double> sceneChanges)
{
UiUtil.PreInitialize(this);
InitializeComponent();
UiUtil.FixFonts(this);
Text = LanguageSettings.Current.Settings.WaveformRemoveOrExportSceneChanges;
buttonExport.Text = LanguageSettings.Current.MultipleReplace.Export;
buttonOK.Text = LanguageSettings.Current.General.Ok;
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
columnHeaderNumber.Text = LanguageSettings.Current.General.NumberSymbol;
columnHeaderStartTime.Text = LanguageSettings.Current.General.StartTime;
removeToolStripMenuItem.Text = LanguageSettings.Current.SubStationAlphaStyles.Remove;
SceneChanges = new List<double>(sceneChanges);
_subtitleFileName = subtitleFileName;
FillListView();
}
private void FillListView()
{
var i = 0;
listViewSceneChanges.BeginUpdate();
listViewSceneChanges.Items.Clear();
foreach (var sceneChange in SceneChanges)
{
i++;
ListViewItem item = new ListViewItem("#" + i) { Tag = sceneChange };
item.SubItems.Add(TimeCode.FromSeconds(sceneChange).ToDisplayString());
listViewSceneChanges.Items.Add(item);
}
listViewSceneChanges.EndUpdate();
labelCount.Text = $"{LanguageSettings.Current.FindDialog.Count}: {SceneChanges.Count}";
}
private void listViewSceneChanges_DoubleClick(object sender, EventArgs e)
{
if (listViewSceneChanges.SelectedItems.Count > 0)
{
SceneChangeSeconds = (double)listViewSceneChanges.SelectedItems[0].Tag;
DialogResult = DialogResult.OK;
}
}
private void buttonOK_Click(object sender, EventArgs e)
{
if (listViewSceneChanges.SelectedItems.Count > 0)
{
SceneChangeSeconds = (double)listViewSceneChanges.SelectedItems[0].Tag;
DialogResult = DialogResult.OK;
}
SceneChangeSeconds = -1;
DialogResult = DialogResult.OK;
}
private void SceneChangesList_KeyDown(object sender, KeyEventArgs e)
{
if (listViewSceneChanges.Focused && e.KeyCode == Keys.Enter)
{
buttonOK_Click(sender, e);
}
else if (e.KeyCode == Keys.Escape)
{
DialogResult = DialogResult.Cancel;
}
else if (e.KeyCode == Keys.A && e.Modifiers == Keys.Control)
{
listViewSceneChanges.SelectAll();
e.SuppressKeyPress = true;
}
else if (e.KeyCode == Keys.D && e.Modifiers == Keys.Control)
{
listViewSceneChanges.SelectFirstSelectedItemOnly();
e.SuppressKeyPress = true;
}
else if (e.KeyCode == Keys.I && e.Modifiers == (Keys.Control | Keys.Shift))
{
listViewSceneChanges.InverseSelection();
e.SuppressKeyPress = true;
}
}
private void SceneChangesList_ResizeEnd(object sender, EventArgs e)
{
listViewSceneChanges.AutoSizeLastColumn();
}
private void SceneChangesList_Shown(object sender, EventArgs e)
{
SceneChangesList_ResizeEnd(sender, e);
listViewSceneChanges.Focus();
}
private void buttonExport_Click(object sender, EventArgs e)
{
ExportSceneChanges(SceneChanges, this);
}
public void ExportSceneChanges(List<double> sceneChanges, Form form)
{
using (var saveDialog = new SaveFileDialog { FileName = GetFileName(), Filter = "Seconds|*.txt|Milliseconds|*.txt|Frames|*.txt" })
{
if (saveDialog.ShowDialog(form) != DialogResult.OK)
{
return;
}
var sb = new StringBuilder();
foreach (var sc in sceneChanges)
{
if (saveDialog.FilterIndex == 1)
{
sb.AppendLine(sc.ToString(CultureInfo.InvariantCulture));
}
else if (saveDialog.FilterIndex == 2)
{
sb.AppendLine(((long)Math.Round(sc * 1000.0)).ToString(CultureInfo.InvariantCulture));
}
else if (saveDialog.FilterIndex == 3)
{
sb.AppendLine(SubtitleFormat.MillisecondsToFrames(sc * 1000.0).ToString(CultureInfo.InvariantCulture));
}
}
File.WriteAllText(saveDialog.FileName, sb.ToString());
}
}
private string GetFileName()
{
if (string.IsNullOrEmpty(_subtitleFileName))
{
return "scene_changes.txt";
}
return Path.GetFileNameWithoutExtension(_subtitleFileName) + "_scene_changes.txt";
}
private void removeToolStripMenuItem_Click(object sender, EventArgs e)
{
if (listViewSceneChanges.SelectedItems.Count == 0)
{
return;
}
string askText = listViewSceneChanges.SelectedItems.Count > 1 ?
string.Format(LanguageSettings.Current.Main.DeleteXLinesPrompt, listViewSceneChanges.SelectedItems.Count) :
LanguageSettings.Current.Main.DeleteOneLinePrompt;
if (Configuration.Settings.General.PromptDeleteLines
&& MessageBox.Show(askText, string.Empty, MessageBoxButtons.YesNoCancel) != DialogResult.Yes)
{
return;
}
var indices = new List<int>();
foreach (ListViewItem selectedItem in listViewSceneChanges.SelectedItems)
{
indices.Add(selectedItem.Index);
}
foreach (var index in indices.OrderByDescending(p=>p))
{
SceneChanges.RemoveAt(index);
}
FillListView();
}
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -1745,7 +1745,7 @@ namespace Nikse.SubtitleEdit.Logic
GenerateVideoWithBurnedInSub = "Generate video with burned-in sub...",
ImportChaptersFromVideo = "Import chapters from video",
GenerateImportSceneChanges = "Generate/import scene changes...",
RemoveSceneChanges = "Remove scene changes",
RemoveOrExportSceneChanges = "Remove/export scene changes...",
WaveformBatchGenerate = "Batch generate waveforms...",
ShowHideVideo = "Show/hide video",
ShowHideWaveform = "Show/hide waveform",
@ -2692,6 +2692,7 @@ can edit in same subtitle file (collaboration)",
WaveformGoToPreviousSceneChange = "Go to previous scene change",
WaveformGoToNextSceneChange = "Go to next scene change",
WaveformToggleSceneChange = "Toggle scene change",
WaveformRemoveOrExportSceneChanges = "Remove/export scene changes",
WaveformGuessStart = "Auto adjust start via volume/scene change",
GoBack1Frame = "One frame back",
GoForward1Frame = "One frame forward",

View File

@ -4063,8 +4063,8 @@ namespace Nikse.SubtitleEdit.Logic
case "Main/Menu/Video/GenerateImportSceneChanges":
language.Main.Menu.Video.GenerateImportSceneChanges = reader.Value;
break;
case "Main/Menu/Video/RemoveSceneChanges":
language.Main.Menu.Video.RemoveSceneChanges = reader.Value;
case "Main/Menu/Video/RemoveOrExportSceneChanges":
language.Main.Menu.Video.RemoveOrExportSceneChanges = reader.Value;
break;
case "Main/Menu/Video/WaveformBatchGenerate":
language.Main.Menu.Video.WaveformBatchGenerate = reader.Value;
@ -6454,6 +6454,9 @@ namespace Nikse.SubtitleEdit.Logic
case "Settings/WaveformToggleSceneChange":
language.Settings.WaveformToggleSceneChange = reader.Value;
break;
case "Settings/WaveformRemoveOrExportSceneChanges":
language.Settings.WaveformRemoveOrExportSceneChanges = reader.Value;
break;
case "Settings/WaveformGuessStart":
language.Settings.WaveformGuessStart = reader.Value;
break;

View File

@ -1594,7 +1594,7 @@
public string GenerateVideoWithBurnedInSub { get; set; }
public string ImportChaptersFromVideo { get; set; }
public string GenerateImportSceneChanges { get; set; }
public string RemoveSceneChanges { get; set; }
public string RemoveOrExportSceneChanges { get; set; }
public string WaveformBatchGenerate { get; set; }
public string ShowHideVideo { get; set; }
public string ShowHideWaveform { get; set; }
@ -2540,6 +2540,7 @@
public string WaveformGoToPreviousSceneChange { get; set; }
public string WaveformGoToNextSceneChange { get; set; }
public string WaveformToggleSceneChange { get; set; }
public string WaveformRemoveOrExportSceneChanges { get; set; }
public string WaveformGuessStart { get; set; }
public string GoBack1Frame { get; set; }
public string GoForward1Frame { get; set; }

View File

@ -206,6 +206,7 @@ namespace Nikse.SubtitleEdit.Logic
public Keys WaveformGoToPreviousSceneChange { get; set; }
public Keys WaveformGoToNextSceneChange { get; set; }
public Keys WaveformToggleSceneChange { get; set; }
public Keys WaveformListSceneChanges { get; set; }
public Keys WaveformGuessStart { get; set; }
public Keys MainTranslateGoogleIt { get; set; }
public Keys MainTranslateGoogleTranslateIt { get; set; }
@ -418,6 +419,7 @@ namespace Nikse.SubtitleEdit.Logic
WaveformGoToPreviousSceneChange = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformGoToPreviousSceneChange);
WaveformGoToNextSceneChange = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformGoToNextSceneChange);
WaveformToggleSceneChange = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformToggleSceneChange);
WaveformListSceneChanges = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformListSceneChanges);
WaveformGuessStart = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformGuessStart);
MainTranslateGoogleIt = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTranslateGoogleIt);
MainTranslateGoogleTranslateIt = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTranslateGoogleTranslateIt);

View File

@ -222,6 +222,12 @@
<Compile Include="Forms\AddWaveformBatch.Designer.cs">
<DependentUpon>AddWaveformBatch.cs</DependentUpon>
</Compile>
<Compile Include="Forms\SceneChangesList.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\SceneChangesList.Designer.cs">
<DependentUpon>SceneChangesList.cs</DependentUpon>
</Compile>
<Compile Include="Forms\DownloadYouTubeDl.cs">
<SubType>Form</SubType>
</Compile>
@ -1368,6 +1374,9 @@
<EmbeddedResource Include="Forms\AddWaveformBatch.resx">
<DependentUpon>AddWaveformBatch.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\SceneChangesList.resx">
<DependentUpon>SceneChangesList.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\DownloadYouTubeDl.resx">
<DependentUpon>DownloadYouTubeDl.cs</DependentUpon>
</EmbeddedResource>