Move Start/StopSound calls from InputPrompt to callers
This commit is contained in:
parent
2295d47192
commit
cc4acd9c64
|
@ -193,13 +193,15 @@ namespace BizHawk.Client.EmuHawk.ToolExtensions
|
||||||
var settingsItem = new ToolStripMenuItem { Text = "&Recent Settings..." };
|
var settingsItem = new ToolStripMenuItem { Text = "&Recent Settings..." };
|
||||||
settingsItem.Click += (o, ev) =>
|
settingsItem.Click += (o, ev) =>
|
||||||
{
|
{
|
||||||
using var prompt = new InputPrompt(mainForm)
|
using var prompt = new InputPrompt
|
||||||
{
|
{
|
||||||
TextInputType = InputPrompt.InputType.Unsigned,
|
TextInputType = InputPrompt.InputType.Unsigned,
|
||||||
Message = "Number of recent files to track",
|
Message = "Number of recent files to track",
|
||||||
InitialValue = recent.MAX_RECENT_FILES.ToString()
|
InitialValue = recent.MAX_RECENT_FILES.ToString()
|
||||||
};
|
};
|
||||||
|
mainForm.StopSound();
|
||||||
var result = prompt.ShowDialog();
|
var result = prompt.ShowDialog();
|
||||||
|
mainForm.StartSound();
|
||||||
if (result == DialogResult.OK)
|
if (result == DialogResult.OK)
|
||||||
{
|
{
|
||||||
int val = int.Parse(prompt.PromptText);
|
int val = int.Parse(prompt.PromptText);
|
||||||
|
|
|
@ -1598,14 +1598,16 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void GoToAddressMenuItem_Click(object sender, EventArgs e)
|
private void GoToAddressMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using var inputPrompt = new InputPrompt(MainForm)
|
using var inputPrompt = new InputPrompt
|
||||||
{
|
{
|
||||||
Text = "Go to Address",
|
Text = "Go to Address",
|
||||||
StartLocation = this.ChildPointToScreen(MemoryViewerBox),
|
StartLocation = this.ChildPointToScreen(MemoryViewerBox),
|
||||||
Message = "Enter a hexadecimal value"
|
Message = "Enter a hexadecimal value"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MainForm.StopSound();
|
||||||
var result = inputPrompt.ShowHawkDialog(this);
|
var result = inputPrompt.ShowHawkDialog(this);
|
||||||
|
MainForm.StartSound();
|
||||||
|
|
||||||
if (result == DialogResult.OK && inputPrompt.PromptText.IsHex())
|
if (result == DialogResult.OK && inputPrompt.PromptText.IsHex())
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,12 +13,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class InputPrompt : Form
|
public partial class InputPrompt : Form
|
||||||
{
|
{
|
||||||
private readonly IMainFormForTools _mainForm;
|
public InputPrompt()
|
||||||
|
|
||||||
public InputPrompt(IMainFormForTools mainForm)
|
|
||||||
{
|
{
|
||||||
_mainForm = mainForm;
|
|
||||||
_mainForm.StopSound();
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
StartLocation = new Point(-1, -1);
|
StartLocation = new Point(-1, -1);
|
||||||
}
|
}
|
||||||
|
@ -58,14 +54,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
Close();
|
Close();
|
||||||
_mainForm.StartSound();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Cancel_Click(object sender, EventArgs e)
|
private void Cancel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
DialogResult = DialogResult.Cancel;
|
DialogResult = DialogResult.Cancel;
|
||||||
Close();
|
Close();
|
||||||
_mainForm.StartSound();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PromptBox_KeyPress(object sender, KeyPressEventArgs e)
|
private void PromptBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||||
|
|
|
@ -566,7 +566,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var i = new InputPrompt(MainForm)
|
var i = new InputPrompt
|
||||||
{
|
{
|
||||||
Text = $"Text for branch {index}",
|
Text = $"Text for branch {index}",
|
||||||
TextInputType = InputPrompt.InputType.Text,
|
TextInputType = InputPrompt.InputType.Text,
|
||||||
|
@ -577,7 +577,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
var point = Cursor.Position;
|
var point = Cursor.Position;
|
||||||
point.Offset(i.Width / -2, i.Height / -2);
|
point.Offset(i.Width / -2, i.Height / -2);
|
||||||
|
|
||||||
|
MainForm.StopSound();
|
||||||
var result = i.ShowHawkDialog(this, position: point);
|
var result = i.ShowHawkDialog(this, position: point);
|
||||||
|
MainForm.StartSound();
|
||||||
if (result.IsOk())
|
if (result.IsOk())
|
||||||
{
|
{
|
||||||
branch.UserText = i.PromptText;
|
branch.UserText = i.PromptText;
|
||||||
|
|
|
@ -182,7 +182,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
TasMovieMarker marker;
|
TasMovieMarker marker;
|
||||||
if (editText)
|
if (editText)
|
||||||
{
|
{
|
||||||
var i = new InputPrompt(Tastudio.MainForm)
|
var i = new InputPrompt
|
||||||
{
|
{
|
||||||
Text = $"Marker for frame {frame}",
|
Text = $"Marker for frame {frame}",
|
||||||
TextInputType = InputPrompt.InputType.Text,
|
TextInputType = InputPrompt.InputType.Text,
|
||||||
|
@ -196,7 +196,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
var point = Cursor.Position;
|
var point = Cursor.Position;
|
||||||
point.Offset(i.Width / -2, i.Height / -2);
|
point.Offset(i.Width / -2, i.Height / -2);
|
||||||
|
|
||||||
|
Tastudio.MainForm.StopSound();
|
||||||
var result = i.ShowHawkDialog(this, position: point);
|
var result = i.ShowHawkDialog(this, position: point);
|
||||||
|
Tastudio.MainForm.StartSound();
|
||||||
if (!result.IsOk())
|
if (!result.IsOk())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -234,7 +236,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
var markerFrame = marker.Frame;
|
var markerFrame = marker.Frame;
|
||||||
var point = default(Point);
|
var point = default(Point);
|
||||||
var i = new InputPrompt(Tastudio.MainForm)
|
var i = new InputPrompt
|
||||||
{
|
{
|
||||||
Text = $"Marker for frame {markerFrame}",
|
Text = $"Marker for frame {markerFrame}",
|
||||||
TextInputType = InputPrompt.InputType.Text,
|
TextInputType = InputPrompt.InputType.Text,
|
||||||
|
@ -251,7 +253,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
point.Offset(i.Width / -2, i.Height / -2);
|
point.Offset(i.Width / -2, i.Height / -2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Tastudio.MainForm.StopSound();
|
||||||
var result = i.ShowHawkDialog(this, position: point);
|
var result = i.ShowHawkDialog(this, position: point);
|
||||||
|
Tastudio.MainForm.StartSound();
|
||||||
|
|
||||||
if (result == DialogResult.OK)
|
if (result == DialogResult.OK)
|
||||||
{
|
{
|
||||||
|
|
|
@ -822,14 +822,17 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void SetMaxUndoLevelsMenuItem_Click(object sender, EventArgs e)
|
private void SetMaxUndoLevelsMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using var prompt = new InputPrompt(MainForm)
|
using var prompt = new InputPrompt
|
||||||
{
|
{
|
||||||
TextInputType = InputPrompt.InputType.Unsigned,
|
TextInputType = InputPrompt.InputType.Unsigned,
|
||||||
Message = "Number of Undo Levels to keep",
|
Message = "Number of Undo Levels to keep",
|
||||||
InitialValue = CurrentTasMovie.ChangeLog.MaxSteps.ToString()
|
InitialValue = CurrentTasMovie.ChangeLog.MaxSteps.ToString()
|
||||||
};
|
};
|
||||||
|
|
||||||
if (prompt.ShowDialog().IsOk())
|
MainForm.StopSound();
|
||||||
|
var result = prompt.ShowDialog();
|
||||||
|
MainForm.StartSound();
|
||||||
|
if (result.IsOk())
|
||||||
{
|
{
|
||||||
int val = 0;
|
int val = 0;
|
||||||
try
|
try
|
||||||
|
@ -850,14 +853,17 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void SetBranchCellHoverIntervalMenuItem_Click(object sender, EventArgs e)
|
private void SetBranchCellHoverIntervalMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using var prompt = new InputPrompt(MainForm)
|
using var prompt = new InputPrompt
|
||||||
{
|
{
|
||||||
TextInputType = InputPrompt.InputType.Unsigned,
|
TextInputType = InputPrompt.InputType.Unsigned,
|
||||||
Message = "ScreenshotPopUp Delay",
|
Message = "ScreenshotPopUp Delay",
|
||||||
InitialValue = Settings.BranchCellHoverInterval.ToString()
|
InitialValue = Settings.BranchCellHoverInterval.ToString()
|
||||||
};
|
};
|
||||||
|
|
||||||
if (prompt.ShowDialog().IsOk())
|
MainForm.StopSound();
|
||||||
|
var result = prompt.ShowDialog();
|
||||||
|
MainForm.StartSound();
|
||||||
|
if (result.IsOk())
|
||||||
{
|
{
|
||||||
int val = int.Parse(prompt.PromptText);
|
int val = int.Parse(prompt.PromptText);
|
||||||
if (val > 0)
|
if (val > 0)
|
||||||
|
@ -870,14 +876,17 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void SetSeekingCutoffIntervalMenuItem_Click(object sender, EventArgs e)
|
private void SetSeekingCutoffIntervalMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using var prompt = new InputPrompt(MainForm)
|
using var prompt = new InputPrompt
|
||||||
{
|
{
|
||||||
TextInputType = InputPrompt.InputType.Unsigned,
|
TextInputType = InputPrompt.InputType.Unsigned,
|
||||||
Message = "Seeking Cutoff Interval",
|
Message = "Seeking Cutoff Interval",
|
||||||
InitialValue = Settings.SeekingCutoffInterval.ToString()
|
InitialValue = Settings.SeekingCutoffInterval.ToString()
|
||||||
};
|
};
|
||||||
|
|
||||||
if (prompt.ShowDialog().IsOk())
|
MainForm.StopSound();
|
||||||
|
var result = prompt.ShowDialog();
|
||||||
|
MainForm.StartSound();
|
||||||
|
if (result.IsOk())
|
||||||
{
|
{
|
||||||
int val = int.Parse(prompt.PromptText);
|
int val = int.Parse(prompt.PromptText);
|
||||||
if (val > 0)
|
if (val > 0)
|
||||||
|
@ -890,14 +899,17 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void SetAutosaveIntervalMenuItem_Click(object sender, EventArgs e)
|
private void SetAutosaveIntervalMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using var prompt = new InputPrompt(MainForm)
|
using var prompt = new InputPrompt
|
||||||
{
|
{
|
||||||
TextInputType = InputPrompt.InputType.Unsigned,
|
TextInputType = InputPrompt.InputType.Unsigned,
|
||||||
Message = "Autosave Interval in seconds\nSet to 0 to disable",
|
Message = "Autosave Interval in seconds\nSet to 0 to disable",
|
||||||
InitialValue = (Settings.AutosaveInterval / 1000).ToString()
|
InitialValue = (Settings.AutosaveInterval / 1000).ToString()
|
||||||
};
|
};
|
||||||
|
|
||||||
if (prompt.ShowDialog().IsOk())
|
MainForm.StopSound();
|
||||||
|
var result = prompt.ShowDialog();
|
||||||
|
MainForm.StartSound();
|
||||||
|
if (result.IsOk())
|
||||||
{
|
{
|
||||||
uint val = uint.Parse(prompt.PromptText) * 1000;
|
uint val = uint.Parse(prompt.PromptText) * 1000;
|
||||||
Settings.AutosaveInterval = val;
|
Settings.AutosaveInterval = val;
|
||||||
|
@ -1170,13 +1182,16 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void WheelScrollSpeedMenuItem_Click(object sender, EventArgs e)
|
private void WheelScrollSpeedMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var inputPrompt = new InputPrompt(MainForm)
|
var inputPrompt = new InputPrompt
|
||||||
{
|
{
|
||||||
TextInputType = InputPrompt.InputType.Unsigned,
|
TextInputType = InputPrompt.InputType.Unsigned,
|
||||||
Message = "Frames per tick:",
|
Message = "Frames per tick:",
|
||||||
InitialValue = TasView.ScrollSpeed.ToString()
|
InitialValue = TasView.ScrollSpeed.ToString()
|
||||||
};
|
};
|
||||||
if (inputPrompt.ShowDialog() == DialogResult.OK)
|
MainForm.StopSound();
|
||||||
|
var result = inputPrompt.ShowDialog();
|
||||||
|
MainForm.StartSound();
|
||||||
|
if (result == DialogResult.OK)
|
||||||
{
|
{
|
||||||
TasView.ScrollSpeed = int.Parse(inputPrompt.PromptText);
|
TasView.ScrollSpeed = int.Parse(inputPrompt.PromptText);
|
||||||
Settings.ScrollSpeed = TasView.ScrollSpeed;
|
Settings.ScrollSpeed = TasView.ScrollSpeed;
|
||||||
|
|
|
@ -343,7 +343,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void MaxLinesMenuItem_Click(object sender, EventArgs e)
|
private void MaxLinesMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using var prompt = new InputPrompt(MainForm)
|
using var prompt = new InputPrompt
|
||||||
{
|
{
|
||||||
StartLocation = this.ChildPointToScreen(TraceView),
|
StartLocation = this.ChildPointToScreen(TraceView),
|
||||||
TextInputType = InputPrompt.InputType.Unsigned,
|
TextInputType = InputPrompt.InputType.Unsigned,
|
||||||
|
@ -351,7 +351,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
InitialValue = MaxLines.ToString()
|
InitialValue = MaxLines.ToString()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MainForm.StopSound();
|
||||||
var result = prompt.ShowHawkDialog(this);
|
var result = prompt.ShowHawkDialog(this);
|
||||||
|
MainForm.StartSound();
|
||||||
if (result == DialogResult.OK)
|
if (result == DialogResult.OK)
|
||||||
{
|
{
|
||||||
var max = int.Parse(prompt.PromptText);
|
var max = int.Parse(prompt.PromptText);
|
||||||
|
@ -364,7 +366,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void SegmentSizeMenuItem_Click(object sender, EventArgs e)
|
private void SegmentSizeMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using var prompt = new InputPrompt(MainForm)
|
using var prompt = new InputPrompt
|
||||||
{
|
{
|
||||||
StartLocation = this.ChildPointToScreen(TraceView),
|
StartLocation = this.ChildPointToScreen(TraceView),
|
||||||
TextInputType = InputPrompt.InputType.Unsigned,
|
TextInputType = InputPrompt.InputType.Unsigned,
|
||||||
|
@ -372,7 +374,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
InitialValue = FileSizeCap.ToString()
|
InitialValue = FileSizeCap.ToString()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MainForm.StopSound();
|
||||||
var result = prompt.ShowHawkDialog(this);
|
var result = prompt.ShowHawkDialog(this);
|
||||||
|
MainForm.StartSound();
|
||||||
if (result == DialogResult.OK)
|
if (result == DialogResult.OK)
|
||||||
{
|
{
|
||||||
FileSizeCap = int.Parse(prompt.PromptText);
|
FileSizeCap = int.Parse(prompt.PromptText);
|
||||||
|
|
|
@ -891,14 +891,17 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private void GoToSpecifiedAddress()
|
private void GoToSpecifiedAddress()
|
||||||
{
|
{
|
||||||
WatchListView.DeselectAll();
|
WatchListView.DeselectAll();
|
||||||
var prompt = new InputPrompt(MainForm)
|
var prompt = new InputPrompt
|
||||||
{
|
{
|
||||||
Text = "Go to Address",
|
Text = "Go to Address",
|
||||||
StartLocation = this.ChildPointToScreen(WatchListView),
|
StartLocation = this.ChildPointToScreen(WatchListView),
|
||||||
Message = "Enter a hexadecimal value"
|
Message = "Enter a hexadecimal value"
|
||||||
};
|
};
|
||||||
|
|
||||||
while (prompt.ShowHawkDialog(this).IsOk())
|
MainForm.StopSound();
|
||||||
|
var result = prompt.ShowHawkDialog(this);
|
||||||
|
MainForm.StartSound();
|
||||||
|
while (result.IsOk())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -420,7 +420,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
else if (SelectedSeparators.Any() && !duplicate)
|
else if (SelectedSeparators.Any() && !duplicate)
|
||||||
{
|
{
|
||||||
var inputPrompt = new InputPrompt(MainForm)
|
var inputPrompt = new InputPrompt
|
||||||
{
|
{
|
||||||
Text = "Edit Separator",
|
Text = "Edit Separator",
|
||||||
StartLocation = this.ChildPointToScreen(WatchListView),
|
StartLocation = this.ChildPointToScreen(WatchListView),
|
||||||
|
@ -428,7 +428,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
TextInputType = InputPrompt.InputType.Text
|
TextInputType = InputPrompt.InputType.Text
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MainForm.StopSound();
|
||||||
var result = inputPrompt.ShowHawkDialog();
|
var result = inputPrompt.ShowHawkDialog();
|
||||||
|
MainForm.StartSound();
|
||||||
|
|
||||||
if (result == DialogResult.OK)
|
if (result == DialogResult.OK)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue