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 b61bc8ac91
commit fb9bed78b4
1 changed files with 11 additions and 3 deletions

View File

@ -469,9 +469,10 @@ 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);
int statbegin = 3 * StatusFrame + QuitButtonLength + AnalyseLength + 20;
MoveWindow(hwSource, StatusFrame, h, cx - statbegin - BorderSize, StatusElHeight, TRUE);
MoveWindow(hwAnalyse,
cx - 3 * StatusFrame - QuitButtonLength - AnalyseLength - 20,
cx - statbegin,
h, AnalyseLength, StatusElHeight, TRUE);
MoveWindow(hwQuitButton,
cx - StatusFrame - QuitButtonLength - 20,
@ -937,7 +938,9 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCm
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) {
@ -990,6 +993,11 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCm
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). */