Working on dvb sub

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@2358 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2014-01-09 20:12:19 +00:00
parent 19df847015
commit dff2c05279
6 changed files with 329 additions and 204 deletions

View File

@ -85,7 +85,7 @@ namespace Nikse.SubtitleEdit.Forms
i++;
var start = new TimeCode(TimeSpan.FromMilliseconds(sub.StartMilliseconds));
var end = new TimeCode(TimeSpan.FromMilliseconds(sub.EndMilliseconds));
listBoxSubtitles.Items.Add(string.Format("{0}: {1} --> {2}, {3} image(s)", i, start.ToString(), end.ToString(), sub.Pes.ObjectDataList.Count));
listBoxSubtitles.Items.Add(string.Format("{0}: {1} --> {2}, {3} image(s)", i, start.ToString(), end.ToString(), sub.NumberOfImages));
}
if (list.Count > 0)
listBoxSubtitles.SelectedIndex = 0;

View File

@ -59,16 +59,6 @@ namespace Nikse.SubtitleEdit.Forms
this.buttonCancel = new System.Windows.Forms.Button();
this.groupBoxOcrMethod = new System.Windows.Forms.GroupBox();
this.comboBoxOcrMethod = new System.Windows.Forms.ComboBox();
this.groupBoxImageCompareMethod = new System.Windows.Forms.GroupBox();
this.labelMaxErrorPercent = new System.Windows.Forms.Label();
this.numericUpDownMaxErrorPct = new System.Windows.Forms.NumericUpDown();
this.checkBoxRightToLeft = new System.Windows.Forms.CheckBox();
this.numericUpDownPixelsIsSpace = new System.Windows.Forms.NumericUpDown();
this.buttonEditCharacterDatabase = new System.Windows.Forms.Button();
this.labelNoOfPixelsIsSpace = new System.Windows.Forms.Label();
this.comboBoxCharacterDatabase = new System.Windows.Forms.ComboBox();
this.labelImageDatabase = new System.Windows.Forms.Label();
this.buttonNewCharacterDatabase = new System.Windows.Forms.Button();
this.GroupBoxTesseractMethod = new System.Windows.Forms.GroupBox();
this.buttonGetTesseractDictionaries = new System.Windows.Forms.Button();
this.checkBoxTesseractMusicOn = new System.Windows.Forms.CheckBox();
@ -89,6 +79,16 @@ namespace Nikse.SubtitleEdit.Forms
this.checkBoxRightToLeftNOCR = new System.Windows.Forms.CheckBox();
this.numericUpDownNumberOfPixelsIsSpaceNOCR = new System.Windows.Forms.NumericUpDown();
this.labelNumberOfPixelsIsSpaceNOCR = new System.Windows.Forms.Label();
this.groupBoxImageCompareMethod = new System.Windows.Forms.GroupBox();
this.labelMaxErrorPercent = new System.Windows.Forms.Label();
this.numericUpDownMaxErrorPct = new System.Windows.Forms.NumericUpDown();
this.checkBoxRightToLeft = new System.Windows.Forms.CheckBox();
this.numericUpDownPixelsIsSpace = new System.Windows.Forms.NumericUpDown();
this.buttonEditCharacterDatabase = new System.Windows.Forms.Button();
this.labelNoOfPixelsIsSpace = new System.Windows.Forms.Label();
this.comboBoxCharacterDatabase = new System.Windows.Forms.ComboBox();
this.labelImageDatabase = new System.Windows.Forms.Label();
this.buttonNewCharacterDatabase = new System.Windows.Forms.Button();
this.groupBoxOCRControls = new System.Windows.Forms.GroupBox();
this.labelStartFrom = new System.Windows.Forms.Label();
this.numericUpDownStartNumber = new System.Windows.Forms.NumericUpDown();
@ -140,18 +140,21 @@ namespace Nikse.SubtitleEdit.Forms
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.splitContainerBottom = new System.Windows.Forms.SplitContainer();
this.timerHideStatus = new System.Windows.Forms.Timer(this.components);
this.groupBoxTransportStream = new System.Windows.Forms.GroupBox();
this.checkBoxTransportStreamGrayscale = new System.Windows.Forms.CheckBox();
this.textBoxCurrentText = new Nikse.SubtitleEdit.Controls.SETextBox();
this.subtitleListView1 = new Nikse.SubtitleEdit.Controls.SubtitleListView();
this.timerHideStatus = new System.Windows.Forms.Timer(this.components);
this.checkBoxTransportStreamGetColorAndSplit = new System.Windows.Forms.CheckBox();
this.contextMenuStripListview.SuspendLayout();
this.groupBoxOcrMethod.SuspendLayout();
this.groupBoxImageCompareMethod.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxErrorPct)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownPixelsIsSpace)).BeginInit();
this.GroupBoxTesseractMethod.SuspendLayout();
this.groupBoxModiMethod.SuspendLayout();
this.groupBoxNOCR.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownNumberOfPixelsIsSpaceNOCR)).BeginInit();
this.groupBoxImageCompareMethod.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxErrorPct)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownPixelsIsSpace)).BeginInit();
this.groupBoxOCRControls.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownStartNumber)).BeginInit();
this.groupBoxOcrAutoFix.SuspendLayout();
@ -172,6 +175,7 @@ namespace Nikse.SubtitleEdit.Forms
this.splitContainerBottom.Panel1.SuspendLayout();
this.splitContainerBottom.Panel2.SuspendLayout();
this.splitContainerBottom.SuspendLayout();
this.groupBoxTransportStream.SuspendLayout();
this.SuspendLayout();
//
// contextMenuStripListview
@ -412,141 +416,6 @@ namespace Nikse.SubtitleEdit.Forms
this.comboBoxOcrMethod.TabIndex = 0;
this.comboBoxOcrMethod.SelectedIndexChanged += new System.EventHandler(this.ComboBoxOcrMethodSelectedIndexChanged);
//
// groupBoxImageCompareMethod
//
this.groupBoxImageCompareMethod.Controls.Add(this.labelMaxErrorPercent);
this.groupBoxImageCompareMethod.Controls.Add(this.numericUpDownMaxErrorPct);
this.groupBoxImageCompareMethod.Controls.Add(this.checkBoxRightToLeft);
this.groupBoxImageCompareMethod.Controls.Add(this.numericUpDownPixelsIsSpace);
this.groupBoxImageCompareMethod.Controls.Add(this.buttonEditCharacterDatabase);
this.groupBoxImageCompareMethod.Controls.Add(this.labelNoOfPixelsIsSpace);
this.groupBoxImageCompareMethod.Controls.Add(this.comboBoxCharacterDatabase);
this.groupBoxImageCompareMethod.Controls.Add(this.labelImageDatabase);
this.groupBoxImageCompareMethod.Controls.Add(this.buttonNewCharacterDatabase);
this.groupBoxImageCompareMethod.Location = new System.Drawing.Point(13, 38);
this.groupBoxImageCompareMethod.Name = "groupBoxImageCompareMethod";
this.groupBoxImageCompareMethod.Size = new System.Drawing.Size(366, 131);
this.groupBoxImageCompareMethod.TabIndex = 2;
this.groupBoxImageCompareMethod.TabStop = false;
this.groupBoxImageCompareMethod.Text = "Image compare";
//
// labelMaxErrorPercent
//
this.labelMaxErrorPercent.AutoSize = true;
this.labelMaxErrorPercent.Location = new System.Drawing.Point(7, 83);
this.labelMaxErrorPercent.Name = "labelMaxErrorPercent";
this.labelMaxErrorPercent.Size = new System.Drawing.Size(55, 13);
this.labelMaxErrorPercent.TabIndex = 45;
this.labelMaxErrorPercent.Text = "Max Err%";
//
// numericUpDownMaxErrorPct
//
this.numericUpDownMaxErrorPct.DecimalPlaces = 1;
this.numericUpDownMaxErrorPct.Increment = new decimal(new int[] {
1,
0,
0,
65536});
this.numericUpDownMaxErrorPct.Location = new System.Drawing.Point(173, 81);
this.numericUpDownMaxErrorPct.Maximum = new decimal(new int[] {
20,
0,
0,
0});
this.numericUpDownMaxErrorPct.Minimum = new decimal(new int[] {
5,
0,
0,
65536});
this.numericUpDownMaxErrorPct.Name = "numericUpDownMaxErrorPct";
this.numericUpDownMaxErrorPct.Size = new System.Drawing.Size(50, 21);
this.numericUpDownMaxErrorPct.TabIndex = 44;
this.numericUpDownMaxErrorPct.Value = new decimal(new int[] {
10,
0,
0,
65536});
//
// checkBoxRightToLeft
//
this.checkBoxRightToLeft.AutoSize = true;
this.checkBoxRightToLeft.Location = new System.Drawing.Point(9, 107);
this.checkBoxRightToLeft.Name = "checkBoxRightToLeft";
this.checkBoxRightToLeft.Size = new System.Drawing.Size(83, 17);
this.checkBoxRightToLeft.TabIndex = 6;
this.checkBoxRightToLeft.Text = "Right to left";
this.checkBoxRightToLeft.UseVisualStyleBackColor = true;
//
// numericUpDownPixelsIsSpace
//
this.numericUpDownPixelsIsSpace.Location = new System.Drawing.Point(173, 54);
this.numericUpDownPixelsIsSpace.Maximum = new decimal(new int[] {
50,
0,
0,
0});
this.numericUpDownPixelsIsSpace.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDownPixelsIsSpace.Name = "numericUpDownPixelsIsSpace";
this.numericUpDownPixelsIsSpace.Size = new System.Drawing.Size(50, 21);
this.numericUpDownPixelsIsSpace.TabIndex = 5;
this.numericUpDownPixelsIsSpace.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// buttonEditCharacterDatabase
//
this.buttonEditCharacterDatabase.Location = new System.Drawing.Point(278, 46);
this.buttonEditCharacterDatabase.Name = "buttonEditCharacterDatabase";
this.buttonEditCharacterDatabase.Size = new System.Drawing.Size(68, 21);
this.buttonEditCharacterDatabase.TabIndex = 3;
this.buttonEditCharacterDatabase.Text = "Edit";
this.buttonEditCharacterDatabase.UseVisualStyleBackColor = true;
this.buttonEditCharacterDatabase.Click += new System.EventHandler(this.ButtonEditCharacterDatabaseClick);
//
// labelNoOfPixelsIsSpace
//
this.labelNoOfPixelsIsSpace.AutoSize = true;
this.labelNoOfPixelsIsSpace.Location = new System.Drawing.Point(6, 56);
this.labelNoOfPixelsIsSpace.Name = "labelNoOfPixelsIsSpace";
this.labelNoOfPixelsIsSpace.Size = new System.Drawing.Size(104, 13);
this.labelNoOfPixelsIsSpace.TabIndex = 4;
this.labelNoOfPixelsIsSpace.Text = "No of pixels is space";
//
// comboBoxCharacterDatabase
//
this.comboBoxCharacterDatabase.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxCharacterDatabase.FormattingEnabled = true;
this.comboBoxCharacterDatabase.Location = new System.Drawing.Point(130, 19);
this.comboBoxCharacterDatabase.Name = "comboBoxCharacterDatabase";
this.comboBoxCharacterDatabase.Size = new System.Drawing.Size(142, 21);
this.comboBoxCharacterDatabase.TabIndex = 1;
this.comboBoxCharacterDatabase.SelectedIndexChanged += new System.EventHandler(this.ComboBoxCharacterDatabaseSelectedIndexChanged);
//
// labelImageDatabase
//
this.labelImageDatabase.AutoSize = true;
this.labelImageDatabase.Location = new System.Drawing.Point(7, 22);
this.labelImageDatabase.Name = "labelImageDatabase";
this.labelImageDatabase.Size = new System.Drawing.Size(85, 13);
this.labelImageDatabase.TabIndex = 0;
this.labelImageDatabase.Text = "Image database";
//
// buttonNewCharacterDatabase
//
this.buttonNewCharacterDatabase.Location = new System.Drawing.Point(278, 19);
this.buttonNewCharacterDatabase.Name = "buttonNewCharacterDatabase";
this.buttonNewCharacterDatabase.Size = new System.Drawing.Size(68, 21);
this.buttonNewCharacterDatabase.TabIndex = 2;
this.buttonNewCharacterDatabase.Text = "New";
this.buttonNewCharacterDatabase.UseVisualStyleBackColor = true;
this.buttonNewCharacterDatabase.Click += new System.EventHandler(this.ButtonNewCharacterDatabaseClick);
//
// GroupBoxTesseractMethod
//
this.GroupBoxTesseractMethod.Controls.Add(this.buttonGetTesseractDictionaries);
@ -776,6 +645,141 @@ namespace Nikse.SubtitleEdit.Forms
this.labelNumberOfPixelsIsSpaceNOCR.TabIndex = 4;
this.labelNumberOfPixelsIsSpaceNOCR.Text = "No of pixels is space";
//
// groupBoxImageCompareMethod
//
this.groupBoxImageCompareMethod.Controls.Add(this.labelMaxErrorPercent);
this.groupBoxImageCompareMethod.Controls.Add(this.numericUpDownMaxErrorPct);
this.groupBoxImageCompareMethod.Controls.Add(this.checkBoxRightToLeft);
this.groupBoxImageCompareMethod.Controls.Add(this.numericUpDownPixelsIsSpace);
this.groupBoxImageCompareMethod.Controls.Add(this.buttonEditCharacterDatabase);
this.groupBoxImageCompareMethod.Controls.Add(this.labelNoOfPixelsIsSpace);
this.groupBoxImageCompareMethod.Controls.Add(this.comboBoxCharacterDatabase);
this.groupBoxImageCompareMethod.Controls.Add(this.labelImageDatabase);
this.groupBoxImageCompareMethod.Controls.Add(this.buttonNewCharacterDatabase);
this.groupBoxImageCompareMethod.Location = new System.Drawing.Point(13, 38);
this.groupBoxImageCompareMethod.Name = "groupBoxImageCompareMethod";
this.groupBoxImageCompareMethod.Size = new System.Drawing.Size(366, 131);
this.groupBoxImageCompareMethod.TabIndex = 2;
this.groupBoxImageCompareMethod.TabStop = false;
this.groupBoxImageCompareMethod.Text = "Image compare";
//
// labelMaxErrorPercent
//
this.labelMaxErrorPercent.AutoSize = true;
this.labelMaxErrorPercent.Location = new System.Drawing.Point(7, 83);
this.labelMaxErrorPercent.Name = "labelMaxErrorPercent";
this.labelMaxErrorPercent.Size = new System.Drawing.Size(55, 13);
this.labelMaxErrorPercent.TabIndex = 45;
this.labelMaxErrorPercent.Text = "Max Err%";
//
// numericUpDownMaxErrorPct
//
this.numericUpDownMaxErrorPct.DecimalPlaces = 1;
this.numericUpDownMaxErrorPct.Increment = new decimal(new int[] {
1,
0,
0,
65536});
this.numericUpDownMaxErrorPct.Location = new System.Drawing.Point(173, 81);
this.numericUpDownMaxErrorPct.Maximum = new decimal(new int[] {
20,
0,
0,
0});
this.numericUpDownMaxErrorPct.Minimum = new decimal(new int[] {
5,
0,
0,
65536});
this.numericUpDownMaxErrorPct.Name = "numericUpDownMaxErrorPct";
this.numericUpDownMaxErrorPct.Size = new System.Drawing.Size(50, 21);
this.numericUpDownMaxErrorPct.TabIndex = 44;
this.numericUpDownMaxErrorPct.Value = new decimal(new int[] {
10,
0,
0,
65536});
//
// checkBoxRightToLeft
//
this.checkBoxRightToLeft.AutoSize = true;
this.checkBoxRightToLeft.Location = new System.Drawing.Point(9, 107);
this.checkBoxRightToLeft.Name = "checkBoxRightToLeft";
this.checkBoxRightToLeft.Size = new System.Drawing.Size(83, 17);
this.checkBoxRightToLeft.TabIndex = 6;
this.checkBoxRightToLeft.Text = "Right to left";
this.checkBoxRightToLeft.UseVisualStyleBackColor = true;
//
// numericUpDownPixelsIsSpace
//
this.numericUpDownPixelsIsSpace.Location = new System.Drawing.Point(173, 54);
this.numericUpDownPixelsIsSpace.Maximum = new decimal(new int[] {
50,
0,
0,
0});
this.numericUpDownPixelsIsSpace.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDownPixelsIsSpace.Name = "numericUpDownPixelsIsSpace";
this.numericUpDownPixelsIsSpace.Size = new System.Drawing.Size(50, 21);
this.numericUpDownPixelsIsSpace.TabIndex = 5;
this.numericUpDownPixelsIsSpace.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// buttonEditCharacterDatabase
//
this.buttonEditCharacterDatabase.Location = new System.Drawing.Point(278, 46);
this.buttonEditCharacterDatabase.Name = "buttonEditCharacterDatabase";
this.buttonEditCharacterDatabase.Size = new System.Drawing.Size(68, 21);
this.buttonEditCharacterDatabase.TabIndex = 3;
this.buttonEditCharacterDatabase.Text = "Edit";
this.buttonEditCharacterDatabase.UseVisualStyleBackColor = true;
this.buttonEditCharacterDatabase.Click += new System.EventHandler(this.ButtonEditCharacterDatabaseClick);
//
// labelNoOfPixelsIsSpace
//
this.labelNoOfPixelsIsSpace.AutoSize = true;
this.labelNoOfPixelsIsSpace.Location = new System.Drawing.Point(6, 56);
this.labelNoOfPixelsIsSpace.Name = "labelNoOfPixelsIsSpace";
this.labelNoOfPixelsIsSpace.Size = new System.Drawing.Size(104, 13);
this.labelNoOfPixelsIsSpace.TabIndex = 4;
this.labelNoOfPixelsIsSpace.Text = "No of pixels is space";
//
// comboBoxCharacterDatabase
//
this.comboBoxCharacterDatabase.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxCharacterDatabase.FormattingEnabled = true;
this.comboBoxCharacterDatabase.Location = new System.Drawing.Point(130, 19);
this.comboBoxCharacterDatabase.Name = "comboBoxCharacterDatabase";
this.comboBoxCharacterDatabase.Size = new System.Drawing.Size(142, 21);
this.comboBoxCharacterDatabase.TabIndex = 1;
this.comboBoxCharacterDatabase.SelectedIndexChanged += new System.EventHandler(this.ComboBoxCharacterDatabaseSelectedIndexChanged);
//
// labelImageDatabase
//
this.labelImageDatabase.AutoSize = true;
this.labelImageDatabase.Location = new System.Drawing.Point(7, 22);
this.labelImageDatabase.Name = "labelImageDatabase";
this.labelImageDatabase.Size = new System.Drawing.Size(85, 13);
this.labelImageDatabase.TabIndex = 0;
this.labelImageDatabase.Text = "Image database";
//
// buttonNewCharacterDatabase
//
this.buttonNewCharacterDatabase.Location = new System.Drawing.Point(278, 19);
this.buttonNewCharacterDatabase.Name = "buttonNewCharacterDatabase";
this.buttonNewCharacterDatabase.Size = new System.Drawing.Size(68, 21);
this.buttonNewCharacterDatabase.TabIndex = 2;
this.buttonNewCharacterDatabase.Text = "New";
this.buttonNewCharacterDatabase.UseVisualStyleBackColor = true;
this.buttonNewCharacterDatabase.Click += new System.EventHandler(this.ButtonNewCharacterDatabaseClick);
//
// groupBoxOCRControls
//
this.groupBoxOCRControls.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
@ -1257,6 +1261,7 @@ namespace Nikse.SubtitleEdit.Forms
//
this.groupBoxSubtitleImage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxSubtitleImage.Controls.Add(this.groupBoxTransportStream);
this.groupBoxSubtitleImage.Controls.Add(this.checkBoxAutoTransparentBackground);
this.groupBoxSubtitleImage.Controls.Add(this.groupBoxImagePalette);
this.groupBoxSubtitleImage.Controls.Add(this.pictureBoxSubtitleImage);
@ -1346,6 +1351,36 @@ namespace Nikse.SubtitleEdit.Forms
this.splitContainerBottom.SplitterDistance = 658;
this.splitContainerBottom.TabIndex = 39;
//
// timerHideStatus
//
this.timerHideStatus.Interval = 2000;
this.timerHideStatus.Tick += new System.EventHandler(this.timerHideStatus_Tick);
//
// groupBoxTransportStream
//
this.groupBoxTransportStream.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxTransportStream.Controls.Add(this.checkBoxTransportStreamGetColorAndSplit);
this.groupBoxTransportStream.Controls.Add(this.checkBoxTransportStreamGrayscale);
this.groupBoxTransportStream.Location = new System.Drawing.Point(94, 6);
this.groupBoxTransportStream.Name = "groupBoxTransportStream";
this.groupBoxTransportStream.Size = new System.Drawing.Size(636, 38);
this.groupBoxTransportStream.TabIndex = 36;
this.groupBoxTransportStream.TabStop = false;
this.groupBoxTransportStream.Text = "Transport stream";
this.groupBoxTransportStream.Visible = false;
//
// checkBoxTransportStreamGrayscale
//
this.checkBoxTransportStreamGrayscale.AutoSize = true;
this.checkBoxTransportStreamGrayscale.Location = new System.Drawing.Point(7, 16);
this.checkBoxTransportStreamGrayscale.Name = "checkBoxTransportStreamGrayscale";
this.checkBoxTransportStreamGrayscale.Size = new System.Drawing.Size(73, 17);
this.checkBoxTransportStreamGrayscale.TabIndex = 0;
this.checkBoxTransportStreamGrayscale.Text = "Grayscale";
this.checkBoxTransportStreamGrayscale.UseVisualStyleBackColor = true;
this.checkBoxTransportStreamGrayscale.CheckedChanged += new System.EventHandler(this.checkBoxTransportStreamGrayscale_CheckedChanged);
//
// textBoxCurrentText
//
this.textBoxCurrentText.AllowDrop = true;
@ -1383,10 +1418,16 @@ namespace Nikse.SubtitleEdit.Forms
this.subtitleListView1.SelectedIndexChanged += new System.EventHandler(this.SubtitleListView1SelectedIndexChanged);
this.subtitleListView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.subtitleListView1_KeyDown);
//
// timerHideStatus
// checkBoxTransportStreamGetColorAndSplit
//
this.timerHideStatus.Interval = 2000;
this.timerHideStatus.Tick += new System.EventHandler(this.timerHideStatus_Tick);
this.checkBoxTransportStreamGetColorAndSplit.AutoSize = true;
this.checkBoxTransportStreamGetColorAndSplit.Location = new System.Drawing.Point(135, 15);
this.checkBoxTransportStreamGetColorAndSplit.Name = "checkBoxTransportStreamGetColorAndSplit";
this.checkBoxTransportStreamGetColorAndSplit.Size = new System.Drawing.Size(253, 17);
this.checkBoxTransportStreamGetColorAndSplit.TabIndex = 1;
this.checkBoxTransportStreamGetColorAndSplit.Text = "Try get color (will include some splitting of lines)";
this.checkBoxTransportStreamGetColorAndSplit.UseVisualStyleBackColor = true;
this.checkBoxTransportStreamGetColorAndSplit.CheckedChanged += new System.EventHandler(this.checkBoxTransportStreamGetColorAndSplit_CheckedChanged);
//
// VobSubOcr
//
@ -1415,10 +1456,6 @@ namespace Nikse.SubtitleEdit.Forms
this.Resize += new System.EventHandler(this.VobSubOcr_Resize);
this.contextMenuStripListview.ResumeLayout(false);
this.groupBoxOcrMethod.ResumeLayout(false);
this.groupBoxImageCompareMethod.ResumeLayout(false);
this.groupBoxImageCompareMethod.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxErrorPct)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownPixelsIsSpace)).EndInit();
this.GroupBoxTesseractMethod.ResumeLayout(false);
this.GroupBoxTesseractMethod.PerformLayout();
this.groupBoxModiMethod.ResumeLayout(false);
@ -1426,6 +1463,10 @@ namespace Nikse.SubtitleEdit.Forms
this.groupBoxNOCR.ResumeLayout(false);
this.groupBoxNOCR.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownNumberOfPixelsIsSpaceNOCR)).EndInit();
this.groupBoxImageCompareMethod.ResumeLayout(false);
this.groupBoxImageCompareMethod.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxErrorPct)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownPixelsIsSpace)).EndInit();
this.groupBoxOCRControls.ResumeLayout(false);
this.groupBoxOCRControls.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownStartNumber)).EndInit();
@ -1451,6 +1492,8 @@ namespace Nikse.SubtitleEdit.Forms
this.splitContainerBottom.Panel1.PerformLayout();
this.splitContainerBottom.Panel2.ResumeLayout(false);
this.splitContainerBottom.ResumeLayout(false);
this.groupBoxTransportStream.ResumeLayout(false);
this.groupBoxTransportStream.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -1570,5 +1613,8 @@ namespace Nikse.SubtitleEdit.Forms
private System.Windows.Forms.ToolStripMenuItem dOSTToolStripMenuItem;
private System.Windows.Forms.Label labelMaxErrorPercent;
private System.Windows.Forms.NumericUpDown numericUpDownMaxErrorPct;
private System.Windows.Forms.GroupBox groupBoxTransportStream;
private System.Windows.Forms.CheckBox checkBoxTransportStreamGrayscale;
private System.Windows.Forms.CheckBox checkBoxTransportStreamGetColorAndSplit;
}
}

