diff --git a/BizHawk.Client.Common/config/Config.cs b/BizHawk.Client.Common/config/Config.cs index a0e51deeb3..3143ec7f5b 100644 --- a/BizHawk.Client.Common/config/Config.cs +++ b/BizHawk.Client.Common/config/Config.cs @@ -41,7 +41,7 @@ namespace BizHawk.Client.Common public PathEntryCollection PathEntries = new PathEntryCollection(); // BIOS Paths - public Dictionary FirmwareUserSpecifications = new Dictionary(); //key: sysid+firmwareId; value: absolute path + public Dictionary FirmwareUserSpecifications = new Dictionary(); // key: sysid+firmwareId; value: absolute path public string FFMpegPath = "%exe%/dll/ffmpeg.exe"; @@ -49,12 +49,12 @@ namespace BizHawk.Client.Common public int Input_Hotkey_OverrideOptions = 0; public bool StackOSDMessages = true; public int TargetZoomFactor = 2; - public int TargetScanlineFilterIntensity = 0; //choose between 0 and 256 + public int TargetScanlineFilterIntensity = 0; // choose between 0 and 256 public RecentFiles RecentRoms = new RecentFiles(8); public bool PauseWhenMenuActivated = true; public bool SaveWindowPosition = true; public bool StartPaused = false; - public int MainWndx = -1; //Negative numbers will be ignored + public int MainWndx = -1; // Negative numbers will be ignored public int MainWndy = -1; public bool RunInBackground = true; public bool AcceptBackgroundInput = false; @@ -179,13 +179,8 @@ namespace BizHawk.Client.Common public bool DisableLuaScriptsOnLoad = false; // RamWatch Settings + public ToolDialogSettings RamWatchSettings = new ToolDialogSettings(); public RecentFiles RecentWatches = new RecentFiles(8); - public bool RamWatchSaveWindowPosition = true; - public bool RamWatchAlwaysOnTop = false; - public int RamWatchWndx = -1; // Negative numbers will be ignored even with save window position set - public int RamWatchWndy = -1; - public int RamWatchWidth = -1; - public int RamWatchHeight = -1; public bool RamWatchShowChangeColumn = true; public bool RamWatchShowPrevColumn = false; public bool RamWatchShowDiffColumn = false; diff --git a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.Designer.cs b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.Designer.cs index 64ede5cb51..5cf89a364a 100644 --- a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.Designer.cs @@ -116,6 +116,7 @@ this.DiffColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.DomainColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.NotesColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.FloatingWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ListViewContextMenu.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); @@ -170,7 +171,7 @@ this.ShowDiffContextMenuItem, this.ShowDomainContextMenuItem}); this.ListViewContextMenu.Name = "contextMenuStrip1"; - this.ListViewContextMenu.Size = new System.Drawing.Size(204, 346); + this.ListViewContextMenu.Size = new System.Drawing.Size(204, 324); this.ListViewContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.ListViewContextMenu_Opening); // // EditContextMenuItem @@ -721,6 +722,7 @@ this.WatchesOnScreenMenuItem, this.SaveWindowPositionMenuItem, this.AlwaysOnTopMenuItem, + this.FloatingWindowMenuItem, this.toolStripSeparator7, this.RestoreWindowSizeMenuItem}); this.OptionsSubMenu.Name = "OptionsSubMenu"; @@ -843,6 +845,7 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.WatchListView.AutoArrange = false; + this.WatchListView.BlazingFast = false; this.WatchListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.AddressColumn, this.ValueColumn, @@ -915,6 +918,13 @@ this.NotesColumn.Text = "Notes"; this.NotesColumn.Width = 128; // + // FloatingWindowMenuItem + // + this.FloatingWindowMenuItem.Name = "FloatingWindowMenuItem"; + this.FloatingWindowMenuItem.Size = new System.Drawing.Size(217, 22); + this.FloatingWindowMenuItem.Text = "&Floating Window"; + this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click); + // // RamWatch // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1033,5 +1043,6 @@ private System.Windows.Forms.ToolStripMenuItem ShowDiffContextMenuItem; private System.Windows.Forms.ToolStripMenuItem ShowDomainContextMenuItem; private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem; + private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem; } } \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs index c151851359..47c40c19ac 100644 --- a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs +++ b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs @@ -28,7 +28,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 RamWatch() @@ -48,10 +48,11 @@ namespace BizHawk.Client.EmuHawk e.Cancel = true; } }; - _sortedColumn = String.Empty; + + _sortedColumn = string.Empty; _sortReverse = false; - TopMost = Global.Config.RamWatchAlwaysOnTop; + TopMost = Global.Config.RamWatchSettings.TopMost; } private IEnumerable SelectedIndices @@ -177,7 +178,7 @@ namespace BizHawk.Client.EmuHawk return; } - if (!String.IsNullOrWhiteSpace(_watches.CurrentFileName)) + if (!string.IsNullOrWhiteSpace(_watches.CurrentFileName)) { _watches.Reload(); } @@ -317,7 +318,7 @@ namespace BizHawk.Client.EmuHawk switch (name) { default: - return String.Empty; + return string.Empty; case WatchList.ADDRESS: return _watches[index].AddressString; case WatchList.VALUE: @@ -371,14 +372,14 @@ namespace BizHawk.Client.EmuHawk _defaultWidth = Size.Width; // Save these first so that the user can restore to its original size _defaultHeight = Size.Height; - if (Global.Config.RamWatchSaveWindowPosition && Global.Config.RamWatchWndx >= 0 && Global.Config.RamWatchWndy >= 0) + if (Global.Config.RamWatchSettings.UseWindowPosition) { - Location = new Point(Global.Config.RamWatchWndx, Global.Config.RamWatchWndy); + Location = new Point(Global.Config.RamWatchSettings.Wndx.Value, Global.Config.RamWatchSettings.Wndy.Value); } - if (Global.Config.RamWatchWidth >= 0 && Global.Config.RamWatchHeight >= 0) + if (Global.Config.RamWatchSettings.UseWindowSize) { - Size = new Size(Global.Config.RamWatchWidth, Global.Config.RamWatchHeight); + Size = new Size(Global.Config.RamWatchSettings.Width.Value, Global.Config.RamWatchSettings.Height.Value); } LoadColumnInfo(); @@ -399,7 +400,7 @@ namespace BizHawk.Client.EmuHawk UpdateWatchCount(); UpdateMessageLabel(); _sortReverse = false; - _sortedColumn = String.Empty; + _sortedColumn = string.Empty; } } @@ -476,10 +477,10 @@ namespace BizHawk.Client.EmuHawk private void SaveConfigSettings() { SaveColumnInfo(); - Global.Config.RamWatchWndx = Location.X; - Global.Config.RamWatchWndy = Location.Y; - Global.Config.RamWatchWidth = Right - Left; - Global.Config.RamWatchHeight = Bottom - Top; + Global.Config.RamWatchSettings.Wndx = Location.X; + Global.Config.RamWatchSettings.Wndy = Location.Y; + Global.Config.RamWatchSettings.Width = Right - Left; + Global.Config.RamWatchSettings.Height = Bottom - Top; } private void SetMemoryDomain(string name) @@ -496,8 +497,8 @@ namespace BizHawk.Client.EmuHawk private void UpdateMessageLabel(bool saved = false) { - var message = String.Empty; - if (!String.IsNullOrWhiteSpace(_watches.CurrentFileName)) + var message = string.Empty; + if (!string.IsNullOrWhiteSpace(_watches.CurrentFileName)) { if (saved) { @@ -505,7 +506,7 @@ namespace BizHawk.Client.EmuHawk } else { - message = Path.GetFileName(_watches.CurrentFileName) + (_watches.Changes ? " *" : String.Empty); + message = Path.GetFileName(_watches.CurrentFileName) + (_watches.Changes ? " *" : string.Empty); } } @@ -539,7 +540,7 @@ namespace BizHawk.Client.EmuHawk private void WatchListView_QueryItemText(int index, int column, out string text) { - text = String.Empty; + text = string.Empty; if (index >= _watches.ItemCount || _watches[index].IsSeparator) { @@ -578,6 +579,11 @@ namespace BizHawk.Client.EmuHawk } } + private void RefreshFloatingWindowControl() + { + Owner = Global.Config.RamWatchSettings.FloatingWindow ? null : GlobalWin.MainForm; + } + #endregion #region Winform Events @@ -602,7 +608,7 @@ namespace BizHawk.Client.EmuHawk private void SaveMenuItem_Click(object sender, EventArgs e) { - if (!String.IsNullOrWhiteSpace(_watches.CurrentFileName)) + if (!string.IsNullOrWhiteSpace(_watches.CurrentFileName)) { if (_watches.Save()) { @@ -828,8 +834,9 @@ namespace BizHawk.Client.EmuHawk private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e) { WatchesOnScreenMenuItem.Checked = Global.Config.DisplayRamWatch; - SaveWindowPositionMenuItem.Checked = Global.Config.RamWatchSaveWindowPosition; - AlwaysOnTopMenuItem.Checked = Global.Config.RamWatchAlwaysOnTop; + SaveWindowPositionMenuItem.Checked = Global.Config.RamWatchSettings.SaveWindowPosition; + AlwaysOnTopMenuItem.Checked = Global.Config.RamWatchSettings.TopMost; + FloatingWindowMenuItem.Checked = Global.Config.RamWatchSettings.FloatingWindow; } private void DefinePreviousValueSubMenu_DropDownOpened(object sender, EventArgs e) @@ -870,13 +877,19 @@ namespace BizHawk.Client.EmuHawk private void SaveWindowPositionMenuItem_Click(object sender, EventArgs e) { - Global.Config.RamWatchSaveWindowPosition ^= true; + Global.Config.RamWatchSettings.SaveWindowPosition ^= true; } private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e) { - Global.Config.RamWatchAlwaysOnTop ^= true; - TopMost = Global.Config.RamWatchAlwaysOnTop; + Global.Config.RamWatchSettings.TopMost ^= true; + TopMost = Global.Config.RamWatchSettings.TopMost; + } + + private void FloatingWindowMenuItem_Click(object sender, EventArgs e) + { + Global.Config.RamWatchSettings.FloatingWindow ^= true; + RefreshFloatingWindowControl(); } private void RestoreWindowSizeMenuItem_Click(object sender, EventArgs e) @@ -903,15 +916,13 @@ namespace BizHawk.Client.EmuHawk WatchListView.Columns[WatchList.ADDRESS].Width = _defaultColumnWidths[WatchList.ADDRESS]; WatchListView.Columns[WatchList.VALUE].Width = _defaultColumnWidths[WatchList.VALUE]; - // WatchListView.Columns[WatchList.PREV].Width = DefaultColumnWidths[WatchList.PREV]; WatchListView.Columns[WatchList.CHANGES].Width = _defaultColumnWidths[WatchList.CHANGES]; - // WatchListView.Columns[WatchList.DIFF].Width = DefaultColumnWidths[WatchList.DIFF]; WatchListView.Columns[WatchList.DOMAIN].Width = _defaultColumnWidths[WatchList.DOMAIN]; WatchListView.Columns[WatchList.NOTES].Width = _defaultColumnWidths[WatchList.NOTES]; Global.Config.DisplayRamWatch = false; - Global.Config.RamWatchSaveWindowPosition = true; - Global.Config.RamWatchAlwaysOnTop = TopMost = false; + Global.Config.RamWatchSettings.SaveWindowPosition = true; + Global.Config.RamWatchSettings.TopMost = TopMost = false; LoadColumnInfo(); } @@ -1100,8 +1111,14 @@ namespace BizHawk.Client.EmuHawk Global.Config.RamWatchColumnIndexes[WatchList.NOTES] = WatchListView.Columns[WatchList.NOTES].DisplayIndex; } + protected override void OnShown(EventArgs e) + { + RefreshFloatingWindowControl(); + base.OnShown(e); + } + #endregion - + #endregion } }