mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-30 04:13:33 +00:00
[MSPAINT] get rid of all _stprintf occurrences and the respective magic number sized TCHAR arrays
svn path=/trunk/; revision=72945
This commit is contained in:
@@ -76,9 +76,6 @@ ATTDlgWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
TCHAR strrc[100];
|
||||
TCHAR res[100];
|
||||
|
||||
widthSetInDlg = imageModel.GetWidth();
|
||||
heightSetInDlg = imageModel.GetHeight();
|
||||
|
||||
@@ -90,20 +87,19 @@ ATTDlgWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if (isAFile)
|
||||
{
|
||||
TCHAR date[100];
|
||||
TCHAR size[100];
|
||||
TCHAR temp[100];
|
||||
GetDateFormat(LOCALE_USER_DEFAULT, 0, &fileTime, NULL, date, SIZEOF(date));
|
||||
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &fileTime, NULL, temp, SIZEOF(temp));
|
||||
_tcscat(date, _T(" "));
|
||||
_tcscat(date, temp);
|
||||
LoadString(hProgInstance, IDS_FILESIZE, strrc, SIZEOF(strrc));
|
||||
_stprintf(size, strrc, fileSize);
|
||||
CString strSize;
|
||||
strSize.Format(IDS_FILESIZE, fileSize);
|
||||
SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT6, date);
|
||||
SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT7, size);
|
||||
SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT7, strSize);
|
||||
}
|
||||
LoadString(hProgInstance, IDS_PRINTRES, strrc, SIZEOF(strrc));
|
||||
_stprintf(res, strrc, fileHPPM, fileVPPM);
|
||||
SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT8, res);
|
||||
CString strRes;
|
||||
strRes.Format(IDS_PRINTRES, fileHPPM, fileVPPM);
|
||||
SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT8, strRes);
|
||||
return TRUE;
|
||||
}
|
||||
case WM_CLOSE:
|
||||
@@ -128,20 +124,20 @@ ATTDlgWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
case IDD_ATTRIBUTESRB1:
|
||||
{
|
||||
TCHAR number[100];
|
||||
_stprintf(number, _T("%.3lf"), widthSetInDlg / (0.0254 * fileHPPM));
|
||||
SetDlgItemText(hwnd, IDD_ATTRIBUTESEDIT1, number);
|
||||
_stprintf(number, _T("%.3lf"), heightSetInDlg / (0.0254 * fileVPPM));
|
||||
SetDlgItemText(hwnd, IDD_ATTRIBUTESEDIT2, number);
|
||||
CString strNum;
|
||||
strNum.Format(_T("%.3lf"), widthSetInDlg / (0.0254 * fileHPPM));
|
||||
SetDlgItemText(hwnd, IDD_ATTRIBUTESEDIT1, strNum);
|
||||
strNum.Format(_T("%.3lf"), heightSetInDlg / (0.0254 * fileVPPM));
|
||||
SetDlgItemText(hwnd, IDD_ATTRIBUTESEDIT2, strNum);
|
||||
break;
|
||||
}
|
||||
case IDD_ATTRIBUTESRB2:
|
||||
{
|
||||
TCHAR number[100];
|
||||
_stprintf(number, _T("%.3lf"), widthSetInDlg * 100.0 / fileHPPM);
|
||||
SetDlgItemText(hwnd, IDD_ATTRIBUTESEDIT1, number);
|
||||
_stprintf(number, _T("%.3lf"), heightSetInDlg * 100.0 / fileVPPM);
|
||||
SetDlgItemText(hwnd, IDD_ATTRIBUTESEDIT2, number);
|
||||
CString strNum;
|
||||
strNum.Format(_T("%.3lf"), widthSetInDlg * 100.0 / fileHPPM);
|
||||
SetDlgItemText(hwnd, IDD_ATTRIBUTESEDIT1, strNum);
|
||||
strNum.Format(_T("%.3lf"), heightSetInDlg * 100.0 / fileVPPM);
|
||||
SetDlgItemText(hwnd, IDD_ATTRIBUTESEDIT2, strNum);
|
||||
break;
|
||||
}
|
||||
case IDD_ATTRIBUTESRB3:
|
||||
|
||||
@@ -73,13 +73,11 @@ SaveDIBToFile(HBITMAP hBitmap, LPTSTR FileName, HDC hDC, LPSYSTEMTIME time, int
|
||||
|
||||
void ShowFileLoadError(LPCTSTR name)
|
||||
{
|
||||
TCHAR programname[20];
|
||||
TCHAR loaderrortext[100];
|
||||
TCHAR temptext[500];
|
||||
LoadString(hProgInstance, IDS_PROGRAMNAME, programname, SIZEOF(programname));
|
||||
LoadString(hProgInstance, IDS_LOADERRORTEXT, loaderrortext, SIZEOF(loaderrortext));
|
||||
_stprintf(temptext, loaderrortext, name);
|
||||
mainWindow.MessageBox(temptext, programname, MB_OK | MB_ICONEXCLAMATION);
|
||||
CString strText;
|
||||
strText.Format(IDS_LOADERRORTEXT, (LPCTSTR) name);
|
||||
CString strProgramName;
|
||||
strProgramName.LoadString(IDS_PROGRAMNAME);
|
||||
mainWindow.MessageBox(strText, strProgramName, MB_OK | MB_ICONEXCLAMATION);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -252,9 +252,9 @@ LRESULT CImgAreaWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
|
||||
|
||||
if (!drawing)
|
||||
{
|
||||
TCHAR coordStr[100];
|
||||
_stprintf(coordStr, _T("%ld, %ld"), xNow, yNow);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) coordStr);
|
||||
CString strCoord;
|
||||
strCoord.Format(_T("%ld, %ld"), xNow, yNow);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) (LPCTSTR) strCoord);
|
||||
}
|
||||
}
|
||||
if (drawing)
|
||||
@@ -291,9 +291,9 @@ LRESULT CImgAreaWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
|
||||
case TOOL_AIRBRUSH:
|
||||
case TOOL_SHAPE:
|
||||
{
|
||||
TCHAR coordStr[100];
|
||||
_stprintf(coordStr, _T("%ld, %ld"), xNow, yNow);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) coordStr);
|
||||
CString strCoord;
|
||||
strCoord.Format(_T("%ld, %ld"), xNow, yNow);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) (LPCTSTR) strCoord);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -303,11 +303,11 @@ LRESULT CImgAreaWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
|
||||
Invalidate(FALSE);
|
||||
if ((toolsModel.GetActiveTool() >= TOOL_TEXT) || (toolsModel.GetActiveTool() == TOOL_RECTSEL) || (toolsModel.GetActiveTool() == TOOL_FREESEL))
|
||||
{
|
||||
TCHAR sizeStr[100];
|
||||
CString strSize;
|
||||
if ((toolsModel.GetActiveTool() >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0))
|
||||
yRel = xRel;
|
||||
_stprintf(sizeStr, _T("%ld x %ld"), xRel, yRel);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) sizeStr);
|
||||
strSize.Format(_T("%ld x %ld"), xRel, yRel);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) (LPCTSTR) strSize);
|
||||
}
|
||||
}
|
||||
if ((wParam & MK_RBUTTON) != 0)
|
||||
@@ -316,11 +316,11 @@ LRESULT CImgAreaWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
|
||||
Invalidate(FALSE);
|
||||
if (toolsModel.GetActiveTool() >= TOOL_TEXT)
|
||||
{
|
||||
TCHAR sizeStr[100];
|
||||
CString strSize;
|
||||
if ((toolsModel.GetActiveTool() >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0))
|
||||
yRel = xRel;
|
||||
_stprintf(sizeStr, _T("%ld x %ld"), xRel, yRel);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) sizeStr);
|
||||
strSize.Format(_T("%ld x %ld"), xRel, yRel);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) (LPCTSTR) strSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,15 +46,15 @@ void RegistrySettings::SetWallpaper(LPCTSTR szFileName, DWORD dwStyle, DWORD dwT
|
||||
CRegKey desktop;
|
||||
if (desktop.Open(HKEY_CURRENT_USER, _T("Control Panel\\Desktop")) == ERROR_SUCCESS)
|
||||
{
|
||||
TCHAR szStyle[3], szTile[3];
|
||||
CString strStyle, strTile;
|
||||
|
||||
desktop.SetStringValue(_T("Wallpaper"), szFileName);
|
||||
|
||||
_stprintf(szStyle, _T("%lu"), dwStyle);
|
||||
_stprintf(szTile, _T("%lu"), dwTile);
|
||||
strStyle.Format(_T("%lu"), dwStyle);
|
||||
strTile.Format(_T("%lu"), dwTile);
|
||||
|
||||
desktop.SetStringValue(_T("WallpaperStyle"), szStyle);
|
||||
desktop.SetStringValue(_T("TileWallpaper"), szTile);
|
||||
desktop.SetStringValue(_T("WallpaperStyle"), strStyle);
|
||||
desktop.SetStringValue(_T("TileWallpaper"), strTile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,6 @@ LRESULT CSelectionWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, B
|
||||
{
|
||||
if (m_bMoving)
|
||||
{
|
||||
TCHAR sizeStr[100];
|
||||
imageModel.ResetToPrevious();
|
||||
m_ptFrac.x += GET_X_LPARAM(lParam) - m_ptPos.x;
|
||||
m_ptFrac.y += GET_Y_LPARAM(lParam) - m_ptPos.y;
|
||||
@@ -173,8 +172,9 @@ LRESULT CSelectionWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, B
|
||||
}
|
||||
selectionModel.ModifyDestRect(m_ptDelta, m_iAction);
|
||||
|
||||
_stprintf(sizeStr, _T("%d x %d"), selectionModel.GetDestRectWidth(), selectionModel.GetDestRectHeight());
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) sizeStr);
|
||||
CString strSize;
|
||||
strSize.Format(_T("%d x %d"), selectionModel.GetDestRectWidth(), selectionModel.GetDestRectHeight());
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) (LPCTSTR) strSize);
|
||||
|
||||
if (toolsModel.GetActiveTool() == TOOL_TEXT)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ LRESULT CSizeboxWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
|
||||
{
|
||||
if (resizing)
|
||||
{
|
||||
TCHAR sizeStr[100];
|
||||
CString strSize;
|
||||
short xRel;
|
||||
short yRel;
|
||||
int imgXRes = imageModel.GetWidth();
|
||||
@@ -50,22 +50,22 @@ LRESULT CSizeboxWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
|
||||
xRel = (GET_X_LPARAM(lParam) - xOrig) * 1000 / toolsModel.GetZoom();
|
||||
yRel = (GET_Y_LPARAM(lParam) - yOrig) * 1000 / toolsModel.GetZoom();
|
||||
if (m_hWnd == sizeboxLeftTop.m_hWnd)
|
||||
_stprintf(sizeStr, _T("%d x %d"), imgXRes - xRel, imgYRes - yRel);
|
||||
strSize.Format(_T("%d x %d"), imgXRes - xRel, imgYRes - yRel);
|
||||
if (m_hWnd == sizeboxCenterTop.m_hWnd)
|
||||
_stprintf(sizeStr, _T("%d x %d"), imgXRes, imgYRes - yRel);
|
||||
strSize.Format(_T("%d x %d"), imgXRes, imgYRes - yRel);
|
||||
if (m_hWnd == sizeboxRightTop.m_hWnd)
|
||||
_stprintf(sizeStr, _T("%d x %d"), imgXRes + xRel, imgYRes - yRel);
|
||||
strSize.Format(_T("%d x %d"), imgXRes + xRel, imgYRes - yRel);
|
||||
if (m_hWnd == sizeboxLeftCenter.m_hWnd)
|
||||
_stprintf(sizeStr, _T("%d x %d"), imgXRes - xRel, imgYRes);
|
||||
strSize.Format(_T("%d x %d"), imgXRes - xRel, imgYRes);
|
||||
if (m_hWnd == sizeboxRightCenter.m_hWnd)
|
||||
_stprintf(sizeStr, _T("%d x %d"), imgXRes + xRel, imgYRes);
|
||||
strSize.Format(_T("%d x %d"), imgXRes + xRel, imgYRes);
|
||||
if (m_hWnd == sizeboxLeftBottom.m_hWnd)
|
||||
_stprintf(sizeStr, _T("%d x %d"), imgXRes - xRel, imgYRes + yRel);
|
||||
strSize.Format(_T("%d x %d"), imgXRes - xRel, imgYRes + yRel);
|
||||
if (m_hWnd == sizeboxCenterBottom.m_hWnd)
|
||||
_stprintf(sizeStr, _T("%d x %d"), imgXRes, imgYRes + yRel);
|
||||
strSize.Format(_T("%d x %d"), imgXRes, imgYRes + yRel);
|
||||
if (m_hWnd == sizeboxRightBottom.m_hWnd)
|
||||
_stprintf(sizeStr, _T("%d x %d"), imgXRes + xRel, imgYRes + yRel);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) sizeStr);
|
||||
strSize.Format(_T("%d x %d"), imgXRes + xRel, imgYRes + yRel);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) (LPCTSTR) strSize);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user