Cheats dialog - Floating window option
This commit is contained in:
parent
003156d28e
commit
5f5677781b
|
@ -394,16 +394,12 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#region Cheats Dialog
|
||||
|
||||
public ToolDialogSettings CheatsSettings = new ToolDialogSettings();
|
||||
public bool Cheats_ValuesAsHex = true;
|
||||
public bool CheatsSaveWindowPosition = true;
|
||||
public bool DisableCheatsOnLoad = false;
|
||||
public bool LoadCheatFileByGame = true;
|
||||
public bool CheatsAutoSaveOnClose = true;
|
||||
public RecentFiles RecentCheats = new RecentFiles(8);
|
||||
public int CheatsWndx = -1;
|
||||
public int CheatsWndy = -1;
|
||||
public int CheatsWidth = -1;
|
||||
public int CheatsHeight = -1;
|
||||
public int CheatsNameWidth = -1;
|
||||
public int CheatsAddressWidth = -1;
|
||||
public int CheatsValueWidth = -1;
|
||||
|
@ -416,7 +412,6 @@ namespace BizHawk.Client.Common
|
|||
public int CheatsCompareIndex = 3;
|
||||
public int CheatsOnIndex = 4;
|
||||
public int CheatsDomainIndex = 5;
|
||||
public bool CheatsAlwaysOnTop = false;
|
||||
|
||||
public Dictionary<string, int> CheatsColumnWidths = new Dictionary<string, int>
|
||||
{
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
this.MessageLabel = new System.Windows.Forms.Label();
|
||||
this.CheatGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.CheatEditor = new BizHawk.Client.EmuHawk.CheatEdit();
|
||||
this.FloatingWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.CheatsContextMenu.SuspendLayout();
|
||||
this.CheatsMenu.SuspendLayout();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
|
@ -430,6 +431,7 @@
|
|||
this.AutoloadMenuItem,
|
||||
this.SaveWindowPositionMenuItem,
|
||||
this.AlwaysOnTopMenuItem,
|
||||
this.FloatingWindowMenuItem,
|
||||
this.toolStripSeparator5,
|
||||
this.RestoreWindowSizeMenuItem});
|
||||
this.OptionsSubMenu.Name = "OptionsSubMenu";
|
||||
|
@ -516,63 +518,63 @@
|
|||
// ShowNameMenuItem
|
||||
//
|
||||
this.ShowNameMenuItem.Name = "ShowNameMenuItem";
|
||||
this.ShowNameMenuItem.Size = new System.Drawing.Size(141, 22);
|
||||
this.ShowNameMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.ShowNameMenuItem.Text = "&Name";
|
||||
this.ShowNameMenuItem.Click += new System.EventHandler(this.ShowNameMenuItem_Click);
|
||||
//
|
||||
// ShowAddressMenuItem
|
||||
//
|
||||
this.ShowAddressMenuItem.Name = "ShowAddressMenuItem";
|
||||
this.ShowAddressMenuItem.Size = new System.Drawing.Size(141, 22);
|
||||
this.ShowAddressMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.ShowAddressMenuItem.Text = "&Address";
|
||||
this.ShowAddressMenuItem.Click += new System.EventHandler(this.ShowAddressMenuItem_Click);
|
||||
//
|
||||
// ShowValueMenuItem
|
||||
//
|
||||
this.ShowValueMenuItem.Name = "ShowValueMenuItem";
|
||||
this.ShowValueMenuItem.Size = new System.Drawing.Size(141, 22);
|
||||
this.ShowValueMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.ShowValueMenuItem.Text = "&Value";
|
||||
this.ShowValueMenuItem.Click += new System.EventHandler(this.ShowValueMenuItem_Click);
|
||||
//
|
||||
// ShowCompareMenuItem
|
||||
//
|
||||
this.ShowCompareMenuItem.Name = "ShowCompareMenuItem";
|
||||
this.ShowCompareMenuItem.Size = new System.Drawing.Size(141, 22);
|
||||
this.ShowCompareMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.ShowCompareMenuItem.Text = "&Compare";
|
||||
this.ShowCompareMenuItem.Click += new System.EventHandler(this.ShowCompareMenuItem_Click);
|
||||
//
|
||||
// ShowOnMenuItem
|
||||
//
|
||||
this.ShowOnMenuItem.Name = "ShowOnMenuItem";
|
||||
this.ShowOnMenuItem.Size = new System.Drawing.Size(141, 22);
|
||||
this.ShowOnMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.ShowOnMenuItem.Text = "&On";
|
||||
this.ShowOnMenuItem.Click += new System.EventHandler(this.ShowOnMenuItem_Click);
|
||||
//
|
||||
// ShowDomainMenuItem
|
||||
//
|
||||
this.ShowDomainMenuItem.Name = "ShowDomainMenuItem";
|
||||
this.ShowDomainMenuItem.Size = new System.Drawing.Size(141, 22);
|
||||
this.ShowDomainMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.ShowDomainMenuItem.Text = "&Domain";
|
||||
this.ShowDomainMenuItem.Click += new System.EventHandler(this.ShowDomainMenuItem_Click);
|
||||
//
|
||||
// ShowSizeMenuItem
|
||||
//
|
||||
this.ShowSizeMenuItem.Name = "ShowSizeMenuItem";
|
||||
this.ShowSizeMenuItem.Size = new System.Drawing.Size(141, 22);
|
||||
this.ShowSizeMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.ShowSizeMenuItem.Text = "&Size";
|
||||
this.ShowSizeMenuItem.Click += new System.EventHandler(this.ShowSizeMenuItem_Click);
|
||||
//
|
||||
// ShowEndianMenuItem
|
||||
//
|
||||
this.ShowEndianMenuItem.Name = "ShowEndianMenuItem";
|
||||
this.ShowEndianMenuItem.Size = new System.Drawing.Size(141, 22);
|
||||
this.ShowEndianMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.ShowEndianMenuItem.Text = "&Endian";
|
||||
this.ShowEndianMenuItem.Click += new System.EventHandler(this.ShowEndianMenuItem_Click);
|
||||
//
|
||||
// ShowDisplayTypeMenuItem
|
||||
//
|
||||
this.ShowDisplayTypeMenuItem.Name = "ShowDisplayTypeMenuItem";
|
||||
this.ShowDisplayTypeMenuItem.Size = new System.Drawing.Size(141, 22);
|
||||
this.ShowDisplayTypeMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.ShowDisplayTypeMenuItem.Text = "&Display Type";
|
||||
this.ShowDisplayTypeMenuItem.Click += new System.EventHandler(this.ShowDisplayTypeMenuItem_Click);
|
||||
//
|
||||
|
@ -734,6 +736,13 @@
|
|||
this.CheatEditor.Size = new System.Drawing.Size(190, 264);
|
||||
this.CheatEditor.TabIndex = 0;
|
||||
//
|
||||
// FloatingWindowMenuItem
|
||||
//
|
||||
this.FloatingWindowMenuItem.Name = "FloatingWindowMenuItem";
|
||||
this.FloatingWindowMenuItem.Size = new System.Drawing.Size(199, 22);
|
||||
this.FloatingWindowMenuItem.Text = "Floating Window";
|
||||
this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click);
|
||||
//
|
||||
// Cheats
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -836,5 +845,6 @@
|
|||
private CheatEdit CheatEditor;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
|
||||
private System.Windows.Forms.ToolStripMenuItem ViewInHexEditorContextMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem;
|
||||
}
|
||||
}
|
|
@ -7,7 +7,6 @@ using System.Linq;
|
|||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Cores.Nintendo.NES;
|
||||
using BizHawk.Emulation.Cores.Nintendo.SNES;
|
||||
using BizHawk.Emulation.Cores.Sega.Genesis;
|
||||
|
||||
|
@ -40,7 +39,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private int _defaultWidth;
|
||||
private int _defaultHeight;
|
||||
private string _sortedColumn = String.Empty;
|
||||
private string _sortedColumn = string.Empty;
|
||||
private bool _sortReverse;
|
||||
|
||||
public bool UpdateBefore { get { return false; } }
|
||||
|
@ -64,9 +63,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
CheatListView.QueryItemBkColor += CheatListView_QueryItemBkColor;
|
||||
CheatListView.VirtualMode = true;
|
||||
|
||||
_sortedColumn = String.Empty;
|
||||
_sortedColumn = string.Empty;
|
||||
_sortReverse = false;
|
||||
TopMost = Global.Config.CheatsAlwaysOnTop;
|
||||
TopMost = Global.Config.CheatsSettings.TopMost;
|
||||
}
|
||||
|
||||
public void UpdateValues()
|
||||
|
@ -92,7 +91,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void LoadFileFromRecent(string path)
|
||||
{
|
||||
var askResult = Global.CheatList.Changes ? AskSave() : true;
|
||||
var askResult = !Global.CheatList.Changes || AskSave();
|
||||
if (askResult)
|
||||
{
|
||||
var loadResult = Global.CheatList.Load(path, append: false);
|
||||
|
@ -113,7 +112,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
MessageLabel.Text = saved
|
||||
? Path.GetFileName(Global.CheatList.CurrentFileName) + " saved."
|
||||
: Path.GetFileName(Global.CheatList.CurrentFileName) + (Global.CheatList.Changes ? " *" : String.Empty);
|
||||
: Path.GetFileName(Global.CheatList.CurrentFileName) + (Global.CheatList.Changes ? " *" : string.Empty);
|
||||
}
|
||||
|
||||
public bool AskSave()
|
||||
|
@ -203,10 +202,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void SaveConfigSettings()
|
||||
{
|
||||
SaveColumnInfo();
|
||||
Global.Config.CheatsWndx = Location.X;
|
||||
Global.Config.CheatsWndy = Location.Y;
|
||||
Global.Config.CheatsWidth = Right - Left;
|
||||
Global.Config.CheatsHeight = Bottom - Top;
|
||||
Global.Config.CheatsSettings.Wndx = Location.X;
|
||||
Global.Config.CheatsSettings.Wndy = Location.Y;
|
||||
Global.Config.CheatsSettings.Width = Right - Left;
|
||||
Global.Config.CheatsSettings.Height = Bottom - Top;
|
||||
}
|
||||
|
||||
private void LoadConfigSettings()
|
||||
|
@ -214,14 +213,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
_defaultWidth = Size.Width;
|
||||
_defaultHeight = Size.Height;
|
||||
|
||||
if (Global.Config.CheatsSaveWindowPosition && Global.Config.CheatsWndx >= 0 && Global.Config.CheatsWndy >= 0)
|
||||
if (Global.Config.CheatsSettings.UseWindowPosition)
|
||||
{
|
||||
Location = new Point(Global.Config.CheatsWndx, Global.Config.CheatsWndy);
|
||||
Location = Global.Config.CheatsSettings.WindowPosition;
|
||||
}
|
||||
|
||||
if (Global.Config.CheatsWidth >= 0 && Global.Config.CheatsHeight >= 0)
|
||||
if (Global.Config.CheatsSettings.UseWindowSize)
|
||||
{
|
||||
Size = new Size(Global.Config.CheatsWidth, Global.Config.CheatsHeight);
|
||||
Size = Global.Config.CheatsSettings.WindowSize;
|
||||
}
|
||||
|
||||
LoadColumnInfo();
|
||||
|
@ -318,7 +317,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void CheatListView_QueryItemText(int index, int column, out string text)
|
||||
{
|
||||
text = String.Empty;
|
||||
text = string.Empty;
|
||||
if (index >= Global.CheatList.Count || Global.CheatList[index].IsSeparator)
|
||||
{
|
||||
return;
|
||||
|
@ -341,7 +340,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
text = Global.CheatList[index].CompareStr;
|
||||
break;
|
||||
case ON:
|
||||
text = Global.CheatList[index].Enabled ? "*" : String.Empty;
|
||||
text = Global.CheatList[index].Enabled ? "*" : string.Empty;
|
||||
break;
|
||||
case DOMAIN:
|
||||
text = Global.CheatList[index].Domain.Name;
|
||||
|
@ -405,7 +404,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void StartNewList()
|
||||
{
|
||||
var result = Global.CheatList.Changes ? AskSave() : true;
|
||||
var result = !Global.CheatList.Changes || AskSave();
|
||||
if (result)
|
||||
{
|
||||
Global.CheatList.NewList(ToolManager.GenerateDefaultCheatFilename());
|
||||
|
@ -417,13 +416,18 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void NewList()
|
||||
{
|
||||
var result = Global.CheatList.Changes ? AskSave() : true;
|
||||
var result = !Global.CheatList.Changes || AskSave();
|
||||
if (result)
|
||||
{
|
||||
StartNewList();
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshFloatingWindowControl()
|
||||
{
|
||||
Owner = Global.Config.CheatsSettings.FloatingWindow ? null : GlobalWin.MainForm;
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
#region File
|
||||
|
@ -621,8 +625,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
AutoSaveCheatsMenuItem.Checked = Global.Config.CheatsAutoSaveOnClose;
|
||||
DisableCheatsOnLoadMenuItem.Checked = Global.Config.DisableCheatsOnLoad;
|
||||
AutoloadMenuItem.Checked = Global.Config.RecentCheats.AutoLoad;
|
||||
SaveWindowPositionMenuItem.Checked = Global.Config.CheatsSaveWindowPosition;
|
||||
AlwaysOnTopMenuItem.Checked = Global.Config.CheatsAlwaysOnTop;
|
||||
SaveWindowPositionMenuItem.Checked = Global.Config.CheatsSettings.SaveWindowPosition;
|
||||
AlwaysOnTopMenuItem.Checked = Global.Config.CheatsSettings.TopMost;
|
||||
FloatingWindowMenuItem.Checked = Global.Config.CheatsSettings.FloatingWindow;
|
||||
}
|
||||
|
||||
private void AlwaysLoadCheatsMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -647,19 +652,26 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void SaveWindowPositionMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.CheatsSaveWindowPosition ^= true;
|
||||
Global.Config.CheatsSettings.SaveWindowPosition ^= true;
|
||||
}
|
||||
|
||||
private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.CheatsAlwaysOnTop ^= true;
|
||||
Global.Config.CheatsSettings.TopMost ^= true;
|
||||
}
|
||||
|
||||
private void FloatingWindowMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.CheatsSettings.FloatingWindow ^= true;
|
||||
RefreshFloatingWindowControl();
|
||||
}
|
||||
|
||||
private void RestoreWindowSizeMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Size = new Size(_defaultWidth, _defaultHeight);
|
||||
Global.Config.CheatsSaveWindowPosition = true;
|
||||
Global.Config.CheatsAlwaysOnTop = TopMost = false;
|
||||
Global.Config.CheatsSettings.SaveWindowPosition = true;
|
||||
Global.Config.CheatsSettings.TopMost = TopMost = false;
|
||||
Global.Config.CheatsSettings.FloatingWindow = false;
|
||||
Global.Config.DisableCheatsOnLoad = false;
|
||||
Global.Config.LoadCheatFileByGame = true;
|
||||
Global.Config.CheatsAutoSaveOnClose = true;
|
||||
|
@ -704,6 +716,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
};
|
||||
|
||||
LoadColumnInfo();
|
||||
RefreshFloatingWindowControl();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -870,6 +883,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
protected override void OnShown(EventArgs e)
|
||||
{
|
||||
RefreshFloatingWindowControl();
|
||||
base.OnShown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in New Issue