Added option to have text duplicated while splitting subtitles in waveform

This commit is contained in:
MitchSirco 2024-10-07 17:17:36 +02:00
parent cb86eba5e8
commit 3ee2eb0925
8 changed files with 41 additions and 6 deletions

View File

@ -5428,6 +5428,12 @@ namespace Nikse.SubtitleEdit.Core.Settings
settings.VideoControls.WaveformChaptersColor = Color.FromArgb(int.Parse(subNode.InnerText, CultureInfo.InvariantCulture));
}
subNode = node.SelectSingleNode("WaveformDuplicateTextWhileSplitting");
if (subNode != null)
{
settings.VideoControls.WaveformDuplicateTextWhileSplitting = Convert.ToBoolean(subNode.InnerText, CultureInfo.InvariantCulture);
}
subNode = node.SelectSingleNode("WaveformTextSize");
if (subNode != null)
{
@ -9599,6 +9605,7 @@ namespace Nikse.SubtitleEdit.Core.Settings
xmlWriter.WriteElementString("WaveformCursorColor", settings.VideoControls.WaveformCursorColor.ToArgb().ToString(CultureInfo.InvariantCulture));
xmlWriter.WriteElementString("WaveformChaptersColor", settings.VideoControls.WaveformChaptersColor.ToArgb().ToString(CultureInfo.InvariantCulture));
xmlWriter.WriteElementString("WaveformTextSize", settings.VideoControls.WaveformTextSize.ToString(CultureInfo.InvariantCulture));
xmlWriter.WriteElementString("WaveformDuplicateTextWhileSplitting", settings.VideoControls.WaveformDuplicateTextWhileSplitting.ToString(CultureInfo.InvariantCulture));
xmlWriter.WriteElementString("WaveformTextBold", settings.VideoControls.WaveformTextBold.ToString(CultureInfo.InvariantCulture));
xmlWriter.WriteElementString("WaveformDoubleClickOnNonParagraphAction", settings.VideoControls.WaveformDoubleClickOnNonParagraphAction);
xmlWriter.WriteElementString("WaveformRightClickOnNonParagraphAction", settings.VideoControls.WaveformRightClickOnNonParagraphAction);

View File

@ -36,6 +36,7 @@ namespace Nikse.SubtitleEdit.Core.Settings
public Color WaveformTextColor { get; set; }
public Color WaveformCursorColor { get; set; }
public Color WaveformChaptersColor { get; set; }
public bool WaveformDuplicateTextWhileSplitting { get; set; }
public int WaveformTextSize { get; set; }
public bool WaveformTextBold { get; set; }
public string WaveformDoubleClickOnNonParagraphAction { get; set; }
@ -73,6 +74,8 @@ namespace Nikse.SubtitleEdit.Core.Settings
WaveformChaptersColor = Color.FromArgb(255, 104, 33, 122);
WaveformTextSize = 9;
WaveformTextBold = true;
WaveformDuplicateTextWhileSplitting = false;
WaveformDoubleClickOnNonParagraphAction = "PlayPause";
WaveformDoubleClickOnNonParagraphAction = string.Empty;
WaveformMouseWheelScrollUpIsForward = true;

View File

@ -12122,7 +12122,14 @@ namespace Nikse.SubtitleEdit.Forms
}
}
lines = s.SplitToLines();
if (Configuration.Settings.VideoControls.WaveformDuplicateTextWhileSplitting)
{
lines.Add(s);
} else
{
lines = s.SplitToLines();
}
if (lines.Count == 1)
{
s = Utilities.AutoBreakLine(currentParagraph.Text, 3, 20, language);
@ -12236,8 +12243,8 @@ namespace Nikse.SubtitleEdit.Forms
newParagraph.Text = ContinuationUtilities.ConvertBackForArabic(newParagraph.Text);
}
}
FixSplitItalicTagAndAssa(currentParagraph, newParagraph);
if (!Configuration.Settings.VideoControls.WaveformDuplicateTextWhileSplitting)
FixSplitItalicTagAndAssa(currentParagraph, newParagraph);
FixSplitFontTag(currentParagraph, newParagraph);
FixSplitBoxTag(currentParagraph, newParagraph);
SetSplitTime(splitSeconds, currentParagraph, newParagraph, oldText);
@ -13796,7 +13803,7 @@ namespace Nikse.SubtitleEdit.Forms
if (!e.Cancel)
{
e.Cancel = true; // Hack as FormClosing will crash if any Forms are created here (e.g. a msgbox).
e.Cancel = true; // Hack as FormClosing will crash if any Forms are created here (e.g. a msgbox).
_forceClose = true;
TaskDelayHelper.RunDelayed(TimeSpan.FromMilliseconds(10), () => Application.Exit());
}

