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

View File

@ -1,36 +1,37 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Calculators; using BizHawk.Emulation.Cores.Calculators;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class TI83PaletteConfig : Form 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(); InitializeComponent();
} }
private void TI83PaletteConfig_Load(object sender, EventArgs e) private void TI83PaletteConfig_Load(object sender, EventArgs e)
{ {
var s = ((TI83)Global.Emulator).GetSettings();
// Alpha hack because Winform is lame with colors // Alpha hack because Winform is lame with colors
BackgroundPanel.BackColor = Color.FromArgb(255, Color.FromArgb((int)s.BGColor)); BackgroundPanel.BackColor = Color.FromArgb(255, Color.FromArgb((int)_settings.BGColor));
ForeGroundPanel.BackColor = Color.FromArgb(255, Color.FromArgb((int)s.ForeColor)); ForeGroundPanel.BackColor = Color.FromArgb(255, Color.FromArgb((int)_settings.ForeColor));
} }
private void OkBtn_Click(object sender, EventArgs e) private void OkBtn_Click(object sender, EventArgs e)
{ {
var ti83 = (TI83)Global.Emulator; _settings.BGColor = (uint)BackgroundPanel.BackColor.ToArgb();
var s = ti83.GetSettings(); _settings.ForeColor = (uint)ForeGroundPanel.BackColor.ToArgb();
s.BGColor = (uint)BackgroundPanel.BackColor.ToArgb();
s.ForeColor = (uint)ForeGroundPanel.BackColor.ToArgb();
ti83.PutSettings(s); _mainForm.PutCoreSettings(_settings);
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); 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/=Hotkey/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Hotkeys/@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/=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/=INTV/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Joypad/@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> <s:Boolean x:Key="/Default/UserDictionary/Words/=Justifier/@EntryIndexedValue">True</s:Boolean>