mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-28 08:14:18 +02:00
Add a clear button for filter field in Shortcut Mapper
Fix #15742, close #16713
This commit is contained in:
parent
45ce3418da
commit
dddbf24ff5
@ -543,6 +543,19 @@ void ShortcutMapper::resizeDialogElements()
|
|||||||
::GetWindowRect(hFilterEdit, &rcFilterEdit);
|
::GetWindowRect(hFilterEdit, &rcFilterEdit);
|
||||||
::MapWindowPoints(nullptr, _hSelf, reinterpret_cast<LPPOINT>(&rcFilterEdit), 2);
|
::MapWindowPoints(nullptr, _hSelf, reinterpret_cast<LPPOINT>(&rcFilterEdit), 2);
|
||||||
|
|
||||||
|
HWND hFilterClearBtn = ::GetDlgItem(_hSelf, IDC_BABYGRID_FILTER_CLEAR);
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
RECT rcInfo{};
|
RECT rcInfo{};
|
||||||
HWND hInfo = ::GetDlgItem(_hSelf, IDC_BABYGRID_INFO);
|
HWND hInfo = ::GetDlgItem(_hSelf, IDC_BABYGRID_INFO);
|
||||||
::GetWindowRect(hInfo, &rcInfo);
|
::GetWindowRect(hInfo, &rcInfo);
|
||||||
@ -559,10 +572,9 @@ void ShortcutMapper::resizeDialogElements()
|
|||||||
::InflateRect(&rcClient, -padding, -(gapBtn + getRcHeight(rcOkBtn)));
|
::InflateRect(&rcClient, -padding, -(gapBtn + getRcHeight(rcOkBtn)));
|
||||||
|
|
||||||
const int gapBtnEdit = rcClearBtn.top - rcFilterEdit.bottom;
|
const int gapBtnEdit = rcClearBtn.top - rcFilterEdit.bottom;
|
||||||
const int heightFilter = getRcHeight(rcFilterEdit);
|
|
||||||
const int heightInfo = getRcHeight(rcInfo);
|
const int heightInfo = getRcHeight(rcInfo);
|
||||||
|
|
||||||
constexpr int nCtrls = 7;
|
constexpr int nCtrls = 8;
|
||||||
auto hdwp = ::BeginDeferWindowPos(nCtrls);
|
auto hdwp = ::BeginDeferWindowPos(nCtrls);
|
||||||
|
|
||||||
hdwp = setOrDeferWindowPos(hdwp, hModBtn, nullptr, center - gapBtnHalf - wBtn * 2 - gapBtn, rcClient.bottom, 0, 0, SWP_NOSIZE | flags);
|
hdwp = setOrDeferWindowPos(hdwp, hModBtn, nullptr, center - gapBtnHalf - wBtn * 2 - gapBtn, rcClient.bottom, 0, 0, SWP_NOSIZE | flags);
|
||||||
@ -570,9 +582,10 @@ void ShortcutMapper::resizeDialogElements()
|
|||||||
hdwp = setOrDeferWindowPos(hdwp, hDelBtn, nullptr, center + gapBtnHalf, rcClient.bottom, 0, 0, SWP_NOSIZE | flags);
|
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);
|
hdwp = setOrDeferWindowPos(hdwp, hOkBtn, nullptr, center + gapBtnHalf + wBtn + gapBtn, rcClient.bottom, 0, 0, SWP_NOSIZE | flags);
|
||||||
|
|
||||||
rcClient.bottom -= (gapBtnEdit + heightFilter);
|
rcClient.bottom -= (gapBtnEdit + filterEditHeight);
|
||||||
hdwp = setOrDeferWindowPos(hdwp, hStatic, nullptr, rcClient.left, rcClient.bottom + gapBtnEdit / 2, 0, 0, SWP_NOSIZE | flags);
|
hdwp = setOrDeferWindowPos(hdwp, hStatic, nullptr, rcClient.left, rcClient.bottom + gapBtnEdit / 2, 0, 0, SWP_NOSIZE | flags);
|
||||||
hdwp = setOrDeferWindowPos(hdwp, hFilterEdit, nullptr, rcFilterEdit.left, rcClient.bottom, rcClient.right - rcFilterEdit.left, heightFilter, 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, hInfo, nullptr, rcClient.left, rcClient.bottom - gapBtnEdit - heightInfo, getRcWidth(rcClient), heightInfo, flags);
|
hdwp = setOrDeferWindowPos(hdwp, hInfo, nullptr, rcClient.left, rcClient.bottom - gapBtnEdit - heightInfo, getRcWidth(rcClient), heightInfo, flags);
|
||||||
|
|
||||||
if (hdwp)
|
if (hdwp)
|
||||||
@ -1360,7 +1373,13 @@ intptr_t CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARA
|
|||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
case IDC_BABYGRID_FILTER_CLEAR:
|
||||||
|
{
|
||||||
|
HWND hFilterEdit = ::GetDlgItem(_hSelf, IDC_BABYGRID_FILTER);
|
||||||
|
::SetWindowText(hFilterEdit, L"");
|
||||||
|
::SetFocus(hFilterEdit);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#pragma code_page(65001)
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "ShortcutMapper_rc.h"
|
#include "ShortcutMapper_rc.h"
|
||||||
@ -32,6 +33,7 @@ BEGIN
|
|||||||
EDITTEXT IDC_BABYGRID_INFO,4,283,442,29,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP
|
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
|
RTEXT "Filter:",IDC_BABYGRID_STATIC,4,318,25,8
|
||||||
EDITTEXT IDC_BABYGRID_FILTER,32,316,414,12,ES_AUTOHSCROLL | ES_WANTRETURN
|
EDITTEXT IDC_BABYGRID_FILTER,32,316,414,12,ES_AUTOHSCROLL | ES_WANTRETURN
|
||||||
|
PUSHBUTTON "✕", IDC_BABYGRID_FILTER_CLEAR, 440, 316, 12, 12, WS_TABSTOP
|
||||||
PUSHBUTTON "Modify",IDM_BABYGRID_MODIFY,120,333,47,14
|
PUSHBUTTON "Modify",IDM_BABYGRID_MODIFY,120,333,47,14
|
||||||
PUSHBUTTON "Clear",IDM_BABYGRID_CLEAR,174,333,47,14
|
PUSHBUTTON "Clear",IDM_BABYGRID_CLEAR,174,333,47,14
|
||||||
PUSHBUTTON "Delete",IDM_BABYGRID_DELETE,228,333,47,14
|
PUSHBUTTON "Delete",IDM_BABYGRID_DELETE,228,333,47,14
|
||||||
|
@ -26,3 +26,4 @@
|
|||||||
#define IDM_BABYGRID_CLEAR (IDD_SHORTCUTMAPPER_DLG + 6)
|
#define IDM_BABYGRID_CLEAR (IDD_SHORTCUTMAPPER_DLG + 6)
|
||||||
#define IDC_BABYGRID_STATIC (IDD_SHORTCUTMAPPER_DLG + 7)
|
#define IDC_BABYGRID_STATIC (IDD_SHORTCUTMAPPER_DLG + 7)
|
||||||
#define IDC_BABYGRID_FILTER (IDD_SHORTCUTMAPPER_DLG + 8)
|
#define IDC_BABYGRID_FILTER (IDD_SHORTCUTMAPPER_DLG + 8)
|
||||||
|
#define IDC_BABYGRID_FILTER_CLEAR (IDD_SHORTCUTMAPPER_DLG + 9)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user