View File

@ -506,6 +506,7 @@
this.labelNllbApiUrl = new System.Windows.Forms.Label();
this.linkLabelNllbApi = new System.Windows.Forms.LinkLabel();
this.label5 = new System.Windows.Forms.Label();
this.checkBoxWaveformDuplicateTextWhileSplitting = new System.Windows.Forms.CheckBox();
this.panelGeneral.SuspendLayout();
this.groupBoxMiscellaneous.SuspendLayout();
this.groupBoxGeneralRules.SuspendLayout();
@ -3779,6 +3780,7 @@
//
this.groupBoxWaveformAppearence.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxWaveformAppearence.Controls.Add(this.checkBoxWaveformDuplicateTextWhileSplitting);
this.groupBoxWaveformAppearence.Controls.Add(this.buttonEditShotChangesProfile);
this.groupBoxWaveformAppearence.Controls.Add(this.checkBoxWaveformAutoGen);
this.groupBoxWaveformAppearence.Controls.Add(this.panelWaveformCursorColor);
@ -6929,11 +6931,22 @@
this.label5.Size = new System.Drawing.Size(0, 13);
this.label5.TabIndex = 25;
//
// checkBoxWaveformDuplicateTextWhileSplitting
//
this.checkBoxWaveformDuplicateTextWhileSplitting.AutoSize = true;
this.checkBoxWaveformDuplicateTextWhileSplitting.Location = new System.Drawing.Point(527, 27);
this.checkBoxWaveformDuplicateTextWhileSplitting.Name = "checkBoxWaveformDuplicateTextWhileSplitting";
this.checkBoxWaveformDuplicateTextWhileSplitting.Size = new System.Drawing.Size(160, 17);
this.checkBoxWaveformDuplicateTextWhileSplitting.TabIndex = 35;
this.checkBoxWaveformDuplicateTextWhileSplitting.Text = "Duplicate text while splitting";
this.checkBoxWaveformDuplicateTextWhileSplitting.UseVisualStyleBackColor = true;
//
// Settings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1092, 574);
this.Controls.Add(this.panelWaveform);
this.Controls.Add(this.panelVideoPlayer);
this.Controls.Add(this.panelShortcuts);
this.Controls.Add(this.panelToolBar);
@ -6944,7 +6957,6 @@
this.Controls.Add(this.panelNetwork);
this.Controls.Add(this.panelFont);
this.Controls.Add(this.panelSubtitleFormats);
this.Controls.Add(this.panelWaveform);
this.Controls.Add(this.panelFileTypeAssociations);
this.Controls.Add(this.panelSyntaxColoring);
this.Controls.Add(this.listBoxSection);
@ -7569,5 +7581,6 @@
private System.Windows.Forms.Label labelTBOpenVideo;
private System.Windows.Forms.PictureBox pictureBoxTBOpenVideo;
private System.Windows.Forms.CheckBox checkBoxTBOpenVideo;
private System.Windows.Forms.CheckBox checkBoxWaveformDuplicateTextWhileSplitting;
}
}

View File

