Goto main tab from CC tab

This commit is contained in:
Cj 2024-06-19 10:47:29 -04:00
parent 766ef5189f
commit b307837b1b
2 changed files with 103 additions and 81 deletions

View File

@ -141,9 +141,12 @@ partial class ReCodeItForm
AutoMapperTypesExcludeBox = new ListBox(); AutoMapperTypesExcludeBox = new ListBox();
tabPage5 = new TabPage(); tabPage5 = new TabPage();
groupBox4 = new GroupBox(); groupBox4 = new GroupBox();
groupBox5 = new GroupBox();
CCBuildConfiguration = new TextBox();
CrossPatchRemapButton = new Button();
CrossPatchRunButton = new Button();
label4 = new Label(); label4 = new Label();
CCMappingTreeView = new TreeView(); CCMappingTreeView = new TreeView();
CrossPatchRunButton = new Button();
groupBox3 = new GroupBox(); groupBox3 = new GroupBox();
CCAutoLoadLastProj = new CheckBox(); CCAutoLoadLastProj = new CheckBox();
CCLoadProjButton = new Button(); CCLoadProjButton = new Button();
@ -156,13 +159,10 @@ partial class ReCodeItForm
CCBuildDirButton = new Button(); CCBuildDirButton = new Button();
CCOriginalAssemblyButton = new Button(); CCOriginalAssemblyButton = new Button();
CCBuildDirText = new TextBox(); CCBuildDirText = new TextBox();
CrossPatchRemapButton = new Button();
SettingsTab = new TabPage(); SettingsTab = new TabPage();
groupBox2 = new GroupBox(); groupBox2 = new GroupBox();
SilentModeCheckbox = new CheckBox(); SilentModeCheckbox = new CheckBox();
DebugLoggingCheckbox = new CheckBox(); DebugLoggingCheckbox = new CheckBox();
groupBox5 = new GroupBox();
CCBuildConfiguration = new TextBox();
TabPageRemapper.SuspendLayout(); TabPageRemapper.SuspendLayout();
groupBox1.SuspendLayout(); groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)ConstuctorCountUpDown).BeginInit(); ((System.ComponentModel.ISupportInitialize)ConstuctorCountUpDown).BeginInit();
@ -181,10 +181,10 @@ partial class ReCodeItForm
((System.ComponentModel.ISupportInitialize)AutoMapperRequiredMatchesUpDown).BeginInit(); ((System.ComponentModel.ISupportInitialize)AutoMapperRequiredMatchesUpDown).BeginInit();
tabPage5.SuspendLayout(); tabPage5.SuspendLayout();
groupBox4.SuspendLayout(); groupBox4.SuspendLayout();
groupBox5.SuspendLayout();
groupBox3.SuspendLayout(); groupBox3.SuspendLayout();
SettingsTab.SuspendLayout(); SettingsTab.SuspendLayout();
groupBox2.SuspendLayout(); groupBox2.SuspendLayout();
groupBox5.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
// TabPageRemapper // TabPageRemapper
@ -202,7 +202,7 @@ partial class ReCodeItForm
// RemapTreeView // RemapTreeView
// //
RemapTreeView.BackColor = Color.Gray; RemapTreeView.BackColor = Color.Gray;
RemapTreeView.Location = new Point(790, 20); RemapTreeView.Location = new Point(781, 20);
RemapTreeView.Name = "RemapTreeView"; RemapTreeView.Name = "RemapTreeView";
RemapTreeView.Size = new Size(487, 890); RemapTreeView.Size = new Size(487, 890);
RemapTreeView.TabIndex = 1; RemapTreeView.TabIndex = 1;
@ -1420,7 +1420,6 @@ partial class ReCodeItForm
tabPage5.Size = new Size(1336, 953); tabPage5.Size = new Size(1336, 953);
tabPage5.TabIndex = 4; tabPage5.TabIndex = 4;
tabPage5.Text = "Cross Compiler"; tabPage5.Text = "Cross Compiler";
tabPage5.Click += tabPage5_Click;
// //
// groupBox4 // groupBox4
// //
@ -1435,22 +1434,36 @@ partial class ReCodeItForm
groupBox4.TabStop = false; groupBox4.TabStop = false;
groupBox4.Text = "Cross Compiler"; groupBox4.Text = "Cross Compiler";
// //
// label4 // groupBox5
// //
label4.AutoSize = true; groupBox5.Controls.Add(CCBuildConfiguration);
label4.Location = new Point(786, 27); groupBox5.Controls.Add(CrossPatchRemapButton);
label4.Name = "label4"; groupBox5.Controls.Add(CrossPatchRunButton);
label4.Size = new Size(446, 25); groupBox5.Location = new Point(6, 274);
label4.TabIndex = 26; groupBox5.Name = "groupBox5";
label4.Text = "Project Mappings (Double click to edit in remap editor)"; groupBox5.Size = new Size(631, 215);
groupBox5.TabIndex = 27;
groupBox5.TabStop = false;
groupBox5.Text = "Generation";
// //
// CCMappingTreeView // CCBuildConfiguration
// //
CCMappingTreeView.BackColor = Color.Gray; CCBuildConfiguration.Location = new Point(6, 30);
CCMappingTreeView.Location = new Point(786, 60); CCBuildConfiguration.Name = "CCBuildConfiguration";
CCMappingTreeView.Name = "CCMappingTreeView"; CCBuildConfiguration.PlaceholderText = "Build Configuration";
CCMappingTreeView.Size = new Size(472, 825); CCBuildConfiguration.Size = new Size(150, 31);
CCMappingTreeView.TabIndex = 25; 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 // CrossPatchRunButton
// //
@ -1462,6 +1475,23 @@ partial class ReCodeItForm
CrossPatchRunButton.UseVisualStyleBackColor = true; CrossPatchRunButton.UseVisualStyleBackColor = true;
CrossPatchRunButton.Click += CrossPatchRunButton_Click; 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
// //
groupBox3.Controls.Add(CCAutoLoadLastProj); groupBox3.Controls.Add(CCAutoLoadLastProj);
@ -1591,16 +1621,6 @@ partial class ReCodeItForm
CCBuildDirText.Size = new Size(501, 31); CCBuildDirText.Size = new Size(501, 31);
CCBuildDirText.TabIndex = 30; 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
// //
SettingsTab.BackColor = SystemColors.ControlDarkDark; SettingsTab.BackColor = SystemColors.ControlDarkDark;
@ -1645,27 +1665,6 @@ partial class ReCodeItForm
DebugLoggingCheckbox.UseVisualStyleBackColor = true; DebugLoggingCheckbox.UseVisualStyleBackColor = true;
DebugLoggingCheckbox.CheckedChanged += DebugLoggingCheckbox_CheckedChanged; 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 // ReCodeItForm
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(10F, 25F);
@ -1701,13 +1700,13 @@ partial class ReCodeItForm
tabPage5.ResumeLayout(false); tabPage5.ResumeLayout(false);
groupBox4.ResumeLayout(false); groupBox4.ResumeLayout(false);
groupBox4.PerformLayout(); groupBox4.PerformLayout();
groupBox5.ResumeLayout(false);
groupBox5.PerformLayout();
groupBox3.ResumeLayout(false); groupBox3.ResumeLayout(false);
groupBox3.PerformLayout(); groupBox3.PerformLayout();
SettingsTab.ResumeLayout(false); SettingsTab.ResumeLayout(false);
groupBox2.ResumeLayout(false); groupBox2.ResumeLayout(false);
groupBox2.PerformLayout(); groupBox2.PerformLayout();
groupBox5.ResumeLayout(false);
groupBox5.PerformLayout();
ResumeLayout(false); ResumeLayout(false);
} }

View File

@ -19,6 +19,7 @@ public partial class ReCodeItForm : Form
private static Settings AppSettings => DataProvider.Settings; private static Settings AppSettings => DataProvider.Settings;
private int _selectedRemapTreeIndex = 0; private int _selectedRemapTreeIndex = 0;
private int _selectedCCRemapTreeIndex = 0;
public ReCodeItForm() public ReCodeItForm()
{ {
@ -32,7 +33,8 @@ public partial class ReCodeItForm : Form
RefreshCrossCompilerPage(); RefreshCrossCompilerPage();
LoadMappingFile(); LoadMappingFile();
RemapTreeView.NodeMouseDoubleClick += EditSelectedRemap; RemapTreeView.NodeMouseDoubleClick += ManualEditSelectedRemap;
CCMappingTreeView.NodeMouseDoubleClick += CCEditSelectedRemap;
Remapper.OnComplete += ReloadTreeAfterMapping; Remapper.OnComplete += ReloadTreeAfterMapping;
} }
@ -52,7 +54,7 @@ public partial class ReCodeItForm : Form
LoadedMappingFilePath.Text = $"Project Mode: ({CrossCompiler.ActiveProject.SolutionName})"; LoadedMappingFilePath.Text = $"Project Mode: ({CrossCompiler.ActiveProject.SolutionName})";
ReloadTreeView(CrossCompiler.ActiveProject.RemapModels); ReloadRemapTreeView(CrossCompiler.ActiveProject.RemapModels);
return; return;
} }
@ -80,7 +82,7 @@ public partial class ReCodeItForm : Form
LoadedMappingFilePath.Text = AppSettings.Remapper?.MappingPath; LoadedMappingFilePath.Text = AppSettings.Remapper?.MappingPath;
} }
ReloadTreeView(remaps!); ReloadRemapTreeView(remaps!);
DataProvider.SaveAppSettings(); DataProvider.SaveAppSettings();
} }
@ -234,7 +236,7 @@ public partial class ReCodeItForm : Form
CrossCompiler.ActiveProject.OriginalAssemblyPath, CrossCompiler.ActiveProject.OriginalAssemblyPath,
CrossCompiler.ActiveProject.RemappedAssemblyPath); CrossCompiler.ActiveProject.RemappedAssemblyPath);
ReloadTreeView(CrossCompiler.ActiveProject.RemapModels); ReloadRemapTreeView(CrossCompiler.ActiveProject.RemapModels);
return; return;
} }
@ -249,7 +251,7 @@ public partial class ReCodeItForm : Form
AppSettings.Remapper.AssemblyPath, AppSettings.Remapper.AssemblyPath,
AppSettings.Remapper.OutputPath); AppSettings.Remapper.OutputPath);
ReloadTreeView(DataProvider.Remaps); ReloadRemapTreeView(DataProvider.Remaps);
} }
/// <summary> /// <summary>
@ -257,7 +259,7 @@ public partial class ReCodeItForm : Form
/// </summary> /// </summary>
private void ReloadTreeAfterMapping() private void ReloadTreeAfterMapping()
{ {
ReloadTreeView(DataProvider.Remaps); ReloadRemapTreeView(DataProvider.Remaps);
} }
private void SaveMappingFileButton_Click(object sender, EventArgs e) private void SaveMappingFileButton_Click(object sender, EventArgs e)
@ -776,6 +778,8 @@ public partial class ReCodeItForm : Form
CCRemappedOutputText.Text = activeProj.RemappedAssemblyPath; CCRemappedOutputText.Text = activeProj.RemappedAssemblyPath;
CCVisualStudioProjDirText.Text = activeProj.VisualStudioSolutionPath; CCVisualStudioProjDirText.Text = activeProj.VisualStudioSolutionPath;
CCBuildDirText.Text = activeProj.BuildDirectory; CCBuildDirText.Text = activeProj.BuildDirectory;
ReloadCCRemapTreeView(activeProj.RemapModels);
} }
private void CCOriginalAssemblyButton_Click(object sender, EventArgs e) private void CCOriginalAssemblyButton_Click(object sender, EventArgs e)
@ -873,6 +877,7 @@ public partial class ReCodeItForm : Form
if (result != string.Empty) if (result != string.Empty)
{ {
ProjectManager.LoadProject(result); ProjectManager.LoadProject(result);
ReloadCCRemapTreeView(ProjectManager.ActiveProject.RemapModels);
} }
} }
@ -941,7 +946,34 @@ public partial class ReCodeItForm : Form
NestedTypesExcludeBox.Items.Clear(); 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) if (e?.Node.Level != 0 || RemapTreeView?.SelectedNode?.Index < 0 || RemapTreeView?.SelectedNode?.Index == null)
{ {
@ -953,7 +985,7 @@ public partial class ReCodeItForm : Form
ResetAllRemapFields(); ResetAllRemapFields();
var remap = AppSettings.Remapper.UseProjectMappings var remap = AppSettings.Remapper.UseProjectMappings
? CrossCompiler.ActiveProject.RemapModels.ElementAt(_selectedRemapTreeIndex) ? CrossCompiler.ActiveProject.RemapModels.ElementAt(isComingFromOtherTab ? _selectedCCRemapTreeIndex : _selectedRemapTreeIndex)
: DataProvider.Remaps.ElementAt(_selectedRemapTreeIndex); : DataProvider.Remaps.ElementAt(_selectedRemapTreeIndex);
NewTypeName.Text = remap.NewTypeName; NewTypeName.Text = remap.NewTypeName;
@ -1041,30 +1073,11 @@ public partial class ReCodeItForm : Form
HasGenericParametersUpDown.BuildStringList("HasGenericParams"); 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
/// <summary> /// <summary>
/// Subscribes the the remappers OnComplete event /// Subscribes the the remappers OnComplete event
/// </summary> /// </summary>
/// <param name="remaps"></param> /// <param name="remaps"></param>
private void ReloadTreeView(List<RemapModel> remaps) private void ReloadRemapTreeView(List<RemapModel> remaps)
{ {
RemapTreeView.Nodes.Clear(); RemapTreeView.Nodes.Clear();
@ -1073,4 +1086,14 @@ public partial class ReCodeItForm : Form
RemapTreeView.Nodes.Add(GUIHelpers.GenerateTreeNode(remap, this)); RemapTreeView.Nodes.Add(GUIHelpers.GenerateTreeNode(remap, this));
} }
} }
private void ReloadCCRemapTreeView(List<RemapModel> remaps)
{
CCMappingTreeView.Nodes.Clear();
foreach (var remap in remaps)
{
CCMappingTreeView.Nodes.Add(GUIHelpers.GenerateTreeNode(remap, this));
}
}
} }