SUP editor: Add option 'Select unforced lines' - thx manuelrn :)

Fix #7510
This commit is contained in:
niksedk 2023-10-14 18:32:45 +02:00
parent 577a626236
commit 74a19bb4d8
6 changed files with 68 additions and 24 deletions

View File

@ -489,6 +489,7 @@ We leverage the intrinsic rhythm of the image.</CreateSimpleChainingToolTip>
<BottomAlignSelectedLines>Bottom align selected lines (keep horizontal position)</BottomAlignSelectedLines> <BottomAlignSelectedLines>Bottom align selected lines (keep horizontal position)</BottomAlignSelectedLines>
<ToggleForcedSelectedLines>Toggle "Forced" for selected lines</ToggleForcedSelectedLines> <ToggleForcedSelectedLines>Toggle "Forced" for selected lines</ToggleForcedSelectedLines>
<SelectForcedLines>Select forced lines</SelectForcedLines> <SelectForcedLines>Select forced lines</SelectForcedLines>
<SelectNonForcedLines>Select non-forced lines</SelectNonForcedLines>
<SizeXY>Size: {0}x{1}</SizeXY> <SizeXY>Size: {0}x{1}</SizeXY>
<SetAspectRatio11>Set aspect ratio 1:1</SetAspectRatio11> <SetAspectRatio11>Set aspect ratio 1:1</SetAspectRatio11>
<ChangeBrightnessTitle>Adjust brightness</ChangeBrightnessTitle> <ChangeBrightnessTitle>Adjust brightness</ChangeBrightnessTitle>

View File

