Fix typos
[TortoiseGit.git] / src / TortoiseProc / Settings / SettingsAdvanced.cpp
blobe669aab39a39acd83117785fb88ee25d3157a0fe
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2012-2024 - TortoiseGit
4 // Copyright (C) 2009-2011, 2013 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "stdafx.h"
22 #include "TortoiseProc.h"
23 #include "SettingsAdvanced.h"
24 #include "registry.h"
25 #include "Git.h"
28 IMPLEMENT_DYNAMIC(CSettingsAdvanced, ISettingsPropPage)
30 CSettingsAdvanced::CSettingsAdvanced()
31 : ISettingsPropPage(CSettingsAdvanced::IDD)
33 AddSetting<DWORDSetting> (L"AutoCompleteMinChars", 3);
34 AddSetting<DWORDSetting> (L"AutocompleteParseMaxSize", 300000L);
35 AddSetting<BooleanSetting>(L"AutocompleteParseUnversioned", false);
36 AddSetting<BooleanSetting>(L"AutocompleteRemovesExtensions", false);
37 AddSetting<BooleanSetting>(L"BlockStatus", false);
38 AddSetting<BooleanSetting>(L"CacheTrayIcon", false);
39 AddSetting<BooleanSetting>(L"CacheSave", true);
40 AddSetting<BooleanSetting>(L"ConflictDontGuessBranchNames", false);
41 AddSetting<BooleanSetting>(L"CygwinHack", false);
42 AddSetting<BooleanSetting>(L"Debug", false);
43 AddSetting<BooleanSetting>(L"DebugOutputString", false);
44 AddSetting<DWORDSetting> (L"DialogTitles", 0);
45 AddSetting<DWORDSetting> (L"DiffSimilarityIndexThreshold", 50);
46 AddSetting<BooleanSetting>(L"DownloadAnimation", true);
47 AddSetting<BooleanSetting>(L"FullRowSelect", true);
48 AddSetting<DWORDSetting> (L"GroupTaskbarIconsPerRepo", 3);
49 AddSetting<BooleanSetting>(L"GroupTaskbarIconsPerRepoOverlay", true);
50 AddSetting<BooleanSetting>(L"LogFontForFileListCtrl", false);
51 AddSetting<BooleanSetting>(L"LogFontForLogCtrl", false);
52 AddSetting<DWORDSetting> (L"LogTooManyItemsThreshold", 1000);
53 AddSetting<BooleanSetting>(L"LogIncludeBoundaryCommits", false);
54 AddSetting<BooleanSetting>(L"LogIncludeWorkingTreeChanges", true);
55 AddSetting<BooleanSetting>(L"LogShowSuperProjectSubmodulePointer", true);
56 AddSetting<DWORDSetting> (L"MaxRefHistoryItems", 5);
57 AddSetting<BooleanSetting>(L"ModifyExplorerTitle", true);
58 AddSetting<BooleanSetting>(L"Msys2Hack", false);
59 AddSetting<BooleanSetting>(L"NamedRemoteFetchAll", true);
60 AddSetting<BooleanSetting>(L"NoSortLocalBranchesFirst", false);
61 AddSetting<DWORDSetting> (L"NumDiffWarning", 10);
62 AddSetting<BooleanSetting>(L"OverlaysCaseSensitive", true);
63 AddSetting<DWORDSetting> (L"ProgressDlgLinesLimit", 50000);
64 AddSetting<BooleanSetting>(L"ReaddUnselectedAddedFilesAfterCommit", true);
65 AddSetting<BooleanSetting>(L"RefreshFileListAfterResolvingConflict", true);
66 AddSetting<BooleanSetting>(L"RememberFileListPosition", true);
67 AddSetting<BooleanSetting>(L"SanitizeCommitMsg", true);
68 AddSetting<BooleanSetting>(L"ScintillaDirect2D", false);
69 AddSetting<BooleanSetting>(L"ShellMenuAccelerators", true);
70 AddSetting<DWORDSetting> (L"ShortHashLengthForHyperLinkInLogMessage", g_Git.GetShortHASHLength());
71 AddSetting<BooleanSetting>(L"ShowContextMenuIcons", true);
72 AddSetting<BooleanSetting>(L"ShowAppContextMenuIcons", true);
73 AddSetting<BooleanSetting>(L"ShowListBackgroundImage", true);
74 AddSetting<BooleanSetting>(L"ShowListFullPathTooltip", true);
75 AddSetting<DWORDSetting> (L"SquashDate", 0);
76 AddSetting<BooleanSetting>(L"StyleCommitMessages", true);
77 AddSetting<BooleanSetting>(L"StyleGitOutput", true);
78 AddSetting<DWORDSetting> (L"TGitCacheCheckContentMaxSize", 10 * 1024);
79 AddSetting<DWORDSetting> (L"UseCustomWordBreak", 2);
80 AddSetting<BooleanSetting>(L"UseLibgit2", true);
81 AddSetting<BooleanSetting>(L"VersionCheck", true);
82 AddSetting<BooleanSetting>(L"VersionCheckPreview", false);
83 AddSetting<BooleanSetting>(L"Win8SpellChecker", false);
86 CSettingsAdvanced::~CSettingsAdvanced()
90 void CSettingsAdvanced::DoDataExchange(CDataExchange* pDX)
92 ISettingsPropPage::DoDataExchange(pDX);
93 DDX_Control(pDX, IDC_CONFIG, m_ListCtrl);
97 BEGIN_MESSAGE_MAP(CSettingsAdvanced, ISettingsPropPage)
98 ON_NOTIFY(LVN_BEGINLABELEDIT, IDC_CONFIG, &CSettingsAdvanced::OnLvnBeginlabeledit)
99 ON_NOTIFY(LVN_ENDLABELEDIT, IDC_CONFIG, &CSettingsAdvanced::OnLvnEndlabeledit)
100 ON_NOTIFY(NM_DBLCLK, IDC_CONFIG, &CSettingsAdvanced::OnNMDblclkConfig)
101 END_MESSAGE_MAP()
104 BOOL CSettingsAdvanced::OnInitDialog()
106 ISettingsPropPage::OnInitDialog();
108 m_ListCtrl.DeleteAllItems();
109 int c = m_ListCtrl.GetHeaderCtrl()->GetItemCount() - 1;
110 while (c >= 0)
111 m_ListCtrl.DeleteColumn(c--);
113 SetWindowTheme(m_ListCtrl.GetSafeHwnd(), L"Explorer", nullptr);
115 CString temp;
116 temp.LoadString(IDS_SETTINGS_CONF_VALUECOL);
117 m_ListCtrl.InsertColumn(0, temp);
118 temp.LoadString(IDS_SETTINGS_CONF_NAMECOL);
119 m_ListCtrl.InsertColumn(1, temp);
121 m_ListCtrl.SetRedraw(FALSE);
123 for (int i = 0; i < static_cast<int>(settings.size()); ++i)
125 m_ListCtrl.InsertItem(i, settings.at(i)->GetName());
126 m_ListCtrl.SetItemText(i, 1, settings.at(i)->GetName());
127 m_ListCtrl.SetItemText(i, 0, settings.at(i)->GetValue());
130 for (int col = 0, maxcol = m_ListCtrl.GetHeaderCtrl()->GetItemCount(); col < maxcol; ++col)
131 m_ListCtrl.SetColumnWidth(col, LVSCW_AUTOSIZE_USEHEADER);
132 int arr[2] = {1,0};
133 m_ListCtrl.SetColumnOrderArray(2, arr);
134 m_ListCtrl.SetRedraw(TRUE);
136 return TRUE;
139 BOOL CSettingsAdvanced::OnApply()
141 for (int i = 0; i < static_cast<int>(settings.size()); ++i)
143 settings.at(i)->StoreValue(m_ListCtrl.GetItemText(i, 0));
146 return ISettingsPropPage::OnApply();
149 void CSettingsAdvanced::OnLvnBeginlabeledit(NMHDR * /*pNMHDR*/, LRESULT *pResult)
151 *pResult = FALSE;
154 void CSettingsAdvanced::OnLvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult)
156 NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
157 *pResult = 0;
158 if (!pDispInfo->item.pszText)
159 return;
161 bool allowEdit = settings.at(pDispInfo->item.iItem)->IsValid(pDispInfo->item.pszText);
163 if (allowEdit)
164 SetModified();
166 *pResult = allowEdit ? TRUE : FALSE;
169 BOOL CSettingsAdvanced::PreTranslateMessage(MSG* pMsg)
171 if (pMsg->message == WM_KEYDOWN)
173 switch (pMsg->wParam)
175 case VK_F2:
177 m_ListCtrl.EditLabel(m_ListCtrl.GetSelectionMark());
179 break;
182 return ISettingsPropPage::PreTranslateMessage(pMsg);
185 void CSettingsAdvanced::OnNMDblclkConfig(NMHDR *pNMHDR, LRESULT *pResult)
187 LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
188 m_ListCtrl.EditLabel(pNMItemActivate->iItem);
189 *pResult = 0;