Buttons from focused license text fixed (return will not work if next button not enabled and escape will work as cancel)

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2391 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-03-29 13:39:48 +00:00
parent 68c97de740
commit 34e75bfd21
4 changed files with 28 additions and 18 deletions

View file

@ -220,7 +220,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
{ {
if (hwnd) if (hwnd)
{ {
static MSG msg; MSG msg;
while (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) DispatchMessage(&msg); while (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) DispatchMessage(&msg);
} }
else if (GetTickCount() > verify_time) else if (GetTickCount() > verify_time)

View file

@ -674,7 +674,7 @@ DWORD CALLBACK StreamLicense(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
static HWND hwLicense; HWND hwLicense;
static unsigned int uLastAcceptState; static unsigned int uLastAcceptState;
if (uMsg == WM_INITDIALOG) if (uMsg == WM_INITDIALOG)
{ {
@ -701,23 +701,29 @@ static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
} }
if (uMsg == WM_COMMAND && HIWORD(wParam) == BN_CLICKED) { if (uMsg == WM_COMMAND && HIWORD(wParam) == BN_CLICKED) {
if (inst_flags&CH_FLAGS_LICENSE_FORCE_SELECTION) if (inst_flags&CH_FLAGS_LICENSE_FORCE_SELECTION)
EnableWindow(m_hwndOK, uLastAcceptState = IsDlgButtonChecked(hwndDlg, IDC_LICENSEAGREE) & BST_CHECKED); EnableWindow(
m_hwndOK,
uLastAcceptState = SendMessage(GetUIItem(IDC_LICENSEAGREE), BM_GETCHECK, 0, 0) & BST_CHECKED
);
} }
if (uMsg == WM_NOTIFY) { if (uMsg == WM_NOTIFY) {
hwLicense=GetUIItem(IDC_EDIT1);
#define nmhdr ((NMHDR *)lParam) #define nmhdr ((NMHDR *)lParam)
#define enlink ((ENLINK *)lParam) #define enlink ((ENLINK *)lParam)
#define msgfilter ((MSGFILTER *)lParam) #define msgfilter ((MSGFILTER *)lParam)
if (nmhdr->code==EN_LINK) { if (nmhdr->code==EN_LINK) {
if (enlink->msg==WM_LBUTTONDOWN) { if (enlink->msg==WM_LBUTTONDOWN) {
char *szUrl; TEXTRANGE tr = {
long min=enlink->chrg.cpMin, max=enlink->chrg.cpMax; enlink->chrg.cpMin,
SendMessage(hwLicense,EM_SETSEL,min,max); enlink->chrg.cpMax,
szUrl=(char *)my_GlobalAlloc(max-min+1); ps_tmpbuf
SendMessage(hwLicense,EM_GETSELTEXT,0,(LPARAM)szUrl); };
SetCursor(LoadCursor(0,IDC_WAIT)); if (tr.chrg.cpMax-tr.chrg.cpMin < sizeof(ps_tmpbuf)) {
ShellExecute(hwndDlg,"open",szUrl,NULL,NULL,SW_SHOWNORMAL); SendMessage(hwLicense,EM_GETTEXTRANGE,0,(LPARAM)&tr);
SetCursor(LoadCursor(0,IDC_ARROW)); SetCursor(LoadCursor(0,IDC_WAIT));
GlobalFree(szUrl); ShellExecute(hwndDlg,"open",ps_tmpbuf,NULL,NULL,SW_SHOWNORMAL);
SetCursor(LoadCursor(0,IDC_ARROW));
}
} }
if (enlink->msg==WM_SETCURSOR) { if (enlink->msg==WM_SETCURSOR) {
#ifndef IDC_HAND #ifndef IDC_HAND
@ -733,10 +739,14 @@ static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
//rich edit control should NOT process this message, hence the return 1. //rich edit control should NOT process this message, hence the return 1.
if (nmhdr->code==EN_MSGFILTER) if (nmhdr->code==EN_MSGFILTER)
{ {
if (msgfilter->msg==WM_KEYDOWN && if (msgfilter->msg==WM_KEYDOWN)
msgfilter->wParam==VK_RETURN)
{ {
outernotify(1); if (msgfilter->wParam==VK_RETURN && IsWindowEnabled(m_hwndOK)) {
outernotify(1);
}
if (msgfilter->wParam==VK_ESCAPE) {
SendMessage(g_hwnd, WM_CLOSE, 0, 0);
}
return 1; return 1;
} }
} }

View file

@ -839,7 +839,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
DWORD lExitCode; DWORD lExitCode;
while (WaitForSingleObject(hProc,100) == WAIT_TIMEOUT) while (WaitForSingleObject(hProc,100) == WAIT_TIMEOUT)
{ {
static MSG msg; MSG msg;
while (PeekMessage(&msg,NULL,WM_PAINT,WM_PAINT,PM_REMOVE)) while (PeekMessage(&msg,NULL,WM_PAINT,WM_PAINT,PM_REMOVE))
DispatchMessage(&msg); DispatchMessage(&msg);
} }
@ -1129,7 +1129,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
return 0; return 0;
case EW_READINISTR: case EW_READINISTR:
{ {
static const char *errstr="!N~"; const char *errstr="!N~";
char *p=var0; char *p=var0;
char *buf0=process_string_fromparm_tobuf(0x01); char *buf0=process_string_fromparm_tobuf(0x01);
char *buf1=process_string_fromparm_tobuf(0x12); char *buf1=process_string_fromparm_tobuf(0x12);

View file

@ -262,7 +262,7 @@ static int NSISCALL __ensuredata(int amount)
#endif #endif
{ {
if (hwnd) { if (hwnd) {
static MSG msg; MSG msg;
m_pos=m_length-(amount-(dbd_size-dbd_pos)); m_pos=m_length-(amount-(dbd_size-dbd_pos));
while (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) DispatchMessage(&msg); while (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) DispatchMessage(&msg);
} }