Layout improvement in FindReplaceDlg

* move labels to resemble v8.2 positioning
* resize IDD_FINDINFILES_DIR_COMBO to make it end with the other comboboxes
* resize IDD_FINDINFILES_BROWSE_BUTTON to match combobox height
* make IDD_FINDREPLACE_SWAP_BUTTON in line with IDD_FINDINFILES_BROWSE_BUTTON
* expand GroupBox to allow for a wider IDREDOTMATCHNL
* expand IDREDOTMATCHNL
* improve scaling algorithm for those ComboBoxes

Fix #11318, close #11386
This commit is contained in:
Daniel Fuchs 2022-03-14 19:30:08 +01:00 committed by Don Ho
parent 9465925cd1
commit dddffcf0fd
2 changed files with 20 additions and 7 deletions

View File

@ -997,6 +997,19 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
SendMessage(hDirCombo, WM_SETFONT, (WPARAM)_hMonospaceFont, MAKELPARAM(true, 0));
}
// Change ComboBox height to accomodate High-DPI settings.
// ComboBoxes are scaled using the font used in them, however this results in weird optics
// on scaling > 200% (192 DPI). Using this method we accomodate these scalings way better
// than the OS does with the current dpiAware.manifest...
for (HWND hComboBox : { hFindCombo, hReplaceCombo, hFiltersCombo, hDirCombo })
{
LOGFONT lf = {};
HFONT font = reinterpret_cast<HFONT>(SendMessage(hComboBox, WM_GETFONT, 0, 0));
::GetObject(font, sizeof(lf), &lf);
lf.lfHeight = (NppParameters::getInstance()._dpiManager.scaleY(16) - 5) * -1;
SendMessage(hComboBox, WM_SETFONT, (WPARAM)CreateFontIndirect(&lf), MAKELPARAM(true, 0));
}
RECT arc;
::GetWindowRect(::GetDlgItem(_hSelf, IDCANCEL), &arc);
_markClosePos.bottom = _findInFilesClosePos.bottom = _replaceClosePos.bottom = _findClosePos.bottom = arc.bottom - arc.top;

View File

@ -24,16 +24,16 @@ EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE
CAPTION "Replace"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
RTEXT "&Find what :",IDFINDWHAT_STATIC,1,21,75,8
RTEXT "&Find what :",IDFINDWHAT_STATIC,1,22,73,8
COMBOBOX IDFINDWHAT,76,20,170,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP
RTEXT "Rep&lace with :",ID_STATICTEXT_REPLACE,1,39,75,8
RTEXT "Rep&lace with :",ID_STATICTEXT_REPLACE,1,40,73,8
COMBOBOX IDREPLACEWITH,76,38,170,50,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "",IDD_FINDREPLACE_SWAP_BUTTON,249,26,13,17
RTEXT "Filter&s :",IDD_FINDINFILES_FILTERS_STATIC,1,57,75,8, SS_NOTIFY
PUSHBUTTON "",IDD_FINDREPLACE_SWAP_BUTTON,248,27,16,17
RTEXT "Filter&s :",IDD_FINDINFILES_FILTERS_STATIC,1,58,73,8, SS_NOTIFY
COMBOBOX IDD_FINDINFILES_FILTERS_COMBO,76,56,170,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP
RTEXT "Dir&ectory :",IDD_FINDINFILES_DIR_STATIC,7,75,40,8
COMBOBOX IDD_FINDINFILES_DIR_COMBO,49,74,190,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "...",IDD_FINDINFILES_BROWSE_BUTTON,245,73,15,13
RTEXT "Dir&ectory :",IDD_FINDINFILES_DIR_STATIC,7,76,41,8
COMBOBOX IDD_FINDINFILES_DIR_COMBO,50,74,196,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "...",IDD_FINDINFILES_BROWSE_BUTTON,248,73,16,14
CONTROL "Follow current doc.",IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,270,73,94,15
CONTROL "In all su&b-folders",IDD_FINDINFILES_RECURSIVE_CHECK,