winmain.c: make source window scalable, adapt font in text window to modern displays

This commit is contained in:
h_vogt 2016-10-27 22:54:34 +02:00 committed by rlar
parent b459f6bd94
commit 89182304eb
1 changed files with 11 additions and 4 deletions

View File

@ -412,9 +412,9 @@ static void Main_OnSize(HWND hwnd, UINT state, int cx, int cy)
/* Expand Status Elements */
h = cy - LineHeight + StatusFrame -1;
MoveWindow( hwSource, StatusFrame, h, SourceLength, StatusElHeight, TRUE);
MoveWindow( hwAnalyse, cx - 3 * StatusFrame - QuitButtonLength - AnalyseLength - 20,
h, AnalyseLength, StatusElHeight, TRUE);
int statbegin = 3 * StatusFrame + QuitButtonLength + AnalyseLength + 20;
MoveWindow( hwSource, StatusFrame, h, cx - statbegin - BorderSize, StatusElHeight, TRUE);
MoveWindow( hwAnalyse, cx - statbegin, h, AnalyseLength, StatusElHeight, TRUE);
MoveWindow( hwQuitButton, cx - StatusFrame - QuitButtonLength - 20,
h, QuitButtonLength, StatusElHeight, TRUE);
}
@ -858,7 +858,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi
HDC textDC;
HFONT font;
TEXTMETRIC tm;
font = GetStockFont( ANSI_FIXED_FONT);
font = CreateFont(15, 0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, NONANTIALIASED_QUALITY, FIXED_PITCH | FF_MODERN, "Courier");
if(!font)
font = GetStockFont(ANSI_FIXED_FONT);
SetWindowFont( twText, font, FALSE);
textDC = GetDC( twText);
if (textDC) {
@ -906,6 +908,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi
if (!hwQuitButton) goto THE_END;
/* Define a minimum width */
int MinWidth = AnalyseLength + SourceLength + QuitButtonLength + 48;
if (WinLineWidth < MinWidth)
WinLineWidth = MinWidth;
/* Make main window and subwindows visible.
Size of windows allows display of 80 character line.
Limit window to screen size (if only VGA). */