forked from ReClassNET/ReClass.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettingsForm.cs
More file actions
198 lines (175 loc) · 7.64 KB
/
Copy pathSettingsForm.cs
File metadata and controls
198 lines (175 loc) · 7.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
using System;
using System.Diagnostics.Contracts;
using System.Windows.Forms;
using ReClassNET.Extensions;
using ReClassNET.Native;
using ReClassNET.UI;
using ReClassNET.Util;
namespace ReClassNET.Forms
{
public partial class SettingsForm : IconForm
{
private readonly Settings settings;
public TabControl SettingsTabControl => settingsTabControl;
public SettingsForm(Settings settings)
{
Contract.Requires(settings != null);
this.settings = settings;
InitializeComponent();
var imageList = new ImageList();
imageList.Images.Add(Properties.Resources.B16x16_Gear);
imageList.Images.Add(Properties.Resources.B16x16_Color_Wheel);
imageList.Images.Add(Properties.Resources.B16x16_Settings_Edit);
settingsTabControl.ImageList = imageList;
generalSettingsTabPage.ImageIndex = 0;
colorsSettingTabPage.ImageIndex = 1;
typeDefinitionsSettingsTabPage.ImageIndex = 2;
backgroundColorBox.Color = System.Drawing.Color.Red;
SetBindings();
if (NativeMethods.IsUnix())
{
fileAssociationGroupBox.Enabled = false;
}
else
{
NativeMethodsWindows.SetButtonShield(createAssociationButton, true);
NativeMethodsWindows.SetButtonShield(removeAssociationButton, true);
}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
GlobalWindowManager.AddWindow(this);
}
protected override void OnFormClosed(FormClosedEventArgs e)
{
base.OnFormClosed(e);
GlobalWindowManager.RemoveWindow(this);
}
private void createAssociationButton_Click(object sender, EventArgs e)
{
WinUtil.RunElevated(PathUtil.LauncherExecutablePath, $"-{Constants.CommandLineOptions.FileExtRegister}");
}
private void removeAssociationButton_Click(object sender, EventArgs e)
{
WinUtil.RunElevated(PathUtil.LauncherExecutablePath, $"-{Constants.CommandLineOptions.FileExtUnregister}");
}
private void SetBindings()
{
SetGeneralBindings();
SetColorBindings();
SetTypedefinitionBindings();
}
private void SetGeneralBindings()
{
stayOnTopCheckBox.Source = settings;
stayOnTopCheckBox.SettingName = nameof(Settings.StayOnTop);
stayOnTopCheckBox.CheckedChanged += (sender, e) =>
{
GlobalWindowManager.Windows.ForEach(w => w.TopMost = stayOnTopCheckBox.Checked);
};
showNodeAddressCheckBox.Source = settings;
showNodeAddressCheckBox.SettingName = nameof(Settings.ShowNodeAddress);
showNodeOffsetCheckBox.Source = settings;
showNodeOffsetCheckBox.SettingName = nameof(Settings.ShowNodeOffset);
showTextCheckBox.Source = settings;
showTextCheckBox.SettingName = nameof(Settings.ShowNodeText);
highlightChangedValuesCheckBox.Source = settings;
highlightChangedValuesCheckBox.SettingName = nameof(Settings.HighlightChangedValues);
showFloatCheckBox.Source = settings;
showFloatCheckBox.SettingName = nameof(Settings.ShowCommentFloat);
showIntegerCheckBox.Source = settings;
showIntegerCheckBox.SettingName = nameof(Settings.ShowCommentInteger);
showPointerCheckBox.Source = settings;
showPointerCheckBox.SettingName = nameof(Settings.ShowCommentPointer);
showRttiCheckBox.Source = settings;
showRttiCheckBox.SettingName = nameof(Settings.ShowCommentRtti);
showSymbolsCheckBox.Source = settings;
showSymbolsCheckBox.SettingName = nameof(Settings.ShowCommentSymbol);
showStringCheckBox.Source = settings;
showStringCheckBox.SettingName = nameof(Settings.ShowCommentString);
showPluginInfoCheckBox.Source = settings;
showPluginInfoCheckBox.SettingName = nameof(Settings.ShowCommentPluginInfo);
}
private void SetColorBindings()
{
backgroundColorBox.Source = settings;
backgroundColorBox.SettingName = nameof(Settings.BackgroundColor);
nodeSelectedColorBox.Source = settings;
nodeSelectedColorBox.SettingName = nameof(Settings.SelectedColor);
nodeHiddenColorBox.Source = settings;
nodeHiddenColorBox.SettingName = nameof(Settings.HiddenColor);
nodeAddressColorBox.Source = settings;
nodeAddressColorBox.SettingName = nameof(Settings.AddressColor);
nodeOffsetColorBox.Source = settings;
nodeOffsetColorBox.SettingName = nameof(Settings.OffsetColor);
nodeHexValueColorBox.Source = settings;
nodeHexValueColorBox.SettingName = nameof(Settings.HexColor);
nodeTypeColorBox.Source = settings;
nodeTypeColorBox.SettingName = nameof(Settings.TypeColor);
nodeNameColorBox.Source = settings;
nodeNameColorBox.SettingName = nameof(Settings.NameColor);
nodeValueColorBox.Source = settings;
nodeValueColorBox.SettingName = nameof(Settings.ValueColor);
nodeIndexColorBox.Source = settings;
nodeIndexColorBox.SettingName = nameof(Settings.IndexColor);
nodeVTableColorBox.Source = settings;
nodeVTableColorBox.SettingName = nameof(Settings.VTableColor);
nodeCommentColorBox.Source = settings;
nodeCommentColorBox.SettingName = nameof(Settings.CommentColor);
nodeTextColorBox.Source = settings;
nodeTextColorBox.SettingName = nameof(Settings.TextColor);
nodePluginColorBox.Source = settings;
nodePluginColorBox.SettingName = nameof(Settings.PluginColor);
}
private void SetTypedefinitionBindings()
{
paddingSettingsTextBox.Source = settings;
paddingSettingsTextBox.SettingName = nameof(Settings.TypePadding);
boolSettingsTextBox.Source = settings;
boolSettingsTextBox.SettingName = nameof(Settings.TypeBool);
int8SettingsTextBox.Source = settings;
int8SettingsTextBox.SettingName = nameof(Settings.TypeInt8);
int16SettingsTextBox.Source = settings;
int16SettingsTextBox.SettingName = nameof(Settings.TypeInt16);
int32SettingsTextBox.Source = settings;
int32SettingsTextBox.SettingName = nameof(Settings.TypeInt32);
int64SettingsTextBox.Source = settings;
int64SettingsTextBox.SettingName = nameof(Settings.TypeInt64);
uint8SettingsTextBox.Source = settings;
uint8SettingsTextBox.SettingName = nameof(Settings.TypeUInt8);
uint16SettingsTextBox.Source = settings;
uint16SettingsTextBox.SettingName = nameof(Settings.TypeUInt16);
uint32SettingsTextBox.Source = settings;
uint32SettingsTextBox.SettingName = nameof(Settings.TypeUInt32);
uint64SettingsTextBox.Source = settings;
uint64SettingsTextBox.SettingName = nameof(Settings.TypeUInt64);
floatSettingsTextBox.Source = settings;
floatSettingsTextBox.SettingName = nameof(Settings.TypeFloat);
doubleSettingsTextBox.Source = settings;
doubleSettingsTextBox.SettingName = nameof(Settings.TypeDouble);
vector2SettingsTextBox.Source = settings;
vector2SettingsTextBox.SettingName = nameof(Settings.TypeVector2);
vector3SettingsTextBox.Source = settings;
vector3SettingsTextBox.SettingName = nameof(Settings.TypeVector3);
vector4SettingsTextBox.Source = settings;
vector4SettingsTextBox.SettingName = nameof(Settings.TypeVector4);
matrix3x3SettingsTextBox.Source = settings;
matrix3x3SettingsTextBox.SettingName = nameof(Settings.TypeMatrix3x3);
matrix3x4SettingsTextBox.Source = settings;
matrix3x4SettingsTextBox.SettingName = nameof(Settings.TypeMatrix3x4);
matrix4x4SettingsTextBox.Source = settings;
matrix4x4SettingsTextBox.SettingName = nameof(Settings.TypeMatrix4x4);
utf8TextSettingsTextBox.Source = settings;
utf8TextSettingsTextBox.SettingName = nameof(Settings.TypeUTF8Text);
utf8TextPtrSettingsTextBox.Source = settings;
utf8TextPtrSettingsTextBox.SettingName = nameof(Settings.TypeUTF8TextPtr);
utf16TextSettingsTextBox.Source = settings;
utf16TextSettingsTextBox.SettingName = nameof(Settings.TypeUTF16Text);
utf16TextPtrSettingsTextBox.Source = settings;
utf16TextPtrSettingsTextBox.SettingName = nameof(Settings.TypeUTF16TextPtr);
functionPtrSettingsTextBox.Source = settings;
functionPtrSettingsTextBox.SettingName = nameof(Settings.TypeFunctionPtr);
}
}
}