diff --git a/src/ui/Forms/AudioToText.cs b/src/ui/Forms/AudioToText.cs index c1ade6bc7..2f92901f5 100644 --- a/src/ui/Forms/AudioToText.cs +++ b/src/ui/Forms/AudioToText.cs @@ -12,6 +12,7 @@ using System.Text; using System.Windows.Forms; using Nikse.SubtitleEdit.Core.SubtitleFormats; using Vosk; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace Nikse.SubtitleEdit.Forms { @@ -134,9 +135,7 @@ namespace Nikse.SubtitleEdit.Forms return; } - progressBar1.Maximum = 100; - progressBar1.Value = 0; - progressBar1.Visible = true; + ShowProgressBar(); var modelFileName = Path.Combine(_voskFolder, comboBoxModels.Text); buttonGenerate.Enabled = false; buttonDownload.Enabled = false; @@ -161,6 +160,16 @@ namespace Nikse.SubtitleEdit.Forms DialogResult = DialogResult.OK; } + private void ShowProgressBar() + { + progressBar1.Maximum = 100; + progressBar1.Value = 0; + progressBar1.Visible = true; + progressBar1.BringToFront(); + progressBar1.Refresh(); + progressBar1.Top = labelProgress.Bottom + 3; + } + private void GenerateBatch() { groupBoxInputFiles.Enabled = false; @@ -172,9 +181,7 @@ namespace Nikse.SubtitleEdit.Forms var videoFileName = lvi.Text; listViewInputFiles.SelectedIndices.Clear(); lvi.Selected = true; - progressBar1.Maximum = 100; - progressBar1.Value = 0; - progressBar1.Visible = true; + ShowProgressBar(); var modelFileName = Path.Combine(_voskFolder, comboBoxModels.Text); buttonGenerate.Enabled = false; buttonDownload.Enabled = false; @@ -361,8 +368,8 @@ namespace Nikse.SubtitleEdit.Forms _filesToDelete.Add(outWaveFile); var process = GetFfmpegProcess(videoFileName, audioTrackNumber, outWaveFile); process.Start(); + ShowProgressBar(); progressBar1.Style = ProgressBarStyle.Marquee; - progressBar1.Visible = true; double seconds = 0; buttonCancel.Visible = true; try diff --git a/src/ui/Forms/AudioToTextSelectedLines.cs b/src/ui/Forms/AudioToTextSelectedLines.cs index b16cd2815..6acf3d217 100644 --- a/src/ui/Forms/AudioToTextSelectedLines.cs +++ b/src/ui/Forms/AudioToTextSelectedLines.cs @@ -106,6 +106,16 @@ namespace Nikse.SubtitleEdit.Forms TaskbarList.SetProgressState(_parentForm.Handle, TaskbarButtonProgressFlags.NoProgress); } + private void ShowProgressBar() + { + progressBar1.Maximum = 100; + progressBar1.Value = 0; + progressBar1.Visible = true; + progressBar1.BringToFront(); + progressBar1.Refresh(); + progressBar1.Top = labelProgress.Bottom + 3; + } + private void GenerateBatch() { groupBoxInputFiles.Enabled = false; @@ -116,7 +126,7 @@ namespace Nikse.SubtitleEdit.Forms ParagraphMaxChars = Configuration.Settings.General.SubtitleLineMaximumLength * 2, }; - progressBar1.Visible = true; + ShowProgressBar(); foreach (ListViewItem lvi in listViewInputFiles.Items) { _batchFileNumber++;