Shoehorn IDialogController into ShowHawkDialog call chains

This commit is contained in:
YoshiRulz 2020-12-01 04:28:46 +10:00 committed by James Groom
parent dd44ff7f6c
commit 9d620116f3
41 changed files with 99 additions and 95 deletions

View File

@ -243,9 +243,9 @@ namespace BizHawk.Client.EmuHawk
W.AddSamples(samples);
}
public IDisposable AcquireVideoCodecToken(IWin32Window hwnd, Config config)
public IDisposable AcquireVideoCodecToken(IDialogController dialogController, IWin32Window hwnd, Config config)
{
return W.AcquireVideoCodecToken(hwnd, config);
return W.AcquireVideoCodecToken(dialogController, hwnd, config);
}
public void SetMovieParameters(int fpsNum, int fpsDen)

View File

@ -261,7 +261,7 @@ namespace BizHawk.Client.EmuHawk
/// Acquires a video codec configuration from the user. you may save it for future use, but you must dispose of it when you're done with it.
/// returns null if the user canceled the dialog
/// </summary>
public IDisposable AcquireVideoCodecToken(IWin32Window hwnd, Config config)
public IDisposable AcquireVideoCodecToken(IDialogController dialogController, IWin32Window hwnd, Config config)
{
var tempParams = new Parameters
{

View File

@ -110,10 +110,10 @@ namespace BizHawk.Client.EmuHawk
}
}
public static void Run(IWin32Window hwnd)
public static void Run(IDialogController dialogController, IWin32Window hwnd)
{
var form = new FFmpegDownloaderForm();
form.ShowHawkDialog(hwnd);
form.ShowHawkDialog(dialogController, hwnd);
}
private void btnDownload_Click(object sender, EventArgs e)

View File

@ -207,14 +207,14 @@ namespace BizHawk.Client.EmuHawk
//ffmpeg.StandardInput.BaseStream.Write(b, 0, b.Length);
}
public IDisposable AcquireVideoCodecToken(IWin32Window hwnd, Config config)
public IDisposable AcquireVideoCodecToken(IDialogController dialogController, IWin32Window hwnd, Config config)
{
if (new FFmpegService().QueryServiceAvailable())
{
return FFmpegWriterForm.DoFFmpegWriterDlg(hwnd, config);
}
FFmpegDownloaderForm.Run(hwnd);
FFmpegDownloaderForm.Run(dialogController, hwnd);
if (new FFmpegService().QueryServiceAvailable())
{
return FFmpegWriterForm.DoFFmpegWriterDlg(hwnd, config);

View File

@ -195,7 +195,7 @@ namespace BizHawk.Client.EmuHawk
// ignored
}
public IDisposable AcquireVideoCodecToken(IWin32Window hwnd, Config config)
public IDisposable AcquireVideoCodecToken(IDialogController dialogController, IWin32Window hwnd, Config config)
{
return GifWriterForm.DoTokenForm(hwnd, config);
}

View File

@ -64,7 +64,7 @@ namespace BizHawk.Client.EmuHawk
/// </summary>
/// <param name="hwnd">hwnd to attach to if the user is shown config dialog</param>
/// <returns>codec token, dispose of it when you're done with it</returns>
IDisposable AcquireVideoCodecToken(IWin32Window hwnd, Config config);
IDisposable AcquireVideoCodecToken(IDialogController dialogController, IWin32Window hwnd, Config config);
/// <summary>
/// set framerate to fpsNum/fpsDen (assumed to be unchanging over the life of the stream)

View File

@ -73,7 +73,7 @@ namespace BizHawk.Client.EmuHawk
}
}
public IDisposable AcquireVideoCodecToken(IWin32Window hwnd, Config config)
public IDisposable AcquireVideoCodecToken(IDialogController dialogController, IWin32Window hwnd, Config config)
{
return new CodecToken();
}

View File

@ -529,7 +529,7 @@ namespace BizHawk.Client.EmuHawk
/// </summary>
/// <param name="hwnd">hwnd to attach to if the user is shown config dialog</param>
/// <returns>codec token, dispose of it when you're done with it</returns>
public IDisposable AcquireVideoCodecToken(IWin32Window hwnd, Config config)
public IDisposable AcquireVideoCodecToken(IDialogController dialogController, IWin32Window hwnd, Config config)
{
var ret = new CodecToken();

View File

@ -29,7 +29,7 @@ namespace BizHawk.Client.EmuHawk
{
// ignored
}
public IDisposable AcquireVideoCodecToken(IWin32Window hwnd, Config config)
public IDisposable AcquireVideoCodecToken(IDialogController dialogController, IWin32Window hwnd, Config config)
{
return new NutWriterToken();
}

View File

@ -83,7 +83,7 @@ namespace BizHawk.Client.EmuHawk
}
}
public IDisposable AcquireVideoCodecToken(IWin32Window hwnd, Config config)
public IDisposable AcquireVideoCodecToken(IDialogController dialogController, IWin32Window hwnd, Config config)
{
return new DummyDisposable();
}

View File

@ -16,12 +16,15 @@ namespace BizHawk.Client.EmuHawk
private readonly Config _config;
private readonly IGameInfo _game;
private readonly IDialogController _dialogController;
private string _mSynclessConfigFile;
private string _mFramesDirectory;
public SynclessRecordingTools(Config config, IGameInfo game)
public SynclessRecordingTools(Config config, IGameInfo game, IDialogController dialogController)
{
_config = config;
_dialogController = dialogController;
_game = game;
InitializeComponent();
}
@ -123,7 +126,7 @@ namespace BizHawk.Client.EmuHawk
avw.SetAudioParameters(44100, 2, 16); // hacky
avw.SetMovieParameters(60, 1); // hacky
avw.SetVideoParameters(width, height);
var token = avw.AcquireVideoCodecToken(this, _config);
var token = avw.AcquireVideoCodecToken(_dialogController, this, _config);
avw.SetVideoCodecToken(token);
avw.OpenFile(sfd.FileName);
foreach (var fi in _mFrameInfos)

View File

@ -229,7 +229,7 @@ namespace BizHawk.Client.EmuHawk
public void Dispose() { }
}
public IDisposable AcquireVideoCodecToken(IWin32Window hwnd, Config config)
public IDisposable AcquireVideoCodecToken(IDialogController dialogController, IWin32Window hwnd, Config config)
{
// don't care
return new WavWriterVToken();

View File

@ -148,28 +148,22 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// Handles EmuHawk specific issues before showing a modal dialog
/// </summary>
public static DialogResult ShowHawkDialog(this Form form, IWin32Window owner, Point position = default)
public static DialogResult ShowHawkDialog(this Form form, IDialogController dialogController, IWin32Window owner, Point position = default)
{
Sound.Instance.StopSound();
if (position != default)
{
form.StartPosition = FormStartPosition.Manual;
form.Location = position;
}
var result = form.ShowDialog(owner);
Sound.Instance.StartSound();
return result;
return dialogController.DoWithTempMute(() => form.ShowDialog(owner));
}
/// <summary>
/// Handles EmuHawk specific issues before showing a modal dialog
/// </summary>
public static DialogResult ShowHawkDialog(this CommonDialog form, IWin32Window owner)
public static DialogResult ShowHawkDialog(this CommonDialog form, IDialogController dialogController, IWin32Window owner)
{
Sound.Instance.StopSound();
var result = form.ShowDialog(owner);
Sound.Instance.StartSound();
return result;
return dialogController.DoWithTempMute(() => form.ShowDialog(owner));
}
public static void DoWithTempMute(this IDialogController dialogController, Action action)
@ -286,7 +280,7 @@ namespace BizHawk.Client.EmuHawk
Clipboard.SetImage(img);
}
public static void SaveAsFile(this Bitmap bitmap, IGameInfo game, string suffix, string systemId, PathEntryCollection paths, IWin32Window owner)
public static void SaveAsFile(this Bitmap bitmap, IGameInfo game, string suffix, string systemId, PathEntryCollection paths, IDialogController dialogController, IWin32Window owner)
{
using var sfd = new SaveFileDialog
{
@ -296,7 +290,7 @@ namespace BizHawk.Client.EmuHawk
RestoreDirectory = true
};
var result = sfd.ShowHawkDialog(owner);
var result = sfd.ShowHawkDialog(dialogController, owner);
if (result != DialogResult.OK)
{
return;

View File

@ -246,7 +246,7 @@ namespace BizHawk.Client.EmuHawk
private void OpenAdvancedMenuItem_Click(object sender, EventArgs e)
{
using var oac = new OpenAdvancedChooser(Config, CreateCoreComm, Game, RunLibretroCoreChooser);
if (oac.ShowHawkDialog(this) == DialogResult.Cancel)
if (oac.ShowHawkDialog(this, this) == DialogResult.Cancel)
{
return;
}
@ -295,7 +295,7 @@ namespace BizHawk.Client.EmuHawk
Title = "Open Advanced"
};
var result = ofd.ShowHawkDialog(this);
var result = ofd.ShowHawkDialog(this, this);
if (!result.IsOk())
{
return;
@ -444,7 +444,7 @@ namespace BizHawk.Client.EmuHawk
RestoreDirectory = false
};
if (ofd.ShowHawkDialog(this).IsOk())
if (ofd.ShowHawkDialog(this, this).IsOk())
{
foreach (var fn in ofd.FileNames)
{
@ -471,8 +471,8 @@ namespace BizHawk.Client.EmuHawk
Config.PathEntries.MovieAbsolutePath(),
"Movie Files",
MovieSession.Movie.PreferredExtension,
this
);
this,
this);
if (file != null)
{
@ -540,7 +540,7 @@ namespace BizHawk.Client.EmuHawk
private void SynclessRecordingMenuItem_Click(object sender, EventArgs e)
{
new SynclessRecordingTools(Config, Game).Run();
new SynclessRecordingTools(Config, Game, this).Run();
}
private void CaptureOSDMenuItem_Click(object sender, EventArgs e)
@ -564,7 +564,7 @@ namespace BizHawk.Client.EmuHawk
Filter = FilesystemFilter.PNGs.ToString()
};
if (sfd.ShowHawkDialog(this).IsOk())
if (sfd.ShowHawkDialog(this, this).IsOk())
{
TakeScreenshot(sfd.FileName);
}
@ -1130,7 +1130,7 @@ namespace BizHawk.Client.EmuHawk
Filter = ConfigFileFSFilterString
};
if (sfd.ShowHawkDialog(this).IsOk())
if (sfd.ShowHawkDialog(this, this).IsOk())
{
SaveConfig(sfd.FileName);
AddOnScreenMessage("Copied settings");
@ -1152,7 +1152,7 @@ namespace BizHawk.Client.EmuHawk
Filter = ConfigFileFSFilterString
};
if (ofd.ShowHawkDialog(this).IsOk())
if (ofd.ShowHawkDialog(this, this).IsOk())
{
LoadConfigFile(ofd.FileName);
}
@ -1385,12 +1385,12 @@ namespace BizHawk.Client.EmuHawk
if (Emulator is NES nes && nes.IsVS)
{
using var form = new NesVsSettings(this, nes.GetSyncSettings().Clone());
form.ShowHawkDialog(this);
form.ShowHawkDialog(this, this);
}
else if (Emulator is SubNESHawk sub && sub.IsVs)
{
using var form = new NesVsSettings(this, sub.GetSyncSettings().Clone());
form.ShowHawkDialog(this);
form.ShowHawkDialog(this, this);
}
}

View File

