diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index 75264677..6116808f 100644 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -77,8 +77,10 @@ static int num_sections; static int m_page=-1,m_abort,m_retcode,m_delta=1; -static void NSISCALL outernotify(int num) { - if (num==0xD1E) +#define NOTIFY_BYE_BYE 'x' + +static void NSISCALL outernotify(char num) { + if (num==NOTIFY_BYE_BYE) g_quit_flag=1; m_delta=num; SendMessage(g_hwnd,WM_NOTIFY_OUTER_NEXT,(WPARAM)num,0); // it sends num again for plugins - DON'T REMOVE! @@ -98,8 +100,6 @@ static BOOL CALLBACK UninstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l static DWORD WINAPI install_thread(LPVOID p); -HWND NSISCALL bgWnd_Init(); - HWND insthwnd, insthwnd2,insthwndbutton; void *g_inst_combinedheader; @@ -366,7 +366,26 @@ int NSISCALL ui_doinstall(void) #ifdef NSIS_SUPPORT_BGBG if (g_inst_cmnheader->bg_color1 != -1) { - m_bgwnd=bgWnd_Init(); + RECT vp; + static WNDCLASS wc; + 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; + wc.hIcon = g_hIcon; + wc.hCursor = LoadCursor(NULL,IDC_ARROW); + wc.lpszClassName = "_Nb"; + + if (!RegisterClass(&wc)) return 0; + + bg_color1=g_inst_cmnheader->bg_color1; + bg_color2=g_inst_cmnheader->bg_color2; + bg_textcolor=g_inst_cmnheader->bg_textcolor; + + SystemParametersInfo(SPI_GETWORKAREA, 0, &vp, 0); + + m_bgwnd = CreateWindow("_Nb","",WS_OVERLAPPED|WS_THICKFRAME|WS_CAPTION|WS_SYSMENU|WS_MAXIMIZEBOX|WS_MINIMIZEBOX, + vp.left,vp.top,vp.right-vp.left,vp.bottom-vp.top,GetDesktopWindow(),NULL,g_hInstance,NULL); } #endif//NSIS_SUPPORT_BGBG #ifdef NSIS_SUPPORT_CODECALLBACKS @@ -515,6 +534,7 @@ nextPage: hwndtmp=GetDlgItem(hwndDlg,IDC_BACK); ShowWindow(hwndtmp,this_page->back&SW_SHOWNA);// SW_HIDE = 0 EnableWindow(hwndtmp,this_page->back&2); + EnableWindow(m_hwndOK,1); if (this_page->id!=NSIS_PAGE_COMPLETED) DestroyWindow(m_curwnd); else if (g_autoclose) goto nextPage; @@ -549,7 +569,7 @@ nextPage: //on the license page, instead we want the focus left alone because in //WM_INITDIALOG it is given to the richedit control. if (!gDontFookWithFocus) - SetFocus(m_hwndOK); + SetFocus(m_hwndOK); //XGE End } } @@ -578,7 +598,7 @@ nextPage: ExecuteCodeSegment(g_inst_cmnheader->code_onInstFailed,NULL); #endif//NSIS_SUPPORT_CODECALLBACKS m_retcode=2; - outernotify(0xD1E); + outernotify(NOTIFY_BYE_BYE); } else { @@ -587,7 +607,7 @@ nextPage: #endif//NSIS_SUPPORT_CODECALLBACKS { m_retcode=1; - outernotify(0xD1E); + outernotify(NOTIFY_BYE_BYE); } } } @@ -820,6 +840,8 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar // Allows 'SpaceTexts none' if (LANG_STR_TAB(LANG_SPACE_REQ)) { SetUITextNT(IDC_SPACEREQUIRED,inttosizestr(total,mystrcpy(s,LANG_STR(LANG_SPACE_REQ)))); + //if (available < total) + //SetTextColor(GetDC(GetDlgItem(hwndDlg,IDC_SPACEREQUIRED)), RGB(255,0,0)); if (available != -1) SetUITextNT(IDC_SPACEAVAILABLE,inttosizestr(available,mystrcpy(s,LANG_STR(LANG_SPACE_AVAIL)))); else @@ -1363,7 +1385,7 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (g_quit_flag) { m_retcode=1; - outernotify(0xD1E); + outernotify(NOTIFY_BYE_BYE); } else if (!wParam) { diff --git a/Source/exehead/bgbg.c b/Source/exehead/bgbg.c index b920cc85..e79a8e0c 100644 --- a/Source/exehead/bgbg.c +++ b/Source/exehead/bgbg.c @@ -7,9 +7,9 @@ #ifdef NSIS_SUPPORT_BGBG -static int m_color1, m_color2, m_textcolor; +int bg_color1, bg_color2, bg_textcolor; -static LRESULT CALLBACK BG_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK BG_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { @@ -30,9 +30,9 @@ static LRESULT CALLBACK BG_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l int rv,gv,bv; RECT rect; HBRUSH brush; - rv = (GetRValue(m_color2) * y + GetRValue(m_color1) * ry) / r.bottom; - gv = (GetGValue(m_color2) * y + GetGValue(m_color1) * ry) / r.bottom; - bv = (GetBValue(m_color2) * y + GetBValue(m_color1) * ry) / r.bottom; + 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; 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)" @@ -43,7 +43,7 @@ static LRESULT CALLBACK BG_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l y+=4; } - if (m_textcolor != -1) + if (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"); @@ -54,7 +54,7 @@ static LRESULT CALLBACK BG_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l r.top+=8; GetWindowText(hwnd,buf,sizeof(buf)); SetBkMode(hdc,TRANSPARENT); - SetTextColor(hdc,m_textcolor); + SetTextColor(hdc,bg_textcolor); oldFont = SelectObject(hdc,newFont); DrawText(hdc,buf,-1,&r,DT_TOP|DT_LEFT|DT_SINGLELINE|DT_NOPREFIX); SelectObject(hdc,oldFont); @@ -68,28 +68,4 @@ static LRESULT CALLBACK BG_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l return DefWindowProc(hwnd,uMsg,wParam,lParam); } - -HWND NSISCALL bgWnd_Init() -{ - RECT vp; - static WNDCLASS wc; - wc.lpfnWndProc = BG_WndProc; - wc.hInstance = g_hInstance; - wc.hIcon = g_hIcon; - wc.hCursor = LoadCursor(NULL,IDC_ARROW); - wc.lpszClassName = "_Nb"; - - if (!RegisterClass(&wc)) return 0; - - m_color1=g_inst_cmnheader->bg_color1; - m_color2=g_inst_cmnheader->bg_color2; - m_textcolor=g_inst_cmnheader->bg_textcolor; - - SystemParametersInfo(SPI_GETWORKAREA, 0, &vp, 0); - - return CreateWindow("_Nb","",WS_OVERLAPPED|WS_THICKFRAME|WS_CAPTION|WS_SYSMENU|WS_MAXIMIZEBOX|WS_MINIMIZEBOX, - vp.left,vp.top,vp.right-vp.left,vp.bottom-vp.top,GetDesktopWindow(),NULL,g_hInstance,NULL); -} - - #endif //NSIS_SUPPORT_BGBG diff --git a/Source/exehead/util.c b/Source/exehead/util.c index 7d3eb516..d96732d4 100644 --- a/Source/exehead/util.c +++ b/Source/exehead/util.c @@ -454,23 +454,25 @@ char * NSISCALL process_string(char *out, const char *in) case VAR_CODES_START + 28: // SMSTARTUP case VAR_CODES_START + 29: // DESKTOP case VAR_CODES_START + 30: // STARTMENU + case VAR_CODES_START + 31: // QUICKLAUNCH { static const char *tab[]={ "Programs", "Startup", "Desktop", - "Start Menu" + "Start Menu", + "AppData" }; queryShellFolders(tab[nVarIdx-(VAR_CODES_START+27)], out); + if (nVarIdx == VAR_CODES_START + 31) { + lstrcat(out, "\\Microsoft\\Internet Explorer\\Quick Launch"); + f = GetFileAttributes(out); + if (f != (DWORD)-1 && (f & FILE_ATTRIBUTE_DIRECTORY)) + break; + } + else break; } - break; - case VAR_CODES_START + 31: // QUICKLAUNCH - queryShellFolders("AppData", out); - lstrcat(out, "\\Microsoft\\Internet Explorer\\Quick Launch"); - f = GetFileAttributes(out); - if (f != (DWORD)-1 && (f & FILE_ATTRIBUTE_DIRECTORY)) - break; case VAR_CODES_START + 32: // TEMP GetTempPath(NSIS_MAX_STRLEN, out); break;