diff --git a/Contrib/InstallOptions/InstallerOptions.cpp b/Contrib/InstallOptions/InstallerOptions.cpp index 2f78f78e..35744a99 100644 --- a/Contrib/InstallOptions/InstallerOptions.cpp +++ b/Contrib/InstallOptions/InstallerOptions.cpp @@ -636,7 +636,10 @@ BOOL CALLBACK cfgDlgProc(HWND hwndDlg, { HANDLE_MSG(hwndDlg, WM_COMMAND, WMCommandProc); case WM_CTLCOLORSTATIC: + case WM_CTLCOLOREDIT: case WM_CTLCOLORDLG: + case WM_CTLCOLORBTN: + case WM_CTLCOLORLISTBOX: SetBkMode((HDC)wParam, TRANSPARENT); return (BOOL)GetWindowLong((HWND)lParam, GWL_USERDATA); } diff --git a/Contrib/Modern UI/System.nsh b/Contrib/Modern UI/System.nsh index 771e4d29..09c436b9 100644 --- a/Contrib/Modern UI/System.nsh +++ b/Contrib/Modern UI/System.nsh @@ -337,22 +337,22 @@ GetDlgItem ${MUI_TEMP1} $HWNDPARENT 1037 CreateFont ${MUI_TEMP2} "${MUI_FONT_HEADER}" "${MUI_FONTSIZE_HEADER}" "${MUI_FONTSTYLE_HEADER}" SendMessage ${MUI_TEMP1} ${WM_SETFONT} ${MUI_TEMP2} 0 - SetStaticBkColor ${MUI_TEMP1} "${MUI_BGCOLOR}" + SetBkColor ${MUI_TEMP1} "${MUI_BGCOLOR}" GetDlgItem ${MUI_TEMP1} $HWNDPARENT 1038 - SetStaticBkColor ${MUI_TEMP1} "${MUI_BGCOLOR}" + SetBkColor ${MUI_TEMP1} "${MUI_BGCOLOR}" GetDlgItem ${MUI_TEMP1} $HWNDPARENT 1034 - SetStaticBkColor ${MUI_TEMP1} "${MUI_BGCOLOR}" + SetBkColor ${MUI_TEMP1} "${MUI_BGCOLOR}" GetDlgItem ${MUI_TEMP1} $HWNDPARENT 1039 - SetStaticBkColor ${MUI_TEMP1} "${MUI_BGCOLOR}" + SetBkColor ${MUI_TEMP1} "${MUI_BGCOLOR}" GetDlgItem ${MUI_TEMP1} $HWNDPARENT 1028 - SetStaticBkColor ${MUI_TEMP1} -1 + SetBkColor ${MUI_TEMP1} -1 GetWindowText ${MUI_TEMP2} ${MUI_TEMP1} GetDlgItem ${MUI_TEMP1} $HWNDPARENT 1256 - SetStaticBkColor ${MUI_TEMP1} -1 + SetBkColor ${MUI_TEMP1} -1 SendMessage ${MUI_TEMP1} ${WM_SETTEXT} ${NSIS_MAX_STRLEN} "STR:${MUI_TEMP2}" Pop ${MUI_TEMP2} @@ -941,15 +941,15 @@ Pop ${MUI_TEMP1} - SetStaticBkColor ${MUI_TEMP1} "${MUI_BGCOLOR}" + SetBkColor ${MUI_TEMP1} "${MUI_BGCOLOR}" GetDlgItem ${MUI_TEMP2} ${MUI_TEMP1} 1201 - SetStaticBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" + SetBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" CreateFont ${MUI_TEMP3} "${MUI_FONT_TITLE}" "${MUI_FONTSIZE_TITLE}" "${MUI_FONTSTYLE_TITLE}" SendMessage ${MUI_TEMP2} ${WM_SETFONT} ${MUI_TEMP3} 0 GetDlgItem ${MUI_TEMP2} ${MUI_TEMP1} 1202 - SetStaticBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" + SetBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" !ifdef MUI_CUSTOMFUNCTION_WELCOME_SHOW Call "${MUI_CUSTOMFUNCTION_WELCOME_SHOW}" @@ -1289,25 +1289,25 @@ Pop ${MUI_TEMP1} - SetStaticBkColor ${MUI_TEMP1} "${MUI_BGCOLOR}" + SetBkColor ${MUI_TEMP1} "${MUI_BGCOLOR}" GetDlgItem ${MUI_TEMP2} ${MUI_TEMP1} 1201 - SetStaticBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" + SetBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" CreateFont ${MUI_TEMP3} "${MUI_FONT_TITLE}" "${MUI_FONTSIZE_TITLE}" "${MUI_FONTSTYLE_TITLE}" SendMessage ${MUI_TEMP2} ${WM_SETFONT} ${MUI_TEMP3} 0 GetDlgItem ${MUI_TEMP2} ${MUI_TEMP1} 1202 - SetStaticBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" + SetBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" !ifndef MUI_FINISHPAGE_NOREBOOTSUPPORT IfRebootFlag "" noreboot_show GetDlgItem ${MUI_TEMP2} ${MUI_TEMP1} 1203 - SetStaticBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" + SetBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" GetDlgItem ${MUI_TEMP2} ${MUI_TEMP1} 1204 - SetStaticBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" + SetBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" Goto show @@ -1318,19 +1318,19 @@ !ifdef MUI_FINISHPAGE_RUN GetDlgItem ${MUI_TEMP2} ${MUI_TEMP1} 1203 - SetStaticBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" + SetBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" !ifdef MUI_FINISHPAGE_SHOWREADME GetDlgItem ${MUI_TEMP2} ${MUI_TEMP1} 1204 - SetStaticBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" + SetBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" !endif !else ifdef MUI_FINISHPAGE_SHOWREADME GetDlgItem ${MUI_TEMP2} ${MUI_TEMP1} 1203 - SetStaticBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" + SetBkColor ${MUI_TEMP2} "${MUI_BGCOLOR}" !endif diff --git a/Docs/src/callback.but b/Docs/src/callback.but index 70d67c02..dae97118 100644 --- a/Docs/src/callback.but +++ b/Docs/src/callback.but @@ -17,7 +17,7 @@ Example: \c GetDlgItem $R0 $HWNDPARENT 1028 \c CreateFont $R1 "Tahoma" 10 700 \c SendMessage $R0 ${WM_SETFONT} $R1 0 -\c SetStaticBkColor $R0 0x00FFFFFF +\c SetBkColor $R0 0x00FFFFFF \c FunctionEnd \S3{oninit} .onInit diff --git a/Docs/src/pages.but b/Docs/src/pages.but index a0a1452e..3a10787c 100644 --- a/Docs/src/pages.but +++ b/Docs/src/pages.but @@ -21,7 +21,7 @@ If you don't use any Page command the installer pages order will be just as in o \S{pagecallbacks} Callbacks -Each built-in page has three callback functions. The pre-function, the show-creation function and the leave-function. The pre-function is called right before the page is created, the show-function is called right after it is created and before it is shown so you can tweak its user interface with \R{createfont}{CreateFont}, \R{setstaticbkcolor}{SetStaticBkColor } and \R{sendmessage}{SendMessage}; the leave-function is called right after the user has pressed the next button and before the page is left. +Each built-in page has three callback functions. The pre-function, the show-creation function and the leave-function. The pre-function is called right before the page is created, the show-function is called right after it is created and before it is shown so you can tweak its user interface with \R{createfont}{CreateFont}, \R{setbkcolor}{SetBkColor } and \R{sendmessage}{SendMessage}; the leave-function is called right after the user has pressed the next button and before the page is left. A custom page has only two callback functions, one that creates it which is mandatory, and one leave-function that acts just like the leave-function for built-in pages. diff --git a/Docs/src/ui.but b/Docs/src/ui.but index 9238ab84..bc6d0a57 100644 --- a/Docs/src/ui.but +++ b/Docs/src/ui.but @@ -80,17 +80,11 @@ Shows or hides the details, depending on which parameter you pass. Overrides the Sets mode at which commands print their status. None has commands be quiet, listonly has status text only added to the listbox, textonly has status text only printed to the status bar, and both enables both (the default). For extracting many small files, textonly is recommended (especially on win9x with smooth scrolling enabled). -\S2{setstaticbkcolor} SetStaticBkColor +\S2{setbkcolor} SetBkColor \c hwnd color -Sets a background color for a static control. Use GetDlgItem to get the handle (HWND) of the static control. - -\S2{setwindowlong} SetWindowLong - -\c hwnd index new_long - -Same as \W{http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/windowclasses/windowclassreference/windowclassfunctions/setwindowlong.asp}{Windows SetWindowLong}. +Sets a background color for a static control, edit control, button or a dialog. Use GetDlgItem to get the handle (HWND) of the control. \e{Do not} use this on branding image controls! \S2{showwindow} ShowWindow diff --git a/Plugins/InstallOptions.dll b/Plugins/InstallOptions.dll index fa20a9ed..35cb998a 100644 Binary files a/Plugins/InstallOptions.dll and b/Plugins/InstallOptions.dll differ diff --git a/Source/build.cpp b/Source/build.cpp index ddb17fa9..30eaec28 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -987,7 +987,7 @@ int CEXEBuild::resolve_instruction(const char *fn, const char *str, entry *w, in } #endif #ifdef NSIS_SUPPORT_INTOPTS - else if (w->which == EW_INTCMP || w->which == EW_INTCMPU) + else if (w->which == EW_INTCMP) { if (resolve_jump_int(fn,&w->offsets[2],offs,start,end)) return 1; if (resolve_jump_int(fn,&w->offsets[3],offs,start,end)) return 1; diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index b492e124..6fc4fb4d 100644 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -129,16 +129,22 @@ static BOOL NSISCALL SetDlgItemTextFromLang_(HWND dlg, int id, int lid) { #ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT #define HandleStaticBkColor() _HandleStaticBkColor(uMsg, wParam, lParam) static BOOL NSISCALL _HandleStaticBkColor(UINT uMsg, WPARAM wParam, LPARAM lParam) { - if (uMsg == WM_CTLCOLORSTATIC) { - BOOL brush = (BOOL)GetWindowLong((HWND)lParam, GWL_USERDATA); - if (brush == -1) { - COLORREF dlgColor = GetSysColor(COLOR_BTNFACE); - SetBkColor((HDC)wParam, dlgColor); - SetTextColor((HDC)wParam, dlgColor); - return (BOOL)GetStockObject(NULL_BRUSH); + switch (uMsg) { + case WM_CTLCOLORSTATIC: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORDLG: + case WM_CTLCOLORBTN: + { + BOOL brush = (BOOL)GetWindowLong((HWND)lParam, GWL_USERDATA); + if (brush == -1) { + COLORREF dlgColor = GetSysColor(COLOR_BTNFACE); + SetBkColor((HDC)wParam, dlgColor); + SetTextColor((HDC)wParam, dlgColor); + return (BOOL)GetStockObject(NULL_BRUSH); + } + SetBkMode((HDC)wParam, TRANSPARENT); + return brush; } - SetBkMode((HDC)wParam, TRANSPARENT); - return (BOOL)GetWindowLong((HWND)lParam, GWL_USERDATA); } return 0; } diff --git a/Source/exehead/config.h b/Source/exehead/config.h index 89ee0ea6..2171ba82 100644 --- a/Source/exehead/config.h +++ b/Source/exehead/config.h @@ -55,13 +55,9 @@ #define NSIS_CONFIG_VISIBLE_SUPPORT // NSIS_CONFIG_ENHANCEDUI_SUPPORT enables support for CreateFont, -// SetStaticBkColor (used by some UIs), SetBrandingImage, .onInitDialog, etc +// SetBkColor (used by some UIs), SetBrandingImage, .onInitDialog, etc #define NSIS_CONFIG_ENHANCEDUI_SUPPORT - -// Changed by Amir Szekely 31st July 2002 -// Now supports runtime choice of compression method - // NSIS_CONFIG_COMPRESSION_SUPPORT enables support for making installers // that use compression (recommended). #define NSIS_CONFIG_COMPRESSION_SUPPORT diff --git a/Source/exehead/exec.c b/Source/exehead/exec.c index a90cec84..bbac021d 100644 --- a/Source/exehead/exec.c +++ b/Source/exehead/exec.c @@ -607,17 +607,16 @@ static int NSISCALL ExecuteEntry(entry *entry_) int v,v2; v=process_string_fromparm_toint(0); v2=process_string_fromparm_toint(1); - if (vv2) return parm4; - } - return parm2; - case EW_INTCMPU: - { - unsigned int v,v2; - v=(unsigned int)process_string_fromparm_toint(0); - v2=(unsigned int)process_string_fromparm_toint(1); - if (vv2) return parm4; + if (!parm5) { + // signed + if (vv2) return parm4; + } + else { + // unsigned + if ((unsigned int)v<(unsigned int)v2) return parm3; + if ((unsigned int)v>(unsigned int)v2) return parm4; + } } return parm2; case EW_INTOP: @@ -746,7 +745,7 @@ static int NSISCALL ExecuteEntry(entry *entry_) NSIS_MAX_STRLEN ); return 0; - case EW_SETSTATICBKCOLOR: + case EW_SETBKCOLOR: DeleteObject( (HGDIOBJ)SetWindowLong( (HWND)process_string_fromparm_toint(0), @@ -769,7 +768,7 @@ static int NSISCALL ExecuteEntry(entry *entry_) parm2?r.bottom-r.top:0, LR_LOADFROMFILE ); - DeleteObject((HGDIOBJ)SetWindowLong(hwImage,DWL_USER,(LONG)hImage)); + DeleteObject((HGDIOBJ)SetWindowLong(hwImage,GWL_USERDATA,(LONG)hImage)); SendMessage( hwImage, STM_SETIMAGE, diff --git a/Source/exehead/fileform.h b/Source/exehead/fileform.h index 0e5d7fbd..987b646f 100644 --- a/Source/exehead/fileform.h +++ b/Source/exehead/fileform.h @@ -77,8 +77,7 @@ enum EW_READENVSTR, // ReadEnvStr/ExpandEnvStrings: 3 [output, string_with_env_variables, IsRead] #endif #ifdef NSIS_SUPPORT_INTOPTS - EW_INTCMP, // IntCmp: 5 [val1, val2, equal, val1val2] - EW_INTCMPU, // IntCmpU: 5 [val1, val2, equal, val1val2] + EW_INTCMP, // IntCmp: 6 [val1, val2, equal, val1val2, unsigned?] EW_INTOP, // IntOp: 4 [output, input1, input2, op] where op: 0=add, 1=sub, 2=mul, 3=div, 4=bor, 5=band, 6=bxor, 7=bnot input1, 8=lnot input1, 9=lor, 10=land], 11=1%2 EW_INTFMT, // IntFmt: [output, format, input] #endif @@ -94,7 +93,7 @@ enum #ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT EW_GETDLGITEM, // GetDlgItem: 3: [outputvar, dialog, item_id] EW_GETWINTEXT, // GetWindowText: 2: [outputvar, hwnd] - EW_SETSTATICBKCOLOR, // SerStaticBkColor: 3: [hwnd, color] + EW_SETBKCOLOR, // SerBkColor: 2: [hwnd, color] EW_SETBRANDINGIMAGE, // SetBrandingImage: 1: [Bitmap file] EW_CREATEFONT, // CreateFont: 5: [handle output, face name, height, weight, flags] EW_SHOWWINDOW, // ShowWindow: 2: [hwnd, show state] diff --git a/Source/script.cpp b/Source/script.cpp index a9262330..820cef74 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -2774,11 +2774,11 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char ent.offsets[1]=add_string(line.gettoken_str(2)); SCRIPT_MSG("GetWindowText: output=%s hwnd=%s\n",line.gettoken_str(1),line.gettoken_str(2)); return add_entry(&ent); - case TOK_SETSTATICBKCOLOR: - ent.which=EW_SETSTATICBKCOLOR; + case TOK_SETBKCOLOR: + ent.which=EW_SETBKCOLOR; ent.offsets[0]=add_string(line.gettoken_str(1)); ent.offsets[1]=line.gettoken_int(2); - SCRIPT_MSG("SetStaticBkColor: handle=%s color=%s\n",line.gettoken_str(1),line.gettoken_str(2)); + SCRIPT_MSG("SetBkColor: handle=%s color=%s\n",line.gettoken_str(1),line.gettoken_str(2)); return add_entry(&ent); case TOK_CREATEFONT: ent.which=EW_CREATEFONT; @@ -2845,7 +2845,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char return add_entry(&ent); #else//NSIS_CONFIG_ENHANCEDUI_SUPPORT case TOK_GETDLGITEM: - case TOK_SETSTATICBKCOLOR: + case TOK_SETBKCOLOR: case TOK_SHOWWINDOW: case TOK_CREATEFONT: case TOK_HIDEWINDOW: @@ -2857,7 +2857,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char case TOK_SENDMESSAGE: case TOK_FINDWINDOW: case TOK_GETDLGITEM: - case TOK_SETSTATICBKCOLOR: + case TOK_SETBKCOLOR: case TOK_SHOWWINDOW: case TOK_CREATEFONT: case TOK_HIDEWINDOW: @@ -3465,9 +3465,10 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char return add_entry(&ent); case TOK_INTCMP: case TOK_INTCMPU: - ent.which=(which_token == TOK_INTCMP) ? EW_INTCMP : EW_INTCMPU; + ent.which=EW_INTCMP; ent.offsets[0]=add_string(line.gettoken_str(1)); ent.offsets[1]=add_string(line.gettoken_str(2)); + ent.offsets[5]=which_token == TOK_INTCMPU; if (process_jump(line,3,&ent.offsets[2]) || process_jump(line,4,&ent.offsets[3]) || process_jump(line,5,&ent.offsets[4])) PRINTHELP() diff --git a/Source/tokens.cpp b/Source/tokens.cpp index 58ba8082..bbf58fcb 100644 --- a/Source/tokens.cpp +++ b/Source/tokens.cpp @@ -138,6 +138,7 @@ static tokenType tokenlist[TOK__LAST] = {TOK_SECTIONIN,"SectionIn",1,-1,"InstTypeIdx [InstTypeIdx [...]]"}, {TOK_SENDMESSAGE,"SendMessage",4,2,"hwnd message [wparam|STR:wParam] [lparam|STR:lParam] [$(user_var: return value)] [/TIMEOUT=X]"}, {TOK_SETAUTOCLOSE,"SetAutoClose",1,0,"(false|true)"}, +{TOK_SETBKCOLOR,"SetBkColor",2,0,"hwnd color"}, {TOK_SETBRANDINGIMAGE,"SetBrandingImage",1,2,"[/IMGID=image_item_id_in_dialog] [/RESIZETOFIT] bitmap.bmp"}, {TOK_SETCOMPRESS,"SetCompress",1,0,"(off|auto|force)"}, {TOK_SETCOMPRESSOR,"SetCompressor",1,0,"(zlib|bzip2)"}, @@ -152,8 +153,6 @@ static tokenType tokenlist[TOK__LAST] = {TOK_SETPLUGINUNLOAD,"SetPluginUnload",1,0,"(manual|alwaysoff)"}, {TOK_SETREBOOTFLAG,"SetRebootFlag",1,0,"true|false"}, {TOK_SETSHELLVARCONTEXT,"SetShellVarContext",1,0,"all|current"}, -{TOK_SETSTATICBKCOLOR,"SetStaticBkColor",2,0,"hwnd color"}, -{TOK_SETWINDOWLONG,"SetWindowLong",3,0,"hwnd index new_long"}, {TOK_SHOWDETAILS,"ShowInstDetails",1,0,"(hide|show|nevershow)"}, {TOK_SHOWDETAILSUNINST,"ShowUninstDetails",1,0,"(hide|show|nevershow)"}, {TOK_SHOWWINDOW,"ShowWindow",2,0,"hwnd show_state"}, diff --git a/Source/tokens.h b/Source/tokens.h index ba977049..c2601908 100644 --- a/Source/tokens.h +++ b/Source/tokens.h @@ -174,8 +174,7 @@ enum TOK_ISWINDOW, TOK_GETDLGITEM, TOK_GETWINTEXT, - TOK_SETSTATICBKCOLOR, - TOK_SETWINDOWLONG, + TOK_SETBKCOLOR, TOK_FINDFIRST, TOK_FINDNEXT, TOK_FINDCLOSE, diff --git a/TODO.txt b/TODO.txt index e96eaf52..b7fa53c9 100644 --- a/TODO.txt +++ b/TODO.txt @@ -4,8 +4,12 @@ TODO NSIS +* MB and friends translatable + * skip plugin calls, file instructions that add more than one file with +1 with goto +* add version numbers for the installer + * move more ui changes to compile time. inst details could be changed in compile time too