Debugger: PPU Viewer - Add 2x zoom toggle

This commit is contained in:
Sour 2019-01-21 14:38:38 -05:00
parent e29bd94d55
commit 5f88fa8cc6
18 changed files with 428 additions and 278 deletions

View file

@ -56,6 +56,8 @@ namespace Mesen.GUI.Config
[ShortcutName("PPU Viewer: Toggle View")] [ShortcutName("PPU Viewer: Toggle View")]
public XmlKeys PpuViewer_ToggleView = Keys.Control | Keys.Q; public XmlKeys PpuViewer_ToggleView = Keys.Control | Keys.Q;
[ShortcutName("PPU Viewer: Toggle Zoom")]
public XmlKeys PpuViewer_ToggleZoom = Keys.Control | Keys.W;
[ShortcutName("Edit in Memory Viewer")] [ShortcutName("Edit in Memory Viewer")]
public XmlKeys CodeWindow_EditInMemoryViewer = Keys.F1; public XmlKeys CodeWindow_EditInMemoryViewer = Keys.F1;

View file

@ -0,0 +1,16 @@
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace Mesen.GUI.Controls
{
public class ctrlMesenPictureBox : PictureBox
{
public InterpolationMode InterpolationMode { get; set; }
protected override void OnPaint(PaintEventArgs paintEventArgs)
{
paintEventArgs.Graphics.InterpolationMode = InterpolationMode;
base.OnPaint(paintEventArgs);
}
}
}

View file

@ -30,7 +30,15 @@ namespace Mesen.GUI.Debugger.Controls
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.tlpMain = new System.Windows.Forms.TableLayoutPanel();
this.picChrBank1 = new Mesen.GUI.Controls.ctrlMesenPictureBox();
this.ctxMenu = new Mesen.GUI.Controls.ctrlMesenContextMenuStrip(this.components);
this.mnuEditInMemoryViewer = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.mnuCopyHdPack = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.mnuCopyToClipboard = new System.Windows.Forms.ToolStripMenuItem();
this.mnuExportToPng = new System.Windows.Forms.ToolStripMenuItem();
this.grpDisplayOptions = new System.Windows.Forms.GroupBox(); this.grpDisplayOptions = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.chkShowSingleColorTilesInGrayscale = new System.Windows.Forms.CheckBox(); this.chkShowSingleColorTilesInGrayscale = new System.Windows.Forms.CheckBox();
@ -38,7 +46,6 @@ namespace Mesen.GUI.Debugger.Controls
this.lblPalette = new System.Windows.Forms.Label(); this.lblPalette = new System.Windows.Forms.Label();
this.cboPalette = new System.Windows.Forms.ComboBox(); this.cboPalette = new System.Windows.Forms.ComboBox();
this.picPaletteTooltip = new System.Windows.Forms.PictureBox(); this.picPaletteTooltip = new System.Windows.Forms.PictureBox();
this.chkLargeSprites = new System.Windows.Forms.CheckBox();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.lblChrSelection = new System.Windows.Forms.Label(); this.lblChrSelection = new System.Windows.Forms.Label();
this.cboChrSelection = new System.Windows.Forms.ComboBox(); this.cboChrSelection = new System.Windows.Forms.ComboBox();
@ -46,6 +53,8 @@ namespace Mesen.GUI.Debugger.Controls
this.lblHighlight = new System.Windows.Forms.Label(); this.lblHighlight = new System.Windows.Forms.Label();
this.cboHighlightType = new System.Windows.Forms.ComboBox(); this.cboHighlightType = new System.Windows.Forms.ComboBox();
this.chkAutoPalette = new System.Windows.Forms.CheckBox(); this.chkAutoPalette = new System.Windows.Forms.CheckBox();
this.chkLargeSprites = new System.Windows.Forms.CheckBox();
this.picChrBank2 = new Mesen.GUI.Controls.ctrlMesenPictureBox();
this.grpTileInfo = new System.Windows.Forms.GroupBox(); this.grpTileInfo = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.txtTileAddress = new System.Windows.Forms.TextBox(); this.txtTileAddress = new System.Windows.Forms.TextBox();
@ -58,60 +67,121 @@ namespace Mesen.GUI.Debugger.Controls
this.picColorTooltip = new System.Windows.Forms.PictureBox(); this.picColorTooltip = new System.Windows.Forms.PictureBox();
this.picTileTooltip = new System.Windows.Forms.PictureBox(); this.picTileTooltip = new System.Windows.Forms.PictureBox();
this.ctrlTilePalette = new Mesen.GUI.Debugger.Controls.ctrlTilePalette(); this.ctrlTilePalette = new Mesen.GUI.Debugger.Controls.ctrlTilePalette();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.picChrBank1 = new System.Windows.Forms.PictureBox();
this.ctxMenu = new Mesen.GUI.Controls.ctrlMesenContextMenuStrip(this.components);
this.mnuEditInMemoryViewer = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.mnuCopyHdPack = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.mnuCopyToClipboard = new System.Windows.Forms.ToolStripMenuItem();
this.mnuExportToPng = new System.Windows.Forms.ToolStripMenuItem();
this.picChrBank2 = new System.Windows.Forms.PictureBox();
this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.tableLayoutPanel3.SuspendLayout(); this.tlpMain.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picChrBank1)).BeginInit();
this.ctxMenu.SuspendLayout();
this.grpDisplayOptions.SuspendLayout(); this.grpDisplayOptions.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picPaletteTooltip)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picPaletteTooltip)).BeginInit();
this.flowLayoutPanel2.SuspendLayout(); this.flowLayoutPanel2.SuspendLayout();
this.flpHighlight.SuspendLayout(); this.flpHighlight.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picChrBank2)).BeginInit();
this.grpTileInfo.SuspendLayout(); this.grpTileInfo.SuspendLayout();
this.tableLayoutPanel4.SuspendLayout(); this.tableLayoutPanel4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picTile)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picTile)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picColorTooltip)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picColorTooltip)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picTileTooltip)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picTileTooltip)).BeginInit();
this.tableLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picChrBank1)).BeginInit();
this.ctxMenu.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picChrBank2)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// tableLayoutPanel3 // tlpMain
// //
this.tableLayoutPanel3.ColumnCount = 2; this.tlpMain.ColumnCount = 2;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tlpMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tlpMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel3.Controls.Add(this.grpDisplayOptions, 1, 1); this.tlpMain.Controls.Add(this.picChrBank1, 0, 0);
this.tableLayoutPanel3.Controls.Add(this.grpTileInfo, 1, 0); this.tlpMain.Controls.Add(this.grpDisplayOptions, 1, 1);
this.tableLayoutPanel3.Controls.Add(this.tableLayoutPanel2, 0, 0); this.tlpMain.Controls.Add(this.picChrBank2, 0, 1);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; this.tlpMain.Controls.Add(this.grpTileInfo, 1, 0);
this.tableLayoutPanel3.Location = new System.Drawing.Point(0, 0); this.tlpMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel3.Name = "tableLayoutPanel3"; this.tlpMain.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel3.RowCount = 2; this.tlpMain.Name = "tlpMain";
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tlpMain.RowCount = 2;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel3.Size = new System.Drawing.Size(534, 525); this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel3.TabIndex = 3; this.tlpMain.Size = new System.Drawing.Size(701, 522);
this.tlpMain.TabIndex = 3;
//
// picChrBank1
//
this.picChrBank1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picChrBank1.ContextMenuStrip = this.ctxMenu;
this.picChrBank1.Cursor = System.Windows.Forms.Cursors.Hand;
this.picChrBank1.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
this.picChrBank1.Location = new System.Drawing.Point(1, 1);
this.picChrBank1.Margin = new System.Windows.Forms.Padding(1);
this.picChrBank1.Name = "picChrBank1";
this.picChrBank1.Size = new System.Drawing.Size(258, 258);
this.picChrBank1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.picChrBank1.TabIndex = 0;
this.picChrBank1.TabStop = false;
this.picChrBank1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picChrBank_MouseDown);
this.picChrBank1.MouseEnter += new System.EventHandler(this.picChrBank_MouseEnter);
this.picChrBank1.MouseLeave += new System.EventHandler(this.picChrBank_MouseLeave);
this.picChrBank1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picChrBank_MouseMove);
//
// ctxMenu
//
this.ctxMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuEditInMemoryViewer,
this.toolStripMenuItem2,
this.mnuCopyHdPack,
this.toolStripMenuItem1,
this.mnuCopyToClipboard,
this.mnuExportToPng});
this.ctxMenu.Name = "ctxMenu";
this.ctxMenu.Size = new System.Drawing.Size(222, 104);
this.ctxMenu.Opening += new System.ComponentModel.CancelEventHandler(this.ctxMenu_Opening);
//
// mnuEditInMemoryViewer
//
this.mnuEditInMemoryViewer.Image = global::Mesen.GUI.Properties.Resources.CheatCode;
this.mnuEditInMemoryViewer.Name = "mnuEditInMemoryViewer";
this.mnuEditInMemoryViewer.Size = new System.Drawing.Size(221, 22);
this.mnuEditInMemoryViewer.Text = "Edit in Memory Viewer";
this.mnuEditInMemoryViewer.Click += new System.EventHandler(this.mnuEditInMemoryViewer_Click);
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(218, 6);
//
// mnuCopyHdPack
//
this.mnuCopyHdPack.Name = "mnuCopyHdPack";
this.mnuCopyHdPack.Size = new System.Drawing.Size(221, 22);
this.mnuCopyHdPack.Text = "Copy Tile (HD Pack Format)";
this.mnuCopyHdPack.Click += new System.EventHandler(this.mnuCopyHdPack_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(218, 6);
//
// mnuCopyToClipboard
//
this.mnuCopyToClipboard.Image = global::Mesen.GUI.Properties.Resources.Copy;
this.mnuCopyToClipboard.Name = "mnuCopyToClipboard";
this.mnuCopyToClipboard.Size = new System.Drawing.Size(221, 22);
this.mnuCopyToClipboard.Text = "Copy image to clipboard";
this.mnuCopyToClipboard.Click += new System.EventHandler(this.mnuCopyToClipboard_Click);
//
// mnuExportToPng
//
this.mnuExportToPng.Image = global::Mesen.GUI.Properties.Resources.Export;
this.mnuExportToPng.Name = "mnuExportToPng";
this.mnuExportToPng.Size = new System.Drawing.Size(221, 22);
this.mnuExportToPng.Text = "Export image to PNG";
this.mnuExportToPng.Click += new System.EventHandler(this.mnuExportToPng_Click);
// //
// grpDisplayOptions // grpDisplayOptions
// //
this.grpDisplayOptions.Controls.Add(this.tableLayoutPanel1); this.grpDisplayOptions.Controls.Add(this.tableLayoutPanel1);
this.grpDisplayOptions.Dock = System.Windows.Forms.DockStyle.Top; this.grpDisplayOptions.Location = new System.Drawing.Point(263, 263);
this.grpDisplayOptions.Location = new System.Drawing.Point(269, 300);
this.grpDisplayOptions.Name = "grpDisplayOptions"; this.grpDisplayOptions.Name = "grpDisplayOptions";
this.grpDisplayOptions.Size = new System.Drawing.Size(264, 175); this.grpDisplayOptions.Size = new System.Drawing.Size(435, 175);
this.grpDisplayOptions.TabIndex = 4; this.grpDisplayOptions.TabIndex = 4;
this.grpDisplayOptions.TabStop = false; this.grpDisplayOptions.TabStop = false;
this.grpDisplayOptions.Text = "Display Options"; this.grpDisplayOptions.Text = "Display Options";
@ -122,10 +192,10 @@ namespace Mesen.GUI.Debugger.Controls
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.chkShowSingleColorTilesInGrayscale, 0, 5); this.tableLayoutPanel1.Controls.Add(this.chkShowSingleColorTilesInGrayscale, 0, 5);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 1); this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.chkLargeSprites, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 0, 0); this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.flpHighlight, 0, 2); this.tableLayoutPanel1.Controls.Add(this.flpHighlight, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.chkAutoPalette, 0, 4); this.tableLayoutPanel1.Controls.Add(this.chkAutoPalette, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.chkLargeSprites, 0, 3);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 16); this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 16);
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.Name = "tableLayoutPanel1";
@ -136,7 +206,7 @@ namespace Mesen.GUI.Debugger.Controls
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(258, 156); this.tableLayoutPanel1.Size = new System.Drawing.Size(429, 156);
this.tableLayoutPanel1.TabIndex = 6; this.tableLayoutPanel1.TabIndex = 6;
// //
// chkShowSingleColorTilesInGrayscale // chkShowSingleColorTilesInGrayscale
@ -159,7 +229,7 @@ namespace Mesen.GUI.Debugger.Controls
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 27); this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 27);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(258, 27); this.flowLayoutPanel1.Size = new System.Drawing.Size(429, 27);
this.flowLayoutPanel1.TabIndex = 5; this.flowLayoutPanel1.TabIndex = 5;
// //
// lblPalette // lblPalette
@ -204,17 +274,6 @@ namespace Mesen.GUI.Debugger.Controls
this.picPaletteTooltip.TabIndex = 16; this.picPaletteTooltip.TabIndex = 16;
this.picPaletteTooltip.TabStop = false; this.picPaletteTooltip.TabStop = false;
// //
// chkLargeSprites
//
this.chkLargeSprites.AutoSize = true;
this.chkLargeSprites.Location = new System.Drawing.Point(3, 84);
this.chkLargeSprites.Name = "chkLargeSprites";
this.chkLargeSprites.Size = new System.Drawing.Size(133, 17);
this.chkLargeSprites.TabIndex = 2;
this.chkLargeSprites.Text = "Display as 8x16 sprites";
this.chkLargeSprites.UseVisualStyleBackColor = true;
this.chkLargeSprites.CheckedChanged += new System.EventHandler(this.chkLargeSprites_CheckedChanged);
//
// flowLayoutPanel2 // flowLayoutPanel2
// //
this.flowLayoutPanel2.Controls.Add(this.lblChrSelection); this.flowLayoutPanel2.Controls.Add(this.lblChrSelection);
@ -223,7 +282,7 @@ namespace Mesen.GUI.Debugger.Controls
this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 0); this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel2.Name = "flowLayoutPanel2"; this.flowLayoutPanel2.Name = "flowLayoutPanel2";
this.flowLayoutPanel2.Size = new System.Drawing.Size(258, 27); this.flowLayoutPanel2.Size = new System.Drawing.Size(429, 27);
this.flowLayoutPanel2.TabIndex = 6; this.flowLayoutPanel2.TabIndex = 6;
// //
// lblChrSelection // lblChrSelection
@ -255,7 +314,7 @@ namespace Mesen.GUI.Debugger.Controls
this.flpHighlight.Location = new System.Drawing.Point(0, 54); this.flpHighlight.Location = new System.Drawing.Point(0, 54);
this.flpHighlight.Margin = new System.Windows.Forms.Padding(0); this.flpHighlight.Margin = new System.Windows.Forms.Padding(0);
this.flpHighlight.Name = "flpHighlight"; this.flpHighlight.Name = "flpHighlight";
this.flpHighlight.Size = new System.Drawing.Size(258, 27); this.flpHighlight.Size = new System.Drawing.Size(429, 27);
this.flpHighlight.TabIndex = 7; this.flpHighlight.TabIndex = 7;
// //
// lblHighlight // lblHighlight
@ -293,13 +352,41 @@ namespace Mesen.GUI.Debugger.Controls
this.chkAutoPalette.UseVisualStyleBackColor = true; this.chkAutoPalette.UseVisualStyleBackColor = true;
this.chkAutoPalette.CheckedChanged += new System.EventHandler(this.chkAutoPalette_CheckedChanged); this.chkAutoPalette.CheckedChanged += new System.EventHandler(this.chkAutoPalette_CheckedChanged);
// //
// chkLargeSprites
//
this.chkLargeSprites.AutoSize = true;
this.chkLargeSprites.Location = new System.Drawing.Point(3, 84);
this.chkLargeSprites.Name = "chkLargeSprites";
this.chkLargeSprites.Size = new System.Drawing.Size(133, 17);
this.chkLargeSprites.TabIndex = 2;
this.chkLargeSprites.Text = "Display as 8x16 sprites";
this.chkLargeSprites.UseVisualStyleBackColor = true;
this.chkLargeSprites.CheckedChanged += new System.EventHandler(this.chkLargeSprites_CheckedChanged);
//
// picChrBank2
//
this.picChrBank2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picChrBank2.ContextMenuStrip = this.ctxMenu;
this.picChrBank2.Cursor = System.Windows.Forms.Cursors.Hand;
this.picChrBank2.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
this.picChrBank2.Location = new System.Drawing.Point(1, 261);
this.picChrBank2.Margin = new System.Windows.Forms.Padding(1);
this.picChrBank2.Name = "picChrBank2";
this.picChrBank2.Size = new System.Drawing.Size(258, 258);
this.picChrBank2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.picChrBank2.TabIndex = 1;
this.picChrBank2.TabStop = false;
this.picChrBank2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picChrBank_MouseDown);
this.picChrBank2.MouseEnter += new System.EventHandler(this.picChrBank_MouseEnter);
this.picChrBank2.MouseLeave += new System.EventHandler(this.picChrBank_MouseLeave);
this.picChrBank2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picChrBank_MouseMove);
//
// grpTileInfo // grpTileInfo
// //
this.grpTileInfo.Controls.Add(this.tableLayoutPanel4); this.grpTileInfo.Controls.Add(this.tableLayoutPanel4);
this.grpTileInfo.Dock = System.Windows.Forms.DockStyle.Top; this.grpTileInfo.Location = new System.Drawing.Point(263, 3);
this.grpTileInfo.Location = new System.Drawing.Point(269, 3);
this.grpTileInfo.Name = "grpTileInfo"; this.grpTileInfo.Name = "grpTileInfo";
this.grpTileInfo.Size = new System.Drawing.Size(264, 291); this.grpTileInfo.Size = new System.Drawing.Size(435, 254);
this.grpTileInfo.TabIndex = 4; this.grpTileInfo.TabIndex = 4;
this.grpTileInfo.TabStop = false; this.grpTileInfo.TabStop = false;
this.grpTileInfo.Text = "Tile Info"; this.grpTileInfo.Text = "Tile Info";
@ -329,7 +416,7 @@ namespace Mesen.GUI.Debugger.Controls
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel4.Size = new System.Drawing.Size(258, 272); this.tableLayoutPanel4.Size = new System.Drawing.Size(429, 235);
this.tableLayoutPanel4.TabIndex = 0; this.tableLayoutPanel4.TabIndex = 0;
// //
// txtTileAddress // txtTileAddress
@ -435,109 +522,6 @@ namespace Mesen.GUI.Debugger.Controls
this.ctrlTilePalette.Size = new System.Drawing.Size(130, 34); this.ctrlTilePalette.Size = new System.Drawing.Size(130, 34);
this.ctrlTilePalette.TabIndex = 17; this.ctrlTilePalette.TabIndex = 17;
// //
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 1;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Controls.Add(this.picChrBank1, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.picChrBank2, 0, 1);
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 2;
this.tableLayoutPanel3.SetRowSpan(this.tableLayoutPanel2, 2);
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(260, 520);
this.tableLayoutPanel2.TabIndex = 7;
//
// picChrBank1
//
this.picChrBank1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picChrBank1.ContextMenuStrip = this.ctxMenu;
this.picChrBank1.Cursor = System.Windows.Forms.Cursors.Hand;
this.picChrBank1.Location = new System.Drawing.Point(1, 1);
this.picChrBank1.Margin = new System.Windows.Forms.Padding(1);
this.picChrBank1.Name = "picChrBank1";
this.picChrBank1.Size = new System.Drawing.Size(258, 258);
this.picChrBank1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.picChrBank1.TabIndex = 0;
this.picChrBank1.TabStop = false;
this.picChrBank1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picChrBank_MouseDown);
this.picChrBank1.MouseEnter += new System.EventHandler(this.picChrBank_MouseEnter);
this.picChrBank1.MouseLeave += new System.EventHandler(this.picChrBank_MouseLeave);
this.picChrBank1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picChrBank_MouseMove);
//
// ctxMenu
//
this.ctxMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuEditInMemoryViewer,
this.toolStripMenuItem2,
this.mnuCopyHdPack,
this.toolStripMenuItem1,
this.mnuCopyToClipboard,
this.mnuExportToPng});
this.ctxMenu.Name = "ctxMenu";
this.ctxMenu.Size = new System.Drawing.Size(222, 104);
this.ctxMenu.Opening += new System.ComponentModel.CancelEventHandler(this.ctxMenu_Opening);
//
// mnuEditInMemoryViewer
//
this.mnuEditInMemoryViewer.Image = global::Mesen.GUI.Properties.Resources.CheatCode;
this.mnuEditInMemoryViewer.Name = "mnuEditInMemoryViewer";
this.mnuEditInMemoryViewer.Size = new System.Drawing.Size(221, 22);
this.mnuEditInMemoryViewer.Text = "Edit in Memory Viewer";
this.mnuEditInMemoryViewer.Click += new System.EventHandler(this.mnuEditInMemoryViewer_Click);
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(218, 6);
//
// mnuCopyHdPack
//
this.mnuCopyHdPack.Name = "mnuCopyHdPack";
this.mnuCopyHdPack.Size = new System.Drawing.Size(221, 22);
this.mnuCopyHdPack.Text = "Copy Tile (HD Pack Format)";
this.mnuCopyHdPack.Click += new System.EventHandler(this.mnuCopyHdPack_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(218, 6);
//
// mnuCopyToClipboard
//
this.mnuCopyToClipboard.Image = global::Mesen.GUI.Properties.Resources.Copy;
this.mnuCopyToClipboard.Name = "mnuCopyToClipboard";
this.mnuCopyToClipboard.Size = new System.Drawing.Size(221, 22);
this.mnuCopyToClipboard.Text = "Copy image to clipboard";
this.mnuCopyToClipboard.Click += new System.EventHandler(this.mnuCopyToClipboard_Click);
//
// mnuExportToPng
//
this.mnuExportToPng.Image = global::Mesen.GUI.Properties.Resources.Export;
this.mnuExportToPng.Name = "mnuExportToPng";
this.mnuExportToPng.Size = new System.Drawing.Size(221, 22);
this.mnuExportToPng.Text = "Export image to PNG";
this.mnuExportToPng.Click += new System.EventHandler(this.mnuExportToPng_Click);
//
// picChrBank2
//
this.picChrBank2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picChrBank2.ContextMenuStrip = this.ctxMenu;
this.picChrBank2.Cursor = System.Windows.Forms.Cursors.Hand;
this.picChrBank2.Location = new System.Drawing.Point(1, 261);
this.picChrBank2.Margin = new System.Windows.Forms.Padding(1);
this.picChrBank2.Name = "picChrBank2";
this.picChrBank2.Size = new System.Drawing.Size(258, 258);
this.picChrBank2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.picChrBank2.TabIndex = 1;
this.picChrBank2.TabStop = false;
this.picChrBank2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picChrBank_MouseDown);
this.picChrBank2.MouseEnter += new System.EventHandler(this.picChrBank_MouseEnter);
this.picChrBank2.MouseLeave += new System.EventHandler(this.picChrBank_MouseLeave);
this.picChrBank2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picChrBank_MouseMove);
//
// toolTip // toolTip
// //
this.toolTip.AutoPopDelay = 32700; this.toolTip.AutoPopDelay = 32700;
@ -548,10 +532,12 @@ namespace Mesen.GUI.Debugger.Controls
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tableLayoutPanel3); this.Controls.Add(this.tlpMain);
this.Name = "ctrlChrViewer"; this.Name = "ctrlChrViewer";
this.Size = new System.Drawing.Size(534, 525); this.Size = new System.Drawing.Size(701, 522);
this.tableLayoutPanel3.ResumeLayout(false); this.tlpMain.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picChrBank1)).EndInit();
this.ctxMenu.ResumeLayout(false);
this.grpDisplayOptions.ResumeLayout(false); this.grpDisplayOptions.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout(); this.tableLayoutPanel1.PerformLayout();
@ -562,24 +548,21 @@ namespace Mesen.GUI.Debugger.Controls
this.flowLayoutPanel2.PerformLayout(); this.flowLayoutPanel2.PerformLayout();
this.flpHighlight.ResumeLayout(false); this.flpHighlight.ResumeLayout(false);
this.flpHighlight.PerformLayout(); this.flpHighlight.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picChrBank2)).EndInit();
this.grpTileInfo.ResumeLayout(false); this.grpTileInfo.ResumeLayout(false);
this.tableLayoutPanel4.ResumeLayout(false); this.tableLayoutPanel4.ResumeLayout(false);
this.tableLayoutPanel4.PerformLayout(); this.tableLayoutPanel4.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picTile)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picTile)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picColorTooltip)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picColorTooltip)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picTileTooltip)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picTileTooltip)).EndInit();
this.tableLayoutPanel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picChrBank1)).EndInit();
this.ctxMenu.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picChrBank2)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; private System.Windows.Forms.TableLayoutPanel tlpMain;
private System.Windows.Forms.PictureBox picChrBank1; private ctrlMesenPictureBox picChrBank1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Label lblPalette; private System.Windows.Forms.Label lblPalette;
private System.Windows.Forms.ComboBox cboPalette; private System.Windows.Forms.ComboBox cboPalette;
@ -599,8 +582,7 @@ namespace Mesen.GUI.Debugger.Controls
private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox txtTileIndex; private System.Windows.Forms.TextBox txtTileIndex;
private System.Windows.Forms.PictureBox picTile; private System.Windows.Forms.PictureBox picTile;
private System.Windows.Forms.PictureBox picChrBank2; private ctrlMesenPictureBox picChrBank2;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.GroupBox grpDisplayOptions; private System.Windows.Forms.GroupBox grpDisplayOptions;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.PictureBox picColorTooltip; private System.Windows.Forms.PictureBox picColorTooltip;

View file

@ -66,9 +66,19 @@ namespace Mesen.GUI.Debugger.Controls
} }
} }
public Size GetCompactSize() public Size GetCompactSize(bool includeMargins)
{ {
return new Size(picChrBank1.Width, picChrBank1.Height * 2 + picChrBank1.Margin.Bottom * 2); int margins = includeMargins ? (picChrBank1.Margin.Bottom + picChrBank2.Margin.Top) : 0;
return new Size(picChrBank1.Width, picChrBank1.Height * 2 + margins);
}
public void ScaleImage(double scale)
{
picChrBank1.Size = new Size((int)(picChrBank1.Width * scale), (int)(picChrBank1.Height * scale));
picChrBank2.Size = new Size((int)(picChrBank2.Width * scale), (int)(picChrBank2.Height * scale));
picChrBank1.InterpolationMode = scale > 1 ? InterpolationMode.NearestNeighbor : InterpolationMode.Default;
picChrBank2.InterpolationMode = scale > 1 ? InterpolationMode.NearestNeighbor : InterpolationMode.Default;
} }
protected override void OnLoad(EventArgs e) protected override void OnLoad(EventArgs e)

View file

@ -31,7 +31,7 @@ namespace Mesen.GUI.Debugger.Controls
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.picNametable = new System.Windows.Forms.PictureBox(); this.picNametable = new Mesen.GUI.Controls.ctrlMesenPictureBox();
this.ctxMenu = new Mesen.GUI.Controls.ctrlMesenContextMenuStrip(this.components); this.ctxMenu = new Mesen.GUI.Controls.ctrlMesenContextMenuStrip(this.components);
this.mnuAddBreakpoint = new System.Windows.Forms.ToolStripMenuItem(); this.mnuAddBreakpoint = new System.Windows.Forms.ToolStripMenuItem();
this.mnuEditInMemoryViewer = new System.Windows.Forms.ToolStripMenuItem(); this.mnuEditInMemoryViewer = new System.Windows.Forms.ToolStripMenuItem();
@ -65,6 +65,7 @@ namespace Mesen.GUI.Debugger.Controls
this.ctrlTilePalette = new Mesen.GUI.Debugger.Controls.ctrlTilePalette(); this.ctrlTilePalette = new Mesen.GUI.Debugger.Controls.ctrlTilePalette();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.chkShowPpuScrollOverlay = new System.Windows.Forms.CheckBox(); this.chkShowPpuScrollOverlay = new System.Windows.Forms.CheckBox();
this.chkShowAttributeColorsOnly = new System.Windows.Forms.CheckBox();
this.chkShowTileGrid = new System.Windows.Forms.CheckBox(); this.chkShowTileGrid = new System.Windows.Forms.CheckBox();
this.chkShowAttributeGrid = new System.Windows.Forms.CheckBox(); this.chkShowAttributeGrid = new System.Windows.Forms.CheckBox();
this.chkUseGrayscalePalette = new System.Windows.Forms.CheckBox(); this.chkUseGrayscalePalette = new System.Windows.Forms.CheckBox();
@ -76,7 +77,6 @@ namespace Mesen.GUI.Debugger.Controls
this.chkHighlightAttributeUpdates = new System.Windows.Forms.CheckBox(); this.chkHighlightAttributeUpdates = new System.Windows.Forms.CheckBox();
this.lblHighlight = new System.Windows.Forms.Label(); this.lblHighlight = new System.Windows.Forms.Label();
this.chkIgnoreRedundantWrites = new System.Windows.Forms.CheckBox(); this.chkIgnoreRedundantWrites = new System.Windows.Forms.CheckBox();
this.chkShowAttributeColorsOnly = new System.Windows.Forms.CheckBox();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picNametable)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picNametable)).BeginInit();
this.ctxMenu.SuspendLayout(); this.ctxMenu.SuspendLayout();
@ -96,7 +96,6 @@ namespace Mesen.GUI.Debugger.Controls
this.tableLayoutPanel1.Controls.Add(this.grpTileInfo, 1, 0); this.tableLayoutPanel1.Controls.Add(this.grpTileInfo, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 1, 1); this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel3, 0, 2); this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel3, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.chkIgnoreRedundantWrites, 0, 3);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.Name = "tableLayoutPanel1";
@ -105,13 +104,14 @@ namespace Mesen.GUI.Debugger.Controls
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(697, 530); this.tableLayoutPanel1.Size = new System.Drawing.Size(701, 530);
this.tableLayoutPanel1.TabIndex = 2; this.tableLayoutPanel1.TabIndex = 2;
// //
// picNametable // picNametable
// //
this.picNametable.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.picNametable.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picNametable.ContextMenuStrip = this.ctxMenu; this.picNametable.ContextMenuStrip = this.ctxMenu;
this.picNametable.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
this.picNametable.Location = new System.Drawing.Point(4, 4); this.picNametable.Location = new System.Drawing.Point(4, 4);
this.picNametable.Margin = new System.Windows.Forms.Padding(4, 4, 4, 0); this.picNametable.Margin = new System.Windows.Forms.Padding(4, 4, 4, 0);
this.picNametable.Name = "picNametable"; this.picNametable.Name = "picNametable";
@ -208,11 +208,10 @@ namespace Mesen.GUI.Debugger.Controls
// //
// grpTileInfo // grpTileInfo
// //
this.grpTileInfo.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.grpTileInfo.Controls.Add(this.tableLayoutPanel2); this.grpTileInfo.Controls.Add(this.tableLayoutPanel2);
this.grpTileInfo.Location = new System.Drawing.Point(525, 3); this.grpTileInfo.Location = new System.Drawing.Point(525, 3);
this.grpTileInfo.Name = "grpTileInfo"; this.grpTileInfo.Name = "grpTileInfo";
this.grpTileInfo.Size = new System.Drawing.Size(169, 345); this.grpTileInfo.Size = new System.Drawing.Size(173, 345);
this.grpTileInfo.TabIndex = 4; this.grpTileInfo.TabIndex = 4;
this.grpTileInfo.TabStop = false; this.grpTileInfo.TabStop = false;
this.grpTileInfo.Text = "Tile Info"; this.grpTileInfo.Text = "Tile Info";
@ -259,7 +258,7 @@ namespace Mesen.GUI.Debugger.Controls
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(163, 326); this.tableLayoutPanel2.Size = new System.Drawing.Size(167, 326);
this.tableLayoutPanel2.TabIndex = 0; this.tableLayoutPanel2.TabIndex = 0;
// //
// txtPpuAddress // txtPpuAddress
@ -447,15 +446,12 @@ namespace Mesen.GUI.Debugger.Controls
// //
// flowLayoutPanel1 // flowLayoutPanel1
// //
this.flowLayoutPanel1.AutoSize = true;
this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.flowLayoutPanel1.Controls.Add(this.chkShowPpuScrollOverlay); this.flowLayoutPanel1.Controls.Add(this.chkShowPpuScrollOverlay);
this.flowLayoutPanel1.Controls.Add(this.chkShowAttributeColorsOnly); this.flowLayoutPanel1.Controls.Add(this.chkShowAttributeColorsOnly);
this.flowLayoutPanel1.Controls.Add(this.chkShowTileGrid); this.flowLayoutPanel1.Controls.Add(this.chkShowTileGrid);
this.flowLayoutPanel1.Controls.Add(this.chkShowAttributeGrid); this.flowLayoutPanel1.Controls.Add(this.chkShowAttributeGrid);
this.flowLayoutPanel1.Controls.Add(this.chkUseGrayscalePalette); this.flowLayoutPanel1.Controls.Add(this.chkUseGrayscalePalette);
this.flowLayoutPanel1.Controls.Add(this.chkHighlightChrTile); this.flowLayoutPanel1.Controls.Add(this.chkHighlightChrTile);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(522, 351); this.flowLayoutPanel1.Location = new System.Drawing.Point(522, 351);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Name = "flowLayoutPanel1";
@ -474,6 +470,17 @@ namespace Mesen.GUI.Debugger.Controls
this.chkShowPpuScrollOverlay.UseVisualStyleBackColor = true; this.chkShowPpuScrollOverlay.UseVisualStyleBackColor = true;
this.chkShowPpuScrollOverlay.Click += new System.EventHandler(this.chkShowScrollWindow_Click); this.chkShowPpuScrollOverlay.Click += new System.EventHandler(this.chkShowScrollWindow_Click);
// //
// chkShowAttributeColorsOnly
//
this.chkShowAttributeColorsOnly.AutoSize = true;
this.chkShowAttributeColorsOnly.Location = new System.Drawing.Point(3, 26);
this.chkShowAttributeColorsOnly.Name = "chkShowAttributeColorsOnly";
this.chkShowAttributeColorsOnly.Size = new System.Drawing.Size(147, 17);
this.chkShowAttributeColorsOnly.TabIndex = 6;
this.chkShowAttributeColorsOnly.Text = "Show attribute colors only";
this.chkShowAttributeColorsOnly.UseVisualStyleBackColor = true;
this.chkShowAttributeColorsOnly.Click += new System.EventHandler(this.chkShowAttributeColorsOnly_Click);
//
// chkShowTileGrid // chkShowTileGrid
// //
this.chkShowTileGrid.AutoSize = true; this.chkShowTileGrid.AutoSize = true;
@ -531,14 +538,15 @@ namespace Mesen.GUI.Debugger.Controls
this.tableLayoutPanel3.Controls.Add(this.lblMirroringType, 1, 0); this.tableLayoutPanel3.Controls.Add(this.lblMirroringType, 1, 0);
this.tableLayoutPanel3.Controls.Add(this.chkHighlightTileUpdates, 4, 0); this.tableLayoutPanel3.Controls.Add(this.chkHighlightTileUpdates, 4, 0);
this.tableLayoutPanel3.Controls.Add(this.chkHighlightAttributeUpdates, 5, 0); this.tableLayoutPanel3.Controls.Add(this.chkHighlightAttributeUpdates, 5, 0);
this.tableLayoutPanel3.Controls.Add(this.chkIgnoreRedundantWrites, 4, 1);
this.tableLayoutPanel3.Controls.Add(this.lblHighlight, 3, 0); this.tableLayoutPanel3.Controls.Add(this.lblHighlight, 3, 0);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel3.Location = new System.Drawing.Point(0, 486); this.tableLayoutPanel3.Location = new System.Drawing.Point(0, 486);
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel3.Name = "tableLayoutPanel3"; this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 1; this.tableLayoutPanel3.RowCount = 2;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(522, 20); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(522, 40);
this.tableLayoutPanel3.TabIndex = 6; this.tableLayoutPanel3.TabIndex = 6;
// //
// lblMirroring // lblMirroring
@ -602,7 +610,8 @@ namespace Mesen.GUI.Debugger.Controls
// //
this.chkIgnoreRedundantWrites.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.chkIgnoreRedundantWrites.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.chkIgnoreRedundantWrites.AutoSize = true; this.chkIgnoreRedundantWrites.AutoSize = true;
this.chkIgnoreRedundantWrites.Location = new System.Drawing.Point(332, 507); this.tableLayoutPanel3.SetColumnSpan(this.chkIgnoreRedundantWrites, 2);
this.chkIgnoreRedundantWrites.Location = new System.Drawing.Point(332, 21);
this.chkIgnoreRedundantWrites.Margin = new System.Windows.Forms.Padding(3, 1, 3, 0); this.chkIgnoreRedundantWrites.Margin = new System.Windows.Forms.Padding(3, 1, 3, 0);
this.chkIgnoreRedundantWrites.Name = "chkIgnoreRedundantWrites"; this.chkIgnoreRedundantWrites.Name = "chkIgnoreRedundantWrites";
this.chkIgnoreRedundantWrites.Size = new System.Drawing.Size(187, 17); this.chkIgnoreRedundantWrites.Size = new System.Drawing.Size(187, 17);
@ -611,26 +620,14 @@ namespace Mesen.GUI.Debugger.Controls
this.chkIgnoreRedundantWrites.UseVisualStyleBackColor = true; this.chkIgnoreRedundantWrites.UseVisualStyleBackColor = true;
this.chkIgnoreRedundantWrites.Click += new System.EventHandler(this.chkIgnoreRedundantWrites_Click); this.chkIgnoreRedundantWrites.Click += new System.EventHandler(this.chkIgnoreRedundantWrites_Click);
// //
// chkShowAttributeColorsOnly
//
this.chkShowAttributeColorsOnly.AutoSize = true;
this.chkShowAttributeColorsOnly.Location = new System.Drawing.Point(3, 26);
this.chkShowAttributeColorsOnly.Name = "chkShowAttributeColorsOnly";
this.chkShowAttributeColorsOnly.Size = new System.Drawing.Size(147, 17);
this.chkShowAttributeColorsOnly.TabIndex = 6;
this.chkShowAttributeColorsOnly.Text = "Show attribute colors only";
this.chkShowAttributeColorsOnly.UseVisualStyleBackColor = true;
this.chkShowAttributeColorsOnly.Click += new System.EventHandler(this.chkShowAttributeColorsOnly_Click);
//
// ctrlNametableViewer // ctrlNametableViewer
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.tableLayoutPanel1);
this.Name = "ctrlNametableViewer"; this.Name = "ctrlNametableViewer";
this.Size = new System.Drawing.Size(697, 530); this.Size = new System.Drawing.Size(701, 530);
this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picNametable)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picNametable)).EndInit();
this.ctxMenu.ResumeLayout(false); this.ctxMenu.ResumeLayout(false);
this.grpTileInfo.ResumeLayout(false); this.grpTileInfo.ResumeLayout(false);
@ -649,7 +646,7 @@ namespace Mesen.GUI.Debugger.Controls
#endregion #endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.PictureBox picNametable; private ctrlMesenPictureBox picNametable;
private System.Windows.Forms.GroupBox grpTileInfo; private System.Windows.Forms.GroupBox grpTileInfo;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.TextBox txtPaletteAddress; private System.Windows.Forms.TextBox txtPaletteAddress;

