From 6cbb1273a3bda3887232117b056aace724004570 Mon Sep 17 00:00:00 2001 From: ozone10 Date: Tue, 11 Jun 2024 07:27:16 +0200 Subject: [PATCH] Tweak Find in File Progress hits text position - increase width for Find dialog In selection checkbox - increase width for Preference Autocompletion html/xml close tag checkbox According the community's decision: https://community.notepad-plus-plus.org/topic/25874/poll-find-in-files-hits-position ref https://github.com/notepad-plus-plus/notepad-plus-plus/pull/15187#issuecomment-2159602146 Fix #15244, fix #13426, close #15268 --- PowerEditor/src/NppDarkMode.cpp | 6 ++++- .../src/ScintillaComponent/FindReplaceDlg.cpp | 23 +++++++++++++------ .../src/ScintillaComponent/FindReplaceDlg.h | 2 +- .../src/ScintillaComponent/FindReplaceDlg.rc | 5 ++-- .../src/WinControls/Preference/preference.rc | 6 ++--- 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/PowerEditor/src/NppDarkMode.cpp b/PowerEditor/src/NppDarkMode.cpp index 8d1486231..5ba302762 100644 --- a/PowerEditor/src/NppDarkMode.cpp +++ b/PowerEditor/src/NppDarkMode.cpp @@ -2017,7 +2017,11 @@ namespace NppDarkMode ::Polyline(hdc, edge, _countof(edge)); const int roundCornerValue = NppDarkMode::isWindows11() ? DPIManagerV2::scale(4, dpi) : 0; - NppDarkMode::paintRoundFrameRect(hdc, rc, hSelectedPen, roundCornerValue, roundCornerValue); + + ::ExcludeClipRect(hdc, cbi.rcItem.left, cbi.rcItem.top, cbi.rcItem.right, cbi.rcItem.bottom); + ::ExcludeClipRect(hdc, rcArrow.left - 1, rcArrow.top, rcArrow.right, rcArrow.bottom); + + ::RoundRect(hdc, rc.left, rc.top, rc.right, rc.bottom, roundCornerValue, roundCornerValue); ::SelectObject(hdc, holdPen); ::SelectObject(hdc, holdBrush); diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index 834214cf2..ae0f867f8 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -1341,6 +1341,8 @@ void FindReplaceDlg::resizeDialogElements() if (hdwp) ::EndDeferWindowPos(hdwp); + + ::SetWindowPos(::GetDlgItem(_hSelf, IDFINDWHAT), nullptr, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_FRAMECHANGED | flags); } std::mutex findOps_mutex; @@ -4731,7 +4733,7 @@ void FindReplaceDlg::calcAndSetCtrlsPos(DIALOG_TYPE dlgT, bool fromColBtn) LONG yFrame = -btnGapOneHalf; LONG hFrame = btnGapDbl; - + int ySelCheck = rcBtn3rdPos.top; RECT rcToUse{}; switch (dlgT) @@ -4765,6 +4767,13 @@ void FindReplaceDlg::calcAndSetCtrlsPos(DIALOG_TYPE dlgT, bool fromColBtn) case MARK_DLG: { + + RECT rcBtn1stPos{}; + getMappedChildRect(IDOK, rcBtn1stPos); + yFrame += rcBtn1stPos.top; + hFrame += (rcBtn2ndPos.bottom - rcBtn1stPos.top); + ySelCheck = rcBtn2ndPos.top; + rcToUse = rcBtn3rdPos; break; } @@ -4772,10 +4781,11 @@ void FindReplaceDlg::calcAndSetCtrlsPos(DIALOG_TYPE dlgT, bool fromColBtn) ::SetWindowPos(::GetDlgItem(_hSelf, IDCANCEL), nullptr, rcToUse.left, (rcToUse.bottom + btnGap), 0, 0, SWP_NOSIZE | flags); - if (dlgT == FIND_DLG || dlgT == REPLACE_DLG) + if (dlgT == FIND_DLG || dlgT == REPLACE_DLG || dlgT == MARK_DLG) { RECT rcCheckBtn{}; getMappedChildRect(IDC_IN_SELECTION_CHECK, rcCheckBtn); + ::SetWindowPos(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), nullptr, rcCheckBtn.left, ySelCheck + btnGap / 2, 0, 0, SWP_NOSIZE | flags); const LONG xFrame = rcCheckBtn.left - btnGapOneHalf; const LONG wFrame = (rcBtn2ndPos.right - rcCheckBtn.left) + btnGapDbl; @@ -4844,7 +4854,6 @@ void FindReplaceDlg::enableMarkFunc() showFindDlgItem(IDD_FINDREPLACE_SWAP_BUTTON, false); showFindDlgItem(IDREPLACEALL, false); showFindDlgItem(IDC_REPLACE_OPENEDFILES, false); - showFindDlgItem(IDC_REPLACEINSELECTION, false); // find controls to hide showFindDlgItem(IDC_FINDALL_OPENEDFILES, false); @@ -6270,12 +6279,12 @@ int Progress::createProgressWindow() generic_string hits = pNativeSpeaker->getLocalizedStrFromID("progress-hits-title", L"Hits:"); _hRunningHitsStaticText = ::CreateWindowEx(0, WC_STATIC, hits.c_str(), - WS_CHILD | WS_VISIBLE, + WS_CHILD | WS_VISIBLE | SS_RIGHT, 0, 0, 0, 0, _hwnd, nullptr, _hInst, nullptr); _hRunningHitsText = ::CreateWindowEx(0, WC_STATIC, L"", - WS_CHILD | WS_VISIBLE | SS_RIGHT, + WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, _hwnd, nullptr, _hInst, nullptr); @@ -6388,8 +6397,8 @@ void Progress::setCtrlsPos() hdwp = setOrDeferWindowPos(hdwp, _hPathText, nullptr, xStartPos, yCtrlPos, xClientPadded, yText, flags); yCtrlPos += yText; - hdwp = setOrDeferWindowPos(hdwp, _hRunningHitsStaticText, nullptr, xStartPos, yCtrlPos, xTextHits, yText, flags); - hdwp = setOrDeferWindowPos(hdwp, _hRunningHitsText, nullptr, xStartPos + xClientPadded - xTextHits, yCtrlPos, xTextHits, yText, flags); + hdwp = setOrDeferWindowPos(hdwp, _hRunningHitsStaticText, nullptr, (xClientPadded - padding) / 2 - xTextHits, yCtrlPos, xTextHits, yText, flags); + hdwp = setOrDeferWindowPos(hdwp, _hRunningHitsText, nullptr, (xClientPadded + padding) / 2, yCtrlPos, xTextHits, yText, flags); yCtrlPos += yText; hdwp = setOrDeferWindowPos(hdwp, _hPBar, nullptr, xStartPos, yCtrlPos, xClientPadded, yBar, flags); yCtrlPos += yText; diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h index 79ae97283..a326ce6a1 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h @@ -460,7 +460,7 @@ private: std::vector _reduce2hide_findReplace = { IDC_IN_SELECTION_CHECK, IDC_REPLACEINSELECTION, IDREPLACEALL, IDCANCEL }; std::vector _reduce2hide_fif = { IDD_FINDINFILES_FILTERS_STATIC, IDD_FINDINFILES_FILTERS_COMBO, IDCANCEL }; std::vector _reduce2hide_fip = { IDD_FINDINFILES_FILTERS_STATIC, IDD_FINDINFILES_FILTERS_COMBO, IDCANCEL }; - std::vector _reduce2hide_mark = { IDC_MARKLINE_CHECK, IDC_PURGE_CHECK, IDC_IN_SELECTION_CHECK, IDC_COPY_MARKED_TEXT, IDCANCEL }; + std::vector _reduce2hide_mark = { IDC_MARKLINE_CHECK, IDC_PURGE_CHECK, IDC_IN_SELECTION_CHECK, IDC_REPLACEINSELECTION, IDC_COPY_MARKED_TEXT, IDCANCEL }; void enableFindDlgItem(int dlgItemID, bool isEnable = true); void showFindDlgItem(int dlgItemID, bool isShow = true); diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.rc b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.rc index ac04f6663..980ef3678 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.rc +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.rc @@ -25,6 +25,8 @@ EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE CAPTION "Replace" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN + GROUPBOX "",IDC_REPLACEINSELECTION,162,50,180,23 + RTEXT "&Find what:",IDFINDWHAT_STATIC,1,22,73,8 COMBOBOX IDFINDWHAT,76,20,170,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP RTEXT "Rep&lace with:",ID_STATICTEXT_REPLACE,1,40,73,8 @@ -57,8 +59,7 @@ BEGIN CONTROL "Re&gular expression",IDREGEXP,"Button",BS_AUTORADIOBUTTON,12,167,78,10 CONTROL "&. matches newline",IDREDOTMATCHNL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,93,167,101,10 - GROUPBOX "",IDC_REPLACEINSELECTION,192,50,180,23 - CONTROL "In select&ion",IDC_IN_SELECTION_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,58,59,10 + CONTROL "In select&ion",IDC_IN_SELECTION_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,58,90,10 PUSHBUTTON "",IDC_FINDPREV,278,20,17,14,WS_GROUP PUSHBUTTON "",IDC_FINDNEXT,299,20,70,14,WS_GROUP diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index ebeb9e876..bc301bc16 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -286,9 +286,9 @@ BEGIN LISTBOX IDC_LIST_TABSETTNG,307,15,84,70,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP GROUPBOX "",IDC_GR_TABVALUE_STATIC,254,92,188,92,BS_CENTER CONTROL "Use default value",IDC_CHECK_DEFAULTTABVALUE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,250,91,122,10 - RTEXT "Indent size: ",IDC_TABSIZE_STATIC,262,105,98,8 + RTEXT "Indent size:",IDC_TABSIZE_STATIC,262,105,98,8 EDITTEXT IDC_EDIT_TABSIZEVAL,362,103,14,12,ES_CENTER | ES_NUMBER - LTEXT "Indent using: ",IDC_INDENTUSING_STATIC,259,118,135,8 + LTEXT "Indent using:",IDC_INDENTUSING_STATIC,259,118,135,8 CONTROL "Tab character",IDC_RADIO_USINGTAB,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,264,130,165,10 CONTROL "Space character(s)",IDC_RADIO_REPLACEBYSPACE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,264,143,165,10 //CONTROL "Backspace key unindents instead of removing single space",IDC_CHECK_BACKSPACEUNINDENT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,258,158,180,21 @@ -451,7 +451,7 @@ BEGIN CONTROL " {",IDD_AUTOCCURLYBRACKET_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,50,180,24,10 CONTROL " """,IDD_AUTOC_DOUBLEQUOTESCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,140,24,10 CONTROL " '",IDD_AUTOC_QUOTESCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,160,24,10 - CONTROL " html/xml close tag",IDD_AUTOCTAG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,180,76,10 + CONTROL " html/xml close tag",IDD_AUTOCTAG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,180,96,10 RTEXT "Open",IDC_MACHEDPAIROPEN_STATIC,254,126,25,8 LTEXT "Close",IDC_MACHEDPAIRCLOSE_STATIC,292,126,25,8