From 89182304eb08c929737c951a828ca0c105f1238e Mon Sep 17 00:00:00 2001 From: h_vogt Date: Thu, 27 Oct 2016 22:54:34 +0200 Subject: [PATCH] winmain.c: make source window scalable, adapt font in text window to modern displays --- src/winmain.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/winmain.c b/src/winmain.c index cff1d4a41..dc260c843 100644 --- a/src/winmain.c +++ b/src/winmain.c @@ -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). */