diff --git a/src/ui/Forms/EbuSaveOptions.cs b/src/ui/Forms/EbuSaveOptions.cs index 669413236..ed7ae51bd 100644 --- a/src/ui/Forms/EbuSaveOptions.cs +++ b/src/ui/Forms/EbuSaveOptions.cs @@ -106,7 +106,8 @@ namespace Nikse.SubtitleEdit.Forms { System.Diagnostics.Debug.WriteLine("EbuOptions unable to read existing file: " + fileName + " - " + ex.Message); } - string title = Path.GetFileNameWithoutExtension(fileName); + + var title = Path.GetFileNameWithoutExtension(fileName); if (title.Length > 32) { title = title.Substring(0, 32).Trim(); diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index b1d812638..da4bf7ece 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -2508,7 +2508,7 @@ namespace Nikse.SubtitleEdit.Forms promptText = string.Format(_language.SaveChangesToX, _fileName); } - var dr = MessageBox.Show(this, promptText, Title, MessageBoxButtons.YesNoCancel); + var dr = MessageBox.Show(this, promptText, Title, MessageBoxButtons.YesNoCancel, true); if (dr == DialogResult.Cancel) { diff --git a/src/ui/Forms/SeMsgBox/MessageBox.cs b/src/ui/Forms/SeMsgBox/MessageBox.cs index 8249f1016..5ccfd1934 100644 --- a/src/ui/Forms/SeMsgBox/MessageBox.cs +++ b/src/ui/Forms/SeMsgBox/MessageBox.cs @@ -52,6 +52,14 @@ namespace Nikse.SubtitleEdit.Forms.SeMsgBox } } + public static DialogResult Show(Form form, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, bool noTextBox) + { + using (var msgBox = new MessageBoxForm(text, caption, buttons, icon)) + { + return msgBox.ShowDialog(form); + } + } + internal static DialogResult Show(Form form, string text, string title, MessageBoxButtons buttons) { using (var msgBox = new MessageBoxForm(text, title, buttons)) @@ -60,6 +68,15 @@ namespace Nikse.SubtitleEdit.Forms.SeMsgBox } } + internal static DialogResult Show(Form form, string text, string title, MessageBoxButtons buttons, bool noTextBox) + { + using (var msgBox = new MessageBoxForm(text, title, buttons, noTextBox)) + { + return msgBox.ShowDialog(form); + } + } + + internal static DialogResult Show(string text, string caption) { using (var msgBox = new MessageBoxForm(text, caption, MessageBoxButtons.OK)) diff --git a/src/ui/Forms/SeMsgBox/MessageBoxForm.cs b/src/ui/Forms/SeMsgBox/MessageBoxForm.cs index 0faf9d82b..cb6db87ac 100644 --- a/src/ui/Forms/SeMsgBox/MessageBoxForm.cs +++ b/src/ui/Forms/SeMsgBox/MessageBoxForm.cs @@ -17,7 +17,13 @@ namespace Nikse.SubtitleEdit.Forms.SeMsgBox public MessageBoxForm(string text, string caption, MessageBoxButtons buttons) { var icon = AutoGuessIcon(text, buttons); - Init(text, caption, buttons, icon); + Init(text, caption, buttons, icon, false); + } + + public MessageBoxForm(string text, string caption, MessageBoxButtons buttons, bool noTextBox) + { + var icon = AutoGuessIcon(text, buttons); + Init(text, caption, buttons, icon, noTextBox); } private static MessageBoxIcon AutoGuessIcon(string text, MessageBoxButtons buttons) @@ -37,10 +43,15 @@ namespace Nikse.SubtitleEdit.Forms.SeMsgBox public MessageBoxForm(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) { - Init(text, caption, buttons, icon); + Init(text, caption, buttons, icon, false); } - private void Init(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) + public MessageBoxForm(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, bool noTextBox) + { + Init(text, caption, buttons, icon, noTextBox); + } + + private void Init(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, bool noTextBox) { UiUtil.PreInitialize(this); InitializeComponent(); @@ -59,7 +70,7 @@ namespace Nikse.SubtitleEdit.Forms.SeMsgBox buttonAbort.Text = LanguageSettings.Current.DvdSubRip.Abort; InitializeIcon(icon); - InitializeText(text); + InitializeText(text, noTextBox); InitializeButtons(buttons); UiUtil.FixLargeFonts(this, buttonOK); @@ -121,14 +132,14 @@ namespace Nikse.SubtitleEdit.Forms.SeMsgBox } } - private void InitializeText(string text) + private void InitializeText(string text, bool noTextBox) { if (text == null) { text = string.Empty; } - if (ShouldSwitchToTextBox(text)) + if (!noTextBox && ShouldSwitchToTextBox(text)) { seTextBox2.ReadOnly = true; seTextBox2.Text = text; @@ -151,7 +162,7 @@ namespace Nikse.SubtitleEdit.Forms.SeMsgBox labelText.Text = text; } - private bool ShouldSwitchToTextBox(string text) + private static bool ShouldSwitchToTextBox(string text) { if (text.Length > 500) {