From b307837b1ba4ab6a04e1c1c85d79aa4a83ca53d8 Mon Sep 17 00:00:00 2001
From: Cj <161484149+CJ-SPT@users.noreply.github.com>
Date: Wed, 19 Jun 2024 10:47:29 -0400
Subject: [PATCH] Goto main tab from CC tab
---
RecodeItGUI/GUI/Main.Designer.cs | 105 +++++++++++++++----------------
RecodeItGUI/GUI/Main.cs | 79 ++++++++++++++---------
2 files changed, 103 insertions(+), 81 deletions(-)
diff --git a/RecodeItGUI/GUI/Main.Designer.cs b/RecodeItGUI/GUI/Main.Designer.cs
index 89e61ba..9122a76 100644
--- a/RecodeItGUI/GUI/Main.Designer.cs
+++ b/RecodeItGUI/GUI/Main.Designer.cs
@@ -141,9 +141,12 @@ partial class ReCodeItForm
AutoMapperTypesExcludeBox = new ListBox();
tabPage5 = new TabPage();
groupBox4 = new GroupBox();
+ groupBox5 = new GroupBox();
+ CCBuildConfiguration = new TextBox();
+ CrossPatchRemapButton = new Button();
+ CrossPatchRunButton = new Button();
label4 = new Label();
CCMappingTreeView = new TreeView();
- CrossPatchRunButton = new Button();
groupBox3 = new GroupBox();
CCAutoLoadLastProj = new CheckBox();
CCLoadProjButton = new Button();
@@ -156,13 +159,10 @@ partial class ReCodeItForm
CCBuildDirButton = new Button();
CCOriginalAssemblyButton = new Button();
CCBuildDirText = new TextBox();
- CrossPatchRemapButton = new Button();
SettingsTab = new TabPage();
groupBox2 = new GroupBox();
SilentModeCheckbox = new CheckBox();
DebugLoggingCheckbox = new CheckBox();
- groupBox5 = new GroupBox();
- CCBuildConfiguration = new TextBox();
TabPageRemapper.SuspendLayout();
groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)ConstuctorCountUpDown).BeginInit();
@@ -181,10 +181,10 @@ partial class ReCodeItForm
((System.ComponentModel.ISupportInitialize)AutoMapperRequiredMatchesUpDown).BeginInit();
tabPage5.SuspendLayout();
groupBox4.SuspendLayout();
+ groupBox5.SuspendLayout();
groupBox3.SuspendLayout();
SettingsTab.SuspendLayout();
groupBox2.SuspendLayout();
- groupBox5.SuspendLayout();
SuspendLayout();
//
// TabPageRemapper
@@ -202,7 +202,7 @@ partial class ReCodeItForm
// RemapTreeView
//
RemapTreeView.BackColor = Color.Gray;
- RemapTreeView.Location = new Point(790, 20);
+ RemapTreeView.Location = new Point(781, 20);
RemapTreeView.Name = "RemapTreeView";
RemapTreeView.Size = new Size(487, 890);
RemapTreeView.TabIndex = 1;
@@ -1420,7 +1420,6 @@ partial class ReCodeItForm
tabPage5.Size = new Size(1336, 953);
tabPage5.TabIndex = 4;
tabPage5.Text = "Cross Compiler";
- tabPage5.Click += tabPage5_Click;
//
// groupBox4
//
@@ -1435,22 +1434,36 @@ partial class ReCodeItForm
groupBox4.TabStop = false;
groupBox4.Text = "Cross Compiler";
//
- // label4
+ // groupBox5
//
- label4.AutoSize = true;
- label4.Location = new Point(786, 27);
- label4.Name = "label4";
- label4.Size = new Size(446, 25);
- label4.TabIndex = 26;
- label4.Text = "Project Mappings (Double click to edit in remap editor)";
+ groupBox5.Controls.Add(CCBuildConfiguration);
+ groupBox5.Controls.Add(CrossPatchRemapButton);
+ groupBox5.Controls.Add(CrossPatchRunButton);
+ groupBox5.Location = new Point(6, 274);
+ groupBox5.Name = "groupBox5";
+ groupBox5.Size = new Size(631, 215);
+ groupBox5.TabIndex = 27;
+ groupBox5.TabStop = false;
+ groupBox5.Text = "Generation";
//
- // CCMappingTreeView
+ // CCBuildConfiguration
//
- CCMappingTreeView.BackColor = Color.Gray;
- CCMappingTreeView.Location = new Point(786, 60);
- CCMappingTreeView.Name = "CCMappingTreeView";
- CCMappingTreeView.Size = new Size(472, 825);
- CCMappingTreeView.TabIndex = 25;
+ CCBuildConfiguration.Location = new Point(6, 30);
+ CCBuildConfiguration.Name = "CCBuildConfiguration";
+ CCBuildConfiguration.PlaceholderText = "Build Configuration";
+ CCBuildConfiguration.Size = new Size(150, 31);
+ CCBuildConfiguration.TabIndex = 25;
+ CCBuildConfiguration.Text = "Debug";
+ //
+ // CrossPatchRemapButton
+ //
+ CrossPatchRemapButton.Location = new Point(6, 175);
+ CrossPatchRemapButton.Name = "CrossPatchRemapButton";
+ CrossPatchRemapButton.Size = new Size(316, 34);
+ CrossPatchRemapButton.TabIndex = 21;
+ CrossPatchRemapButton.Text = "Generate Remapped Reference";
+ CrossPatchRemapButton.UseVisualStyleBackColor = true;
+ CrossPatchRemapButton.Click += CrossPatchRemapButton_Click;
//
// CrossPatchRunButton
//
@@ -1462,6 +1475,23 @@ partial class ReCodeItForm
CrossPatchRunButton.UseVisualStyleBackColor = true;
CrossPatchRunButton.Click += CrossPatchRunButton_Click;
//
+ // label4
+ //
+ label4.AutoSize = true;
+ label4.Location = new Point(786, 18);
+ label4.Name = "label4";
+ label4.Size = new Size(446, 25);
+ label4.TabIndex = 26;
+ label4.Text = "Project Mappings (Double click to edit in remap editor)";
+ //
+ // CCMappingTreeView
+ //
+ CCMappingTreeView.BackColor = Color.Gray;
+ CCMappingTreeView.Location = new Point(786, 46);
+ CCMappingTreeView.Name = "CCMappingTreeView";
+ CCMappingTreeView.Size = new Size(487, 855);
+ CCMappingTreeView.TabIndex = 25;
+ //
// groupBox3
//
groupBox3.Controls.Add(CCAutoLoadLastProj);
@@ -1591,16 +1621,6 @@ partial class ReCodeItForm
CCBuildDirText.Size = new Size(501, 31);
CCBuildDirText.TabIndex = 30;
//
- // CrossPatchRemapButton
- //
- CrossPatchRemapButton.Location = new Point(6, 175);
- CrossPatchRemapButton.Name = "CrossPatchRemapButton";
- CrossPatchRemapButton.Size = new Size(316, 34);
- CrossPatchRemapButton.TabIndex = 21;
- CrossPatchRemapButton.Text = "Generate Remapped Reference";
- CrossPatchRemapButton.UseVisualStyleBackColor = true;
- CrossPatchRemapButton.Click += CrossPatchRemapButton_Click;
- //
// SettingsTab
//
SettingsTab.BackColor = SystemColors.ControlDarkDark;
@@ -1645,27 +1665,6 @@ partial class ReCodeItForm
DebugLoggingCheckbox.UseVisualStyleBackColor = true;
DebugLoggingCheckbox.CheckedChanged += DebugLoggingCheckbox_CheckedChanged;
//
- // groupBox5
- //
- groupBox5.Controls.Add(CCBuildConfiguration);
- groupBox5.Controls.Add(CrossPatchRemapButton);
- groupBox5.Controls.Add(CrossPatchRunButton);
- groupBox5.Location = new Point(6, 274);
- groupBox5.Name = "groupBox5";
- groupBox5.Size = new Size(631, 215);
- groupBox5.TabIndex = 27;
- groupBox5.TabStop = false;
- groupBox5.Text = "Generation";
- //
- // CCBuildConfiguration
- //
- CCBuildConfiguration.Location = new Point(6, 30);
- CCBuildConfiguration.Name = "CCBuildConfiguration";
- CCBuildConfiguration.PlaceholderText = "Build Configuration";
- CCBuildConfiguration.Size = new Size(150, 31);
- CCBuildConfiguration.TabIndex = 25;
- CCBuildConfiguration.Text = "Debug";
- //
// ReCodeItForm
//
AutoScaleDimensions = new SizeF(10F, 25F);
@@ -1701,13 +1700,13 @@ partial class ReCodeItForm
tabPage5.ResumeLayout(false);
groupBox4.ResumeLayout(false);
groupBox4.PerformLayout();
+ groupBox5.ResumeLayout(false);
+ groupBox5.PerformLayout();
groupBox3.ResumeLayout(false);
groupBox3.PerformLayout();
SettingsTab.ResumeLayout(false);
groupBox2.ResumeLayout(false);
groupBox2.PerformLayout();
- groupBox5.ResumeLayout(false);
- groupBox5.PerformLayout();
ResumeLayout(false);
}
diff --git a/RecodeItGUI/GUI/Main.cs b/RecodeItGUI/GUI/Main.cs
index 0e2daf9..b1771ed 100644
--- a/RecodeItGUI/GUI/Main.cs
+++ b/RecodeItGUI/GUI/Main.cs
@@ -19,6 +19,7 @@ public partial class ReCodeItForm : Form
private static Settings AppSettings => DataProvider.Settings;
private int _selectedRemapTreeIndex = 0;
+ private int _selectedCCRemapTreeIndex = 0;
public ReCodeItForm()
{
@@ -32,7 +33,8 @@ public partial class ReCodeItForm : Form
RefreshCrossCompilerPage();
LoadMappingFile();
- RemapTreeView.NodeMouseDoubleClick += EditSelectedRemap;
+ RemapTreeView.NodeMouseDoubleClick += ManualEditSelectedRemap;
+ CCMappingTreeView.NodeMouseDoubleClick += CCEditSelectedRemap;
Remapper.OnComplete += ReloadTreeAfterMapping;
}
@@ -52,7 +54,7 @@ public partial class ReCodeItForm : Form
LoadedMappingFilePath.Text = $"Project Mode: ({CrossCompiler.ActiveProject.SolutionName})";
- ReloadTreeView(CrossCompiler.ActiveProject.RemapModels);
+ ReloadRemapTreeView(CrossCompiler.ActiveProject.RemapModels);
return;
}
@@ -80,7 +82,7 @@ public partial class ReCodeItForm : Form
LoadedMappingFilePath.Text = AppSettings.Remapper?.MappingPath;
}
- ReloadTreeView(remaps!);
+ ReloadRemapTreeView(remaps!);
DataProvider.SaveAppSettings();
}
@@ -234,7 +236,7 @@ public partial class ReCodeItForm : Form
CrossCompiler.ActiveProject.OriginalAssemblyPath,
CrossCompiler.ActiveProject.RemappedAssemblyPath);
- ReloadTreeView(CrossCompiler.ActiveProject.RemapModels);
+ ReloadRemapTreeView(CrossCompiler.ActiveProject.RemapModels);
return;
}
@@ -249,7 +251,7 @@ public partial class ReCodeItForm : Form
AppSettings.Remapper.AssemblyPath,
AppSettings.Remapper.OutputPath);
- ReloadTreeView(DataProvider.Remaps);
+ ReloadRemapTreeView(DataProvider.Remaps);
}
///
@@ -257,7 +259,7 @@ public partial class ReCodeItForm : Form
///
private void ReloadTreeAfterMapping()
{
- ReloadTreeView(DataProvider.Remaps);
+ ReloadRemapTreeView(DataProvider.Remaps);
}
private void SaveMappingFileButton_Click(object sender, EventArgs e)
@@ -776,6 +778,8 @@ public partial class ReCodeItForm : Form
CCRemappedOutputText.Text = activeProj.RemappedAssemblyPath;
CCVisualStudioProjDirText.Text = activeProj.VisualStudioSolutionPath;
CCBuildDirText.Text = activeProj.BuildDirectory;
+
+ ReloadCCRemapTreeView(activeProj.RemapModels);
}
private void CCOriginalAssemblyButton_Click(object sender, EventArgs e)
@@ -873,6 +877,7 @@ public partial class ReCodeItForm : Form
if (result != string.Empty)
{
ProjectManager.LoadProject(result);
+ ReloadCCRemapTreeView(ProjectManager.ActiveProject.RemapModels);
}
}
@@ -941,7 +946,34 @@ public partial class ReCodeItForm : Form
NestedTypesExcludeBox.Items.Clear();
}
- private void EditSelectedRemap(object? sender, TreeNodeMouseClickEventArgs e)
+ private void CCEditSelectedRemap(object? sender, TreeNodeMouseClickEventArgs e)
+ {
+ if (e?.Node.Level != 0 || CCMappingTreeView?.SelectedNode?.Index < 0 || CCMappingTreeView?.SelectedNode?.Index == null)
+ {
+ return;
+ }
+
+ _selectedCCRemapTreeIndex = CCMappingTreeView.SelectedNode.Index;
+
+ // Go to remapper page
+ TabControlMain.SelectedIndex = 0;
+
+ DataProvider.Settings.Remapper.UseProjectMappings = true;
+ ActiveProjectMappingsCheckbox.Checked = true;
+ DataProvider.SaveAppSettings();
+
+ EditSelectedRemap(this, e, true);
+ }
+
+ private void ManualEditSelectedRemap(object? sender, TreeNodeMouseClickEventArgs e)
+ {
+ EditSelectedRemap(this, e);
+ }
+
+ private void EditSelectedRemap(
+ object? sender,
+ TreeNodeMouseClickEventArgs e,
+ bool isComingFromOtherTab = false)
{
if (e?.Node.Level != 0 || RemapTreeView?.SelectedNode?.Index < 0 || RemapTreeView?.SelectedNode?.Index == null)
{
@@ -953,7 +985,7 @@ public partial class ReCodeItForm : Form
ResetAllRemapFields();
var remap = AppSettings.Remapper.UseProjectMappings
- ? CrossCompiler.ActiveProject.RemapModels.ElementAt(_selectedRemapTreeIndex)
+ ? CrossCompiler.ActiveProject.RemapModels.ElementAt(isComingFromOtherTab ? _selectedCCRemapTreeIndex : _selectedRemapTreeIndex)
: DataProvider.Remaps.ElementAt(_selectedRemapTreeIndex);
NewTypeName.Text = remap.NewTypeName;
@@ -1041,30 +1073,11 @@ public partial class ReCodeItForm : Form
HasGenericParametersUpDown.BuildStringList("HasGenericParams");
}
- #region TAB_REFRESH
-
- private void AutoMapperTab_Click(object sender, EventArgs e)
- {
- RefreshAutoMapperPage();
- }
-
- private void tabPage5_Click(object sender, EventArgs e)
- {
- RefreshCrossCompilerPage();
- }
-
- private void SettingsTab_Click(object sender, EventArgs e)
- {
- RefreshSettingsPage();
- }
-
- #endregion TAB_REFRESH
-
///
/// Subscribes the the remappers OnComplete event
///
///
- private void ReloadTreeView(List remaps)
+ private void ReloadRemapTreeView(List remaps)
{
RemapTreeView.Nodes.Clear();
@@ -1073,4 +1086,14 @@ public partial class ReCodeItForm : Form
RemapTreeView.Nodes.Add(GUIHelpers.GenerateTreeNode(remap, this));
}
}
+
+ private void ReloadCCRemapTreeView(List remaps)
+ {
+ CCMappingTreeView.Nodes.Clear();
+
+ foreach (var remap in remaps)
+ {
+ CCMappingTreeView.Nodes.Add(GUIHelpers.GenerateTreeNode(remap, this));
+ }
+ }
}
\ No newline at end of file