TI83 settings - pass in dependencies

This commit is contained in:
adelikat 2019-12-16 17:58:50 -06:00
parent 4a332c1fb0
commit 7675e35d85
3 changed files with 21 additions and 16 deletions

View File

@ -2038,11 +2038,14 @@ namespace BizHawk.Client.EmuHawk
private void TI83PaletteMenuItem_Click(object sender, EventArgs e)
{
using var form = new TI83PaletteConfig();
if (Emulator is TI83 ti83)
{
using var form = new TI83PaletteConfig(this, ti83.GetSettings().Clone());
GlobalWin.OSD.AddMessage(form.ShowDialog() == DialogResult.OK
? "Palette settings saved"
: "Palette config aborted");
}
}
#endregion

View File

@ -1,36 +1,37 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Calculators;
namespace BizHawk.Client.EmuHawk
{
public partial class TI83PaletteConfig : Form
{
public TI83PaletteConfig()
private readonly MainForm _mainForm;
private readonly TI83.TI83Settings _settings;
public TI83PaletteConfig(
MainForm mainForm,
TI83.TI83Settings settings)
{
_mainForm = mainForm;
_settings = settings;
InitializeComponent();
}
private void TI83PaletteConfig_Load(object sender, EventArgs e)
{
var s = ((TI83)Global.Emulator).GetSettings();
// Alpha hack because Winform is lame with colors
BackgroundPanel.BackColor = Color.FromArgb(255, Color.FromArgb((int)s.BGColor));
ForeGroundPanel.BackColor = Color.FromArgb(255, Color.FromArgb((int)s.ForeColor));
BackgroundPanel.BackColor = Color.FromArgb(255, Color.FromArgb((int)_settings.BGColor));
ForeGroundPanel.BackColor = Color.FromArgb(255, Color.FromArgb((int)_settings.ForeColor));
}
private void OkBtn_Click(object sender, EventArgs e)
{
var ti83 = (TI83)Global.Emulator;
var s = ti83.GetSettings();
s.BGColor = (uint)BackgroundPanel.BackColor.ToArgb();
s.ForeColor = (uint)ForeGroundPanel.BackColor.ToArgb();
_settings.BGColor = (uint)BackgroundPanel.BackColor.ToArgb();
_settings.ForeColor = (uint)ForeGroundPanel.BackColor.ToArgb();
ti83.PutSettings(s);
_mainForm.PutCoreSettings(_settings);
DialogResult = DialogResult.OK;
Close();

View File

@ -251,6 +251,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Hotkey/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Hotkeys/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Intelli/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ints/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=INTV/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Joypad/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Justifier/@EntryIndexedValue">True</s:Boolean>