Show "Add" button next to batch command dropdowns

This commit is contained in:
Kurt 2022-09-17 02:00:06 -07:00
parent d33b97bf67
commit 3a085c6607
7 changed files with 107 additions and 12 deletions

View file

@ -71,6 +71,17 @@ public partial class EntityInstructionBuilder : UserControl
public bool ReadOnly
{
set => CB_Require.Visible = !value;
set
{
if (value)
{
CB_Require.Visible = false;
CB_Require.SelectedIndex = 1;
}
else
{
CB_Require.Visible = true;
}
}
}
}

View file

@ -47,6 +47,7 @@
this.Menu_Import = new System.Windows.Forms.ToolStripMenuItem();
this.Menu_DeleteClones = new System.Windows.Forms.ToolStripMenuItem();
this.P_Results = new System.Windows.Forms.Panel();
this.DatabasePokeGrid = new PKHeX.WinForms.Controls.PokeGrid();
this.CB_Ability = new System.Windows.Forms.ComboBox();
this.CB_HeldItem = new System.Windows.Forms.ComboBox();
this.CB_Nature = new System.Windows.Forms.ComboBox();
@ -99,7 +100,7 @@
this.Tab_General = new System.Windows.Forms.TabPage();
this.Tab_Advanced = new System.Windows.Forms.TabPage();
this.RTB_Instructions = new System.Windows.Forms.RichTextBox();
this.DatabasePokeGrid = new PKHeX.WinForms.Controls.PokeGrid();
this.B_Add = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout();
this.P_Results.SuspendLayout();
this.FLP_Egg.SuspendLayout();
@ -286,6 +287,15 @@
this.P_Results.Size = new System.Drawing.Size(285, 352);
this.P_Results.TabIndex = 66;
//
// DatabasePokeGrid
//
this.DatabasePokeGrid.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.DatabasePokeGrid.Location = new System.Drawing.Point(2, 2);
this.DatabasePokeGrid.Margin = new System.Windows.Forms.Padding(0);
this.DatabasePokeGrid.Name = "DatabasePokeGrid";
this.DatabasePokeGrid.Size = new System.Drawing.Size(251, 346);
this.DatabasePokeGrid.TabIndex = 2;
//
// CB_Ability
//
this.CB_Ability.Anchor = System.Windows.Forms.AnchorStyles.Left;
@ -968,6 +978,7 @@
//
// Tab_Advanced
//
this.Tab_Advanced.Controls.Add(this.B_Add);
this.Tab_Advanced.Controls.Add(this.RTB_Instructions);
this.Tab_Advanced.Location = new System.Drawing.Point(4, 22);
this.Tab_Advanced.Name = "Tab_Advanced";
@ -988,14 +999,16 @@
this.RTB_Instructions.TabIndex = 120;
this.RTB_Instructions.Text = "";
//
// DatabasePokeGrid
// B_Add
//
this.DatabasePokeGrid.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.DatabasePokeGrid.Location = new System.Drawing.Point(2, 2);
this.DatabasePokeGrid.Margin = new System.Windows.Forms.Padding(0);
this.DatabasePokeGrid.Name = "DatabasePokeGrid";
this.DatabasePokeGrid.Size = new System.Drawing.Size(251, 346);
this.DatabasePokeGrid.TabIndex = 2;
this.B_Add.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.B_Add.Location = new System.Drawing.Point(196, -1);
this.B_Add.Name = "B_Add";
this.B_Add.Size = new System.Drawing.Size(57, 23);
this.B_Add.TabIndex = 122;
this.B_Add.Text = "Add";
this.B_Add.UseVisualStyleBackColor = true;
this.B_Add.Click += new System.EventHandler(this.B_Add_Click);
//
// SAV_Database
//
@ -1109,5 +1122,6 @@
private System.Windows.Forms.TabPage Tab_Advanced;
private System.Windows.Forms.RichTextBox RTB_Instructions;
private System.Windows.Forms.ToolStripMenuItem Menu_SearchBackups;
private System.Windows.Forms.Button B_Add;
}
}

