mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-15 00:37:11 +00:00
Distribution checkboxes to correct panel
Also fixed checkbox enable/disable (didn't consider prefix)
This commit is contained in:
parent
8a0976e6e3
commit
deb7502ee5
2 changed files with 15 additions and 22 deletions
|
@ -153,7 +153,7 @@
|
|||
// CHK_Secret
|
||||
//
|
||||
this.CHK_Secret.AutoSize = true;
|
||||
this.CHK_Secret.Location = new System.Drawing.Point(3, 2);
|
||||
this.CHK_Secret.Location = new System.Drawing.Point(2, 2);
|
||||
this.CHK_Secret.Name = "CHK_Secret";
|
||||
this.CHK_Secret.Size = new System.Drawing.Size(171, 17);
|
||||
this.CHK_Secret.TabIndex = 36;
|
||||
|
@ -213,16 +213,17 @@
|
|||
// TLP_DistSuperTrain
|
||||
//
|
||||
this.TLP_DistSuperTrain.AutoScroll = true;
|
||||
this.TLP_DistSuperTrain.ColumnCount = 2;
|
||||
this.TLP_DistSuperTrain.AutoSize = true;
|
||||
this.TLP_DistSuperTrain.ColumnCount = 1;
|
||||
this.TLP_DistSuperTrain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.TLP_DistSuperTrain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.TLP_DistSuperTrain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.TLP_DistSuperTrain.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.TLP_DistSuperTrain.Location = new System.Drawing.Point(0, 101);
|
||||
this.TLP_DistSuperTrain.Location = new System.Drawing.Point(0, 229);
|
||||
this.TLP_DistSuperTrain.Name = "TLP_DistSuperTrain";
|
||||
this.TLP_DistSuperTrain.RowCount = 1;
|
||||
this.TLP_DistSuperTrain.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.TLP_DistSuperTrain.Size = new System.Drawing.Size(215, 128);
|
||||
this.TLP_DistSuperTrain.Size = new System.Drawing.Size(215, 0);
|
||||
this.TLP_DistSuperTrain.TabIndex = 3;
|
||||
//
|
||||
// SuperTrainingEditor
|
||||
|
|
|
@ -57,12 +57,12 @@ namespace PKHeX
|
|||
let RegimenValue = ReflectUtil.GetValue(pkm, RegimenName)
|
||||
where RegimenValue is bool
|
||||
select new RegimenInfo(RegimenName, (bool) RegimenValue));
|
||||
TLP.ColumnCount = 2;
|
||||
TLP.ColumnCount = 1;
|
||||
TLP.RowCount = 0;
|
||||
|
||||
// Add Regimens
|
||||
foreach (var reg in list)
|
||||
addRegimenChoice(reg);
|
||||
addRegimenChoice(reg, TLP);
|
||||
|
||||
// Force auto-size
|
||||
foreach (RowStyle style in TLP.RowStyles)
|
||||
|
@ -70,32 +70,24 @@ namespace PKHeX
|
|||
foreach (ColumnStyle style in TLP.ColumnStyles)
|
||||
style.SizeType = SizeType.AutoSize;
|
||||
}
|
||||
private void addRegimenChoice(RegimenInfo reg)
|
||||
private void addRegimenChoice(RegimenInfo reg, TableLayoutPanel TLP)
|
||||
{
|
||||
// Get row we add to
|
||||
int row = TLP_SuperTrain.RowCount;
|
||||
TLP_SuperTrain.RowCount++;
|
||||
|
||||
var label = new Label
|
||||
{
|
||||
Anchor = AnchorStyles.Left,
|
||||
Name = PrefixLabel + reg.Name,
|
||||
Text = reg.Name,
|
||||
Padding = Padding.Empty,
|
||||
AutoSize = true,
|
||||
};
|
||||
TLP_SuperTrain.Controls.Add(label, 1, row);
|
||||
int row = TLP.RowCount;
|
||||
TLP.RowCount++;
|
||||
|
||||
var chk = new CheckBox
|
||||
{
|
||||
Anchor = AnchorStyles.Right,
|
||||
Anchor = AnchorStyles.Left,
|
||||
Name = PrefixCHK + reg.Name,
|
||||
Margin = new Padding(2),
|
||||
Text = reg.Name,
|
||||
AutoSize = true,
|
||||
Padding = Padding.Empty,
|
||||
};
|
||||
chk.CheckedChanged += (sender, e) => { reg.CompletedRegimen = chk.Checked; };
|
||||
chk.Checked = reg.CompletedRegimen;
|
||||
TLP_SuperTrain.Controls.Add(chk, 0, row);
|
||||
TLP.Controls.Add(chk, 0, row);
|
||||
}
|
||||
|
||||
private void save()
|
||||
|
@ -143,7 +135,7 @@ namespace PKHeX
|
|||
}
|
||||
private void CHK_Secret_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
foreach (var c in TLP_SuperTrain.Controls.OfType<CheckBox>().Where(chk => Convert.ToInt16(chk.Name[10]) > 4))
|
||||
foreach (var c in TLP_SuperTrain.Controls.OfType<CheckBox>().Where(chk => Convert.ToInt16(chk.Name[14]+"") > 4))
|
||||
{
|
||||
c.Enabled = CHK_Secret.Checked;
|
||||
if (!CHK_Secret.Checked)
|
||||
|
|
Loading…
Reference in a new issue