mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-15 08:47:14 +00:00
Remove box bar, inline sprite height calc
Skip empty slots since the input data no longer guarantees no empty slots
This commit is contained in:
parent
edcf3a9bd6
commit
8d7f56a7db
2 changed files with 11 additions and 20 deletions
14
PKHeX.WinForms/Subforms/ReportGrid.Designer.cs
generated
14
PKHeX.WinForms/Subforms/ReportGrid.Designer.cs
generated
|
@ -30,7 +30,6 @@
|
||||||
{
|
{
|
||||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||||
this.dgData = new System.Windows.Forms.DataGridView();
|
this.dgData = new System.Windows.Forms.DataGridView();
|
||||||
this.BoxBar = new System.Windows.Forms.ProgressBar();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dgData)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.dgData)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
|
@ -38,7 +37,7 @@
|
||||||
//
|
//
|
||||||
this.dgData.AllowUserToAddRows = false;
|
this.dgData.AllowUserToAddRows = false;
|
||||||
this.dgData.AllowUserToDeleteRows = false;
|
this.dgData.AllowUserToDeleteRows = false;
|
||||||
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(224, 224, 224);
|
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
||||||
this.dgData.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
|
this.dgData.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
|
||||||
this.dgData.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
|
this.dgData.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
|
||||||
this.dgData.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.dgData.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
@ -49,19 +48,11 @@
|
||||||
this.dgData.TabIndex = 0;
|
this.dgData.TabIndex = 0;
|
||||||
this.dgData.Sorted += new System.EventHandler(this.Data_Sorted);
|
this.dgData.Sorted += new System.EventHandler(this.Data_Sorted);
|
||||||
//
|
//
|
||||||
// BoxBar
|
// ReportGrid
|
||||||
//
|
|
||||||
this.BoxBar.Location = new System.Drawing.Point(13, 13);
|
|
||||||
this.BoxBar.Name = "BoxBar";
|
|
||||||
this.BoxBar.Size = new System.Drawing.Size(787, 23);
|
|
||||||
this.BoxBar.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// frmReport
|
|
||||||
//
|
//
|
||||||
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(812, 461);
|
this.ClientSize = new System.Drawing.Size(812, 461);
|
||||||
this.Controls.Add(this.BoxBar);
|
|
||||||
this.Controls.Add(this.dgData);
|
this.Controls.Add(this.dgData);
|
||||||
this.Icon = global::PKHeX.WinForms.Properties.Resources.Icon;
|
this.Icon = global::PKHeX.WinForms.Properties.Resources.Icon;
|
||||||
this.Name = "ReportGrid";
|
this.Name = "ReportGrid";
|
||||||
|
@ -76,6 +67,5 @@
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private System.Windows.Forms.DataGridView dgData;
|
private System.Windows.Forms.DataGridView dgData;
|
||||||
private System.Windows.Forms.ProgressBar BoxBar;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -54,27 +54,28 @@ namespace PKHeX.WinForms
|
||||||
public void PopulateData(IList<SlotCache> Data)
|
public void PopulateData(IList<SlotCache> Data)
|
||||||
{
|
{
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
BoxBar.Step = 1;
|
|
||||||
var PL = new PokemonList<EntitySummaryImage>();
|
var PL = new PokemonList<EntitySummaryImage>();
|
||||||
var strings = GameInfo.Strings;
|
var strings = GameInfo.Strings;
|
||||||
foreach (var entry in Data)
|
foreach (var entry in Data)
|
||||||
{
|
{
|
||||||
var pkm = entry.Entity;
|
var pkm = entry.Entity;
|
||||||
|
if ((uint)(pkm.Species - 1) >= pkm.MaxSpeciesID)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
pkm.Stat_Level = pkm.CurrentLevel; // recalc Level
|
pkm.Stat_Level = pkm.CurrentLevel; // recalc Level
|
||||||
PL.Add(new EntitySummaryImage(pkm, strings, entry.Identify()));
|
PL.Add(new EntitySummaryImage(pkm, strings, entry.Identify()));
|
||||||
BoxBar.PerformStep();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dgData.DataSource = PL;
|
dgData.DataSource = PL;
|
||||||
dgData.AutoGenerateColumns = true;
|
dgData.AutoGenerateColumns = true;
|
||||||
BoxBar.Maximum = Data.Count + dgData.Columns.Count;
|
|
||||||
for (int i = 0; i < dgData.Columns.Count; i++)
|
for (int i = 0; i < dgData.Columns.Count; i++)
|
||||||
{
|
{
|
||||||
BoxBar.PerformStep();
|
var col = dgData.Columns[i];
|
||||||
if (dgData.Columns[i] is DataGridViewImageColumn) continue; // Don't add sorting for Sprites
|
if (col is DataGridViewImageColumn)
|
||||||
dgData.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic;
|
continue; // Don't add sorting for Sprites
|
||||||
|
col.SortMode = DataGridViewColumnSortMode.Automatic;
|
||||||
}
|
}
|
||||||
BoxBar.Visible = false;
|
|
||||||
|
|
||||||
// Trigger Resizing
|
// Trigger Resizing
|
||||||
dgData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
|
dgData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
|
||||||
|
@ -92,7 +93,7 @@ namespace PKHeX.WinForms
|
||||||
|
|
||||||
private void Data_Sorted(object sender, EventArgs e)
|
private void Data_Sorted(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
int height = SpriteUtil.GetSprite(1, 0, 0, 0, 0, false, false).Height + 1; // dummy sprite, max height of a row
|
int height = SpriteUtil.Spriter.Height + 1; // max height of a row, +1px
|
||||||
for (int i = 0; i < dgData.Rows.Count; i++)
|
for (int i = 0; i < dgData.Rows.Count; i++)
|
||||||
dgData.Rows[i].Height = height;
|
dgData.Rows[i].Height = height;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue