mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Show earlier/later + a few minor improvements/fixes
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@185 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
6f0cc104c6
commit
7f284aa267
@ -101,6 +101,8 @@ namespace Nikse.SubtitleEdit.Controls
|
|||||||
public bool DrawGridLines { get; set; }
|
public bool DrawGridLines { get; set; }
|
||||||
public bool AllowNewSelection { get; set; }
|
public bool AllowNewSelection { get; set; }
|
||||||
|
|
||||||
|
public bool Locked { get; set; }
|
||||||
|
|
||||||
public double EndPositionSeconds
|
public double EndPositionSeconds
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -952,19 +954,19 @@ namespace Nikse.SubtitleEdit.Controls
|
|||||||
|
|
||||||
private void WaveForm_KeyDown(object sender, KeyEventArgs e)
|
private void WaveForm_KeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.KeyCode == Keys.Add)
|
if (e.Modifiers == Keys.None && e.KeyCode == Keys.Add)
|
||||||
{
|
{
|
||||||
ZoomFactor = ZoomFactor + 0.1;
|
ZoomFactor = ZoomFactor + 0.1;
|
||||||
if (OnZoomedChanged != null)
|
if (OnZoomedChanged != null)
|
||||||
OnZoomedChanged.Invoke(null, null);
|
OnZoomedChanged.Invoke(null, null);
|
||||||
}
|
}
|
||||||
else if (e.KeyCode == Keys.Subtract)
|
else if (e.Modifiers == Keys.None && e.KeyCode == Keys.Subtract)
|
||||||
{
|
{
|
||||||
ZoomFactor = ZoomFactor - 0.1;
|
ZoomFactor = ZoomFactor - 0.1;
|
||||||
if (OnZoomedChanged != null)
|
if (OnZoomedChanged != null)
|
||||||
OnZoomedChanged.Invoke(null, null);
|
OnZoomedChanged.Invoke(null, null);
|
||||||
}
|
}
|
||||||
else if (e.Control == false && e.KeyCode == Keys.Z)
|
else if (e.Modifiers == Keys.None && e.KeyCode == Keys.Z)
|
||||||
{
|
{
|
||||||
if (StartPositionSeconds > 0.1)
|
if (StartPositionSeconds > 0.1)
|
||||||
{
|
{
|
||||||
@ -974,7 +976,7 @@ namespace Nikse.SubtitleEdit.Controls
|
|||||||
e.SuppressKeyPress = true;
|
e.SuppressKeyPress = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (e.Control == false && e.KeyCode == Keys.X)
|
else if (e.Modifiers == Keys.None && e.KeyCode == Keys.X)
|
||||||
{
|
{
|
||||||
if (StartPositionSeconds + 0.1 < _wavePeaks.Header.LengthInSeconds)
|
if (StartPositionSeconds + 0.1 < _wavePeaks.Header.LengthInSeconds)
|
||||||
{
|
{
|
||||||
@ -983,16 +985,29 @@ namespace Nikse.SubtitleEdit.Controls
|
|||||||
Invalidate();
|
Invalidate();
|
||||||
e.SuppressKeyPress = true;
|
e.SuppressKeyPress = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (e.Modifiers == Keys.Alt && e.KeyCode == Keys.C)
|
||||||
|
{
|
||||||
|
Locked = !Locked;
|
||||||
|
Invalidate();
|
||||||
|
e.SuppressKeyPress = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaveForm_MouseWheel(object sender, MouseEventArgs e)
|
void WaveForm_MouseWheel(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
int delta = e.Delta;
|
int delta = e.Delta;
|
||||||
{
|
{
|
||||||
StartPositionSeconds -= delta / 256.0;
|
if (Locked)
|
||||||
if (_currentVideoPositionSeconds < StartPositionSeconds || _currentVideoPositionSeconds >= EndPositionSeconds)
|
{
|
||||||
OnPositionSelected.Invoke(StartPositionSeconds, null);
|
OnPositionSelected.Invoke(_currentVideoPositionSeconds + (-delta / 256.0), null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StartPositionSeconds -= delta / 256.0;
|
||||||
|
if (_currentVideoPositionSeconds < StartPositionSeconds || _currentVideoPositionSeconds >= EndPositionSeconds)
|
||||||
|
OnPositionSelected.Invoke(StartPositionSeconds, null);
|
||||||
|
}
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
src/Forms/Main.Designer.cs
generated
11
src/Forms/Main.Designer.cs
generated
@ -1219,7 +1219,8 @@
|
|||||||
// toolStripMenuItemAdjustAllTimes
|
// toolStripMenuItemAdjustAllTimes
|
||||||
//
|
//
|
||||||
this.toolStripMenuItemAdjustAllTimes.Name = "toolStripMenuItemAdjustAllTimes";
|
this.toolStripMenuItemAdjustAllTimes.Name = "toolStripMenuItemAdjustAllTimes";
|
||||||
this.toolStripMenuItemAdjustAllTimes.Size = new System.Drawing.Size(276, 22);
|
this.toolStripMenuItemAdjustAllTimes.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
|
||||||
|
this.toolStripMenuItemAdjustAllTimes.Size = new System.Drawing.Size(317, 22);
|
||||||
this.toolStripMenuItemAdjustAllTimes.Text = "Adjust all times (show earlier/later)...";
|
this.toolStripMenuItemAdjustAllTimes.Text = "Adjust all times (show earlier/later)...";
|
||||||
this.toolStripMenuItemAdjustAllTimes.Click += new System.EventHandler(this.toolStripMenuItemAdjustAllTimes_Click);
|
this.toolStripMenuItemAdjustAllTimes.Click += new System.EventHandler(this.toolStripMenuItemAdjustAllTimes_Click);
|
||||||
//
|
//
|
||||||
@ -1228,7 +1229,7 @@
|
|||||||
this.visualSyncToolStripMenuItem.Name = "visualSyncToolStripMenuItem";
|
this.visualSyncToolStripMenuItem.Name = "visualSyncToolStripMenuItem";
|
||||||
this.visualSyncToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
|
this.visualSyncToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
|
||||||
| System.Windows.Forms.Keys.V)));
|
| System.Windows.Forms.Keys.V)));
|
||||||
this.visualSyncToolStripMenuItem.Size = new System.Drawing.Size(276, 22);
|
this.visualSyncToolStripMenuItem.Size = new System.Drawing.Size(317, 22);
|
||||||
this.visualSyncToolStripMenuItem.Text = "Visual sync...";
|
this.visualSyncToolStripMenuItem.Text = "Visual sync...";
|
||||||
this.visualSyncToolStripMenuItem.Click += new System.EventHandler(this.VisualSyncToolStripMenuItemClick);
|
this.visualSyncToolStripMenuItem.Click += new System.EventHandler(this.VisualSyncToolStripMenuItemClick);
|
||||||
//
|
//
|
||||||
@ -1237,7 +1238,7 @@
|
|||||||
this.toolStripMenuItemPointSync.Name = "toolStripMenuItemPointSync";
|
this.toolStripMenuItemPointSync.Name = "toolStripMenuItemPointSync";
|
||||||
this.toolStripMenuItemPointSync.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
|
this.toolStripMenuItemPointSync.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
|
||||||
| System.Windows.Forms.Keys.P)));
|
| System.Windows.Forms.Keys.P)));
|
||||||
this.toolStripMenuItemPointSync.Size = new System.Drawing.Size(276, 22);
|
this.toolStripMenuItemPointSync.Size = new System.Drawing.Size(317, 22);
|
||||||
this.toolStripMenuItemPointSync.Text = "Point sync...";
|
this.toolStripMenuItemPointSync.Text = "Point sync...";
|
||||||
this.toolStripMenuItemPointSync.Click += new System.EventHandler(this.toolStripMenuItemPointSync_Click);
|
this.toolStripMenuItemPointSync.Click += new System.EventHandler(this.toolStripMenuItemPointSync_Click);
|
||||||
//
|
//
|
||||||
@ -1358,14 +1359,14 @@
|
|||||||
//
|
//
|
||||||
this.helpToolStripMenuItem1.Name = "helpToolStripMenuItem1";
|
this.helpToolStripMenuItem1.Name = "helpToolStripMenuItem1";
|
||||||
this.helpToolStripMenuItem1.ShortcutKeys = System.Windows.Forms.Keys.F1;
|
this.helpToolStripMenuItem1.ShortcutKeys = System.Windows.Forms.Keys.F1;
|
||||||
this.helpToolStripMenuItem1.Size = new System.Drawing.Size(152, 22);
|
this.helpToolStripMenuItem1.Size = new System.Drawing.Size(118, 22);
|
||||||
this.helpToolStripMenuItem1.Text = "Help";
|
this.helpToolStripMenuItem1.Text = "Help";
|
||||||
this.helpToolStripMenuItem1.Click += new System.EventHandler(this.HelpToolStripMenuItem1Click);
|
this.helpToolStripMenuItem1.Click += new System.EventHandler(this.HelpToolStripMenuItem1Click);
|
||||||
//
|
//
|
||||||
// aboutToolStripMenuItem
|
// aboutToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
|
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
|
||||||
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(118, 22);
|
||||||
this.aboutToolStripMenuItem.Text = "About";
|
this.aboutToolStripMenuItem.Text = "About";
|
||||||
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.AboutToolStripMenuItemClick);
|
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.AboutToolStripMenuItemClick);
|
||||||
//
|
//
|
||||||
|
@ -11,10 +11,10 @@ using Nikse.SubtitleEdit.Controls;
|
|||||||
using Nikse.SubtitleEdit.Logic;
|
using Nikse.SubtitleEdit.Logic;
|
||||||
using Nikse.SubtitleEdit.Logic.BluRaySup;
|
using Nikse.SubtitleEdit.Logic.BluRaySup;
|
||||||
using Nikse.SubtitleEdit.Logic.Enums;
|
using Nikse.SubtitleEdit.Logic.Enums;
|
||||||
|
using Nikse.SubtitleEdit.Logic.Networking;
|
||||||
using Nikse.SubtitleEdit.Logic.SubtitleFormats;
|
using Nikse.SubtitleEdit.Logic.SubtitleFormats;
|
||||||
using Nikse.SubtitleEdit.Logic.VideoPlayers;
|
using Nikse.SubtitleEdit.Logic.VideoPlayers;
|
||||||
using Nikse.SubtitleEdit.Logic.VobSub;
|
using Nikse.SubtitleEdit.Logic.VobSub;
|
||||||
using Nikse.SubtitleEdit.Logic.Networking;
|
|
||||||
|
|
||||||
namespace Nikse.SubtitleEdit.Forms
|
namespace Nikse.SubtitleEdit.Forms
|
||||||
{
|
{
|
||||||
@ -75,6 +75,8 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
NikseWebServiceSession _networkSession;
|
NikseWebServiceSession _networkSession;
|
||||||
NetworkChat _networkChat = null;
|
NetworkChat _networkChat = null;
|
||||||
|
|
||||||
|
ShowEarlierLater _showEarlierOrLater = null;
|
||||||
|
|
||||||
private bool AutoRepeatContinueOn
|
private bool AutoRepeatContinueOn
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -2675,7 +2677,15 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
textBoxListViewText.Text = string.Empty;
|
textBoxListViewText.Text = string.Empty;
|
||||||
MakeHistoryForUndo(_language.BeforeUndo);
|
MakeHistoryForUndo(_language.BeforeUndo);
|
||||||
string subtitleFormatFriendlyName;
|
string subtitleFormatFriendlyName;
|
||||||
|
|
||||||
|
string oldFileName = _fileName;
|
||||||
|
DateTime oldFileDateTime = _fileDateTime;
|
||||||
|
|
||||||
_fileName = _subtitle.UndoHistory(showHistory.SelectedIndex, out subtitleFormatFriendlyName, out _fileDateTime);
|
_fileName = _subtitle.UndoHistory(showHistory.SelectedIndex, out subtitleFormatFriendlyName, out _fileDateTime);
|
||||||
|
|
||||||
|
if (string.Compare(oldFileName, _fileName, true) == 0)
|
||||||
|
_fileDateTime = oldFileDateTime; // undo will not give overwrite-newer-file warning
|
||||||
|
|
||||||
Text = Title + " - " + _fileName;
|
Text = Title + " - " + _fileName;
|
||||||
ShowStatus(_language.UndoPerformed);
|
ShowStatus(_language.UndoPerformed);
|
||||||
|
|
||||||
@ -3227,7 +3237,10 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
|
|
||||||
private void UpdateListViewTextCharactersPerSeconds(Paragraph paragraph)
|
private void UpdateListViewTextCharactersPerSeconds(Paragraph paragraph)
|
||||||
{
|
{
|
||||||
string s = Utilities.RemoveHtmlTags(paragraph.Text).Replace(" ", string.Empty).Replace(Environment.NewLine, string.Empty);
|
const string zeroWhiteSpace = "\u200B";
|
||||||
|
const string zeroWidthNoBreakSpace = "\uFEFF";
|
||||||
|
|
||||||
|
string s = Utilities.RemoveHtmlTags(paragraph.Text).Replace(" ", string.Empty).Replace(Environment.NewLine, string.Empty).Replace(zeroWhiteSpace, string.Empty).Replace(zeroWidthNoBreakSpace, string.Empty);
|
||||||
if (paragraph.Duration.TotalSeconds > 0)
|
if (paragraph.Duration.TotalSeconds > 0)
|
||||||
{
|
{
|
||||||
double charactersPerSecond = s.Length / paragraph.Duration.TotalSeconds;
|
double charactersPerSecond = s.Length / paragraph.Duration.TotalSeconds;
|
||||||
@ -3360,6 +3373,38 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
{
|
{
|
||||||
e.SuppressKeyPress = true;
|
e.SuppressKeyPress = true;
|
||||||
}
|
}
|
||||||
|
else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.R)
|
||||||
|
{
|
||||||
|
ButtonAutoBreakClick(null, null);
|
||||||
|
e.SuppressKeyPress = true;
|
||||||
|
}
|
||||||
|
else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.R)
|
||||||
|
{
|
||||||
|
ButtonUnBreakClick(null, null);
|
||||||
|
e.SuppressKeyPress = true;
|
||||||
|
}
|
||||||
|
else if (e.Modifiers == Keys.Alt && e.KeyCode == Keys.I)
|
||||||
|
{
|
||||||
|
if (textBoxListViewText.SelectionLength == 0)
|
||||||
|
{
|
||||||
|
string tag = "i";
|
||||||
|
if (textBoxListViewText.Text.Contains("<" + tag + ">"))
|
||||||
|
{
|
||||||
|
textBoxListViewText.Text = textBoxListViewText.Text.Replace("<" + tag + ">", string.Empty);
|
||||||
|
textBoxListViewText.Text = textBoxListViewText.Text.Replace("</" + tag + ">", string.Empty);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
textBoxListViewText.Text = string.Format("<{0}>{1}</{0}>", tag, textBoxListViewText.Text);
|
||||||
|
}
|
||||||
|
//SubtitleListview1.SetText(i, textBoxListViewText.Text);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TextBoxListViewToogleTag("i");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// last key down in text
|
// last key down in text
|
||||||
_lastTextKeyDownTicks = DateTime.Now.Ticks;
|
_lastTextKeyDownTicks = DateTime.Now.Ticks;
|
||||||
@ -3940,7 +3985,21 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
|
|
||||||
SubtitleFormat format;
|
SubtitleFormat format;
|
||||||
|
|
||||||
if (matroskaSubtitleInfo.CodecPrivate.ToLower().Contains("[script info]"))
|
if (matroskaSubtitleInfo.CodecId.ToUpper() == "S_VOBSUB")
|
||||||
|
{
|
||||||
|
MessageBox.Show("VobSub subtitles inside Matroska not supported - sorry!");
|
||||||
|
if (_fileName == "123")
|
||||||
|
LoadVobSubFromMatroska(matroskaSubtitleInfo, fileName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (matroskaSubtitleInfo.CodecId.ToUpper() == "S_HDMV/PGS")
|
||||||
|
{
|
||||||
|
MessageBox.Show("Blu-ray subtitles inside Matroska not supported - sorry!");
|
||||||
|
if (_fileName == "123")
|
||||||
|
LoadBluRaySubFromMatroska(matroskaSubtitleInfo, fileName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (matroskaSubtitleInfo.CodecPrivate.ToLower().Contains("[script info]"))
|
||||||
{
|
{
|
||||||
format = new SubStationAlpha();
|
format = new SubStationAlpha();
|
||||||
isSsa = true;
|
isSsa = true;
|
||||||
@ -3957,7 +4016,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
ShowStatus(_language.ParsingMatroskaFile);
|
ShowStatus(_language.ParsingMatroskaFile);
|
||||||
Refresh();
|
Refresh();
|
||||||
Cursor.Current = Cursors.WaitCursor;
|
Cursor.Current = Cursors.WaitCursor;
|
||||||
Subtitle sub = matroska.GetMatroskaSubtitle(fileName, (int)matroskaSubtitleInfo.TrackNumber, out isValid);
|
List<SubtitleSequence> sub = matroska.GetMatroskaSubtitle(fileName, (int)matroskaSubtitleInfo.TrackNumber, out isValid);
|
||||||
Cursor.Current = Cursors.Default;
|
Cursor.Current = Cursors.Default;
|
||||||
if (isValid)
|
if (isValid)
|
||||||
{
|
{
|
||||||
@ -3970,7 +4029,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
{
|
{
|
||||||
int commaCount = 100;
|
int commaCount = 100;
|
||||||
|
|
||||||
foreach (Paragraph p in sub.Paragraphs)
|
foreach (SubtitleSequence p in sub)
|
||||||
{
|
{
|
||||||
string s1 = p.Text;
|
string s1 = p.Text;
|
||||||
if (s1.Contains(@"{\"))
|
if (s1.Contains(@"{\"))
|
||||||
@ -3980,7 +4039,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
commaCount = temp;
|
commaCount = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Paragraph p in sub.Paragraphs)
|
foreach (SubtitleSequence p in sub)
|
||||||
{
|
{
|
||||||
string s = string.Empty;
|
string s = string.Empty;
|
||||||
string[] arr = p.Text.Split(',');
|
string[] arr = p.Text.Split(',');
|
||||||
@ -3993,15 +4052,14 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
s += arr[i-1];
|
s += arr[i-1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.Text = s;
|
_subtitle.Paragraphs.Add(new Paragraph(s, p.StartMilliseconds, p.EndMilliseconds));
|
||||||
_subtitle.Paragraphs.Add(p);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (Paragraph p in sub.Paragraphs)
|
foreach (SubtitleSequence p in sub)
|
||||||
{
|
{
|
||||||
_subtitle.Paragraphs.Add(p);
|
_subtitle.Paragraphs.Add(new Paragraph(p.Text, p.StartMilliseconds, p.EndMilliseconds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4024,6 +4082,128 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LoadVobSubFromMatroska(MatroskaSubtitleInfo matroskaSubtitleInfo, string fileName)
|
||||||
|
{
|
||||||
|
bool isValid;
|
||||||
|
var matroska = new Matroska();
|
||||||
|
|
||||||
|
ShowStatus(_language.ParsingMatroskaFile);
|
||||||
|
Refresh();
|
||||||
|
Cursor.Current = Cursors.WaitCursor;
|
||||||
|
List<SubtitleSequence> sub = matroska.GetMatroskaSubtitle(fileName, (int)matroskaSubtitleInfo.TrackNumber, out isValid);
|
||||||
|
Cursor.Current = Cursors.Default;
|
||||||
|
|
||||||
|
|
||||||
|
if (isValid)
|
||||||
|
{
|
||||||
|
MakeHistoryForUndo(_language.BeforeImportFromMatroskaFile);
|
||||||
|
_subtitleListViewIndex = -1;
|
||||||
|
|
||||||
|
_subtitle.Paragraphs.Clear();
|
||||||
|
|
||||||
|
List<VobSubMergedPack> mergedVobSubPacks = new List<VobSubMergedPack>();
|
||||||
|
List<VobSubPack> vobSubPacks = new List<VobSubPack>();
|
||||||
|
List<Color> palette = new List<Color>();
|
||||||
|
|
||||||
|
palette = null;
|
||||||
|
foreach (SubtitleSequence p in sub)
|
||||||
|
|
||||||
|
{
|
||||||
|
SubPicture sp = new SubPicture(p.BinaryData);
|
||||||
|
MessageBox.Show(sp.SubPictureDateSize.ToString());
|
||||||
|
MessageBox.Show(sp.ImageDisplayArea.ToString());
|
||||||
|
|
||||||
|
int length = p.BinaryData.Length;
|
||||||
|
if (length > 5000)
|
||||||
|
MessageBox.Show("Large");
|
||||||
|
mergedVobSubPacks.Add(new VobSubMergedPack(p.BinaryData, TimeSpan.FromMilliseconds(p.StartMilliseconds), 32, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
var formSubOcr = new VobSubOcr();
|
||||||
|
formSubOcr.Initialize(mergedVobSubPacks, palette, Configuration.Settings.VobSubOcr);
|
||||||
|
if (formSubOcr.ShowDialog(this) == DialogResult.OK)
|
||||||
|
{
|
||||||
|
MakeHistoryForUndo(_language.BeforeImportingDvdSubtitle);
|
||||||
|
|
||||||
|
_subtitle.Paragraphs.Clear();
|
||||||
|
SetCurrentFormat(new SubRip().FriendlyName);
|
||||||
|
_subtitle.WasLoadedWithFrameNumbers = false;
|
||||||
|
_subtitle.CalculateFrameNumbersFromTimeCodes(CurrentFrameRate);
|
||||||
|
foreach (Paragraph p in formSubOcr.SubtitleFromOcr.Paragraphs)
|
||||||
|
{
|
||||||
|
_subtitle.Paragraphs.Add(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowSource();
|
||||||
|
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
|
||||||
|
_change = true;
|
||||||
|
_subtitleListViewIndex = -1;
|
||||||
|
SubtitleListview1.FirstVisibleIndex = -1;
|
||||||
|
SubtitleListview1.SelectIndexAndEnsureVisible(0);
|
||||||
|
|
||||||
|
_fileName = string.Empty;
|
||||||
|
Text = Title;
|
||||||
|
|
||||||
|
Configuration.Settings.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadBluRaySubFromMatroska(MatroskaSubtitleInfo matroskaSubtitleInfo, string fileName)
|
||||||
|
{
|
||||||
|
bool isValid;
|
||||||
|
var matroska = new Matroska();
|
||||||
|
|
||||||
|
ShowStatus(_language.ParsingMatroskaFile);
|
||||||
|
Refresh();
|
||||||
|
Cursor.Current = Cursors.WaitCursor;
|
||||||
|
List<SubtitleSequence> sub = matroska.GetMatroskaSubtitle(fileName, (int)matroskaSubtitleInfo.TrackNumber, out isValid);
|
||||||
|
Cursor.Current = Cursors.Default;
|
||||||
|
|
||||||
|
|
||||||
|
if (isValid)
|
||||||
|
{
|
||||||
|
MakeHistoryForUndo(_language.BeforeImportFromMatroskaFile);
|
||||||
|
_subtitleListViewIndex = -1;
|
||||||
|
_subtitle.Paragraphs.Clear();
|
||||||
|
|
||||||
|
foreach (SubtitleSequence p in sub)
|
||||||
|
{
|
||||||
|
int length = p.BinaryData.Length;
|
||||||
|
if (length > 5000)
|
||||||
|
MessageBox.Show("Large");
|
||||||
|
}
|
||||||
|
|
||||||
|
var formSubOcr = new VobSubOcr();
|
||||||
|
// formSubOcr.Initialize(mergedVobSubPacks, palette, Configuration.Settings.VobSubOcr);
|
||||||
|
if (formSubOcr.ShowDialog(this) == DialogResult.OK)
|
||||||
|
{
|
||||||
|
MakeHistoryForUndo(_language.BeforeImportingDvdSubtitle);
|
||||||
|
|
||||||
|
_subtitle.Paragraphs.Clear();
|
||||||
|
SetCurrentFormat(new SubRip().FriendlyName);
|
||||||
|
_subtitle.WasLoadedWithFrameNumbers = false;
|
||||||
|
_subtitle.CalculateFrameNumbersFromTimeCodes(CurrentFrameRate);
|
||||||
|
foreach (Paragraph p in formSubOcr.SubtitleFromOcr.Paragraphs)
|
||||||
|
{
|
||||||
|
_subtitle.Paragraphs.Add(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowSource();
|
||||||
|
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
|
||||||
|
_change = true;
|
||||||
|
_subtitleListViewIndex = -1;
|
||||||
|
SubtitleListview1.FirstVisibleIndex = -1;
|
||||||
|
SubtitleListview1.SelectIndexAndEnsureVisible(0);
|
||||||
|
|
||||||
|
_fileName = string.Empty;
|
||||||
|
Text = Title;
|
||||||
|
|
||||||
|
Configuration.Settings.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void SubtitleListview1_DragEnter(object sender, DragEventArgs e)
|
private void SubtitleListview1_DragEnter(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
// make sure they're actually dropping files (not text or anything else)
|
// make sure they're actually dropping files (not text or anything else)
|
||||||
@ -4351,35 +4531,23 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
private void ShowSelectedLinesEarlierlaterToolStripMenuItemClick(object sender, EventArgs e)
|
private void ShowSelectedLinesEarlierlaterToolStripMenuItemClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_subtitle != null && _subtitle.Paragraphs.Count > 1)
|
if (_subtitle != null && _subtitle.Paragraphs.Count > 1)
|
||||||
{
|
{
|
||||||
var showEarlierOrLater = new ShowEarlierLater();
|
bool waveFormEnabled = timerWaveForm.Enabled;
|
||||||
SaveSubtitleListviewIndexes();
|
timerWaveForm.Stop();
|
||||||
|
bool videoTimerEnabled = videoTimer.Enabled;
|
||||||
|
videoTimer.Stop();
|
||||||
|
timer1.Stop();
|
||||||
|
|
||||||
var selectedLines = new Subtitle { WasLoadedWithFrameNumbers = _subtitle.WasLoadedWithFrameNumbers };
|
_showEarlierOrLater = new ShowEarlierLater();
|
||||||
foreach (int index in SubtitleListview1.SelectedIndices)
|
_showEarlierOrLater.Initialize(ShowEarlierOrLaterSelectedLinesOnly, true);
|
||||||
selectedLines.Paragraphs.Add(_subtitle.Paragraphs[index]);
|
MakeHistoryForUndo(_language.BeforeShowSelectedLinesEarlierLater);
|
||||||
showEarlierOrLater.Initialize(selectedLines, _videoFileName);
|
_showEarlierOrLater.ShowDialog(this);
|
||||||
|
|
||||||
if (showEarlierOrLater.ShowDialog(this) == DialogResult.OK)
|
timerWaveForm.Enabled = waveFormEnabled;
|
||||||
{
|
videoTimer.Enabled = videoTimerEnabled;
|
||||||
MakeHistoryForUndo(_language.BeforeShowSelectedLinesEarlierLater);
|
timer1.Start();
|
||||||
|
|
||||||
// we only update selected lines
|
RefreshSelectedParagraph();
|
||||||
int i = 0;
|
|
||||||
double frameRate = CurrentFrameRate;
|
|
||||||
foreach (int index in SubtitleListview1.SelectedIndices)
|
|
||||||
{
|
|
||||||
_subtitle.Paragraphs[index] = new Paragraph(showEarlierOrLater.Paragraphs[i]);
|
|
||||||
if (_subtitle.WasLoadedWithFrameNumbers)
|
|
||||||
_subtitle.Paragraphs[index].CalculateFrameNumbersFromTimeCodes(frameRate);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
ShowStatus(_language.ShowSelectedLinesEarlierLaterPerformed);
|
|
||||||
ShowSource();
|
|
||||||
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
|
|
||||||
RestoreSubtitleListviewIndexes();
|
|
||||||
}
|
|
||||||
showEarlierOrLater.Dispose();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -4670,6 +4838,50 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
e.SuppressKeyPress = true;
|
e.SuppressKeyPress = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (e.Modifiers == (Keys.Control | Keys.Alt | Keys.Shift) && e.KeyCode == Keys.W) // watermak
|
||||||
|
{
|
||||||
|
if (comboBoxEncoding.Text.StartsWith("ANSI - "))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Watermark only works with unicode file encoding");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Watermark watermarkForm = new Watermark();
|
||||||
|
watermarkForm.Initialize(_subtitle, FirstSelectedIndex);
|
||||||
|
if (watermarkForm.ShowDialog(this) == DialogResult.OK)
|
||||||
|
{
|
||||||
|
watermarkForm.AddOrRemove(_subtitle);
|
||||||
|
RefreshSelectedParagraph();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (e.Modifiers == Keys.Shift && e.KeyCode == Keys.Insert)
|
||||||
|
{
|
||||||
|
InsertBefore();
|
||||||
|
e.SuppressKeyPress = true;
|
||||||
|
}
|
||||||
|
else if (e.Modifiers == Keys.Alt && e.KeyCode == Keys.Insert)
|
||||||
|
{
|
||||||
|
InsertAfter();
|
||||||
|
e.SuppressKeyPress = true;
|
||||||
|
}
|
||||||
|
//else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.D)
|
||||||
|
//{
|
||||||
|
// InsertAfter();
|
||||||
|
// e.SuppressKeyPress = true;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//else if (e.Modifiers == Keys.Alt && e.KeyCode == Keys.C)
|
||||||
|
//{
|
||||||
|
// buttonSetStartTime_Click(null, null);
|
||||||
|
// e.SuppressKeyPress = true;
|
||||||
|
//}
|
||||||
|
//else if (e.Modifiers == Keys.None && e.KeyCode == Keys.B)
|
||||||
|
//{
|
||||||
|
// StopAutoDuration();
|
||||||
|
// buttonSetEnd_Click(null, null);
|
||||||
|
// e.SuppressKeyPress = true;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SubtitleListview1_KeyDown(object sender, KeyEventArgs e)
|
private void SubtitleListview1_KeyDown(object sender, KeyEventArgs e)
|
||||||
@ -5352,6 +5564,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
if (File.Exists(peakWaveFileName))
|
if (File.Exists(peakWaveFileName))
|
||||||
{
|
{
|
||||||
AudioWaveForm.WavePeaks = new WavePeakGenerator(peakWaveFileName);
|
AudioWaveForm.WavePeaks = new WavePeakGenerator(peakWaveFileName);
|
||||||
|
toolStripComboBoxWaveForm_SelectedIndexChanged(null, null);
|
||||||
AudioWaveForm.WavePeaks.GenerateAllSamples();
|
AudioWaveForm.WavePeaks.GenerateAllSamples();
|
||||||
AudioWaveForm.WavePeaks.Close();
|
AudioWaveForm.WavePeaks.Close();
|
||||||
|
|
||||||
@ -5887,36 +6100,51 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ShowEarlierOrLater(double adjustMilliseconds)
|
||||||
|
{
|
||||||
|
double frameRate = CurrentFrameRate;
|
||||||
|
_subtitle.AddTimeToAllParagraphs(TimeSpan.FromMilliseconds(adjustMilliseconds));
|
||||||
|
SubtitleListview1.BeginUpdate();
|
||||||
|
for (int i = 0; i < _subtitle.Paragraphs.Count; i++)
|
||||||
|
{
|
||||||
|
Paragraph p = _subtitle.GetParagraphOrDefault(i);
|
||||||
|
if (p != null)
|
||||||
|
SubtitleListview1.SetStartTime(i, p);
|
||||||
|
if (_subtitle.WasLoadedWithFrameNumbers)
|
||||||
|
p.CalculateFrameNumbersFromTimeCodes(frameRate);
|
||||||
|
}
|
||||||
|
SubtitleListview1.EndUpdate();
|
||||||
|
RefreshSelectedParagraph();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowEarlierOrLaterSelectedLinesOnly(double adjustMilliseconds)
|
||||||
|
{
|
||||||
|
double frameRate = CurrentFrameRate;
|
||||||
|
_subtitle.AddTimeToAllParagraphs(TimeSpan.FromMilliseconds(adjustMilliseconds));
|
||||||
|
SubtitleListview1.BeginUpdate();
|
||||||
|
for (int i = 0; i < _subtitle.Paragraphs.Count; i++)
|
||||||
|
{
|
||||||
|
if (SubtitleListview1.Items[i].Selected)
|
||||||
|
{
|
||||||
|
Paragraph p = _subtitle.GetParagraphOrDefault(i);
|
||||||
|
if (p != null)
|
||||||
|
SubtitleListview1.SetStartTime(i, p);
|
||||||
|
if (_subtitle.WasLoadedWithFrameNumbers)
|
||||||
|
p.CalculateFrameNumbersFromTimeCodes(frameRate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SubtitleListview1.EndUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
private void toolStripMenuItemAdjustAllTimes_Click(object sender, EventArgs e)
|
private void toolStripMenuItemAdjustAllTimes_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_subtitle != null && _subtitle.Paragraphs.Count > 1)
|
if (_subtitle != null && _subtitle.Paragraphs.Count > 1)
|
||||||
{
|
{
|
||||||
mediaPlayer.Pause();
|
mediaPlayer.Pause();
|
||||||
var showEarlierOrLater = new ShowEarlierLater();
|
_showEarlierOrLater = new ShowEarlierLater();
|
||||||
SaveSubtitleListviewIndexes();
|
SaveSubtitleListviewIndexes();
|
||||||
|
_showEarlierOrLater.Initialize(ShowEarlierOrLater, false);
|
||||||
showEarlierOrLater.Initialize(_subtitle, _videoFileName);
|
_showEarlierOrLater.Show(this);
|
||||||
|
|
||||||
if (showEarlierOrLater.ShowDialog(this) == DialogResult.OK)
|
|
||||||
{
|
|
||||||
MakeHistoryForUndo(_language.BeforeShowSelectedLinesEarlierLater);
|
|
||||||
|
|
||||||
// we only update selected lines
|
|
||||||
int i = 0;
|
|
||||||
double frameRate = CurrentFrameRate;
|
|
||||||
for (int index = 0; i < _subtitle.Paragraphs.Count; index++)
|
|
||||||
{
|
|
||||||
_subtitle.Paragraphs[index] = new Paragraph(showEarlierOrLater.Paragraphs[i]);
|
|
||||||
if (_subtitle.WasLoadedWithFrameNumbers)
|
|
||||||
_subtitle.Paragraphs[index].CalculateFrameNumbersFromTimeCodes(frameRate);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
ShowStatus(_language.ShowSelectedLinesEarlierLaterPerformed);
|
|
||||||
ShowSource();
|
|
||||||
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
|
|
||||||
RestoreSubtitleListviewIndexes();
|
|
||||||
}
|
|
||||||
showEarlierOrLater.Dispose();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -6385,7 +6613,15 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
int index = -1;
|
int index = -1;
|
||||||
if (SubtitleListview1.SelectedItems.Count > 0)
|
if (SubtitleListview1.SelectedItems.Count > 0)
|
||||||
index = SubtitleListview1.SelectedItems[0].Index;
|
index = SubtitleListview1.SelectedItems[0].Index;
|
||||||
if (mediaPlayer.CurrentPosition > AudioWaveForm.EndPositionSeconds || mediaPlayer.CurrentPosition < AudioWaveForm.StartPositionSeconds)
|
|
||||||
|
if (AudioWaveForm.Locked)
|
||||||
|
{
|
||||||
|
double startPos = mediaPlayer.CurrentPosition - ((AudioWaveForm.EndPositionSeconds - AudioWaveForm.StartPositionSeconds) / 2.0);
|
||||||
|
if (startPos < 0)
|
||||||
|
startPos = 0;
|
||||||
|
AudioWaveForm.SetPosition(startPos, _subtitle, mediaPlayer.CurrentPosition, index);
|
||||||
|
}
|
||||||
|
else if (mediaPlayer.CurrentPosition > AudioWaveForm.EndPositionSeconds || mediaPlayer.CurrentPosition < AudioWaveForm.StartPositionSeconds)
|
||||||
{
|
{
|
||||||
double startPos = mediaPlayer.CurrentPosition - 0.01;
|
double startPos = mediaPlayer.CurrentPosition - 0.01;
|
||||||
if (startPos < 0)
|
if (startPos < 0)
|
||||||
|
@ -95,6 +95,10 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
{
|
{
|
||||||
if (File.Exists(fileName))
|
if (File.Exists(fileName))
|
||||||
{
|
{
|
||||||
|
FileInfo fi = new FileInfo(fileName);
|
||||||
|
if (fi.Length < 1000)
|
||||||
|
return;
|
||||||
|
|
||||||
labelVideoFileName.Text = fileName;
|
labelVideoFileName.Text = fileName;
|
||||||
VideoFileName = fileName;
|
VideoFileName = fileName;
|
||||||
if (videoPlayerContainer1.VideoPlayer != null)
|
if (videoPlayerContainer1.VideoPlayer != null)
|
||||||
|
93
src/Forms/ShowEarlierLater.Designer.cs
generated
93
src/Forms/ShowEarlierLater.Designer.cs
generated
@ -34,12 +34,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
this.labelHoursMinSecsMilliSecs = new System.Windows.Forms.Label();
|
this.labelHoursMinSecsMilliSecs = new System.Windows.Forms.Label();
|
||||||
this.buttonShowLater = new System.Windows.Forms.Button();
|
this.buttonShowLater = new System.Windows.Forms.Button();
|
||||||
this.buttonShowEarlier = new System.Windows.Forms.Button();
|
this.buttonShowEarlier = new System.Windows.Forms.Button();
|
||||||
this.buttonCancel = new System.Windows.Forms.Button();
|
|
||||||
this.buttonOK = new System.Windows.Forms.Button();
|
|
||||||
this.subtitleListView1 = new Nikse.SubtitleEdit.Controls.SubtitleListView();
|
|
||||||
this.labelTotalAdjustment = new System.Windows.Forms.Label();
|
this.labelTotalAdjustment = new System.Windows.Forms.Label();
|
||||||
this.labelSubtitle = new System.Windows.Forms.Label();
|
|
||||||
this.mediaPlayer = new Nikse.SubtitleEdit.Controls.VideoPlayerContainer();
|
|
||||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||||
this.timeUpDownAdjust = new Nikse.SubtitleEdit.Controls.TimeUpDown();
|
this.timeUpDownAdjust = new Nikse.SubtitleEdit.Controls.TimeUpDown();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -47,7 +42,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
// labelHoursMinSecsMilliSecs
|
// labelHoursMinSecsMilliSecs
|
||||||
//
|
//
|
||||||
this.labelHoursMinSecsMilliSecs.AutoSize = true;
|
this.labelHoursMinSecsMilliSecs.AutoSize = true;
|
||||||
this.labelHoursMinSecsMilliSecs.Location = new System.Drawing.Point(11, 383);
|
this.labelHoursMinSecsMilliSecs.Location = new System.Drawing.Point(11, 7);
|
||||||
this.labelHoursMinSecsMilliSecs.Name = "labelHoursMinSecsMilliSecs";
|
this.labelHoursMinSecsMilliSecs.Name = "labelHoursMinSecsMilliSecs";
|
||||||
this.labelHoursMinSecsMilliSecs.Size = new System.Drawing.Size(108, 13);
|
this.labelHoursMinSecsMilliSecs.Size = new System.Drawing.Size(108, 13);
|
||||||
this.labelHoursMinSecsMilliSecs.TabIndex = 18;
|
this.labelHoursMinSecsMilliSecs.TabIndex = 18;
|
||||||
@ -55,7 +50,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
//
|
//
|
||||||
// buttonShowLater
|
// buttonShowLater
|
||||||
//
|
//
|
||||||
this.buttonShowLater.Location = new System.Drawing.Point(14, 456);
|
this.buttonShowLater.Location = new System.Drawing.Point(110, 54);
|
||||||
this.buttonShowLater.Name = "buttonShowLater";
|
this.buttonShowLater.Name = "buttonShowLater";
|
||||||
this.buttonShowLater.Size = new System.Drawing.Size(119, 21);
|
this.buttonShowLater.Size = new System.Drawing.Size(119, 21);
|
||||||
this.buttonShowLater.TabIndex = 20;
|
this.buttonShowLater.TabIndex = 20;
|
||||||
@ -65,7 +60,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
//
|
//
|
||||||
// buttonShowEarlier
|
// buttonShowEarlier
|
||||||
//
|
//
|
||||||
this.buttonShowEarlier.Location = new System.Drawing.Point(14, 429);
|
this.buttonShowEarlier.Location = new System.Drawing.Point(110, 27);
|
||||||
this.buttonShowEarlier.Name = "buttonShowEarlier";
|
this.buttonShowEarlier.Name = "buttonShowEarlier";
|
||||||
this.buttonShowEarlier.Size = new System.Drawing.Size(120, 21);
|
this.buttonShowEarlier.Size = new System.Drawing.Size(120, 21);
|
||||||
this.buttonShowEarlier.TabIndex = 19;
|
this.buttonShowEarlier.TabIndex = 19;
|
||||||
@ -73,102 +68,34 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
this.buttonShowEarlier.UseVisualStyleBackColor = true;
|
this.buttonShowEarlier.UseVisualStyleBackColor = true;
|
||||||
this.buttonShowEarlier.Click += new System.EventHandler(this.ButtonShowEarlierClick);
|
this.buttonShowEarlier.Click += new System.EventHandler(this.ButtonShowEarlierClick);
|
||||||
//
|
//
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
|
||||||
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
|
||||||
this.buttonCancel.Location = new System.Drawing.Point(715, 630);
|
|
||||||
this.buttonCancel.Name = "buttonCancel";
|
|
||||||
this.buttonCancel.Size = new System.Drawing.Size(75, 21);
|
|
||||||
this.buttonCancel.TabIndex = 37;
|
|
||||||
this.buttonCancel.Text = "C&ancel";
|
|
||||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonOK
|
|
||||||
//
|
|
||||||
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
||||||
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
|
||||||
this.buttonOK.Location = new System.Drawing.Point(634, 630);
|
|
||||||
this.buttonOK.Name = "buttonOK";
|
|
||||||
this.buttonOK.Size = new System.Drawing.Size(75, 21);
|
|
||||||
this.buttonOK.TabIndex = 36;
|
|
||||||
this.buttonOK.Text = "&OK";
|
|
||||||
this.buttonOK.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// subtitleListView1
|
|
||||||
//
|
|
||||||
this.subtitleListView1.FirstVisibleIndex = -1;
|
|
||||||
this.subtitleListView1.FullRowSelect = true;
|
|
||||||
this.subtitleListView1.GridLines = true;
|
|
||||||
this.subtitleListView1.HideSelection = false;
|
|
||||||
this.subtitleListView1.Location = new System.Drawing.Point(14, 13);
|
|
||||||
this.subtitleListView1.Name = "subtitleListView1";
|
|
||||||
this.subtitleListView1.Size = new System.Drawing.Size(776, 329);
|
|
||||||
this.subtitleListView1.TabIndex = 35;
|
|
||||||
this.subtitleListView1.UseCompatibleStateImageBehavior = false;
|
|
||||||
this.subtitleListView1.View = System.Windows.Forms.View.Details;
|
|
||||||
this.subtitleListView1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.subtitleListView1_MouseDoubleClick);
|
|
||||||
//
|
|
||||||
// labelTotalAdjustment
|
// labelTotalAdjustment
|
||||||
//
|
//
|
||||||
this.labelTotalAdjustment.AutoSize = true;
|
this.labelTotalAdjustment.AutoSize = true;
|
||||||
this.labelTotalAdjustment.Location = new System.Drawing.Point(11, 348);
|
this.labelTotalAdjustment.Location = new System.Drawing.Point(12, 90);
|
||||||
this.labelTotalAdjustment.Name = "labelTotalAdjustment";
|
this.labelTotalAdjustment.Name = "labelTotalAdjustment";
|
||||||
this.labelTotalAdjustment.Size = new System.Drawing.Size(108, 13);
|
this.labelTotalAdjustment.Size = new System.Drawing.Size(108, 13);
|
||||||
this.labelTotalAdjustment.TabIndex = 38;
|
this.labelTotalAdjustment.TabIndex = 38;
|
||||||
this.labelTotalAdjustment.Text = "labelTotalAdjustment";
|
this.labelTotalAdjustment.Text = "labelTotalAdjustment";
|
||||||
//
|
//
|
||||||
// labelSubtitle
|
|
||||||
//
|
|
||||||
this.labelSubtitle.BackColor = System.Drawing.Color.Black;
|
|
||||||
this.labelSubtitle.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.labelSubtitle.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.labelSubtitle.Location = new System.Drawing.Point(387, 582);
|
|
||||||
this.labelSubtitle.Name = "labelSubtitle";
|
|
||||||
this.labelSubtitle.Size = new System.Drawing.Size(403, 28);
|
|
||||||
this.labelSubtitle.TabIndex = 39;
|
|
||||||
this.labelSubtitle.Text = "labelSubtitle";
|
|
||||||
this.labelSubtitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
//
|
|
||||||
// mediaPlayer
|
|
||||||
//
|
|
||||||
this.mediaPlayer.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18)))));
|
|
||||||
this.mediaPlayer.CurrentPosition = 0D;
|
|
||||||
this.mediaPlayer.Location = new System.Drawing.Point(387, 348);
|
|
||||||
this.mediaPlayer.Name = "mediaPlayer";
|
|
||||||
this.mediaPlayer.ShowStopButton = true;
|
|
||||||
this.mediaPlayer.Size = new System.Drawing.Size(403, 234);
|
|
||||||
this.mediaPlayer.TabIndex = 40;
|
|
||||||
this.mediaPlayer.VideoPlayer = null;
|
|
||||||
this.mediaPlayer.Volume = 0D;
|
|
||||||
//
|
|
||||||
// timer1
|
// timer1
|
||||||
//
|
//
|
||||||
this.timer1.Interval = 250;
|
this.timer1.Interval = 250;
|
||||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
|
||||||
//
|
//
|
||||||
// timeUpDownAdjust
|
// timeUpDownAdjust
|
||||||
//
|
//
|
||||||
this.timeUpDownAdjust.AutoSize = true;
|
this.timeUpDownAdjust.AutoSize = true;
|
||||||
this.timeUpDownAdjust.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
this.timeUpDownAdjust.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||||
this.timeUpDownAdjust.Location = new System.Drawing.Point(12, 399);
|
this.timeUpDownAdjust.Location = new System.Drawing.Point(12, 23);
|
||||||
this.timeUpDownAdjust.Name = "timeUpDownAdjust";
|
this.timeUpDownAdjust.Name = "timeUpDownAdjust";
|
||||||
this.timeUpDownAdjust.Size = new System.Drawing.Size(89, 25);
|
this.timeUpDownAdjust.Size = new System.Drawing.Size(92, 25);
|
||||||
this.timeUpDownAdjust.TabIndex = 21;
|
this.timeUpDownAdjust.TabIndex = 21;
|
||||||
//
|
//
|
||||||
// ShowEarlierLater
|
// ShowEarlierLater
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(804, 663);
|
this.ClientSize = new System.Drawing.Size(243, 113);
|
||||||
this.Controls.Add(this.labelSubtitle);
|
|
||||||
this.Controls.Add(this.mediaPlayer);
|
|
||||||
this.Controls.Add(this.labelTotalAdjustment);
|
this.Controls.Add(this.labelTotalAdjustment);
|
||||||
this.Controls.Add(this.subtitleListView1);
|
|
||||||
this.Controls.Add(this.buttonCancel);
|
|
||||||
this.Controls.Add(this.buttonOK);
|
|
||||||
this.Controls.Add(this.timeUpDownAdjust);
|
this.Controls.Add(this.timeUpDownAdjust);
|
||||||
this.Controls.Add(this.labelHoursMinSecsMilliSecs);
|
this.Controls.Add(this.labelHoursMinSecsMilliSecs);
|
||||||
this.Controls.Add(this.buttonShowLater);
|
this.Controls.Add(this.buttonShowLater);
|
||||||
@ -180,7 +107,6 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
this.Name = "ShowEarlierLater";
|
this.Name = "ShowEarlierLater";
|
||||||
this.Text = "Show selected lines earlier/later";
|
this.Text = "Show selected lines earlier/later";
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ShowEarlierLater_FormClosing);
|
|
||||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ShowEarlierLater_KeyDown);
|
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ShowEarlierLater_KeyDown);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
@ -193,12 +119,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
private System.Windows.Forms.Label labelHoursMinSecsMilliSecs;
|
private System.Windows.Forms.Label labelHoursMinSecsMilliSecs;
|
||||||
private System.Windows.Forms.Button buttonShowLater;
|
private System.Windows.Forms.Button buttonShowLater;
|
||||||
private System.Windows.Forms.Button buttonShowEarlier;
|
private System.Windows.Forms.Button buttonShowEarlier;
|
||||||
private SubtitleListView subtitleListView1;
|
|
||||||
private System.Windows.Forms.Button buttonCancel;
|
|
||||||
private System.Windows.Forms.Button buttonOK;
|
|
||||||
private System.Windows.Forms.Label labelTotalAdjustment;
|
private System.Windows.Forms.Label labelTotalAdjustment;
|
||||||
private System.Windows.Forms.Label labelSubtitle;
|
|
||||||
private VideoPlayerContainer mediaPlayer;
|
|
||||||
private System.Windows.Forms.Timer timer1;
|
private System.Windows.Forms.Timer timer1;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,35 +8,21 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
{
|
{
|
||||||
public sealed partial class ShowEarlierLater : Form
|
public sealed partial class ShowEarlierLater : Form
|
||||||
{
|
{
|
||||||
Subtitle _subtitle;
|
public delegate void AdjustEventHandler(double adjustMilliseconds);
|
||||||
|
|
||||||
TimeSpan _totalAdjustment = TimeSpan.FromMilliseconds(0);
|
TimeSpan _totalAdjustment = TimeSpan.FromMilliseconds(0);
|
||||||
VideoInfo _videoInfo;
|
AdjustEventHandler _adjustCallback;
|
||||||
|
|
||||||
public List<Paragraph> Paragraphs
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _subtitle.Paragraphs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string VideoFileName { get; set; }
|
|
||||||
|
|
||||||
public ShowEarlierLater()
|
public ShowEarlierLater()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
labelTotalAdjustment.Text = string.Empty;
|
labelTotalAdjustment.Text = string.Empty;
|
||||||
timeUpDownAdjust.MaskedTextBox.Text = "000000000";
|
timeUpDownAdjust.MaskedTextBox.Text = "000000000";
|
||||||
labelSubtitle.Text = string.Empty;
|
|
||||||
|
|
||||||
Text = Configuration.Settings.Language.ShowEarlierLater.Title;
|
Text = Configuration.Settings.Language.ShowEarlierLater.Title;
|
||||||
labelHoursMinSecsMilliSecs.Text = Configuration.Settings.Language.General.HourMinutesSecondsMilliseconds;
|
labelHoursMinSecsMilliSecs.Text = Configuration.Settings.Language.General.HourMinutesSecondsMilliseconds;
|
||||||
buttonShowEarlier.Text = Configuration.Settings.Language.ShowEarlierLater.ShowEarlier;
|
buttonShowEarlier.Text = Configuration.Settings.Language.ShowEarlierLater.ShowEarlier;
|
||||||
buttonShowLater.Text = Configuration.Settings.Language.ShowEarlierLater.ShowLater;
|
buttonShowLater.Text = Configuration.Settings.Language.ShowEarlierLater.ShowLater;
|
||||||
buttonOK.Text = Configuration.Settings.Language.General.OK;
|
|
||||||
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
|
|
||||||
|
|
||||||
subtitleListView1.InitializeLanguage(Configuration.Settings.Language.General, Configuration.Settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowEarlierLater_KeyDown(object sender, KeyEventArgs e)
|
private void ShowEarlierLater_KeyDown(object sender, KeyEventArgs e)
|
||||||
@ -45,93 +31,17 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
{
|
{
|
||||||
DialogResult = DialogResult.Cancel;
|
DialogResult = DialogResult.Cancel;
|
||||||
}
|
}
|
||||||
else if (e.KeyCode == Keys.Right && e.Modifiers == Keys.Control)
|
|
||||||
{
|
|
||||||
mediaPlayer.CurrentPosition += 0.10;
|
|
||||||
e.SuppressKeyPress = true;
|
|
||||||
}
|
|
||||||
else if (e.KeyCode == Keys.Left && e.Modifiers == Keys.Control)
|
|
||||||
{
|
|
||||||
mediaPlayer.CurrentPosition -= 0.10;
|
|
||||||
e.SuppressKeyPress = true;
|
|
||||||
}
|
|
||||||
else if (e.KeyCode == Keys.Right && e.Modifiers == Keys.Alt)
|
|
||||||
{
|
|
||||||
if (mediaPlayer.VideoPlayer != null)
|
|
||||||
{
|
|
||||||
mediaPlayer.CurrentPosition += 0.5;
|
|
||||||
e.SuppressKeyPress = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (e.KeyCode == Keys.Left && e.Modifiers == Keys.Alt)
|
|
||||||
{
|
|
||||||
if (mediaPlayer.VideoPlayer != null)
|
|
||||||
{
|
|
||||||
mediaPlayer.CurrentPosition -= 0.5;
|
|
||||||
e.SuppressKeyPress = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (e.Modifiers == Keys.None && e.KeyCode == Keys.Space)
|
|
||||||
{
|
|
||||||
mediaPlayer.TooglePlayPause();
|
|
||||||
e.SuppressKeyPress = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Initialize(Subtitle subtitle, string videoFileName)
|
internal void Initialize(AdjustEventHandler adjustCallback, bool onlySelected)
|
||||||
{
|
{
|
||||||
_subtitle = subtitle;
|
if (onlySelected)
|
||||||
subtitleListView1.Fill(subtitle);
|
Text = Configuration.Settings.Language.ShowEarlierLater.Title;
|
||||||
|
|
||||||
timeUpDownAdjust.TimeCode = new TimeCode(TimeSpan.FromMilliseconds(Configuration.Settings.General.DefaultAdjustMilliseconds));
|
|
||||||
|
|
||||||
VideoFileName = videoFileName;
|
|
||||||
OpenVideo(videoFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OpenVideo(string fileName)
|
|
||||||
{
|
|
||||||
if (File.Exists(fileName))
|
|
||||||
{
|
|
||||||
FileInfo fi = new FileInfo(fileName);
|
|
||||||
if (fi.Length < 1000)
|
|
||||||
return;
|
|
||||||
|
|
||||||
VideoFileName = fileName;
|
|
||||||
if (mediaPlayer.VideoPlayer != null)
|
|
||||||
{
|
|
||||||
mediaPlayer.Pause();
|
|
||||||
mediaPlayer.VideoPlayer.DisposeVideoPlayer();
|
|
||||||
}
|
|
||||||
VideoInfo videoInfo = ShowVideoInfo(fileName);
|
|
||||||
Utilities.InitializeVideoPlayerAndContainer(fileName, videoInfo, mediaPlayer, VideoLoaded, VideoEnded);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
Text = Configuration.Settings.Language.ShowEarlierLater.TitleAll;
|
||||||
Height = buttonShowLater.Top + buttonShowLater.Height + 40;
|
|
||||||
mediaPlayer.Visible = false;
|
|
||||||
labelSubtitle.Visible = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private VideoInfo ShowVideoInfo(string fileName)
|
_adjustCallback = adjustCallback;
|
||||||
{
|
timeUpDownAdjust.TimeCode = new TimeCode(TimeSpan.FromMilliseconds(Configuration.Settings.General.DefaultAdjustMilliseconds));
|
||||||
_videoInfo = Utilities.GetVideoInfo(fileName, delegate { Application.DoEvents(); });
|
|
||||||
var info = new FileInfo(fileName);
|
|
||||||
long fileSizeInBytes = info.Length;
|
|
||||||
return _videoInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void VideoLoaded(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
mediaPlayer.Stop();
|
|
||||||
timer1.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VideoEnded(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
mediaPlayer.Pause();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonShowEarlierClick(object sender, EventArgs e)
|
private void ButtonShowEarlierClick(object sender, EventArgs e)
|
||||||
@ -139,10 +49,10 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
TimeCode tc = timeUpDownAdjust.TimeCode;
|
TimeCode tc = timeUpDownAdjust.TimeCode;
|
||||||
if (tc != null && tc.TotalMilliseconds > 0)
|
if (tc != null && tc.TotalMilliseconds > 0)
|
||||||
{
|
{
|
||||||
|
_adjustCallback.Invoke(-tc.TotalMilliseconds);
|
||||||
_totalAdjustment = TimeSpan.FromMilliseconds(_totalAdjustment.TotalMilliseconds - tc.TotalMilliseconds);
|
_totalAdjustment = TimeSpan.FromMilliseconds(_totalAdjustment.TotalMilliseconds - tc.TotalMilliseconds);
|
||||||
ShowTotalAdjustMent();
|
ShowTotalAdjustMent();
|
||||||
_subtitle.AddTimeToAllParagraphs(-tc.TimeSpan);
|
Configuration.Settings.General.DefaultAdjustMilliseconds = (int)tc.TotalMilliseconds;
|
||||||
subtitleListView1.Fill(_subtitle);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,47 +67,10 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
TimeCode tc = timeUpDownAdjust.TimeCode;
|
TimeCode tc = timeUpDownAdjust.TimeCode;
|
||||||
if (tc != null && tc.TotalMilliseconds > 0)
|
if (tc != null && tc.TotalMilliseconds > 0)
|
||||||
{
|
{
|
||||||
|
_adjustCallback.Invoke(tc.TotalMilliseconds);
|
||||||
_totalAdjustment = TimeSpan.FromMilliseconds(_totalAdjustment.TotalMilliseconds + tc.TotalMilliseconds);
|
_totalAdjustment = TimeSpan.FromMilliseconds(_totalAdjustment.TotalMilliseconds + tc.TotalMilliseconds);
|
||||||
ShowTotalAdjustMent();
|
ShowTotalAdjustMent();
|
||||||
_subtitle.AddTimeToAllParagraphs(tc.TimeSpan);
|
Configuration.Settings.General.DefaultAdjustMilliseconds = (int)tc.TotalMilliseconds;
|
||||||
subtitleListView1.Fill(_subtitle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void timer1_Tick(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (mediaPlayer != null && mediaPlayer.VideoPlayer != null)
|
|
||||||
{
|
|
||||||
if (!mediaPlayer.IsPaused)
|
|
||||||
{
|
|
||||||
mediaPlayer.RefreshProgressBar();
|
|
||||||
int index = Utilities.ShowSubtitle(_subtitle.Paragraphs, labelSubtitle, mediaPlayer.VideoPlayer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void subtitleListView1_MouseDoubleClick(object sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
if (subtitleListView1.SelectedItems.Count > 0 && VideoFileName != null)
|
|
||||||
{
|
|
||||||
int index = subtitleListView1.SelectedItems[0].Index;
|
|
||||||
|
|
||||||
mediaPlayer.Pause();
|
|
||||||
double pos = _subtitle.Paragraphs[index].StartTime.TotalSeconds;
|
|
||||||
if (pos > 1)
|
|
||||||
mediaPlayer.CurrentPosition = (_subtitle.Paragraphs[index].StartTime.TotalSeconds) - 0.5;
|
|
||||||
else
|
|
||||||
mediaPlayer.CurrentPosition = _subtitle.Paragraphs[index].StartTime.TotalSeconds;
|
|
||||||
mediaPlayer.Play();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ShowEarlierLater_FormClosing(object sender, FormClosingEventArgs e)
|
|
||||||
{
|
|
||||||
if (mediaPlayer.VideoPlayer != null)
|
|
||||||
{
|
|
||||||
mediaPlayer.VideoPlayer.Pause();
|
|
||||||
mediaPlayer.VideoPlayer.DisposeVideoPlayer();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,6 +114,10 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
{
|
{
|
||||||
VideoFileName = fileName;
|
VideoFileName = fileName;
|
||||||
|
|
||||||
|
FileInfo fi = new FileInfo(fileName);
|
||||||
|
if (fi.Length < 1000)
|
||||||
|
return;
|
||||||
|
|
||||||
if (MediaPlayerStart.VideoPlayer != null)
|
if (MediaPlayerStart.VideoPlayer != null)
|
||||||
{
|
{
|
||||||
MediaPlayerStart.Pause();
|
MediaPlayerStart.Pause();
|
||||||
|
158
src/Forms/Watermark.Designer.cs
generated
Normal file
158
src/Forms/Watermark.Designer.cs
generated
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
namespace Nikse.SubtitleEdit.Forms
|
||||||
|
{
|
||||||
|
partial class Watermark
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.LabelWatermark = new System.Windows.Forms.Label();
|
||||||
|
this.groupBoxGenerate = new System.Windows.Forms.GroupBox();
|
||||||
|
this.textBoxWatermark = new System.Windows.Forms.TextBox();
|
||||||
|
this.radioButtonSpread = new System.Windows.Forms.RadioButton();
|
||||||
|
this.radioButtonCurrentLine = new System.Windows.Forms.RadioButton();
|
||||||
|
this.buttonGenerate = new System.Windows.Forms.Button();
|
||||||
|
this.buttonRemove = new System.Windows.Forms.Button();
|
||||||
|
this.buttonOK = new System.Windows.Forms.Button();
|
||||||
|
this.groupBoxGenerate.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// LabelWatermark
|
||||||
|
//
|
||||||
|
this.LabelWatermark.AutoSize = true;
|
||||||
|
this.LabelWatermark.Location = new System.Drawing.Point(4, 19);
|
||||||
|
this.LabelWatermark.Name = "LabelWatermark";
|
||||||
|
this.LabelWatermark.Size = new System.Drawing.Size(62, 13);
|
||||||
|
this.LabelWatermark.TabIndex = 0;
|
||||||
|
this.LabelWatermark.Text = "Watermark:";
|
||||||
|
//
|
||||||
|
// groupBoxGenerate
|
||||||
|
//
|
||||||
|
this.groupBoxGenerate.Controls.Add(this.textBoxWatermark);
|
||||||
|
this.groupBoxGenerate.Controls.Add(this.radioButtonSpread);
|
||||||
|
this.groupBoxGenerate.Controls.Add(this.radioButtonCurrentLine);
|
||||||
|
this.groupBoxGenerate.Controls.Add(this.buttonGenerate);
|
||||||
|
this.groupBoxGenerate.Location = new System.Drawing.Point(7, 69);
|
||||||
|
this.groupBoxGenerate.Name = "groupBoxGenerate";
|
||||||
|
this.groupBoxGenerate.Size = new System.Drawing.Size(344, 100);
|
||||||
|
this.groupBoxGenerate.TabIndex = 1;
|
||||||
|
this.groupBoxGenerate.TabStop = false;
|
||||||
|
this.groupBoxGenerate.Text = "Generate watermark";
|
||||||
|
//
|
||||||
|
// textBoxWatermark
|
||||||
|
//
|
||||||
|
this.textBoxWatermark.Location = new System.Drawing.Point(87, 68);
|
||||||
|
this.textBoxWatermark.MaxLength = 50;
|
||||||
|
this.textBoxWatermark.Name = "textBoxWatermark";
|
||||||
|
this.textBoxWatermark.Size = new System.Drawing.Size(195, 20);
|
||||||
|
this.textBoxWatermark.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// radioButtonSpread
|
||||||
|
//
|
||||||
|
this.radioButtonSpread.AutoSize = true;
|
||||||
|
this.radioButtonSpread.Checked = true;
|
||||||
|
this.radioButtonSpread.Location = new System.Drawing.Point(6, 19);
|
||||||
|
this.radioButtonSpread.Name = "radioButtonSpread";
|
||||||
|
this.radioButtonSpread.Size = new System.Drawing.Size(148, 17);
|
||||||
|
this.radioButtonSpread.TabIndex = 2;
|
||||||
|
this.radioButtonSpread.TabStop = true;
|
||||||
|
this.radioButtonSpread.Text = "Spread over entire subtitle";
|
||||||
|
this.radioButtonSpread.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// radioButtonCurrentLine
|
||||||
|
//
|
||||||
|
this.radioButtonCurrentLine.AutoSize = true;
|
||||||
|
this.radioButtonCurrentLine.Location = new System.Drawing.Point(6, 42);
|
||||||
|
this.radioButtonCurrentLine.Name = "radioButtonCurrentLine";
|
||||||
|
this.radioButtonCurrentLine.Size = new System.Drawing.Size(122, 17);
|
||||||
|
this.radioButtonCurrentLine.TabIndex = 1;
|
||||||
|
this.radioButtonCurrentLine.Text = "Only on current line: ";
|
||||||
|
this.radioButtonCurrentLine.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// buttonGenerate
|
||||||
|
//
|
||||||
|
this.buttonGenerate.Location = new System.Drawing.Point(6, 65);
|
||||||
|
this.buttonGenerate.Name = "buttonGenerate";
|
||||||
|
this.buttonGenerate.Size = new System.Drawing.Size(75, 21);
|
||||||
|
this.buttonGenerate.TabIndex = 0;
|
||||||
|
this.buttonGenerate.Text = "Generate";
|
||||||
|
this.buttonGenerate.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonGenerate.Click += new System.EventHandler(this.buttonGenerate_Click);
|
||||||
|
//
|
||||||
|
// buttonRemove
|
||||||
|
//
|
||||||
|
this.buttonRemove.Location = new System.Drawing.Point(7, 38);
|
||||||
|
this.buttonRemove.Name = "buttonRemove";
|
||||||
|
this.buttonRemove.Size = new System.Drawing.Size(75, 21);
|
||||||
|
this.buttonRemove.TabIndex = 0;
|
||||||
|
this.buttonRemove.Text = "Remove";
|
||||||
|
this.buttonRemove.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click);
|
||||||
|
//
|
||||||
|
// buttonOK
|
||||||
|
//
|
||||||
|
this.buttonOK.Location = new System.Drawing.Point(276, 175);
|
||||||
|
this.buttonOK.Name = "buttonOK";
|
||||||
|
this.buttonOK.Size = new System.Drawing.Size(75, 21);
|
||||||
|
this.buttonOK.TabIndex = 1;
|
||||||
|
this.buttonOK.Text = "&OK";
|
||||||
|
this.buttonOK.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
|
||||||
|
//
|
||||||
|
// Watermark
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(356, 202);
|
||||||
|
this.Controls.Add(this.buttonOK);
|
||||||
|
this.Controls.Add(this.buttonRemove);
|
||||||
|
this.Controls.Add(this.groupBoxGenerate);
|
||||||
|
this.Controls.Add(this.LabelWatermark);
|
||||||
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||||
|
this.KeyPreview = true;
|
||||||
|
this.MaximizeBox = false;
|
||||||
|
this.MinimizeBox = false;
|
||||||
|
this.Name = "Watermark";
|
||||||
|
this.Text = "Watermark";
|
||||||
|
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Watermark_KeyDown);
|
||||||
|
this.groupBoxGenerate.ResumeLayout(false);
|
||||||
|
this.groupBoxGenerate.PerformLayout();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Label LabelWatermark;
|
||||||
|
private System.Windows.Forms.GroupBox groupBoxGenerate;
|
||||||
|
private System.Windows.Forms.RadioButton radioButtonSpread;
|
||||||
|
private System.Windows.Forms.RadioButton radioButtonCurrentLine;
|
||||||
|
private System.Windows.Forms.Button buttonGenerate;
|
||||||
|
private System.Windows.Forms.Button buttonRemove;
|
||||||
|
private System.Windows.Forms.Button buttonOK;
|
||||||
|
private System.Windows.Forms.TextBox textBoxWatermark;
|
||||||
|
}
|
||||||
|
}
|
169
src/Forms/Watermark.cs
Normal file
169
src/Forms/Watermark.cs
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Nikse.SubtitleEdit.Logic;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Nikse.SubtitleEdit.Forms
|
||||||
|
{
|
||||||
|
public sealed partial class Watermark : Form
|
||||||
|
{
|
||||||
|
const string zeroWhiteSpace = "\u200B";
|
||||||
|
const string zeroWidthNoBreakSpace = "\uFEFF";
|
||||||
|
|
||||||
|
int _firstSelectedIndex;
|
||||||
|
|
||||||
|
public Watermark()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void Initialize(Logic.Subtitle subtitle, int firstSelectedIndex)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
foreach (Paragraph p in subtitle.Paragraphs)
|
||||||
|
sb.AppendLine(p.Text);
|
||||||
|
|
||||||
|
string watermark = ReadWaterMark(sb.ToString().Trim());
|
||||||
|
LabelWatermark.Text = string.Format("Watermark: {0}", watermark);
|
||||||
|
if (watermark.Length == 0)
|
||||||
|
{
|
||||||
|
buttonRemove.Enabled = false;
|
||||||
|
textBoxWatermark.Focus();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
groupBoxGenerate.Enabled = false;
|
||||||
|
buttonOK.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
_firstSelectedIndex = firstSelectedIndex;
|
||||||
|
Paragraph current = subtitle.GetParagraphOrDefault(_firstSelectedIndex);
|
||||||
|
if (current != null)
|
||||||
|
radioButtonCurrentLine.Text = radioButtonCurrentLine.Text + " " + current.Text.Replace(Environment.NewLine, Configuration.Settings.General.ListViewLineSeparatorString);
|
||||||
|
else
|
||||||
|
radioButtonCurrentLine.Enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string ReadWaterMark(string input)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
bool letterOn = false;
|
||||||
|
int letter = 0;
|
||||||
|
while (i < input.Length)
|
||||||
|
{
|
||||||
|
string s = input.Substring(i, 1);
|
||||||
|
if (s == zeroWhiteSpace)
|
||||||
|
{
|
||||||
|
if (letter > 0)
|
||||||
|
sb.Append(Encoding.ASCII.GetString(new byte[] { (byte)letter }));
|
||||||
|
letterOn = true;
|
||||||
|
letter = 0;
|
||||||
|
}
|
||||||
|
else if (s == zeroWidthNoBreakSpace && letterOn)
|
||||||
|
{
|
||||||
|
letter++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (letter > 0)
|
||||||
|
sb.Append(Encoding.ASCII.GetString(new byte[] { (byte)letter }));
|
||||||
|
letterOn = false;
|
||||||
|
letter = 0;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddWaterMark(Subtitle subtitle, string input)
|
||||||
|
{
|
||||||
|
byte[] buffer = Encoding.ASCII.GetBytes(input);
|
||||||
|
|
||||||
|
if (radioButtonCurrentLine.Checked)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
foreach (byte b in buffer)
|
||||||
|
{
|
||||||
|
sb.Append(zeroWhiteSpace);
|
||||||
|
for (int i = 0; i < b; i++)
|
||||||
|
sb.Append(zeroWidthNoBreakSpace);
|
||||||
|
}
|
||||||
|
Paragraph p = subtitle.GetParagraphOrDefault(_firstSelectedIndex);
|
||||||
|
if (p != null)
|
||||||
|
{
|
||||||
|
if (p.Text.Length > 1)
|
||||||
|
p.Text = p.Text.Insert(p.Text.Length / 2, sb.ToString());
|
||||||
|
else
|
||||||
|
p.Text = sb.ToString() + p.Text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Random r = new Random();
|
||||||
|
List<int> indices = new List<int>();
|
||||||
|
foreach (byte b in buffer)
|
||||||
|
{
|
||||||
|
int number = r.Next(subtitle.Paragraphs.Count - 1);
|
||||||
|
if (indices.Contains(number))
|
||||||
|
number = r.Next(subtitle.Paragraphs.Count - 1);
|
||||||
|
if (indices.Contains(number))
|
||||||
|
number = r.Next(subtitle.Paragraphs.Count - 1);
|
||||||
|
indices.Add(number);
|
||||||
|
}
|
||||||
|
|
||||||
|
indices.Sort();
|
||||||
|
int j = 0;
|
||||||
|
foreach (byte b in buffer)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
Paragraph p = subtitle.Paragraphs[indices[j]];
|
||||||
|
sb.Append(zeroWhiteSpace);
|
||||||
|
for (int i = 0; i < b; i++)
|
||||||
|
sb.Append(zeroWidthNoBreakSpace);
|
||||||
|
if (p.Text.Length > 1)
|
||||||
|
p.Text = p.Text.Insert(p.Text.Length / 2, sb.ToString());
|
||||||
|
else
|
||||||
|
p.Text = sb.ToString() + p.Text;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonOK_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void AddOrRemove(Subtitle subtitle)
|
||||||
|
{
|
||||||
|
if (groupBoxGenerate.Enabled)
|
||||||
|
AddWaterMark(subtitle, textBoxWatermark.Text);
|
||||||
|
else
|
||||||
|
RemoveWaterMark(subtitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RemoveWaterMark(Subtitle subtitle)
|
||||||
|
{
|
||||||
|
foreach (Paragraph p in subtitle.Paragraphs)
|
||||||
|
p.Text = p.Text.Replace(zeroWhiteSpace, string.Empty).Replace(zeroWidthNoBreakSpace, string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonGenerate_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonRemove_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Watermark_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.KeyCode == Keys.Escape)
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
src/Forms/Watermark.resx
Normal file
120
src/Forms/Watermark.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -1069,6 +1069,7 @@ namespace Nikse.SubtitleEdit.Logic
|
|||||||
ShowEarlierLater = new LanguageStructure.ShowEarlierLater
|
ShowEarlierLater = new LanguageStructure.ShowEarlierLater
|
||||||
{
|
{
|
||||||
Title = "Show selected lines earlier/later",
|
Title = "Show selected lines earlier/later",
|
||||||
|
TitleAll = "Show all lines earlier/later",
|
||||||
ShowEarlier = "Show earlier",
|
ShowEarlier = "Show earlier",
|
||||||
ShowLater = "Show later",
|
ShowLater = "Show later",
|
||||||
TotalAdjustmentX = "Total adjustment: {0}",
|
TotalAdjustmentX = "Total adjustment: {0}",
|
||||||
|
@ -1006,6 +1006,7 @@
|
|||||||
public class ShowEarlierLater
|
public class ShowEarlierLater
|
||||||
{
|
{
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
public string TitleAll { get; set; }
|
||||||
public string ShowEarlier { get; set; }
|
public string ShowEarlier { get; set; }
|
||||||
public string ShowLater { get; set; }
|
public string ShowLater { get; set; }
|
||||||
public string TotalAdjustmentX { get; set; }
|
public string TotalAdjustmentX { get; set; }
|
||||||
|
@ -4,6 +4,30 @@ using System.IO;
|
|||||||
|
|
||||||
namespace Nikse.SubtitleEdit.Logic
|
namespace Nikse.SubtitleEdit.Logic
|
||||||
{
|
{
|
||||||
|
public class SubtitleSequence
|
||||||
|
{
|
||||||
|
public long StartMilliseconds { get; set; }
|
||||||
|
public long EndMilliseconds { get; set; }
|
||||||
|
public byte[] BinaryData { get; set; }
|
||||||
|
|
||||||
|
public SubtitleSequence(byte[] data, long startMilliseconds, long endMilliseconds)
|
||||||
|
{
|
||||||
|
BinaryData = data;
|
||||||
|
StartMilliseconds = startMilliseconds;
|
||||||
|
EndMilliseconds = endMilliseconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Text
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (BinaryData != null)
|
||||||
|
return System.Text.Encoding.UTF8.GetString(BinaryData).Replace("\\N", Environment.NewLine);
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class MatroskaSubtitleInfo
|
public class MatroskaSubtitleInfo
|
||||||
{
|
{
|
||||||
public long TrackNumber { get; set; }
|
public long TrackNumber { get; set; }
|
||||||
@ -92,7 +116,8 @@ namespace Nikse.SubtitleEdit.Logic
|
|||||||
|
|
||||||
List<MatroskaSubtitleInfo> _subtitleList;
|
List<MatroskaSubtitleInfo> _subtitleList;
|
||||||
int _subtitleRipTrackNumber = 0;
|
int _subtitleRipTrackNumber = 0;
|
||||||
Subtitle _subtitleRip = new Subtitle();
|
List<SubtitleSequence> _subtitleRip = new List<SubtitleSequence>();
|
||||||
|
//Subtitle _subtitleRip = new Subtitle();
|
||||||
|
|
||||||
|
|
||||||
private static int GetMatroskaVariableIntLength(byte b)
|
private static int GetMatroskaVariableIntLength(byte b)
|
||||||
@ -953,16 +978,17 @@ namespace Nikse.SubtitleEdit.Logic
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// save subtitle data
|
// save subtitle data
|
||||||
if (trackNo == _subtitleRipTrackNumber)
|
if (trackNo == _subtitleRipTrackNumber)
|
||||||
{
|
{
|
||||||
long sublength = afterPosition - f.Position;
|
long sublength = afterPosition - f.Position;
|
||||||
if (sublength > 0)
|
if (sublength > 0)
|
||||||
{
|
{
|
||||||
string s = GetMatroskaString(sublength);
|
byte[] buffer = new byte[sublength];
|
||||||
s = s.Replace("\\N", Environment.NewLine);
|
f.Read(buffer, 0, (int)sublength);
|
||||||
|
|
||||||
|
//string s = GetMatroskaString(sublength);
|
||||||
|
//s = s.Replace("\\N", Environment.NewLine);
|
||||||
|
|
||||||
f.Seek(afterPosition, SeekOrigin.Begin);
|
f.Seek(afterPosition, SeekOrigin.Begin);
|
||||||
b = (byte)f.ReadByte();
|
b = (byte)f.ReadByte();
|
||||||
@ -974,7 +1000,7 @@ namespace Nikse.SubtitleEdit.Logic
|
|||||||
duration = GetMatroskaVariableSizeUnsignedInt(dataSize);
|
duration = GetMatroskaVariableSizeUnsignedInt(dataSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
_subtitleRip.Paragraphs.Add(new Paragraph(s, timeCode + clusterTimeCode, timeCode + clusterTimeCode + duration));
|
_subtitleRip.Add(new SubtitleSequence(buffer, timeCode + clusterTimeCode, timeCode + clusterTimeCode + duration));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1061,7 +1087,7 @@ namespace Nikse.SubtitleEdit.Logic
|
|||||||
return _subtitleList;
|
return _subtitleList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Subtitle GetMatroskaSubtitle(string fileName, int trackNumber, out bool isValid)
|
public List<SubtitleSequence> GetMatroskaSubtitle(string fileName, int trackNumber, out bool isValid)
|
||||||
{
|
{
|
||||||
byte b;
|
byte b;
|
||||||
bool done;
|
bool done;
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
<ApplicationRevision>3</ApplicationRevision>
|
<ApplicationRevision>3</ApplicationRevision>
|
||||||
<ApplicationVersion>2.0.1.%2a</ApplicationVersion>
|
<ApplicationVersion>2.0.1.%2a</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
|
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
@ -76,7 +77,10 @@
|
|||||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||||
<HintPath>DLLs\Interop.QuartzTypeLib.dll</HintPath>
|
<HintPath>DLLs\Interop.QuartzTypeLib.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="NHunspell, Version=0.6.3.0, Culture=neutral, processorArchitecture=MSIL" />
|
<Reference Include="NHunspell, Version=0.9.6.0, Culture=neutral, PublicKeyToken=1ac793ea843b4366, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>DLLs\NHunspell.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
@ -393,6 +397,12 @@
|
|||||||
<Compile Include="Forms\VobSubOcrNewFolder.Designer.cs">
|
<Compile Include="Forms\VobSubOcrNewFolder.Designer.cs">
|
||||||
<DependentUpon>VobSubOcrNewFolder.cs</DependentUpon>
|
<DependentUpon>VobSubOcrNewFolder.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Forms\Watermark.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Forms\Watermark.Designer.cs">
|
||||||
|
<DependentUpon>Watermark.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Logic\BluRaySup\BluRaySupPalette.cs" />
|
<Compile Include="Logic\BluRaySup\BluRaySupPalette.cs" />
|
||||||
<Compile Include="Logic\BluRaySup\BluRaySupParser.cs" />
|
<Compile Include="Logic\BluRaySup\BluRaySupParser.cs" />
|
||||||
<Compile Include="Logic\BluRaySup\BluRaySupPicture.cs" />
|
<Compile Include="Logic\BluRaySup\BluRaySupPicture.cs" />
|
||||||
@ -688,6 +698,9 @@
|
|||||||
<DependentUpon>VobSubOcrNewFolder.cs</DependentUpon>
|
<DependentUpon>VobSubOcrNewFolder.cs</DependentUpon>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Forms\Watermark.resx">
|
||||||
|
<DependentUpon>Watermark.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
Loading…
Reference in New Issue
Block a user