View File

@ -222,6 +222,7 @@ namespace Nikse.SubtitleEdit.Forms
// DVB (from transport stream)
List<Logic.TransportStream.DvbSubtitle> _dvbSubtitles;
Color _dvbSubColor = Color.Transparent;
string _lastLine;
string _languageId;
@ -1254,12 +1255,14 @@ namespace Nikse.SubtitleEdit.Forms
}
else if (_dvbSubtitles != null)
{
var dvbBmp = _dvbSubtitles[index].Pes.GetImageFull();
NikseBitmap nDvbBmp = new NikseBitmap(dvbBmp);
var dvbBmp = _dvbSubtitles[index].GetActiveImage();
var nDvbBmp = new NikseBitmap(dvbBmp);
nDvbBmp.CropTopTransparent(2);
nDvbBmp.CropSidesAndBottom(2, Color.Transparent, true);
var c = nDvbBmp.GetBrightestColor();
groupBoxSubtitleImage.BackColor = c;
nDvbBmp.CropTransparentSidesAndBottom(2, true);
if (checkBoxTransportStreamGetColorAndSplit.Checked)
_dvbSubColor = nDvbBmp.GetBrightestColor();
if (checkBoxTransportStreamGrayscale.Checked)
nDvbBmp.GrayScale();
dvbBmp.Dispose();
return nDvbBmp.GetBitmap();
}
@ -4454,6 +4457,13 @@ namespace Nikse.SubtitleEdit.Forms
text = Utilities.AutoBreakLine(text);
}
if (_dvbSubtitles != null && checkBoxTransportStreamGetColorAndSplit.Checked)
{
text = Utilities.UnbreakLine(text);
if (_dvbSubColor != Color.Transparent)
text = "<font color=\"" + ColorTranslator.ToHtml(_dvbSubColor) + "\">" + text + "</font>";
}
if (_abort)
{
textBoxCurrentText.Text = text;
@ -6681,6 +6691,11 @@ namespace Nikse.SubtitleEdit.Forms
foreach (int idx in indices)
_spList.RemoveAt(idx);
}
else if (_dvbSubtitles != null)
{
foreach (int idx in indices)
_dvbSubtitles.RemoveAt(idx);
}
else if (_bdnXmlSubtitle != null)
{
foreach (int idx in indices)
@ -6991,6 +7006,7 @@ namespace Nikse.SubtitleEdit.Forms
exportBdnXmlPng.ShowDialog(this);
}
// TODO: Get language from ts file
internal void Initialize(List<Logic.TransportStream.DvbSubtitle> subtitles, VobSubOcrSettings vobSubOcrSettings, string fileName)
{
buttonOK.Enabled = false;
@ -7015,6 +7031,81 @@ namespace Nikse.SubtitleEdit.Forms
_dvbSubtitles = subtitles;
ShowDvbSubs();
FileName = fileName;
Text += " - " + Path.GetFileName(fileName);
groupBoxImagePalette.Visible = false;
groupBoxTransportStream.Left = groupBoxImagePalette.Left;
groupBoxTransportStream.Top = groupBoxImagePalette.Top;
groupBoxTransportStream.Visible = true;
//SetTesseractLanguageFromLanguageString(languageString);
//_importLanguageString = languageString;
}
private void checkBoxTransportStreamGrayscale_CheckedChanged(object sender, EventArgs e)
{
SubtitleListView1SelectedIndexChanged(null, null);
}
private void checkBoxTransportStreamGetColorAndSplit_CheckedChanged(object sender, EventArgs e)
{
if (checkBoxTransportStreamGetColorAndSplit.Checked)
{
SplitDvbForEachSubImage();
}
else
{
MergeDvbForEachSubImage();
}
SubtitleListView1SelectedIndexChanged(null, null);
}
private void MergeDvbForEachSubImage()
{
for (int i = 0; i < _dvbSubtitles.Count; i++)
{
var dvbSub = _dvbSubtitles[i];
if (dvbSub.ActiveImageIndex.HasValue && dvbSub.ActiveImageIndex > 0)
_dvbSubtitles.RemoveAt(i);
else
dvbSub.ActiveImageIndex = null;
}
_tesseractAsyncStrings = null;
ShowDvbSubs();
}
private void SplitDvbForEachSubImage()
{
var list = new List<Nikse.SubtitleEdit.Logic.TransportStream.DvbSubtitle>();
foreach (var dvbSub in _dvbSubtitles)
{
if (dvbSub.ActiveImageIndex == null)
{
for (int i = 0; i < dvbSub.Pes.ObjectDataList.Count; i++)
{
var newDbvSub = new Nikse.SubtitleEdit.Logic.TransportStream.DvbSubtitle();
newDbvSub.Pes = dvbSub.Pes;
newDbvSub.ActiveImageIndex = i;
newDbvSub.StartMilliseconds = dvbSub.StartMilliseconds;
newDbvSub.EndMilliseconds = dvbSub.EndMilliseconds;
list.Add(newDbvSub);
}
}
else
{
list.Add(dvbSub);
}
}
_dvbSubtitles = list;
_tesseractAsyncStrings = null;
ShowDvbSubs();
}
private void ShowDvbSubs()
{
_subtitle.Paragraphs.Clear();
foreach (var sub in _dvbSubtitles)
{
_subtitle.Paragraphs.Add(new Paragraph(string.Empty, sub.StartMilliseconds, sub.EndMilliseconds));
@ -7022,13 +7113,6 @@ namespace Nikse.SubtitleEdit.Forms
_subtitle.Renumber(1);
subtitleListView1.Fill(_subtitle);
subtitleListView1.SelectIndexAndEnsureVisible(0);
FileName = fileName;
Text += " - " + Path.GetFileName(fileName);
groupBoxImagePalette.Visible = false;
//SetTesseractLanguageFromLanguageString(languageString);
//_importLanguageString = languageString;
}
}