View file

@ -21,12 +21,13 @@ public partial class SAV_Database : Form
private readonly SaveFile SAV;
private readonly SAVEditor BoxView;
private readonly PKMEditor PKME_Tabs;
private readonly EntityInstructionBuilder UC_Builder;
public SAV_Database(PKMEditor f1, SAVEditor saveditor)
{
InitializeComponent();
WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
var UC_Builder = new EntityInstructionBuilder(() => f1.PreparePKM())
UC_Builder = new EntityInstructionBuilder(() => f1.PreparePKM())
{
Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right,
Width = Tab_Advanced.Width,
@ -34,6 +35,7 @@ public partial class SAV_Database : Form
ReadOnly = true,
};
Tab_Advanced.Controls.Add(UC_Builder);
UC_Builder.SendToBack();
SAV = saveditor.SAV;
BoxView = saveditor;
@ -723,4 +725,16 @@ public partial class SAV_Database : Form
ShowSet.Show(pb, Results[index].Entity);
}
private void B_Add_Click(object sender, EventArgs e)
{
var s = UC_Builder.Create();
if (s.Length == 0)
{ WinFormsUtil.Alert(MsgBEPropertyInvalid); return; }
if (RTB_Instructions.Lines.Length != 0 && RTB_Instructions.Lines[^1].Length > 0)
s = Environment.NewLine + s;
RTB_Instructions.AppendText(s);
}
}

View file

@ -64,6 +64,7 @@
this.TC_SearchOptions = new System.Windows.Forms.TabControl();
this.Tab_General = new System.Windows.Forms.TabPage();
this.Tab_Advanced = new System.Windows.Forms.TabPage();
this.B_Add = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout();
this.P_Results.SuspendLayout();
this.TLP_Filters.SuspendLayout();
@ -484,6 +485,7 @@
//
// Tab_Advanced
//
this.Tab_Advanced.Controls.Add(this.B_Add);
this.Tab_Advanced.Controls.Add(this.RTB_Instructions);
this.Tab_Advanced.Location = new System.Drawing.Point(4, 22);
this.Tab_Advanced.Name = "Tab_Advanced";
@ -492,6 +494,17 @@
this.Tab_Advanced.Text = "Advanced";
this.Tab_Advanced.UseVisualStyleBackColor = true;
//
// B_Add
//
this.B_Add.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.B_Add.Location = new System.Drawing.Point(197, -1);
this.B_Add.Name = "B_Add";
this.B_Add.Size = new System.Drawing.Size(57, 23);
this.B_Add.TabIndex = 122;
this.B_Add.Text = "Add";
this.B_Add.UseVisualStyleBackColor = true;
this.B_Add.Click += new System.EventHandler(this.B_Add_Click);
//
// SAV_Encounters
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -564,5 +577,6 @@
private System.Windows.Forms.TabPage Tab_Advanced;
public System.Windows.Forms.CheckBox CHK_IsEgg;
public System.Windows.Forms.CheckBox CHK_Shiny;
private System.Windows.Forms.Button B_Add;
}
}

View file

@ -22,12 +22,13 @@ public partial class SAV_Encounters : Form
private readonly SummaryPreviewer ShowSet = new();
private readonly TrainerDatabase Trainers;
private readonly CancellationTokenSource TokenSource = new();
private readonly EntityInstructionBuilder UC_Builder;
public SAV_Encounters(PKMEditor f1, TrainerDatabase db)
{
InitializeComponent();
WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
var UC_Builder = new EntityInstructionBuilder(() => f1.PreparePKM())
UC_Builder = new EntityInstructionBuilder(() => f1.PreparePKM())
{
Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right,
Width = Tab_Advanced.Width,
@ -35,6 +36,7 @@ public partial class SAV_Encounters : Form
ReadOnly = true,
};
Tab_Advanced.Controls.Add(UC_Builder);
UC_Builder.SendToBack();
PKME_Tabs = f1;
Trainers = db;
@ -466,4 +468,16 @@ public partial class SAV_Encounters : Form
}
private void SAV_Encounters_FormClosing(object sender, FormClosingEventArgs e) => TokenSource.Cancel();
private void B_Add_Click(object sender, EventArgs e)
{
var s = UC_Builder.Create();
if (s.Length == 0)
{ WinFormsUtil.Alert(MsgBEPropertyInvalid); return; }
if (RTB_Instructions.Lines.Length != 0 && RTB_Instructions.Lines[^1].Length > 0)
s = Environment.NewLine + s;
RTB_Instructions.AppendText(s);
}
}

