Rework ToolHelpers from a static object to ToolFormBase that inherits form and have a lot of tools inherit it, in hopes of moving a lot of copy pasta into a base class, move a few functions that show up a lot there
This commit is contained in:
parent
a990e3a2f2
commit
894a9c2318
|
@ -560,7 +560,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
filename = PathManager.FilesystemSafeName(Global.Game);
|
||||
}
|
||||
|
||||
var file = ToolHelpers.SaveFileDialog(
|
||||
var file = ToolFormBase.SaveFileDialog(
|
||||
filename,
|
||||
PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null),
|
||||
"Movie Files",
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
PlayRecordStatusButton.Visible = false;
|
||||
AVIStatusLabel.Visible = false;
|
||||
SetPauseStatusbarIcon();
|
||||
ToolHelpers.UpdateCheatRelatedTools(null, null);
|
||||
ToolFormBase.UpdateCheatRelatedTools(null, null);
|
||||
RebootStatusBarIcon.Visible = false;
|
||||
UpdateNotification.Visible = false;
|
||||
StatusBarDiskLightOnImage = Properties.Resources.LightOn;
|
||||
|
@ -123,7 +123,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_throttle = new Throttle();
|
||||
|
||||
Global.CheatList = new CheatCollection();
|
||||
Global.CheatList.Changed += ToolHelpers.UpdateCheatRelatedTools;
|
||||
Global.CheatList.Changed += ToolFormBase.UpdateCheatRelatedTools;
|
||||
|
||||
UpdateStatusSlots();
|
||||
UpdateKeyPriorityIcon();
|
||||
|
@ -3465,7 +3465,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Global.AutofireStickyXORAdapter.ClearStickies();
|
||||
|
||||
RewireSound();
|
||||
ToolHelpers.UpdateCheatRelatedTools(null, null);
|
||||
ToolFormBase.UpdateCheatRelatedTools(null, null);
|
||||
if (Global.Config.AutoLoadLastSaveSlot && _stateSlots.HasSlot(Global.Config.SaveSlot))
|
||||
{
|
||||
LoadQuickSave("QuickSave" + Global.Config.SaveSlot);
|
||||
|
@ -3594,7 +3594,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
UpdateCoreStatusBarButton();
|
||||
ClearHolds();
|
||||
PauseOnFrame = null;
|
||||
ToolHelpers.UpdateCheatRelatedTools(null, null);
|
||||
ToolFormBase.UpdateCheatRelatedTools(null, null);
|
||||
UpdateStatusSlots();
|
||||
CurrentlyOpenRom = null;
|
||||
CurrentlyOpenRomArgs = null;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,17 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Common.IEmulatorExtensions;
|
||||
|
||||
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
|
||||
using BizHawk.Emulation.Cores.Components.H6280;
|
||||
using BizHawk.Emulation.Cores.PCEngine;
|
||||
using BizHawk.Emulation.Cores.Consoles.Sega;
|
||||
using BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Client.EmuHawk.ToolExtensions;
|
||||
|
@ -26,7 +18,7 @@ using BizHawk.Client.EmuHawk.ToolExtensions;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class CDL : Form, IToolFormAutoConfig
|
||||
public partial class CDL : ToolFormBase, IToolFormAutoConfig
|
||||
{
|
||||
private RecentFiles _recent_fld = new RecentFiles();
|
||||
|
||||
|
@ -271,7 +263,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void OpenMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var file = ToolHelpers.OpenFileDialog(
|
||||
var file = OpenFileDialog(
|
||||
_currentFilename,
|
||||
PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null),
|
||||
"Code Data Logger Files",
|
||||
|
@ -313,7 +305,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
var file = ToolHelpers.SaveFileDialog(
|
||||
var file = SaveFileDialog(
|
||||
_currentFilename,
|
||||
PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null),
|
||||
"Code Data Logger Files",
|
||||
|
@ -344,7 +336,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
var file = ToolHelpers.OpenFileDialog(
|
||||
var file = ToolFormBase.OpenFileDialog(
|
||||
_currentFilename,
|
||||
PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null),
|
||||
"Code Data Logger Files",
|
||||
|
|
|
@ -13,7 +13,7 @@ using BizHawk.Client.EmuHawk.WinFormExtensions;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class Cheats : Form, IToolForm
|
||||
public partial class Cheats : ToolFormBase, IToolForm
|
||||
{
|
||||
private const string NAME = "NamesColumn";
|
||||
private const string ADDRESS = "AddressColumn";
|
||||
|
@ -136,7 +136,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private static bool SaveAs()
|
||||
{
|
||||
var file = ToolHelpers.SaveFileDialog(
|
||||
var file = SaveFileDialog(
|
||||
Global.CheatList.CurrentFileName,
|
||||
PathManager.GetCheatsPath(Global.Game),
|
||||
"Cheat Files",
|
||||
|
@ -160,8 +160,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void ColumnToggleCallback()
|
||||
{
|
||||
SaveColumnInfo();
|
||||
LoadColumnInfo();
|
||||
SaveColumnInfo(CheatListView, Settings.Columns);
|
||||
LoadColumnInfo(CheatListView, Settings.Columns);
|
||||
}
|
||||
|
||||
private void ToggleGameGenieButton()
|
||||
|
@ -187,7 +187,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void SaveConfigSettings()
|
||||
{
|
||||
SaveColumnInfo();
|
||||
SaveColumnInfo(CheatListView, Settings.Columns);
|
||||
|
||||
if (WindowState == FormWindowState.Normal)
|
||||
{
|
||||
|
@ -213,37 +213,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
Size = Settings.WindowSize;
|
||||
}
|
||||
|
||||
LoadColumnInfo();
|
||||
}
|
||||
|
||||
private void LoadColumnInfo()
|
||||
{
|
||||
CheatListView.Columns.Clear();
|
||||
|
||||
var columns = Settings.Columns
|
||||
.Where(c => c.Visible)
|
||||
.OrderBy(c => c.Index);
|
||||
|
||||
foreach (var column in columns)
|
||||
{
|
||||
CheatListView.AddColumn(column);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveColumnInfo()
|
||||
{
|
||||
foreach (ColumnHeader column in CheatListView.Columns)
|
||||
{
|
||||
Settings.Columns[column.Name].Index = column.DisplayIndex;
|
||||
Settings.Columns[column.Name].Width = column.Width;
|
||||
}
|
||||
LoadColumnInfo(CheatListView, Settings.Columns);
|
||||
}
|
||||
|
||||
private void DoColumnToggle(string column)
|
||||
{
|
||||
Settings.Columns[column].Visible ^= true;
|
||||
SaveColumnInfo();
|
||||
LoadColumnInfo();
|
||||
SaveColumnInfo(CheatListView, Settings.Columns);
|
||||
LoadColumnInfo(CheatListView, Settings.Columns);
|
||||
}
|
||||
|
||||
private void CheatListView_QueryItemText(int index, int column, out string text)
|
||||
|
@ -385,14 +362,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void OpenMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var append = sender == AppendMenuItem;
|
||||
var file = ToolHelpers.OpenFileDialog(
|
||||
var file = OpenFileDialog(
|
||||
Global.CheatList.CurrentFileName,
|
||||
PathManager.GetCheatsPath(Global.Game),
|
||||
"Cheat Files",
|
||||
"cht");
|
||||
|
||||
LoadFile(file, append);
|
||||
LoadFile(file, append: sender == AppendMenuItem);
|
||||
}
|
||||
|
||||
private void SaveMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -617,7 +593,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Global.Config.CheatsAutoSaveOnClose = true;
|
||||
|
||||
RefreshFloatingWindowControl();
|
||||
LoadColumnInfo();
|
||||
LoadColumnInfo(CheatListView, Settings.Columns);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -699,11 +675,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (selected.Select(x => x.Domain).Distinct().Count() > 1)
|
||||
{
|
||||
ToolHelpers.ViewInHexEditor(selected[0].Domain, new List<long> { selected.First().Address ?? 0 }, selected.First().Size);
|
||||
ViewInHexEditor(selected[0].Domain, new List<long> { selected.First().Address ?? 0 }, selected.First().Size);
|
||||
}
|
||||
else
|
||||
{
|
||||
ToolHelpers.ViewInHexEditor(selected.First().Domain, selected.Select(x => x.Address ?? 0), selected.First().Size);
|
||||
ViewInHexEditor(selected.First().Domain, selected.Select(x => x.Address ?? 0), selected.First().Size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ using BizHawk.Client.EmuHawk.ToolExtensions;
|
|||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
// int to long TODO: 32 bit domains have more digits than the hex editor can account for and the address covers up the 0 column
|
||||
public partial class HexEditor : Form, IToolFormAutoConfig
|
||||
public partial class HexEditor : ToolFormBase, IToolFormAutoConfig
|
||||
{
|
||||
[RequiredService]
|
||||
private IMemoryDomains MemoryDomains { get; set; }
|
||||
|
@ -1589,7 +1589,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
ToolHelpers.UpdateCheatRelatedTools(null, null);
|
||||
UpdateCheatRelatedTools(null, null);
|
||||
MemoryViewerBox.Refresh();
|
||||
}
|
||||
|
||||
|
|
|
@ -825,7 +825,7 @@
|
|||
this.Text = "Lua Console";
|
||||
this.Load += new System.EventHandler(this.LuaConsole_Load);
|
||||
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.LuaConsole_DragDrop);
|
||||
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.LuaConsole_DragEnter);
|
||||
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.GenericDragEnter);
|
||||
this.ScriptListContextMenu.ResumeLayout(false);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
|
|
|
@ -7,17 +7,13 @@ using System.Linq;
|
|||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using LuaInterface;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Common.IEmulatorExtensions;
|
||||
using BizHawk.Client.EmuHawk.WinFormExtensions;
|
||||
using BizHawk.Client.EmuHawk.ToolExtensions;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class LuaConsole : Form, IToolFormAutoConfig
|
||||
public partial class LuaConsole : ToolFormBase, IToolFormAutoConfig
|
||||
{
|
||||
private readonly LuaFileList _luaList;
|
||||
private bool _sortReverse;
|
||||
|
@ -64,7 +60,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (AskSaveChanges())
|
||||
{
|
||||
SaveColumnInfo();
|
||||
SaveColumnInfo(LuaListView, Settings.Columns);
|
||||
CloseLua();
|
||||
GlobalWin.DisplayManager.ClearLuaSurfaces();
|
||||
}
|
||||
|
@ -131,30 +127,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
LoadColumnInfo();
|
||||
}
|
||||
|
||||
private void LoadColumnInfo()
|
||||
{
|
||||
LuaListView.Columns.Clear();
|
||||
|
||||
var columns = Settings.Columns
|
||||
.Where(c => c.Visible)
|
||||
.OrderBy(c => c.Index);
|
||||
|
||||
foreach (var column in columns)
|
||||
{
|
||||
LuaListView.AddColumn(column);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveColumnInfo()
|
||||
{
|
||||
foreach (ColumnHeader column in LuaListView.Columns)
|
||||
{
|
||||
Settings.Columns[column.Name].Index = column.DisplayIndex;
|
||||
Settings.Columns[column.Name].Width = column.Width;
|
||||
}
|
||||
LoadColumnInfo(LuaListView, Settings.Columns);
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
|
@ -1096,11 +1069,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void LuaConsole_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
}
|
||||
|
||||
private void LuaListView_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Delete && !e.Control && !e.Alt && !e.Shift)
|
||||
|
|
|
@ -1526,7 +1526,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Tastudio_Closing);
|
||||
this.Load += new System.EventHandler(this.Tastudio_Load);
|
||||
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.TAStudio_DragDrop);
|
||||
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.TAStudio_DragEnter);
|
||||
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.GenericDragEnter);
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TAStudio_KeyDown);
|
||||
this.MouseLeave += new System.EventHandler(this.TAStudio_MouseLeave);
|
||||
this.TASMenu.ResumeLayout(false);
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Common.IEmulatorExtensions;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Client.Common.MovieConversionExtensions;
|
||||
using BizHawk.Client.EmuHawk.ToolExtensions;
|
||||
|
@ -60,7 +56,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
filename = string.Empty;
|
||||
}
|
||||
|
||||
var file = ToolHelpers.OpenFileDialog(
|
||||
var file = OpenFileDialog(
|
||||
filename,
|
||||
PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null),
|
||||
"Tas Project Files",
|
||||
|
@ -104,7 +100,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
filename = SuggestedTasProjName();
|
||||
}
|
||||
|
||||
var file = ToolHelpers.SaveFileDialog(
|
||||
var file = SaveFileDialog(
|
||||
filename,
|
||||
PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null),
|
||||
"Tas Project Files",
|
||||
|
|
|
@ -17,7 +17,7 @@ using BizHawk.Client.EmuHawk.ToolExtensions;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class TAStudio : Form, IToolFormAutoConfig, IControlMainform
|
||||
public partial class TAStudio : ToolFormBase, IToolFormAutoConfig, IControlMainform
|
||||
{
|
||||
// TODO: UI flow that conveniently allows to start from savestate
|
||||
private const string CursorColumnName = "CursorColumn";
|
||||
|
@ -839,11 +839,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
SetTextProperty();
|
||||
}
|
||||
|
||||
private void TAStudio_DragEnter(object sender, DragEventArgs e)
|
||||
private void LuaConsole_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
}
|
||||
|
||||
private void TAStudio_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (!AskSaveChanges())
|
||||
|
|
|
@ -12,7 +12,7 @@ using BizHawk.Client.EmuHawk.WinFormExtensions;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public static class ToolHelpers
|
||||
public class ToolFormBase : Form
|
||||
{
|
||||
public static FileInfo OpenFileDialog(string currentFile, string path, string fileType, string fileExt)
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public static FileInfo GetWatchSaveFileFromUser(string currentFile)
|
||||
{
|
||||
return SaveFileDialog(currentFile, PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPathFragment, null), "Watch Files", "wch");
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateCheatRelatedTools(object sender, CheatCollection.CheatListEventArgs e)
|
||||
{
|
||||
|
@ -98,5 +98,33 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.Tools.Load<HexEditor>();
|
||||
GlobalWin.Tools.HexEditor.SetToAddresses(addresses, domain, size);
|
||||
}
|
||||
|
||||
protected void GenericDragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
}
|
||||
|
||||
protected void LoadColumnInfo(VirtualListView listView, ToolDialogSettings.ColumnList columns)
|
||||
{
|
||||
listView.Columns.Clear();
|
||||
|
||||
var cl = columns
|
||||
.Where(c => c.Visible)
|
||||
.OrderBy(c => c.Index);
|
||||
|
||||
foreach (var column in cl)
|
||||
{
|
||||
listView.AddColumn(column);
|
||||
}
|
||||
}
|
||||
|
||||
protected void SaveColumnInfo(VirtualListView listview, ToolDialogSettings.ColumnList columns)
|
||||
{
|
||||
foreach (ColumnHeader column in listview.Columns)
|
||||
{
|
||||
columns[column.Name].Index = column.DisplayIndex;
|
||||
columns[column.Name].Width = column.Width;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@
|
|||
this.WatchListView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.WatchListView_ColumnClick);
|
||||
this.WatchListView.SelectedIndexChanged += new System.EventHandler(this.WatchListView_SelectedIndexChanged);
|
||||
this.WatchListView.DragDrop += new System.Windows.Forms.DragEventHandler(this.NewRamSearch_DragDrop);
|
||||
this.WatchListView.DragEnter += new System.Windows.Forms.DragEventHandler(this.NewRamSearch_DragEnter);
|
||||
this.WatchListView.DragEnter += new System.Windows.Forms.DragEventHandler(this.GenericDragEnter);
|
||||
this.WatchListView.Enter += new System.EventHandler(this.WatchListView_Enter);
|
||||
this.WatchListView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.WatchListView_KeyDown);
|
||||
this.WatchListView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.WatchListView_MouseDoubleClick);
|
||||
|
@ -1399,7 +1399,7 @@
|
|||
this.Activated += new System.EventHandler(this.NewRamSearch_Activated);
|
||||
this.Load += new System.EventHandler(this.RamSearch_Load);
|
||||
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.NewRamSearch_DragDrop);
|
||||
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.NewRamSearch_DragEnter);
|
||||
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.GenericDragEnter);
|
||||
this.ListViewContextMenu.ResumeLayout(false);
|
||||
this.RamSearchMenu.ResumeLayout(false);
|
||||
this.RamSearchMenu.PerformLayout();
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <summary>
|
||||
/// A form designed to search through ram values
|
||||
/// </summary>
|
||||
public partial class RamSearch : Form, IToolForm
|
||||
public partial class RamSearch : ToolFormBase, IToolForm
|
||||
{
|
||||
// TODO: DoSearch grabs the state of widgets and passes it to the engine before running, so rip out code that is attempting to keep the state up to date through change events
|
||||
|
||||
|
@ -115,8 +115,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void ColumnToggleCallback()
|
||||
{
|
||||
SaveColumnInfo();
|
||||
LoadColumnInfo();
|
||||
SaveColumnInfo(WatchListView, Settings.Columns);
|
||||
LoadColumnInfo(WatchListView, Settings.Columns);
|
||||
}
|
||||
|
||||
private void RamSearch_Load(object sender, EventArgs e)
|
||||
|
@ -244,7 +244,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
TopMost = Settings.TopMost;
|
||||
|
||||
LoadColumnInfo();
|
||||
LoadColumnInfo(WatchListView, Settings.Columns);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -312,7 +312,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void SaveConfigSettings()
|
||||
{
|
||||
SaveColumnInfo();
|
||||
SaveColumnInfo(WatchListView, Settings.Columns);
|
||||
|
||||
if (WindowState == FormWindowState.Normal)
|
||||
{
|
||||
|
@ -623,29 +623,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void LoadColumnInfo()
|
||||
{
|
||||
WatchListView.Columns.Clear();
|
||||
|
||||
var columns = Settings.Columns
|
||||
.Where(c => c.Visible)
|
||||
.OrderBy(c => c.Index);
|
||||
|
||||
foreach (var column in columns)
|
||||
{
|
||||
WatchListView.AddColumn(column);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveColumnInfo()
|
||||
{
|
||||
foreach (ColumnHeader column in WatchListView.Columns)
|
||||
{
|
||||
Settings.Columns[column.Name].Index = column.DisplayIndex;
|
||||
Settings.Columns[column.Name].Width = column.Width;
|
||||
}
|
||||
}
|
||||
|
||||
private void DoDisplayTypeClick(BizHawk.Client.Common.DisplayType type)
|
||||
{
|
||||
if (_settings.Type != type)
|
||||
|
@ -1021,7 +998,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void OpenMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadWatchFile(
|
||||
ToolHelpers.GetWatchFileFromUser(string.Empty),
|
||||
GetWatchFileFromUser(string.Empty),
|
||||
sender == AppendFileMenuItem,
|
||||
sender == TruncateFromFileMenuItem
|
||||
);
|
||||
|
@ -1048,7 +1025,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
var result = watches.SaveAs(ToolHelpers.GetWatchSaveFileFromUser(watches.CurrentFileName));
|
||||
var result = watches.SaveAs(ToolFormBase.GetWatchSaveFileFromUser(watches.CurrentFileName));
|
||||
if (result)
|
||||
{
|
||||
MessageLabel.Text = Path.GetFileName(_currentFileName) + " saved";
|
||||
|
@ -1066,7 +1043,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
watches.Add(_searches[i]);
|
||||
}
|
||||
|
||||
if (watches.SaveAs(ToolHelpers.GetWatchSaveFileFromUser(watches.CurrentFileName)))
|
||||
if (watches.SaveAs(ToolFormBase.GetWatchSaveFileFromUser(watches.CurrentFileName)))
|
||||
{
|
||||
_currentFileName = watches.CurrentFileName;
|
||||
MessageLabel.Text = Path.GetFileName(_currentFileName) + " saved";
|
||||
|
@ -1436,7 +1413,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
RefreshFloatingWindowControl();
|
||||
LoadColumnInfo();
|
||||
LoadColumnInfo(WatchListView, Settings.Columns);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1493,7 +1470,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (SelectedWatches.Any())
|
||||
{
|
||||
ToolHelpers.ViewInHexEditor(_searches.Domain, SelectedWatches.Select(x => x.Address), SelectedSize);
|
||||
ViewInHexEditor(_searches.Domain, SelectedWatches.Select(x => x.Address), SelectedSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1801,11 +1778,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
WatchListView.Refresh();
|
||||
}
|
||||
|
||||
private void NewRamSearch_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
}
|
||||
|
||||
private void NewRamSearch_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
|
|
|
@ -881,7 +881,7 @@
|
|||
this.WatchListView.SelectedIndexChanged += new System.EventHandler(this.WatchListView_SelectedIndexChanged);
|
||||
this.WatchListView.VirtualItemsSelectionRangeChanged += new System.Windows.Forms.ListViewVirtualItemsSelectionRangeChangedEventHandler(this.WatchListView_VirtualItemsSelectionRangeChanged);
|
||||
this.WatchListView.DragDrop += new System.Windows.Forms.DragEventHandler(this.NewRamWatch_DragDrop);
|
||||
this.WatchListView.DragEnter += new System.Windows.Forms.DragEventHandler(this.NewRamWatch_DragEnter);
|
||||
this.WatchListView.DragEnter += new System.Windows.Forms.DragEventHandler(this.GenericDragEnter);
|
||||
this.WatchListView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.WatchListView_KeyDown);
|
||||
this.WatchListView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.WatchListView_MouseDoubleClick);
|
||||
//
|
||||
|
@ -948,7 +948,7 @@
|
|||
this.Activated += new System.EventHandler(this.NewRamWatch_Activated);
|
||||
this.Load += new System.EventHandler(this.NewRamWatch_Load);
|
||||
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.NewRamWatch_DragDrop);
|
||||
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.NewRamWatch_DragEnter);
|
||||
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.GenericDragEnter);
|
||||
this.Enter += new System.EventHandler(this.NewRamWatch_Enter);
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.WatchListView_KeyDown);
|
||||
this.ListViewContextMenu.ResumeLayout(false);
|
||||
|
|
|
@ -7,7 +7,6 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Common.NumberExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Common.IEmulatorExtensions;
|
||||
|
||||
|
@ -17,7 +16,7 @@ using BizHawk.Client.EmuHawk.ToolExtensions;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class RamWatch : Form, IToolForm
|
||||
public partial class RamWatch : ToolFormBase, IToolForm
|
||||
{
|
||||
private WatchList _watches;
|
||||
|
||||
|
@ -455,20 +454,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void LoadColumnInfo()
|
||||
{
|
||||
WatchListView.Columns.Clear();
|
||||
|
||||
var columns = Settings.Columns
|
||||
.Where(c => c.Visible)
|
||||
.OrderBy(c => c.Index);
|
||||
|
||||
foreach (var column in columns)
|
||||
{
|
||||
WatchListView.AddColumn(column);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadConfigSettings()
|
||||
{
|
||||
// Size and Positioning
|
||||
|
@ -485,7 +470,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Size = Settings.WindowSize;
|
||||
}
|
||||
|
||||
LoadColumnInfo();
|
||||
LoadColumnInfo(WatchListView, Settings.Columns);
|
||||
}
|
||||
|
||||
private void NewWatchList(bool suppressAsk)
|
||||
|
@ -529,7 +514,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void SaveAs()
|
||||
{
|
||||
var result = _watches.SaveAs(ToolHelpers.GetWatchSaveFileFromUser(_watches.CurrentFileName));
|
||||
var result = _watches.SaveAs(GetWatchSaveFileFromUser(_watches.CurrentFileName));
|
||||
if (result)
|
||||
{
|
||||
UpdateStatusBar(saved: true);
|
||||
|
@ -537,18 +522,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void SaveColumnInfo()
|
||||
{
|
||||
foreach (ColumnHeader column in WatchListView.Columns)
|
||||
{
|
||||
Settings.Columns[column.Name].Index = column.DisplayIndex;
|
||||
Settings.Columns[column.Name].Width = column.Width;
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveConfigSettings()
|
||||
{
|
||||
SaveColumnInfo();
|
||||
SaveColumnInfo(WatchListView, Settings.Columns);
|
||||
|
||||
if (WindowState == FormWindowState.Normal)
|
||||
{
|
||||
|
@ -685,7 +661,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void OpenMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var append = sender == AppendMenuItem;
|
||||
LoadWatchFile(ToolHelpers.GetWatchFileFromUser(_watches.CurrentFileName), append);
|
||||
LoadWatchFile(GetWatchFileFromUser(_watches.CurrentFileName), append);
|
||||
}
|
||||
|
||||
private void SaveMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -993,7 +969,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Global.Config.DisplayRamWatch = false;
|
||||
|
||||
RefreshFloatingWindowControl();
|
||||
LoadColumnInfo();
|
||||
LoadColumnInfo(WatchListView, Settings.Columns);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1016,8 +992,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void ColumnToggleCallback()
|
||||
{
|
||||
SaveColumnInfo();
|
||||
LoadColumnInfo();
|
||||
SaveColumnInfo(WatchListView, Settings.Columns);
|
||||
LoadColumnInfo(WatchListView, Settings.Columns);
|
||||
}
|
||||
|
||||
private void NewRamWatch_Activated(object sender, EventArgs e)
|
||||
|
@ -1025,11 +1001,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
WatchListView.Refresh();
|
||||
}
|
||||
|
||||
private void NewRamWatch_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
}
|
||||
|
||||
private void NewRamWatch_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
|
@ -1111,11 +1082,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (selected.Select(x => x.Domain).Distinct().Count() > 1)
|
||||
{
|
||||
ToolHelpers.ViewInHexEditor(selected[0].Domain, new List<long> { selected.First().Address }, selected.First().Size);
|
||||
ViewInHexEditor(selected[0].Domain, new List<long> { selected.First().Address }, selected.First().Size);
|
||||
}
|
||||
else
|
||||
{
|
||||
ToolHelpers.ViewInHexEditor(selected.First().Domain, selected.Select(x => x.Address), selected.First().Size);
|
||||
ViewInHexEditor(selected.First().Domain, selected.Select(x => x.Address), selected.First().Size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue