mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-21 18:52:36 +01:00
Do not show save message with text box - thx Pasco :)
This commit is contained in:
parent
9ae93c4d49
commit
dbe07ab735
@ -106,7 +106,8 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
{
|
{
|
||||||
System.Diagnostics.Debug.WriteLine("EbuOptions unable to read existing file: " + fileName + " - " + ex.Message);
|
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)
|
if (title.Length > 32)
|
||||||
{
|
{
|
||||||
title = title.Substring(0, 32).Trim();
|
title = title.Substring(0, 32).Trim();
|
||||||
|
@ -2508,7 +2508,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
promptText = string.Format(_language.SaveChangesToX, _fileName);
|
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)
|
if (dr == DialogResult.Cancel)
|
||||||
{
|
{
|
||||||
|
@ -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)
|
internal static DialogResult Show(Form form, string text, string title, MessageBoxButtons buttons)
|
||||||
{
|
{
|
||||||
using (var msgBox = new MessageBoxForm(text, title, 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)
|
internal static DialogResult Show(string text, string caption)
|
||||||
{
|
{
|
||||||
using (var msgBox = new MessageBoxForm(text, caption, MessageBoxButtons.OK))
|
using (var msgBox = new MessageBoxForm(text, caption, MessageBoxButtons.OK))
|
||||||
|
@ -17,7 +17,13 @@ namespace Nikse.SubtitleEdit.Forms.SeMsgBox
|
|||||||
public MessageBoxForm(string text, string caption, MessageBoxButtons buttons)
|
public MessageBoxForm(string text, string caption, MessageBoxButtons buttons)
|
||||||
{
|
{
|
||||||
var icon = AutoGuessIcon(text, 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)
|
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)
|
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);
|
UiUtil.PreInitialize(this);
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -59,7 +70,7 @@ namespace Nikse.SubtitleEdit.Forms.SeMsgBox
|
|||||||
buttonAbort.Text = LanguageSettings.Current.DvdSubRip.Abort;
|
buttonAbort.Text = LanguageSettings.Current.DvdSubRip.Abort;
|
||||||
|
|
||||||
InitializeIcon(icon);
|
InitializeIcon(icon);
|
||||||
InitializeText(text);
|
InitializeText(text, noTextBox);
|
||||||
InitializeButtons(buttons);
|
InitializeButtons(buttons);
|
||||||
|
|
||||||
UiUtil.FixLargeFonts(this, buttonOK);
|
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)
|
if (text == null)
|
||||||
{
|
{
|
||||||
text = string.Empty;
|
text = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShouldSwitchToTextBox(text))
|
if (!noTextBox && ShouldSwitchToTextBox(text))
|
||||||
{
|
{
|
||||||
seTextBox2.ReadOnly = true;
|
seTextBox2.ReadOnly = true;
|
||||||
seTextBox2.Text = text;
|
seTextBox2.Text = text;
|
||||||
@ -151,7 +162,7 @@ namespace Nikse.SubtitleEdit.Forms.SeMsgBox
|
|||||||
labelText.Text = text;
|
labelText.Text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSwitchToTextBox(string text)
|
private static bool ShouldSwitchToTextBox(string text)
|
||||||
{
|
{
|
||||||
if (text.Length > 500)
|
if (text.Length > 500)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user