View file

@ -72,6 +72,7 @@
this.TC_SearchSettings = new System.Windows.Forms.TabControl();
this.Tab_General = new System.Windows.Forms.TabPage();
this.Tab_Advanced = new System.Windows.Forms.TabPage();
this.B_Add = new System.Windows.Forms.Button();
this.RTB_Instructions = new System.Windows.Forms.RichTextBox();
this.menuStrip1.SuspendLayout();
this.P_Results.SuspendLayout();
@ -589,6 +590,7 @@
//
// Tab_Advanced
//
this.Tab_Advanced.Controls.Add(this.B_Add);
this.Tab_Advanced.Controls.Add(this.RTB_Instructions);
this.Tab_Advanced.Location = new System.Drawing.Point(4, 22);
this.Tab_Advanced.Name = "Tab_Advanced";
@ -597,6 +599,17 @@
this.Tab_Advanced.Text = "Advanced";
this.Tab_Advanced.UseVisualStyleBackColor = true;
//
// B_Add
//
this.B_Add.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.B_Add.Location = new System.Drawing.Point(196, -1);
this.B_Add.Name = "B_Add";
this.B_Add.Size = new System.Drawing.Size(57, 23);
this.B_Add.TabIndex = 121;
this.B_Add.Text = "Add";
this.B_Add.UseVisualStyleBackColor = true;
this.B_Add.Click += new System.EventHandler(this.B_Add_Click);
//
// RTB_Instructions
//
this.RTB_Instructions.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -692,5 +705,6 @@
private System.Windows.Forms.TabPage Tab_General;
private System.Windows.Forms.TabPage Tab_Advanced;
private System.Windows.Forms.RichTextBox RTB_Instructions;
private System.Windows.Forms.Button B_Add;
}
}

View file

@ -20,12 +20,13 @@ public partial class SAV_MysteryGiftDB : Form
private readonly SaveFile SAV;
private readonly SAVEditor BoxView;
private readonly SummaryPreviewer ShowSet = new();
private readonly EntityInstructionBuilder UC_Builder;
public SAV_MysteryGiftDB(PKMEditor tabs, SAVEditor sav)
{
InitializeComponent();
WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
var UC_Builder = new EntityInstructionBuilder(() => tabs.PreparePKM())
UC_Builder = new EntityInstructionBuilder(() => tabs.PreparePKM())
{
Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right,
Width = Tab_Advanced.Width,
@ -33,6 +34,7 @@ public partial class SAV_MysteryGiftDB : Form
ReadOnly = true,
};
Tab_Advanced.Controls.Add(UC_Builder);
UC_Builder.SendToBack();
SAV = sav.SAV;
BoxView = sav;
@ -439,4 +441,16 @@ public partial class SAV_MysteryGiftDB : Form
ShowSet.Show(pb, Results[index]);
}
private void B_Add_Click(object sender, EventArgs e)
{
var s = UC_Builder.Create();
if (s.Length == 0)
{ WinFormsUtil.Alert(MsgBEPropertyInvalid); return; }
if (RTB_Instructions.Lines.Length != 0 && RTB_Instructions.Lines[^1].Length > 0)
s = Environment.NewLine + s;
RTB_Instructions.AppendText(s);
}
}