-
Notifications
You must be signed in to change notification settings - Fork 107
/
SccProviderOptionsControl.cs
430 lines (404 loc) · 18.2 KB
/
SccProviderOptionsControl.cs
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
/***************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
This code is licensed under the Visual Studio SDK license terms.
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
***************************************************************************/
using System;
using System.Diagnostics;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Windows.Forms;
using System.Drawing;
using Microsoft.VisualStudio.Shell.Interop;
namespace GitScc
{
/// <summary>
/// Summary description for SccProviderOptionsControl.
/// </summary>
public class SccProviderOptionsControl : System.Windows.Forms.UserControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private OpenFileDialog openFileDialog1;
private Label label1;
private TextBox textBox1;
private Label label2;
private TextBox textBox2;
private Label label3;
private TextBox textBox3;
private Button button1;
private Button button2;
private Button button3;
private Label label4;
private TextBox textBox4;
private Button button4;
private CheckBox checkBox1;
private CheckBox checkBox2;
private CheckBox checkBox3;
private CheckBox checkBox4;
private CheckBox checkBox5;
private CheckBox checkBox6;
private CheckBox useVsDiffChk;
private CheckBox chkDisableDiffMargin;
// The parent page, use to persist data
private SccProviderOptions _customPage;
public SccProviderOptionsControl()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// TODO: Add any initialization after the InitializeComponent call
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
GC.SuppressFinalize(this);
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.textBox4 = new System.Windows.Forms.TextBox();
this.button4 = new System.Windows.Forms.Button();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.checkBox3 = new System.Windows.Forms.CheckBox();
this.checkBox4 = new System.Windows.Forms.CheckBox();
this.checkBox5 = new System.Windows.Forms.CheckBox();
this.checkBox6 = new System.Windows.Forms.CheckBox();
this.useVsDiffChk = new System.Windows.Forms.CheckBox();
this.chkDisableDiffMargin = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 5);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(162, 13);
this.label1.TabIndex = 11;
this.label1.Text = "Path to Git for Windows (git.exe):";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(6, 21);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(283, 20);
this.textBox1.TabIndex = 12;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(3, 44);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(114, 13);
this.label2.TabIndex = 13;
this.label2.Text = "Path to Git Extensions:";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(6, 60);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(283, 20);
this.textBox2.TabIndex = 14;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(3, 191);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(321, 13);
this.label3.TabIndex = 15;
this.label3.Text = "Path to external diff tool (optional, by default diffmerge.exe is used):";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(6, 207);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(283, 20);
this.textBox3.TabIndex = 16;
//
// button1
//
this.button1.Location = new System.Drawing.Point(295, 19);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 17;
this.button1.Text = "Browse ...";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(295, 58);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 18;
this.button2.Text = "Browse ...";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(295, 205);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 19;
this.button3.Text = "Browse ...";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(3, 106);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(98, 13);
this.label4.TabIndex = 20;
this.label4.Text = "Path to TortoiseGit:";
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(6, 122);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(283, 20);
this.textBox4.TabIndex = 21;
//
// button4
//
this.button4.Location = new System.Drawing.Point(295, 120);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 22;
this.button4.Text = "Browse ...";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(66, 86);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(220, 17);
this.checkBox1.TabIndex = 23;
this.checkBox1.Text = "Do not expand Git Extensions commands";
this.checkBox1.UseVisualStyleBackColor = true;
//
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Location = new System.Drawing.Point(66, 148);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(204, 17);
this.checkBox2.TabIndex = 24;
this.checkBox2.Text = "Do not expand TortoiseGit commands";
this.checkBox2.UseVisualStyleBackColor = true;
//
// checkBox3
//
this.checkBox3.AutoSize = true;
this.checkBox3.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.checkBox3.Location = new System.Drawing.Point(6, 233);
this.checkBox3.Name = "checkBox3";
this.checkBox3.Size = new System.Drawing.Size(163, 17);
this.checkBox3.TabIndex = 25;
this.checkBox3.Text = "Use TortoiseGit style icon set";
this.checkBox3.UseVisualStyleBackColor = true;
//
// checkBox4
//
this.checkBox4.AutoSize = true;
this.checkBox4.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.checkBox4.Location = new System.Drawing.Point(6, 252);
this.checkBox4.Name = "checkBox4";
this.checkBox4.Size = new System.Drawing.Size(120, 17);
this.checkBox4.TabIndex = 26;
this.checkBox4.Text = "Disable auto-refresh";
this.checkBox4.UseVisualStyleBackColor = true;
//
// checkBox5
//
this.checkBox5.AutoSize = true;
this.checkBox5.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.checkBox5.Location = new System.Drawing.Point(6, 271);
this.checkBox5.Name = "checkBox5";
this.checkBox5.Size = new System.Drawing.Size(303, 17);
this.checkBox5.TabIndex = 27;
this.checkBox5.Text = "Disable auto switch to this plug-in for Git controlled projects";
this.checkBox5.UseVisualStyleBackColor = true;
//
// checkBox6
//
this.checkBox6.AutoSize = true;
this.checkBox6.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.checkBox6.Location = new System.Drawing.Point(6, 290);
this.checkBox6.Name = "checkBox6";
this.checkBox6.Size = new System.Drawing.Size(205, 17);
this.checkBox6.TabIndex = 28;
this.checkBox6.Text = "Disable UTF-8 file names (Git 1.7.10+)";
this.checkBox6.UseVisualStyleBackColor = true;
//
// useVsDiffChk
//
this.useVsDiffChk.AutoSize = true;
this.useVsDiffChk.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.useVsDiffChk.Location = new System.Drawing.Point(6, 171);
this.useVsDiffChk.Name = "useVsDiffChk";
this.useVsDiffChk.Size = new System.Drawing.Size(197, 17);
this.useVsDiffChk.TabIndex = 29;
this.useVsDiffChk.Text = "Use Visual Studio 2012 Diff Window";
this.useVsDiffChk.UseVisualStyleBackColor = true;
this.useVsDiffChk.CheckedChanged += new System.EventHandler(this.useVsDiffChk_CheckedChanged);
//
// chkDisableDiffMargin
//
this.chkDisableDiffMargin.AutoSize = true;
this.chkDisableDiffMargin.Location = new System.Drawing.Point(6, 309);
this.chkDisableDiffMargin.Name = "chkDisableDiffMargin";
this.chkDisableDiffMargin.Size = new System.Drawing.Size(130, 17);
this.chkDisableDiffMargin.TabIndex = 30;
this.chkDisableDiffMargin.Text = "Disable the diff margin";
this.chkDisableDiffMargin.UseVisualStyleBackColor = true;
//
// SccProviderOptionsControl
//
this.AllowDrop = true;
this.AutoScroll = true;
this.AutoSize = true;
this.Controls.Add(this.chkDisableDiffMargin);
this.Controls.Add(this.useVsDiffChk);
this.Controls.Add(this.checkBox6);
this.Controls.Add(this.checkBox5);
this.Controls.Add(this.checkBox4);
this.Controls.Add(this.checkBox3);
this.Controls.Add(this.checkBox2);
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.button4);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.label4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.Name = "SccProviderOptionsControl";
this.Size = new System.Drawing.Size(435, 340);
this.Load += new System.EventHandler(this.SccProviderOptionsControl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
public SccProviderOptions OptionsPage
{
set
{
_customPage = value;
}
}
private void SccProviderOptionsControl_Load(object sender, EventArgs e)
{
this.textBox1.Text = GitSccOptions.Current.GitBashPath;
this.textBox2.Text = GitSccOptions.Current.GitExtensionPath;
this.textBox3.Text = GitSccOptions.Current.DifftoolPath;
this.textBox4.Text = GitSccOptions.Current.TortoiseGitPath;
this.checkBox1.Checked = GitSccOptions.Current.NotExpandGitExtensions;
this.checkBox2.Checked = GitSccOptions.Current.NotExpandTortoiseGit;
this.checkBox3.Checked = GitSccOptions.Current.UseTGitIconSet;
this.checkBox4.Checked = GitSccOptions.Current.DisableAutoRefresh;
this.checkBox5.Checked = GitSccOptions.Current.DisableAutoLoad;
this.checkBox6.Checked = GitSccOptions.Current.NotUseUTF8FileNames;
this.chkDisableDiffMargin.Checked = GitSccOptions.Current.DisableDiffMargin;
this.useVsDiffChk.Checked = GitSccOptions.Current.UseVsDiff;
if (GitSccOptions.IsVisualStudio2012)
checkBox3.Text += " (requires restart)";
}
private void button1_Click(object sender, EventArgs e)
{
OpenFile("git.exe", textBox1);
}
private void button2_Click(object sender, EventArgs e)
{
OpenFile("*.exe", textBox2);
}
private void button3_Click(object sender, EventArgs e)
{
OpenFile("*.exe", textBox3);
}
private void button4_Click(object sender, EventArgs e)
{
OpenFile("*.exe", textBox4);
}
private void OpenFile(string shexe, TextBox textBox)
{
this.openFileDialog1.FileName = shexe;
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
{
textBox.Text = this.openFileDialog1.FileName;
}
}
internal void Save()
{
GitBash.GitExePath =
GitSccOptions.Current.GitBashPath = this.textBox1.Text;
GitSccOptions.Current.GitExtensionPath = this.textBox2.Text;
GitSccOptions.Current.DifftoolPath = this.textBox3.Text;
GitSccOptions.Current.TortoiseGitPath = this.textBox4.Text;
GitSccOptions.Current.NotExpandGitExtensions = this.checkBox1.Checked;
GitSccOptions.Current.NotExpandTortoiseGit = this.checkBox2.Checked;
GitSccOptions.Current.UseTGitIconSet = this.checkBox3.Checked;
GitSccOptions.Current.DisableAutoRefresh = this.checkBox4.Checked;
GitSccOptions.Current.DisableAutoLoad = this.checkBox5.Checked;
GitSccOptions.Current.NotUseUTF8FileNames = this.checkBox6.Checked;
GitSccOptions.Current.DisableDiffMargin = this.chkDisableDiffMargin.Checked;
GitSccOptions.Current.UseVsDiff = this.useVsDiffChk.Checked;
GitBash.UseUTF8FileNames = !GitSccOptions.Current.NotUseUTF8FileNames;
GitSccOptions.Current.SaveConfig();
SccProviderService sccProviderService = (SccProviderService)GetService(typeof(SccProviderService));
sccProviderService.MarkDirty(false);
}
private void useVsDiffChk_CheckedChanged(object sender, EventArgs e)
{
label3.Enabled = textBox3.Enabled = button3.Enabled
= !useVsDiffChk.Checked;
}
}
}