View File

@ -932,6 +932,10 @@ namespace Nikse.SubtitleEdit.Logic
}
/// <summary>
/// Returns brightest color (not white though)
/// </summary>
/// <returns>Brightest color, if not found or if brightes color is white, then Color.Transparent is returned</returns>
public Color GetBrightestColor()
{
int max = Width * Height - 4;
@ -957,5 +961,16 @@ namespace Nikse.SubtitleEdit.Logic
return false;
}
public void GrayScale()
{
for (int i = 0; i < _bitmapData.Length; i += 4)
{
int medium = Convert.ToInt32((_bitmapData[i + 2] + _bitmapData[i + 1] + _bitmapData[i]) * 1.5 / 3.0 + 2);
if (medium > byte.MaxValue)
medium = byte.MaxValue;
_bitmapData[i + 2] = _bitmapData[i + 1] = _bitmapData[i] = (byte)medium;
}
}
}
}

View File

@ -120,31 +120,7 @@ namespace Nikse.SubtitleEdit.Logic.TransportStream
return DataBuffer[1];
}
}
//public List<SubtitleSegment> SubtitleSegments
//{
// get
// {
// var list = new List<SubtitleSegment>();
// int index = 2;
// var ss = new SubtitleSegment(DataBuffer, index, null);
// ClutDefinitionSegment cds = null;
// while (ss.SyncByte == Helper.B00001111)
// {
// list.Add(ss);
// if (ss.ClutDefinition != null)
// cds = ss.ClutDefinition;
// index += 6 + ss.SegmentLength;
// if (index + 6 < DataBuffer.Length)
// ss = new SubtitleSegment(DataBuffer, index, cds);
// else
// ss.SyncByte = Helper.B11111111;
// }
// return list;
// }
//}
}
public List<SubtitleSegment> SubtitleSegments { get; set; }
public List<ClutDefinitionSegment> ClutDefinitions { get; set; }

View File

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Drawing;
namespace Nikse.SubtitleEdit.Logic.TransportStream
{
@ -11,19 +8,26 @@ namespace Nikse.SubtitleEdit.Logic.TransportStream
public ulong EndMilliseconds { get; set; }
public DvbSubPes Pes { get; set; }
public int? ActiveImageIndex { get; set; }
/// <summary>
/// Get complete bitmap
/// Gets full image if 'ActiveImageIndex' not set, otherwise only gets image by index
/// </summary>
/// <returns></returns>
public Bitmap GetBitmap()
public Bitmap GetActiveImage()
{
return null;
if (ActiveImageIndex.HasValue && ActiveImageIndex.HasValue && ActiveImageIndex >= 0 && ActiveImageIndex < Pes.ObjectDataList.Count)
return (Bitmap)Pes.GetImage(Pes.ObjectDataList[ActiveImageIndex.Value]).Clone();
return Pes.GetImageFull();
}
public List<Bitmap> GetBitmaps()
public int NumberOfImages
{
return null;
}
get
{
return Pes.ObjectDataList.Count;
}
}
}
}