mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-24 12:34:13 -05:00
Distribution checkboxes to correct panel
Also fixed checkbox enable/disable (didn't consider prefix)
This commit is contained in:
@@ -153,7 +153,7 @@ private void InitializeComponent()
|
||||
// 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 @@ private void InitializeComponent()
|
||||
// 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 @@ private void populateRegimens(string Type, TableLayoutPanel TLP, List<RegimenInf
|
||||
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 @@ private void populateRegimens(string Type, TableLayoutPanel TLP, List<RegimenInf
|
||||
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 @@ private void B_None_Click(object sender, EventArgs e)
|
||||
}
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user