@ -2258,7 +2258,7 @@ namespace BizHawk.Client.EmuHawk
FilterIndex = _lastOpenRomFilter
};
var result = ofd.ShowHawkDialog(this);
var result = ofd.ShowHawkDialog(this, this);
if (result != DialogResult.OK)
{
return;
@ -3221,7 +3221,7 @@ namespace BizHawk.Client.EmuHawk
aw.SetDefaultVideoCodecToken(Config);
}
var token = aw.AcquireVideoCodecToken(this, Config);
var token = aw.AcquireVideoCodecToken(this, this, Config);
if (token == null)
{
AddOnScreenMessage("A/V capture canceled.");
@ -3270,7 +3270,7 @@ namespace BizHawk.Client.EmuHawk
sfd.Filter = new FilesystemFilterSet(new FilesystemFilter(ext, new[] { ext })).ToString();
var result = sfd.ShowHawkDialog(this);
var result = sfd.ShowHawkDialog(this, this);
if (result == DialogResult.Cancel)
{
aw.Dispose();
@ -4257,7 +4257,7 @@ namespace BizHawk.Client.EmuHawk
FileName = $"{SaveStatePrefix()}.QuickSave0.State"
};
var result = sfd.ShowHawkDialog(this);
var result = sfd.ShowHawkDialog(this, this);
if (result == DialogResult.OK)
{
SaveState(sfd.FileName, sfd.FileName);
@ -4289,7 +4289,7 @@ namespace BizHawk.Client.EmuHawk
RestoreDirectory = true
};
var result = ofd.ShowHawkDialog(this);
var result = ofd.ShowHawkDialog(this, this);
if (result != DialogResult.OK)
{
return;

View File

@ -513,7 +513,7 @@ namespace BizHawk.Client.EmuHawk
InitialDirectory = _config.PathEntries.MovieAbsolutePath()
};
var result = ofd.ShowHawkDialog(this);
var result = ofd.ShowHawkDialog(_mainForm, this);
if (result == DialogResult.OK)
{
var file = new FileInfo(ofd.FileName);

View File

@ -194,7 +194,7 @@ namespace BizHawk.Client.EmuHawk
Filter = new FilesystemFilterSet(new FilesystemFilter("Movie Files", new[] { preferredExt })).ToString()
};
var result = sfd.ShowHawkDialog(this);
var result = sfd.ShowHawkDialog(_mainForm, this);
if (result == DialogResult.OK
&& !string.IsNullOrWhiteSpace(sfd.FileName))
{

View File

@ -366,11 +366,12 @@ namespace BizHawk.Client.EmuHawk
}
var file = SaveFileDialog(
fileName,
Config.PathEntries.ToolsAbsolutePath(),
"Bot files",
"bot",
this);
fileName,
Config.PathEntries.ToolsAbsolutePath(),
"Bot files",
"bot",
MainForm,
this);
if (file != null)
{

View File

@ -392,6 +392,7 @@ namespace BizHawk.Client.EmuHawk
Config.PathEntries.LogAbsolutePath(),
"Code Data Logger Files",
"cdl",
MainForm,
this);
if (file == null)

View File

@ -150,6 +150,7 @@ namespace BizHawk.Client.EmuHawk
Config.PathEntries.CheatsAbsolutePath(Game.System),
"Cheat Files",
"cht",
MainForm,
Owner ?? this);
return file != null && MainForm.CheatList.SaveFile(file.FullName);

View File

