Don't create more than one brush per SetStaticBkColor - saved about 50 bytes. Still problems with BrandingText width, working on it
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2054 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
aa369c899c
commit
ac449dae62
4 changed files with 8 additions and 28 deletions
|
@ -126,14 +126,7 @@ static BOOL NSISCALL SetDlgItemTextFromLang_(HWND dlg, int id, int lid) {
|
||||||
#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT
|
#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT
|
||||||
#define HandleStaticBkColor() _HandleStaticBkColor(uMsg, lParam)
|
#define HandleStaticBkColor() _HandleStaticBkColor(uMsg, lParam)
|
||||||
static BOOL NSISCALL _HandleStaticBkColor(UINT uMsg, LPARAM lParam) {
|
static BOOL NSISCALL _HandleStaticBkColor(UINT uMsg, LPARAM lParam) {
|
||||||
if (uMsg == WM_CTLCOLORSTATIC) {
|
if (uMsg == WM_CTLCOLORSTATIC) return (BOOL)GetWindowLong((HWND)lParam, GWL_USERDATA);
|
||||||
COLORREF color = GetWindowLong((HWND)lParam, GWL_USERDATA);
|
|
||||||
if (color) {
|
|
||||||
LOGBRUSH b={BS_SOLID, color-1, 0};
|
|
||||||
SetBkColor(GetDC((HWND)lParam), b.lbColor);
|
|
||||||
return (BOOL)CreateBrushIndirect(&b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -762,11 +762,11 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return 0;
|
return 0;
|
||||||
case EW_SETWINDOWLONG:
|
case EW_SETSTATICBKCOLOR:
|
||||||
SetWindowLong(
|
SetWindowLong(
|
||||||
(HWND)process_string_fromparm_toint(0),
|
(HWND)process_string_fromparm_toint(0),
|
||||||
process_string_fromparm_toint(1),
|
GWL_USERDATA,
|
||||||
process_string_fromparm_toint(2)
|
(LONG)CreateSolidBrush(parm1)
|
||||||
);
|
);
|
||||||
return 0;
|
return 0;
|
||||||
case EW_SETBRANDINGIMAGE:
|
case EW_SETBRANDINGIMAGE:
|
||||||
|
|
|
@ -93,8 +93,8 @@ enum
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT
|
#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT
|
||||||
EW_GETDLGITEM, // GetDlgItem: 3 [outputvar, dialog, item_id]
|
EW_GETDLGITEM, // GetDlgItem: 3 [outputvar, dialog, item_id]
|
||||||
EW_SETWINDOWLONG, // SetWindowLong (used by StaticBkColor): 3 [hwnd, which(numeric), value]
|
EW_SETSTATICBKCOLOR, // SerStaticBkColor: 3 [hwnd, color]
|
||||||
EW_SETBRANDINGIMAGE, // SetBrandingImage: 1: [Bitmap file]
|
EW_SETBRANDINGIMAGE, // SetBrandingImage: 1: [Bitmap file]
|
||||||
EW_CREATEFONT, // CreateFont: 5: [handle output, face name, height, weight, flags]
|
EW_CREATEFONT, // CreateFont: 5: [handle output, face name, height, weight, flags]
|
||||||
EW_SHOWWINDOW, // ShowWindow: 2: [hwnd, show state]
|
EW_SHOWWINDOW, // ShowWindow: 2: [hwnd, show state]
|
||||||
|
|
|
@ -2583,22 +2583,11 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
||||||
SCRIPT_MSG("GetDlgItem: output=%s dialog=%s item=%s\n",line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3));
|
SCRIPT_MSG("GetDlgItem: output=%s dialog=%s item=%s\n",line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3));
|
||||||
return add_entry(&ent);
|
return add_entry(&ent);
|
||||||
case TOK_SETSTATICBKCOLOR:
|
case TOK_SETSTATICBKCOLOR:
|
||||||
ent.which=EW_SETWINDOWLONG;
|
ent.which=EW_SETSTATICBKCOLOR;
|
||||||
ent.offsets[0]=add_string(line.gettoken_str(1));
|
ent.offsets[0]=add_string(line.gettoken_str(1));
|
||||||
char temp[64];
|
ent.offsets[1]=line.gettoken_int(2);
|
||||||
wsprintf(temp, "%d", GWL_USERDATA);
|
|
||||||
ent.offsets[1]=add_string(temp);
|
|
||||||
wsprintf(temp, "%d", line.gettoken_int(2)+1);
|
|
||||||
ent.offsets[2]=add_string(temp);
|
|
||||||
SCRIPT_MSG("SetStaticBkColor: handle=%s color=%s\n",line.gettoken_str(1),line.gettoken_str(2));
|
SCRIPT_MSG("SetStaticBkColor: handle=%s color=%s\n",line.gettoken_str(1),line.gettoken_str(2));
|
||||||
return add_entry(&ent);
|
return add_entry(&ent);
|
||||||
case TOK_SETWINDOWLONG:
|
|
||||||
ent.which=EW_SETWINDOWLONG;
|
|
||||||
ent.offsets[0]=add_string(line.gettoken_str(1));
|
|
||||||
ent.offsets[1]=add_string(line.gettoken_str(2));
|
|
||||||
ent.offsets[2]=add_string(line.gettoken_str(3));
|
|
||||||
SCRIPT_MSG("SetWindowLong: handle=%s index=%s new long=%s\n",line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3));
|
|
||||||
return add_entry(&ent);
|
|
||||||
case TOK_CREATEFONT:
|
case TOK_CREATEFONT:
|
||||||
ent.which=EW_CREATEFONT;
|
ent.which=EW_CREATEFONT;
|
||||||
ent.offsets[0]=line.gettoken_enum(1,usrvars);
|
ent.offsets[0]=line.gettoken_enum(1,usrvars);
|
||||||
|
@ -2658,7 +2647,6 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
||||||
#else//NSIS_CONFIG_ENHANCEDUI_SUPPORT
|
#else//NSIS_CONFIG_ENHANCEDUI_SUPPORT
|
||||||
case TOK_GETDLGITEM:
|
case TOK_GETDLGITEM:
|
||||||
case TOK_SETSTATICBKCOLOR:
|
case TOK_SETSTATICBKCOLOR:
|
||||||
case TOK_SETWINDOWLONG:
|
|
||||||
case TOK_SHOWWINDOW:
|
case TOK_SHOWWINDOW:
|
||||||
case TOK_CREATEFONT:
|
case TOK_CREATEFONT:
|
||||||
ERROR_MSG("Error: %s specified, NSIS_CONFIG_ENHANCEDUI_SUPPORT not defined.\n", line.gettoken_str(0));
|
ERROR_MSG("Error: %s specified, NSIS_CONFIG_ENHANCEDUI_SUPPORT not defined.\n", line.gettoken_str(0));
|
||||||
|
@ -2670,7 +2658,6 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
||||||
case TOK_FINDWINDOW:
|
case TOK_FINDWINDOW:
|
||||||
case TOK_GETDLGITEM:
|
case TOK_GETDLGITEM:
|
||||||
case TOK_SETSTATICBKCOLOR:
|
case TOK_SETSTATICBKCOLOR:
|
||||||
case TOK_SETWINDOWLONG:
|
|
||||||
case TOK_SHOWWINDOW:
|
case TOK_SHOWWINDOW:
|
||||||
case TOK_CREATEFONT:
|
case TOK_CREATEFONT:
|
||||||
ERROR_MSG("Error: %s specified, NSIS_SUPPORT_HWNDS not defined.\n", line.gettoken_str(0));
|
ERROR_MSG("Error: %s specified, NSIS_SUPPORT_HWNDS not defined.\n", line.gettoken_str(0));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue