Find dialog added
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@976 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
4092e33109
commit
4d6e00a745
3 changed files with 55 additions and 9 deletions
|
@ -36,6 +36,10 @@ HWND g_hwnd;
|
|||
HANDLE g_hThread;
|
||||
BOOL g_warnings;
|
||||
|
||||
FINDREPLACE fr;
|
||||
UINT uFindReplaceMsg; // message identifier for FINDMSGSTRING
|
||||
HWND hwndFind;
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char *cmdParam, int cmdShow) {
|
||||
HACCEL haccel;
|
||||
g_hInstance=GetModuleHandle(0);
|
||||
|
@ -56,12 +60,14 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char *cmdParam, int cmd
|
|||
int status;
|
||||
while ((status=GetMessage(&msg,0,0,0))!=0) {
|
||||
if (status==-1) return -1;
|
||||
if (!TranslateAccelerator(hDialog,haccel,&msg)) {
|
||||
if (!IsDialogMessage(hDialog,&msg)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
if (!IsDialogMessage(hwndFind, &msg)) {
|
||||
if (!TranslateAccelerator(hDialog,haccel,&msg)) {
|
||||
if (!IsDialogMessage(hDialog,&msg)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ExitProcess(msg.wParam);
|
||||
return msg.wParam;
|
||||
|
@ -282,9 +288,44 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
}
|
||||
return TRUE;
|
||||
}
|
||||
case IDM_FIND:
|
||||
{
|
||||
if (!uFindReplaceMsg)
|
||||
uFindReplaceMsg = RegisterWindowMessage(FINDMSGSTRING);
|
||||
my_memset(&fr, 0, sizeof(FINDREPLACE));
|
||||
fr.lStructSize = sizeof(FINDREPLACE);
|
||||
fr.hwndOwner = hwndDlg;
|
||||
fr.Flags = FR_NOUPDOWN;
|
||||
fr.lpstrFindWhat = (char *)GlobalAlloc(GPTR, 128);
|
||||
if (!fr.lpstrFindWhat) return TRUE;
|
||||
fr.wFindWhatLen = 128;
|
||||
hwndFind = FindText(&fr);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (msg == uFindReplaceMsg) {
|
||||
LPFINDREPLACE lpfr = (LPFINDREPLACE)lParam;
|
||||
if (lpfr->Flags & FR_FINDNEXT) {
|
||||
WPARAM flags = FR_DOWN;
|
||||
if (lpfr->Flags & FR_MATCHCASE) flags |= FR_MATCHCASE;
|
||||
if (lpfr->Flags & FR_WHOLEWORD) flags |= FR_WHOLEWORD;
|
||||
|
||||
FINDTEXTEX ft;
|
||||
SendDlgItemMessage(hwndDlg, IDC_LOGWIN, EM_EXGETSEL, 0, (LPARAM)&ft.chrg);
|
||||
if (ft.chrg.cpMax == ft.chrg.cpMin) ft.chrg.cpMin = 0;
|
||||
else ft.chrg.cpMin = ft.chrg.cpMax;
|
||||
ft.chrg.cpMax = SendDlgItemMessage(hwndDlg, IDC_LOGWIN, WM_GETTEXTLENGTH, 0, 0);
|
||||
ft.lpstrText = lpfr->lpstrFindWhat;
|
||||
ft.chrg.cpMin = SendDlgItemMessage(hwndDlg, IDC_LOGWIN, EM_FINDTEXTEX, flags, (LPARAM)&ft);
|
||||
if (ft.chrg.cpMin != -1)
|
||||
SendDlgItemMessage(hwndDlg, IDC_LOGWIN, EM_SETSEL, ft.chrgText.cpMin, ft.chrgText.cpMax);
|
||||
else MessageBeep(MB_ICONASTERISK);
|
||||
}
|
||||
if (lpfr->Flags & FR_DIALOGTERM) hwndFind = 0;
|
||||
return TRUE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,13 +27,14 @@
|
|||
#define IDM_EDITSCRIPT 40003
|
||||
#define IDM_DOCS 40004
|
||||
#define IDM_LOADSCRIPT 40005
|
||||
#define IDM_FIND 40006
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 111
|
||||
#define _APS_NEXT_COMMAND_VALUE 40006
|
||||
#define _APS_NEXT_COMMAND_VALUE 40007
|
||||
#define _APS_NEXT_CONTROL_VALUE 1009
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
|
|
|
@ -79,6 +79,8 @@ BEGIN
|
|||
MENUITEM SEPARATOR
|
||||
MENUITEM "Copy &All", IDM_COPY
|
||||
MENUITEM "Copy &Selected", IDM_COPYSELECTED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Find...\tCtrl+F", IDM_FIND
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
|
@ -98,6 +100,7 @@ END
|
|||
IDK_ACCEL ACCELERATORS PRELOAD MOVEABLE PURE
|
||||
BEGIN
|
||||
"E", IDM_EDITSCRIPT, VIRTKEY, CONTROL, NOINVERT
|
||||
"F", IDM_FIND, VIRTKEY, CONTROL, NOINVERT
|
||||
"R", IDM_RECOMPILE, VIRTKEY, CONTROL, NOINVERT
|
||||
"T", IDM_TEST, VIRTKEY, CONTROL, NOINVERT
|
||||
"X", IDM_EXIT, VIRTKEY, CONTROL, NOINVERT
|
||||
|
@ -117,7 +120,8 @@ MENU IDM_MENU
|
|||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "",IDC_LOGWIN,"RICHEDIT",ES_MULTILINE | ES_AUTOVSCROLL |
|
||||
ES_READONLY | WS_BORDER | WS_VSCROLL,7,4,345,186
|
||||
ES_NOHIDESEL | ES_READONLY | WS_BORDER | WS_VSCROLL,7,4,
|
||||
345,186
|
||||
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,202,346,1
|
||||
LTEXT "",IDC_VERSION,7,212,200,12,WS_DISABLED
|
||||
DEFPUSHBUTTON "Clo&se",IDC_CLOSE,303,209,49,14
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue