1 //Widgit is free software; you can redistribute it and/or modify
2 //it under the terms of the GNU General Public License as published by
3 //the Free Software Foundation; either version 2 of the License, or
4 //(at your option) any later version.
6 //Widgit is distributed in the hope that it will be useful,
7 //but WITHOUT ANY WARRANTY; without even the implied warranty of
8 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 //GNU General Public License for more details.
11 //You should have received a copy of the GNU General Public License
12 //along with Widgit; if not, write to the Free Software
13 //Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USAusing System;
16 using System
.Collections
.Generic
;
17 using System
.ComponentModel
;
21 using System
.Windows
.Forms
;
25 public partial class PreferencesEditor
: Form
27 internal Prefs m_prefs
;
29 internal PreferencesEditor(Prefs p
)
32 InitializeComponent();
33 m_gitPath
.Text
= m_prefs
.GitDir
;
34 m_editor
.Text
= m_prefs
.ViewerApp
;
35 m_editorArgs
.Text
= m_prefs
.ViewerArgs
;
36 m_difftool
.Text
= m_prefs
.DiffApp
;
37 m_difftoolArgs
.Text
= m_prefs
.DiffArgs
;
38 m_mergeTool
.Text
= m_prefs
.MergeApp
;
39 m_mergetoolArgs
.Text
= m_prefs
.MergeArgs
;
42 protected string ChooseDir(bool bDirs
)
47 m_folderChooser
.ShowDialog();
48 s
= m_folderChooser
.SelectedPath
;
52 m_fileChooser
.ShowDialog();
53 s
= m_fileChooser
.FileName
;
58 private void OnChooseMinGWPath(object sender
, EventArgs e
)
60 string dir
= ChooseDir(true);
61 if (!String
.IsNullOrEmpty(dir
))
67 private void OnSave(object sender
, EventArgs e
)
69 string dir
= m_gitPath
.Text
;
70 if (!System
.IO
.File
.Exists(dir
+ System
.IO
.Path
.DirectorySeparatorChar
+ "git-init-db") &&
71 !System
.IO
.File
.Exists(dir
+ System
.IO
.Path
.DirectorySeparatorChar
+ "git-init-db.exe"))
73 MessageBox
.Show("The location does not appear to have git executables in it.", "Error", MessageBoxButtons
.OK
, MessageBoxIcon
.Error
);
77 m_prefs
.DiffApp
= m_difftool
.Text
;
78 m_prefs
.DiffArgs
= m_difftoolArgs
.Text
;
79 m_prefs
.ViewerApp
= m_editor
.Text
;
80 m_prefs
.ViewerArgs
= m_editorArgs
.Text
;
81 m_prefs
.MergeApp
= m_mergeTool
.Text
;
82 m_prefs
.MergeArgs
= m_mergetoolArgs
.Text
;
87 private void OnBrowseEditor(object sender
, EventArgs e
)
89 string dir
= ChooseDir(false);
90 if (!String
.IsNullOrEmpty(dir
))
96 private void OnBrowseDifftool(object sender
, EventArgs e
)
98 string dir
= ChooseDir(false);
99 if (!String
.IsNullOrEmpty(dir
))
101 m_difftool
.Text
= dir
;
105 private void OnBrowseMegetool(object sender
, EventArgs e
)
107 string dir
= ChooseDir(false);
108 if (!String
.IsNullOrEmpty(dir
))
110 m_mergeTool
.Text
= dir
;