[NOTEPAD] Shift+F3 for backward search (#5101)

- Add Shift+F3 accelerator as command CMD_SEARCH_PREV.
- Extend DIALOG_SearchNext function with bDown argument for the action of CMD_SEARCH_PREV.
- Modify the message loop for effective F3 key on Find/Replace dialog.
CORE-17064
This commit is contained in:
Katayama Hirofumi MZ 2023-03-01 07:16:28 +09:00 committed by GitHub
parent a9b1e059f4
commit 55e3feba53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 58 additions and 8 deletions

View file

@ -1070,8 +1070,13 @@ VOID DIALOG_Search(VOID)
DIALOG_SearchDialog(FindText);
}
VOID DIALOG_SearchNext(VOID)
VOID DIALOG_SearchNext(BOOL bDown)
{
if (bDown)
Globals.find.Flags |= FR_DOWN;
else
Globals.find.Flags &= ~FR_DOWN;
if (Globals.find.lpstrFindWhat != NULL)
NOTEPAD_FindNext(&Globals.find, FALSE, TRUE);
else

View file

@ -39,7 +39,7 @@ VOID DIALOG_EditTimeDate(VOID);
VOID DIALOG_EditWrap(VOID);
VOID DIALOG_Search(VOID);
VOID DIALOG_SearchNext(VOID);
VOID DIALOG_SearchNext(BOOL bDown);
VOID DIALOG_Replace(VOID);
VOID DIALOG_GoTo(VOID);

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -18,6 +18,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -24,6 +24,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -23,6 +23,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -23,6 +23,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -18,6 +18,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -21,6 +21,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -24,6 +24,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -20,6 +20,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -19,6 +19,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -16,6 +16,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -24,6 +24,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -24,6 +24,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -24,6 +24,7 @@ BEGIN
"^X", CMD_CUT
"^Z", CMD_UNDO
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
VK_F3, CMD_SEARCH_PREV, VIRTKEY, SHIFT
VK_F5, CMD_TIME_DATE, VIRTKEY
END

View file

@ -5,7 +5,7 @@
* Copyright 1997,98 Marcel Baur <mbaur@g26.ethz.ch>
* Copyright 2002 Sylvain Petreolle <spetreolle@yahoo.fr>
* Copyright 2002 Andriy Palamarchuk
* Copyright 2020 Katayama Hirofumi MZ
* Copyright 2020-2023 Katayama Hirofumi MZ
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -37,6 +37,7 @@ VOID NOTEPAD_EnableSearchMenu()
UINT uEnable = MF_BYCOMMAND | (bEmpty ? MF_GRAYED : MF_ENABLED);
EnableMenuItem(Globals.hMenu, CMD_SEARCH, uEnable);
EnableMenuItem(Globals.hMenu, CMD_SEARCH_NEXT, uEnable);
EnableMenuItem(Globals.hMenu, CMD_SEARCH_PREV, uEnable);
}
/***********************************************************************
@ -83,9 +84,10 @@ static int NOTEPAD_MenuCommand(WPARAM wParam)
case CMD_TIME_DATE: DIALOG_EditTimeDate(); break;
case CMD_SEARCH: DIALOG_Search(); break;
case CMD_SEARCH_NEXT: DIALOG_SearchNext(); break;
case CMD_SEARCH_NEXT: DIALOG_SearchNext(TRUE); break;
case CMD_REPLACE: DIALOG_Replace(); break;
case CMD_GOTO: DIALOG_GoTo(); break;
case CMD_SEARCH_PREV: DIALOG_SearchNext(FALSE); break;
case CMD_WRAP: DIALOG_EditWrap(); break;
case CMD_FONT: DIALOG_SelectFont(); break;
@ -647,14 +649,17 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE prev, LPTSTR cmdline, int sh
hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(ID_ACCEL));
while (GetMessage(&msg, 0, 0, 0))
while (GetMessage(&msg, NULL, 0, 0))
{
if (!IsDialogMessage(Globals.hFindReplaceDlg, &msg) &&
!TranslateAccelerator(Globals.hMainWnd, hAccel, &msg))
if (!TranslateAccelerator(Globals.hMainWnd, hAccel, &msg) &&
!IsDialogMessage(Globals.hFindReplaceDlg, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
DestroyAcceleratorTable(hAccel);
return (int) msg.wParam;
}

View file

@ -99,5 +99,5 @@ void NOTEPAD_LoadSettingsFromRegistry(void);
void NOTEPAD_SaveSettingsToRegistry(void);
/* from main.c */
BOOL NOTEPAD_FindNext(FINDREPLACE *, BOOL , BOOL );
BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bShowAlert);
VOID NOTEPAD_EnableSearchMenu(VOID);

View file

@ -54,6 +54,7 @@
#define CMD_SEARCH_NEXT 0x121
#define CMD_REPLACE 0x122
#define CMD_GOTO 0x123
#define CMD_SEARCH_PREV 0x124
#define CMD_WRAP 0x119
#define CMD_FONT 0x140