View file

@ -11,6 +11,7 @@ using System.Runtime.InteropServices;
using Mesen.GUI.Config; using Mesen.GUI.Config;
using Mesen.GUI.Controls; using Mesen.GUI.Controls;
using Mesen.GUI.Forms; using Mesen.GUI.Forms;
using System.Drawing.Drawing2D;
namespace Mesen.GUI.Debugger.Controls namespace Mesen.GUI.Debugger.Controls
{ {
@ -67,11 +68,17 @@ namespace Mesen.GUI.Debugger.Controls
} }
} }
public Size GetCompactSize() public Size GetCompactSize(bool includeMargins)
{ {
return new Size(picNametable.Width, picNametable.Height); return new Size(picNametable.Width, picNametable.Height);
} }
public void ScaleImage(double scale)
{
picNametable.Size = new Size((int)(picNametable.Width * scale), (int)(picNametable.Height * scale));
picNametable.InterpolationMode = scale > 1 ? InterpolationMode.NearestNeighbor : InterpolationMode.Default;
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{ {
if(ctxMenu.ProcessCommandKey(ref msg, keyData)) { if(ctxMenu.ProcessCommandKey(ref msg, keyData)) {

View file

@ -1,4 +1,6 @@
namespace Mesen.GUI.Debugger.Controls using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger.Controls
{ {
partial class ctrlPaletteViewer partial class ctrlPaletteViewer
{ {
@ -42,11 +44,11 @@
this.txtColorCodeRgb = new System.Windows.Forms.TextBox(); this.txtColorCodeRgb = new System.Windows.Forms.TextBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.lblPaletteSprites = new System.Windows.Forms.Label(); this.lblPaletteSprites = new System.Windows.Forms.Label();
this.picPaletteSprites = new System.Windows.Forms.PictureBox(); this.picPaletteSprites = new Mesen.GUI.Controls.ctrlMesenPictureBox();
this.ctxMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.ctxMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
this.mnuCopyHexColor = new System.Windows.Forms.ToolStripMenuItem(); this.mnuCopyHexColor = new System.Windows.Forms.ToolStripMenuItem();
this.mnuCopyRgbColor = new System.Windows.Forms.ToolStripMenuItem(); this.mnuCopyRgbColor = new System.Windows.Forms.ToolStripMenuItem();
this.picPaletteBg = new System.Windows.Forms.PictureBox(); this.picPaletteBg = new Mesen.GUI.Controls.ctrlMesenPictureBox();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.picHelp = new System.Windows.Forms.PictureBox(); this.picHelp = new System.Windows.Forms.PictureBox();
this.lblClickColorHint = new System.Windows.Forms.Label(); this.lblClickColorHint = new System.Windows.Forms.Label();
@ -65,11 +67,10 @@
// grpColorInfo // grpColorInfo
// //
this.grpColorInfo.Controls.Add(this.tableLayoutPanel4); this.grpColorInfo.Controls.Add(this.tableLayoutPanel4);
this.grpColorInfo.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpColorInfo.Location = new System.Drawing.Point(273, 3); this.grpColorInfo.Location = new System.Drawing.Point(273, 3);
this.grpColorInfo.Name = "grpColorInfo"; this.grpColorInfo.Name = "grpColorInfo";
this.tableLayoutPanel3.SetRowSpan(this.grpColorInfo, 3); this.tableLayoutPanel3.SetRowSpan(this.grpColorInfo, 3);
this.grpColorInfo.Size = new System.Drawing.Size(406, 305); this.grpColorInfo.Size = new System.Drawing.Size(425, 205);
this.grpColorInfo.TabIndex = 4; this.grpColorInfo.TabIndex = 4;
this.grpColorInfo.TabStop = false; this.grpColorInfo.TabStop = false;
this.grpColorInfo.Text = "Color Info"; this.grpColorInfo.Text = "Color Info";
@ -89,7 +90,6 @@
this.tableLayoutPanel4.Controls.Add(this.label1, 0, 4); this.tableLayoutPanel4.Controls.Add(this.label1, 0, 4);
this.tableLayoutPanel4.Controls.Add(this.txtColorCodeHex, 1, 3); this.tableLayoutPanel4.Controls.Add(this.txtColorCodeHex, 1, 3);
this.tableLayoutPanel4.Controls.Add(this.txtColorCodeRgb, 1, 4); this.tableLayoutPanel4.Controls.Add(this.txtColorCodeRgb, 1, 4);
this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 16); this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 16);
this.tableLayoutPanel4.Name = "tableLayoutPanel4"; this.tableLayoutPanel4.Name = "tableLayoutPanel4";
this.tableLayoutPanel4.RowCount = 6; this.tableLayoutPanel4.RowCount = 6;
@ -99,7 +99,7 @@
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel4.Size = new System.Drawing.Size(400, 286); this.tableLayoutPanel4.Size = new System.Drawing.Size(382, 183);
this.tableLayoutPanel4.TabIndex = 0; this.tableLayoutPanel4.TabIndex = 0;
// //
// txtPaletteAddress // txtPaletteAddress
@ -217,7 +217,7 @@
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(682, 311); this.tableLayoutPanel3.Size = new System.Drawing.Size(701, 311);
this.tableLayoutPanel3.TabIndex = 3; this.tableLayoutPanel3.TabIndex = 3;
// //
// lblPaletteSprites // lblPaletteSprites
@ -236,6 +236,7 @@
this.picPaletteSprites.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.picPaletteSprites.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picPaletteSprites.ContextMenuStrip = this.ctxMenu; this.picPaletteSprites.ContextMenuStrip = this.ctxMenu;
this.picPaletteSprites.Cursor = System.Windows.Forms.Cursors.Hand; this.picPaletteSprites.Cursor = System.Windows.Forms.Cursors.Hand;
this.picPaletteSprites.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
this.picPaletteSprites.Location = new System.Drawing.Point(138, 4); this.picPaletteSprites.Location = new System.Drawing.Point(138, 4);
this.picPaletteSprites.Margin = new System.Windows.Forms.Padding(2, 4, 2, 4); this.picPaletteSprites.Margin = new System.Windows.Forms.Padding(2, 4, 2, 4);
this.picPaletteSprites.Name = "picPaletteSprites"; this.picPaletteSprites.Name = "picPaletteSprites";
@ -272,6 +273,7 @@
this.picPaletteBg.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.picPaletteBg.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picPaletteBg.ContextMenuStrip = this.ctxMenu; this.picPaletteBg.ContextMenuStrip = this.ctxMenu;
this.picPaletteBg.Cursor = System.Windows.Forms.Cursors.Hand; this.picPaletteBg.Cursor = System.Windows.Forms.Cursors.Hand;
this.picPaletteBg.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
this.picPaletteBg.Location = new System.Drawing.Point(4, 4); this.picPaletteBg.Location = new System.Drawing.Point(4, 4);
this.picPaletteBg.Margin = new System.Windows.Forms.Padding(4, 4, 2, 4); this.picPaletteBg.Margin = new System.Windows.Forms.Padding(4, 4, 2, 4);
this.picPaletteBg.Name = "picPaletteBg"; this.picPaletteBg.Name = "picPaletteBg";
@ -284,12 +286,10 @@
// //
// flowLayoutPanel1 // flowLayoutPanel1
// //
this.flowLayoutPanel1.AutoSize = true;
this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel3.SetColumnSpan(this.flowLayoutPanel1, 2); this.tableLayoutPanel3.SetColumnSpan(this.flowLayoutPanel1, 2);
this.flowLayoutPanel1.Controls.Add(this.picHelp); this.flowLayoutPanel1.Controls.Add(this.picHelp);
this.flowLayoutPanel1.Controls.Add(this.lblClickColorHint); this.flowLayoutPanel1.Controls.Add(this.lblClickColorHint);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 154); this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 154);
this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(264, 26); this.flowLayoutPanel1.Size = new System.Drawing.Size(264, 26);
@ -332,7 +332,7 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tableLayoutPanel3); this.Controls.Add(this.tableLayoutPanel3);
this.Name = "ctrlPaletteViewer"; this.Name = "ctrlPaletteViewer";
this.Size = new System.Drawing.Size(682, 311); this.Size = new System.Drawing.Size(701, 311);
this.grpColorInfo.ResumeLayout(false); this.grpColorInfo.ResumeLayout(false);
this.tableLayoutPanel4.ResumeLayout(false); this.tableLayoutPanel4.ResumeLayout(false);
this.tableLayoutPanel4.PerformLayout(); this.tableLayoutPanel4.PerformLayout();
@ -351,7 +351,7 @@
#endregion #endregion
private System.Windows.Forms.PictureBox picPaletteBg; private ctrlMesenPictureBox picPaletteBg;
private System.Windows.Forms.GroupBox grpColorInfo; private System.Windows.Forms.GroupBox grpColorInfo;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4;
private System.Windows.Forms.TextBox txtPaletteAddress; private System.Windows.Forms.TextBox txtPaletteAddress;
@ -371,7 +371,7 @@
private System.Windows.Forms.ContextMenuStrip ctxMenu; private System.Windows.Forms.ContextMenuStrip ctxMenu;
private System.Windows.Forms.ToolStripMenuItem mnuCopyHexColor; private System.Windows.Forms.ToolStripMenuItem mnuCopyHexColor;
private System.Windows.Forms.ToolStripMenuItem mnuCopyRgbColor; private System.Windows.Forms.ToolStripMenuItem mnuCopyRgbColor;
private System.Windows.Forms.PictureBox picPaletteSprites; private ctrlMesenPictureBox picPaletteSprites;
private System.Windows.Forms.Label lblBgPalette; private System.Windows.Forms.Label lblBgPalette;
private System.Windows.Forms.Label lblPaletteSprites; private System.Windows.Forms.Label lblPaletteSprites;
} }

View file

@ -10,6 +10,7 @@ using System.Windows.Forms;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Mesen.GUI.Controls; using Mesen.GUI.Controls;
using Mesen.GUI.Forms; using Mesen.GUI.Forms;
using System.Drawing.Drawing2D;
namespace Mesen.GUI.Debugger.Controls namespace Mesen.GUI.Debugger.Controls
{ {
@ -24,9 +25,18 @@ namespace Mesen.GUI.Debugger.Controls
InitializeComponent(); InitializeComponent();
} }
public Size GetCompactSize() public Size GetCompactSize(bool includeMargins)
{ {
return new Size(picPaletteBg.Width * 2 + picPaletteBg.Margin.Right * 2, picPaletteBg.Height); int margins = includeMargins ? (picPaletteBg.Margin.Right + picPaletteSprites.Margin.Left) : 0;
return new Size(picPaletteBg.Width * 2 + margins, picPaletteBg.Height);
}
public void ScaleImage(double scale)
{
picPaletteBg.Size = new Size((int)(picPaletteBg.Width * scale), (int)(picPaletteBg.Height * scale));
picPaletteSprites.Size = new Size((int)(picPaletteSprites.Width * scale), (int)(picPaletteSprites.Height * scale));
picPaletteBg.InterpolationMode = scale > 1 ? InterpolationMode.NearestNeighbor : InterpolationMode.Default;
picPaletteSprites.InterpolationMode = scale > 1 ? InterpolationMode.NearestNeighbor : InterpolationMode.Default;
} }
public void GetData() public void GetData()
@ -80,8 +90,8 @@ namespace Mesen.GUI.Debugger.Controls
private void picPalette_MouseMove(object sender, MouseEventArgs e) private void picPalette_MouseMove(object sender, MouseEventArgs e)
{ {
int tileX = Math.Max(0, Math.Min(e.X * 128 / (picPaletteBg.Width - 2) / 32, 31)); int tileX = Math.Max(0, Math.Min(e.X * 128 / (picPaletteBg.Width - 2) / 32, 3));
int tileY = Math.Max(0, Math.Min(e.Y * 128 / (picPaletteBg.Height - 2) / 32, 31)); int tileY = Math.Max(0, Math.Min(e.Y * 128 / (picPaletteBg.Height - 2) / 32, 3));
int paletteIndex = tileY * 4 + tileX + (sender == picPaletteSprites ? 16 : 0); int paletteIndex = tileY * 4 + tileX + (sender == picPaletteSprites ? 16 : 0);

View file

@ -36,7 +36,7 @@ namespace Mesen.GUI.Debugger.Controls
this.lblPalette = new System.Windows.Forms.Label(); this.lblPalette = new System.Windows.Forms.Label();
this.txtSpriteIndex = new System.Windows.Forms.TextBox(); this.txtSpriteIndex = new System.Windows.Forms.TextBox();
this.lblSpriteIndex = new System.Windows.Forms.Label(); this.lblSpriteIndex = new System.Windows.Forms.Label();
this.picPreview = new System.Windows.Forms.PictureBox(); this.picPreview = new Mesen.GUI.Controls.ctrlMesenPictureBox();
this.ctxMenu = new Mesen.GUI.Controls.ctrlMesenContextMenuStrip(this.components); this.ctxMenu = new Mesen.GUI.Controls.ctrlMesenContextMenuStrip(this.components);
this.mnuEditInMemoryViewer = new System.Windows.Forms.ToolStripMenuItem(); this.mnuEditInMemoryViewer = new System.Windows.Forms.ToolStripMenuItem();
this.mnuShowInChrViewer = new System.Windows.Forms.ToolStripMenuItem(); this.mnuShowInChrViewer = new System.Windows.Forms.ToolStripMenuItem();
@ -63,7 +63,7 @@ namespace Mesen.GUI.Debugger.Controls
this.lblTile = new System.Windows.Forms.Label(); this.lblTile = new System.Windows.Forms.Label();
this.picTile = new System.Windows.Forms.PictureBox(); this.picTile = new System.Windows.Forms.PictureBox();
this.chkDisplaySpriteOutlines = new System.Windows.Forms.CheckBox(); this.chkDisplaySpriteOutlines = new System.Windows.Forms.CheckBox();
this.picSprites = new System.Windows.Forms.PictureBox(); this.picSprites = new Mesen.GUI.Controls.ctrlMesenPictureBox();
this.tlpMain.SuspendLayout(); this.tlpMain.SuspendLayout();
this.grpSpriteInfo.SuspendLayout(); this.grpSpriteInfo.SuspendLayout();
this.tlpInfo.SuspendLayout(); this.tlpInfo.SuspendLayout();
@ -94,7 +94,7 @@ namespace Mesen.GUI.Debugger.Controls
// grpSpriteInfo // grpSpriteInfo
// //
this.grpSpriteInfo.Controls.Add(this.tlpInfo); this.grpSpriteInfo.Controls.Add(this.tlpInfo);
this.grpSpriteInfo.Dock = System.Windows.Forms.DockStyle.Fill; this.grpSpriteInfo.Dock = System.Windows.Forms.DockStyle.Top;
this.grpSpriteInfo.Location = new System.Drawing.Point(269, 3); this.grpSpriteInfo.Location = new System.Drawing.Point(269, 3);
this.grpSpriteInfo.Name = "grpSpriteInfo"; this.grpSpriteInfo.Name = "grpSpriteInfo";
this.tlpMain.SetRowSpan(this.grpSpriteInfo, 2); this.tlpMain.SetRowSpan(this.grpSpriteInfo, 2);
@ -179,7 +179,9 @@ namespace Mesen.GUI.Debugger.Controls
this.picPreview.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.picPreview.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tlpInfo.SetColumnSpan(this.picPreview, 4); this.tlpInfo.SetColumnSpan(this.picPreview, 4);
this.picPreview.ContextMenuStrip = this.ctxMenu; this.picPreview.ContextMenuStrip = this.ctxMenu;
this.picPreview.Location = new System.Drawing.Point(75, 231); this.picPreview.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
this.picPreview.Location = new System.Drawing.Point(76, 232);
this.picPreview.Margin = new System.Windows.Forms.Padding(4);
this.picPreview.Name = "picPreview"; this.picPreview.Name = "picPreview";
this.picPreview.Size = new System.Drawing.Size(258, 242); this.picPreview.Size = new System.Drawing.Size(258, 242);
this.picPreview.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.picPreview.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@ -439,7 +441,7 @@ namespace Mesen.GUI.Debugger.Controls
// //
this.chkDisplaySpriteOutlines.AutoSize = true; this.chkDisplaySpriteOutlines.AutoSize = true;
this.tlpInfo.SetColumnSpan(this.chkDisplaySpriteOutlines, 4); this.tlpInfo.SetColumnSpan(this.chkDisplaySpriteOutlines, 4);
this.chkDisplaySpriteOutlines.Location = new System.Drawing.Point(3, 479); this.chkDisplaySpriteOutlines.Location = new System.Drawing.Point(3, 481);
this.chkDisplaySpriteOutlines.Name = "chkDisplaySpriteOutlines"; this.chkDisplaySpriteOutlines.Name = "chkDisplaySpriteOutlines";
this.chkDisplaySpriteOutlines.Size = new System.Drawing.Size(227, 17); this.chkDisplaySpriteOutlines.Size = new System.Drawing.Size(227, 17);
this.chkDisplaySpriteOutlines.TabIndex = 27; this.chkDisplaySpriteOutlines.TabIndex = 27;
@ -451,6 +453,7 @@ namespace Mesen.GUI.Debugger.Controls
// //
this.picSprites.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.picSprites.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picSprites.ContextMenuStrip = this.ctxMenu; this.picSprites.ContextMenuStrip = this.ctxMenu;
this.picSprites.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
this.picSprites.Location = new System.Drawing.Point(4, 4); this.picSprites.Location = new System.Drawing.Point(4, 4);
this.picSprites.Margin = new System.Windows.Forms.Padding(4); this.picSprites.Margin = new System.Windows.Forms.Padding(4);
this.picSprites.Name = "picSprites"; this.picSprites.Name = "picSprites";
@ -488,7 +491,7 @@ namespace Mesen.GUI.Debugger.Controls
#endregion #endregion
private System.Windows.Forms.TableLayoutPanel tlpMain; private System.Windows.Forms.TableLayoutPanel tlpMain;
private System.Windows.Forms.PictureBox picSprites; private ctrlMesenPictureBox picSprites;
private System.Windows.Forms.GroupBox grpSpriteInfo; private System.Windows.Forms.GroupBox grpSpriteInfo;
private System.Windows.Forms.TableLayoutPanel tlpInfo; private System.Windows.Forms.TableLayoutPanel tlpInfo;
private System.Windows.Forms.TextBox txtTileAddress; private System.Windows.Forms.TextBox txtTileAddress;
@ -504,7 +507,7 @@ namespace Mesen.GUI.Debugger.Controls
private System.Windows.Forms.Label lblPaletteAddr; private System.Windows.Forms.Label lblPaletteAddr;
private System.Windows.Forms.Label lblPosition; private System.Windows.Forms.Label lblPosition;
private System.Windows.Forms.CheckBox chkBackgroundPriority; private System.Windows.Forms.CheckBox chkBackgroundPriority;
private System.Windows.Forms.PictureBox picPreview; private ctrlMesenPictureBox picPreview;
private System.Windows.Forms.Label lblScreenPreview; private System.Windows.Forms.Label lblScreenPreview;
private System.Windows.Forms.Label lblSpriteIndex; private System.Windows.Forms.Label lblSpriteIndex;
private System.Windows.Forms.TextBox txtSpriteIndex; private System.Windows.Forms.TextBox txtSpriteIndex;

View file

@ -12,6 +12,7 @@ using Mesen.GUI.Controls;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using Mesen.GUI.Config; using Mesen.GUI.Config;
using Mesen.GUI.Forms; using Mesen.GUI.Forms;
using System.Drawing.Drawing2D;
namespace Mesen.GUI.Debugger.Controls namespace Mesen.GUI.Debugger.Controls
{ {
@ -39,23 +40,44 @@ namespace Mesen.GUI.Debugger.Controls
private bool _firstDraw = true; private bool _firstDraw = true;
private int _originalSpriteHeight = 0; private int _originalSpriteHeight = 0;
private int _originalTileHeight = 0; private int _originalTileHeight = 0;
private Size _originalPreviewSize;
private double _scale = 1;
public ctrlSpriteViewer() public ctrlSpriteViewer()
{ {
InitializeComponent(); InitializeComponent();
picPreview.Image = new Bitmap(256, 240, PixelFormat.Format32bppArgb); if(!IsDesignMode) {
picSprites.Image = new Bitmap(256, 512, PixelFormat.Format32bppArgb); picPreview.Image = new Bitmap(256, 240, PixelFormat.Format32bppArgb);
picSprites.Image = new Bitmap(256, 512, PixelFormat.Format32bppArgb);
chkDisplaySpriteOutlines.Checked = ConfigManager.Config.DebugInfo.SpriteViewerDisplaySpriteOutlines; chkDisplaySpriteOutlines.Checked = ConfigManager.Config.DebugInfo.SpriteViewerDisplaySpriteOutlines;
_originalSpriteHeight = picSprites.Height; _originalSpriteHeight = picSprites.Height;
_originalTileHeight = picTile.Height; _originalTileHeight = picTile.Height;
_originalPreviewSize = picPreview.Size;
}
} }
public Size GetCompactSize() public Size GetCompactSize(bool includeMargins)
{ {
return new Size(picSprites.Width, _prevLargeSprites ? picSprites.Height : (picSprites.Height + picPreview.Height + picPreview.Margin.Top + picSprites.Margin.Bottom)); return new Size(picSprites.Width, _prevLargeSprites ? picSprites.Height : (picSprites.Height * 2));
}
public void ScaleImage(double scale)
{
_scale *= scale;
picSprites.Size = new Size((int)(picSprites.Width * scale), (int)(picSprites.Height * scale));
if(_largeSprites) {
picPreview.Size = _originalPreviewSize;
} else {
picPreview.Size = new Size((int)(_originalPreviewSize.Width * _scale), (int)(_originalPreviewSize.Height * _scale));
}
_originalSpriteHeight = (int)(_originalSpriteHeight * scale);
picSprites.InterpolationMode = scale > 1 ? InterpolationMode.NearestNeighbor : InterpolationMode.Default;
picPreview.InterpolationMode = scale > 1 ? InterpolationMode.NearestNeighbor : InterpolationMode.Default;
} }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
@ -122,25 +144,7 @@ namespace Mesen.GUI.Debugger.Controls
} }
if(_prevLargeSprites != _largeSprites) { if(_prevLargeSprites != _largeSprites) {
if(_largeSprites) { ToggleSpriteMode();
picSprites.Image = new Bitmap(256, 512, PixelFormat.Format32bppArgb);
picSprites.Height = _originalSpriteHeight;
picTile.Height = _originalTileHeight;
tlpMain.SetRowSpan(picSprites, 2);
tlpMain.SetColumnSpan(picPreview, 4);
tlpInfo.Controls.Add(picPreview, 1, 5);
lblScreenPreview.Visible = true;
} else {
picSprites.Image = new Bitmap(256, 256, PixelFormat.Format32bppArgb);
picSprites.Height = (_originalSpriteHeight - 2) / 2 + 2;
picTile.Height = (_originalTileHeight - 2) / 2 + 2;
tlpMain.SetRowSpan(picSprites, 1);
tlpMain.SetColumnSpan(picPreview, 1);
tlpMain.Controls.Add(picPreview, 0, 1);
lblScreenPreview.Visible = false;
}
_prevLargeSprites = _largeSprites; _prevLargeSprites = _largeSprites;
} }
@ -160,6 +164,31 @@ namespace Mesen.GUI.Debugger.Controls
DrawHud(); DrawHud();
} }
private void ToggleSpriteMode()
{
if(_largeSprites) {
picSprites.Image = new Bitmap(256, 512, PixelFormat.Format32bppArgb);
picSprites.Height = _originalSpriteHeight;
picTile.Height = _originalTileHeight;
picPreview.Size = _originalPreviewSize;
tlpMain.SetRowSpan(picSprites, 2);
tlpMain.SetColumnSpan(picPreview, 4);
tlpInfo.Controls.Add(picPreview, 1, 5);
lblScreenPreview.Visible = true;
} else {
picSprites.Image = new Bitmap(256, 256, PixelFormat.Format32bppArgb);
picSprites.Height = (_originalSpriteHeight - 2) / 2 + 2;
picTile.Height = (_originalTileHeight - 2) / 2 + 2;
picPreview.Size = new Size((int)(_originalPreviewSize.Width * _scale), (int)(_originalPreviewSize.Height * _scale));
tlpMain.SetRowSpan(picSprites, 1);
tlpMain.SetColumnSpan(picPreview, 1);
tlpMain.Controls.Add(picPreview, 0, 1);
lblScreenPreview.Visible = false;
}
}
private void DrawHud() private void DrawHud()
{ {
using(Graphics g = Graphics.FromImage(picSprites.Image)) { using(Graphics g = Graphics.FromImage(picSprites.Image)) {

View file

@ -40,6 +40,7 @@ namespace Mesen.GUI.Debugger
GetMember(nameof(DebuggerShortcutsConfig.CodeWindow_EditInMemoryViewer)), GetMember(nameof(DebuggerShortcutsConfig.CodeWindow_EditInMemoryViewer)),
GetMember(nameof(DebuggerShortcutsConfig.MemoryViewer_ViewInDisassembly)), GetMember(nameof(DebuggerShortcutsConfig.MemoryViewer_ViewInDisassembly)),
GetMember(nameof(DebuggerShortcutsConfig.PpuViewer_ToggleView)), GetMember(nameof(DebuggerShortcutsConfig.PpuViewer_ToggleView)),
GetMember(nameof(DebuggerShortcutsConfig.PpuViewer_ToggleZoom)),
GetMember(nameof(DebuggerShortcutsConfig.OpenApuViewer)), GetMember(nameof(DebuggerShortcutsConfig.OpenApuViewer)),
GetMember(nameof(DebuggerShortcutsConfig.OpenAssembler)), GetMember(nameof(DebuggerShortcutsConfig.OpenAssembler)),

View file

@ -33,7 +33,7 @@ namespace Mesen.GUI.Debugger
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.menuStrip1 = new Mesen.GUI.Controls.ctrlMesenMenuStrip(); this.menuStrip = new Mesen.GUI.Controls.ctrlMesenMenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuClose = new System.Windows.Forms.ToolStripMenuItem(); this.mnuClose = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -45,6 +45,7 @@ namespace Mesen.GUI.Debugger
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.mnuAutoRefresh = new System.Windows.Forms.ToolStripMenuItem(); this.mnuAutoRefresh = new System.Windows.Forms.ToolStripMenuItem();
this.mnuRefreshOnBreak = new System.Windows.Forms.ToolStripMenuItem(); this.mnuRefreshOnBreak = new System.Windows.Forms.ToolStripMenuItem();
this.mnuShowInformationOverlay = new System.Windows.Forms.ToolStripMenuItem();
this.tabMain = new System.Windows.Forms.TabControl(); this.tabMain = new System.Windows.Forms.TabControl();
this.tpgNametableViewer = new System.Windows.Forms.TabPage(); this.tpgNametableViewer = new System.Windows.Forms.TabPage();
this.ctrlNametableViewer = new Mesen.GUI.Debugger.Controls.ctrlNametableViewer(); this.ctrlNametableViewer = new Mesen.GUI.Debugger.Controls.ctrlNametableViewer();
@ -56,8 +57,8 @@ namespace Mesen.GUI.Debugger
this.ctrlPaletteViewer = new Mesen.GUI.Debugger.Controls.ctrlPaletteViewer(); this.ctrlPaletteViewer = new Mesen.GUI.Debugger.Controls.ctrlPaletteViewer();
this.ctrlScanlineCycle = new Mesen.GUI.Debugger.Controls.ctrlScanlineCycleSelect(); this.ctrlScanlineCycle = new Mesen.GUI.Debugger.Controls.ctrlScanlineCycleSelect();
this.btnToggleView = new System.Windows.Forms.Button(); this.btnToggleView = new System.Windows.Forms.Button();
this.mnuShowInformationOverlay = new System.Windows.Forms.ToolStripMenuItem(); this.chkToggleZoom = new System.Windows.Forms.CheckBox();
this.menuStrip1.SuspendLayout(); this.menuStrip.SuspendLayout();
this.tabMain.SuspendLayout(); this.tabMain.SuspendLayout();
this.tpgNametableViewer.SuspendLayout(); this.tpgNametableViewer.SuspendLayout();
this.tpgChrViewer.SuspendLayout(); this.tpgChrViewer.SuspendLayout();
@ -65,16 +66,16 @@ namespace Mesen.GUI.Debugger
this.tpgPaletteViewer.SuspendLayout(); this.tpgPaletteViewer.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// menuStrip1 // menuStrip
// //
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem, this.fileToolStripMenuItem,
this.viewToolStripMenuItem}); this.viewToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1"; this.menuStrip.Name = "menuStrip";
this.menuStrip1.Size = new System.Drawing.Size(709, 24); this.menuStrip.Size = new System.Drawing.Size(709, 24);
this.menuStrip1.TabIndex = 2; this.menuStrip.TabIndex = 2;
this.menuStrip1.Text = "menuStrip1"; this.menuStrip.Text = "menuStrip1";
// //
// fileToolStripMenuItem // fileToolStripMenuItem
// //
@ -168,6 +169,14 @@ namespace Mesen.GUI.Debugger
this.mnuRefreshOnBreak.Text = "Refresh on pause/break"; this.mnuRefreshOnBreak.Text = "Refresh on pause/break";
this.mnuRefreshOnBreak.Click += new System.EventHandler(this.mnuRefreshOnBreak_Click); this.mnuRefreshOnBreak.Click += new System.EventHandler(this.mnuRefreshOnBreak_Click);
// //
// mnuShowInformationOverlay
//
this.mnuShowInformationOverlay.CheckOnClick = true;
this.mnuShowInformationOverlay.Name = "mnuShowInformationOverlay";
this.mnuShowInformationOverlay.Size = new System.Drawing.Size(210, 22);
this.mnuShowInformationOverlay.Text = "Show information overlay";
this.mnuShowInformationOverlay.Click += new System.EventHandler(this.mnuShowInformationOverlay_Click);
//
// tabMain // tabMain
// //
this.tabMain.Controls.Add(this.tpgNametableViewer); this.tabMain.Controls.Add(this.tpgNametableViewer);
@ -199,7 +208,6 @@ namespace Mesen.GUI.Debugger
this.ctrlNametableViewer.Name = "ctrlNametableViewer"; this.ctrlNametableViewer.Name = "ctrlNametableViewer";
this.ctrlNametableViewer.Size = new System.Drawing.Size(701, 527); this.ctrlNametableViewer.Size = new System.Drawing.Size(701, 527);
this.ctrlNametableViewer.TabIndex = 0; this.ctrlNametableViewer.TabIndex = 0;
this.ctrlNametableViewer.OnSelectChrTile += this.ctrlNametableViewer_OnSelectChrTile;
// //
// tpgChrViewer // tpgChrViewer
// //
@ -275,30 +283,36 @@ namespace Mesen.GUI.Debugger
this.btnToggleView.UseVisualStyleBackColor = true; this.btnToggleView.UseVisualStyleBackColor = true;
this.btnToggleView.Click += new System.EventHandler(this.btnToggleView_Click); this.btnToggleView.Click += new System.EventHandler(this.btnToggleView_Click);
// //
// mnuShowInformationOverlay // chkToggleZoom
// //
this.mnuShowInformationOverlay.CheckOnClick = true; this.chkToggleZoom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.mnuShowInformationOverlay.Name = "mnuShowInformationOverlay"; this.chkToggleZoom.Appearance = System.Windows.Forms.Appearance.Button;
this.mnuShowInformationOverlay.Size = new System.Drawing.Size(210, 22); this.chkToggleZoom.AutoCheck = false;
this.mnuShowInformationOverlay.Text = "Show information overlay"; this.chkToggleZoom.Image = global::Mesen.GUI.Properties.Resources.Zoom2x;
this.mnuShowInformationOverlay.Click += new System.EventHandler(this.mnuShowInformationOverlay_Click); this.chkToggleZoom.Location = new System.Drawing.Point(647, 1);
this.chkToggleZoom.Name = "chkToggleZoom";
this.chkToggleZoom.Size = new System.Drawing.Size(27, 22);
this.chkToggleZoom.TabIndex = 6;
this.chkToggleZoom.UseVisualStyleBackColor = true;
this.chkToggleZoom.Click += new System.EventHandler(this.chkToggleZoom_Click);
// //
// frmPpuViewer // frmPpuViewer
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(709, 605); this.ClientSize = new System.Drawing.Size(709, 605);
this.Controls.Add(this.chkToggleZoom);
this.Controls.Add(this.btnToggleView); this.Controls.Add(this.btnToggleView);
this.Controls.Add(this.tabMain); this.Controls.Add(this.tabMain);
this.Controls.Add(this.menuStrip1); this.Controls.Add(this.menuStrip);
this.Controls.Add(this.ctrlScanlineCycle); this.Controls.Add(this.ctrlScanlineCycle);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MainMenuStrip = this.menuStrip1; this.MainMenuStrip = this.menuStrip;
this.MaximizeBox = false; this.MaximizeBox = false;
this.Name = "frmPpuViewer"; this.Name = "frmPpuViewer";
this.Text = "PPU Viewer"; this.Text = "PPU Viewer";
this.menuStrip1.ResumeLayout(false); this.menuStrip.ResumeLayout(false);
this.menuStrip1.PerformLayout(); this.menuStrip.PerformLayout();
this.tabMain.ResumeLayout(false); this.tabMain.ResumeLayout(false);
this.tpgNametableViewer.ResumeLayout(false); this.tpgNametableViewer.ResumeLayout(false);
this.tpgChrViewer.ResumeLayout(false); this.tpgChrViewer.ResumeLayout(false);
@ -311,7 +325,7 @@ namespace Mesen.GUI.Debugger
#endregion #endregion
private Mesen.GUI.Controls.ctrlMesenMenuStrip menuStrip1; private Mesen.GUI.Controls.ctrlMesenMenuStrip menuStrip;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mnuClose; private System.Windows.Forms.ToolStripMenuItem mnuClose;
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
@ -335,5 +349,6 @@ namespace Mesen.GUI.Debugger
private System.Windows.Forms.ToolStripMenuItem mnuAutoRefreshHigh; private System.Windows.Forms.ToolStripMenuItem mnuAutoRefreshHigh;
private System.Windows.Forms.Button btnToggleView; private System.Windows.Forms.Button btnToggleView;
private System.Windows.Forms.ToolStripMenuItem mnuShowInformationOverlay; private System.Windows.Forms.ToolStripMenuItem mnuShowInformationOverlay;
private System.Windows.Forms.CheckBox chkToggleZoom;
} }
} }

