- BgImage improved a lot
- Added .onGUIEnd - Some optimizations git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2542 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
65806e3b4b
commit
26845a8b74
12 changed files with 724 additions and 193 deletions
|
@ -1252,6 +1252,7 @@ int CEXEBuild::write_output(void)
|
|||
if (resolve_call_int("uninstall callback","un.callbacks",ns_func.find("un.onUserAbort",0),&build_uninst.common.code_onUserAbort)) return PS_ERROR;
|
||||
#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT
|
||||
if (resolve_call_int("uninstall callback","un.callbacks",ns_func.find("un.onGUIInit",0),&build_uninst.common.code_onGUIInit)) return PS_ERROR;
|
||||
if (resolve_call_int("uninstall callback","un.callbacks",ns_func.find("un.onGUIEnd",0),&build_uninst.common.code_onGUIEnd)) return PS_ERROR;
|
||||
#endif
|
||||
#endif//NSIS_SUPPORT_CODECALLBACKS
|
||||
|
||||
|
@ -1275,6 +1276,7 @@ int CEXEBuild::write_output(void)
|
|||
if (resolve_call_int("install callback",".callbacks",ns_func.find(".onVerifyInstDir",0),&build_header.code_onVerifyInstDir)) return PS_ERROR;
|
||||
#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT
|
||||
if (resolve_call_int("install callback",".callbacks",ns_func.find(".onGUIInit",0),&build_header.common.code_onGUIInit)) return PS_ERROR;
|
||||
if (resolve_call_int("install callback",".callbacks",ns_func.find(".onGUIEnd",0),&build_header.common.code_onGUIEnd)) return PS_ERROR;
|
||||
if (resolve_call_int("install callback",".callbacks",ns_func.find(".onMouseOverSection",0),&build_header.code_onMouseOverSection)) return PS_ERROR;
|
||||
#endif
|
||||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||
|
|
|
@ -274,7 +274,6 @@ int NSISCALL ui_doinstall(void)
|
|||
if (inst_cmnheader->bg_color1 != -1)
|
||||
{
|
||||
RECT vp;
|
||||
extern int bg_color1, bg_color2, bg_textcolor;
|
||||
extern LRESULT CALLBACK BG_WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
wc.lpfnWndProc = BG_WndProc;
|
||||
wc.hInstance = g_hInstance;
|
||||
|
@ -284,10 +283,6 @@ int NSISCALL ui_doinstall(void)
|
|||
|
||||
if (!RegisterClass(&wc)) return 0;
|
||||
|
||||
bg_color1=inst_cmnheader->bg_color1;
|
||||
bg_color2=inst_cmnheader->bg_color2;
|
||||
bg_textcolor=inst_cmnheader->bg_textcolor;
|
||||
|
||||
SystemParametersInfo(SPI_GETWORKAREA, 0, &vp, 0);
|
||||
|
||||
m_bgwnd = CreateWindowEx(WS_EX_TOOLWINDOW,"_Nb",0,WS_POPUP,
|
||||
|
@ -300,8 +295,10 @@ int NSISCALL ui_doinstall(void)
|
|||
if (ExecuteCodeSegment(inst_cmnheader->code_onInit,NULL)) return 1;
|
||||
set_language();
|
||||
g_hwnd=NULL;
|
||||
ShowWindow(m_bgwnd, SW_SHOW);
|
||||
#endif//NSIS_SUPPORT_CODECALLBACKS
|
||||
#ifdef NSIS_SUPPORT_BGBG
|
||||
ShowWindow(m_bgwnd, SW_SHOW);
|
||||
#endif//NSIS_SUPPORT_BGBG
|
||||
|
||||
#ifdef NSIS_CONFIG_LICENSEPAGE
|
||||
{ // load richedit DLL
|
||||
|
@ -325,7 +322,13 @@ int NSISCALL ui_doinstall(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
return DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_INST+dlg_offset),0,DialogProc);
|
||||
{
|
||||
int ret=DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_INST+dlg_offset),0,DialogProc);
|
||||
#if defined(NSIS_SUPPORT_CODECALLBACKS) && defined(NSIS_CONFIG_ENHANCEDUI_SUPPORT)
|
||||
ExecuteCodeSegment(g_inst_cmnheader->code_onGUIEnd,NULL);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
#ifdef NSIS_CONFIG_SILENT_SUPPORT
|
||||
|
@ -414,7 +417,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
// Call leave function. If Abort used don't move to the next page.
|
||||
if (m_delta==1) if (ExecuteCodeSegment(this_page->leavefunc,NULL)) return 1;
|
||||
#endif
|
||||
|
||||
|
||||
// if the last page was a custom page, wait for it to finish by itself.
|
||||
// if it doesn't, it's a BAD plugin.
|
||||
// plugins should react to WM_NOTIFY_OUTER_NEXT.
|
||||
|
@ -445,9 +448,9 @@ nextPage:
|
|||
if (g_flags.abort)
|
||||
{
|
||||
this_page->button_states|=16|4;
|
||||
SendMessage(g_hwnd,DM_SETDEFID,IDCANCEL,0);
|
||||
SendMessage(hwndDlg,DM_SETDEFID,IDCANCEL,0);
|
||||
}
|
||||
else SendMessage(g_hwnd,DM_SETDEFID,IDOK,0);
|
||||
else SendMessage(hwndDlg,DM_SETDEFID,IDOK,0);
|
||||
SetWindowLong(hwndtmp,GWL_STYLE,GetWindowLong(hwndtmp,GWL_STYLE)&~BS_DEFPUSHBUTTON);
|
||||
ShowWindow(hwndtmp,this_page->button_states&SW_SHOWNA);// SW_HIDE = 0, SW_SHOWNA = 8
|
||||
EnableWindow(hwndtmp,this_page->button_states&2);
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
|
||||
#ifdef NSIS_SUPPORT_BGBG
|
||||
|
||||
int bg_color1, bg_color2, bg_textcolor;
|
||||
#define c1 g_inst_cmnheader->bg_color1
|
||||
#define c2 g_inst_cmnheader->bg_color2
|
||||
|
||||
LRESULT CALLBACK BG_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
@ -23,46 +24,43 @@ LRESULT CALLBACK BG_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
case WM_PAINT:
|
||||
{
|
||||
static PAINTSTRUCT ps;
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc=BeginPaint(hwnd,&ps);
|
||||
RECT r;
|
||||
int y,ry;
|
||||
int ry;
|
||||
GetClientRect(hwnd,&r);
|
||||
// this portion by Drew Davidson, drewdavidson@mindspring.com
|
||||
ry=r.bottom;
|
||||
y=0; //r.top
|
||||
|
||||
// JF: made slower, reduced to 4 pixels high, because I like how it looks better/
|
||||
while (y < r.bottom)
|
||||
while (r.top < ry)
|
||||
{
|
||||
int rv,gv,bv;
|
||||
RECT rect;
|
||||
HBRUSH brush;
|
||||
rv = (GetRValue(bg_color2) * y + GetRValue(bg_color1) * ry) / r.bottom;
|
||||
gv = (GetGValue(bg_color2) * y + GetGValue(bg_color1) * ry) / r.bottom;
|
||||
bv = (GetBValue(bg_color2) * y + GetBValue(bg_color1) * ry) / r.bottom;
|
||||
rv = (GetRValue(c2) * r.top + GetRValue(c1) * (ry-r.top)) / ry;
|
||||
gv = (GetGValue(c2) * r.top + GetGValue(c1) * (ry-r.top)) / ry;
|
||||
bv = (GetBValue(c2) * r.top + GetBValue(c1) * (ry-r.top)) / ry;
|
||||
brush = CreateSolidBrush(RGB(rv,gv,bv));
|
||||
SetRect(&rect, 0 /*r.left*/, y, r.right, y+4);
|
||||
// note that we don't need to do "SelectObject(hdc, brush)"
|
||||
// because FillRect lets us specify the brush as a parameter.
|
||||
FillRect(hdc, &rect, brush);
|
||||
FillRect(hdc, &r, brush);
|
||||
DeleteObject(brush);
|
||||
ry-=4;
|
||||
y+=4;
|
||||
r.top+=4;
|
||||
r.bottom+=4;
|
||||
}
|
||||
|
||||
if (bg_textcolor != -1)
|
||||
if (g_inst_cmnheader->bg_textcolor != -1)
|
||||
{
|
||||
HFONT newFont, oldFont;
|
||||
newFont = CreateFont(40,0,0,0,FW_BOLD,TRUE,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,"Garamond");
|
||||
if (newFont)
|
||||
{
|
||||
static char buf[256];
|
||||
r.left+=16;
|
||||
r.top+=8;
|
||||
r.left=16;
|
||||
r.top=8;
|
||||
my_GetWindowText(hwnd,buf,sizeof(buf));
|
||||
SetBkMode(hdc,TRANSPARENT);
|
||||
SetTextColor(hdc,bg_textcolor);
|
||||
SetTextColor(hdc,g_inst_cmnheader->bg_textcolor);
|
||||
oldFont = SelectObject(hdc,newFont);
|
||||
DrawText(hdc,buf,-1,&r,DT_TOP|DT_LEFT|DT_SINGLELINE|DT_NOPREFIX);
|
||||
SelectObject(hdc,oldFont);
|
||||
|
|
|
@ -152,6 +152,10 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
int parm5 = entry_->offsets[5];
|
||||
//char *var5 = g_usrvars[parm5]; // not used yet
|
||||
int which = entry_->which;
|
||||
|
||||
// Saves 8 bytes
|
||||
// HWND mainHwnd = g_hwnd;
|
||||
// #define g_hwnd mainHwnd
|
||||
|
||||
parms = entry_->offsets;
|
||||
|
||||
|
@ -196,9 +200,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
case EW_SLEEP:
|
||||
{
|
||||
int x=process_string_fromparm_toint(0);
|
||||
if (x < 1) x=1;
|
||||
log_printf2("Sleep(%d)",x);
|
||||
Sleep(x);
|
||||
Sleep(min(x,1));
|
||||
}
|
||||
break;
|
||||
case EW_BRINGTOFRONT:
|
||||
|
@ -764,13 +767,13 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
RECT r;
|
||||
HANDLE hImage;
|
||||
HWND hwImage=GetDlgItem(g_hwnd, parm1);
|
||||
GetWindowRect(hwImage, &r);
|
||||
GetClientRect(hwImage, &r);
|
||||
hImage=LoadImage(
|
||||
0,
|
||||
process_string_fromparm_tobuf(0x00),
|
||||
IMAGE_BITMAP,
|
||||
parm2?r.right-r.left:0,
|
||||
parm2?r.bottom-r.top:0,
|
||||
parm2?r.right:0,
|
||||
parm2?r.bottom:0,
|
||||
LR_LOADFROMFILE
|
||||
);
|
||||
DeleteObject((HGDIOBJ)SetWindowLong(hwImage,GWL_USERDATA,(LONG)hImage));
|
||||
|
|
|
@ -350,6 +350,7 @@ typedef struct
|
|||
int code_onUserAbort;
|
||||
#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT
|
||||
int code_onGUIInit;
|
||||
int code_onGUIEnd;
|
||||
#endif
|
||||
#endif//NSIS_SUPPORT_CODECALLBACKS
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ extern void dopause(void);
|
|||
|
||||
// Adds the bitmap in filename using resource editor re as id id.
|
||||
// If width or height are specified it will also make sure the bitmap is in that size
|
||||
int update_bitmap(CResourceEditor* re, WORD id, char* filename, int width=0, int height=0);
|
||||
int update_bitmap(CResourceEditor* re, WORD id, char* filename, int width=0, int height=0, int maxbpp=0);
|
||||
|
||||
// reads icon file filename and places its icons in the resource wIconId using resource editor re. Also updates icondata_size.
|
||||
int replace_icon(CResourceEditor* re, WORD wIconId, char* filename);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue