Fix UI issues

This commit is contained in:
2023-10-18 22:49:45 +08:00
parent 101e3c5ffc
commit f5780a4366
6 changed files with 62 additions and 63 deletions

View File

@ -37,10 +37,10 @@
this.LblResourcesPath = new System.Windows.Forms.Label(); this.LblResourcesPath = new System.Windows.Forms.Label();
this.BtnSearch = new System.Windows.Forms.Button(); this.BtnSearch = new System.Windows.Forms.Button();
this.DGVTextMap = new System.Windows.Forms.DataGridView(); this.DGVTextMap = new System.Windows.Forms.DataGridView();
this.ColumnHash = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnText = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.LblClearFilter = new System.Windows.Forms.Label(); this.LblClearFilter = new System.Windows.Forms.Label();
this.ColumnHash = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnText = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnID = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.DGVTextMap)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DGVTextMap)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -100,30 +100,12 @@
this.DGVTextMap.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.DGVTextMap.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.DGVTextMap.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.DGVTextMap.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.ColumnHash, this.ColumnHash,
this.ColumnID, this.ColumnText,
this.ColumnText}); this.ColumnID});
this.DGVTextMap.Name = "DGVTextMap"; this.DGVTextMap.Name = "DGVTextMap";
this.DGVTextMap.ReadOnly = true; this.DGVTextMap.ReadOnly = true;
this.DGVTextMap.RowTemplate.Height = 23; this.DGVTextMap.RowTemplate.Height = 23;
// //
// ColumnHash
//
resources.ApplyResources(this.ColumnHash, "ColumnHash");
this.ColumnHash.Name = "ColumnHash";
this.ColumnHash.ReadOnly = true;
//
// ColumnID
//
resources.ApplyResources(this.ColumnID, "ColumnID");
this.ColumnID.Name = "ColumnID";
this.ColumnID.ReadOnly = true;
//
// ColumnText
//
resources.ApplyResources(this.ColumnText, "ColumnText");
this.ColumnText.Name = "ColumnText";
this.ColumnText.ReadOnly = true;
//
// LblClearFilter // LblClearFilter
// //
resources.ApplyResources(this.LblClearFilter, "LblClearFilter"); resources.ApplyResources(this.LblClearFilter, "LblClearFilter");
@ -132,6 +114,24 @@
this.LblClearFilter.Name = "LblClearFilter"; this.LblClearFilter.Name = "LblClearFilter";
this.LblClearFilter.Click += new System.EventHandler(this.LblClearFilter_Click); this.LblClearFilter.Click += new System.EventHandler(this.LblClearFilter_Click);
// //
// ColumnHash
//
resources.ApplyResources(this.ColumnHash, "ColumnHash");
this.ColumnHash.Name = "ColumnHash";
this.ColumnHash.ReadOnly = true;
//
// ColumnText
//
resources.ApplyResources(this.ColumnText, "ColumnText");
this.ColumnText.Name = "ColumnText";
this.ColumnText.ReadOnly = true;
//
// ColumnID
//
resources.ApplyResources(this.ColumnID, "ColumnID");
this.ColumnID.Name = "ColumnID";
this.ColumnID.ReadOnly = true;
//
// FormTextMapBrowser // FormTextMapBrowser
// //
resources.ApplyResources(this, "$this"); resources.ApplyResources(this, "$this");
@ -162,9 +162,9 @@
private System.Windows.Forms.Label LblResourcesPath; private System.Windows.Forms.Label LblResourcesPath;
private System.Windows.Forms.Button BtnSearch; private System.Windows.Forms.Button BtnSearch;
private System.Windows.Forms.DataGridView DGVTextMap; private System.Windows.Forms.DataGridView DGVTextMap;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnHash;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnID;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnText;
private System.Windows.Forms.Label LblClearFilter; private System.Windows.Forms.Label LblClearFilter;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnHash;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnText;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnID;
} }
} }

View File

@ -119,13 +119,12 @@ namespace GrasscutterTools.Forms
private void GenLines() private void GenLines()
{ {
List<ListViewItem> items = new List<ListViewItem>(data.TextMap.Count); var items = new List<ListViewItem>(data.TextMap.Count);
foreach (var kv in data.TextMap) foreach (var kv in data.TextMap)
{ {
if (data.ManualTextMap.TryGetValue(kv.Key, out string id)) items.Add(data.ManualTextMap?.TryGetValue(kv.Key, out var id) == true
items.Add(new ListViewItem(new string[] { kv.Key, id, kv.Value })); ? new ListViewItem(new[] { kv.Key, id, kv.Value })
else : new ListViewItem(new[] { kv.Key, "", kv.Value }));
items.Add(new ListViewItem(new string[] { kv.Key, "", kv.Value }));
} }
Items = items; Items = items;
} }
@ -161,26 +160,25 @@ namespace GrasscutterTools.Forms
Cursor = Cursors.WaitCursor; Cursor = Cursors.WaitCursor;
Application.DoEvents(); Application.DoEvents();
var result = data.ManualTextMap.Where(kv => r.Match(kv.Value).Success) var manualResult = data.ManualTextMap?.Where(kv => r.Match(kv.Value).Success)
.Select(kv => new { Hash = kv.Key, Id = kv.Value, Text = data.TextMap[kv.Key] }) .Select(kv => new { Hash = kv.Key, Text = data.TextMap[kv.Key], Id = kv.Value, });
.Concat( var textMapResult = data.TextMap.Where(kv => r.Match(kv.Key).Success || r.Match(kv.Value).Success)
data.TextMap.Where(kv => r.Match(kv.Key).Success || r.Match(kv.Value).Success)
.Select(kv => new .Select(kv => new
{ {
Hash = kv.Key, Hash = kv.Key,
Id = data.ManualTextMap.TryGetValue(kv.Key, out string id) ? id : "", Text = kv.Value,
Text = kv.Value Id = data.ManualTextMap?.TryGetValue(kv.Key, out var id) == true ? id : "",
}) });
).ToList(); var result = manualResult == null ? textMapResult.ToList() : textMapResult.Concat(manualResult).ToList();
DGVTextMap.SuspendLayout(); DGVTextMap.SuspendLayout();
DGVTextMap.Rows.Clear(); DGVTextMap.Rows.Clear();
for (int i = 0; i < result.Count; i++) for (var i = 0; i < result.Count; i++)
{ {
DGVTextMap.Rows.Add(); DGVTextMap.Rows.Add();
DGVTextMap.Rows[i].Cells[0].Value = result[i].Hash; DGVTextMap.Rows[i].Cells[0].Value = result[i].Hash;
DGVTextMap.Rows[i].Cells[1].Value = result[i].Id; DGVTextMap.Rows[i].Cells[1].Value = result[i].Text;
DGVTextMap.Rows[i].Cells[2].Value = result[i].Text; DGVTextMap.Rows[i].Cells[2].Value = result[i].Id;
} }
DGVTextMap.ResumeLayout(); DGVTextMap.ResumeLayout();
} }