View file

@ -14,7 +14,8 @@ namespace Mesen.GUI.Debugger
private TabPage _selectedTab; private TabPage _selectedTab;
private bool _refreshing = false; private bool _refreshing = false;
private Size _originalSize; private Size _originalSize;
private bool _isCompact; private bool _isCompact = false;
private bool _isZoomed = false;
private PpuViewerMode _mode; private PpuViewerMode _mode;
private static int _nextPpuViewerId = 0; private static int _nextPpuViewerId = 0;
@ -27,6 +28,11 @@ namespace Mesen.GUI.Debugger
_ppuViewerId = GetNextPpuViewerId(); _ppuViewerId = GetNextPpuViewerId();
_mode = mode; _mode = mode;
if(Program.IsMono) {
btnToggleView.Top -= 1;
chkToggleZoom.Top -= 1;
}
this._selectedTab = this.tpgNametableViewer; this._selectedTab = this.tpgNametableViewer;
this.mnuAutoRefresh.Checked = ConfigManager.Config.DebugInfo.PpuAutoRefresh; this.mnuAutoRefresh.Checked = ConfigManager.Config.DebugInfo.PpuAutoRefresh;
this.mnuRefreshOnBreak.Checked = ConfigManager.Config.DebugInfo.PpuRefreshOnBreak; this.mnuRefreshOnBreak.Checked = ConfigManager.Config.DebugInfo.PpuRefreshOnBreak;
@ -84,6 +90,12 @@ namespace Mesen.GUI.Debugger
} }
this.toolTip.SetToolTip(this.btnToggleView, toggleViewTooltip); this.toolTip.SetToolTip(this.btnToggleView, toggleViewTooltip);
string toggleZoomTooltip = "Toggle 2x Zoom";
if(ConfigManager.Config.DebugInfo.Shortcuts.PpuViewer_ToggleZoom != Keys.None) {
toggleZoomTooltip += " (" + DebuggerShortcutsConfig.GetShortcutDisplay(ConfigManager.Config.DebugInfo.Shortcuts.PpuViewer_ToggleZoom) + ")";
}
this.toolTip.SetToolTip(this.chkToggleZoom, toggleZoomTooltip);
_selectedTab = tabMain.SelectedTab; _selectedTab = tabMain.SelectedTab;
if(_mode != PpuViewerMode.Combined) { if(_mode != PpuViewerMode.Combined) {
TabPage page = _selectedTab; TabPage page = _selectedTab;
@ -209,16 +221,59 @@ namespace Mesen.GUI.Debugger
private void tabMain_SelectedIndexChanged(object sender, EventArgs e) private void tabMain_SelectedIndexChanged(object sender, EventArgs e)
{ {
bool wasZoomedIn = _isZoomed;
if(wasZoomedIn) {
this.ToggleZoom();
}
this._selectedTab = this.tabMain.SelectedTab; this._selectedTab = this.tabMain.SelectedTab;
if(wasZoomedIn) {
this.ToggleZoom();
}
if(InteropEmu.DebugIsExecutionStopped()) { if(InteropEmu.DebugIsExecutionStopped()) {
//Refresh data when changing tabs when not running //Refresh data when changing tabs when not running
this.RefreshViewers(); this.RefreshViewers();
} }
} }
private void ToggleZoom()
{
ICompactControl ctrl = null;
if(_selectedTab == tpgChrViewer) {
ctrl = ctrlChrViewer;
} else if(_selectedTab == tpgPaletteViewer) {
ctrl = ctrlPaletteViewer;
} else if(_selectedTab == tpgSpriteViewer) {
ctrl = ctrlSpriteViewer;
} else if(_selectedTab == tpgNametableViewer) {
ctrl = ctrlNametableViewer;
}
if(!_isZoomed) {
Size pictureSize = ctrl.GetCompactSize(false);
this.Size += pictureSize;
_originalSize += pictureSize;
ctrl.ScaleImage(2);
_isZoomed = true;
} else {
Size pictureSize = ctrl.GetCompactSize(false);
Size halfSize = new Size(pictureSize.Width / 2, pictureSize.Height / 2);
this.Size -= halfSize;
_originalSize -= halfSize;
ctrl.ScaleImage(0.5);
_isZoomed = false;
}
chkToggleZoom.Checked = _isZoomed;
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{ {
if(keyData == ConfigManager.Config.DebugInfo.Shortcuts.PpuViewer_ToggleView) { if(keyData == ConfigManager.Config.DebugInfo.Shortcuts.PpuViewer_ToggleZoom) {
ToggleZoom();
return true;
} else if(keyData == ConfigManager.Config.DebugInfo.Shortcuts.PpuViewer_ToggleView) {
ToggleView(); ToggleView();
return true; return true;
} }
@ -323,7 +378,7 @@ namespace Mesen.GUI.Debugger
_isCompact = true; _isCompact = true;
_originalSize = this.Size; _originalSize = this.Size;
Size size = control.GetCompactSize(); Size size = control.GetCompactSize(true);
int widthDiff = ((Control)control).Width - size.Width; int widthDiff = ((Control)control).Width - size.Width;
int heightDiff = ((Control)control).Height - size.Height; int heightDiff = ((Control)control).Height - size.Height;
@ -365,6 +420,11 @@ namespace Mesen.GUI.Debugger
{ {
ToggleView(); ToggleView();
} }
private void chkToggleZoom_Click(object sender, EventArgs e)
{
ToggleZoom();
}
} }
public enum PpuViewerMode public enum PpuViewerMode
@ -378,6 +438,7 @@ namespace Mesen.GUI.Debugger
public interface ICompactControl public interface ICompactControl
{ {
Size GetCompactSize(); Size GetCompactSize(bool includeMargins);
void ScaleImage(double scale);
} }
} }

View file

@ -120,7 +120,7 @@
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>107, 17</value> <value>107, 17</value>
</metadata> </metadata>
</root> </root>

View file

@ -285,6 +285,9 @@
<Compile Include="Controls\ctrlMesenMenuStrip.cs"> <Compile Include="Controls\ctrlMesenMenuStrip.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="Controls\ctrlMesenPictureBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\ctrlMesenToolStrip.cs"> <Compile Include="Controls\ctrlMesenToolStrip.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
@ -1257,6 +1260,7 @@
<Compile Include="RuntimeChecker.cs" /> <Compile Include="RuntimeChecker.cs" />
<Compile Include="SingleInstance.cs" /> <Compile Include="SingleInstance.cs" />
<Compile Include="TestRunner.cs" /> <Compile Include="TestRunner.cs" />
<None Include="Resources\Zoom2x.png" />
<None Include="Resources\Expand.png" /> <None Include="Resources\Expand.png" />
<None Include="Resources\Collapse.png" /> <None Include="Resources\Collapse.png" />
<None Include="Resources\RegisterIcon.png" /> <None Include="Resources\RegisterIcon.png" />

View file

@ -1129,5 +1129,15 @@ namespace Mesen.GUI.Properties {
return ((System.Drawing.Bitmap)(obj)); return ((System.Drawing.Bitmap)(obj));
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Zoom2x {
get {
object obj = ResourceManager.GetObject("Zoom2x", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
} }
} }

View file

@ -439,4 +439,7 @@
<data name="Expand" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Expand" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Expand.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Expand.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Zoom2x" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Zoom2x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B