diff --git a/Changelog.txt b/Changelog.txt index 77f56b274..54c80985c 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -2,8 +2,11 @@ 3.4.14 (xth September 2016) BETA * NEW: - * added "Netflix Timed Text" - thx Piotr + * Can now generate scene changes via FFmpeg + other scene changes improvements + * New shortcuts + * Added "Netflix Timed Text" - thx Piotr * Added format "MediaTransData" - thx Alice + * Added new subtitle format - thx emmanuel * Auto detection of Czech and Slovak languages - thx mm6502 * IMPROVED: * Updated Korean translation - thx domddol diff --git a/LanguageMaster.xml b/LanguageMaster.xml index 713560b01..b0ee26b26 100644 --- a/LanguageMaster.xml +++ b/LanguageMaster.xml @@ -687,7 +687,7 @@ Note: Do check free disk space. Frames Seconds Milliseconds - Get scene changes with FFMPEG + Get scene changes with FFmpeg Import plain text @@ -1853,6 +1853,7 @@ can edit in same subtitle file (collaboration) Play end of selection Play first selected subtitle Focus list view + Go to next scene change One frame back One frame forward 100 ms back @@ -2282,6 +2283,8 @@ Keep changes? Show waveform and spectrogram Show waveform only Show spectrogram only + Add scene change + Remove scene change Guess time codes... Seek silence... diff --git a/libse/Language.cs b/libse/Language.cs index 0fcc2fc58..8a6856d20 100644 --- a/libse/Language.cs +++ b/libse/Language.cs @@ -886,7 +886,7 @@ namespace Nikse.SubtitleEdit.Core Frames = "Frames", Seconds = "Seconds", Milliseconds = "Milliseconds", - GetSceneChangesWithFfmpeg = "Get scene changes with FFMPEG" + GetSceneChangesWithFfmpeg = "Get scene changes with FFmpeg" }; ImportText = new LanguageStructure.ImportText @@ -2135,6 +2135,7 @@ can edit in same subtitle file (collaboration)", WaveformPlayNewSelectionEnd = "Play end of selection", WaveformPlayFirstSelectedSubtitle = "Play first selected subtitle", WaveformFocusListView = "Focus list view", + WaveformGoToNextSceneChange = "Go to next scene change", GoBack1Frame = "One frame back", GoForward1Frame = "One frame forward", GoBack100Milliseconds = "100 ms back", @@ -2612,6 +2613,8 @@ Keep changes?", ShowWaveformAndSpectrogram = "Show waveform and spectrogram", ShowWaveformOnly = "Show waveform only", ShowSpectrogramOnly = "Show spectrogram only", + AddSceneChange = "Add scene change", + RemoveSceneChange = "Remove scene change", SeekSilence = "Seek silence...", GuessTimeCodes = "Guess time codes...", }; diff --git a/libse/LanguageDeserializer.cs b/libse/LanguageDeserializer.cs index e0d095dfe..4ddb79bba 100644 --- a/libse/LanguageDeserializer.cs +++ b/libse/LanguageDeserializer.cs @@ -5008,6 +5008,9 @@ namespace Nikse.SubtitleEdit.Core case "Settings/WaveformFocusListView": language.Settings.WaveformFocusListView = reader.Value; break; + case "Settings/WaveformGoToNextSceneChange": + language.Settings.WaveformGoToNextSceneChange = reader.Value; + break; case "Settings/GoBack1Frame": language.Settings.GoBack1Frame = reader.Value; break; @@ -6145,6 +6148,12 @@ namespace Nikse.SubtitleEdit.Core case "Waveform/ShowSpectrogramOnly": language.Waveform.ShowSpectrogramOnly = reader.Value; break; + case "Waveform/AddSceneChange": + language.Waveform.AddSceneChange = reader.Value; + break; + case "Waveform/RemoveSceneChange": + language.Waveform.RemoveSceneChange = reader.Value; + break; case "Waveform/GuessTimeCodes": language.Waveform.GuessTimeCodes = reader.Value; break; diff --git a/libse/LanguageStructure.cs b/libse/LanguageStructure.cs index 64ed9c1e3..45b4e012a 100644 --- a/libse/LanguageStructure.cs +++ b/libse/LanguageStructure.cs @@ -2015,6 +2015,7 @@ public string WaveformPlayNewSelectionEnd { get; set; } public string WaveformPlayFirstSelectedSubtitle { get; set; } public string WaveformFocusListView { get; set; } + public string WaveformGoToNextSceneChange { get; set; } public string GoBack1Frame { get; set; } public string GoForward1Frame { get; set; } public string GoBack100Milliseconds { get; set; } @@ -2489,8 +2490,11 @@ public string ShowWaveformAndSpectrogram { get; set; } public string ShowWaveformOnly { get; set; } public string ShowSpectrogramOnly { get; set; } + public string AddSceneChange { get; set; } + public string RemoveSceneChange { get; set; } public string GuessTimeCodes { get; set; } public string SeekSilence { get; set; } + } public class WaveformGenerateTimeCodes diff --git a/libse/Settings.cs b/libse/Settings.cs index 5202c4f54..d19cc8215 100644 --- a/libse/Settings.cs +++ b/libse/Settings.cs @@ -932,6 +932,7 @@ namespace Nikse.SubtitleEdit.Core public string WaveformAddTextHere { get; set; } public string WaveformAddTextHereFromClipboard { get; set; } public string WaveformFocusListView { get; set; } + public string WaveformGoToNextSceneChange { get; set; } public string MainTranslateCustomSearch1 { get; set; } public string MainTranslateCustomSearch2 { get; set; } public string MainTranslateCustomSearch3 { get; set; } @@ -2745,6 +2746,9 @@ namespace Nikse.SubtitleEdit.Core subNode = node.SelectSingleNode("WaveformFocusListView"); if (subNode != null) settings.Shortcuts.WaveformFocusListView = subNode.InnerText; + subNode = node.SelectSingleNode("WaveformGoToNextSceneChange"); + if (subNode != null) + settings.Shortcuts.WaveformGoToNextSceneChange = subNode.InnerText; subNode = node.SelectSingleNode("MainTranslateCustomSearch1"); if (subNode != null) settings.Shortcuts.MainTranslateCustomSearch1 = subNode.InnerText; @@ -3385,6 +3389,7 @@ namespace Nikse.SubtitleEdit.Core textWriter.WriteElementString("WaveformAddTextHere", settings.Shortcuts.WaveformAddTextHere); textWriter.WriteElementString("WaveformAddTextHereFromClipboard", settings.Shortcuts.WaveformAddTextHereFromClipboard); textWriter.WriteElementString("WaveformFocusListView", settings.Shortcuts.WaveformFocusListView); + textWriter.WriteElementString("WaveformGoToNextSceneChange", settings.Shortcuts.WaveformGoToNextSceneChange); textWriter.WriteElementString("MainTranslateCustomSearch1", settings.Shortcuts.MainTranslateCustomSearch1); textWriter.WriteElementString("MainTranslateCustomSearch2", settings.Shortcuts.MainTranslateCustomSearch2); textWriter.WriteElementString("MainTranslateCustomSearch3", settings.Shortcuts.MainTranslateCustomSearch3); diff --git a/libse/SubtitleFormats/Ebu.cs b/libse/SubtitleFormats/Ebu.cs index db11717ff..7178c657a 100644 --- a/libse/SubtitleFormats/Ebu.cs +++ b/libse/SubtitleFormats/Ebu.cs @@ -524,16 +524,16 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats get { return true; } } - public static void Save(string fileName, Subtitle subtitle) + public static bool Save(string fileName, Subtitle subtitle) { - Save(fileName, subtitle, false); + return Save(fileName, subtitle, false); } - public static void Save(string fileName, Subtitle subtitle, bool batchMode) + public static bool Save(string fileName, Subtitle subtitle, bool batchMode) { var header = new EbuGeneralSubtitleInformation(); if (EbuUiHelper == null) - return; + return false; if (subtitle.Header != null && subtitle.Header.Length == 1024 && (subtitle.Header.Contains("STL24") || subtitle.Header.Contains("STL25") || subtitle.Header.Contains("STL29") || subtitle.Header.Contains("STL30"))) { @@ -546,7 +546,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats } if (!batchMode && !EbuUiHelper.ShowDialogOk()) - return; + return false; using (var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write)) { @@ -637,6 +637,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats subtitleNumber++; } } + return true; } public override bool IsMine(List lines, string fileName) @@ -689,6 +690,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats byte lastExtensionBlockNumber = 0xff; JustificationCodes = new List(); VerticalPositions = new List(); + Configuration.Settings.General.CurrentFrameRate = header.FrameRate; foreach (EbuTextTimingInformation tti in ReadTextAndTiming(buffer, header)) { if (tti.ExtensionBlockNumber != 0xfe) // FEh : Reserved for User Data @@ -1058,12 +1060,12 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats tti.TimeCodeInHours = buffer[index + 5 + 0]; tti.TimeCodeInMinutes = buffer[index + 5 + 1]; tti.TimeCodeInSeconds = buffer[index + 5 + 2]; - tti.TimeCodeInMilliseconds = (int)Math.Round(TimeCode.BaseUnit / (header.FrameRate / buffer[index + 5 + 3])); + tti.TimeCodeInMilliseconds = FramesToMillisecondsMax999(buffer[index + 5 + 3]); tti.TimeCodeOutHours = buffer[index + 9 + 0]; tti.TimeCodeOutMinutes = buffer[index + 9 + 1]; tti.TimeCodeOutSeconds = buffer[index + 9 + 2]; - tti.TimeCodeOutMilliseconds = (int)Math.Round(TimeCode.BaseUnit / (header.FrameRate / buffer[index + 9 + 3])); + tti.TimeCodeOutMilliseconds = FramesToMillisecondsMax999(buffer[index + 9 + 3]); tti.VerticalPosition = buffer[index + 13]; VerticalPositions.Add(tti.VerticalPosition); diff --git a/src/Controls/AudioVisualizer.cs b/src/Controls/AudioVisualizer.cs index b9e057c23..6990858a5 100644 --- a/src/Controls/AudioVisualizer.cs +++ b/src/Controls/AudioVisualizer.cs @@ -508,15 +508,22 @@ namespace Nikse.SubtitleEdit.Controls // scene changes if (_sceneChanges != null) { - foreach (double time in _sceneChanges) + try { - int pos = SecondsToXPosition(time - StartPositionSeconds); - if (pos > 0 && pos < Width) + foreach (double time in _sceneChanges) { - using (var p = new Pen(Color.AntiqueWhite)) - graphics.DrawLine(p, pos, 0, pos, Height); + int pos = SecondsToXPosition(time - StartPositionSeconds); + if (pos > 0 && pos < Width) + { + using (var p = new Pen(Color.AntiqueWhite)) + graphics.DrawLine(p, pos, 0, pos, Height); + } } } + catch (Exception) + { + // ignored + } } // current video position diff --git a/src/Forms/ImportSceneChanges.Designer.cs b/src/Forms/ImportSceneChanges.Designer.cs index 4ff18459b..4e3924693 100644 --- a/src/Forms/ImportSceneChanges.Designer.cs +++ b/src/Forms/ImportSceneChanges.Designer.cs @@ -167,7 +167,7 @@ this.buttonImportWithFfmpeg.Name = "buttonImportWithFfmpeg"; this.buttonImportWithFfmpeg.Size = new System.Drawing.Size(319, 21); this.buttonImportWithFfmpeg.TabIndex = 2; - this.buttonImportWithFfmpeg.Text = "Get scene changes with FFMPEG"; + this.buttonImportWithFfmpeg.Text = "Get scene changes with FFmpeg"; this.buttonImportWithFfmpeg.UseVisualStyleBackColor = true; this.buttonImportWithFfmpeg.Click += new System.EventHandler(this.buttonImportWithFfmpeg_Click); // diff --git a/src/Forms/ImportSceneChanges.cs b/src/Forms/ImportSceneChanges.cs index 36e0073ad..246b477da 100644 --- a/src/Forms/ImportSceneChanges.cs +++ b/src/Forms/ImportSceneChanges.cs @@ -35,6 +35,7 @@ namespace Nikse.SubtitleEdit.Forms radioButtonSeconds.Text = Configuration.Settings.Language.ImportSceneChanges.Seconds; radioButtonMilliseconds.Text = Configuration.Settings.Language.ImportSceneChanges.Milliseconds; groupBoxTimeCodes.Text = Configuration.Settings.Language.ImportSceneChanges.TimeCodes; + buttonImportWithFfmpeg.Text = Configuration.Settings.Language.ImportSceneChanges.GetSceneChangesWithFfmpeg; buttonOK.Text = Configuration.Settings.Language.General.Ok; buttonCancel.Text = Configuration.Settings.Language.General.Cancel; UiUtil.FixLargeFonts(this, buttonOK); diff --git a/src/Forms/Main.Designer.cs b/src/Forms/Main.Designer.cs index ab7819615..99cdd182d 100644 --- a/src/Forms/Main.Designer.cs +++ b/src/Forms/Main.Designer.cs @@ -298,7 +298,6 @@ this.colorDialog1 = new System.Windows.Forms.ColorDialog(); this.fontDialog1 = new System.Windows.Forms.FontDialog(); this.groupBoxVideo = new System.Windows.Forms.GroupBox(); - this.audioVisualizer = new Nikse.SubtitleEdit.Controls.AudioVisualizer(); this.checkBoxSyncListViewWithVideoWhilePlaying = new System.Windows.Forms.CheckBox(); this.labelVideoInfo = new System.Windows.Forms.Label(); this.trackBarWaveformPosition = new System.Windows.Forms.TrackBar(); @@ -338,7 +337,6 @@ this.buttonPlayCurrent = new System.Windows.Forms.Button(); this.buttonPlayNext = new System.Windows.Forms.Button(); this.tabPageCreate = new System.Windows.Forms.TabPage(); - this.timeUpDownVideoPosition = new Nikse.SubtitleEdit.Controls.TimeUpDown(); this.buttonGotoSub = new System.Windows.Forms.Button(); this.buttonBeforeText = new System.Windows.Forms.Button(); this.buttonSetEnd = new System.Windows.Forms.Button(); @@ -375,7 +373,6 @@ this.labelVideoPosition2 = new System.Windows.Forms.Label(); this.buttonAdjustGoToPosAndPause = new System.Windows.Forms.Button(); this.buttonAdjustPlayBefore = new System.Windows.Forms.Button(); - this.timeUpDownVideoPositionAdjust = new Nikse.SubtitleEdit.Controls.TimeUpDown(); this.ShowSubtitleTimer = new System.Windows.Forms.Timer(this.components); this.timerAutoDuration = new System.Windows.Forms.Timer(this.components); this.timerAutoContinue = new System.Windows.Forms.Timer(this.components); @@ -403,7 +400,6 @@ this.tabControlSubtitle = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.splitContainerListViewAndText = new System.Windows.Forms.SplitContainer(); - this.SubtitleListview1 = new Nikse.SubtitleEdit.Controls.SubtitleListView(); this.groupBoxEdit = new System.Windows.Forms.GroupBox(); this.labelSingleLine = new System.Windows.Forms.Label(); this.labelAlternateSingleLine = new System.Windows.Forms.Label(); @@ -415,7 +411,6 @@ this.labelTextAlternateLineLengths = new System.Windows.Forms.Label(); this.labelAlternateText = new System.Windows.Forms.Label(); this.labelText = new System.Windows.Forms.Label(); - this.textBoxListViewTextAlternate = new Nikse.SubtitleEdit.Controls.SETextBox(); this.contextMenuStripTextBoxListView = new System.Windows.Forms.ContextMenuStrip(this.components); this.toolStripMenuItemWebVttVoice = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparatorWebVTT = new System.Windows.Forms.ToolStripSeparator(); @@ -449,23 +444,30 @@ this.labelTextLineTotal = new System.Windows.Forms.Label(); this.labelCharactersPerSecond = new System.Windows.Forms.Label(); this.buttonUnBreak = new System.Windows.Forms.Button(); - this.timeUpDownStartTime = new Nikse.SubtitleEdit.Controls.TimeUpDown(); this.numericUpDownDuration = new System.Windows.Forms.NumericUpDown(); this.buttonPrevious = new System.Windows.Forms.Button(); this.buttonNext = new System.Windows.Forms.Button(); this.labelStartTime = new System.Windows.Forms.Label(); - this.textBoxListViewText = new Nikse.SubtitleEdit.Controls.SETextBox(); this.labelDuration = new System.Windows.Forms.Label(); this.labelAutoDuration = new System.Windows.Forms.Label(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.textBoxSource = new System.Windows.Forms.TextBox(); this.panelVideoPlayer = new System.Windows.Forms.Panel(); - this.mediaPlayer = new Nikse.SubtitleEdit.Controls.VideoPlayerContainer(); this.contextMenuStripEmpty = new System.Windows.Forms.ContextMenuStrip(this.components); this.insertLineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.imageListPlayRate = new System.Windows.Forms.ImageList(this.components); this.timerTextUndo = new System.Windows.Forms.Timer(this.components); this.timerAlternateTextUndo = new System.Windows.Forms.Timer(this.components); + this.removeSceneChangeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.SubtitleListview1 = new Nikse.SubtitleEdit.Controls.SubtitleListView(); + this.textBoxListViewTextAlternate = new Nikse.SubtitleEdit.Controls.SETextBox(); + this.timeUpDownStartTime = new Nikse.SubtitleEdit.Controls.TimeUpDown(); + this.textBoxListViewText = new Nikse.SubtitleEdit.Controls.SETextBox(); + this.mediaPlayer = new Nikse.SubtitleEdit.Controls.VideoPlayerContainer(); + this.audioVisualizer = new Nikse.SubtitleEdit.Controls.AudioVisualizer(); + this.timeUpDownVideoPosition = new Nikse.SubtitleEdit.Controls.TimeUpDown(); + this.timeUpDownVideoPositionAdjust = new Nikse.SubtitleEdit.Controls.TimeUpDown(); + this.addSceneChangeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.statusStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); @@ -2670,43 +2672,6 @@ this.groupBoxVideo.TabIndex = 1; this.groupBoxVideo.TabStop = false; // - // audioVisualizer - // - this.audioVisualizer.AllowDrop = true; - this.audioVisualizer.AllowNewSelection = true; - this.audioVisualizer.AllowOverlap = false; - this.audioVisualizer.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.audioVisualizer.BackColor = System.Drawing.Color.Black; - this.audioVisualizer.BackgroundColor = System.Drawing.Color.Black; - this.audioVisualizer.Color = System.Drawing.Color.GreenYellow; - this.audioVisualizer.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(18))))); - this.audioVisualizer.Location = new System.Drawing.Point(472, 32); - this.audioVisualizer.Margin = new System.Windows.Forms.Padding(0); - this.audioVisualizer.Name = "audioVisualizer"; - this.audioVisualizer.NewSelectionParagraph = null; - this.audioVisualizer.ParagraphColor = System.Drawing.Color.LimeGreen; - this.audioVisualizer.SceneChanges = ((System.Collections.Generic.List)(resources.GetObject("audioVisualizer.SceneChanges"))); - this.audioVisualizer.SelectedColor = System.Drawing.Color.Red; - this.audioVisualizer.ShowGridLines = true; - this.audioVisualizer.ShowSpectrogram = false; - this.audioVisualizer.ShowWaveform = true; - this.audioVisualizer.Size = new System.Drawing.Size(499, 229); - this.audioVisualizer.StartPositionSeconds = 0D; - this.audioVisualizer.TabIndex = 6; - this.audioVisualizer.TextBold = true; - this.audioVisualizer.TextColor = System.Drawing.Color.Gray; - this.audioVisualizer.TextSize = 9F; - this.audioVisualizer.VerticalZoomFactor = 1D; - this.audioVisualizer.WaveformNotLoadedText = "Click to add waveform"; - this.audioVisualizer.WavePeaks = null; - this.audioVisualizer.ZoomFactor = 1D; - this.audioVisualizer.Click += new System.EventHandler(this.AudioWaveform_Click); - this.audioVisualizer.DragDrop += new System.Windows.Forms.DragEventHandler(this.AudioWaveformDragDrop); - this.audioVisualizer.DragEnter += new System.Windows.Forms.DragEventHandler(this.AudioWaveformDragEnter); - this.audioVisualizer.MouseEnter += new System.EventHandler(this.audioVisualizer_MouseEnter); - // // checkBoxSyncListViewWithVideoWhilePlaying // this.checkBoxSyncListViewWithVideoWhilePlaying.AutoSize = true; @@ -3167,17 +3132,6 @@ this.tabPageCreate.Text = "Create"; this.tabPageCreate.UseVisualStyleBackColor = true; // - // timeUpDownVideoPosition - // - this.timeUpDownVideoPosition.AutoSize = true; - this.timeUpDownVideoPosition.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.timeUpDownVideoPosition.Location = new System.Drawing.Point(96, 191); - this.timeUpDownVideoPosition.Margin = new System.Windows.Forms.Padding(4); - this.timeUpDownVideoPosition.Name = "timeUpDownVideoPosition"; - this.timeUpDownVideoPosition.Size = new System.Drawing.Size(96, 25); - this.timeUpDownVideoPosition.TabIndex = 12; - this.timeUpDownVideoPosition.UseVideoOffset = false; - // // buttonGotoSub // this.buttonGotoSub.Location = new System.Drawing.Point(6, 58); @@ -3612,17 +3566,6 @@ this.buttonAdjustPlayBefore.UseVisualStyleBackColor = true; this.buttonAdjustPlayBefore.Click += new System.EventHandler(this.buttonBeforeText_Click); // - // timeUpDownVideoPositionAdjust - // - this.timeUpDownVideoPositionAdjust.AutoSize = true; - this.timeUpDownVideoPositionAdjust.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.timeUpDownVideoPositionAdjust.Location = new System.Drawing.Point(96, 213); - this.timeUpDownVideoPositionAdjust.Margin = new System.Windows.Forms.Padding(4); - this.timeUpDownVideoPositionAdjust.Name = "timeUpDownVideoPositionAdjust"; - this.timeUpDownVideoPositionAdjust.Size = new System.Drawing.Size(96, 25); - this.timeUpDownVideoPositionAdjust.TabIndex = 13; - this.timeUpDownVideoPositionAdjust.UseVideoOffset = false; - // // ShowSubtitleTimer // this.ShowSubtitleTimer.Enabled = true; @@ -3665,10 +3608,12 @@ this.showOnlyWaveformToolStripMenuItem, this.showOnlySpectrogramToolStripMenuItem, this.toolStripSeparatorGuessTimeCodes, + this.removeSceneChangeToolStripMenuItem, + this.addSceneChangeToolStripMenuItem, this.guessTimeCodesToolStripMenuItem, this.seekSilenceToolStripMenuItem}); this.contextMenuStripWaveform.Name = "contextMenuStripWaveform"; - this.contextMenuStripWaveform.Size = new System.Drawing.Size(275, 308); + this.contextMenuStripWaveform.Size = new System.Drawing.Size(275, 374); this.contextMenuStripWaveform.Closing += new System.Windows.Forms.ToolStripDropDownClosingEventHandler(this.contextMenuStripWaveform_Closing); this.contextMenuStripWaveform.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripWaveformOpening); // @@ -3863,35 +3808,6 @@ this.splitContainerListViewAndText.SplitterDistance = 91; this.splitContainerListViewAndText.TabIndex = 2; // - // SubtitleListview1 - // - this.SubtitleListview1.AllowDrop = true; - this.SubtitleListview1.ContextMenuStrip = this.contextMenuStripListview; - this.SubtitleListview1.DisplayExtraFromExtra = false; - this.SubtitleListview1.Dock = System.Windows.Forms.DockStyle.Fill; - this.SubtitleListview1.FirstVisibleIndex = -1; - this.SubtitleListview1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.SubtitleListview1.FullRowSelect = true; - this.SubtitleListview1.GridLines = true; - this.SubtitleListview1.HideSelection = false; - this.SubtitleListview1.Location = new System.Drawing.Point(0, 0); - this.SubtitleListview1.Name = "SubtitleListview1"; - this.SubtitleListview1.OwnerDraw = true; - this.SubtitleListview1.Size = new System.Drawing.Size(724, 91); - this.SubtitleListview1.SubtitleFontBold = false; - this.SubtitleListview1.SubtitleFontName = "Tahoma"; - this.SubtitleListview1.SubtitleFontSize = 8; - this.SubtitleListview1.TabIndex = 0; - this.SubtitleListview1.UseCompatibleStateImageBehavior = false; - this.SubtitleListview1.UseSyntaxColoring = true; - this.SubtitleListview1.View = System.Windows.Forms.View.Details; - this.SubtitleListview1.SelectedIndexChanged += new System.EventHandler(this.SubtitleListview1_SelectedIndexChanged); - this.SubtitleListview1.DragDrop += new System.Windows.Forms.DragEventHandler(this.SubtitleListview1_DragDrop); - this.SubtitleListview1.DragEnter += new System.Windows.Forms.DragEventHandler(this.SubtitleListview1_DragEnter); - this.SubtitleListview1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SubtitleListview1KeyDown); - this.SubtitleListview1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.SubtitleListview1_MouseDoubleClick); - this.SubtitleListview1.MouseEnter += new System.EventHandler(this.SubtitleListview1_MouseEnter); - // // groupBoxEdit // this.groupBoxEdit.Controls.Add(this.labelSingleLine); @@ -4027,28 +3943,6 @@ this.labelText.TabIndex = 5; this.labelText.Text = "Text"; // - // textBoxListViewTextAlternate - // - this.textBoxListViewTextAlternate.AllowDrop = true; - this.textBoxListViewTextAlternate.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.textBoxListViewTextAlternate.ContextMenuStrip = this.contextMenuStripTextBoxListView; - this.textBoxListViewTextAlternate.Enabled = false; - this.textBoxListViewTextAlternate.HideSelection = false; - this.textBoxListViewTextAlternate.Location = new System.Drawing.Point(946, 28); - this.textBoxListViewTextAlternate.Multiline = true; - this.textBoxListViewTextAlternate.Name = "textBoxListViewTextAlternate"; - this.textBoxListViewTextAlternate.Size = new System.Drawing.Size(0, 63); - this.textBoxListViewTextAlternate.TabIndex = 33; - this.textBoxListViewTextAlternate.Visible = false; - this.textBoxListViewTextAlternate.MouseClick += new System.Windows.Forms.MouseEventHandler(this.TextBoxListViewTextAlternateMouseClick); - this.textBoxListViewTextAlternate.TextChanged += new System.EventHandler(this.textBoxListViewTextAlternate_TextChanged); - this.textBoxListViewTextAlternate.Enter += new System.EventHandler(this.TextBoxListViewTextAlternateEnter); - this.textBoxListViewTextAlternate.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxListViewTextAlternateKeyDown); - this.textBoxListViewTextAlternate.KeyUp += new System.Windows.Forms.KeyEventHandler(this.TextBoxListViewTextAlternateKeyUp); - this.textBoxListViewTextAlternate.MouseMove += new System.Windows.Forms.MouseEventHandler(this.TextBoxListViewTextAlternateMouseMove); - // // contextMenuStripTextBoxListView // this.contextMenuStripTextBoxListView.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -4321,17 +4215,6 @@ this.buttonUnBreak.UseVisualStyleBackColor = true; this.buttonUnBreak.Click += new System.EventHandler(this.ButtonUnBreakClick); // - // timeUpDownStartTime - // - this.timeUpDownStartTime.AutoSize = true; - this.timeUpDownStartTime.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.timeUpDownStartTime.Location = new System.Drawing.Point(9, 26); - this.timeUpDownStartTime.Margin = new System.Windows.Forms.Padding(4); - this.timeUpDownStartTime.Name = "timeUpDownStartTime"; - this.timeUpDownStartTime.Size = new System.Drawing.Size(96, 25); - this.timeUpDownStartTime.TabIndex = 0; - this.timeUpDownStartTime.UseVideoOffset = false; - // // numericUpDownDuration // this.numericUpDownDuration.DecimalPlaces = 3; @@ -4385,28 +4268,6 @@ this.labelStartTime.TabIndex = 3; this.labelStartTime.Text = "Start time"; // - // textBoxListViewText - // - this.textBoxListViewText.AllowDrop = true; - this.textBoxListViewText.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.textBoxListViewText.ContextMenuStrip = this.contextMenuStripTextBoxListView; - this.textBoxListViewText.Enabled = false; - this.textBoxListViewText.HideSelection = false; - this.textBoxListViewText.Location = new System.Drawing.Point(236, 28); - this.textBoxListViewText.Multiline = true; - this.textBoxListViewText.Name = "textBoxListViewText"; - this.textBoxListViewText.Size = new System.Drawing.Size(362, 63); - this.textBoxListViewText.TabIndex = 5; - this.textBoxListViewText.MouseClick += new System.Windows.Forms.MouseEventHandler(this.TextBoxListViewTextMouseClick); - this.textBoxListViewText.TextChanged += new System.EventHandler(this.TextBoxListViewTextTextChanged); - this.textBoxListViewText.Enter += new System.EventHandler(this.TextBoxListViewTextEnter); - this.textBoxListViewText.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxListViewTextKeyDown); - this.textBoxListViewText.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBoxListViewText_KeyUp); - this.textBoxListViewText.Leave += new System.EventHandler(this.textBoxListViewText_Leave); - this.textBoxListViewText.MouseMove += new System.Windows.Forms.MouseEventHandler(this.textBoxListViewText_MouseMove); - // // labelDuration // this.labelDuration.AutoSize = true; @@ -4468,32 +4329,6 @@ this.panelVideoPlayer.Size = new System.Drawing.Size(220, 246); this.panelVideoPlayer.TabIndex = 5; // - // mediaPlayer - // - this.mediaPlayer.AllowDrop = true; - this.mediaPlayer.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.mediaPlayer.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18))))); - this.mediaPlayer.CurrentPosition = 0D; - this.mediaPlayer.FontSizeFactor = 1F; - this.mediaPlayer.Location = new System.Drawing.Point(0, 0); - this.mediaPlayer.Margin = new System.Windows.Forms.Padding(0); - this.mediaPlayer.Name = "mediaPlayer"; - this.mediaPlayer.ShowFullscreenButton = true; - this.mediaPlayer.ShowMuteButton = true; - this.mediaPlayer.ShowStopButton = true; - this.mediaPlayer.Size = new System.Drawing.Size(219, 246); - this.mediaPlayer.SubtitleText = ""; - this.mediaPlayer.TabIndex = 5; - this.mediaPlayer.TextRightToLeft = System.Windows.Forms.RightToLeft.No; - this.mediaPlayer.VideoHeight = 0; - this.mediaPlayer.VideoPlayer = null; - this.mediaPlayer.VideoWidth = 0; - this.mediaPlayer.Volume = 0D; - this.mediaPlayer.DragDrop += new System.Windows.Forms.DragEventHandler(this.mediaPlayer_DragDrop); - this.mediaPlayer.DragEnter += new System.Windows.Forms.DragEventHandler(this.mediaPlayer_DragEnter); - // // contextMenuStripEmpty // this.contextMenuStripEmpty.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -4525,6 +4360,189 @@ this.timerAlternateTextUndo.Interval = 700; this.timerAlternateTextUndo.Tick += new System.EventHandler(this.TimerAlternateTextUndoTick); // + // removeSceneChangeToolStripMenuItem + // + this.removeSceneChangeToolStripMenuItem.Name = "removeSceneChangeToolStripMenuItem"; + this.removeSceneChangeToolStripMenuItem.Size = new System.Drawing.Size(274, 22); + this.removeSceneChangeToolStripMenuItem.Text = "Remove scene change"; + this.removeSceneChangeToolStripMenuItem.Click += new System.EventHandler(this.removeSceneChangeToolStripMenuItem_Click); + // + // SubtitleListview1 + // + this.SubtitleListview1.AllowDrop = true; + this.SubtitleListview1.ContextMenuStrip = this.contextMenuStripListview; + this.SubtitleListview1.DisplayExtraFromExtra = false; + this.SubtitleListview1.Dock = System.Windows.Forms.DockStyle.Fill; + this.SubtitleListview1.FirstVisibleIndex = -1; + this.SubtitleListview1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.SubtitleListview1.FullRowSelect = true; + this.SubtitleListview1.GridLines = true; + this.SubtitleListview1.HideSelection = false; + this.SubtitleListview1.Location = new System.Drawing.Point(0, 0); + this.SubtitleListview1.Name = "SubtitleListview1"; + this.SubtitleListview1.OwnerDraw = true; + this.SubtitleListview1.Size = new System.Drawing.Size(724, 91); + this.SubtitleListview1.SubtitleFontBold = false; + this.SubtitleListview1.SubtitleFontName = "Tahoma"; + this.SubtitleListview1.SubtitleFontSize = 8; + this.SubtitleListview1.TabIndex = 0; + this.SubtitleListview1.UseCompatibleStateImageBehavior = false; + this.SubtitleListview1.UseSyntaxColoring = true; + this.SubtitleListview1.View = System.Windows.Forms.View.Details; + this.SubtitleListview1.SelectedIndexChanged += new System.EventHandler(this.SubtitleListview1_SelectedIndexChanged); + this.SubtitleListview1.DragDrop += new System.Windows.Forms.DragEventHandler(this.SubtitleListview1_DragDrop); + this.SubtitleListview1.DragEnter += new System.Windows.Forms.DragEventHandler(this.SubtitleListview1_DragEnter); + this.SubtitleListview1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SubtitleListview1KeyDown); + this.SubtitleListview1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.SubtitleListview1_MouseDoubleClick); + this.SubtitleListview1.MouseEnter += new System.EventHandler(this.SubtitleListview1_MouseEnter); + // + // textBoxListViewTextAlternate + // + this.textBoxListViewTextAlternate.AllowDrop = true; + this.textBoxListViewTextAlternate.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.textBoxListViewTextAlternate.ContextMenuStrip = this.contextMenuStripTextBoxListView; + this.textBoxListViewTextAlternate.Enabled = false; + this.textBoxListViewTextAlternate.HideSelection = false; + this.textBoxListViewTextAlternate.Location = new System.Drawing.Point(946, 28); + this.textBoxListViewTextAlternate.Multiline = true; + this.textBoxListViewTextAlternate.Name = "textBoxListViewTextAlternate"; + this.textBoxListViewTextAlternate.Size = new System.Drawing.Size(0, 63); + this.textBoxListViewTextAlternate.TabIndex = 33; + this.textBoxListViewTextAlternate.Visible = false; + this.textBoxListViewTextAlternate.MouseClick += new System.Windows.Forms.MouseEventHandler(this.TextBoxListViewTextAlternateMouseClick); + this.textBoxListViewTextAlternate.TextChanged += new System.EventHandler(this.textBoxListViewTextAlternate_TextChanged); + this.textBoxListViewTextAlternate.Enter += new System.EventHandler(this.TextBoxListViewTextAlternateEnter); + this.textBoxListViewTextAlternate.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxListViewTextAlternateKeyDown); + this.textBoxListViewTextAlternate.KeyUp += new System.Windows.Forms.KeyEventHandler(this.TextBoxListViewTextAlternateKeyUp); + this.textBoxListViewTextAlternate.MouseMove += new System.Windows.Forms.MouseEventHandler(this.TextBoxListViewTextAlternateMouseMove); + // + // timeUpDownStartTime + // + this.timeUpDownStartTime.AutoSize = true; + this.timeUpDownStartTime.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.timeUpDownStartTime.Location = new System.Drawing.Point(9, 26); + this.timeUpDownStartTime.Margin = new System.Windows.Forms.Padding(4); + this.timeUpDownStartTime.Name = "timeUpDownStartTime"; + this.timeUpDownStartTime.Size = new System.Drawing.Size(96, 25); + this.timeUpDownStartTime.TabIndex = 0; + this.timeUpDownStartTime.UseVideoOffset = false; + // + // textBoxListViewText + // + this.textBoxListViewText.AllowDrop = true; + this.textBoxListViewText.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.textBoxListViewText.ContextMenuStrip = this.contextMenuStripTextBoxListView; + this.textBoxListViewText.Enabled = false; + this.textBoxListViewText.HideSelection = false; + this.textBoxListViewText.Location = new System.Drawing.Point(236, 28); + this.textBoxListViewText.Multiline = true; + this.textBoxListViewText.Name = "textBoxListViewText"; + this.textBoxListViewText.Size = new System.Drawing.Size(362, 63); + this.textBoxListViewText.TabIndex = 5; + this.textBoxListViewText.MouseClick += new System.Windows.Forms.MouseEventHandler(this.TextBoxListViewTextMouseClick); + this.textBoxListViewText.TextChanged += new System.EventHandler(this.TextBoxListViewTextTextChanged); + this.textBoxListViewText.Enter += new System.EventHandler(this.TextBoxListViewTextEnter); + this.textBoxListViewText.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxListViewTextKeyDown); + this.textBoxListViewText.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBoxListViewText_KeyUp); + this.textBoxListViewText.Leave += new System.EventHandler(this.textBoxListViewText_Leave); + this.textBoxListViewText.MouseMove += new System.Windows.Forms.MouseEventHandler(this.textBoxListViewText_MouseMove); + // + // mediaPlayer + // + this.mediaPlayer.AllowDrop = true; + this.mediaPlayer.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.mediaPlayer.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18))))); + this.mediaPlayer.CurrentPosition = 0D; + this.mediaPlayer.FontSizeFactor = 1F; + this.mediaPlayer.Location = new System.Drawing.Point(0, 0); + this.mediaPlayer.Margin = new System.Windows.Forms.Padding(0); + this.mediaPlayer.Name = "mediaPlayer"; + this.mediaPlayer.ShowFullscreenButton = true; + this.mediaPlayer.ShowMuteButton = true; + this.mediaPlayer.ShowStopButton = true; + this.mediaPlayer.Size = new System.Drawing.Size(219, 246); + this.mediaPlayer.SubtitleText = ""; + this.mediaPlayer.TabIndex = 5; + this.mediaPlayer.TextRightToLeft = System.Windows.Forms.RightToLeft.No; + this.mediaPlayer.VideoHeight = 0; + this.mediaPlayer.VideoPlayer = null; + this.mediaPlayer.VideoWidth = 0; + this.mediaPlayer.Volume = 0D; + this.mediaPlayer.DragDrop += new System.Windows.Forms.DragEventHandler(this.mediaPlayer_DragDrop); + this.mediaPlayer.DragEnter += new System.Windows.Forms.DragEventHandler(this.mediaPlayer_DragEnter); + // + // audioVisualizer + // + this.audioVisualizer.AllowDrop = true; + this.audioVisualizer.AllowNewSelection = true; + this.audioVisualizer.AllowOverlap = false; + this.audioVisualizer.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.audioVisualizer.BackColor = System.Drawing.Color.Black; + this.audioVisualizer.BackgroundColor = System.Drawing.Color.Black; + this.audioVisualizer.Color = System.Drawing.Color.GreenYellow; + this.audioVisualizer.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(18))))); + this.audioVisualizer.Location = new System.Drawing.Point(472, 32); + this.audioVisualizer.Margin = new System.Windows.Forms.Padding(0); + this.audioVisualizer.Name = "audioVisualizer"; + this.audioVisualizer.NewSelectionParagraph = null; + this.audioVisualizer.ParagraphColor = System.Drawing.Color.LimeGreen; + this.audioVisualizer.SceneChanges = ((System.Collections.Generic.List)(resources.GetObject("audioVisualizer.SceneChanges"))); + this.audioVisualizer.SelectedColor = System.Drawing.Color.Red; + this.audioVisualizer.ShowGridLines = true; + this.audioVisualizer.ShowSpectrogram = false; + this.audioVisualizer.ShowWaveform = true; + this.audioVisualizer.Size = new System.Drawing.Size(499, 229); + this.audioVisualizer.StartPositionSeconds = 0D; + this.audioVisualizer.TabIndex = 6; + this.audioVisualizer.TextBold = true; + this.audioVisualizer.TextColor = System.Drawing.Color.Gray; + this.audioVisualizer.TextSize = 9F; + this.audioVisualizer.VerticalZoomFactor = 1D; + this.audioVisualizer.WaveformNotLoadedText = "Click to add waveform"; + this.audioVisualizer.WavePeaks = null; + this.audioVisualizer.ZoomFactor = 1D; + this.audioVisualizer.Click += new System.EventHandler(this.AudioWaveform_Click); + this.audioVisualizer.DragDrop += new System.Windows.Forms.DragEventHandler(this.AudioWaveformDragDrop); + this.audioVisualizer.DragEnter += new System.Windows.Forms.DragEventHandler(this.AudioWaveformDragEnter); + this.audioVisualizer.MouseEnter += new System.EventHandler(this.audioVisualizer_MouseEnter); + // + // timeUpDownVideoPosition + // + this.timeUpDownVideoPosition.AutoSize = true; + this.timeUpDownVideoPosition.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.timeUpDownVideoPosition.Location = new System.Drawing.Point(96, 191); + this.timeUpDownVideoPosition.Margin = new System.Windows.Forms.Padding(4); + this.timeUpDownVideoPosition.Name = "timeUpDownVideoPosition"; + this.timeUpDownVideoPosition.Size = new System.Drawing.Size(96, 25); + this.timeUpDownVideoPosition.TabIndex = 12; + this.timeUpDownVideoPosition.UseVideoOffset = false; + // + // timeUpDownVideoPositionAdjust + // + this.timeUpDownVideoPositionAdjust.AutoSize = true; + this.timeUpDownVideoPositionAdjust.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.timeUpDownVideoPositionAdjust.Location = new System.Drawing.Point(96, 213); + this.timeUpDownVideoPositionAdjust.Margin = new System.Windows.Forms.Padding(4); + this.timeUpDownVideoPositionAdjust.Name = "timeUpDownVideoPositionAdjust"; + this.timeUpDownVideoPositionAdjust.Size = new System.Drawing.Size(96, 25); + this.timeUpDownVideoPositionAdjust.TabIndex = 13; + this.timeUpDownVideoPositionAdjust.UseVideoOffset = false; + // + // addSceneChangeToolStripMenuItem + // + this.addSceneChangeToolStripMenuItem.Name = "addSceneChangeToolStripMenuItem"; + this.addSceneChangeToolStripMenuItem.Size = new System.Drawing.Size(274, 22); + this.addSceneChangeToolStripMenuItem.Text = "Add scene change"; + this.addSceneChangeToolStripMenuItem.Click += new System.EventHandler(this.addSceneChangeToolStripMenuItem_Click); + // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -5035,5 +5053,7 @@ private System.Windows.Forms.ToolStripMenuItem uniPacExportToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemExportAyato; private System.Windows.Forms.ToolStripButton toolStripButtonFixCommonErrors; + private System.Windows.Forms.ToolStripMenuItem removeSceneChangeToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem addSceneChangeToolStripMenuItem; } } \ No newline at end of file diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index 8ef27ee2c..2069a22d5 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -200,6 +200,7 @@ namespace Nikse.SubtitleEdit.Forms private Keys _waveformAddTextAtHere = Keys.None; private Keys _waveformAddTextAtHereFromClipboard = Keys.None; private Keys _waveformFocusListView = Keys.None; + private Keys _waveformGoToNextSceneChange = Keys.None; private Keys _mainTranslateCustomSearch1 = Keys.None; private Keys _mainTranslateCustomSearch2 = Keys.None; private Keys _mainTranslateCustomSearch3 = Keys.None; @@ -602,6 +603,17 @@ namespace Nikse.SubtitleEdit.Forms toolStripSeparator11.Visible = false; toolStripMenuItemWaveformPlaySelection.Visible = false; toolStripSeparator24.Visible = false; + if (GetSceneChangeIndex(e.Seconds) >= 0) + { + removeSceneChangeToolStripMenuItem.Visible = true; + addSceneChangeToolStripMenuItem.Visible = false; + } + else + { + removeSceneChangeToolStripMenuItem.Visible = false; + addSceneChangeToolStripMenuItem.Visible = true; + } + _audioWaveformRightClickSeconds = e.Seconds; contextMenuStripWaveform.Show(MousePosition.X, MousePosition.Y); } @@ -698,11 +710,69 @@ namespace Nikse.SubtitleEdit.Forms toolStripSeparator11.Visible = true; toolStripMenuItemWaveformPlaySelection.Visible = true; toolStripSeparator24.Visible = true; - + if (GetSceneChangeIndex(e.Seconds) >= 0) + { + removeSceneChangeToolStripMenuItem.Visible = true; + addSceneChangeToolStripMenuItem.Visible = false; + } + else + { + removeSceneChangeToolStripMenuItem.Visible = false; + addSceneChangeToolStripMenuItem.Visible = true; + } _audioWaveformRightClickSeconds = e.Seconds; contextMenuStripWaveform.Show(MousePosition.X, MousePosition.Y); } + private int GetSceneChangeIndex(double seconds) + { + if (audioVisualizer == null || audioVisualizer.SceneChanges == null) + return -1; + + try + { + for (int index = 0; index < audioVisualizer.SceneChanges.Count; index++) + { + var sceneChange = audioVisualizer.SceneChanges[index]; + if (Math.Abs(sceneChange - seconds) < 0.04) + { + return index; + } + } + } + catch (Exception) + { + // ignored + } + + return -1; + } + + private void removeSceneChangeToolStripMenuItem_Click(object sender, EventArgs e) + { + if (!_audioWaveformRightClickSeconds.HasValue) + return; + + var idx = GetSceneChangeIndex(_audioWaveformRightClickSeconds.Value); + if (idx >= 0 && idx < audioVisualizer.SceneChanges.Count) + { + audioVisualizer.SceneChanges[idx] = -1; + SceneChangeHelper.SaveSceneChanges(_videoFileName, audioVisualizer.SceneChanges.Where(p=>p > 0).ToList()); + } + } + + private void addSceneChangeToolStripMenuItem_Click(object sender, EventArgs e) + { + if (!_audioWaveformRightClickSeconds.HasValue) + return; + + var list = audioVisualizer.SceneChanges.Where(p => p > 0).ToList(); + list.Add(_audioWaveformRightClickSeconds.Value); + list.Sort(); + audioVisualizer.SceneChanges = list; + SceneChangeHelper.SaveSceneChanges(_videoFileName, list); + } + private void AudioWaveform_OnNewSelectionRightClicked(object sender, AudioVisualizer.ParagraphEventArgs e) { SubtitleListview1.SelectIndexAndEnsureVisible(_subtitle.GetIndex(e.Paragraph)); @@ -1341,6 +1411,8 @@ namespace Nikse.SubtitleEdit.Forms showOnlySpectrogramToolStripMenuItem.Text = languageWaveform.ShowSpectrogramOnly; seekSilenceToolStripMenuItem.Text = languageWaveform.SeekSilence; guessTimeCodesToolStripMenuItem.Text = languageWaveform.GuessTimeCodes; + removeSceneChangeToolStripMenuItem.Text = languageWaveform.RemoveSceneChange; + addSceneChangeToolStripMenuItem.Text = languageWaveform.AddSceneChange; toolStripButtonWaveformZoomOut.ToolTipText = languageWaveform.ZoomOut; toolStripButtonWaveformZoomIn.ToolTipText = languageWaveform.ZoomIn; @@ -1641,6 +1713,34 @@ namespace Nikse.SubtitleEdit.Forms if (openFileDialog1.ShowDialog(this) == DialogResult.OK) { RemoveAlternate(true); + + // try to open via recent files + var rfe = Configuration.Settings.RecentFiles.Files.FirstOrDefault(p => p.FileName.Equals(openFileDialog1.FileName, StringComparison.OrdinalIgnoreCase)); + if (rfe != null) + { + OpenSubtitle(rfe.FileName, null, rfe.VideoFileName, rfe.OriginalFileName); + Configuration.Settings.General.CurrentVideoOffsetInMs = rfe.VideoOffsetInMs; + if (rfe.VideoOffsetInMs > 0) + { + _subtitle.AddTimeToAllParagraphs(TimeSpan.FromMilliseconds(-Configuration.Settings.General.CurrentVideoOffsetInMs)); + _changeSubtitleToString = _subtitle.GetFastHashCode(); + SubtitleListview1.Fill(_subtitle); + } + GotoSubPosAndPause(); + SetRecentIndices(openFileDialog1.FileName); + SubtitleListview1.EndUpdate(); + if (!string.IsNullOrEmpty(rfe.VideoFileName)) + { + var p = _subtitle.GetParagraphOrDefault(rfe.FirstSelectedIndex); + if (p != null) + { + mediaPlayer.CurrentPosition = p.StartTime.TotalSeconds; + } + } + _openFileDialogOn = false; + return; + } + OpenSubtitle(openFileDialog1.FileName, null); } _openFileDialogOn = false; @@ -2673,6 +2773,7 @@ namespace Nikse.SubtitleEdit.Forms labelVideoInfo.Text = _languageGeneral.NoVideoLoaded; audioVisualizer.WavePeaks = null; audioVisualizer.Spectrogram = null; + audioVisualizer.SceneChanges = new List(); } if (Configuration.Settings.General.ShowVideoPlayer || Configuration.Settings.General.ShowAudioVisualizer) @@ -2782,6 +2883,7 @@ namespace Nikse.SubtitleEdit.Forms labelVideoInfo.Text = _languageGeneral.NoVideoLoaded; audioVisualizer.WavePeaks = null; audioVisualizer.Spectrogram = null; + audioVisualizer.SceneChanges = new List(); Configuration.Settings.RecentFiles.Add(fileName, FirstVisibleIndex, FirstSelectedIndex, _videoFileName, _subtitleAlternateFileName, Configuration.Settings.General.CurrentVideoOffsetInMs); Configuration.Settings.Save(); @@ -3229,17 +3331,21 @@ namespace Nikse.SubtitleEdit.Forms try { + var sub = GetSaveSubtitle(_subtitle); + if (format != null && !format.IsTextBased) { if (format.GetType() == typeof(Ebu)) { - Ebu.Save(_fileName, _subtitle); + if (Ebu.Save(_fileName, sub)) + { + Configuration.Settings.RecentFiles.Add(_fileName, FirstVisibleIndex, FirstSelectedIndex, _videoFileName, _subtitleAlternateFileName, Configuration.Settings.General.CurrentVideoOffsetInMs); + Configuration.Settings.Save(); + } } return DialogResult.OK; } - var sub = GetSaveSubtitle(_subtitle); - string allText = sub.ToText(format); // Seungki begin @@ -3338,7 +3444,8 @@ namespace Nikse.SubtitleEdit.Forms sw.Write(allText); } } - + Configuration.Settings.RecentFiles.Add(_fileName, FirstVisibleIndex, FirstSelectedIndex, _videoFileName, _subtitleAlternateFileName, Configuration.Settings.General.CurrentVideoOffsetInMs); + Configuration.Settings.Save(); _fileDateTime = File.GetLastWriteTime(_fileName); ShowStatus(string.Format(_language.SavedSubtitleX, _fileName)); _changeSubtitleToString = _subtitle.GetFastHashCode(); @@ -3482,6 +3589,7 @@ namespace Nikse.SubtitleEdit.Forms labelVideoInfo.Text = _languageGeneral.NoVideoLoaded; audioVisualizer.WavePeaks = null; audioVisualizer.Spectrogram = null; + audioVisualizer.SceneChanges = new List(); _sourceViewChange = false; @@ -11197,6 +11305,19 @@ namespace Nikse.SubtitleEdit.Forms SubtitleListview1.Focus(); e.SuppressKeyPress = true; } + else if (audioVisualizer.SceneChanges != null && e.KeyData == _waveformGoToNextSceneChange) + { + var cp = mediaPlayer.CurrentPosition + 0.01; + foreach (var sceneChange in audioVisualizer.SceneChanges) + { + if (sceneChange > cp) + { + mediaPlayer.CurrentPosition = sceneChange; + break; + } + } + e.SuppressKeyPress = true; + } else if (audioVisualizer.Focused && e.KeyCode == Keys.Delete) { ToolStripMenuItemDeleteClick(null, null); @@ -13925,6 +14046,7 @@ namespace Nikse.SubtitleEdit.Forms { audioVisualizer.WavePeaks = null; audioVisualizer.Spectrogram = null; + audioVisualizer.SceneChanges = new List(); } openFileDialog1.InitialDirectory = Path.GetDirectoryName(openFileDialog1.FileName); if (!panelVideoPlayer.Visible) @@ -14832,6 +14954,7 @@ namespace Nikse.SubtitleEdit.Forms _waveformAddTextAtHere = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformAddTextHere); _waveformAddTextAtHereFromClipboard = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformAddTextHereFromClipboard); _waveformFocusListView = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformFocusListView); + _waveformGoToNextSceneChange = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformGoToNextSceneChange); _mainTranslateCustomSearch1 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTranslateCustomSearch1); _mainTranslateCustomSearch2 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTranslateCustomSearch2); _mainTranslateCustomSearch3 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTranslateCustomSearch3); @@ -16962,6 +17085,7 @@ namespace Nikse.SubtitleEdit.Forms labelVideoInfo.Text = _languageGeneral.NoVideoLoaded; audioVisualizer.WavePeaks = null; audioVisualizer.Spectrogram = null; + audioVisualizer.SceneChanges = new List(); mediaPlayer.CurrentPosition = 0; } diff --git a/src/Forms/Main.resx b/src/Forms/Main.resx index 90d86e437..c1c18558c 100644 --- a/src/Forms/Main.resx +++ b/src/Forms/Main.resx @@ -370,31 +370,31 @@ iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAWZSURBVFhHrVZ7TJNXFCfZlpmYkCUzy7LJnE6zuJBsy8TN - B2/l0fJoqTwm0AIDKyBQKFBkwEelyEp5TKgPFKm0RdRJIo/EZZ2LG/j4b5lzy0bM5pL9IdKHMaI4HXf9 - fbu3fKhIi/6Sk/ace+45557vnHOvn7fgOIv/jsLOdcnprfq4BN0cggxr0KHqzw871QdeyyvoqI1N0Ng3 - hheSoM15T6QNoQUEOjt2HTrd1jayim5/NtRqLcGSbTV/fxyinOMsOLJkDgnXQBEitcNsHW2lZhYH64lL - jZGxao9RnD5KXH2xqKyrOSOjY6WQClRGHdY2RxZ59BGYsmRfT2go9yI16T0qag6uCY9W3WPGtsaXT7Ub - zxo4bn5jWHMHt1GR23KH7UPmtLrj3VTFe6gqTZPMSLp877TN9usGnKSk/HBWSnrjxJaY3fcjoit5wn/I - sAYdjjMtycjaO8L2B0cWT3GN5kBqemG0dZwVs1Qi7bVaazjk2UpDvbAI3ad78EnITiFPyjQ9f+Tn7w9A - IFnK9ttsLU3e0Mcb9wby3OYBtjExhfsGsoNdtlIWlEi6eyp+m1aFAsWpE5J1xeKk6hssGBStZeDycpya - BexTFkSShr9YAOWVvWVqg3kpHIBHXVj6R8OoqgdqtWGprun0IAsiv7jrOOT4NODRomkZX27llRdCtKiG - D8D9fQlSiQGDk8D4F62DR6naY8C3j5fVjmMvsgReltpSD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Af8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -799,6 +793,15 @@ 150, 95 + + + AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u + ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBWZXJzaW9u + PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB + AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLkRvdWJsZQMAAAAGX2l0 + ZW1zBV9zaXplCF92ZXJzaW9uBwAABggIAgAAAAkDAAAAAAAAAAAAAAAPAwAAAAAAAAAGCw== + + 144 diff --git a/src/Forms/Settings.cs b/src/Forms/Settings.cs index 023ec6127..5d0162f34 100644 --- a/src/Forms/Settings.cs +++ b/src/Forms/Settings.cs @@ -803,6 +803,7 @@ namespace Nikse.SubtitleEdit.Forms AddNode(audioVisualizerNode, language.WaveformPlayNewSelectionEnd, nameof(Configuration.Settings.Shortcuts.WaveformPlaySelectionEnd)); AddNode(audioVisualizerNode, Configuration.Settings.Language.Main.VideoControls.InsertNewSubtitleAtVideoPosition, nameof(Configuration.Settings.Shortcuts.MainWaveformInsertAtCurrentPosition)); AddNode(audioVisualizerNode, language.WaveformFocusListView, nameof(Configuration.Settings.Shortcuts.WaveformFocusListView)); + AddNode(audioVisualizerNode, language.WaveformGoToNextSceneChange, nameof(Configuration.Settings.Shortcuts.WaveformGoToNextSceneChange)); treeViewShortcuts.Nodes.Add(audioVisualizerNode); foreach (TreeNode node in treeViewShortcuts.Nodes)