mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-24 14:24:58 +02:00
Fix resizing Shortcut Mapper height makes a mess
Regression was introduce by:
dddbf24ff5
Fix #16817
This commit is contained in:
parent
dddbf24ff5
commit
83d5b18d4d
@ -498,11 +498,11 @@ void ShortcutMapper::resizeDialogElements()
|
||||
{
|
||||
constexpr auto getRcWidth = [](const RECT& rc) -> int {
|
||||
return rc.right - rc.left;
|
||||
};
|
||||
};
|
||||
|
||||
constexpr auto getRcHeight = [](const RECT& rc) -> int {
|
||||
return rc.bottom - rc.top;
|
||||
};
|
||||
};
|
||||
|
||||
auto setOrDeferWindowPos = [](HDWP hWinPosInfo, HWND hWnd, HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT uFlags) -> HDWP {
|
||||
if (hWinPosInfo != nullptr)
|
||||
@ -511,7 +511,7 @@ void ShortcutMapper::resizeDialogElements()
|
||||
}
|
||||
::SetWindowPos(hWnd, hWndInsertAfter, x, y, cx, cy, uFlags);
|
||||
return nullptr;
|
||||
};
|
||||
};
|
||||
|
||||
constexpr UINT flags = SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS;
|
||||
|
||||
@ -543,18 +543,12 @@ void ShortcutMapper::resizeDialogElements()
|
||||
::GetWindowRect(hFilterEdit, &rcFilterEdit);
|
||||
::MapWindowPoints(nullptr, _hSelf, reinterpret_cast<LPPOINT>(&rcFilterEdit), 2);
|
||||
|
||||
RECT rcFilterClearBtn{};
|
||||
HWND hFilterClearBtn = ::GetDlgItem(_hSelf, IDC_BABYGRID_FILTER_CLEAR);
|
||||
::GetWindowRect(hFilterClearBtn, &rcFilterClearBtn);
|
||||
|
||||
int clrBtnWidth = rcFilterEdit.bottom - rcFilterEdit.top;
|
||||
int clrBtnHeight = clrBtnWidth;
|
||||
|
||||
int filterEditLeft = rcFilterEdit.left;
|
||||
int filterEditTop = rcFilterEdit.top;
|
||||
int filterEditWidth = rcClient.right - filterEditLeft - clrBtnWidth - 5;
|
||||
int filterEditHeight = clrBtnHeight;
|
||||
|
||||
int clrBtnLeft = filterEditLeft + filterEditWidth + 1;
|
||||
int clrBtnTop = filterEditTop;
|
||||
int clrBtnWidth = rcFilterClearBtn.right - rcFilterClearBtn.left;
|
||||
int clrBtnHeight = rcFilterClearBtn.bottom - rcFilterClearBtn.top;
|
||||
|
||||
RECT rcInfo{};
|
||||
HWND hInfo = ::GetDlgItem(_hSelf, IDC_BABYGRID_INFO);
|
||||
@ -572,6 +566,7 @@ void ShortcutMapper::resizeDialogElements()
|
||||
::InflateRect(&rcClient, -padding, -(gapBtn + getRcHeight(rcOkBtn)));
|
||||
|
||||
const int gapBtnEdit = rcClearBtn.top - rcFilterEdit.bottom;
|
||||
const int heightFilter = getRcHeight(rcFilterEdit);
|
||||
const int heightInfo = getRcHeight(rcInfo);
|
||||
|
||||
constexpr int nCtrls = 8;
|
||||
@ -582,10 +577,10 @@ void ShortcutMapper::resizeDialogElements()
|
||||
hdwp = setOrDeferWindowPos(hdwp, hDelBtn, nullptr, center + gapBtnHalf, rcClient.bottom, 0, 0, SWP_NOSIZE | flags);
|
||||
hdwp = setOrDeferWindowPos(hdwp, hOkBtn, nullptr, center + gapBtnHalf + wBtn + gapBtn, rcClient.bottom, 0, 0, SWP_NOSIZE | flags);
|
||||
|
||||
rcClient.bottom -= (gapBtnEdit + filterEditHeight);
|
||||
rcClient.bottom -= (gapBtnEdit + heightFilter);
|
||||
hdwp = setOrDeferWindowPos(hdwp, hStatic, nullptr, rcClient.left, rcClient.bottom + gapBtnEdit / 2, 0, 0, SWP_NOSIZE | flags);
|
||||
hdwp = setOrDeferWindowPos(hdwp, hFilterEdit, nullptr, filterEditLeft, filterEditTop, filterEditWidth, filterEditHeight, flags);
|
||||
hdwp = setOrDeferWindowPos(hdwp, hFilterClearBtn, nullptr, clrBtnLeft, clrBtnTop, clrBtnWidth, clrBtnHeight, SWP_SHOWWINDOW | SWP_NOACTIVATE | flags);
|
||||
hdwp = setOrDeferWindowPos(hdwp, hFilterEdit, nullptr, rcFilterEdit.left, rcClient.bottom, rcClient.right - rcFilterEdit.left - clrBtnWidth, heightFilter, flags);
|
||||
hdwp = setOrDeferWindowPos(hdwp, hFilterClearBtn, nullptr, rcClient.right - clrBtnWidth + 2, rcClient.bottom, clrBtnWidth, clrBtnHeight, SWP_NOSIZE | flags);
|
||||
hdwp = setOrDeferWindowPos(hdwp, hInfo, nullptr, rcClient.left, rcClient.bottom - gapBtnEdit - heightInfo, getRcWidth(rcClient), heightInfo, flags);
|
||||
|
||||
if (hdwp)
|
||||
|
@ -32,8 +32,8 @@ BEGIN
|
||||
CONTROL "",IDC_BABYGRID_TABBAR,"SysTabControl32",WS_TABSTOP,5,6,384,12
|
||||
EDITTEXT IDC_BABYGRID_INFO,4,283,442,29,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP
|
||||
RTEXT "Filter:",IDC_BABYGRID_STATIC,4,318,25,8
|
||||
EDITTEXT IDC_BABYGRID_FILTER,32,316,414,12,ES_AUTOHSCROLL | ES_WANTRETURN
|
||||
PUSHBUTTON "✕", IDC_BABYGRID_FILTER_CLEAR, 440, 316, 12, 12, WS_TABSTOP
|
||||
EDITTEXT IDC_BABYGRID_FILTER,32,316,402,12,ES_AUTOHSCROLL | ES_WANTRETURN
|
||||
PUSHBUTTON "✕", IDC_BABYGRID_FILTER_CLEAR, 434, 316, 12, 12, WS_TABSTOP
|
||||
PUSHBUTTON "Modify",IDM_BABYGRID_MODIFY,120,333,47,14
|
||||
PUSHBUTTON "Clear",IDM_BABYGRID_CLEAR,174,333,47,14
|
||||
PUSHBUTTON "Delete",IDM_BABYGRID_DELETE,228,333,47,14
|
||||
|
Loading…
x
Reference in New Issue
Block a user