From 1d5558935be15676d16091e89557f13e36902667 Mon Sep 17 00:00:00 2001 From: Cj <161484149+CJ-SPT@users.noreply.github.com> Date: Wed, 19 Jun 2024 18:15:32 -0400 Subject: [PATCH] Allow enter press to add to list boxes --- RecodeItGUI/GUI/Main.cs | 108 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/RecodeItGUI/GUI/Main.cs b/RecodeItGUI/GUI/Main.cs index c3814e2..5622603 100644 --- a/RecodeItGUI/GUI/Main.cs +++ b/RecodeItGUI/GUI/Main.cs @@ -28,15 +28,123 @@ public partial class ReCodeItForm : Form CrossCompiler = new(); + SubscribeToEvents(); PopulateDomainUpDowns(); RefreshSettingsPage(); RefreshAutoMapperPage(); RefreshCrossCompilerPage(); LoadMappingFile(); + } + private void SubscribeToEvents() + { RemapTreeView.NodeMouseDoubleClick += ManualEditSelectedRemap; CCMappingTreeView.NodeMouseDoubleClick += CCEditSelectedRemap; Remapper.OnComplete += ReloadTreeAfterMapping; + + #region MANUAL_REMAPPER + + IncludeMethodTextBox.KeyDown += (sender, e) => + { + if (e.KeyCode == Keys.Enter) + { + MethodIncludeAddButton_Click(sender, e); + } + }; + + ExcludeMethodTextBox.KeyDown += (sender, e) => + { + if (e.KeyCode == Keys.Enter) + { + MethodExcludeAddButton_Click(sender, e); + } + }; + + FieldsIncludeTextInput.KeyDown += (sender, e) => + { + if (e.KeyCode == Keys.Enter) + { + FIeldIncludeAddButton_Click(sender, e); + } + }; + + FieldsExcludeTextInput.KeyDown += (sender, e) => + { + if (e.KeyCode == Keys.Enter) + { + FieldExcludeAddButton_Click(sender, e); + } + }; + + PropertiesIncludeTextField.KeyDown += (sender, e) => + { + if (e.KeyCode == Keys.Enter) + { + PropertiesIncludeAddButton_Click(sender, e); + } + }; + + PropertiesExcludeTextField.KeyDown += (sender, e) => + { + if (e.KeyCode == Keys.Enter) + { + PropertiesExcludeAddButton_Click(sender, e); + } + }; + + NestedTypesIncludeTextField.KeyDown += (sender, e) => + { + if (e.KeyCode == Keys.Enter) + { + NestedTypesAddButton_Click(sender, e); + } + }; + + NestedTypesExcludeTextField.KeyDown += (sender, e) => + { + if (e.KeyCode == Keys.Enter) + { + NestedTypesExlcudeAddButton_Click(sender, e); + } + }; + + #endregion MANUAL_REMAPPER + + #region AUTOMAPPER + + AutoMapperTypesToIgnoreTextField.KeyDown += (sender, e) => + { + if (e.KeyCode == Keys.Enter) + { + AutoMapperExcludeAddButton_Click(sender, e); + } + }; + + AutoMapperTokensTextField.KeyDown += (sender, e) => + { + if (e.KeyCode == Keys.Enter) + { + AutoMapperTokensAddButton_Click(sender, e); + } + }; + + AutoMapperFPTextField.KeyDown += (sender, e) => + { + if (e.KeyCode == Keys.Enter) + { + AutoMapperFPAddButton_Click(sender, e); + } + }; + + AutoMapperMethodTextBox.KeyDown += (sender, e) => + { + if (e.KeyCode == Keys.Enter) + { + AutoMapperMethodAddButton_Click(sender, e); + } + }; + + #endregion AUTOMAPPER } #region MANUAL_REMAPPER