Minor UI adjustments for generate video

This commit is contained in:
niksedk 2021-08-23 16:13:00 +02:00
parent bfdf7dc065
commit 17afb5c964
3 changed files with 15 additions and 5 deletions

View File

@ -74,20 +74,19 @@ namespace Nikse.SubtitleEdit.Forms
private void buttonOK_Click(object sender, EventArgs e) private void buttonOK_Click(object sender, EventArgs e)
{ {
buttonOK.Enabled = false; EnableDisableControls(false);
var fileName = radioButtonColor.Checked ? "blank_video_solid" : "blank_video_checkered"; var fileName = radioButtonColor.Checked ? "blank_video_solid" : "blank_video_checkered";
using (var saveDialog = new SaveFileDialog { FileName = fileName, Filter = "MP4|*.mp4|Matroska|*.mkv|WebM|*.webm" }) using (var saveDialog = new SaveFileDialog { FileName = fileName, Filter = "MP4|*.mp4|Matroska|*.mkv|WebM|*.webm" })
{ {
if (saveDialog.ShowDialog(this) != DialogResult.OK) if (saveDialog.ShowDialog(this) != DialogResult.OK)
{ {
buttonOK.Enabled = true; EnableDisableControls(true);
return; return;
} }
VideoFileName = saveDialog.FileName; VideoFileName = saveDialog.FileName;
} }
buttonOK.Enabled = true;
if (File.Exists(VideoFileName)) if (File.Exists(VideoFileName))
{ {
File.Delete(VideoFileName); File.Delete(VideoFileName);
@ -122,6 +121,16 @@ namespace Nikse.SubtitleEdit.Forms
DialogResult = _abort ? DialogResult.Cancel : DialogResult.OK; DialogResult = _abort ? DialogResult.Cancel : DialogResult.OK;
} }
private void EnableDisableControls(bool enable)
{
buttonOK.Enabled = enable;
numericUpDownDurationMinutes.Enabled = enable;
numericUpDownWidth.Enabled = enable;
numericUpDownHeight.Enabled = enable;
comboBoxFrameRate.Enabled = enable;
groupBoxBackground.Enabled = enable;
}
private void buttonColor_Click(object sender, EventArgs e) private void buttonColor_Click(object sender, EventArgs e)
{ {
using (var colorChooser = new ColorChooser { Color = panelColor.BackColor, ShowAlpha = false }) using (var colorChooser = new ColorChooser { Color = panelColor.BackColor, ShowAlpha = false })

View File

@ -54,18 +54,19 @@ namespace Nikse.SubtitleEdit.Forms
private void buttonOK_Click(object sender, EventArgs e) private void buttonOK_Click(object sender, EventArgs e)
{ {
buttonOK.Enabled = false; buttonOK.Enabled = false;
numericUpDownFontSize.Enabled = false;
using (var saveDialog = new SaveFileDialog { FileName = string.Empty, Filter = "MP4|*.mp4|Matroska|*.mkv|WebM|*.webm" }) using (var saveDialog = new SaveFileDialog { FileName = string.Empty, Filter = "MP4|*.mp4|Matroska|*.mkv|WebM|*.webm" })
{ {
if (saveDialog.ShowDialog(this) != DialogResult.OK) if (saveDialog.ShowDialog(this) != DialogResult.OK)
{ {
buttonOK.Enabled = true; buttonOK.Enabled = true;
numericUpDownFontSize.Enabled = true;
return; return;
} }
VideoFileName = saveDialog.FileName; VideoFileName = saveDialog.FileName;
} }
buttonOK.Enabled = true;
if (File.Exists(VideoFileName)) if (File.Exists(VideoFileName))
{ {
File.Delete(VideoFileName); File.Delete(VideoFileName);

View File

@ -31541,7 +31541,7 @@ namespace Nikse.SubtitleEdit.Forms
var sub = new Subtitle(_subtitle, false); var sub = new Subtitle(_subtitle, false);
int? fontSize = null; int? fontSize = null;
if (string.IsNullOrEmpty(sub.Header)) if (string.IsNullOrEmpty(sub.Header) || !IsAssa())
{ {
sub.Header = AdvancedSubStationAlpha.DefaultHeader; sub.Header = AdvancedSubStationAlpha.DefaultHeader;
var style = AdvancedSubStationAlpha.GetSsaStyle("Default", sub.Header); var style = AdvancedSubStationAlpha.GetSsaStyle("Default", sub.Header);