diff --git a/mozilla/xpinstall/packager/win_gre/config.it b/mozilla/xpinstall/packager/win_gre/config.it index f76ba210799..c3d885e4e87 100644 --- a/mozilla/xpinstall/packager/win_gre/config.it +++ b/mozilla/xpinstall/packager/win_gre/config.it @@ -704,8 +704,7 @@ Message Cancel Setup AUTO mode=Canceling Setup, please wait... ;*** LOCALIZE ME BABY *** Error File Uncompress=Error uncompressing file %s: %d ;*** LOCALIZE ME BABY *** -;UsageMsg Usage must not have more than 20 lines. (Each %s becomes a line) -UsageMsg Usage=Usage: %s [options]%s [options] can be any of the following combination:%s -h: This help.%s -a [path]: Alternate archive search path.%s -app [id]: ID of app which is launching the installer%s -app_path [path]: Points to representative file of the app%s -dd [path]: Suggested install destination direcotory%s -f: Force install%s -n [filename]: Setup's parent's process filename.%s -ma: Run setup in Auto mode.%s -mmi: Allow multiple installer instances%s -ms: Run setup in Silent mode.%s -ira: Ignore the [RunAppX] sections%s -ispf: Ignore the [Program FolderX] sections that show%s the Start Menu shortcut folder at the end of installation.%s -reg_path [path]: Where to make entries in the Windows registry. +UsageMsg Usage=Usage: %s [options]\n [options] can be any of the following combination:\n -h: This help.\n -a [path]: Alternate archive search path.\n -app [app id]: ID of application which is launching the installer (shared installs)\n -app_path [app]: Points to (full path) representative file of application (Shared installs)\n * -dd [path]: Suggested install destination directory. (Shared installs)\n * -greLocal: Forces GRE to be installed into the application dir.\n * -greShared: Forces GRE to be installed into a global, shared dir (normally)\n c:\program files\common files\mozilla.org\GRE\n -reg_path [path]: Where to make entries in the Windows registry. (Shared installs)\n -f: Force install of GRE installer (Shared installs), though it'll work\n for non GRE installers too.\n -greForce: Force 'Component GRE' to be downloaded, run, and installed. This\n bypasses GRE's logic of determining when to install by running its\n installer with a '-f' flag.\n -n [filename]: Setup's parent's process filename.\n * -ma: Run setup in Auto mode.\n * -ms: Run setup in Silent mode.\n -ira: Ignore the [RunAppX] sections\n -ispf: Ignore the [Program FolderX] sections that show\n the Start Menu shortcut folder at the end of installation.\n * -showBanner: Show the banner image in the download and install progress dialogs\n * -hideBanner: Hide the banner image in the download and install progress dialogs\n\n * means it will override config.ini ;*** LOCALIZE ME BABY *** IDC Use FTP=Use &FTP for downloading files ;*** LOCALIZE ME BABY *** diff --git a/mozilla/xpinstall/packager/win_gre/install.it b/mozilla/xpinstall/packager/win_gre/install.it index 942650e0e46..b6d5afa2dab 100644 --- a/mozilla/xpinstall/packager/win_gre/install.it +++ b/mozilla/xpinstall/packager/win_gre/install.it @@ -83,7 +83,7 @@ MSG_SMARTUPDATE_START=Preparing Install, please wait... MSG_CONFIGURING=Configuring %s, please wait... ERROR_XPI_INSTALL=Error occurred during installation ERROR_SETUP_REQUIREMENT=Windows95 or greater Operating System is required! Exiting setup... -DLG_EXTRACTING_TITLE=Install Progress +DLG_EXTRACTING_TITLE=$ProductName$ Setup - Install Progress STR_PROCESSINGFILE=Preparing file: %s STR_INSTALLING=Currently installing %s STR_COPYINGFILE=Copying file: %s @@ -106,6 +106,7 @@ STR_SAVE_INSTALLER_FILES=Save downloaded and Setup program files to: MSG_INIT_SETUP=Initializing Setup, please wait... STR_MESSAGEBOX_TITLE=%s Setup ERROR_GETVERSION=GetVersionEx() failed! +TITLE_USAGE=Usage STATUS_EXTRACTING=Extracting %s STATUS_LAUNCHING_SETUP=Launching Setup... diff --git a/mozilla/xpinstall/packager/win_mfcembed/config.it b/mozilla/xpinstall/packager/win_mfcembed/config.it index f0cd6809803..538c7746c05 100644 --- a/mozilla/xpinstall/packager/win_mfcembed/config.it +++ b/mozilla/xpinstall/packager/win_mfcembed/config.it @@ -119,7 +119,11 @@ GRE Type=Shared ; config.ini file) will be appended as follows: ; ; Software\mozilla.org\GRE_1.4a_00000000_PRIVATE_[Product Name Internal] -GRE Private Key=Software\mozilla.org\GRE_$GreUniqueID$_PRIVATE +GRE Private Key=Software\mozilla.org\GRE_$GreUniqueID$_PRIVATE_%ProductNameInternal$ + +; Controls the display of the banner image in the download and install progress dialogs. +; Default value is TRUE. +Show Banner Image=TRUE ; This section contains info on how to send error information in case of ; either a download or xpinstall error. @@ -690,7 +694,7 @@ Message Cancel Setup AUTO mode=Canceling Setup, please wait... ;*** LOCALIZE ME BABY *** Error File Uncompress=Error uncompressing file %s: %d ;*** LOCALIZE ME BABY *** -UsageMsg Usage=Usage: %s [options]%s [options] can be any of the following combination:%s -h: This help.%s -a [path]: Alternate archive search path.%s -n [filename]: Setup's parent's process filename.%s -ma: Run setup in Auto mode.%s -ms: Run setup in Silent mode.%s -ira: Ignore the [RunAppX] sections%s -ispf: Ignore the [Program FolderX] sections that show%s the Start Menu shortcut folder at the end of installation. +UsageMsg Usage=Usage: %s [options]\n [options] can be any of the following combination:\n -h: This help.\n -a [path]: Alternate archive search path.\n -app [app id]: ID of application which is launching the installer (shared installs)\n -app_path [app]: Points to (full path) representative file of application (Shared installs)\n * -dd [path]: Suggested install destination directory. (Shared installs)\n * -greLocal: Forces GRE to be installed into the application dir.\n * -greShared: Forces GRE to be installed into a global, shared dir (normally)\n c:\program files\common files\mozilla.org\GRE\n -reg_path [path]: Where to make entries in the Windows registry. (Shared installs)\n -f: Force install of GRE installer (Shared installs), though it'll work\n for non GRE installers too.\n -greForce: Force 'Component GRE' to be downloaded, run, and installed. This\n bypasses GRE's logic of determining when to install by running its\n installer with a '-f' flag.\n -n [filename]: Setup's parent's process filename.\n * -ma: Run setup in Auto mode.\n * -ms: Run setup in Silent mode.\n -ira: Ignore the [RunAppX] sections\n -ispf: Ignore the [Program FolderX] sections that show\n the Start Menu shortcut folder at the end of installation.\n * -showBanner: Show the banner image in the download and install progress dialogs\n * -hideBanner: Hide the banner image in the download and install progress dialogs\n\n * means it will override config.ini ;*** LOCALIZE ME BABY *** IDC Use FTP=Use &FTP for downloading files ;*** LOCALIZE ME BABY *** diff --git a/mozilla/xpinstall/packager/win_mfcembed/install.it b/mozilla/xpinstall/packager/win_mfcembed/install.it index 942650e0e46..b6d5afa2dab 100644 --- a/mozilla/xpinstall/packager/win_mfcembed/install.it +++ b/mozilla/xpinstall/packager/win_mfcembed/install.it @@ -83,7 +83,7 @@ MSG_SMARTUPDATE_START=Preparing Install, please wait... MSG_CONFIGURING=Configuring %s, please wait... ERROR_XPI_INSTALL=Error occurred during installation ERROR_SETUP_REQUIREMENT=Windows95 or greater Operating System is required! Exiting setup... -DLG_EXTRACTING_TITLE=Install Progress +DLG_EXTRACTING_TITLE=$ProductName$ Setup - Install Progress STR_PROCESSINGFILE=Preparing file: %s STR_INSTALLING=Currently installing %s STR_COPYINGFILE=Copying file: %s @@ -106,6 +106,7 @@ STR_SAVE_INSTALLER_FILES=Save downloaded and Setup program files to: MSG_INIT_SETUP=Initializing Setup, please wait... STR_MESSAGEBOX_TITLE=%s Setup ERROR_GETVERSION=GetVersionEx() failed! +TITLE_USAGE=Usage STATUS_EXTRACTING=Extracting %s STATUS_LAUNCHING_SETUP=Launching Setup... diff --git a/mozilla/xpinstall/packager/windows/config.it b/mozilla/xpinstall/packager/windows/config.it index 0eab985a594..4801f113bb3 100644 --- a/mozilla/xpinstall/packager/windows/config.it +++ b/mozilla/xpinstall/packager/windows/config.it @@ -116,7 +116,11 @@ GRE Type=Shared ; config.ini file) will be appended as follows: ; ; Software\mozilla.org\GRE_1.4a_0000000000_PRIVATE_[Product Name Internal] -GRE Private Key=Software\mozilla.org\GRE_$GreUniqueID$_PRIVATE +GRE Private Key=Software\mozilla.org\GRE_$GreUniqueID$_PRIVATE_$ProductNameInternal$ + +; Controls the display of the banner image in the download and install progress dialogs. +; Default value is TRUE. +Show Banner Image=TRUE ; This section contains info on how to send error information in case of ; either a download or xpinstall error. @@ -1157,7 +1161,7 @@ Message Cancel Setup AUTO mode=Canceling Setup, please wait... ;*** LOCALIZE ME BABY *** Error File Uncompress=Error uncompressing file %s: %d ;*** LOCALIZE ME BABY *** -UsageMsg Usage=Usage: %s [options]%s [options] can be any of the following combination:%s -h: This help.%s -a [path]: Alternate archive search path.%s -n [filename]: Setup's parent's process filename.%s -ma: Run setup in Auto mode.%s -ms: Run setup in Silent mode.%s -ira: Ignore the [RunAppX] sections%s -ispf: Ignore the [Program FolderX] sections that show%s the Start Menu shortcut folder at the end of installation. +UsageMsg Usage=Usage: %s [options]\n [options] can be any of the following combination:\n -h: This help.\n -a [path]: Alternate archive search path.\n -app [app id]: ID of application which is launching the installer (shared installs)\n -app_path [app]: Points to (full path) representative file of application (Shared installs)\n * -dd [path]: Suggested install destination directory. (Shared installs)\n * -greLocal: Forces GRE to be installed into the application dir.\n * -greShared: Forces GRE to be installed into a global, shared dir (normally)\n c:\program files\common files\mozilla.org\GRE\n -reg_path [path]: Where to make entries in the Windows registry. (Shared installs)\n -f: Force install of GRE installer (Shared installs), though it'll work\n for non GRE installers too.\n -greForce: Force 'Component GRE' to be downloaded, run, and installed. This\n bypasses GRE's logic of determining when to install by running its\n installer with a '-f' flag.\n -n [filename]: Setup's parent's process filename.\n * -ma: Run setup in Auto mode.\n * -ms: Run setup in Silent mode.\n -ira: Ignore the [RunAppX] sections\n -ispf: Ignore the [Program FolderX] sections that show\n the Start Menu shortcut folder at the end of installation.\n * -showBanner: Show the banner image in the download and install progress dialogs\n * -hideBanner: Hide the banner image in the download and install progress dialogs\n\n * means it will override config.ini ;*** LOCALIZE ME BABY *** IDC Use FTP=Use &FTP for downloading files ;*** LOCALIZE ME BABY *** diff --git a/mozilla/xpinstall/packager/windows/install.it b/mozilla/xpinstall/packager/windows/install.it index 942650e0e46..b6d5afa2dab 100644 --- a/mozilla/xpinstall/packager/windows/install.it +++ b/mozilla/xpinstall/packager/windows/install.it @@ -83,7 +83,7 @@ MSG_SMARTUPDATE_START=Preparing Install, please wait... MSG_CONFIGURING=Configuring %s, please wait... ERROR_XPI_INSTALL=Error occurred during installation ERROR_SETUP_REQUIREMENT=Windows95 or greater Operating System is required! Exiting setup... -DLG_EXTRACTING_TITLE=Install Progress +DLG_EXTRACTING_TITLE=$ProductName$ Setup - Install Progress STR_PROCESSINGFILE=Preparing file: %s STR_INSTALLING=Currently installing %s STR_COPYINGFILE=Copying file: %s @@ -106,6 +106,7 @@ STR_SAVE_INSTALLER_FILES=Save downloaded and Setup program files to: MSG_INIT_SETUP=Initializing Setup, please wait... STR_MESSAGEBOX_TITLE=%s Setup ERROR_GETVERSION=GetVersionEx() failed! +TITLE_USAGE=Usage STATUS_EXTRACTING=Extracting %s STATUS_LAUNCHING_SETUP=Launching Setup... diff --git a/mozilla/xpinstall/wizard/windows/setup/dialogs.c b/mozilla/xpinstall/wizard/windows/setup/dialogs.c index e6b22d0934a..09f4a787c5a 100644 --- a/mozilla/xpinstall/wizard/windows/setup/dialogs.c +++ b/mozilla/xpinstall/wizard/windows/setup/dialogs.c @@ -41,6 +41,42 @@ static BOOL gbProcessingXpnstallFiles; static DWORD gdwACFlag; static DWORD gdwIndexLastSelected; +/* List of Dialog Item IDs from the Download dialog + * that need to be repositioned (up) when the banner + * in the dialog is hidden. + */ +const int DownloadDlgItemList[] = {IDPAUSE, + IDRESUME, + IDCANCEL, + IDC_MESSAGE0, + IDC_STATIC3, + IDC_STATUS_URL, + IDC_STATIC1, + IDC_STATUS_STATUS, + IDC_STATIC2, + IDC_STATUS_FILE, + IDC_GAUGE_FILE, + IDC_PERCENTAGE, + IDC_STATIC4, + IDC_STATUS_TO, + -2}; /* -1 is used by IDC_STATIC. Even though + * there shouldn't be any IDC_STATIC in + * list, we shouldn't use it. + */ + +/* List of Dialog Item IDs from the Install Progress dialog + * that need to be repositioned (up) when the banner + * in the dialog is hidden. +*/ +const int InstallProgressDlgItemList[] = {IDC_STATUS0, + IDC_GAUGE_ARCHIVE, + IDC_STATUS3, + IDC_GAUGE_FILE, + -2}; /* -1 is used by IDC_STATIC. Even though + * there shouldn't be any IDC_STATIC in + * list, we shouldn't use it. + */ + BOOL AskCancelDlg(HWND hDlg) { char szDlgQuitTitle[MAX_BUF]; @@ -83,11 +119,136 @@ void DisableSystemMenuItems(HWND hWnd, BOOL bDisableClose) EnableMenuItem(GetSystemMenu(hWnd, FALSE), SC_CLOSE, MF_BYCOMMAND | MF_GRAYED); } +/* Function: MoveDlgItem() + * + * in: HWND aWndDlg : handle to a dialog containing items in aIDList. + * const int *aIDList: list of dlg item IDs that require moving. + * DWORD aWidth : width to move the dlg items by (+/-). + * DWORD aHeight : height to move the dlg items by (+/-). + * + * purpose: To move dialog items (given a list of item ids) +aWidth/+aHeight from + * its current position. + * This is for when the banner logo in the download/install process + * dialogs are not to be displayed, it leaves an empty area above + * the dialog items/controls. So this helps move them up by the + * height of the banner. + * The resizing of the window given the lack of the banner is done + * RepositionWindow(). + */ +void MoveDlgItem(HWND aWndDlg, const int *aIDList, DWORD aWidth, DWORD aHeight) +{ + RECT rect; + HWND hDlgItem; + int i; + int id; + + i = 0; + id = aIDList[i]; + while(id != -2) + { + hDlgItem = GetDlgItem(aWndDlg, id); + if(hDlgItem) + { + GetWindowRect(hDlgItem, &rect); + SetWindowPos(hDlgItem, NULL, rect.left + aWidth, rect.top + aHeight, + -1, -1, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); + } + id = aIDList[++i]; + } +} + +/* Function: RepositionWindow() + * + * in: HWND aHwndDlg : Window handle to reposition. + * DWORD aBannerImage: Integer indicating which dialog needs to have + * it's dlg items moved. + * There are only 3 types: + * NO_BANNER_IMAGE + * BANNER_IMAGE_DOWNLOAD + * BANNER_IMAGE_INSTALLING + * + * purpose: To reposition a window given the screen position of the previous + * window. The previous window position is saved in: + * gSystemInfo.lastWindowPosCenterX + * gSystemInfo.lastWindowPosCenterY + * + * aHwndDlg is the window handle to the dialog to reposition. + * aBannerImage is a DWORD value that indicates which dialog + * the banner is displayed in. There are only two possible dialogs: + * Download dialog + * Install dialog + * + * This function also hides the banner image normally displayed in + * the Download and Install Process dialgs. Once hidden, it also + * moves all of their dialog items up by the height of the hidden + * banner image and resizes the dialogs so it'll look nice. + */ +void RepositionWindow(HWND aHwndDlg, DWORD aBannerImage) +{ + RECT rect; + int iLeft, iTop; + DWORD width = -1; + DWORD height = -1; + DWORD windowFlags = SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE; + + GetWindowRect(aHwndDlg, &rect); + if(aBannerImage && !gShowBannerImage) + { + RECT rLogo; + HWND hwndBanner; + + hwndBanner = GetDlgItem(aHwndDlg, IDB_BITMAP_BANNER); + GetWindowRect(hwndBanner, &rLogo); + ShowWindow(hwndBanner, SW_HIDE); + width = rect.right; + height = rect.bottom - rLogo.bottom + rLogo.top; + windowFlags = SWP_NOZORDER | SWP_NOACTIVATE; + + /* aBannerImage indicates which dialog we need to move it's dlg items + * up to fit the resized window. + */ + switch(aBannerImage) + { + case BANNER_IMAGE_DOWNLOAD: + MoveDlgItem(aHwndDlg, DownloadDlgItemList, 0, -rLogo.bottom); + break; + + case BANNER_IMAGE_INSTALLING: + MoveDlgItem(aHwndDlg, InstallProgressDlgItemList, 0, -rLogo.bottom); + break; + + default: + break; + } + } + + iLeft = (gSystemInfo.lastWindowPosCenterX - ((rect.right - rect.left) / 2)); + iTop = (gSystemInfo.lastWindowPosCenterY - ((rect.bottom - rect.top) / 2)); + SetWindowPos(aHwndDlg, NULL, iLeft, iTop, width, height, windowFlags); +} + +/* Function: SaveWindowPosition() + * + * in: HWND aDlg: Window handle to remember the position of. + * + * purpose: Saves the current window's position so that it can be + * used to position the next window created. + */ +void SaveWindowPosition(HWND aDlg) +{ + RECT rectDlg; + + if(GetWindowRect(aDlg, &rectDlg)) + { + gSystemInfo.lastWindowPosCenterX = ((rectDlg.right - rectDlg.left) / 2) + rectDlg.left; + gSystemInfo.lastWindowPosCenterY = ((rectDlg.bottom - rectDlg.top) / 2) + rectDlg.top; + } +} + LRESULT CALLBACK DlgProcWelcome(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) { char szBuf[MAX_BUF]; - RECT rDlg; - + switch(msg) { case WM_INITDIALOG: @@ -99,14 +260,7 @@ LRESULT CALLBACK DlgProcWelcome(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) SetDlgItemText(hDlg, IDC_STATIC1, diWelcome.szMessage1); SetDlgItemText(hDlg, IDC_STATIC2, diWelcome.szMessage2); - if(GetClientRect(hDlg, &rDlg)) - SetWindowPos(hDlg, - HWND_TOP, - (gSystemInfo.dwScreenX/2)-(rDlg.right/2), - (gSystemInfo.dwScreenY/2)-(rDlg.bottom/2), - 0, - 0, - SWP_NOSIZE); + RepositionWindow(hDlg, NO_BANNER_IMAGE); SetDlgItemText(hDlg, IDWIZNEXT, sgInstallGui.szNext_); SetDlgItemText(hDlg, IDCANCEL, sgInstallGui.szCancel_); @@ -121,6 +275,7 @@ LRESULT CALLBACK DlgProcWelcome(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) switch(LOWORD(wParam)) { case IDWIZNEXT: + SaveWindowPosition(hDlg); DestroyWindow(hDlg); DlgSequence(NEXT_DLG); break; @@ -146,7 +301,6 @@ LRESULT CALLBACK DlgProcLicense(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) DWORD dwBytesRead; HANDLE hFLicense; FILE *fLicense; - RECT rDlg; switch(msg) { @@ -177,14 +331,7 @@ LRESULT CALLBACK DlgProcLicense(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) } } - if(GetClientRect(hDlg, &rDlg)) - SetWindowPos(hDlg, - HWND_TOP, - (gSystemInfo.dwScreenX/2)-(rDlg.right/2), - (gSystemInfo.dwScreenY/2)-(rDlg.bottom/2), - 0, - 0, - SWP_NOSIZE); + RepositionWindow(hDlg, NO_BANNER_IMAGE); SetDlgItemText(hDlg, IDWIZBACK, sgInstallGui.szBack_); SetDlgItemText(hDlg, IDWIZNEXT, sgInstallGui.szAccept_); @@ -201,11 +348,13 @@ LRESULT CALLBACK DlgProcLicense(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) switch(LOWORD(wParam)) { case IDWIZNEXT: + SaveWindowPosition(hDlg); DestroyWindow(hDlg); DlgSequence(NEXT_DLG); break; case IDWIZBACK: + SaveWindowPosition(hDlg); DestroyWindow(hDlg); DlgSequence(PREV_DLG); break; @@ -238,7 +387,6 @@ LRESULT CALLBACK BrowseHookProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l { DWORD dwIndex; DWORD dwLoop; - RECT rDlg; char szBuf[MAX_BUF]; char szBufIndex[MAX_BUF]; char szPath[MAX_BUF]; @@ -246,18 +394,11 @@ LRESULT CALLBACK BrowseHookProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l switch(message) { - case WM_INITDIALOG: + case WM_INITDIALOG: hwndLBFolders = GetDlgItem(hDlg, 1121); SetDlgItemText(hDlg, IDC_EDIT_DESTINATION, szTempSetupPath); - if(GetClientRect(hDlg, &rDlg)) - SetWindowPos(hDlg, - HWND_TOP, - (gSystemInfo.dwScreenX/2)-(rDlg.right/2), - (gSystemInfo.dwScreenY/2)-(rDlg.bottom/2), - 0, - 0, - SWP_NOSIZE); + RepositionWindow(hDlg, NO_BANNER_IMAGE); OldListBoxWndProc = SubclassWindow(hwndLBFolders, (WNDPROC)ListBoxBrowseWndProc); gdwIndexLastSelected = SendDlgItemMessage(hDlg, 1121, LB_GETCURSEL, 0, (LPARAM)0); @@ -313,6 +454,7 @@ LRESULT CALLBACK BrowseHookProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l break; case IDOK: + SaveWindowPosition(hDlg); GetDlgItemText(hDlg, IDC_EDIT_DESTINATION, szBuf, MAX_BUF); if(*szBuf == '\0') { @@ -518,7 +660,6 @@ LRESULT CALLBACK DlgProcSetupType(HWND hDlg, UINT msg, WPARAM wParam, LONG lPara HWND hStaticSt3; HWND hReadme; HWND hDestinationPath; - RECT rDlg; char szBuf[MAX_BUF]; char szBufTemp[MAX_BUF]; char szBufTemp2[MAX_BUF]; @@ -621,14 +762,7 @@ LRESULT CALLBACK DlgProcSetupType(HWND hDlg, UINT msg, WPARAM wParam, LONG lPara break; } - if(GetClientRect(hDlg, &rDlg)) - SetWindowPos(hDlg, - HWND_TOP, - (gSystemInfo.dwScreenX/2)-(rDlg.right/2), - (gSystemInfo.dwScreenY/2)-(rDlg.bottom/2), - 0, - 0, - SWP_NOSIZE); + RepositionWindow(hDlg, NO_BANNER_IMAGE); if((*diSetupType.szReadmeFilename == '\0') || (FileExists(diSetupType.szReadmeFilename) == FALSE)) ShowWindow(hReadme, SW_HIDE); @@ -669,6 +803,7 @@ LRESULT CALLBACK DlgProcSetupType(HWND hDlg, UINT msg, WPARAM wParam, LONG lPara switch(LOWORD(wParam)) { case IDC_BUTTON_BROWSE: + SaveWindowPosition(hDlg); if(IsDlgButtonChecked(hDlg, IDC_RADIO_ST0) == BST_CHECKED) dwTempSetupType = ST_RADIO0; else if(IsDlgButtonChecked(hDlg, IDC_RADIO_ST1) == BST_CHECKED) @@ -693,6 +828,7 @@ LRESULT CALLBACK DlgProcSetupType(HWND hDlg, UINT msg, WPARAM wParam, LONG lPara break; case IDWIZNEXT: + SaveWindowPosition(hDlg); lstrcpy(sgProduct.szPath, szTempSetupPath); /* append a backslash to the path because CreateDirectoriesAll() @@ -789,6 +925,7 @@ LRESULT CALLBACK DlgProcSetupType(HWND hDlg, UINT msg, WPARAM wParam, LONG lPara break; case IDWIZBACK: + SaveWindowPosition(hDlg); dwTempSetupType = dwSetupType; lstrcpy(szTempSetupPath, sgProduct.szPath); DestroyWindow(hDlg); @@ -1072,7 +1209,6 @@ LRESULT CALLBACK DlgProcSelectComponents(HWND hDlg, UINT msg, WPARAM wParam, LON DWORD dwIndex; DWORD dwItems = MAX_BUF; HWND hwndLBComponents; - RECT rDlg; TCHAR tchBuffer[MAX_BUF]; LPDRAWITEMSTRUCT lpdis; ULONGLONG ullDSBuf; @@ -1106,14 +1242,7 @@ LRESULT CALLBACK DlgProcSelectComponents(HWND hDlg, UINT msg, WPARAM wParam, LON SetDlgItemText(hDlg, IDC_STATIC_DESCRIPTION, SiCNodeGetDescriptionLong(0, FALSE, AC_COMPONENTS)); } - if(GetClientRect(hDlg, &rDlg)) - SetWindowPos(hDlg, - HWND_TOP, - (gSystemInfo.dwScreenX/2)-(rDlg.right/2), - (gSystemInfo.dwScreenY/2)-(rDlg.bottom/2), - 0, - 0, - SWP_NOSIZE); + RepositionWindow(hDlg, NO_BANNER_IMAGE); /* update the disk space available info in the dialog. GetDiskSpaceAvailable() returns value in kbytes */ @@ -1157,7 +1286,7 @@ LRESULT CALLBACK DlgProcSelectComponents(HWND hDlg, UINT msg, WPARAM wParam, LON if(lpdis->itemID == -1) break; - DrawLBText(lpdis, AC_COMPONENTS); + DrawLBText(lpdis, AC_COMPONENTS); DrawCheck(lpdis, AC_COMPONENTS); // draw the focus rect on the selected item @@ -1189,11 +1318,13 @@ LRESULT CALLBACK DlgProcSelectComponents(HWND hDlg, UINT msg, WPARAM wParam, LON break; case IDWIZNEXT: + SaveWindowPosition(hDlg); DestroyWindow(hDlg); DlgSequence(NEXT_DLG); break; case IDWIZBACK: + SaveWindowPosition(hDlg); DestroyWindow(hDlg); DlgSequence(PREV_DLG); break; @@ -1218,7 +1349,6 @@ LRESULT CALLBACK DlgProcSelectAdditionalComponents(HWND hDlg, UINT msg, WPARAM w DWORD dwIndex; DWORD dwItems = MAX_BUF; HWND hwndLBComponents; - RECT rDlg; TCHAR tchBuffer[MAX_BUF]; LPDRAWITEMSTRUCT lpdis; ULONGLONG ullDSBuf; @@ -1252,14 +1382,7 @@ LRESULT CALLBACK DlgProcSelectAdditionalComponents(HWND hDlg, UINT msg, WPARAM w SetDlgItemText(hDlg, IDC_STATIC_DESCRIPTION, SiCNodeGetDescriptionLong(0, FALSE, AC_ADDITIONAL_COMPONENTS)); } - if(GetClientRect(hDlg, &rDlg)) - SetWindowPos(hDlg, - HWND_TOP, - (gSystemInfo.dwScreenX/2)-(rDlg.right/2), - (gSystemInfo.dwScreenY/2)-(rDlg.bottom/2), - 0, - 0, - SWP_NOSIZE); + RepositionWindow(hDlg, NO_BANNER_IMAGE); /* update the disk space available info in the dialog. GetDiskSpaceAvailable() returns value in kbytes */ @@ -1335,11 +1458,13 @@ LRESULT CALLBACK DlgProcSelectAdditionalComponents(HWND hDlg, UINT msg, WPARAM w break; case IDWIZNEXT: + SaveWindowPosition(hDlg); DestroyWindow(hDlg); DlgSequence(NEXT_DLG); break; case IDWIZBACK: + SaveWindowPosition(hDlg); DestroyWindow(hDlg); DlgSequence(PREV_DLG); break; @@ -1363,7 +1488,6 @@ LRESULT CALLBACK DlgProcWindowsIntegration(HWND hDlg, UINT msg, WPARAM wParam, L HWND hcbCheck1; HWND hcbCheck2; HWND hcbCheck3; - RECT rDlg; hcbCheck0 = GetDlgItem(hDlg, IDC_CHECK0); hcbCheck1 = GetDlgItem(hDlg, IDC_CHECK1); @@ -1414,14 +1538,7 @@ LRESULT CALLBACK DlgProcWindowsIntegration(HWND hDlg, UINT msg, WPARAM wParam, L else ShowWindow(hcbCheck3, SW_HIDE); - if(GetClientRect(hDlg, &rDlg)) - SetWindowPos(hDlg, - HWND_TOP, - (gSystemInfo.dwScreenX/2)-(rDlg.right/2), - (gSystemInfo.dwScreenY/2)-(rDlg.bottom/2), - 0, - 0, - SWP_NOSIZE); + RepositionWindow(hDlg, NO_BANNER_IMAGE); SetDlgItemText(hDlg, IDWIZBACK, sgInstallGui.szBack_); SetDlgItemText(hDlg, IDWIZNEXT, sgInstallGui.szNext_); @@ -1441,6 +1558,7 @@ LRESULT CALLBACK DlgProcWindowsIntegration(HWND hDlg, UINT msg, WPARAM wParam, L switch(LOWORD(wParam)) { case IDWIZNEXT: + SaveWindowPosition(hDlg); if(IsDlgButtonChecked(hDlg, IDC_CHECK0) == BST_CHECKED) { } @@ -1482,6 +1600,7 @@ LRESULT CALLBACK DlgProcWindowsIntegration(HWND hDlg, UINT msg, WPARAM wParam, L break; case IDWIZBACK: + SaveWindowPosition(hDlg); DestroyWindow(hDlg); DlgSequence(PREV_DLG); break; @@ -1504,7 +1623,6 @@ LRESULT CALLBACK DlgProcProgramFolder(HWND hDlg, UINT msg, WPARAM wParam, LONG l HANDLE hDir; DWORD dwIndex; WIN32_FIND_DATA wfdFindFileData; - RECT rDlg; switch(msg) { @@ -1531,14 +1649,7 @@ LRESULT CALLBACK DlgProcProgramFolder(HWND hDlg, UINT msg, WPARAM wParam, LONG l FindClose(hDir); } - if(GetClientRect(hDlg, &rDlg)) - SetWindowPos(hDlg, - HWND_TOP, - (gSystemInfo.dwScreenX/2)-(rDlg.right/2), - (gSystemInfo.dwScreenY/2)-(rDlg.bottom/2), - 0, - 0, - SWP_NOSIZE); + RepositionWindow(hDlg, NO_BANNER_IMAGE); SetDlgItemText(hDlg, IDC_STATIC1, sgInstallGui.szProgramFolder_); SetDlgItemText(hDlg, IDC_STATIC2, sgInstallGui.szExistingFolder_); @@ -1559,6 +1670,7 @@ LRESULT CALLBACK DlgProcProgramFolder(HWND hDlg, UINT msg, WPARAM wParam, LONG l switch(LOWORD(wParam)) { case IDWIZNEXT: + SaveWindowPosition(hDlg); GetDlgItemText(hDlg, IDC_EDIT_PROGRAM_FOLDER, szBuf, MAX_BUF); if(*szBuf == '\0') { @@ -1575,6 +1687,7 @@ LRESULT CALLBACK DlgProcProgramFolder(HWND hDlg, UINT msg, WPARAM wParam, LONG l break; case IDWIZBACK: + SaveWindowPosition(hDlg); DestroyWindow(hDlg); DlgSequence(PREV_DLG); break; @@ -1609,7 +1722,6 @@ void SaveDownloadProtocolOption(HWND hDlg) LRESULT CALLBACK DlgProcAdvancedSettings(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) { - RECT rDlg; char szBuf[MAX_BUF]; switch(msg) @@ -1623,14 +1735,7 @@ LRESULT CALLBACK DlgProcAdvancedSettings(HWND hDlg, UINT msg, WPARAM wParam, LON SetDlgItemText(hDlg, IDC_EDIT_PROXY_USER, diAdvancedSettings.szProxyUser); SetDlgItemText(hDlg, IDC_EDIT_PROXY_PASSWD, diAdvancedSettings.szProxyPasswd); - if(GetClientRect(hDlg, &rDlg)) - SetWindowPos(hDlg, - HWND_TOP, - (gSystemInfo.dwScreenX/2)-(rDlg.right/2), - (gSystemInfo.dwScreenY/2)-(rDlg.bottom/2), - 0, - 0, - SWP_NOSIZE); + RepositionWindow(hDlg, NO_BANNER_IMAGE); GetPrivateProfileString("Strings", "IDC Use Ftp", "", szBuf, sizeof(szBuf), szFileIniConfig); SetDlgItemText(hDlg, IDC_USE_FTP, szBuf); @@ -1691,6 +1796,7 @@ LRESULT CALLBACK DlgProcAdvancedSettings(HWND hDlg, UINT msg, WPARAM wParam, LON switch(LOWORD(wParam)) { case IDWIZNEXT: + SaveWindowPosition(hDlg); /* get the proxy server and port information */ GetDlgItemText(hDlg, IDC_EDIT_PROXY_SERVER, diAdvancedSettings.szProxyServer, MAX_BUF); GetDlgItemText(hDlg, IDC_EDIT_PROXY_PORT, diAdvancedSettings.szProxyPort, MAX_BUF); @@ -1704,6 +1810,7 @@ LRESULT CALLBACK DlgProcAdvancedSettings(HWND hDlg, UINT msg, WPARAM wParam, LON case IDWIZBACK: case IDCANCEL: + SaveWindowPosition(hDlg); DestroyWindow(hDlg); DlgSequence(PREV_DLG); break; @@ -1739,7 +1846,6 @@ void SaveAdditionalOptions(HWND hDlg, HWND hwndCBSiteSelector) LRESULT CALLBACK DlgProcAdditionalOptions(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) { - RECT rDlg; char szBuf[MAX_BUF]; HWND hwndCBSiteSelector; int iIndex; @@ -1764,7 +1870,7 @@ LRESULT CALLBACK DlgProcAdditionalOptions(HWND hDlg, UINT msg, WPARAM wParam, LO } if(GetTotalArchivesToDownload() == 0) - { + { ShowWindow(GetDlgItem(hDlg, IDC_MESSAGE1), SW_HIDE); ShowWindow(GetDlgItem(hDlg, IDC_CHECK_SAVE_INSTALLER_FILES), SW_HIDE); ShowWindow(GetDlgItem(hDlg, IDC_EDIT_LOCAL_INSTALLER_PATH), SW_HIDE); @@ -1799,14 +1905,7 @@ LRESULT CALLBACK DlgProcAdditionalOptions(HWND hDlg, UINT msg, WPARAM wParam, LO SendDlgItemMessage (hDlg, IDC_CHECK_RECAPTURE_HOMEPAGE, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hDlg, IDC_EDIT_LOCAL_INSTALLER_PATH, WM_SETFONT, (WPARAM)sgInstallGui.systemFont, 0L); - if(GetClientRect(hDlg, &rDlg)) - SetWindowPos(hDlg, - HWND_TOP, - (gSystemInfo.dwScreenX/2)-(rDlg.right/2), - (gSystemInfo.dwScreenY/2)-(rDlg.bottom/2), - 0, - 0, - SWP_NOSIZE); + RepositionWindow(hDlg, NO_BANNER_IMAGE); ssiTemp = ssiSiteSelector; do @@ -1847,18 +1946,21 @@ LRESULT CALLBACK DlgProcAdditionalOptions(HWND hDlg, UINT msg, WPARAM wParam, LO switch(LOWORD(wParam)) { case IDWIZNEXT: + SaveWindowPosition(hDlg); SaveAdditionalOptions(hDlg, hwndCBSiteSelector); DestroyWindow(hDlg); DlgSequence(NEXT_DLG); break; case IDWIZBACK: + SaveWindowPosition(hDlg); SaveAdditionalOptions(hDlg, hwndCBSiteSelector); DestroyWindow(hDlg); DlgSequence(PREV_DLG); break; case IDC_BUTTON_ADDITIONAL_SETTINGS: + SaveWindowPosition(hDlg); SaveAdditionalOptions(hDlg, hwndCBSiteSelector); DestroyWindow(hDlg); DlgSequence(OTHER_DLG_1); @@ -2147,7 +2249,6 @@ LPSTR GetStartInstallMessage() LRESULT CALLBACK DlgProcQuickLaunch(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) { - RECT rDlg; LPSTR szMessage = NULL; char szBuf[MAX_BUF]; @@ -2172,20 +2273,11 @@ LRESULT CALLBACK DlgProcQuickLaunch(HWND hDlg, UINT msg, WPARAM wParam, LONG lPa SendDlgItemMessage (hDlg, IDC_MESSAGE2, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hDlg, IDC_CHECK_TURBO_MODE, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); - if(GetClientRect(hDlg, &rDlg)) - SetWindowPos(hDlg, - HWND_TOP, - (gSystemInfo.dwScreenX/2)-(rDlg.right/2), - (gSystemInfo.dwScreenY/2)-(rDlg.bottom/2), - 0, - 0, - SWP_NOSIZE); + RepositionWindow(hDlg, NO_BANNER_IMAGE); - { - SetDlgItemText(hDlg, IDC_MESSAGE0, diQuickLaunch.szMessage0); - SetDlgItemText(hDlg, IDC_MESSAGE1, diQuickLaunch.szMessage1); - SetDlgItemText(hDlg, IDC_MESSAGE2, diQuickLaunch.szMessage2); - } + SetDlgItemText(hDlg, IDC_MESSAGE0, diQuickLaunch.szMessage0); + SetDlgItemText(hDlg, IDC_MESSAGE1, diQuickLaunch.szMessage1); + SetDlgItemText(hDlg, IDC_MESSAGE2, diQuickLaunch.szMessage2); if(diQuickLaunch.bTurboModeEnabled) ShowWindow(GetDlgItem(hDlg, IDC_CHECK_TURBO_MODE), SW_SHOW); @@ -2206,6 +2298,7 @@ LRESULT CALLBACK DlgProcQuickLaunch(HWND hDlg, UINT msg, WPARAM wParam, LONG lPa switch(LOWORD(wParam)) { case IDWIZNEXT: + SaveWindowPosition(hDlg); if(diQuickLaunch.bTurboModeEnabled) { if(IsDlgButtonChecked(hDlg, IDC_CHECK_TURBO_MODE) == BST_CHECKED) @@ -2219,6 +2312,7 @@ LRESULT CALLBACK DlgProcQuickLaunch(HWND hDlg, UINT msg, WPARAM wParam, LONG lPa break; case IDWIZBACK: + SaveWindowPosition(hDlg); /* remember the last state of the TurboMode checkbox */ if(IsDlgButtonChecked(hDlg, IDC_CHECK_TURBO_MODE) == BST_CHECKED) { diQuickLaunch.bTurboMode = TRUE; @@ -2244,7 +2338,6 @@ LRESULT CALLBACK DlgProcQuickLaunch(HWND hDlg, UINT msg, WPARAM wParam, LONG lPa LRESULT CALLBACK DlgProcStartInstall(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) { - RECT rDlg; LPSTR szMessage = NULL; switch(msg) @@ -2264,14 +2357,7 @@ LRESULT CALLBACK DlgProcStartInstall(HWND hDlg, UINT msg, WPARAM wParam, LONG lP SendDlgItemMessage (hDlg, IDC_MESSAGE0, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hDlg, IDC_CURRENT_SETTINGS, WM_SETFONT, (WPARAM)sgInstallGui.systemFont, 0L); - if(GetClientRect(hDlg, &rDlg)) - SetWindowPos(hDlg, - HWND_TOP, - (gSystemInfo.dwScreenX/2)-(rDlg.right/2), - (gSystemInfo.dwScreenY/2)-(rDlg.bottom/2), - 0, - 0, - SWP_NOSIZE); + RepositionWindow(hDlg, NO_BANNER_IMAGE); if((diAdvancedSettings.bShowDialog == FALSE) || (GetTotalArchivesToDownload() == 0)) { @@ -2296,11 +2382,13 @@ LRESULT CALLBACK DlgProcStartInstall(HWND hDlg, UINT msg, WPARAM wParam, LONG lP switch(LOWORD(wParam)) { case IDWIZNEXT: + SaveWindowPosition(hDlg); DestroyWindow(hDlg); DlgSequence(NEXT_DLG); break; case IDWIZBACK: + SaveWindowPosition(hDlg); DestroyWindow(hDlg); DlgSequence(PREV_DLG); break; @@ -2322,7 +2410,6 @@ LRESULT CALLBACK DlgProcReboot(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) HANDLE hToken; TOKEN_PRIVILEGES tkp; HWND hRadioYes; - RECT rDlg; hRadioYes = GetDlgItem(hDlg, IDC_RADIO_YES); @@ -2333,14 +2420,7 @@ LRESULT CALLBACK DlgProcReboot(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) CheckDlgButton(hDlg, IDC_RADIO_YES, BST_CHECKED); SetFocus(hRadioYes); - if(GetClientRect(hDlg, &rDlg)) - SetWindowPos(hDlg, - HWND_TOP, - (gSystemInfo.dwScreenX/2)-(rDlg.right/2), - (gSystemInfo.dwScreenY/2)-(rDlg.bottom/2), - 0, - 0, - SWP_NOSIZE); + RepositionWindow(hDlg, NO_BANNER_IMAGE); SetDlgItemText(hDlg, 202, sgInstallGui.szSetupMessage); SetDlgItemText(hDlg, IDC_RADIO_YES, sgInstallGui.szYesRestart); @@ -2353,6 +2433,7 @@ LRESULT CALLBACK DlgProcReboot(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) break; case WM_COMMAND: + SaveWindowPosition(hDlg); switch(LOWORD(wParam)) { case IDOK: @@ -2425,21 +2506,14 @@ LRESULT CALLBACK DlgProcMessage(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) lstrcpy(szBuf, sgProduct.szProductName); SetWindowText(hDlg, szBuf); - if(GetClientRect(hDlg, &rDlg)) - SetWindowPos(hDlg, - HWND_TOP, - (gSystemInfo.dwScreenX/2)-(rDlg.right/2), - (gSystemInfo.dwScreenY/2)-(rDlg.bottom/2), - 0, - 0, - SWP_NOSIZE); - + RepositionWindow(hDlg, NO_BANNER_IMAGE); break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_MESSAGE: + SaveWindowPosition(hDlg); hdcSTMessage = GetWindowDC(hSTMessage); SystemParametersInfo(SPI_GETICONTITLELOGFONT, @@ -2456,12 +2530,12 @@ LRESULT CALLBACK DlgProcMessage(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) DeleteObject(hfontTmp); ReleaseDC(hSTMessage, hdcSTMessage); - SetWindowPos(hDlg, HWND_TOP, - (gSystemInfo.dwScreenX/2)-((sizeString.cx + 55)/2), - (gSystemInfo.dwScreenY/2)-((sizeString.cy + 50)/2), + SetWindowPos(hDlg, NULL, + (gSystemInfo.lastWindowPosCenterX)-((sizeString.cx + 55)/2), + (gSystemInfo.lastWindowPosCenterY)-((sizeString.cy + 50)/2), sizeString.cx + 55, sizeString.cy + 50, - SWP_SHOWWINDOW); + SWP_SHOWWINDOW|SWP_NOZORDER); if(GetClientRect(hDlg, &rDlg)) SetWindowPos(hSTMessage, @@ -2470,7 +2544,7 @@ LRESULT CALLBACK DlgProcMessage(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) rDlg.top, rDlg.right, rDlg.bottom, - SWP_SHOWWINDOW); + SWP_SHOWWINDOW|SWP_NOZORDER); SetDlgItemText(hDlg, IDC_MESSAGE, (LPSTR)lParam); break; @@ -2495,9 +2569,12 @@ void ShowMessage(LPSTR szMessage, BOOL bShow) { char szBuf[MAX_BUF]; + if(!hDlgMessage ||!szMessage) + return; + if(sgProduct.mode != SILENT) { - if((bShow) && (hDlgMessage == NULL)) + if(bShow) { ZeroMemory(szBuf, sizeof(szBuf)); GetPrivateProfileString("Messages", "MB_MESSAGE_STR", "", szBuf, sizeof(szBuf), szFileIniInstall); @@ -2505,8 +2582,9 @@ void ShowMessage(LPSTR szMessage, BOOL bShow) SendMessage(hDlgMessage, WM_COMMAND, IDC_MESSAGE, (LPARAM)szMessage); SendDlgItemMessage (hDlgMessage, IDC_MESSAGE, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); } - else if(!bShow && hDlgMessage) + else { + SaveWindowPosition(hDlgMessage); DestroyWindow(hDlgMessage); hDlgMessage = NULL; } diff --git a/mozilla/xpinstall/wizard/windows/setup/dialogs.h b/mozilla/xpinstall/wizard/windows/setup/dialogs.h index 2935f6748cd..3331bfb613d 100644 --- a/mozilla/xpinstall/wizard/windows/setup/dialogs.h +++ b/mozilla/xpinstall/wizard/windows/setup/dialogs.h @@ -64,6 +64,8 @@ WNDPROC SubclassWindow( HWND hWnd, WNDPROC NewWndProc); LRESULT CALLBACK ListBoxBrowseWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); void DisableSystemMenuItems(HWND hWnd, BOOL bDisableClose); void CommitInstall(void); +void RepositionWindow(HWND aHwndDlg, DWORD aBannerImage); +void SaveWindowPosition(HWND aDlg); #endif /* _DIALOGS_H_ */ diff --git a/mozilla/xpinstall/wizard/windows/setup/extern.h b/mozilla/xpinstall/wizard/windows/setup/extern.h index 1f3f8eb88ed..a6a4a1f1e92 100644 --- a/mozilla/xpinstall/wizard/windows/setup/extern.h +++ b/mozilla/xpinstall/wizard/windows/setup/extern.h @@ -78,6 +78,7 @@ extern BOOL gbDownloadTriggered; extern BOOL gbAllowMultipleInstalls; extern BOOL gbForceInstall; extern BOOL gbForceInstallGre; +extern BOOL gShowBannerImage; extern setupGen sgProduct; extern diS diSetup; diff --git a/mozilla/xpinstall/wizard/windows/setup/extra.c b/mozilla/xpinstall/wizard/windows/setup/extra.c index e3b9fa92167..451a4771693 100644 --- a/mozilla/xpinstall/wizard/windows/setup/extra.c +++ b/mozilla/xpinstall/wizard/windows/setup/extra.c @@ -138,6 +138,9 @@ BOOL InitInstance(HINSTANCE hInstance, DWORD dwCmdShow) gSystemInfo.dwScreenX = GetSystemMetrics(SM_CXSCREEN); gSystemInfo.dwScreenY = GetSystemMetrics(SM_CYSCREEN); + gSystemInfo.lastWindowPosCenterX = gSystemInfo.dwScreenX / 2; + gSystemInfo.lastWindowPosCenterY = gSystemInfo.dwScreenY / 2; + hInst = hInstance; hWndMain = NULL; @@ -5362,6 +5365,47 @@ void ResolveDependees(LPSTR szToggledReferenceName, HWND hwndListBox) ResolveDependees(szToggledReferenceName, hwndListBox); } +/* Function: ReplacePrivateProfileStrCR() + * + * in: LPSTR aInputOutputStr: In/out string to containing "\\n" to replace. + * + * purpose: To parse for and replace "\\n" string with "\n". Strings stored + * in .ini files cannot contain "\n" because it's a key delimiter. + * To work around this limination, "\\n" chars can be used to + * represent '\n'. This function will look for "\\n" and replace + * them with a true "\n". + * If it encounters a string of "\\\\n" (which looks like '\\n'), + * then this function will strip out the extra '\\' and just show + * "\\n"; + */ +void ReplacePrivateProfileStrCR(LPSTR aInputOutputStr) +{ + LPSTR pSearch = aInputOutputStr; + LPSTR pSearchEnd = aInputOutputStr + lstrlen(aInputOutputStr); + LPSTR pPreviousSearch = NULL; + + while (pSearch < pSearchEnd) + { + if (('\\' == *pSearch) || ('n' == *pSearch)) + { + // found a '\\' or 'n'. check to see if the prefivous char is also a '\\'. + if (pPreviousSearch && ('\\' == *pPreviousSearch)) + { + if ('n' == *pSearch) + *pSearch = '\n'; + + memmove(pPreviousSearch, pSearch, pSearchEnd-pSearch+1); + + // our string is shorter now ... + pSearchEnd -= pSearch - pPreviousSearch; + } + } + + pPreviousSearch = pSearch; + pSearch = CharNext(pSearch); + } +} + void PrintUsage(void) { char szBuf[MAX_BUF]; @@ -5376,6 +5420,7 @@ void PrintUsage(void) * -greLocal: Forces GRE to be installed into the application dir. * -greShared: Forces GRE to be installed into a global, shared dir (normally * c:\program files\common files\mozilla.org\GRE + * -reg_path [path]: Where to make entries in the Windows registry. (Shared installs) * -f: Force install of GRE installer (Shared installs), though it'll work * for non GRE installers too. * -greForce: Force 'Component GRE' to be downloaded, run, and installed. This @@ -5384,11 +5429,14 @@ void PrintUsage(void) * -n [filename]: setup's parent's process filename * -ma: run setup in Auto mode * -mmi: Allow multiple installer instances. (Shared installs) + * -showBanner: Show the banner in the download and install process dialogs. + * This will override config.ini + * -hideBanner: Hides the banner in the download and install process dialogs. + * This will override config.ini * -ms: run setup in Silent mode * -ira: ignore the [RunAppX] sections * -ispf: ignore the [Program FolderX] sections that show * the Start Menu shortcut folder at the end of installation. - * -reg_path [path]: Where to make entries in the Windows registry. (Shared installs) */ if(sgProduct.szParentProcessFilename && *sgProduct.szParentProcessFilename != '\0') @@ -5402,12 +5450,74 @@ void PrintUsage(void) GetPrivateProfileString("Strings", "UsageMsg Usage", "", szBuf, sizeof(szBuf), szFileIniConfig); if (lstrlen(szBuf) > 0) { - wsprintf(szUsageMsg, szBuf, szProcessFilename, "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n"); - PrintError(szUsageMsg, ERROR_CODE_HIDE); + char strUsage[MAX_BUF]; + + ReplacePrivateProfileStrCR(szBuf); + _snprintf(szUsageMsg, sizeof(szUsageMsg), szBuf, szProcessFilename); + GetPrivateProfileString("Messages", "TITLE_USAGE", "", strUsage, sizeof(strUsage), szFileIniInstall); + MessageBox(hWndMain, szUsageMsg, strUsage, MB_ICONEXCLAMATION); } } -DWORD ParseCommandLine(LPSTR lpszCmdLine) +/* Function: ParseForStartupOptions() + * in: aCmdLine + * purpose: Parses for options that affect the initialization of setup.exe, + * such as -ms, -ma, -mmi. + * This is required to be parsed this early because setup needs to + * know if dialogs need to be shown (-ms, -ma) and also where to + * create the temp directory for temporary items to be placed at + * (-mmi). + */ +DWORD ParseForStartupOptions(LPSTR aCmdLine) +{ + char szArgVBuf[MAX_BUF]; + int i; + int iArgC; + +#ifdef XXX_DEBUG + char szBuf[MAX_BUF]; + char szOutputStr[MAX_BUF]; +#endif + + iArgC = GetArgC(aCmdLine); + +#ifdef XXX_DEBUG + wsprintf(szOutputStr, "ArgC: %d\n", iArgC); +#endif + + i = 0; + while(i < iArgC) + { + GetArgV(aCmdLine, i, szArgVBuf, sizeof(szArgVBuf)); + + if(!lstrcmpi(szArgVBuf, "-mmi") || !lstrcmpi(szArgVBuf, "/mmi")) + { + gbAllowMultipleInstalls = TRUE; + } + else if(!lstrcmpi(szArgVBuf, "-ma") || !lstrcmpi(szArgVBuf, "/ma")) + SetSetupRunMode("AUTO"); + else if(!lstrcmpi(szArgVBuf, "-ms") || !lstrcmpi(szArgVBuf, "/ms")) + SetSetupRunMode("SILENT"); + +#ifdef XXX_DEBUG + itoa(i, szBuf, 10); + lstrcat(szOutputStr, " "); + lstrcat(szOutputStr, szBuf); + lstrcat(szOutputStr, ": "); + lstrcat(szOutputStr, szArgVBuf); + lstrcat(szOutputStr, "\n"); +#endif + + ++i; + } + +#ifdef XXX_DEBUG + MessageBox(NULL, szOutputStr, "Output", MB_OK); +#endif + return(WIZ_OK); +} + +DWORD ParseCommandLine(LPSTR aMessageToClose, LPSTR lpszCmdLine) { char szArgVBuf[MAX_BUF]; int i; @@ -5431,6 +5541,7 @@ DWORD ParseCommandLine(LPSTR lpszCmdLine) if(!lstrcmpi(szArgVBuf, "-h") || !lstrcmpi(szArgVBuf, "/h")) { + ShowMessage(aMessageToClose, FALSE); PrintUsage(); return(WIZ_ERROR_UNDEFINED); } @@ -5462,10 +5573,6 @@ DWORD ParseCommandLine(LPSTR lpszCmdLine) GetArgV(lpszCmdLine, i, szArgVBuf, sizeof(szArgVBuf)); lstrcpy(sgProduct.szParentProcessFilename, szArgVBuf); } - else if(!lstrcmpi(szArgVBuf, "-ma") || !lstrcmpi(szArgVBuf, "/ma")) - SetSetupRunMode("AUTO"); - else if(!lstrcmpi(szArgVBuf, "-ms") || !lstrcmpi(szArgVBuf, "/ms")) - SetSetupRunMode("SILENT"); else if(!lstrcmpi(szArgVBuf, "-ira") || !lstrcmpi(szArgVBuf, "/ira")) /* ignore [RunAppX] sections */ gbIgnoreRunAppX = TRUE; @@ -5500,9 +5607,13 @@ DWORD ParseCommandLine(LPSTR lpszCmdLine) GetArgV(lpszCmdLine, i, szArgVBuf, sizeof(szArgVBuf)); lstrcpy(sgProduct.szRegPath, szArgVBuf); } - else if(!lstrcmpi(szArgVBuf, "-mmi") || !lstrcmpi(szArgVBuf, "/mmi")) + else if(!lstrcmpi(szArgVBuf, "-showBanner") || !lstrcmpi(szArgVBuf, "/showBanner")) { - gbAllowMultipleInstalls = TRUE; + gShowBannerImage = TRUE; + } + else if(!lstrcmpi(szArgVBuf, "-hideBanner") || !lstrcmpi(szArgVBuf, "/hideBanner")) + { + gShowBannerImage = FALSE; } #ifdef XXX_DEBUG @@ -6259,12 +6370,8 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine) /* get main install path */ if(LocatePreviousPath("Locate Previous Product Path", szPreviousPath, sizeof(szPreviousPath)) == FALSE) { - // If the path was set on the command-line than we don't want to use the default here. - if(*sgProduct.szPath == '\0') - { - GetPrivateProfileString("General", "Path", "", szBuf, sizeof(szBuf), szFileIniConfig); - DecryptString(sgProduct.szPath, szBuf); - } + GetPrivateProfileString("General", "Path", "", szBuf, sizeof(szBuf), szFileIniConfig); + DecryptString(sgProduct.szPath, szBuf); } else { @@ -6362,11 +6469,15 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine) GetPrivateProfileString("General", "GRE Private Key", "", szBuf, sizeof(szBuf), szFileIniConfig); if(*szBuf != '\0') - { DecryptString(sgProduct.grePrivateKey, szBuf); - lstrcat(sgProduct.grePrivateKey, "_"); - lstrcat(sgProduct.grePrivateKey, sgProduct.szProductNameInternal); - } + + GetPrivateProfileString("General", "Show Banner Image", "", szBuf, sizeof(szBuf), szFileIniConfig); + if(lstrcmpi(szBuf, "FALSE") == 0) + gShowBannerImage = FALSE; + + iRv = ParseCommandLine(szMsgInitSetup, lpszCmdLine); + if(iRv) + return(iRv); /* Welcome dialog */ GetPrivateProfileString("Dialog Welcome", "Show Dialog", "", szShowDialog, sizeof(szShowDialog), szFileIniConfig); @@ -6716,7 +6827,7 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine) wsprintf(szTitle, szBuf, sgProduct.szProductName); GetPrivateProfileString("Strings", "Message Unfinished Download Restart", "", szBuf, sizeof(szBuf), szFileIniConfig); - if(MessageBox(hWndMain, szBuf, szTitle, MB_YESNO | MB_ICONQUESTION) == IDNO) + if(MessageBox(hWndMain, szBuf, szTitle, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDNO) { UnsetSetupCurrentDownloadFile(); UnsetSetupState(); /* unset the download state so that the archives can be deleted */ @@ -6743,7 +6854,7 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine) wsprintf(szTitle, szBuf, sgProduct.szProductName); GetPrivateProfileString("Strings", "Message Unfinished Install Xpi Restart", "", szBuf, sizeof(szBuf), szFileIniConfig); - if(MessageBox(hWndMain, szBuf, szTitle, MB_YESNO | MB_ICONQUESTION) == IDNO) + if(MessageBox(hWndMain, szBuf, szTitle, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDNO) { UnsetSetupCurrentDownloadFile(); UnsetSetupState(); /* unset the installing xpis state so that the archives can be deleted */ diff --git a/mozilla/xpinstall/wizard/windows/setup/extra.h b/mozilla/xpinstall/wizard/windows/setup/extra.h index d7c19f847bc..8a05ff8f426 100644 --- a/mozilla/xpinstall/wizard/windows/setup/extra.h +++ b/mozilla/xpinstall/wizard/windows/setup/extra.h @@ -169,7 +169,8 @@ LPSTR GetArgV(LPSTR lpszCommandLine, int iIndex, LPSTR lpszDest, int iDestSize); -DWORD ParseCommandLine(LPSTR lpszCmdLine); +DWORD ParseCommandLine(LPSTR aMessageToClose, LPSTR lpszCmdLine); +DWORD ParseForStartupOptions(LPSTR aCmdLine); void SetSetupRunMode(LPSTR szMode); void Delay(DWORD dwSeconds); void UnsetSetupState(void); @@ -224,6 +225,7 @@ HRESULT ProcessXpinstallEngine(void); void GetXpinstallPath(char *aPath, int aPathBufSize); int AddGrePathToApplicationAppPathsKey(void); BOOL GreInstallerNeedsReboot(void); +void ReplacePrivateProfileStrCR(LPSTR aInputOutputStr); #endif /* _EXTRA_H_ */ diff --git a/mozilla/xpinstall/wizard/windows/setup/setup.c b/mozilla/xpinstall/wizard/windows/setup/setup.c index 96f923a2fdd..f5a9444c143 100644 --- a/mozilla/xpinstall/wizard/windows/setup/setup.c +++ b/mozilla/xpinstall/wizard/windows/setup/setup.c @@ -60,8 +60,6 @@ LPSTR szSiteSelectorDescription; DWORD dwWizardState; DWORD dwSetupType; -DWORD dwScreenX; -DWORD dwScreenY; DWORD dwTempSetupType; DWORD gdwUpgradeValue; @@ -84,6 +82,7 @@ BOOL gbForceInstall = FALSE; * GRE is appropriately versioned. See bug 180383 */ BOOL gbForceInstallGre = TRUE; +BOOL gShowBannerImage = TRUE; setupGen sgProduct; diS diSetup; @@ -137,7 +136,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmd { if(InitSetupGeneral()) PostQuitMessage(1); - else if(ParseCommandLine(lpszCmdLine)) + else if(ParseForStartupOptions(lpszCmdLine)) PostQuitMessage(1); else if((hwndFW = FindWindow(CLASS_NAME_SETUP_DLG, NULL)) != NULL && !gbAllowMultipleInstalls) { diff --git a/mozilla/xpinstall/wizard/windows/setup/setup.h b/mozilla/xpinstall/wizard/windows/setup/setup.h index 0c1565a558a..6ea5f764ff4 100644 --- a/mozilla/xpinstall/wizard/windows/setup/setup.h +++ b/mozilla/xpinstall/wizard/windows/setup/setup.h @@ -92,6 +92,10 @@ typedef int PRInt32; #define INCLUDE_INVISIBLE_OBJS TRUE #define SKIP_INVISIBLE_OBJS FALSE +#define NO_BANNER_IMAGE 0x00000000 +#define BANNER_IMAGE_DOWNLOAD 0x00000001 +#define BANNER_IMAGE_INSTALLING 0x00000002 + #define APPPATH_GRE_PATH_SET 0x00000000 #define APPPATH_GRE_PATH_NOT_SET 0x00000001 #define APPPATH_GRE_PATH_ALREADY_SET 0x00000002 @@ -612,6 +616,8 @@ struct sSysInfo DWORD dwMemoryAvailablePhysical; DWORD dwScreenX; DWORD dwScreenY; + DWORD lastWindowPosCenterX; + DWORD lastWindowPosCenterY; BOOL bScreenReader; BOOL bRefreshIcons; }; diff --git a/mozilla/xpinstall/wizard/windows/setup/xpi.c b/mozilla/xpinstall/wizard/windows/setup/xpi.c index ac2b5cbea29..53c3d585a93 100644 --- a/mozilla/xpinstall/wizard/windows/setup/xpi.c +++ b/mozilla/xpinstall/wizard/windows/setup/xpi.c @@ -442,21 +442,6 @@ void cbXPIFinal(const char *URL, PRInt32 finalStatus) ///////////////////////////////////////////////////////////////////////////// // Progress bar -// Centers the specified window over the desktop. Assumes the window is -// smaller both horizontally and vertically than the desktop -static void -CenterWindow(HWND hWndDlg) -{ - RECT rect; - int iLeft, iTop; - - GetWindowRect(hWndDlg, &rect); - iLeft = (GetSystemMetrics(SM_CXSCREEN) - (rect.right - rect.left)) / 2; - iTop = (GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top)) / 2; - - SetWindowPos(hWndDlg, NULL, iLeft, iTop, -1, -1, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); -} - // Window proc for dialog LRESULT CALLBACK ProgressDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -465,7 +450,7 @@ ProgressDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { case WM_INITDIALOG: DisableSystemMenuItems(hWndDlg, TRUE); - CenterWindow(hWndDlg); + RepositionWindow(hWndDlg, BANNER_IMAGE_INSTALLING); SendDlgItemMessage (hWndDlg, IDC_STATUS0, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hWndDlg, IDC_GAUGE_ARCHIVE, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hWndDlg, IDC_STATUS3, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); @@ -839,6 +824,7 @@ void DeInitProgressDlg() { if(sgProduct.mode != SILENT) { + SaveWindowPosition(dlgInfo.hWndDlg); DestroyWindow(dlgInfo.hWndDlg); UnregisterClass("GaugeFile", hInst); UnregisterClass("GaugeArchive", hInst); diff --git a/mozilla/xpinstall/wizard/windows/setup/xpnetHook.cpp b/mozilla/xpinstall/wizard/windows/setup/xpnetHook.cpp index 8c49a983739..1e0e8e79826 100644 --- a/mozilla/xpinstall/wizard/windows/setup/xpnetHook.cpp +++ b/mozilla/xpinstall/wizard/windows/setup/xpnetHook.cpp @@ -1229,23 +1229,6 @@ int ProgressCB(int aBytesSoFar, int aTotalFinalSize) return(iRv); } -///////////////////////////////////////////////////////////////////////////// -// Progress bar -// Centers the specified window over the desktop. Assumes the window is -// smaller both horizontally and vertically than the desktop -static void -CenterWindow(HWND hWndDlg) -{ - RECT rect; - int iLeft, iTop; - - GetWindowRect(hWndDlg, &rect); - iLeft = (GetSystemMetrics(SM_CXSCREEN) - (rect.right - rect.left)) / 2; - iTop = (GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top)) / 2; - - SetWindowPos(hWndDlg, NULL, iLeft, iTop, -1, -1, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); -} - // Window proc for dialog LRESULT CALLBACK DownloadDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -1260,7 +1243,7 @@ DownloadDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam) sizeof(gszFileInfo), szFileIniConfig); DisableSystemMenuItems(hWndDlg, FALSE); - CenterWindow(hWndDlg); + RepositionWindow(hWndDlg, BANNER_IMAGE_DOWNLOAD); if(gbShowDownloadRetryMsg) SetDlgItemText(hWndDlg, IDC_MESSAGE0, diDownload.szMessageRetry0); else @@ -1285,7 +1268,6 @@ DownloadDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam) SendDlgItemMessage (hWndDlg, IDC_STATUS_FILE, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hWndDlg, IDC_STATUS_URL, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hWndDlg, IDC_STATUS_TO, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); - return FALSE; case WM_SIZE: @@ -1534,6 +1516,7 @@ void DeInitDownloadDlg() { if(sgProduct.mode != SILENT) { + SaveWindowPosition(dlgInfo.hWndDlg); DestroyWindow(dlgInfo.hWndDlg); UnregisterClass("GaugeFile", hInst); } diff --git a/mozilla/xpinstall/wizard/windows/setuprsc/setuprsc.h b/mozilla/xpinstall/wizard/windows/setuprsc/setuprsc.h index 8831867a819..bc0465e8710 100644 --- a/mozilla/xpinstall/wizard/windows/setuprsc/setuprsc.h +++ b/mozilla/xpinstall/wizard/windows/setuprsc/setuprsc.h @@ -16,7 +16,7 @@ #define IDI_SETUP 105 #define IDB_BITMAP_WELCOME 108 #define DLG_MESSAGE 110 -#define IDB_BITMAP_DOWNLOAD_LOGO 114 +#define IDB_BITMAP_BANNER 114 #define IDB_QUICK_LAUNCH 115 #define DLG_BROWSE_DIR 503 #define IDC_STATUS 1001 @@ -141,7 +141,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 116 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1078 +#define _APS_NEXT_CONTROL_VALUE 1079 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/mozilla/xpinstall/wizard/windows/setuprsc/setuprsc.rc b/mozilla/xpinstall/wizard/windows/setuprsc/setuprsc.rc index e83033cb057..2854f6c4b85 100644 --- a/mozilla/xpinstall/wizard/windows/setuprsc/setuprsc.rc +++ b/mozilla/xpinstall/wizard/windows/setuprsc/setuprsc.rc @@ -298,7 +298,7 @@ BEGIN #ifndef __MINGW32__ 114, #endif - IDC_STATIC,"Static",SS_BITMAP,0,0,312,34 + IDB_BITMAP_BANNER,"Static",SS_BITMAP,0,0,312,34 END DLG_ADVANCED_SETTINGS DIALOG DISCARDABLE 51, 56, 315, 205 @@ -431,7 +431,7 @@ BEGIN #ifndef __MINGW32__ 114, #endif - IDC_STATIC,"Static",SS_BITMAP,0,0,312,34 + IDB_BITMAP_BANNER,"Static",SS_BITMAP,0,0,312,34 LTEXT "",IDC_STATIC4,9,91,37,8,SS_NOPREFIX CONTROL "",IDC_STATUS_TO,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_GROUP,49,91,253,8 @@ -478,7 +478,7 @@ IDB_BOX_UNCHECKED BITMAP FIXED IMPURE "box_unch.bmp" IDB_BOX_CHECKED BITMAP FIXED IMPURE "box_chec.bmp" IDB_BITMAP_WELCOME BITMAP DISCARDABLE "bitmap1.bmp" IDB_BOX_CHECKED_DISABLED BITMAP FIXED IMPURE "box_ch_d.bmp" -IDB_BITMAP_DOWNLOAD_LOGO BITMAP DISCARDABLE "downloadLogo.bmp" +IDB_BITMAP_BANNER BITMAP DISCARDABLE "downloadLogo.bmp" IDB_QUICK_LAUNCH BITMAP DISCARDABLE "turbo-systray.bmp" /////////////////////////////////////////////////////////////////////////////