@ -144,7 +144,7 @@ namespace BizHawk.Client.EmuHawk
{
var b = CreateAddBreakpointDialog(BreakpointOperation.Add);
if (b.ShowHawkDialog(this).IsOk())
if (b.ShowHawkDialog(MainForm, this).IsOk())
{
_breakpoints.Add(Core, MemoryDomains.SystemBus.Name, b.Address, b.AddressMask, b.BreakType);
}
@ -265,7 +265,7 @@ namespace BizHawk.Client.EmuHawk
{
var b = CreateAddBreakpointDialog(BreakpointOperation.Duplicate, breakpoint.Type, breakpoint.Address, breakpoint.AddressMask);
if (b.ShowHawkDialog(this) == DialogResult.OK)
if (b.ShowHawkDialog(MainForm, this) == DialogResult.OK)
{
_breakpoints.Add(new Breakpoint(Core, MemoryDomains.SystemBus.Name, breakpoint.Callback, b.Address, b.AddressMask, b.BreakType, breakpoint.Active));
}
@ -284,7 +284,7 @@ namespace BizHawk.Client.EmuHawk
{
var b = CreateAddBreakpointDialog(BreakpointOperation.Edit, breakpoint.Type, breakpoint.Address, breakpoint.AddressMask);
if (b.ShowHawkDialog(this) == DialogResult.OK)
if (b.ShowHawkDialog(MainForm, this) == DialogResult.OK)
{
breakpoint.Type = b.BreakType;
breakpoint.Address = b.Address;

View File

@ -1022,7 +1022,7 @@ namespace BizHawk.Client.EmuHawk
Color = Spriteback
};
var result = dlg.ShowHawkDialog(this);
var result = dlg.ShowHawkDialog(MainForm, this);
if (result.IsOk())
{
Spriteback = dlg.Color;

View File

@ -187,7 +187,7 @@ namespace BizHawk.Client.EmuHawk
g.Flush();
}
toSave.Bmp.SaveAsFile(Game, "Print", Emulator.SystemId, Config.PathEntries, this);
toSave.Bmp.SaveAsFile(Game, "Print", Emulator.SystemId, Config.PathEntries, MainForm, this);
}
private void CopyToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -179,7 +179,7 @@ namespace BizHawk.Client.EmuHawk
private void SaveAsFile(Bitmap bitmap, string suffix)
{
bitmap.SaveAsFile(Game, suffix, Emu.SystemId, Config.PathEntries, this);
bitmap.SaveAsFile(Game, suffix, Emu.SystemId, Config.PathEntries, MainForm, this);
}
private void SaveBGAScreenshotToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -946,7 +946,7 @@ namespace BizHawk.Client.EmuHawk
: Game.FilesystemSafeName()
};
var result = sfd.ShowHawkDialog(this);
var result = sfd.ShowHawkDialog(MainForm, this);
return result == DialogResult.OK ? sfd.FileName : "";
}
@ -962,7 +962,7 @@ namespace BizHawk.Client.EmuHawk
RestoreDirectory = true
};
var result = sfd.ShowHawkDialog(this);
var result = sfd.ShowHawkDialog(MainForm, this);
return result == DialogResult.OK ? sfd.FileName : "";
}
@ -1284,7 +1284,7 @@ namespace BizHawk.Client.EmuHawk
RestoreDirectory = true
};
var result = sfd.ShowHawkDialog(this);
var result = sfd.ShowHawkDialog(MainForm, this);
if (result != DialogResult.OK)
{
return;
@ -1338,7 +1338,7 @@ namespace BizHawk.Client.EmuHawk
RestoreDirectory = false
};
var result = ofd.ShowHawkDialog(this);
var result = ofd.ShowHawkDialog(MainForm, this);
if (result == DialogResult.OK)
{
@ -1605,7 +1605,7 @@ namespace BizHawk.Client.EmuHawk
Message = "Enter a hexadecimal value"
};
var result = MainForm.DoWithTempMute(() => inputPrompt.ShowHawkDialog(this));
var result = MainForm.DoWithTempMute(() => inputPrompt.ShowHawkDialog(MainForm, this));
if (result == DialogResult.OK && inputPrompt.PromptText.IsHex())
{
@ -1694,7 +1694,7 @@ namespace BizHawk.Client.EmuHawk
ParentTool = this
};
poke.ShowHawkDialog(this);
poke.ShowHawkDialog(MainForm, this);
GeneralUpdate();
}
}
@ -1702,7 +1702,7 @@ namespace BizHawk.Client.EmuHawk
private void SetColorsMenuItem_Click(object sender, EventArgs e)
{
using var form = new HexColorsForm(this);
form.ShowHawkDialog(this);
form.ShowHawkDialog(MainForm, this);
}
private void ResetColorsToDefaultMenuItem_Click(object sender, EventArgs e)

View File

