SetStaticBkColor -> SetBkColor, now works for dialogs, buttons, edit boxes and list boxes (only in IO)

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2347 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-03-20 20:49:13 +00:00
parent 2e9cb6d4e9
commit 03cafaf818
15 changed files with 68 additions and 68 deletions

View file

@ -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;

View file

@ -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;
}

View file

@ -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

View file

@ -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 (v<v2) return parm3;
if (v>v2) 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 (v<v2) return parm3;
if (v>v2) return parm4;
if (!parm5) {
// signed
if (v<v2) return parm3;
if (v>v2) 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,

View file

@ -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, val1<val2, val1>val2]
EW_INTCMPU, // IntCmpU: 5 [val1, val2, equal, val1<val2, val1>val2]
EW_INTCMP, // IntCmp: 6 [val1, val2, equal, val1<val2, val1>val2, 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]

View file

@ -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()

View file

@ -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"},

View file

@ -174,8 +174,7 @@ enum
TOK_ISWINDOW,
TOK_GETDLGITEM,
TOK_GETWINTEXT,
TOK_SETSTATICBKCOLOR,
TOK_SETWINDOWLONG,
TOK_SETBKCOLOR,
TOK_FINDFIRST,
TOK_FINDNEXT,
TOK_FINDCLOSE,