diff --git a/xpinstall/wizard/windows/setup/dialogs.c b/xpinstall/wizard/windows/setup/dialogs.c index c07bd5768be5..971d6ab3f341 100644 --- a/xpinstall/wizard/windows/setup/dialogs.c +++ b/xpinstall/wizard/windows/setup/dialogs.c @@ -440,6 +440,59 @@ BOOL BrowseForDirectory(HWND hDlg, char *szCurrDir) return(bRet); } +void TruncateString(HWND hWnd, LPSTR szInPath, DWORD dwInPathBufSize, LPSTR szOutPath, DWORD dwOutPathBufSize) +{ + HDC hdcWnd; + LOGFONT logFont; + HFONT hfontTmp; + HFONT hfontOld; + RECT rWndRect; + SIZE sizeString; + BOOL bChopped; + + ZeroMemory(szOutPath, dwOutPathBufSize); + if(dwInPathBufSize > dwOutPathBufSize) + return; + + if(lstrlen(szInPath) == 0) + return; + + lstrcpy(szOutPath, szInPath); + hdcWnd = GetWindowDC(hWnd); + GetClientRect(hWnd, &rWndRect); + SystemParametersInfo(SPI_GETICONTITLELOGFONT, + sizeof(logFont), + (PVOID)&logFont, + 0); + + hfontTmp = CreateFontIndirect(&logFont); + + if(hfontTmp) + hfontOld = SelectObject(hdcWnd, hfontTmp); + + bChopped = FALSE; + GetTextExtentPoint32(hdcWnd, szOutPath, lstrlen(szOutPath), &sizeString); + while(sizeString.cx > rWndRect.right) + { + szOutPath[lstrlen(szOutPath) - 1] = '\0'; + GetTextExtentPoint32(hdcWnd, szOutPath, lstrlen(szOutPath), &sizeString); + bChopped = TRUE; + } + + if(bChopped) + { + DWORD dwLen = lstrlen(szOutPath); + + szOutPath[dwLen - 1] = '.'; + szOutPath[dwLen - 2] = '.'; + szOutPath[dwLen - 3] = '.'; + } + + SelectObject(hdcWnd, hfontOld); + DeleteObject(hfontTmp); + ReleaseDC(hWnd, hdcWnd); +} + LRESULT CALLBACK DlgProcSetupType(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) { HWND hRadioSt0; @@ -451,6 +504,7 @@ LRESULT CALLBACK DlgProcSetupType(HWND hDlg, UINT msg, WPARAM wParam, LONG lPara HWND hRadioSt3; HWND hStaticSt3; HWND hReadme; + HWND hDestinationPath; RECT rDlg; char szBuf[MAX_BUF]; char szBufTemp[MAX_BUF]; @@ -471,7 +525,10 @@ LRESULT CALLBACK DlgProcSetupType(HWND hDlg, UINT msg, WPARAM wParam, LONG lPara case WM_INITDIALOG: SetWindowText(hDlg, diSetupType.szTitle); - SetDlgItemText(hDlg, IDC_EDIT_DESTINATION, szTempSetupPath); + hDestinationPath = GetDlgItem(hDlg, IDC_EDIT_DESTINATION); /* handle to the static destination path text window */ + TruncateString(hDestinationPath, szTempSetupPath, MAX_BUF, szBuf, sizeof(szBuf)); + + SetDlgItemText(hDlg, IDC_EDIT_DESTINATION, szBuf); SetDlgItemText(hDlg, IDC_STATIC_MSG0, diSetupType.szMessage0); if(diSetupType.stSetupType0.bVisible) @@ -1925,14 +1982,13 @@ LRESULT CALLBACK DlgProcReboot(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) LRESULT CALLBACK DlgProcMessage(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) { - RECT rDlg; - HWND hSTMessage = GetDlgItem(hDlg, IDC_MESSAGE); /* handle to the Static Text message window */ - HDC hdcSTMessage; - SIZE sizeString; - int iLen; -// int iCount; -// int iCharWidth; -// UINT uiTotalWidth; + RECT rDlg; + HWND hSTMessage = GetDlgItem(hDlg, IDC_MESSAGE); /* handle to the Static Text message window */ + HDC hdcSTMessage; + SIZE sizeString; + LOGFONT logFont; + HFONT hfontTmp; + HFONT hfontOld; switch(msg) { @@ -1944,28 +2000,33 @@ LRESULT CALLBACK DlgProcMessage(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) { case IDC_MESSAGE: hdcSTMessage = GetWindowDC(hSTMessage); - iLen = lstrlen((LPSTR)lParam); - GetTextExtentPoint32(hdcSTMessage, (LPSTR)lParam, iLen, &sizeString); -/* uiTotalWidth = 0; - for(iCount = 0; iCount < iLen; iCount ++) - { - GetCharWidth32(hdcSTMessage, ((LPSTR)lParam)[iCount], ((LPSTR)lParam)[iCount], &iCharWidth); - uiTotalWidth += iCharWidth; - } -*/ + SystemParametersInfo(SPI_GETICONTITLELOGFONT, + sizeof(logFont), + (PVOID)&logFont, + 0); + hfontTmp = CreateFontIndirect(&logFont); + if(hfontTmp) + hfontOld = SelectObject(hdcSTMessage, hfontTmp); + + GetTextExtentPoint32(hdcSTMessage, (LPSTR)lParam, lstrlen((LPSTR)lParam), &sizeString); + SelectObject(hdcSTMessage, hfontOld); + DeleteObject(hfontTmp); ReleaseDC(hSTMessage, hdcSTMessage); SetWindowPos(hDlg, HWND_TOP, - (dwScreenX/2)-((sizeString.cx - (iLen * 1))/2), (dwScreenY/2)-((sizeString.cy + 50)/2), - (sizeString.cx - (iLen * 1)), sizeString.cy + 50, - SWP_SHOWWINDOW); + (dwScreenX/2)-((sizeString.cx + 40)/2), (dwScreenY/2)-((sizeString.cy + 40)/2), + sizeString.cx + 40, sizeString.cy + 40, + SWP_SHOWWINDOW); if(GetClientRect(hDlg, &rDlg)) - SetWindowPos(hSTMessage, HWND_TOP, - rDlg.left, rDlg.top, - (sizeString.cx - (iLen * 1)), rDlg.bottom, + SetWindowPos(hSTMessage, + HWND_TOP, + rDlg.left, + rDlg.top, + rDlg.right, + rDlg.bottom, SWP_SHOWWINDOW); SetDlgItemText(hDlg, IDC_MESSAGE, (LPSTR)lParam); diff --git a/xpinstall/wizard/windows/setup/dialogs.h b/xpinstall/wizard/windows/setup/dialogs.h index 78f4c1738ba4..a4214b69191b 100644 --- a/xpinstall/wizard/windows/setup/dialogs.h +++ b/xpinstall/wizard/windows/setup/dialogs.h @@ -56,5 +56,6 @@ void CheckWizardStateCustom(DWORD dwDefault); void SunJavaDependencyHack(DWORD dwIndex, BOOL bSelected, DWORD dwACFlag); LPSTR GetStartInstallMessage(void); void AppendStringWOAmpersand(LPSTR szInputString, DWORD dwInputStringSize, LPSTR szString); +void TruncateString(HWND hWnd, LPSTR szInPath, DWORD dwInPathBufSize, LPSTR szOutPath, DWORD dwOutPathBufSize); #endif diff --git a/xpinstall/wizard/windows/setup/extra.c b/xpinstall/wizard/windows/setup/extra.c index 4b3fdd21f4c4..c874ecfabaa6 100644 --- a/xpinstall/wizard/windows/setup/extra.c +++ b/xpinstall/wizard/windows/setup/extra.c @@ -50,6 +50,11 @@ TCHAR INDEX_PROCTHRD_OBJ[2*INDEX_STR_LEN]; DWORD PX_PROCESS; DWORD PX_THREAD; +char *FontColorMap[] = {"WHITE", "0x00EEEEEE", + "BLACK", "0x00000000", + "GREEN", "0x00088808", + ""}; + BOOL CheckProcessNT4(LPSTR szProcessName, DWORD dwProcessNameSize); DWORD GetTitleIdx(HWND hWnd, LPTSTR Title[], DWORD LastIndex, LPTSTR Name); PPERF_OBJECT FindObject (PPERF_DATA pData, DWORD TitleIndex); @@ -4023,17 +4028,26 @@ BOOL CheckLegacy(HWND hDlg) COLORREF DecryptFontColor(LPSTR szColor) { - if((szColor == NULL) || (*szColor == '\0')) - return(0x00EEEEEE); + int i = 0; + long lFontColor = 0x00EEEEEE; - if(lstrcmpi(szColor, "WHITE") == 0) - return(0x00EEEEEE); - else if(lstrcmpi(szColor, "BLACK") == 0) - return(0x00000000); - else if(lstrcmpi(szColor, "GREEN") == 0) - return(0x00088808); + while(TRUE) + { + if(*FontColorMap[i] == '\0') + break; - return(0x00EEEEEE); + if(lstrcmpi(szColor, FontColorMap[i]) == 0) + { + if(*FontColorMap[i + 1] != '\0') + lFontColor = atol(FontColorMap[i + 1]); + + break; + } + + ++i; + } + + return(lFontColor); } HRESULT ParseConfigIni(LPSTR lpszCmdLine) diff --git a/xpinstall/wizard/windows/setuprsc/setuprsc.rc b/xpinstall/wizard/windows/setuprsc/setuprsc.rc index 0a2c006a4639..74b2f9ea1e07 100644 --- a/xpinstall/wizard/windows/setuprsc/setuprsc.rc +++ b/xpinstall/wizard/windows/setuprsc/setuprsc.rc @@ -94,7 +94,8 @@ BEGIN CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,11,179,295,1, WS_EX_STATICEDGE PUSHBUTTON "Read Me",IDC_README,11,186,53,14 - LTEXT "",IDC_EDIT_DESTINATION,107,160,146,9 + CONTROL "",IDC_EDIT_DESTINATION,"Static",SS_LEFTNOWORDWRAP | + WS_GROUP,107,160,143,9 END DLG_SELECT_COMPONENTS DIALOGEX 51, 56, 315, 205 @@ -207,7 +208,6 @@ END DLG_BROWSE_DIR DIALOGEX 147, 23, 190, 143 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Select a directory" -CLASS "SetupDlg" FONT 8, "MS Shell Dlg" BEGIN EDITTEXT IDC_EDIT_DESTINATION,8,16,177,12,ES_AUTOHSCROLL | @@ -253,8 +253,10 @@ CLASS "SetupDlg" FONT 8, "MS Sans Serif" BEGIN CONTROL "",IDC_GAUGE_FILE,"GaugeFile",0x0,9,52,175,11 - LTEXT "",IDC_STATUS0,9,9,175,8 - LTEXT "",IDC_STATUS3,9,40,175,8 + CONTROL "",IDC_STATUS0,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX | + WS_GROUP,9,9,175,8 + CONTROL "",IDC_STATUS3,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX | + WS_GROUP,9,40,175,8 CONTROL "",IDC_GAUGE_ARCHIVE,"GaugeArchive",0x0,9,21,175,11 END