Added Select All

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@977 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
rainwater 2002-09-10 19:11:03 +00:00
parent 4d6e00a745
commit 3e86ebe7ad
4 changed files with 48 additions and 38 deletions

View file

@ -59,7 +59,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char *cmdParam, int cmd
MSG msg;
int status;
while ((status=GetMessage(&msg,0,0,0))!=0) {
if (status==-1) return -1;
if (status==-1) return -1;
if (!IsDialogMessage(hwndFind, &msg)) {
if (!TranslateAccelerator(hDialog,haccel,&msg)) {
if (!IsDialogMessage(hDialog,&msg)) {
@ -181,6 +181,11 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
ShellExecute(g_hwnd,"open",NSIS_URL,NULL,NULL,SW_SHOWNORMAL);
return TRUE;
}
case IDM_SELECTALL:
{
SendDlgItemMessage(g_hwnd, IDC_LOGWIN, EM_SETSEL, 0, -1);
return TRUE;
}
case IDM_DOCS:
{
char pathf[MAX_PATH],*path;
@ -288,44 +293,43 @@ 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;
}
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;
}
}
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;
}