2 using System
.Collections
.Generic
;
3 using System
.ComponentModel
;
7 using System
.Windows
.Forms
;
11 public partial class PreferencesEditor
: Form
13 internal Prefs m_prefs
;
15 internal PreferencesEditor(Prefs p
)
18 InitializeComponent();
19 m_gitPath
.Text
= m_prefs
.GitDir
;
20 m_editor
.Text
= m_prefs
.ViewerApp
;
21 m_editorArgs
.Text
= m_prefs
.ViewerArgs
;
22 m_difftool
.Text
= m_prefs
.DiffApp
;
23 m_difftoolArgs
.Text
= m_prefs
.DiffArgs
;
24 m_mergeTool
.Text
= m_prefs
.MergeApp
;
25 m_mergetoolArgs
.Text
= m_prefs
.MergeArgs
;
28 protected string ChooseDir(bool bDirs
)
34 r
= m_folderChooser
.ShowDialog();
35 s
= m_folderChooser
.SelectedPath
;
39 r
= m_fileChooser
.ShowDialog();
40 s
= m_fileChooser
.FileName
;
45 private void OnChooseMinGWPath(object sender
, EventArgs e
)
47 string dir
= ChooseDir(true);
48 if (!String
.IsNullOrEmpty(dir
))
54 private void OnSave(object sender
, EventArgs e
)
56 string dir
= m_gitPath
.Text
;
57 if (!System
.IO
.File
.Exists(dir
+ System
.IO
.Path
.DirectorySeparatorChar
+ "git-init-db") &&
58 !System
.IO
.File
.Exists(dir
+ System
.IO
.Path
.DirectorySeparatorChar
+ "git-init-db.exe"))
60 MessageBox
.Show("The location does not appear to have git executables in it.", "Error", MessageBoxButtons
.OK
, MessageBoxIcon
.Error
);
64 m_prefs
.DiffApp
= m_difftool
.Text
;
65 m_prefs
.DiffArgs
= m_difftoolArgs
.Text
;
66 m_prefs
.ViewerApp
= m_editor
.Text
;
67 m_prefs
.ViewerArgs
= m_editorArgs
.Text
;
68 m_prefs
.MergeApp
= m_mergeTool
.Text
;
69 m_prefs
.MergeArgs
= m_mergetoolArgs
.Text
;
74 private void OnBrowseEditor(object sender
, EventArgs e
)
76 string dir
= ChooseDir(false);
77 if (!String
.IsNullOrEmpty(dir
))
83 private void OnBrowseDifftool(object sender
, EventArgs e
)
85 string dir
= ChooseDir(false);
86 if (!String
.IsNullOrEmpty(dir
))
88 m_difftool
.Text
= dir
;
92 private void OnBrowseMegetool(object sender
, EventArgs e
)
94 string dir
= ChooseDir(false);
95 if (!String
.IsNullOrEmpty(dir
))
97 m_mergeTool
.Text
= dir
;