@ -30,8 +30,8 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
Nikse.SubtitleEdit.Core.Common.TimeCode timeCode1 = new Nikse.SubtitleEdit.Core.Common.TimeCode(); Nikse.SubtitleEdit.Core.Common.TimeCode timeCode3 = new Nikse.SubtitleEdit.Core.Common.TimeCode();
Nikse.SubtitleEdit.Core.Common.TimeCode timeCode2 = new Nikse.SubtitleEdit.Core.Common.TimeCode(); Nikse.SubtitleEdit.Core.Common.TimeCode timeCode4 = new Nikse.SubtitleEdit.Core.Common.TimeCode();
this.groupBoxCurrent = new System.Windows.Forms.GroupBox(); this.groupBoxCurrent = new System.Windows.Forms.GroupBox();
this.labelSyntaxError = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.labelSyntaxError = new Nikse.SubtitleEdit.Controls.NikseLabel();
this.buttonSetText = new System.Windows.Forms.Button(); this.buttonSetText = new System.Windows.Forms.Button();
@ -131,6 +131,7 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
this.columnHeaderDuration = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderDuration = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderText = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderText = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.timerSyntaxColor = new System.Windows.Forms.Timer(this.components); this.timerSyntaxColor = new System.Windows.Forms.Timer(this.components);
this.toolStripMenuItemSelectNonForced = new System.Windows.Forms.ToolStripMenuItem();
this.groupBoxCurrent.SuspendLayout(); this.groupBoxCurrent.SuspendLayout();
this.groupBoxVideoInfo.SuspendLayout(); this.groupBoxVideoInfo.SuspendLayout();
this.contextMenuStripListView.SuspendLayout(); this.contextMenuStripListView.SuspendLayout();
@ -350,14 +351,14 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
this.timeUpDownEndTime.Size = new System.Drawing.Size(111, 23); this.timeUpDownEndTime.Size = new System.Drawing.Size(111, 23);
this.timeUpDownEndTime.TabIndex = 3; this.timeUpDownEndTime.TabIndex = 3;
this.timeUpDownEndTime.TabStop = false; this.timeUpDownEndTime.TabStop = false;
timeCode1.Hours = 0; timeCode3.Hours = 0;
timeCode1.Milliseconds = 0; timeCode3.Milliseconds = 0;
timeCode1.Minutes = 0; timeCode3.Minutes = 0;
timeCode1.Seconds = 0; timeCode3.Seconds = 0;
timeCode1.TimeSpan = System.TimeSpan.Parse("00:00:00"); timeCode3.TimeSpan = System.TimeSpan.Parse("00:00:00");
timeCode1.TotalMilliseconds = 0D; timeCode3.TotalMilliseconds = 0D;
timeCode1.TotalSeconds = 0D; timeCode3.TotalSeconds = 0D;
this.timeUpDownEndTime.TimeCode = timeCode1; this.timeUpDownEndTime.TimeCode = timeCode3;
this.timeUpDownEndTime.UseVideoOffset = false; this.timeUpDownEndTime.UseVideoOffset = false;
// //
// timeUpDownStartTime // timeUpDownStartTime
@ -382,14 +383,14 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
this.timeUpDownStartTime.Size = new System.Drawing.Size(111, 23); this.timeUpDownStartTime.Size = new System.Drawing.Size(111, 23);
this.timeUpDownStartTime.TabIndex = 1; this.timeUpDownStartTime.TabIndex = 1;
this.timeUpDownStartTime.TabStop = false; this.timeUpDownStartTime.TabStop = false;
timeCode2.Hours = 0; timeCode4.Hours = 0;
timeCode2.Milliseconds = 0; timeCode4.Milliseconds = 0;
timeCode2.Minutes = 0; timeCode4.Minutes = 0;
timeCode2.Seconds = 0; timeCode4.Seconds = 0;
timeCode2.TimeSpan = System.TimeSpan.Parse("00:00:00"); timeCode4.TimeSpan = System.TimeSpan.Parse("00:00:00");
timeCode2.TotalMilliseconds = 0D; timeCode4.TotalMilliseconds = 0D;
timeCode2.TotalSeconds = 0D; timeCode4.TotalSeconds = 0D;
this.timeUpDownStartTime.TimeCode = timeCode2; this.timeUpDownStartTime.TimeCode = timeCode4;
this.timeUpDownStartTime.UseVideoOffset = false; this.timeUpDownStartTime.UseVideoOffset = false;
// //
// label1 // label1
@ -447,6 +448,7 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
this.comboBoxFrameRate.Size = new System.Drawing.Size(74, 21); this.comboBoxFrameRate.Size = new System.Drawing.Size(74, 21);
this.comboBoxFrameRate.TabIndex = 5; this.comboBoxFrameRate.TabIndex = 5;
this.comboBoxFrameRate.TabStop = false; this.comboBoxFrameRate.TabStop = false;
this.comboBoxFrameRate.UsePopupWindow = false;
this.comboBoxFrameRate.SelectedIndexChanged += new System.EventHandler(this.comboBoxFrameRate_SelectedIndexChanged); this.comboBoxFrameRate.SelectedIndexChanged += new System.EventHandler(this.comboBoxFrameRate_SelectedIndexChanged);
this.comboBoxFrameRate.SelectedValueChanged += new System.EventHandler(this.comboBoxFrameRate_SelectedValueChanged); this.comboBoxFrameRate.SelectedValueChanged += new System.EventHandler(this.comboBoxFrameRate_SelectedValueChanged);
// //
@ -557,6 +559,7 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
this.bottomAlignSelectedLinesToolStripMenuItem, this.bottomAlignSelectedLinesToolStripMenuItem,
this.toolStripSeparator9, this.toolStripSeparator9,
this.toggleforcedForSelectedLinesToolStripMenuItem, this.toggleforcedForSelectedLinesToolStripMenuItem,
this.toolStripMenuItemSelectNonForced,
this.selectOnlyForcedLinesToolStripMenuItem, this.selectOnlyForcedLinesToolStripMenuItem,
this.toolStripSeparator7, this.toolStripSeparator7,
this.resizeImagesForSelectedLinesToolStripMenuItem, this.resizeImagesForSelectedLinesToolStripMenuItem,
@ -570,7 +573,7 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
this.toolStripSeparatorInsertSub, this.toolStripSeparatorInsertSub,
this.insertSubtitleAfterThisLineToolStripMenuItem}); this.insertSubtitleAfterThisLineToolStripMenuItem});
this.contextMenuStripListView.Name = "contextMenuStripListView"; this.contextMenuStripListView.Name = "contextMenuStripListView";
this.contextMenuStripListView.Size = new System.Drawing.Size(377, 408); this.contextMenuStripListView.Size = new System.Drawing.Size(377, 452);
this.contextMenuStripListView.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripListView_Opening); this.contextMenuStripListView.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripListView_Opening);
// //
// deleteToolStripMenuItem // deleteToolStripMenuItem
@ -924,21 +927,21 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
// adjustAllTimesToolStripMenuItem // adjustAllTimesToolStripMenuItem
// //
this.adjustAllTimesToolStripMenuItem.Name = "adjustAllTimesToolStripMenuItem"; this.adjustAllTimesToolStripMenuItem.Name = "adjustAllTimesToolStripMenuItem";
this.adjustAllTimesToolStripMenuItem.Size = new System.Drawing.Size(172, 22); this.adjustAllTimesToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.adjustAllTimesToolStripMenuItem.Text = "Adjust all times"; this.adjustAllTimesToolStripMenuItem.Text = "Adjust all times";
this.adjustAllTimesToolStripMenuItem.Click += new System.EventHandler(this.adjustAllTimesToolStripMenuItem_Click); this.adjustAllTimesToolStripMenuItem.Click += new System.EventHandler(this.adjustAllTimesToolStripMenuItem_Click);
// //
// changeFrameRateToolStripMenuItem // changeFrameRateToolStripMenuItem
// //
this.changeFrameRateToolStripMenuItem.Name = "changeFrameRateToolStripMenuItem"; this.changeFrameRateToolStripMenuItem.Name = "changeFrameRateToolStripMenuItem";
this.changeFrameRateToolStripMenuItem.Size = new System.Drawing.Size(172, 22); this.changeFrameRateToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.changeFrameRateToolStripMenuItem.Text = "Change frame rate"; this.changeFrameRateToolStripMenuItem.Text = "Change frame rate";
this.changeFrameRateToolStripMenuItem.Click += new System.EventHandler(this.changeFrameRateToolStripMenuItem_Click); this.changeFrameRateToolStripMenuItem.Click += new System.EventHandler(this.changeFrameRateToolStripMenuItem_Click);
// //
// changeSpeedToolStripMenuItem // changeSpeedToolStripMenuItem
// //
this.changeSpeedToolStripMenuItem.Name = "changeSpeedToolStripMenuItem"; this.changeSpeedToolStripMenuItem.Name = "changeSpeedToolStripMenuItem";
this.changeSpeedToolStripMenuItem.Size = new System.Drawing.Size(172, 22); this.changeSpeedToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.changeSpeedToolStripMenuItem.Text = "Change speed"; this.changeSpeedToolStripMenuItem.Text = "Change speed";
this.changeSpeedToolStripMenuItem.Click += new System.EventHandler(this.changeSpeedToolStripMenuItem_Click); this.changeSpeedToolStripMenuItem.Click += new System.EventHandler(this.changeSpeedToolStripMenuItem_Click);
// //
@ -1136,6 +1139,13 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
this.timerSyntaxColor.Interval = 250; this.timerSyntaxColor.Interval = 250;
this.timerSyntaxColor.Tick += new System.EventHandler(this.timerSyntaxColor_Tick); this.timerSyntaxColor.Tick += new System.EventHandler(this.timerSyntaxColor_Tick);
// //
// toolStripMenuItemSelectNonForced
//
this.toolStripMenuItemSelectNonForced.Name = "toolStripMenuItemSelectNonForced";
this.toolStripMenuItemSelectNonForced.Size = new System.Drawing.Size(376, 22);
this.toolStripMenuItemSelectNonForced.Text = "Select only non-forced lines";
this.toolStripMenuItemSelectNonForced.Click += new System.EventHandler(this.toolStripMenuItemSelectNonForced_Click);
//
// BinEdit // BinEdit
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1277,5 +1287,6 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
private Nikse.SubtitleEdit.Controls.NikseLabel labelSyntaxError; private Nikse.SubtitleEdit.Controls.NikseLabel labelSyntaxError;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator11; private System.Windows.Forms.ToolStripSeparator toolStripSeparator11;
private System.Windows.Forms.ToolStripMenuItem saveImageAsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem saveImageAsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSelectNonForced;
} }
} }