@ -771,6 +771,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
comboBoxSpectrogramAppearance.Items.Clear();
comboBoxSpectrogramAppearance.Items.Add(language.SpectrogramOneColorGradient);
comboBoxSpectrogramAppearance.Items.Add(language.SpectrogramClassic);
checkBoxWaveformDuplicateTextWhileSplitting.Text = language.WaveformDuplicateTextWhileSplitting;
labelWaveformTextSize.Text = language.WaveformTextFontSize;
comboBoxWaveformTextSize.Left = labelWaveformTextSize.Left + labelWaveformTextSize.Width + 5;
checkBoxWaveformTextBold.Text = language.SubtitleBold;
@ -1187,6 +1188,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
panelWaveformCursorColor.BackColor = Configuration.Settings.VideoControls.WaveformCursorColor;
checkBoxGenerateSpectrogram.Checked = Configuration.Settings.VideoControls.GenerateSpectrogram;
comboBoxSpectrogramAppearance.SelectedIndex = Configuration.Settings.VideoControls.SpectrogramAppearance == "OneColorGradient" ? 0 : 1;
checkBoxWaveformDuplicateTextWhileSplitting.Checked = Configuration.Settings.VideoControls.WaveformDuplicateTextWhileSplitting;
comboBoxWaveformTextSize.Text = Configuration.Settings.VideoControls.WaveformTextSize.ToString(CultureInfo.InvariantCulture);
checkBoxWaveformTextBold.Checked = Configuration.Settings.VideoControls.WaveformTextBold;
checkBoxReverseMouseWheelScrollDirection.Checked = Configuration.Settings.VideoControls.WaveformMouseWheelScrollUpIsForward;
@ -2436,6 +2438,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
Configuration.Settings.VideoControls.GenerateSpectrogram = checkBoxGenerateSpectrogram.Checked;
Configuration.Settings.VideoControls.SpectrogramAppearance = comboBoxSpectrogramAppearance.SelectedIndex == 0 ? "OneColorGradient" : "Classic";
Configuration.Settings.VideoControls.WaveformDuplicateTextWhileSplitting = checkBoxWaveformDuplicateTextWhileSplitting.Checked;
Configuration.Settings.VideoControls.WaveformTextSize = int.Parse(comboBoxWaveformTextSize.Text);
Configuration.Settings.VideoControls.WaveformTextBold = checkBoxWaveformTextBold.Checked;
Configuration.Settings.VideoControls.WaveformMouseWheelScrollUpIsForward = checkBoxReverseMouseWheelScrollDirection.Checked;

View File

@ -124,7 +124,7 @@
<value>807, 17</value>
</metadata>
<metadata name="openFileDialogFFmpeg.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>630, 17</value>
<value>595, -5</value>
</metadata>
<metadata name="toolTipContinuationPreview.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1007, 17</value>

View File

@ -2832,6 +2832,7 @@ can edit in same subtitle file (collaboration)",
WaveformBackgroundColor = "Back color",
WaveformTextColor = "Text color",
WaveformCursorColor = "Cursor color",
WaveformDuplicateTextWhileSplitting = "Duplicate text while splitting",
WaveformTextFontSize = "Text font size",
WaveformAndSpectrogramsFolderEmpty = "Empty 'Spectrograms' and 'Waveforms' folders",
WaveformAndSpectrogramsFolderInfo = "'Waveforms' and 'Spectrograms' folders contain {0} files ({1:0.00} MB)",

View File

@ -2643,6 +2643,7 @@
public string WaveformBackgroundColor { get; set; }
public string WaveformCursorColor { get; set; }
public string WaveformTextColor { get; set; }
public string WaveformDuplicateTextWhileSplitting { get; set; }
public string WaveformTextFontSize { get; set; }
public string WaveformAndSpectrogramsFolderEmpty { get; set; }
public string WaveformAndSpectrogramsFolderInfo { get; set; }