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:
kichik 2003-01-09 21:43:01 +00:00
parent aa369c899c
commit ac449dae62
4 changed files with 8 additions and 28 deletions

View file

@ -126,14 +126,7 @@ static BOOL NSISCALL SetDlgItemTextFromLang_(HWND dlg, int id, int lid) {
#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT
#define HandleStaticBkColor() _HandleStaticBkColor(uMsg, lParam)
static BOOL NSISCALL _HandleStaticBkColor(UINT uMsg, LPARAM lParam) {
if (uMsg == WM_CTLCOLORSTATIC) {
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);
}
}
if (uMsg == WM_CTLCOLORSTATIC) return (BOOL)GetWindowLong((HWND)lParam, GWL_USERDATA);
return 0;
}
#else

View file

@ -762,11 +762,11 @@ static int NSISCALL ExecuteEntry(entry *entry_)
)
);
return 0;
case EW_SETWINDOWLONG:
case EW_SETSTATICBKCOLOR:
SetWindowLong(
(HWND)process_string_fromparm_toint(0),
process_string_fromparm_toint(1),
process_string_fromparm_toint(2)
GWL_USERDATA,
(LONG)CreateSolidBrush(parm1)
);
return 0;
case EW_SETBRANDINGIMAGE:

View file

@ -93,8 +93,8 @@ enum
#endif
#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT
EW_GETDLGITEM, // GetDlgItem: 3 [outputvar, dialog, item_id]
EW_SETWINDOWLONG, // SetWindowLong (used by StaticBkColor): 3 [hwnd, which(numeric), value]
EW_GETDLGITEM, // GetDlgItem: 3 [outputvar, dialog, item_id]
EW_SETSTATICBKCOLOR, // SerStaticBkColor: 3 [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]