diff --git a/Contrib/NSISdl/Script1.rc b/Contrib/NSISdl/Script1.rc index 1d43d167..0f6a3283 100644 --- a/Contrib/NSISdl/Script1.rc +++ b/Contrib/NSISdl/Script1.rc @@ -30,9 +30,11 @@ IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 265, 104 STYLE DS_CONTROL | WS_CHILD FONT 8, "MS Sans Serif" BEGIN - CONTROL "Progress1",IDC_PROGRESS1,"msctls_progress32",WS_BORDER, - 0,36,265,11 + CONTROL "Progress1",IDC_PROGRESS1,"msctls_progress32",NOT + WS_VISIBLE | WS_BORDER,0,36,265,11 CTEXT "",IDC_STATIC2,0,25,263,8 + CONTROL "Progress1",IDC_PROGRESS2,"msctls_progress32",PBS_SMOOTH | + NOT WS_VISIBLE | WS_BORDER,0,37,265,11 END diff --git a/Contrib/NSISdl/nsisdl.cpp b/Contrib/NSISdl/nsisdl.cpp index 1feb1eff..51c7af03 100644 --- a/Contrib/NSISdl/nsisdl.cpp +++ b/Contrib/NSISdl/nsisdl.cpp @@ -195,32 +195,54 @@ __declspec(dllexport) void download (HWND parent, DownloadDialogProc); if (dlg) { + int pbid = IDC_PROGRESS1; + HWND hwPb = GetDlgItem(childwnd, 1004); + + // Set progress bar style + if (GetWindowLong(hwPb, GWL_STYLE) & PBS_SMOOTH) + pbid = IDC_PROGRESS2; + + HWND pb = g_hwndProgressBar = GetDlgItem(dlg, pbid); + + long c; + + if (hwPb) + { + c = SendMessage(hwPb, PBM_SETBARCOLOR, 0, 0); + SendMessage(hwPb, PBM_SETBARCOLOR, 0, c); + SendMessage(pb, PBM_SETBARCOLOR, 0, c); + + c = SendMessage(hwPb, PBM_SETBKCOLOR, 0, 0); + SendMessage(hwPb, PBM_SETBKCOLOR, 0, c); + SendMessage(pb, PBM_SETBKCOLOR, 0, c); + } + + ShowWindow(pb, SW_SHOW); + GetWindowRect(dlg,&cr); ScreenToClient(dlg,(LPPOINT)&cr); ScreenToClient(dlg,((LPPOINT)&cr)+1); - GetWindowRect(GetDlgItem(childwnd,1016),&r); + GetWindowRect(hwndL,&r); ScreenToClient(childwnd,(LPPOINT)&r); ScreenToClient(childwnd,((LPPOINT)&r)+1); SetWindowPos(dlg,0,r.left,r.top,r.right-r.left,cr.bottom-cr.top,SWP_NOACTIVATE|SWP_NOZORDER); AdjustSize(IDC_STATIC2); - AdjustSize(IDC_PROGRESS1); + AdjustSize(pbid); ShowWindow(dlg,SW_SHOWNA); char *p=filename; while (*p) p++; while (*p != '\\' && p != filename) p=CharPrev(filename,p); wsprintf(buf,szDownloading, p!=filename?p+1:p); SetDlgItemText(childwnd,1006,buf); - SetDlgItemText (dlg, IDC_STATIC2, szConnecting); + SetDlgItemText(dlg, IDC_STATIC2, szConnecting); // set font long hFont = SendMessage(parent, WM_GETFONT, 0, 0); - SendDlgItemMessage(dlg, IDC_PROGRESS1, WM_SETFONT, hFont, 0); + SendDlgItemMessage(dlg, pbid, WM_SETFONT, hFont, 0); SendDlgItemMessage(dlg, IDC_STATIC2, WM_SETFONT, hFont, 0); } } - g_hwndProgressBar = GetDlgItem (dlg, IDC_PROGRESS1); - JNL_HTTPGet *get = 0; { @@ -427,5 +449,4 @@ __declspec(dllexport) void download_quiet(HWND parent, download(NULL,stringsize,variables,stacktop); } -} //extern "C" - +} //extern "C" \ No newline at end of file diff --git a/Contrib/NSISdl/resource.h b/Contrib/NSISdl/resource.h index a4e827f2..1446f54d 100644 --- a/Contrib/NSISdl/resource.h +++ b/Contrib/NSISdl/resource.h @@ -4,16 +4,17 @@ // #define IDD_DIALOG1 101 #define IDC_PROGRESS1 1001 -#define IDC_STATIC1 1002 -#define IDC_STATIC2 1003 +#define IDC_PROGRESS2 1002 +#define IDC_STATIC1 1003 +#define IDC_STATIC2 1004 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_RESOURCE_VALUE 102 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1004 +#define _APS_NEXT_CONTROL_VALUE 1005 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/Plugins/nsisdl.dll b/Plugins/nsisdl.dll index f222a520..2e61b1bc 100644 Binary files a/Plugins/nsisdl.dll and b/Plugins/nsisdl.dll differ diff --git a/Source/script.cpp b/Source/script.cpp index 5ef70cb3..9d46eb31 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -1197,7 +1197,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char free(dlg); } catch (exception& err) { - ERROR_MSG("Error setting smooth progress bar: %s\n", err.what()); + ERROR_MSG("Error in LicenseForceSelection: %s\n", err.what()); return PS_ERROR; } SCRIPT_MSG("LicenseForceSelection: %s \"%s\" \"%s\"\n", line.gettoken_str(1+a), line.gettoken_str(2+a), line.gettoken_str(3+a));