Hex Editor - fix calculation for rows visible
This commit is contained in:
parent
98ec3bf2a2
commit
d391777d50
|
@ -276,7 +276,7 @@
|
|||
this.MemoryViewerBox.Location = new System.Drawing.Point(12, 27);
|
||||
this.MemoryViewerBox.MaximumSize = new System.Drawing.Size(600, 1024);
|
||||
this.MemoryViewerBox.Name = "MemoryViewerBox";
|
||||
this.MemoryViewerBox.Size = new System.Drawing.Size(558, 277);
|
||||
this.MemoryViewerBox.Size = new System.Drawing.Size(558, 262);
|
||||
this.MemoryViewerBox.TabIndex = 2;
|
||||
this.MemoryViewerBox.TabStop = false;
|
||||
this.MemoryViewerBox.Paint += new System.Windows.Forms.PaintEventHandler(this.MemoryViewerBox_Paint);
|
||||
|
@ -289,7 +289,7 @@
|
|||
this.vScrollBar1.LargeChange = 16;
|
||||
this.vScrollBar1.Location = new System.Drawing.Point(539, 8);
|
||||
this.vScrollBar1.Name = "vScrollBar1";
|
||||
this.vScrollBar1.Size = new System.Drawing.Size(16, 266);
|
||||
this.vScrollBar1.Size = new System.Drawing.Size(16, 251);
|
||||
this.vScrollBar1.TabIndex = 1;
|
||||
this.vScrollBar1.Scroll += new System.Windows.Forms.ScrollEventHandler(this.vScrollBar1_Scroll);
|
||||
//
|
||||
|
@ -312,7 +312,7 @@
|
|||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(584, 316);
|
||||
this.ClientSize = new System.Drawing.Size(584, 301);
|
||||
this.Controls.Add(this.MemoryViewerBox);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
|
|
|
@ -49,6 +49,8 @@ namespace BizHawk.MultiClient
|
|||
const int rowX = 1;
|
||||
const int rowY = 4;
|
||||
const int rowYoffset = 20;
|
||||
const int fontHeight = 14;
|
||||
const int fontWidth = 21; //Width of 2 digits
|
||||
Font font = new Font("Courier New", 8);
|
||||
|
||||
public HexEditor()
|
||||
|
@ -687,8 +689,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void SetUpScrollBar()
|
||||
{
|
||||
int height = font.Height + 3;
|
||||
RowsVisible = ((MemoryViewerBox.Height - height - 5) / height);
|
||||
RowsVisible = ((MemoryViewerBox.Height - (fontHeight * 2) - (fontHeight / 2)) / fontHeight);
|
||||
int totalRows = Domain.Size / 16;
|
||||
int MaxRows = (totalRows - RowsVisible) + 16;
|
||||
|
||||
|
@ -714,12 +715,9 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
//Scroll value determines the first row
|
||||
int row = vScrollBar1.Value;
|
||||
int rowoffset = ((y - 16)/ 14);
|
||||
int rowoffset = ((y - 16)/ fontHeight);
|
||||
row += rowoffset;
|
||||
int column = (x - 43) / 21;
|
||||
|
||||
//pointedRow = rowoffset;
|
||||
//pointedColumn = column;
|
||||
int column = (x - 43) / fontWidth;
|
||||
|
||||
//TODO: 2 & 4 byte views
|
||||
|
||||
|
@ -740,7 +738,6 @@ namespace BizHawk.MultiClient
|
|||
SetUpScrollBar();
|
||||
}
|
||||
|
||||
|
||||
private void AddressesLabel_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
SetAddressOver(e.X, e.Y);
|
||||
|
@ -763,8 +760,8 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private Point GetAddressCoordinates(int address)
|
||||
{
|
||||
int x = ((address % 16) * 21) + 50 + addrOffset;
|
||||
int y = (((address / 16) - vScrollBar1.Value) * 14) + 30;
|
||||
int x = ((address % 16) * fontWidth) + 50 + addrOffset;
|
||||
int y = (((address / 16) - vScrollBar1.Value) * fontHeight) + 30;
|
||||
return new Point(x, y);
|
||||
}
|
||||
|
||||
|
@ -772,8 +769,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
if (addressHighlighted >= 0 && IsVisible(addressHighlighted))
|
||||
{
|
||||
Rectangle rect = new Rectangle(GetAddressCoordinates(addressHighlighted), new Size(16, 14));
|
||||
//e.Graphics.DrawRectangle(new Pen(highlightBrush), rect);
|
||||
Rectangle rect = new Rectangle(GetAddressCoordinates(addressHighlighted), new Size(16, fontHeight));
|
||||
e.Graphics.FillRectangle(highlightBrush, rect);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue