mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-28 23:12:34 +01:00
Add "Adjust time" to image re-export - thx Music Fan :)
This commit is contained in:
parent
c0bd5250cd
commit
f8103bb6f1
73
src/Forms/ExportPngXml.Designer.cs
generated
73
src/Forms/ExportPngXml.Designer.cs
generated
@ -37,6 +37,8 @@
|
||||
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
|
||||
this.progressBar1 = new System.Windows.Forms.ProgressBar();
|
||||
this.groupBoxImageSettings = new System.Windows.Forms.GroupBox();
|
||||
this.labelResize = new System.Windows.Forms.Label();
|
||||
this.comboBoxResizePercentage = new System.Windows.Forms.ComboBox();
|
||||
this.comboBoxBottomMarginUnit = new System.Windows.Forms.ComboBox();
|
||||
this.comboBoxLeftRightMarginUnit = new System.Windows.Forms.ComboBox();
|
||||
this.labelLineHeightStyle = new System.Windows.Forms.Label();
|
||||
@ -93,14 +95,14 @@
|
||||
this.italicToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.boxSingleLineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.boxMultiLineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.adjustTimeCodesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.subtitleListView1 = new System.Windows.Forms.ListView();
|
||||
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.comboBoxResizePercentage = new System.Windows.Forms.ComboBox();
|
||||
this.labelResize = new System.Windows.Forms.Label();
|
||||
this.toolStripSeparatorAdjust = new System.Windows.Forms.ToolStripSeparator();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.groupBoxImageSettings.SuspendLayout();
|
||||
@ -227,6 +229,27 @@
|
||||
this.groupBoxImageSettings.TabStop = false;
|
||||
this.groupBoxImageSettings.Text = "Image settings";
|
||||
//
|
||||
// labelResize
|
||||
//
|
||||
this.labelResize.AutoSize = true;
|
||||
this.labelResize.Location = new System.Drawing.Point(251, 8);
|
||||
this.labelResize.Name = "labelResize";
|
||||
this.labelResize.Size = new System.Drawing.Size(39, 13);
|
||||
this.labelResize.TabIndex = 61;
|
||||
this.labelResize.Text = "Resize";
|
||||
this.labelResize.Visible = false;
|
||||
//
|
||||
// comboBoxResizePercentage
|
||||
//
|
||||
this.comboBoxResizePercentage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxResizePercentage.FormattingEnabled = true;
|
||||
this.comboBoxResizePercentage.Location = new System.Drawing.Point(296, 5);
|
||||
this.comboBoxResizePercentage.Name = "comboBoxResizePercentage";
|
||||
this.comboBoxResizePercentage.Size = new System.Drawing.Size(77, 21);
|
||||
this.comboBoxResizePercentage.TabIndex = 18;
|
||||
this.comboBoxResizePercentage.Visible = false;
|
||||
this.comboBoxResizePercentage.SelectedIndexChanged += new System.EventHandler(this.comboBoxResizePercentage_SelectedIndexChanged);
|
||||
//
|
||||
// comboBoxBottomMarginUnit
|
||||
//
|
||||
this.comboBoxBottomMarginUnit.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
@ -937,38 +960,48 @@
|
||||
this.normalToolStripMenuItem,
|
||||
this.italicToolStripMenuItem,
|
||||
this.boxSingleLineToolStripMenuItem,
|
||||
this.boxMultiLineToolStripMenuItem});
|
||||
this.boxMultiLineToolStripMenuItem,
|
||||
this.toolStripSeparatorAdjust,
|
||||
this.adjustTimeCodesToolStripMenuItem});
|
||||
this.contextMenuStripListView.Name = "contextMenuStripListView";
|
||||
this.contextMenuStripListView.Size = new System.Drawing.Size(158, 92);
|
||||
this.contextMenuStripListView.Size = new System.Drawing.Size(179, 142);
|
||||
this.contextMenuStripListView.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripListView_Opening);
|
||||
//
|
||||
// normalToolStripMenuItem
|
||||
//
|
||||
this.normalToolStripMenuItem.Name = "normalToolStripMenuItem";
|
||||
this.normalToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
|
||||
this.normalToolStripMenuItem.Size = new System.Drawing.Size(178, 22);
|
||||
this.normalToolStripMenuItem.Text = "Normal";
|
||||
this.normalToolStripMenuItem.Click += new System.EventHandler(this.normalToolStripMenuItem_Click);
|
||||
//
|
||||
// italicToolStripMenuItem
|
||||
//
|
||||
this.italicToolStripMenuItem.Name = "italicToolStripMenuItem";
|
||||
this.italicToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
|
||||
this.italicToolStripMenuItem.Size = new System.Drawing.Size(178, 22);
|
||||
this.italicToolStripMenuItem.Text = "Italic";
|
||||
this.italicToolStripMenuItem.Click += new System.EventHandler(this.italicToolStripMenuItem_Click);
|
||||
//
|
||||
// boxSingleLineToolStripMenuItem
|
||||
//
|
||||
this.boxSingleLineToolStripMenuItem.Name = "boxSingleLineToolStripMenuItem";
|
||||
this.boxSingleLineToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
|
||||
this.boxSingleLineToolStripMenuItem.Size = new System.Drawing.Size(178, 22);
|
||||
this.boxSingleLineToolStripMenuItem.Text = "Box - single line";
|
||||
this.boxSingleLineToolStripMenuItem.Click += new System.EventHandler(this.boxSingleLineToolStripMenuItem_Click);
|
||||
//
|
||||
// boxMultiLineToolStripMenuItem
|
||||
//
|
||||
this.boxMultiLineToolStripMenuItem.Name = "boxMultiLineToolStripMenuItem";
|
||||
this.boxMultiLineToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
|
||||
this.boxMultiLineToolStripMenuItem.Size = new System.Drawing.Size(178, 22);
|
||||
this.boxMultiLineToolStripMenuItem.Text = "Box - multi line";
|
||||
this.boxMultiLineToolStripMenuItem.Click += new System.EventHandler(this.boxMultiLineToolStripMenuItem_Click);
|
||||
//
|
||||
// adjustTimeCodesToolStripMenuItem
|
||||
//
|
||||
this.adjustTimeCodesToolStripMenuItem.Name = "adjustTimeCodesToolStripMenuItem";
|
||||
this.adjustTimeCodesToolStripMenuItem.Size = new System.Drawing.Size(178, 22);
|
||||
this.adjustTimeCodesToolStripMenuItem.Text = "Adjust time codes...";
|
||||
this.adjustTimeCodesToolStripMenuItem.Click += new System.EventHandler(this.adjustTimeCodesToolStripMenuItem_Click);
|
||||
//
|
||||
// subtitleListView1
|
||||
//
|
||||
this.subtitleListView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
@ -992,26 +1025,10 @@
|
||||
this.subtitleListView1.SelectedIndexChanged += new System.EventHandler(this.subtitleListView1_SelectedIndexChanged);
|
||||
this.subtitleListView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.subtitleListView1_KeyDown);
|
||||
//
|
||||
// comboBoxResizePercentage
|
||||
// toolStripSeparatorAdjust
|
||||
//
|
||||
this.comboBoxResizePercentage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxResizePercentage.FormattingEnabled = true;
|
||||
this.comboBoxResizePercentage.Location = new System.Drawing.Point(296, 5);
|
||||
this.comboBoxResizePercentage.Name = "comboBoxResizePercentage";
|
||||
this.comboBoxResizePercentage.Size = new System.Drawing.Size(77, 21);
|
||||
this.comboBoxResizePercentage.TabIndex = 18;
|
||||
this.comboBoxResizePercentage.Visible = false;
|
||||
this.comboBoxResizePercentage.SelectedIndexChanged += new System.EventHandler(this.comboBoxResizePercentage_SelectedIndexChanged);
|
||||
//
|
||||
// labelResize
|
||||
//
|
||||
this.labelResize.AutoSize = true;
|
||||
this.labelResize.Location = new System.Drawing.Point(251, 8);
|
||||
this.labelResize.Name = "labelResize";
|
||||
this.labelResize.Size = new System.Drawing.Size(39, 13);
|
||||
this.labelResize.TabIndex = 61;
|
||||
this.labelResize.Text = "Resize";
|
||||
this.labelResize.Visible = false;
|
||||
this.toolStripSeparatorAdjust.Name = "toolStripSeparatorAdjust";
|
||||
this.toolStripSeparatorAdjust.Size = new System.Drawing.Size(175, 6);
|
||||
//
|
||||
// ExportPngXml
|
||||
//
|
||||
@ -1125,5 +1142,7 @@
|
||||
private System.Windows.Forms.ComboBox comboBoxLeftRightMarginUnit;
|
||||
private System.Windows.Forms.ComboBox comboBoxResizePercentage;
|
||||
private System.Windows.Forms.Label labelResize;
|
||||
private System.Windows.Forms.ToolStripMenuItem adjustTimeCodesToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparatorAdjust;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using Nikse.SubtitleEdit.Core;
|
||||
using Nikse.SubtitleEdit.Core.BluRaySup;
|
||||
using Nikse.SubtitleEdit.Core.Enums;
|
||||
using Nikse.SubtitleEdit.Core.SubtitleFormats;
|
||||
using Nikse.SubtitleEdit.Core.VobSub;
|
||||
using Nikse.SubtitleEdit.Forms.Ocr;
|
||||
@ -121,7 +122,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_borderColor = Configuration.Settings.Tools.ExportBorderColor;
|
||||
_boxBorderSize = Configuration.Settings.Tools.ExportBoxBorderSize;
|
||||
_previewTimer.Tick += previewTimer_Tick;
|
||||
_previewTimer.Interval = 100;
|
||||
_previewTimer.Interval = 100;
|
||||
labelLineHeightStyle.Text = string.Empty;
|
||||
}
|
||||
|
||||
@ -1980,7 +1981,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
mbp.AlignLeft = comboBoxHAlign.SelectedIndex == 0;
|
||||
@ -3152,7 +3153,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
|
||||
|
||||
if (parameter.BorderWidth > 0)
|
||||
{
|
||||
var p1 = new Pen(parameter.BorderColor, (float) (parameter.BorderWidth * 1.1));
|
||||
var p1 = new Pen(parameter.BorderColor, (float)(parameter.BorderWidth * 1.1));
|
||||
SetLineJoin(parameter.LineJoin, p1);
|
||||
g.DrawPath(p1, path);
|
||||
p1.Dispose();
|
||||
@ -3371,6 +3372,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
|
||||
italicToolStripMenuItem.Text = Configuration.Settings.Language.General.Italic;
|
||||
boxSingleLineToolStripMenuItem.Text = Configuration.Settings.Language.ExportPngXml.BoxSingleLine;
|
||||
boxMultiLineToolStripMenuItem.Text = Configuration.Settings.Language.ExportPngXml.BoxMultiLine;
|
||||
adjustTimeCodesToolStripMenuItem.Text = Configuration.Settings.Language.Main.Menu.Synchronization.AdjustAllTimes;
|
||||
|
||||
comboBox3D.Items.Clear();
|
||||
comboBox3D.Items.Add(Configuration.Settings.Language.General.None);
|
||||
@ -3746,7 +3748,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
|
||||
SubtitleFontSize = style.FontSize,
|
||||
SubtitleFontBold = style.Bold
|
||||
};
|
||||
var fontSize = (float) TextDraw.GetFontSize(mbp.SubtitleFontSize);
|
||||
var fontSize = (float)TextDraw.GetFontSize(mbp.SubtitleFontSize);
|
||||
Font font = SetFont(mbp, fontSize);
|
||||
SizeF textSize = g.MeasureString("Hj!", font);
|
||||
int lineHeight = (int)Math.Round(textSize.Height * 0.64f);
|
||||
@ -4968,5 +4970,77 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
|
||||
{
|
||||
subtitleListView1_SelectedIndexChanged(null, null);
|
||||
}
|
||||
|
||||
private void adjustTimeCodesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var showEarlierOrLater = new ShowEarlierLater())
|
||||
{
|
||||
showEarlierOrLater.Initialize(ShowEarlierOrLater, false);
|
||||
showEarlierOrLater.ShowDialog(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowEarlierOrLater(double adjustMilliseconds, SelectionChoice selection)
|
||||
{
|
||||
adjustMilliseconds /= TimeCode.BaseUnit;
|
||||
subtitleListView1.BeginUpdate();
|
||||
int startFrom = 0;
|
||||
if (selection == SelectionChoice.SelectionAndForward)
|
||||
{
|
||||
if (subtitleListView1.SelectedItems.Count > 0)
|
||||
startFrom = subtitleListView1.SelectedItems[0].Index;
|
||||
else
|
||||
startFrom = _subtitle.Paragraphs.Count;
|
||||
}
|
||||
for (int i = startFrom; i < _subtitle.Paragraphs.Count; i++)
|
||||
{
|
||||
switch (selection)
|
||||
{
|
||||
case SelectionChoice.SelectionOnly:
|
||||
if (subtitleListView1.Items[i].Selected)
|
||||
{
|
||||
_subtitle.Paragraphs[i].Adjust(1.0, adjustMilliseconds);
|
||||
ShowTimeInListView(i);
|
||||
}
|
||||
break;
|
||||
case SelectionChoice.AllLines:
|
||||
case SelectionChoice.SelectionAndForward:
|
||||
_subtitle.Paragraphs[i].Adjust(1.0, adjustMilliseconds);
|
||||
ShowTimeInListView(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
subtitleListView1.EndUpdate();
|
||||
if (_subtitle.WasLoadedWithFrameNumbers)
|
||||
_subtitle.CalculateFrameNumbersFromTimeCodesNoCheck(Configuration.Settings.General.CurrentFrameRate);
|
||||
}
|
||||
|
||||
private void ShowTimeInListView(int index)
|
||||
{
|
||||
int startIndex = 1;
|
||||
if (subtitleListView1.CheckBoxes)
|
||||
{
|
||||
startIndex++;
|
||||
}
|
||||
subtitleListView1.Items[index].SubItems[startIndex].Text = _subtitle.Paragraphs[index].StartTime.ToDisplayString();
|
||||
subtitleListView1.Items[index].SubItems[startIndex + 1].Text = _subtitle.Paragraphs[index].EndTime.ToDisplayString();
|
||||
subtitleListView1.Items[index].SubItems[startIndex + 2].Text = _subtitle.Paragraphs[index].Duration.ToShortDisplayString();
|
||||
}
|
||||
|
||||
private void contextMenuStripListView_Opening(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
if (_vobSubOcr == null)
|
||||
{
|
||||
toolStripSeparatorAdjust.Visible = false;
|
||||
adjustTimeCodesToolStripMenuItem.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
toolStripSeparatorAdjust.Visible = true;
|
||||
adjustTimeCodesToolStripMenuItem.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -5017,7 +5017,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
bool isItalic = false;
|
||||
bool allItalic = true;
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < matches.Count; i++)
|
||||
{
|
||||
string text = matches[i].Text;
|
||||
@ -8624,7 +8624,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
|
||||
internal void BDNXMLToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ExportToPngXml("BDNXML");
|
||||
ExportToPngXml(ExportPngXml.ExportFormats.BdnXml);
|
||||
}
|
||||
|
||||
private void ExportToPngXml(string exportType)
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Nikse.SubtitleEdit.Core;
|
||||
using Nikse.SubtitleEdit.Core.SubtitleFormats;
|
||||
using Nikse.SubtitleEdit.Core.TransportStream;
|
||||
using Nikse.SubtitleEdit.Forms.Ocr;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
@ -137,44 +138,25 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void BluraySupToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var subtitles = GetSelectedSubtitles();
|
||||
if (subtitles == null)
|
||||
return;
|
||||
|
||||
using (var formSubOcr = new VobSubOcr())
|
||||
{
|
||||
formSubOcr.Initialize(subtitles, Configuration.Settings.VobSubOcr, _fileName);
|
||||
formSubOcr.BluraySupToolStripMenuItem_Click(sender, e);
|
||||
}
|
||||
ExportTo(ExportPngXml.ExportFormats.BluraySup);
|
||||
}
|
||||
|
||||
private void BDNXMLToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var subtitles = GetSelectedSubtitles();
|
||||
if (subtitles == null)
|
||||
return;
|
||||
|
||||
using (var formSubOcr = new VobSubOcr())
|
||||
{
|
||||
formSubOcr.Initialize(subtitles, Configuration.Settings.VobSubOcr, _fileName);
|
||||
formSubOcr.BDNXMLToolStripMenuItem_Click(sender, e);
|
||||
}
|
||||
ExportTo(ExportPngXml.ExportFormats.BdnXml);
|
||||
}
|
||||
|
||||
private void VobSubToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var subtitles = GetSelectedSubtitles();
|
||||
if (subtitles == null)
|
||||
return;
|
||||
|
||||
using (var formSubOcr = new VobSubOcr())
|
||||
{
|
||||
formSubOcr.Initialize(subtitles, Configuration.Settings.VobSubOcr, _fileName);
|
||||
formSubOcr.VobSubToolStripMenuItem_Click(sender, e);
|
||||
}
|
||||
ExportTo(ExportPngXml.ExportFormats.VobSub);
|
||||
}
|
||||
|
||||
private void DOSTToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ExportTo(ExportPngXml.ExportFormats.Dost);
|
||||
}
|
||||
|
||||
private void ExportTo(string exportType)
|
||||
{
|
||||
var subtitles = GetSelectedSubtitles();
|
||||
if (subtitles == null)
|
||||
@ -183,8 +165,13 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
using (var formSubOcr = new VobSubOcr())
|
||||
{
|
||||
formSubOcr.Initialize(subtitles, Configuration.Settings.VobSubOcr, _fileName);
|
||||
formSubOcr.DOSTToolStripMenuItem_Click(sender, e);
|
||||
using (var exportBdnXmlPng = new ExportPngXml())
|
||||
{
|
||||
exportBdnXmlPng.InitializeFromVobSubOcr(formSubOcr.SubtitleFromOcr, new SubRip(), exportType, _fileName, formSubOcr, null);
|
||||
exportBdnXmlPng.ShowDialog(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void SaveAllImagesWithHtmlIndexViewToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
|
Loading…
Reference in New Issue
Block a user