Reformat some codes

This commit is contained in:
Don HO 2020-01-10 20:11:36 +01:00
parent 87d6cd1d04
commit 638ff65ba1
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

View File

@ -1291,30 +1291,26 @@ ATOM RegisterGridClass(HINSTANCE hInstance)
void SizeGrid(HWND hWnd,int /*SI*/)
{
{
SendMessage(hWnd,WM_SIZE,SIZE_MAXIMIZED,0);
//obsolete
//SendMessage(hWnd,WM_SIZE,SIZE_MAXIMIZED,MAKELPARAM(BGHS[SI].wannabewidth,BGHS[SI].wannabeheight));
//SendMessage(hWnd,WM_SIZE,SIZE_MAXIMIZED,MAKELPARAM(BGHS[SI].wannabewidth,BGHS[SI].wannabeheight));
}
}
int FindLongestLine(HDC hdc,TCHAR* text,SIZE* size)
int FindLongestLine(HDC hdc, wchar_t* text, SIZE* size)
{
int longest = 0;
TCHAR temptext[1000];
TCHAR *p;
wchar_t temptext[1000];
wchar_t *p;
wcscpy_s(temptext,text);
wcscpy_s(temptext, text);
p = wcstok(temptext, TEXT("\n"));
while(p)
while (p)
{
GetTextExtentPoint32(hdc,p,lstrlen(p),size);
if(size->cx > longest)
GetTextExtentPoint32(hdc, p, lstrlen(p), size);
if (size->cx > longest)
{
longest=size->cx;
}
TCHAR temptext2[2];
temptext2[0] = TEXT('\0');
wchar_t temptext2[2] = {'\0'};
p = wcstok(temptext2, TEXT("\n"));
}
return longest;
@ -1408,6 +1404,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
MessageBeep(0);
}
break;
case WM_SETTEXT:
{
int j,linecount;
@ -1434,7 +1431,6 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
linecount++;
}
}
holdfont=(HFONT)SelectObject(gdc,BGHS[SelfIndex].htitlefont);
GetTextExtentPoint32(gdc,BGHS[SelfIndex].title,lstrlen(BGHS[SelfIndex].title),&size);
@ -1454,6 +1450,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
break;
case BGM_GETROWS:
ReturnValue = BGHS[SelfIndex].rows;
break;