Skip to content

Commit 5efe8b0

Browse files
committed
Update 26.01.31
1 parent 4a3157a commit 5efe8b0

File tree

8 files changed

+369
-322
lines changed

8 files changed

+369
-322
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>26.01.22</Version>
3+
<Version>26.01.31</Version>
44
<LangVersion>14</LangVersion>
55
<Nullable>enable</Nullable>
66
<NeutralLanguage>en</NeutralLanguage>

PKHeX.Core/Items/ItemStorage9ZA.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
namespace PKHeX.Core;
55

6+
/// <summary>
7+
/// Item storage for <see cref="EntityContext.Gen9a"/>
8+
/// </summary>
69
public sealed class ItemStorage9ZA : IItemStorage
710
{
811
public static readonly ItemStorage9ZA Instance = new();
488 Bytes
Binary file not shown.
120 Bytes
Binary file not shown.

PKHeX.WinForms/Resources/text/changelog.txt

Lines changed: 6 additions & 305 deletions
Large diffs are not rendered by default.

PKHeX.WinForms/Resources/text/changelog_2024.txt

Lines changed: 303 additions & 0 deletions
Large diffs are not rendered by default.

PKHeX.WinForms/Subforms/PKM Editors/Text.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ private byte[] SetString(ReadOnlySpan<char> text)
221221
Minimum = min,
222222
Hexadecimal = hex,
223223
Width = 40,
224-
Padding = new Padding(0),
225-
Margin = new Padding(0),
224+
Padding = Padding.Empty,
225+
Margin = Padding.Empty,
226226
};
227227

228228
private static ReadOnlySpan<ushort> GetChars(EntityContext context) => context switch

