Make monospaced font in Find dialog optional

Default value is disabled (old behaviour).
This commit is contained in:
Don HO 2019-10-17 14:16:10 +02:00
parent bd95534ab2
commit dde38183d3
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
6 changed files with 34 additions and 17 deletions

View File

@ -5076,6 +5076,10 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
if (optNameBackSlashEscape && !lstrcmp(optNameBackSlashEscape, TEXT("no"))) if (optNameBackSlashEscape && !lstrcmp(optNameBackSlashEscape, TEXT("no")))
_nppGUI._backSlashIsEscapeCharacterForSql = false; _nppGUI._backSlashIsEscapeCharacterForSql = false;
const TCHAR * optNameMonoFont = element->Attribute(TEXT("monospacedFontFinfDlg"));
if (optNameMonoFont && !lstrcmp(optNameMonoFont, TEXT("no")))
_nppGUI._monospacedFontFinfDlg = false;
const TCHAR * optNameNewStyleSaveDlg = element->Attribute(TEXT("newStyleSaveDlg")); const TCHAR * optNameNewStyleSaveDlg = element->Attribute(TEXT("newStyleSaveDlg"));
if (optNameNewStyleSaveDlg) if (optNameNewStyleSaveDlg)
_nppGUI._useNewStyleSaveDlg = (lstrcmp(optNameNewStyleSaveDlg, TEXT("yes")) == 0); _nppGUI._useNewStyleSaveDlg = (lstrcmp(optNameNewStyleSaveDlg, TEXT("yes")) == 0);
@ -5832,6 +5836,7 @@ void NppParameters::createXmlTreeFromGUIParams()
GUIConfigElement->SetAttribute(TEXT("fileSwitcherWithoutExtColumn"), _nppGUI._fileSwitcherWithoutExtColumn ? TEXT("yes") : TEXT("no")); GUIConfigElement->SetAttribute(TEXT("fileSwitcherWithoutExtColumn"), _nppGUI._fileSwitcherWithoutExtColumn ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("backSlashIsEscapeCharacterForSql"), _nppGUI._backSlashIsEscapeCharacterForSql ? TEXT("yes") : TEXT("no")); GUIConfigElement->SetAttribute(TEXT("backSlashIsEscapeCharacterForSql"), _nppGUI._backSlashIsEscapeCharacterForSql ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("monospacedFontFinfDlg"), _nppGUI._monospacedFontFinfDlg ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("newStyleSaveDlg"), _nppGUI._useNewStyleSaveDlg ? TEXT("yes") : TEXT("no")); GUIConfigElement->SetAttribute(TEXT("newStyleSaveDlg"), _nppGUI._useNewStyleSaveDlg ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("isFolderDroppedOpenFiles"), _nppGUI._isFolderDroppedOpenFiles ? TEXT("yes") : TEXT("no")); GUIConfigElement->SetAttribute(TEXT("isFolderDroppedOpenFiles"), _nppGUI._isFolderDroppedOpenFiles ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("docPeekOnTab"), _nppGUI._isDocPeekOnTab ? TEXT("yes") : TEXT("no")); GUIConfigElement->SetAttribute(TEXT("docPeekOnTab"), _nppGUI._isDocPeekOnTab ? TEXT("yes") : TEXT("no"));

View File

@ -824,7 +824,7 @@ struct NppGUI final
char _rightmostDelimiter = ')'; char _rightmostDelimiter = ')';
bool _delimiterSelectionOnEntireDocument = false; bool _delimiterSelectionOnEntireDocument = false;
bool _backSlashIsEscapeCharacterForSql = true; bool _backSlashIsEscapeCharacterForSql = true;
bool _monospacedFontFinfDlg = false;
bool _isWordCharDefault = true; bool _isWordCharDefault = true;
std::string _customWordChars; std::string _customWordChars;

View File

@ -794,28 +794,31 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case WM_INITDIALOG : case WM_INITDIALOG :
{ {
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT); if ((NppParameters::getInstance()).getNppGUI()._monospacedFontFinfDlg)
HWND hReplaceCombo = ::GetDlgItem(_hSelf, IDREPLACEWITH); {
HWND hFiltersCombo = ::GetDlgItem(_hSelf, IDD_FINDINFILES_FILTERS_COMBO); HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
HWND hDirCombo = ::GetDlgItem(_hSelf, IDD_FINDINFILES_DIR_COMBO); HWND hReplaceCombo = ::GetDlgItem(_hSelf, IDREPLACEWITH);
HWND hFiltersCombo = ::GetDlgItem(_hSelf, IDD_FINDINFILES_FILTERS_COMBO);
HWND hDirCombo = ::GetDlgItem(_hSelf, IDD_FINDINFILES_DIR_COMBO);
const TCHAR* fontName = _T("Courier New"); const TCHAR* fontName = _T("Courier New");
const long nFontSize = 8; const long nFontSize = 8;
HDC hdc = GetDC(_hSelf); HDC hdc = GetDC(_hSelf);
LOGFONT logFont = { 0 }; LOGFONT logFont = { 0 };
logFont.lfHeight = -MulDiv(nFontSize, GetDeviceCaps(hdc, LOGPIXELSY), 72); logFont.lfHeight = -MulDiv(nFontSize, GetDeviceCaps(hdc, LOGPIXELSY), 72);
_tcscpy_s(logFont.lfFaceName, fontName); _tcscpy_s(logFont.lfFaceName, fontName);
_hMonospaceFont = CreateFontIndirect(&logFont); _hMonospaceFont = CreateFontIndirect(&logFont);
ReleaseDC(_hSelf, hdc); ReleaseDC(_hSelf, hdc);
SendMessage(hFindCombo, WM_SETFONT, (WPARAM)_hMonospaceFont, MAKELPARAM(true, 0)); SendMessage(hFindCombo, WM_SETFONT, (WPARAM)_hMonospaceFont, MAKELPARAM(true, 0));
SendMessage(hReplaceCombo, WM_SETFONT, (WPARAM)_hMonospaceFont, MAKELPARAM(true, 0)); SendMessage(hReplaceCombo, WM_SETFONT, (WPARAM)_hMonospaceFont, MAKELPARAM(true, 0));
SendMessage(hFiltersCombo, WM_SETFONT, (WPARAM)_hMonospaceFont, MAKELPARAM(true, 0)); SendMessage(hFiltersCombo, WM_SETFONT, (WPARAM)_hMonospaceFont, MAKELPARAM(true, 0));
SendMessage(hDirCombo, WM_SETFONT, (WPARAM)_hMonospaceFont, MAKELPARAM(true, 0)); SendMessage(hDirCombo, WM_SETFONT, (WPARAM)_hMonospaceFont, MAKELPARAM(true, 0));
}
RECT arc; RECT arc;
::GetWindowRect(::GetDlgItem(_hSelf, IDCANCEL), &arc); ::GetWindowRect(::GetDlgItem(_hSelf, IDCANCEL), &arc);

View File

@ -126,6 +126,7 @@ BEGIN
CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,113,217,10 CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,113,217,10
CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,128,217,10 CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,128,217,10
CONTROL "Show only filename in title bar",IDC_CHECK_SHORTTITLE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,143,217,10 CONTROL "Show only filename in title bar",IDC_CHECK_SHORTTITLE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,143,217,10
CONTROL "Use Monospaced font in Find dialog (Need to restart Notepad++)",IDC_CHECK_MONOSPACEDFONT_FINDDLG, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,158,217,10
CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,173,217,10 CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,173,217,10
CONTROL "Enable",IDC_CHECK_CLICKABLELINK_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,15,140,10 CONTROL "Enable",IDC_CHECK_CLICKABLELINK_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,15,140,10
CONTROL "No underline",IDC_CHECK_CLICKABLELINK_NOUNDERLINE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,28,140,10 CONTROL "No underline",IDC_CHECK_CLICKABLELINK_NOUNDERLINE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,28,140,10

View File

@ -913,6 +913,7 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_CHECK_MIN2SYSTRAY, BM_SETCHECK, nppGUI._isMinimizedToTray, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_MIN2SYSTRAY, BM_SETCHECK, nppGUI._isMinimizedToTray, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_DETECTENCODING, BM_SETCHECK, nppGUI._detectEncoding, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_DETECTENCODING, BM_SETCHECK, nppGUI._detectEncoding, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_AUTOUPDATE, BM_SETCHECK, nppGUI._autoUpdateOpt._doAutoUpdate, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_AUTOUPDATE, BM_SETCHECK, nppGUI._autoUpdateOpt._doAutoUpdate, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_MONOSPACEDFONT_FINDDLG, BM_SETCHECK, nppGUI._monospacedFontFinfDlg, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLEDOCPEEKER, BM_SETCHECK, nppGUI._isDocPeekOnTab ? BST_CHECKED : BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLEDOCPEEKER, BM_SETCHECK, nppGUI._isDocPeekOnTab ? BST_CHECKED : BST_UNCHECKED, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLEDOCPEEKONMAP, BM_SETCHECK, nppGUI._isDocPeekOnMap ? BST_CHECKED : BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLEDOCPEEKONMAP, BM_SETCHECK, nppGUI._isDocPeekOnMap ? BST_CHECKED : BST_UNCHECKED, 0);
@ -1071,6 +1072,12 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
return TRUE; return TRUE;
} }
case IDC_CHECK_MONOSPACEDFONT_FINDDLG:
{
nppGUI._monospacedFontFinfDlg = isCheckedOrNot(IDC_CHECK_MONOSPACEDFONT_FINDDLG);
return TRUE;
}
case IDC_CHECK_ENABLEDOCPEEKER: case IDC_CHECK_ENABLEDOCPEEKER:
{ {
nppGUI._isDocPeekOnTab = isCheckedOrNot(IDC_CHECK_ENABLEDOCPEEKER); nppGUI._isDocPeekOnTab = isCheckedOrNot(IDC_CHECK_ENABLEDOCPEEKER);

View File

@ -168,6 +168,7 @@
#define IDC_MAXNBFILEVAL_STATIC (IDD_PREFERENCE_SETTING_BOX + 11) #define IDC_MAXNBFILEVAL_STATIC (IDD_PREFERENCE_SETTING_BOX + 11)
#define IDC_FILEAUTODETECTION_STATIC (IDD_PREFERENCE_SETTING_BOX + 12) #define IDC_FILEAUTODETECTION_STATIC (IDD_PREFERENCE_SETTING_BOX + 12)
#define IDC_CHECK_UPDATESILENTLY (IDD_PREFERENCE_SETTING_BOX + 13) #define IDC_CHECK_UPDATESILENTLY (IDD_PREFERENCE_SETTING_BOX + 13)
#define IDC_CHECK_MONOSPACEDFONT_FINDDLG (IDD_PREFERENCE_SETTING_BOX + 14)
#define IDC_RADIO_BKNONE (IDD_PREFERENCE_SETTING_BOX + 15) #define IDC_RADIO_BKNONE (IDD_PREFERENCE_SETTING_BOX + 15)
#define IDC_RADIO_BKSIMPLE (IDD_PREFERENCE_SETTING_BOX + 16) #define IDC_RADIO_BKSIMPLE (IDD_PREFERENCE_SETTING_BOX + 16)
#define IDC_RADIO_BKVERBOSE (IDD_PREFERENCE_SETTING_BOX + 17) #define IDC_RADIO_BKVERBOSE (IDD_PREFERENCE_SETTING_BOX + 17)