@ -696,7 +696,7 @@ namespace BizHawk.Client.EmuHawk
sfd.Filter = SessionsFSFilterSet.ToString();
sfd.RestoreDirectory = true;
var result = sfd.ShowHawkDialog(this);
var result = sfd.ShowHawkDialog(MainForm, this);
return result.IsOk() ? new FileInfo(sfd.FileName) : null;
}
@ -826,7 +826,7 @@ namespace BizHawk.Client.EmuHawk
Directory.CreateDirectory(ofd.InitialDirectory);
}
var result = ofd.ShowHawkDialog(this);
var result = ofd.ShowHawkDialog(MainForm, this);
if (result.IsOk() && !string.IsNullOrWhiteSpace(ofd.FileName))
{
LoadLuaSession(ofd.FileName);
@ -880,7 +880,7 @@ namespace BizHawk.Client.EmuHawk
Filter = new FilesystemFilterSet(FilesystemFilter.LuaScripts).ToString()
};
var result = sfd.ShowHawkDialog(this);
var result = sfd.ShowHawkDialog(MainForm, this);
if (result.IsOk() && !string.IsNullOrWhiteSpace(sfd.FileName))
{
string defaultTemplate = "while true do\n\temu.frameadvance();\nend";
@ -912,7 +912,7 @@ namespace BizHawk.Client.EmuHawk
Directory.CreateDirectory(ofd.InitialDirectory);
}
var result = ofd.ShowHawkDialog(this);
var result = ofd.ShowHawkDialog(MainForm, this);
if (result.IsOk() && ofd.FileNames != null)
{
foreach (var file in ofd.FileNames)

View File

@ -279,7 +279,7 @@ namespace BizHawk.Client.EmuHawk
create = true;
}
DialogResult result = dialog.ShowHawkDialog(this);
DialogResult result = dialog.ShowHawkDialog(MainForm, this);
if (result != DialogResult.OK)
{
if (create)
@ -304,7 +304,7 @@ namespace BizHawk.Client.EmuHawk
Filter = MacrosFSFilterSet.ToString()
};
DialogResult result = dialog.ShowHawkDialog(this);
DialogResult result = dialog.ShowHawkDialog(MainForm, this);
if (result != DialogResult.OK)
{
return null;

View File

@ -127,7 +127,7 @@ namespace BizHawk.Client.EmuHawk
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top
};
var mdf = new MultiDiskFileSelector(this, () => MainForm.CurrentlyOpenRom)
var mdf = new MultiDiskFileSelector(this, MainForm, () => MainForm.CurrentlyOpenRom)
{
Location = UIHelper.Scale(new Point(7, 12)),
Width = groupBox.ClientSize.Width - UIHelper.ScaleX(13),
@ -262,7 +262,7 @@ namespace BizHawk.Client.EmuHawk
Filter = new FilesystemFilterSet(new FilesystemFilter("XML Files", new[] { "xml" })).ToString()
};
var result = sfd.ShowHawkDialog(this);
var result = sfd.ShowHawkDialog(MainForm, this);
if (result != DialogResult.Cancel)
{
NameBox.Text = sfd.FileName;

View File

@ -9,6 +9,8 @@ namespace BizHawk.Client.EmuHawk
{
public partial class MultiDiskFileSelector : UserControl
{
private readonly IDialogController _dialogController;
private readonly Func<string> _getLoadedRomNameCallback;
private readonly ToolFormBase _parent;
@ -28,8 +30,9 @@ namespace BizHawk.Client.EmuHawk
OnNameChanged(EventArgs.Empty);
}
public MultiDiskFileSelector(ToolFormBase parent, Func<string> getLoadedRomNameCallback)
public MultiDiskFileSelector(ToolFormBase parent, IDialogController dialogController, Func<string> getLoadedRomNameCallback)
{
_dialogController = dialogController;
_getLoadedRomNameCallback = getLoadedRomNameCallback;
_parent = parent;
InitializeComponent();
@ -76,7 +79,7 @@ namespace BizHawk.Client.EmuHawk
};
string hawkPath = "";
var result = ofd.ShowHawkDialog(this);
var result = ofd.ShowHawkDialog(_dialogController, this);
if (result == DialogResult.OK)
{
hawkPath = ofd.FileName;

View File

@ -188,7 +188,7 @@ namespace BizHawk.Client.EmuHawk
{
NameTableView
.ToBitMap()
.SaveAsFile(Game, "Nametables", "NES", Config.PathEntries, this);
.SaveAsFile(Game, "Nametables", "NES", Config.PathEntries, MainForm, this);
}
private void ScreenshotToClipboardMenuItem_Click(object sender, EventArgs e)

View File

@ -314,7 +314,7 @@ namespace BizHawk.Client.EmuHawk
private void Screenshot(Bitmap b, string suffix)
{
b.SaveAsFile(Game, suffix, "NES", Config.PathEntries, this);
b.SaveAsFile(Game, suffix, "NES", Config.PathEntries, MainForm, this);
}
private void SavePaletteScreenshotMenuItem_Click(object sender, EventArgs e)

View File

@ -204,7 +204,7 @@ namespace BizHawk.Client.EmuHawk
private void SaveAsFile(Bitmap bmp, string suffix)
{
bmp.SaveAsFile(Game, suffix, Emulator.SystemId, Config.PathEntries, this);
bmp.SaveAsFile(Game, suffix, Emulator.SystemId, Config.PathEntries, MainForm, this);
}
private void SaveBackgroundScreenshotMenuItem_Click(object sender, EventArgs e)

View File

@ -197,7 +197,7 @@ namespace BizHawk.Client.EmuHawk
private void SaveAsFile(Bitmap bmp, string suffix)
{
bmp.SaveAsFile(Game, suffix, Emulator.SystemId, Config.PathEntries, this);
bmp.SaveAsFile(Game, suffix, Emulator.SystemId, Config.PathEntries, MainForm, this);
}
private void SaveTilesScreenshotToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -577,7 +577,7 @@ namespace BizHawk.Client.EmuHawk
var point = Cursor.Position;
point.Offset(i.Width / -2, i.Height / -2);
var result = MainForm.DoWithTempMute(() => i.ShowHawkDialog(this, position: point));
var result = MainForm.DoWithTempMute(() => i.ShowHawkDialog(Tastudio.MainForm, this, position: point));
if (result.IsOk())
{
branch.UserText = i.PromptText;

View File

@ -196,7 +196,7 @@ namespace BizHawk.Client.EmuHawk
var point = Cursor.Position;
point.Offset(i.Width / -2, i.Height / -2);
var result = Tastudio.MainForm.DoWithTempMute(() => i.ShowHawkDialog(this, position: point));
var result = Tastudio.MainForm.DoWithTempMute(() => i.ShowHawkDialog(Tastudio.MainForm, this, position: point));
if (!result.IsOk())
{
return;
@ -251,7 +251,7 @@ namespace BizHawk.Client.EmuHawk
point.Offset(i.Width / -2, i.Height / -2);
}
var result = Tastudio.MainForm.DoWithTempMute(() => i.ShowHawkDialog(this, position: point));
var result = Tastudio.MainForm.DoWithTempMute(() => i.ShowHawkDialog(Tastudio.MainForm, this, position: point));
if (result == DialogResult.OK)
{

View File

@ -108,7 +108,7 @@ namespace BizHawk.Client.EmuHawk
).ToString()
};
var result = ofd.ShowHawkDialog(this);
var result = ofd.ShowHawkDialog(MainForm, this);
if (result.IsOk())
{
LoadMovieFile(ofd.FileName, false);

View File

@ -826,6 +826,7 @@ namespace BizHawk.Client.EmuHawk
Config.PathEntries.MovieAbsolutePath(),
"Tas Project Files",
"tasproj",
MainForm,
this
);

View File

@ -71,7 +71,7 @@ namespace BizHawk.Client.EmuHawk
RestoreDirectory = true
};
var result = ofd.ShowHawkDialog(this);
var result = ofd.ShowHawkDialog(MainForm, this);
if (result != DialogResult.OK)
{
return null;
@ -80,7 +80,7 @@ namespace BizHawk.Client.EmuHawk
return new FileInfo(ofd.FileName);
}
public static FileInfo SaveFileDialog(string currentFile, string path, string fileType, string fileExt, IWin32Window owner)
public static FileInfo SaveFileDialog(string currentFile, string path, string fileType, string fileExt, IDialogController dialogController, IWin32Window owner)
{
if (!Directory.Exists(path))
{
@ -95,7 +95,7 @@ namespace BizHawk.Client.EmuHawk
RestoreDirectory = true
};
var result = sfd.ShowHawkDialog(owner);
var result = sfd.ShowHawkDialog(dialogController, owner);
if (result != DialogResult.OK)
{
return null;
@ -111,7 +111,7 @@ namespace BizHawk.Client.EmuHawk
public FileInfo GetWatchSaveFileFromUser(string currentFile)
{
return SaveFileDialog(currentFile, Config.PathEntries.WatchAbsolutePath(), "Watch Files", "wch", this);
return SaveFileDialog(currentFile, Config.PathEntries.WatchAbsolutePath(), "Watch Files", "wch", MainForm, this);
}
public void ViewInHexEditor(MemoryDomain domain, IEnumerable<long> addresses, WatchSize size)

View File

@ -302,7 +302,7 @@ namespace BizHawk.Client.EmuHawk
FilesystemFilter.TextFiles
).ToString();
sfd.RestoreDirectory = true;
var result = sfd.ShowHawkDialog(this);
var result = sfd.ShowHawkDialog(MainForm, this);
return result.IsOk() ? new FileInfo(sfd.FileName) : null;
}
@ -351,7 +351,7 @@ namespace BizHawk.Client.EmuHawk
InitialValue = MaxLines.ToString()
};
var result = MainForm.DoWithTempMute(() => prompt.ShowHawkDialog(this));
var result = MainForm.DoWithTempMute(() => prompt.ShowHawkDialog(MainForm, this));
if (result == DialogResult.OK)
{
var max = int.Parse(prompt.PromptText);
@ -372,7 +372,7 @@ namespace BizHawk.Client.EmuHawk
InitialValue = FileSizeCap.ToString()
};
var result = MainForm.DoWithTempMute(() => prompt.ShowHawkDialog(this));
var result = MainForm.DoWithTempMute(() => prompt.ShowHawkDialog(MainForm, this));
if (result == DialogResult.OK)
{
FileSizeCap = int.Parse(prompt.PromptText);

View File

@ -868,7 +868,7 @@ namespace BizHawk.Client.EmuHawk
InitialLocation = this.ChildPointToScreen(WatchListView)
};
poke.ShowHawkDialog(this);
poke.ShowHawkDialog(MainForm, this);
UpdateList();
}
}
@ -898,7 +898,7 @@ namespace BizHawk.Client.EmuHawk
Message = "Enter a hexadecimal value"
};
var result = MainForm.DoWithTempMute(() => prompt.ShowHawkDialog(this));
var result = MainForm.DoWithTempMute(() => prompt.ShowHawkDialog(MainForm, this));
while (result.IsOk())
{
try

View File

@ -395,7 +395,7 @@ namespace BizHawk.Client.EmuHawk
we.SetWatch(SelectedWatches.First().Domain, SelectedWatches, duplicate ? WatchEditor.Mode.Duplicate : WatchEditor.Mode.Edit);
var result = we.ShowHawkDialog(this);
var result = we.ShowHawkDialog(MainForm, this);
if (result == DialogResult.OK)
{
if (duplicate)
@ -426,7 +426,7 @@ namespace BizHawk.Client.EmuHawk
TextInputType = InputPrompt.InputType.Text
};
var result = MainForm.DoWithTempMute(() => inputPrompt.ShowHawkDialog(this));
var result = MainForm.DoWithTempMute(() => inputPrompt.ShowHawkDialog(MainForm, this));
if (result == DialogResult.OK)
{
@ -732,7 +732,7 @@ namespace BizHawk.Client.EmuHawk
MemoryDomains = MemoryDomains
};
we.SetWatch(CurrentDomain);
we.ShowHawkDialog(this);
we.ShowHawkDialog(MainForm, this);
if (we.DialogResult == DialogResult.OK)
{
_watches.Add(we.Watches[0]);
@ -779,7 +779,7 @@ namespace BizHawk.Client.EmuHawk
InitialLocation = this.ChildPointToScreen(WatchListView)
};
if (poke.ShowHawkDialog(this).IsOk())
if (poke.ShowHawkDialog(MainForm, this).IsOk())
{
GeneralUpdate();
}