View File

@ -315,15 +315,6 @@
<data name="ColumnHash.Width" type="System.Int32, mscorlib"> <data name="ColumnHash.Width" type="System.Int32, mscorlib">
<value>80</value> <value>80</value>
</data> </data>
<metadata name="ColumnID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="ColumnID.HeaderText" xml:space="preserve">
<value>ID</value>
</data>
<data name="ColumnID.Width" type="System.Int32, mscorlib">
<value>240</value>
</data>
<metadata name="ColumnText.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="ColumnText.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
@ -333,6 +324,15 @@
<data name="ColumnText.Width" type="System.Int32, mscorlib"> <data name="ColumnText.Width" type="System.Int32, mscorlib">
<value>250</value> <value>250</value>
</data> </data>
<metadata name="ColumnID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="ColumnID.HeaderText" xml:space="preserve">
<value>ID</value>
</data>
<data name="ColumnID.Width" type="System.Int32, mscorlib">
<value>240</value>
</data>
<data name="DGVTextMap.Location" type="System.Drawing.Point, System.Drawing"> <data name="DGVTextMap.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 70</value> <value>12, 70</value>
</data> </data>
@ -420,18 +420,18 @@
<data name="&gt;&gt;ColumnHash.Type" xml:space="preserve"> <data name="&gt;&gt;ColumnHash.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="&gt;&gt;ColumnID.Name" xml:space="preserve">
<value>ColumnID</value>
</data>
<data name="&gt;&gt;ColumnID.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;ColumnText.Name" xml:space="preserve"> <data name="&gt;&gt;ColumnText.Name" xml:space="preserve">
<value>ColumnText</value> <value>ColumnText</value>
</data> </data>
<data name="&gt;&gt;ColumnText.Type" xml:space="preserve"> <data name="&gt;&gt;ColumnText.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="&gt;&gt;ColumnID.Name" xml:space="preserve">
<value>ColumnID</value>
</data>
<data name="&gt;&gt;ColumnID.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve"> <data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>FormTextMapBrowser</value> <value>FormTextMapBrowser</value>
</data> </data>

View File

@ -274,7 +274,7 @@
<value>2</value> <value>2</value>
</data> </data>
<data name="TxtHotKey.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <data name="TxtHotKey.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Left, Right</value> <value>Bottom, Right</value>
</data> </data>
<data name="TxtHotKey.Location" type="System.Drawing.Point, System.Drawing"> <data name="TxtHotKey.Location" type="System.Drawing.Point, System.Drawing">
<value>262, 210</value> <value>262, 210</value>
@ -301,7 +301,7 @@
<value>4</value> <value>4</value>
</data> </data>
<data name="LblHotKeyLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <data name="LblHotKeyLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Left, Right</value> <value>Bottom, Right</value>
</data> </data>
<data name="LblHotKeyLabel.AutoSize" type="System.Boolean, mscorlib"> <data name="LblHotKeyLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>

View File

@ -90,7 +90,7 @@ namespace GrasscutterTools.Pages
private void TxtSceneFilter_TextChanged(object sender, EventArgs e) private void TxtSceneFilter_TextChanged(object sender, EventArgs e)
{ {
UIUtil.ListBoxFilter(ListScenes, Scenes, TxtSceneFilter.Text); UIUtil.ListBoxFilter(ListScenes, Scenes, TxtSceneFilter.Text);
TxtSceneFilter.Visible = TxtSceneFilter.Text.Length > 0; LblClearFilter.Visible = TxtSceneFilter.Text.Length > 0;
} }
/// <summary> /// <summary>

View File

@ -181,6 +181,7 @@ namespace GrasscutterTools.Pages
FormMain.Instance.ResetPageTabOrders(); FormMain.Instance.ResetPageTabOrders();
FormMain.Instance.UpdatePagesNav(); FormMain.Instance.UpdatePagesNav();
InitPageList(); InitPageList();
isChanged = true;
} }
} }
} }