Remove superinterface `IDialogParent` from `IMainFormForConfig`
This commit is contained in:
parent
4938f427a4
commit
0366242d0a
|
@ -5,7 +5,7 @@ using BizHawk.Emulation.Common;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public interface IMainFormForConfig : IDialogParent
|
||||
public interface IMainFormForConfig
|
||||
{
|
||||
/// <exception cref="InvalidOperationException">loaded emulator is not instance of <typeparamref name="T"/></exception>
|
||||
ISettingsAdapter GetSettingsAdapterForLoadedCore<T>()
|
||||
|
|
|
@ -1348,7 +1348,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private DialogResult OpenNesHawkGraphicsSettingsDialog(NES.NESSettings s)
|
||||
{
|
||||
using NESGraphicsConfig form = new(this, Config, s);
|
||||
using NESGraphicsConfig form = new(Config, this, this, s);
|
||||
return this.ShowDialogWithTempMute(form);
|
||||
}
|
||||
|
||||
|
@ -1465,7 +1465,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private DialogResult OpenNesHawkAdvancedSettingsDialog(NES.NESSyncSettings ss, bool hasMapperProperties)
|
||||
{
|
||||
using NESSyncSettingsForm form = new(this, ss, hasMapperProperties: hasMapperProperties);
|
||||
using NESSyncSettingsForm form = new(this, this, ss, hasMapperProperties: hasMapperProperties);
|
||||
return this.ShowDialogWithTempMute(form);
|
||||
}
|
||||
|
||||
|
@ -1575,7 +1575,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
private DialogResult OpenGambatteSettingsDialog(Gameboy gambatte)
|
||||
=> GBPrefs.DoGBPrefsDialog(this, Config, Game, MovieSession, gambatte);
|
||||
=> GBPrefs.DoGBPrefsDialog(Config, this, Game, this, MovieSession, gambatte);
|
||||
|
||||
private DialogResult OpenGBHawkSettingsDialog()
|
||||
=> OpenGenericCoreConfig("Gameboy Settings");
|
||||
|
@ -1596,7 +1596,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private DialogResult OpenSameBoyPaletteSettingsDialog(Sameboy.SameboySettings s)
|
||||
{
|
||||
using SameBoyColorChooserForm form = new(this, Game, Config, s);
|
||||
using SameBoyColorChooserForm form = new(Config, this, Game, this, s);
|
||||
return this.ShowDialogWithTempMute(form);
|
||||
}
|
||||
|
||||
|
@ -1640,7 +1640,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
private DialogResult OpenOctoshockSettingsDialog(Octoshock octoshock)
|
||||
=> PSXOptions.DoSettingsDialog(this, Config, octoshock);
|
||||
=> PSXOptions.DoSettingsDialog(Config, this, this, octoshock);
|
||||
|
||||
private void PsxOptionsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -1700,10 +1700,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
private DialogResult OpenOldBSNESSettingsDialog(LibsnesCore bsnes)
|
||||
=> SNESOptions.DoSettingsDialog(this, bsnes);
|
||||
=> SNESOptions.DoSettingsDialog(this, this, bsnes);
|
||||
|
||||
private DialogResult OpenBSNESSettingsDialog(BsnesCore bsnes)
|
||||
=> BSNESOptions.DoSettingsDialog(this, bsnes);
|
||||
=> BSNESOptions.DoSettingsDialog(this, this, bsnes);
|
||||
|
||||
private void SnesOptionsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -1832,7 +1832,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
private DialogResult OpenGambatteLinkSettingsDialog(GambatteLink gambatteLink)
|
||||
=> GBLPrefs.DoGBLPrefsDialog(this, Config, Game, MovieSession, gambatteLink);
|
||||
=> GBLPrefs.DoGBLPrefsDialog(Config, this, Game, this, MovieSession, gambatteLink);
|
||||
|
||||
private void GblSettingsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -1966,7 +1966,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private DialogResult OpenZXHawkGamepadSettingsDialog(ZXSpectrum.ZXSpectrumSyncSettings ss)
|
||||
{
|
||||
using ZxSpectrumJoystickSettings form = new(this, ss);
|
||||
using ZxSpectrumJoystickSettings form = new(this, this, ss);
|
||||
return this.ShowDialogWithTempMute(form);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,12 +48,18 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private bool SyncSettingsChanged => gbPrefControl1.SyncSettingsChanged || gbPrefControl2.SyncSettingsChanged || gbPrefControl3.SyncSettingsChanged || gbPrefControl4.SyncSettingsChanged;
|
||||
|
||||
public static DialogResult DoGBLPrefsDialog(IMainFormForConfig mainForm, Config config, IGameInfo game, IMovieSession movieSession, GambatteLink gambatte)
|
||||
public static DialogResult DoGBLPrefsDialog(
|
||||
Config config,
|
||||
IDialogParent dialogParent,
|
||||
IGameInfo game,
|
||||
IMainFormForConfig mainForm,
|
||||
IMovieSession movieSession,
|
||||
GambatteLink gambatte)
|
||||
{
|
||||
var s = gambatte.GetSettings();
|
||||
var ss = gambatte.GetSyncSettings();
|
||||
|
||||
using var dlg = new GBLPrefs(mainForm.DialogController, config, game, movieSession);
|
||||
using var dlg = new GBLPrefs(dialogParent.DialogController, config, game, movieSession);
|
||||
dlg.PutSettings(s, ss);
|
||||
|
||||
dlg.gbPrefControl1.ColorGameBoy = gambatte.IsCGBMode(0);
|
||||
|
@ -61,7 +67,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
dlg.gbPrefControl3.ColorGameBoy = gambatte.IsCGBMode(2);
|
||||
dlg.gbPrefControl4.ColorGameBoy = gambatte.IsCGBMode(3);
|
||||
|
||||
var result = mainForm.ShowDialogAsChild(dlg);
|
||||
var result = dialogParent.ShowDialogAsChild(dlg);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
dlg.GetSettings(out s, out ss);
|
||||
|
|
|
@ -17,15 +17,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
Icon = Properties.Resources.GambatteIcon;
|
||||
}
|
||||
|
||||
public static DialogResult DoGBPrefsDialog(IMainFormForConfig mainForm, Config config, IGameInfo game, IMovieSession movieSession, Gameboy gb)
|
||||
public static DialogResult DoGBPrefsDialog(
|
||||
Config config,
|
||||
IDialogParent dialogParent,
|
||||
IGameInfo game,
|
||||
IMainFormForConfig mainForm,
|
||||
IMovieSession movieSession,
|
||||
Gameboy gb)
|
||||
{
|
||||
var s = gb.GetSettings();
|
||||
var ss = gb.GetSyncSettings();
|
||||
|
||||
using var dlg = new GBPrefs(mainForm.DialogController);
|
||||
using var dlg = new GBPrefs(dialogParent.DialogController);
|
||||
dlg.gbPrefControl1.PutSettings(config, game, movieSession, s, ss);
|
||||
dlg.gbPrefControl1.ColorGameBoy = gb.IsCGBMode() || gb.IsSgb;
|
||||
var result = mainForm.ShowDialogAsChild(dlg);
|
||||
var result = dialogParent.ShowDialogAsChild(dlg);
|
||||
if (result.IsOk())
|
||||
{
|
||||
dlg.gbPrefControl1.GetSettings(out s, out ss);
|
||||
|
|
|
@ -10,19 +10,27 @@ using BizHawk.Emulation.Cores.Nintendo.Sameboy;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class SameBoyColorChooserForm : Form
|
||||
public partial class SameBoyColorChooserForm : Form, IDialogParent
|
||||
{
|
||||
private readonly IMainFormForConfig _mainForm;
|
||||
private readonly IGameInfo _game;
|
||||
private readonly Config _config;
|
||||
private readonly Sameboy.SameboySettings _settings;
|
||||
|
||||
public SameBoyColorChooserForm(IMainFormForConfig mainForm, IGameInfo game, Config config, Sameboy.SameboySettings settings)
|
||||
public IDialogController DialogController { get; }
|
||||
|
||||
public SameBoyColorChooserForm(
|
||||
Config config,
|
||||
IDialogController dialogController,
|
||||
IGameInfo game,
|
||||
IMainFormForConfig mainForm,
|
||||
Sameboy.SameboySettings settings)
|
||||
{
|
||||
_mainForm = mainForm;
|
||||
_game = game;
|
||||
_config = config;
|
||||
_settings = settings;
|
||||
DialogController = dialogController;
|
||||
InitializeComponent();
|
||||
SetAllColors(_settings.GetCustomPalette());
|
||||
}
|
||||
|
@ -228,7 +236,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (alert)
|
||||
{
|
||||
_mainForm.ModalMessageBox("Error loading .pal file!");
|
||||
this.ModalMessageBox("Error loading .pal file!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -249,7 +257,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
catch
|
||||
{
|
||||
_mainForm.ModalMessageBox("Error saving .pal file!");
|
||||
this.ModalMessageBox("Error saving .pal file!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
|
@ -71,7 +72,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Close();
|
||||
}
|
||||
|
||||
public static DialogResult DoDialog(IEmulator emulator, IMainFormForConfig owner, string title, bool isMovieActive)
|
||||
public static DialogResult DoDialog(IEmulator emulator, IDialogParent owner, string title, bool isMovieActive)
|
||||
{
|
||||
if (emulator is Emulation.Cores.Waterbox.NymaCore core)
|
||||
{
|
||||
|
@ -109,7 +110,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
public static DialogResult DoDialog(
|
||||
IMainFormForConfig owner,
|
||||
IDialogParent owner,
|
||||
string title,
|
||||
bool isMovieActive,
|
||||
bool hideSettings,
|
||||
|
|
|
@ -9,7 +9,7 @@ using BizHawk.Emulation.Cores.Nintendo.NES;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class NESGraphicsConfig : Form
|
||||
public partial class NESGraphicsConfig : Form, IDialogParent
|
||||
{
|
||||
// TODO:
|
||||
// Allow selection of palette file from archive
|
||||
|
@ -20,14 +20,18 @@ namespace BizHawk.Client.EmuHawk
|
|||
private NES.NESSettings _settings;
|
||||
//private Bitmap _bmp;
|
||||
|
||||
public IDialogController DialogController { get; }
|
||||
|
||||
public NESGraphicsConfig(
|
||||
IMainFormForConfig mainForm,
|
||||
Config config,
|
||||
IDialogController dialogController,
|
||||
IMainFormForConfig mainForm,
|
||||
NES.NESSettings settings)
|
||||
{
|
||||
_mainForm = mainForm;
|
||||
_config = config;
|
||||
_settings = settings;
|
||||
DialogController = dialogController;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
@ -108,7 +112,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
var data = Palettes.Load_FCEUX_Palette(palette.ReadAllBytes());
|
||||
if (showMsg)
|
||||
{
|
||||
_mainForm.DialogController.AddOnScreenMessage($"Palette file loaded: {palette.Name}");
|
||||
DialogController.AddOnScreenMessage($"Palette file loaded: {palette.Name}");
|
||||
}
|
||||
|
||||
return data;
|
||||
|
@ -120,7 +124,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// no filename: interpret this as "reset to default"
|
||||
if (showMsg)
|
||||
{
|
||||
_mainForm.DialogController.AddOnScreenMessage("Standard Palette set");
|
||||
DialogController.AddOnScreenMessage("Standard Palette set");
|
||||
}
|
||||
|
||||
return (byte[,])Palettes.QuickNESPalette.Clone();
|
||||
|
|
|
@ -18,13 +18,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
public IDialogController DialogController { get; }
|
||||
|
||||
public NESSyncSettingsForm(
|
||||
IDialogController dialogController,
|
||||
IMainFormForConfig mainForm,
|
||||
NES.NESSyncSettings syncSettings,
|
||||
bool hasMapperProperties)
|
||||
{
|
||||
_mainForm = mainForm;
|
||||
_syncSettings = syncSettings;
|
||||
DialogController = mainForm.DialogController;
|
||||
DialogController = dialogController;
|
||||
InitializeComponent();
|
||||
HelpBtn.Image = Properties.Resources.Help;
|
||||
|
||||
|
|
|
@ -7,14 +7,17 @@ using BizHawk.Client.Common;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class PSXOptions : Form
|
||||
public partial class PSXOptions : Form, IDialogParent
|
||||
{
|
||||
// backups of the labels for string replacing
|
||||
private readonly string _lblPixelProText, _lblMednafenText, _lblTweakedMednafenText;
|
||||
|
||||
|
||||
public IDialogController DialogController { get; }
|
||||
|
||||
private PSXOptions(
|
||||
IMainFormForConfig mainForm,
|
||||
Config config,
|
||||
IDialogController dialogController,
|
||||
IMainFormForConfig mainForm,
|
||||
Octoshock.Settings settings,
|
||||
Octoshock.SyncSettings syncSettings,
|
||||
OctoshockDll.eVidStandard vidStandard,
|
||||
|
@ -27,6 +30,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_syncSettings = syncSettings;
|
||||
_previewVideoStandard = vidStandard;
|
||||
_previewVideoSize = currentVideoSize;
|
||||
DialogController = dialogController;
|
||||
|
||||
if (_previewVideoStandard == OctoshockDll.eVidStandard.NTSC)
|
||||
{
|
||||
|
@ -73,19 +77,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void BtnNiceDisplayConfig_Click(object sender, EventArgs e)
|
||||
{
|
||||
_dispSettingsSet = true;
|
||||
_mainForm.DialogController.ShowMessageBox("Finetuned Display Options will take effect if you OK from PSX Options");
|
||||
DialogController.ShowMessageBox("Finetuned Display Options will take effect if you OK from PSX Options");
|
||||
}
|
||||
|
||||
public static DialogResult DoSettingsDialog(IMainFormForConfig mainForm, Config config, Octoshock psx)
|
||||
public static DialogResult DoSettingsDialog(
|
||||
Config config,
|
||||
IDialogParent dialogParent,
|
||||
IMainFormForConfig mainForm,
|
||||
Octoshock psx)
|
||||
{
|
||||
var s = psx.GetSettings();
|
||||
var ss = psx.GetSyncSettings();
|
||||
var vid = psx.SystemVidStandard;
|
||||
var size = psx.CurrentVideoSize;
|
||||
using var dlg = new PSXOptions(mainForm, config, s, ss, vid, size);
|
||||
|
||||
var result = mainForm.ShowDialogAsChild(dlg);
|
||||
return result;
|
||||
using var dlg = new PSXOptions(config, dialogParent.DialogController, mainForm, s, ss, vid, size);
|
||||
return dialogParent.ShowDialogAsChild(dlg);
|
||||
}
|
||||
|
||||
private void SyncSettingsFromGui(Octoshock.Settings settings, Octoshock.SyncSettings syncSettings)
|
||||
|
@ -188,7 +194,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void LinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
_mainForm.DialogController.ShowMessageBox($@"These options control BizHawk's Display Options to make it act quite a lot like Mednafen:
|
||||
DialogController.ShowMessageBox($@"These options control BizHawk's Display Options to make it act quite a lot like Mednafen:
|
||||
|
||||
{nameof(_config.DispManagerAR)} = System (Use emulator-recommended AR)
|
||||
{nameof(_config.DispFixAspectRatio)} = true (Maintain aspect ratio [letterbox main window as needed])
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Cores.Nintendo.BSNES;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
|
@ -11,7 +13,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
public static DialogResult DoSettingsDialog(IMainFormForConfig mainForm, BsnesCore bsnes)
|
||||
public static DialogResult DoSettingsDialog(IDialogParent dialogParent, IMainFormForConfig mainForm, BsnesCore bsnes)
|
||||
{
|
||||
var s = bsnes.GetSettings();
|
||||
var ss = bsnes.GetSyncSettings();
|
||||
|
@ -40,7 +42,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
ShowBg4_1 = s.ShowBG4_1
|
||||
};
|
||||
|
||||
DialogResult result = mainForm.ShowDialogAsChild(dlg);
|
||||
var result = dialogParent.ShowDialogAsChild(dlg);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
s.AlwaysDoubleSize = dlg.AlwaysDoubleSize;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Cores.Nintendo.SNES;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
|
@ -14,7 +16,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private bool _suppressDoubleSize;
|
||||
private bool _userDoubleSizeOption;
|
||||
|
||||
public static DialogResult DoSettingsDialog(IMainFormForConfig mainForm, LibsnesCore bsnes)
|
||||
public static DialogResult DoSettingsDialog(IDialogParent dialogParent, IMainFormForConfig mainForm, LibsnesCore bsnes)
|
||||
{
|
||||
var s = bsnes.GetSettings();
|
||||
var ss = bsnes.GetSyncSettings();
|
||||
|
@ -33,7 +35,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
ShowBg4 = s.ShowBG4_0
|
||||
};
|
||||
|
||||
var result = mainForm.ShowDialogAsChild(dlg);
|
||||
var result = dialogParent.ShowDialogAsChild(dlg);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
s.AlwaysDoubleSize = dlg.AlwaysDoubleSize;
|
||||
|
|
|
@ -7,18 +7,22 @@ using BizHawk.Emulation.Cores.Computers.SinclairSpectrum;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class ZxSpectrumJoystickSettings : Form
|
||||
public partial class ZxSpectrumJoystickSettings : Form, IDialogParent
|
||||
{
|
||||
private readonly IMainFormForConfig _mainForm;
|
||||
private readonly ZXSpectrum.ZXSpectrumSyncSettings _syncSettings;
|
||||
private string[] _possibleControllers;
|
||||
|
||||
public IDialogController DialogController { get; }
|
||||
|
||||
public ZxSpectrumJoystickSettings(
|
||||
IDialogController dialogController,
|
||||
IMainFormForConfig mainForm,
|
||||
ZXSpectrum.ZXSpectrumSyncSettings syncSettings)
|
||||
{
|
||||
_mainForm = mainForm;
|
||||
_syncSettings = syncSettings;
|
||||
DialogController = dialogController;
|
||||
InitializeComponent();
|
||||
Icon = Properties.Resources.GameControllerIcon;
|
||||
}
|
||||
|
@ -110,7 +114,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
_mainForm.DialogController.ShowMessageBox("Invalid joystick configuration. \nDuplicates have automatically been changed to NULL.\n\nPlease review the configuration");
|
||||
DialogController.ShowMessageBox("Invalid joystick configuration. \nDuplicates have automatically been changed to NULL.\n\nPlease review the configuration");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue