ti83 keypad and toolbox moved to ToolManager

This commit is contained in:
adelikat 2013-11-03 00:31:16 +00:00
parent 35f2dcfd77
commit bd4548ae4f
5 changed files with 29 additions and 61 deletions

View File

@ -1142,15 +1142,13 @@ namespace BizHawk.MultiClient
TAStudioMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["TAStudio"].Bindings; TAStudioMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["TAStudio"].Bindings;
VirtualPadMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Virtual Pad"].Bindings; VirtualPadMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Virtual Pad"].Bindings;
TraceLoggerMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Trace Logger"].Bindings; TraceLoggerMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Trace Logger"].Bindings;
ToolBoxMenuItem.Enabled = !ToolBox1.IsHandleCreated || ToolBox1.IsDisposed;
TraceLoggerMenuItem.Enabled = Global.Emulator.CoreComm.CpuTraceAvailable; TraceLoggerMenuItem.Enabled = Global.Emulator.CoreComm.CpuTraceAvailable;
CheatsMenuItem.Enabled = !(Global.Emulator is NullEmulator); CheatsMenuItem.Enabled = !(Global.Emulator is NullEmulator);
} }
private void ToolBoxMenuItem_Click(object sender, EventArgs e) private void ToolBoxMenuItem_Click(object sender, EventArgs e)
{ {
LoadToolBox(); GlobalWinF.Tools.Load<ToolBox>();
} }
private void RamWatchMenuItem_Click(object sender, EventArgs e) private void RamWatchMenuItem_Click(object sender, EventArgs e)
@ -1362,7 +1360,7 @@ namespace BizHawk.MultiClient
{ {
if (Global.Emulator is TI83) if (Global.Emulator is TI83)
{ {
LoadTI83KeyPad(); GlobalWinF.Tools.Load<TI83KeyPad>();
} }
} }

View File

@ -84,14 +84,6 @@ namespace BizHawk.MultiClient
private bool InFullscreen; private bool InFullscreen;
private Point _windowed_location; private Point _windowed_location;
//tool dialogs
private ToolBox _toolbox;
private TI83KeyPad _ti83pad;
//TODO: this is a lazy way to refactor things, but works for now. The point is to not have these objects created until needed, without refactoring a lot of code
public ToolBox ToolBox1 { get { if (_toolbox == null) _toolbox = new ToolBox(); return _toolbox; } set { _toolbox = value; } }
public TI83KeyPad TI83KeyPad1 { get { if (_ti83pad == null) _ti83pad = new TI83KeyPad(); return _ti83pad; } set { _ti83pad = value; } }
//TODO: clean me up //TODO: clean me up
public void Cheats_Restart() public void Cheats_Restart()
{ {
@ -195,6 +187,9 @@ namespace BizHawk.MultiClient
CloseGame(); CloseGame();
Global.MovieSession.Movie.Stop(); Global.MovieSession.Movie.Stop();
GlobalWinF.Tools.Close(); GlobalWinF.Tools.Close();
#if WINDOWS
CloseForm(LuaConsole1);
#endif
SaveConfig(); SaveConfig();
}; };
@ -1280,7 +1275,9 @@ namespace BizHawk.MultiClient
case "TI83": case "TI83":
nextEmulator = new TI83(nextComm, game, rom.RomData); nextEmulator = new TI83(nextComm, game, rom.RomData);
if (Global.Config.TI83autoloadKeyPad) if (Global.Config.TI83autoloadKeyPad)
LoadTI83KeyPad(); {
GlobalWinF.Tools.Load<TI83KeyPad>();
}
break; break;
case "NES": case "NES":
{ {
@ -1565,21 +1562,16 @@ namespace BizHawk.MultiClient
Global.Config.RecentRoms.Add(file.CanonicalFullPath); Global.Config.RecentRoms.Add(file.CanonicalFullPath);
if (File.Exists(PathManager.SaveRamPath(game))) if (File.Exists(PathManager.SaveRamPath(game)))
{
LoadSaveRam(); LoadSaveRam();
}
if (Global.Config.AutoSavestates) if (Global.Config.AutoSavestates)
{
LoadState("Auto"); LoadState("Auto");
}
////setup the throttle based on platform's specifications
////(one day later for some systems we will need to modify it at runtime as the display mode changes)
//{
// throttle.SetCoreFps(Global.Emulator.CoreComm.VsyncRate);
// SyncThrottle();
//}
GlobalWinF.Tools.Restart(); GlobalWinF.Tools.Restart();
if (_ti83pad != null) TI83KeyPad1.Restart();
Cheats_Restart(); Cheats_Restart();
if (_toolbox != null) ToolBox1.Restart();
if (Global.Config.LoadCheatFileByGame) if (Global.Config.LoadCheatFileByGame)
{ {
@ -2066,7 +2058,7 @@ namespace BizHawk.MultiClient
case "Lua Console": OpenLuaConsole(); break; case "Lua Console": OpenLuaConsole(); break;
case "Cheats": GlobalWinF.Tools.Load<Cheats>(); break; case "Cheats": GlobalWinF.Tools.Load<Cheats>(); break;
case "TAStudio": LoadTAStudio(); break; case "TAStudio": LoadTAStudio(); break;
case "ToolBox": LoadToolBox(); break; case "ToolBox": GlobalWinF.Tools.Load<ToolBox>(); break;
case "Virtual Pad": GlobalWinF.Tools.Load<VirtualPadForm>(); break; case "Virtual Pad": GlobalWinF.Tools.Load<VirtualPadForm>(); break;
case "Do Search": GlobalWinF.Tools.RamSearch.DoSearch(); break; case "Do Search": GlobalWinF.Tools.RamSearch.DoSearch(); break;
@ -2556,28 +2548,6 @@ namespace BizHawk.MultiClient
} }
} }
public void LoadToolBox()
{
if (!ToolBox1.IsHandleCreated || ToolBox1.IsDisposed)
{
ToolBox1 = new ToolBox();
ToolBox1.Show();
}
else
ToolBox1.Close();
}
public void LoadTI83KeyPad()
{
if (!TI83KeyPad1.IsHandleCreated || TI83KeyPad1.IsDisposed)
{
TI83KeyPad1 = new TI83KeyPad();
TI83KeyPad1.Show();
}
else
TI83KeyPad1.Focus();
}
public VideoPluginSettings N64GenerateVideoSettings(GameInfo game, bool hasmovie) public VideoPluginSettings N64GenerateVideoSettings(GameInfo game, bool hasmovie)
{ {
string PluginToUse = ""; string PluginToUse = "";
@ -2913,9 +2883,7 @@ namespace BizHawk.MultiClient
RewireSound(); RewireSound();
ResetRewindBuffer(); ResetRewindBuffer();
TI83KeyPad1.Restart();
Cheats_Restart(); Cheats_Restart();
ToolBox1.Restart();
#if WINDOWS #if WINDOWS
LuaConsole1.Restart(); LuaConsole1.Restart();
#endif #endif
@ -2944,14 +2912,6 @@ namespace BizHawk.MultiClient
ConfigService.Save(PathManager.DefaultIniPath, Global.Config); ConfigService.Save(PathManager.DefaultIniPath, Global.Config);
} }
public void CloseTools()
{
CloseForm(TI83KeyPad1);
#if WINDOWS
CloseForm(LuaConsole1);
#endif
}
private void CloseForm(Form form) private void CloseForm(Form form)
{ {
if (form != null && form.IsHandleCreated) form.Close(); if (form != null && form.IsHandleCreated) form.Close();
@ -3017,7 +2977,6 @@ namespace BizHawk.MultiClient
{ {
GlobalWinF.OSD.AddMessage("No movie active"); GlobalWinF.OSD.AddMessage("No movie active");
} }
} }
public void LoadTAStudio() public void LoadTAStudio()

View File

@ -142,7 +142,7 @@ namespace BizHawk.MultiClient
public static void client_opentoolbox() public static void client_opentoolbox()
{ {
GlobalWinF.MainForm.LoadToolBox(); GlobalWinF.Tools.Load<ToolBox>();
} }
public static void client_opentracelogger() public static void client_opentracelogger()

View File

@ -7,10 +7,13 @@ using BizHawk.Client.Common;
namespace BizHawk.MultiClient namespace BizHawk.MultiClient
{ {
public partial class TI83KeyPad : Form public partial class TI83KeyPad : Form, IToolForm
{ {
//TODO: if wndx/wndy are negative, load window on the right edge of emulator window //TODO: if wndx/wndy are negative, load window on the right edge of emulator window
public bool AskSave() { return true; }
public bool UpdateBefore { get { return false; } }
public TI83KeyPad() public TI83KeyPad()
{ {
InitializeComponent(); InitializeComponent();
@ -91,13 +94,18 @@ namespace BizHawk.MultiClient
public void UpdateValues() public void UpdateValues()
{ {
if (!(Global.Emulator is TI83))
{
Close();
}
} }
public void Restart() public void Restart()
{ {
if (!(Global.Emulator is TI83)) if (!(Global.Emulator is TI83))
{
Close(); Close();
if (!IsHandleCreated || IsDisposed) return; }
} }
private void exitToolStripMenuItem_Click(object sender, EventArgs e) private void exitToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -10,7 +10,7 @@ using BizHawk.Emulation.Consoles.Sega;
namespace BizHawk.MultiClient namespace BizHawk.MultiClient
{ {
public partial class ToolBox : Form public partial class ToolBox : Form, IToolForm
{ {
public ToolBox() public ToolBox()
{ {
@ -25,6 +25,9 @@ namespace BizHawk.MultiClient
HideShowIcons(); HideShowIcons();
} }
public bool AskSave() { return true; }
public bool UpdateBefore { get { return false; } }
public void UpdateValues() { }
public void Restart() public void Restart()
{ {
HideShowIcons(); HideShowIcons();
@ -135,7 +138,7 @@ namespace BizHawk.MultiClient
{ {
if (Global.Emulator is TI83) if (Global.Emulator is TI83)
{ {
GlobalWinF.MainForm.LoadTI83KeyPad(); GlobalWinF.Tools.Load<TI83KeyPad>();
} }
} }