View File

@ -325,6 +325,7 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
bottomAlignSelectedLinesToolStripMenuItem.Text = LanguageSettings.Current.BinEdit.BottomAlignSelectedLines; bottomAlignSelectedLinesToolStripMenuItem.Text = LanguageSettings.Current.BinEdit.BottomAlignSelectedLines;
toggleforcedForSelectedLinesToolStripMenuItem.Text = LanguageSettings.Current.BinEdit.ToggleForcedSelectedLines; toggleforcedForSelectedLinesToolStripMenuItem.Text = LanguageSettings.Current.BinEdit.ToggleForcedSelectedLines;
selectOnlyForcedLinesToolStripMenuItem.Text = LanguageSettings.Current.BinEdit.SelectForcedLines; selectOnlyForcedLinesToolStripMenuItem.Text = LanguageSettings.Current.BinEdit.SelectForcedLines;
toolStripMenuItemSelectNonForced.Text = LanguageSettings.Current.BinEdit.SelectNonForcedLines;
resizeImagesForSelectedLinesToolStripMenuItem.Text = LanguageSettings.Current.BinEdit.ResizeBitmapsForSelectedLines; resizeImagesForSelectedLinesToolStripMenuItem.Text = LanguageSettings.Current.BinEdit.ResizeBitmapsForSelectedLines;
colorSelectedLinesToolStripMenuItem.Text = LanguageSettings.Current.BinEdit.ChangeColorForSelectedLines; colorSelectedLinesToolStripMenuItem.Text = LanguageSettings.Current.BinEdit.ChangeColorForSelectedLines;
changeBrightnessForSelectedLinesToolStripMenuItem.Text = LanguageSettings.Current.BinEdit.ChangeBrightnessForSelectedLines; changeBrightnessForSelectedLinesToolStripMenuItem.Text = LanguageSettings.Current.BinEdit.ChangeBrightnessForSelectedLines;
@ -2655,6 +2656,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
insertSubtitleAfterThisLineToolStripMenuItem.Visible = selectedCount == 1 && subtitleListView1.SelectedItems[0].Index == subtitleListView1.Items.Count - 1; insertSubtitleAfterThisLineToolStripMenuItem.Visible = selectedCount == 1 && subtitleListView1.SelectedItems[0].Index == subtitleListView1.Items.Count - 1;
selectOnlyForcedLinesToolStripMenuItem.Visible = _extra.Any(p => p.IsForced); selectOnlyForcedLinesToolStripMenuItem.Visible = _extra.Any(p => p.IsForced);
toolStripMenuItemSelectNonForced.Visible = _extra.Any(p => p.IsForced);
quickOCRTextsforOverviewOnlyToolStripMenuItem.Visible = File.Exists(_nOcrFileName); quickOCRTextsforOverviewOnlyToolStripMenuItem.Visible = File.Exists(_nOcrFileName);
} }
@ -3949,8 +3951,8 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
subtitleListView1.SelectedIndexChanged -= subtitleListView1_SelectedIndexChanged; subtitleListView1.SelectedIndexChanged -= subtitleListView1_SelectedIndexChanged;
subtitleListView1.SelectedIndices.Clear(); subtitleListView1.SelectedIndices.Clear();
System.Collections.IList list = subtitleListView1.Items; System.Collections.IList list = subtitleListView1.Items;
bool first = true; var first = true;
for (int i = 0; i < list.Count; i++) for (var i = 0; i < list.Count; i++)
{ {
var item = (ListViewItem)list[i]; var item = (ListViewItem)list[i];
if (_extra[i].IsForced) if (_extra[i].IsForced)
@ -4113,5 +4115,30 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
bmp.Dispose(); bmp.Dispose();
} }
} }
private void toolStripMenuItemSelectNonForced_Click(object sender, EventArgs e)
{
subtitleListView1.BeginUpdate();
subtitleListView1.SelectedIndexChanged -= subtitleListView1_SelectedIndexChanged;
subtitleListView1.SelectedIndices.Clear();
System.Collections.IList list = subtitleListView1.Items;
var first = true;
for (var i = 0; i < list.Count; i++)
{
var item = (ListViewItem)list[i];
if (!_extra[i].IsForced)
{
item.Selected = true;
if (first)
{
SelectIndexAndEnsureVisible(i);
first = false;
}
}
}
subtitleListView1.SelectedIndexChanged += subtitleListView1_SelectedIndexChanged;
subtitleListView1.EndUpdate();
subtitleListView1_SelectedIndexChanged(null, null);
}
} }
} }

View File

@ -679,6 +679,7 @@ namespace Nikse.SubtitleEdit.Logic
BottomAlignSelectedLines = "Bottom align selected lines (keep horizontal position)", BottomAlignSelectedLines = "Bottom align selected lines (keep horizontal position)",
ToggleForcedSelectedLines = "Toggle \"Forced\" for selected lines", ToggleForcedSelectedLines = "Toggle \"Forced\" for selected lines",
SelectForcedLines = "Select forced lines", SelectForcedLines = "Select forced lines",
SelectNonForcedLines = "Select non-forced lines",
SizeXY = "Size: {0}x{1}", SizeXY = "Size: {0}x{1}",
SetAspectRatio11 = "Set aspect ratio 1:1", SetAspectRatio11 = "Set aspect ratio 1:1",
ChangeBrightnessTitle = "Adjust brightness", ChangeBrightnessTitle = "Adjust brightness",

View File

@ -1297,6 +1297,9 @@ namespace Nikse.SubtitleEdit.Logic
case "BinEdit/SelectForcedLines": case "BinEdit/SelectForcedLines":
language.BinEdit.SelectForcedLines = reader.Value; language.BinEdit.SelectForcedLines = reader.Value;
break; break;
case "BinEdit/SelectNonForcedLines":
language.BinEdit.SelectNonForcedLines = reader.Value;
break;
case "BinEdit/SizeXY": case "BinEdit/SizeXY":
language.BinEdit.SizeXY = reader.Value; language.BinEdit.SizeXY = reader.Value;
break; break;

View File

@ -502,6 +502,7 @@
public string BottomAlignSelectedLines { get; set; } public string BottomAlignSelectedLines { get; set; }
public string ToggleForcedSelectedLines { get; set; } public string ToggleForcedSelectedLines { get; set; }
public string SelectForcedLines { get; set; } public string SelectForcedLines { get; set; }
public string SelectNonForcedLines { get; set; }
public string SizeXY { get; set; } public string SizeXY { get; set; }
public string SetAspectRatio11 { get; set; } public string SetAspectRatio11 { get; set; }
public string ChangeBrightnessTitle { get; set; } public string ChangeBrightnessTitle { get; set; }