diff --git a/LanguageBaseEnglish.xml b/LanguageBaseEnglish.xml
index b003f9eac..27774c805 100644
--- a/LanguageBaseEnglish.xml
+++ b/LanguageBaseEnglish.xml
@@ -879,6 +879,8 @@ Read more info (web)?
CRF
Tune for
Align right
+ Get start position
+ Get end position
Need dictionaries?
diff --git a/src/ui/Controls/VideoPlayerContainer.cs b/src/ui/Controls/VideoPlayerContainer.cs
index 19cb261cf..abd179f5e 100644
--- a/src/ui/Controls/VideoPlayerContainer.cs
+++ b/src/ui/Controls/VideoPlayerContainer.cs
@@ -4,7 +4,6 @@ using Nikse.SubtitleEdit.Core.SubtitleFormats;
using Nikse.SubtitleEdit.Logic;
using Nikse.SubtitleEdit.Logic.VideoPlayers;
using System;
-using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
@@ -2007,7 +2006,7 @@ namespace Nikse.SubtitleEdit.Controls
RefreshProgressBar();
}
- private bool IsMouseOverControl(Control control, Point cursorLocation)
+ private static bool IsMouseOverControl(Control control, Point cursorLocation)
{
if (control.ClientRectangle.Contains(cursorLocation))
{
@@ -2016,5 +2015,12 @@ namespace Nikse.SubtitleEdit.Controls
return false;
}
+
+ public void SetVolumeAndPlayerNameFont()
+ {
+ _labelVideoPlayerName.Font = new Font(_labelTimeCode.Font.FontFamily, 6);
+ _labelVolume.Font = new Font(_labelTimeCode.Font.FontFamily, 6);
+ _labelVolume.Top -= 2;
+ }
}
}
diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.cs b/src/ui/Forms/GenerateVideoWithHardSubs.cs
index daabef97f..84bc164f3 100644
--- a/src/ui/Forms/GenerateVideoWithHardSubs.cs
+++ b/src/ui/Forms/GenerateVideoWithHardSubs.cs
@@ -1342,7 +1342,7 @@ namespace Nikse.SubtitleEdit.Forms
private void buttonCutFrom_Click(object sender, EventArgs e)
{
var timeSpan = new TimeSpan((int)numericUpDownCutFromHours.Value, (int)numericUpDownCutFromMinutes.Value, (int)numericUpDownCutFromSeconds.Value);
- using (var form = new GetVideoPosition(_assaSubtitle, _inputVideoFileName, timeSpan))
+ using (var form = new GetVideoPosition(_assaSubtitle, _inputVideoFileName, _videoInfo, timeSpan, LanguageSettings.Current.GenerateVideoWithBurnedInSubs.GetStartPosition))
{
if (form.ShowDialog(this) == DialogResult.OK)
{
@@ -1356,7 +1356,7 @@ namespace Nikse.SubtitleEdit.Forms
private void buttonCutTo_Click(object sender, EventArgs e)
{
var timeSpan = new TimeSpan((int)numericUpDownCutFromHours.Value, (int)numericUpDownCutToMinutes.Value, (int)numericUpDownCutFromSeconds.Value);
- using (var form = new GetVideoPosition(_assaSubtitle, _inputVideoFileName, timeSpan))
+ using (var form = new GetVideoPosition(_assaSubtitle, _inputVideoFileName, _videoInfo, timeSpan, LanguageSettings.Current.GenerateVideoWithBurnedInSubs.GetStartPosition))
{
if (form.ShowDialog(this) == DialogResult.OK)
{
diff --git a/src/ui/Forms/GetVideoPosition.Designer.cs b/src/ui/Forms/GetVideoPosition.Designer.cs
index f4311d173..b75bb2173 100644
--- a/src/ui/Forms/GetVideoPosition.Designer.cs
+++ b/src/ui/Forms/GetVideoPosition.Designer.cs
@@ -34,12 +34,10 @@ namespace Nikse.SubtitleEdit.Forms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GetVideoPosition));
this.buttonCancel = new System.Windows.Forms.Button();
this.buttonOK = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.timer1 = new System.Windows.Forms.Timer(this.components);
- this.labelVideoFileName = new System.Windows.Forms.Label();
this.buttonHalfASecondBack = new System.Windows.Forms.Button();
this.buttonThreeSecondsBack = new System.Windows.Forms.Button();
this.buttonThreeSecondsAhead = new System.Windows.Forms.Button();
@@ -53,7 +51,7 @@ namespace Nikse.SubtitleEdit.Forms
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
- this.buttonCancel.Location = new System.Drawing.Point(750, 431);
+ this.buttonCancel.Location = new System.Drawing.Point(838, 574);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(86, 23);
this.buttonCancel.TabIndex = 31;
@@ -65,7 +63,7 @@ namespace Nikse.SubtitleEdit.Forms
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
- this.buttonOK.Location = new System.Drawing.Point(658, 431);
+ this.buttonOK.Location = new System.Drawing.Point(746, 574);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(86, 23);
this.buttonOK.TabIndex = 30;
@@ -82,20 +80,10 @@ namespace Nikse.SubtitleEdit.Forms
this.timer1.Interval = 50;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
- // labelVideoFileName
- //
- this.labelVideoFileName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.labelVideoFileName.AutoSize = true;
- this.labelVideoFileName.Location = new System.Drawing.Point(12, -134);
- this.labelVideoFileName.Name = "labelVideoFileName";
- this.labelVideoFileName.Size = new System.Drawing.Size(98, 13);
- this.labelVideoFileName.TabIndex = 21;
- this.labelVideoFileName.Text = "labelVideoFileName";
- //
// buttonHalfASecondBack
//
this.buttonHalfASecondBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.buttonHalfASecondBack.Location = new System.Drawing.Point(12, 417);
+ this.buttonHalfASecondBack.Location = new System.Drawing.Point(12, 560);
this.buttonHalfASecondBack.Name = "buttonHalfASecondBack";
this.buttonHalfASecondBack.Size = new System.Drawing.Size(77, 23);
this.buttonHalfASecondBack.TabIndex = 20;
@@ -106,7 +94,7 @@ namespace Nikse.SubtitleEdit.Forms
// buttonThreeSecondsBack
//
this.buttonThreeSecondsBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.buttonThreeSecondsBack.Location = new System.Drawing.Point(95, 417);
+ this.buttonThreeSecondsBack.Location = new System.Drawing.Point(95, 560);
this.buttonThreeSecondsBack.Name = "buttonThreeSecondsBack";
this.buttonThreeSecondsBack.Size = new System.Drawing.Size(77, 23);
this.buttonThreeSecondsBack.TabIndex = 21;
@@ -117,7 +105,7 @@ namespace Nikse.SubtitleEdit.Forms
// buttonThreeSecondsAhead
//
this.buttonThreeSecondsAhead.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.buttonThreeSecondsAhead.Location = new System.Drawing.Point(303, 417);
+ this.buttonThreeSecondsAhead.Location = new System.Drawing.Point(303, 560);
this.buttonThreeSecondsAhead.Name = "buttonThreeSecondsAhead";
this.buttonThreeSecondsAhead.Size = new System.Drawing.Size(77, 23);
this.buttonThreeSecondsAhead.TabIndex = 23;
@@ -128,7 +116,7 @@ namespace Nikse.SubtitleEdit.Forms
// buttonHalfASecondAhead
//
this.buttonHalfASecondAhead.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.buttonHalfASecondAhead.Location = new System.Drawing.Point(386, 417);
+ this.buttonHalfASecondAhead.Location = new System.Drawing.Point(386, 560);
this.buttonHalfASecondAhead.Name = "buttonHalfASecondAhead";
this.buttonHalfASecondAhead.Size = new System.Drawing.Size(77, 23);
this.buttonHalfASecondAhead.TabIndex = 24;
@@ -139,7 +127,7 @@ namespace Nikse.SubtitleEdit.Forms
// buttonVerify
//
this.buttonVerify.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.buttonVerify.Location = new System.Drawing.Point(178, 417);
+ this.buttonVerify.Location = new System.Drawing.Point(178, 560);
this.buttonVerify.Name = "buttonVerify";
this.buttonVerify.Size = new System.Drawing.Size(119, 23);
this.buttonVerify.TabIndex = 22;
@@ -154,28 +142,29 @@ namespace Nikse.SubtitleEdit.Forms
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(12, 386);
+ this.labelSubtitle.Location = new System.Drawing.Point(12, 529);
this.labelSubtitle.Name = "labelSubtitle";
- this.labelSubtitle.Size = new System.Drawing.Size(827, 28);
+ this.labelSubtitle.Size = new System.Drawing.Size(915, 28);
this.labelSubtitle.TabIndex = 27;
this.labelSubtitle.Text = "labelSubtitle";
this.labelSubtitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// videoPlayerContainer1
//
- this.videoPlayerContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ this.videoPlayerContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.videoPlayerContainer1.BackColor = System.Drawing.Color.Black;
+ this.videoPlayerContainer1.Chapters = new Nikse.SubtitleEdit.Core.ContainerFormats.Matroska.MatroskaChapter[0];
this.videoPlayerContainer1.CurrentPosition = 0D;
- this.videoPlayerContainer1.Font = new System.Drawing.Font("Tahoma", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.videoPlayerContainer1.FontSizeFactor = 1F;
this.videoPlayerContainer1.LastParagraph = null;
- this.videoPlayerContainer1.Location = new System.Drawing.Point(12, -118);
+ this.videoPlayerContainer1.Location = new System.Drawing.Point(12, 12);
this.videoPlayerContainer1.Name = "videoPlayerContainer1";
this.videoPlayerContainer1.ShowFullscreenButton = true;
this.videoPlayerContainer1.ShowMuteButton = true;
this.videoPlayerContainer1.ShowStopButton = true;
- this.videoPlayerContainer1.Size = new System.Drawing.Size(827, 505);
+ this.videoPlayerContainer1.Size = new System.Drawing.Size(915, 518);
this.videoPlayerContainer1.SubtitleText = "";
this.videoPlayerContainer1.TabIndex = 13;
this.videoPlayerContainer1.TextRightToLeft = System.Windows.Forms.RightToLeft.No;
@@ -189,14 +178,13 @@ namespace Nikse.SubtitleEdit.Forms
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(848, 466);
+ this.ClientSize = new System.Drawing.Size(936, 609);
this.Controls.Add(this.labelSubtitle);
this.Controls.Add(this.buttonVerify);
this.Controls.Add(this.buttonHalfASecondBack);
this.Controls.Add(this.buttonThreeSecondsBack);
this.Controls.Add(this.buttonThreeSecondsAhead);
this.Controls.Add(this.buttonHalfASecondAhead);
- this.Controls.Add(this.labelVideoFileName);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.videoPlayerContainer1);
@@ -215,7 +203,6 @@ namespace Nikse.SubtitleEdit.Forms
this.Shown += new System.EventHandler(this.GetVideoPosition_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GetTime_KeyDown);
this.ResumeLayout(false);
- this.PerformLayout();
}
@@ -226,7 +213,6 @@ namespace Nikse.SubtitleEdit.Forms
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.Timer timer1;
- private System.Windows.Forms.Label labelVideoFileName;
private System.Windows.Forms.Button buttonHalfASecondBack;
private System.Windows.Forms.Button buttonThreeSecondsBack;
private System.Windows.Forms.Button buttonThreeSecondsAhead;
diff --git a/src/ui/Forms/GetVideoPosition.cs b/src/ui/Forms/GetVideoPosition.cs
index 8106b7c73..165d12ecf 100644
--- a/src/ui/Forms/GetVideoPosition.cs
+++ b/src/ui/Forms/GetVideoPosition.cs
@@ -1,4 +1,5 @@
-using Nikse.SubtitleEdit.Core.Common;
+using Nikse.SubtitleEdit.Controls;
+using Nikse.SubtitleEdit.Core.Common;
using Nikse.SubtitleEdit.Core.SubtitleFormats;
using Nikse.SubtitleEdit.Logic;
using Nikse.SubtitleEdit.Logic.VideoPlayers;
@@ -16,10 +17,11 @@ namespace Nikse.SubtitleEdit.Forms
private double _stopPosition = -1.0;
private readonly Subtitle _subtitle;
private readonly string _videoFileName;
+ private VideoInfo _videoInfo;
public string VideoFileName { get; private set; }
public TimeSpan VideoPosition { get; private set; }
- public GetVideoPosition(Subtitle subtitle, string videoFileName, TimeSpan timeSpan)
+ public GetVideoPosition(Subtitle subtitle, string videoFileName, VideoInfo videoInfo, TimeSpan timeSpan, string title)
{
UiUtil.PreInitialize(this);
InitializeComponent();
@@ -36,9 +38,19 @@ namespace Nikse.SubtitleEdit.Forms
_subtitle = subtitle;
_videoFileName = videoFileName;
+ _videoInfo = videoInfo;
VideoPosition = timeSpan;
labelSubtitle.Text = string.Empty;
- labelVideoFileName.Text = LanguageSettings.Current.General.NoVideoLoaded;
+ Text = title;
+
+ AutoSizeWindowRelativeToVideo();
+ }
+
+ private void AutoSizeWindowRelativeToVideo()
+ {
+ var aspectRatio = (double)_videoInfo.Height / _videoInfo.Width;
+ var newHeight = Width * aspectRatio + (Height - videoPlayerContainer1.Bottom + videoPlayerContainer1.Top);
+ Height = (int)newHeight + videoPlayerContainer1.ControlsHeight - 15;
}
private void OpenVideo(string fileName)
@@ -54,7 +66,7 @@ namespace Nikse.SubtitleEdit.Forms
return;
}
- labelVideoFileName.Text = fileName;
+ Text += $" - {fileName}";
VideoFileName = fileName;
if (videoPlayerContainer1.VideoPlayer != null)
{
@@ -63,7 +75,7 @@ namespace Nikse.SubtitleEdit.Forms
}
var videoInfo = UiUtil.GetVideoInfo(fileName);
- UiUtil.InitializeVideoPlayerAndContainer(fileName, videoInfo, videoPlayerContainer1, VideoStartLoaded, VideoStartEnded);
+ UiUtil.InitializeVideoPlayerAndContainer(fileName, videoInfo, videoPlayerContainer1, VideoLoaded, VideoStartEnded);
}
private void VideoStartEnded(object sender, EventArgs e)
@@ -71,7 +83,7 @@ namespace Nikse.SubtitleEdit.Forms
videoPlayerContainer1.Pause();
}
- private void VideoStartLoaded(object sender, EventArgs e)
+ private void VideoLoaded(object sender, EventArgs e)
{
videoPlayerContainer1.Pause();
@@ -83,6 +95,9 @@ namespace Nikse.SubtitleEdit.Forms
}
videoPlayerContainer1.VideoPlayer.CurrentPosition = VideoPosition.TotalSeconds;
+
+ videoPlayerContainer1.UpdatePlayerName();
+
timer1.Start();
}
@@ -237,7 +252,9 @@ namespace Nikse.SubtitleEdit.Forms
if (!string.IsNullOrEmpty(_videoFileName) && File.Exists(_videoFileName))
{
OpenVideo(_videoFileName);
- videoPlayerContainer1.SetSubtitleFont();
+ videoPlayerContainer1.ShowFullscreenButton = false;
+ AutoSizeWindowRelativeToVideo();
+ videoPlayerContainer1.SetVolumeAndPlayerNameFont();
}
}
}
diff --git a/src/ui/Forms/GetVideoPosition.resx b/src/ui/Forms/GetVideoPosition.resx
new file mode 100644
index 000000000..dea6a18d5
--- /dev/null
+++ b/src/ui/Forms/GetVideoPosition.resx
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
+ 157, 17
+
+
\ No newline at end of file
diff --git a/src/ui/Logic/Language.cs b/src/ui/Logic/Language.cs
index 78c2a890c..ccde62413 100644
--- a/src/ui/Logic/Language.cs
+++ b/src/ui/Logic/Language.cs
@@ -1106,6 +1106,8 @@ namespace Nikse.SubtitleEdit.Logic
Crf = "CRF",
TuneFor = "Tune for",
AlignRight = "Align right",
+ GetStartPosition = "Get start position",
+ GetEndPosition = "Get end position",
};
GetDictionaries = new LanguageStructure.GetDictionaries
diff --git a/src/ui/Logic/LanguageDeserializer.cs b/src/ui/Logic/LanguageDeserializer.cs
index ca7863e34..d743cf1a3 100644
--- a/src/ui/Logic/LanguageDeserializer.cs
+++ b/src/ui/Logic/LanguageDeserializer.cs
@@ -2332,6 +2332,12 @@ namespace Nikse.SubtitleEdit.Logic
case "GenerateVideoWithBurnedInSubs/AlignRight":
language.GenerateVideoWithBurnedInSubs.AlignRight = reader.Value;
break;
+ case "GenerateVideoWithBurnedInSubs/GetStartPosition":
+ language.GenerateVideoWithBurnedInSubs.GetStartPosition = reader.Value;
+ break;
+ case "GenerateVideoWithBurnedInSubs/GetEndPosition":
+ language.GenerateVideoWithBurnedInSubs.GetEndPosition = reader.Value;
+ break;
case "GetDictionaries/Title":
language.GetDictionaries.Title = reader.Value;
break;
diff --git a/src/ui/Logic/LanguageStructure.cs b/src/ui/Logic/LanguageStructure.cs
index 24e14d15c..7951976c3 100644
--- a/src/ui/Logic/LanguageStructure.cs
+++ b/src/ui/Logic/LanguageStructure.cs
@@ -966,6 +966,8 @@ namespace Nikse.SubtitleEdit.Logic
public string Crf { get; set; }
public string TuneFor { get; set; }
public string AlignRight { get; set; }
+ public string GetStartPosition { get; set; }
+ public string GetEndPosition { get; set; }
}
public class GetDictionaries
diff --git a/src/ui/SubtitleEdit.csproj b/src/ui/SubtitleEdit.csproj
index d314161a0..5e4a890fd 100644
--- a/src/ui/SubtitleEdit.csproj
+++ b/src/ui/SubtitleEdit.csproj
@@ -1589,6 +1589,9 @@
DownloadVosk.cs
+
+ GetVideoPosition.cs
+
WordSplitDictionaryGenerator.cs