PKHeX.WinForms/Subforms/Save Editors/Gen9/EventWorkGrid64.cs

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,50 @@ public ulong GetHash(string nameOrHex)
4242
/// <summary>
4343
/// Base class with shared UI helpers and wiring for EventWork grids.
4444
/// </summary>
45-
public abstract record EventWorkGridBase(SplitContainer Container, DataGridView Grid, TextBox Search)
46-
: IEventWorkGrid
45+
public abstract record EventWorkGridBase : IEventWorkGrid
4746
{
47+
private readonly Timer _searchDebounce = new() { Interval = 150 };
48+
private Action<string>? _searchAction;
49+
private SplitContainer Container { get; }
50+
private TextBox Search { get; }
51+
protected DataGridView Grid { get; }
52+
53+
protected EventWorkGridBase(SplitContainer container, DataGridView grid, TextBox search)
54+
{
55+
Container = container;
56+
Grid = grid;
57+
Search = search;
58+
59+
_searchDebounce.Tick += SearchDebounceTick;
60+
Search.Disposed += (_, _) => _searchDebounce.Dispose();
61+
}
62+
63+
protected void WireSearch(Action<string> applyFilter)
64+
{
65+
_searchAction = applyFilter;
66+
Search.TextChanged += (_, _) => RestartSearchDebounce();
67+
}
68+
69+
private void RestartSearchDebounce()
70+
{
71+
if (Search.IsDisposed || Search.Disposing)
72+
return;
73+
74+
_searchDebounce.Stop();
75+
_searchDebounce.Start();
76+
}
77+
78+
private void SearchDebounceTick(object? sender, EventArgs e)
79+
{
80+
_searchDebounce.Stop();
81+
if (_searchAction is null)
82+
return;
83+
if (Search.IsDisposed || Search.Disposing || Grid.IsDisposed || Grid.Disposing || Container.IsDisposed || Container.Disposing)
84+
return;
85+
86+
_searchAction(Search.Text);
87+
}
88+
4889
protected static (SplitContainer Container, TextBox Search) CreateContainerCommon()
4990
{
5091
var container = new SplitContainer
@@ -53,13 +94,13 @@ protected static (SplitContainer Container, TextBox Search) CreateContainerCommo
5394
Orientation = Orientation.Horizontal,
5495
FixedPanel = FixedPanel.Panel1,
5596
IsSplitterFixed = true,
56-
Margin = new Padding(0),
97+
Margin = Padding.Empty,
5798
};
5899

59100
var search = new TextBox
60101
{
61102
Dock = DockStyle.Fill,
62-
Margin = new Padding(0),
103+
Margin = Padding.Empty,
63104
PlaceholderText = "Search...",
64105
};
65106
container.Panel1.Controls.Add(search);
@@ -140,8 +181,7 @@ private EventWorkGrid64(EventWorkStorage64<T> storage, EventWorkLookup names, Sp
140181
if (typeof(T) == typeof(ulong))
141182
Grid.CellValidated += ValidateU64;
142183

143-
Search.TextChanged += (_, _) => ApplyFilter(Search.Text);
144-
184+
WireSearch(ApplyFilter);
145185
ToggleAutoSize(true);
146186
}
147187

@@ -186,7 +226,7 @@ public static EventWorkGrid64<bool> CreateFlags(TabPage host, EventWorkFlagStora
186226
AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None,
187227
Dock = DockStyle.Fill,
188228
RowHeadersVisible = false,
189-
Margin = new Padding(0),
229+
Margin = Padding.Empty,
190230
DefaultCellStyle = new DataGridViewCellStyle { Font = font },
191231
};
192232
dgv.Columns.AddRange(MakeIndexColumn(font), MakeValueBoolColumn(font, "Value"), MakeKeyColumn(font));
@@ -211,7 +251,7 @@ public static EventWorkGrid64<ulong> CreateValues(TabPage host, EventWorkValueSt
211251
AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None,
212252
Dock = DockStyle.Fill,
213253
RowHeadersVisible = false,
214-
Margin = new Padding(0),
254+
Margin = Padding.Empty,
215255
DefaultCellStyle = new DataGridViewCellStyle { Font = font },
216256
};
217257
dgv.Columns.AddRange(MakeIndexColumn(font), MakeValueNumberColumn(font, "Value"), MakeKeyColumn(font));
@@ -317,7 +357,7 @@ private EventWorkGridTuple(EventWorkValueStorageKey128 storage, EventWorkLookup
317357
Names = names;
318358

319359
Grid.CellValueChanged += ValidateCell;
320-
Search.TextChanged += (_, _) => ApplyFilter(Search.Text);
360+
WireSearch(ApplyFilter);
321361
ToggleAutoSize(true);
322362
}
323363

@@ -338,7 +378,7 @@ public static EventWorkGridTuple CreateValues(TabPage host, EventWorkValueStorag
338378
AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None,
339379
Dock = DockStyle.Fill,
340380
RowHeadersVisible = false,
341-
Margin = new Padding(0),
381+
Margin = Padding.Empty,
342382
DefaultCellStyle = new DataGridViewCellStyle { Font = font },
343383
};
344384
var c1 = MakeIndexColumn(font);
@@ -470,7 +510,7 @@ private EventWorkGrid128(EventWorkValueStorageKey128 storage, EventWorkLookup na
470510
Names = names;
471511

472512
Grid.CellValidated += ValidateValue;
473-
Search.TextChanged += (_, _) => ApplyFilter(Search.Text);
513+
WireSearch(ApplyFilter);
474514
ToggleAutoSize(true);
475515
}
476516

@@ -491,7 +531,7 @@ public static EventWorkGrid128 CreateValues(TabPage host, EventWorkValueStorageK
491531
AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None,
492532
Dock = DockStyle.Fill,
493533
RowHeadersVisible = false,
494-
Margin = new Padding(0),
534+
Margin = Padding.Empty,
495535
DefaultCellStyle = new DataGridViewCellStyle { Font = font },
496536
};
497537

@@ -619,7 +659,7 @@ private EventWorkGrid192(EventWorkValueStorageKey192 storage, EventWorkLookup na
619659
Names = names;
620660

621661
Grid.CellValidated += ValidateValue;
622-
Search.TextChanged += (_, _) => ApplyFilter(Search.Text);
662+
WireSearch(ApplyFilter);
623663
ToggleAutoSize(true);
624664
}
625665

@@ -640,7 +680,7 @@ public static EventWorkGrid192 CreateValues(TabPage host, EventWorkValueStorageK
640680
AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None,
641681
Dock = DockStyle.Fill,
642682
RowHeadersVisible = false,
643-
Margin = new Padding(0),
683+
Margin = Padding.Empty,
644684
DefaultCellStyle = new DataGridViewCellStyle { Font = font },
645685
};
646686

0 commit comments

Comments
 (0)