- From: Tim Baker <dbaker@direct.ca>
- Date: Tue, 19 Jan 1999 01:11:14 -0800
- To: www-amaya@w3.org
- Message-ID: <36A44C32.83F16270@direct.ca>
I have attached a patch which enhances the current interface used by the MS Windows compilers. It provides a resizeable window with a scrolling text window. The patch changes the following files: batch/app.c batch/grammar.c batch/prs.c batch/str.c batch/tra.c batch/winthotcompilers.c cpp/cpperror.c cpp/cppmain.c Put the patch into the toplevel "Thot" directory and test the patch like this: % patch --dry-run -i winthotpatch.diff Apply the patch like this: % patch -i winthotpatch.diff I appologize if the diff is too large to be sent to a mailing list (28K). -- Tim Baker
diff -C 2 -P -X diff-exclude app.c app.c
*** batch\app.c Fri Jan 8 07:55:02 1999
--- batch\app.c Mon Jan 18 22:15:04 1999
***************
*** 64,67 ****
--- 64,68 ----
#ifdef _WINDOWS
# define FATAL_EXIT_CODE 33
+ # define COMP_SUCCESS 0
#else /* !_WINDOWS */
# define FATAL_EXIT_CODE -1
***************
*** 159,165 ****
#ifdef _WINDOWS
! HDC compilersDC;
! HWND hWnd;
! int _CY_;
#define DLLEXPORT __declspec (dllexport)
#include "compilers_f.h"
--- 160,164 ----
#ifdef _WINDOWS
! HWND hwndEdit;
#define DLLEXPORT __declspec (dllexport)
#include "compilers_f.h"
***************
*** 1582,1588 ****
# ifdef _WINDOWS
! hWnd = hwnd;
! compilersDC = GetDC (hwnd);
! _CY_ = *Y;
strcpy (msg, "Executing app ");
for (ndx = 1; ndx < argc; ndx++) {
--- 1581,1585 ----
# ifdef _WINDOWS
! hwndEdit = hwnd;
strcpy (msg, "Executing app ");
for (ndx = 1; ndx < argc; ndx++) {
***************
*** 1627,1631 ****
TtaDisplaySimpleMessage (FATAL, APP, FILE_NOT_FOUND);
# ifdef _WINDOWS
- ReleaseDC (hwnd, compilersDC);
return FATAL_EXIT_CODE;
# else /* _WINDOWS */
--- 1624,1627 ----
***************
*** 1647,1651 ****
TtaDisplayMessage (FATAL, TtaGetMessage(APP, INVALID_FILE), srceFileName);
# ifdef _WINDOWS
- ReleaseDC (hwnd, compilersDC);
return FATAL_EXIT_CODE;
# else /* !_WINDOWS */
--- 1643,1646 ----
***************
*** 1697,1701 ****
}
# ifdef _WINDOWS
! i = CPPmain (hwnd, pIndex, cmd, &_CY_);
for (ndx = 0; ndx < pIndex; ndx++) {
free (cmd [ndx]);
--- 1692,1696 ----
}
# ifdef _WINDOWS
! i = CPPmain (hwndEdit, pIndex, cmd, NULL);
for (ndx = 0; ndx < pIndex; ndx++) {
free (cmd [ndx]);
***************
*** 1787,1793 ****
}
TtaSaveAppRegistry ();
! # ifdef _WINDOWS
! *Y = _CY_;
! ReleaseDC (hwnd, compilersDC);
# else /* !_WINDOWS */
exit (0);
--- 1782,1789 ----
}
TtaSaveAppRegistry ();
! # ifdef _WINDOWS
! if (error)
! return FATAL_EXIT_CODE;
! return COMP_SUCCESS;
# else /* !_WINDOWS */
exit (0);
diff -C 2 -P -X diff-exclude grammar.c grammar.c
*** batch\grammar.c Thu Dec 3 05:08:32 1998
--- batch\grammar.c Mon Jan 18 21:47:22 1999
***************
*** 101,107 ****
#ifdef _WINDOWS
! int _CY_ ;
! HDC compilersDC;
! HWND hWnd;
#define DLLEXPORT __declspec (dllexport)
#define FATAL_EXIT_CODE 33
--- 101,105 ----
#ifdef _WINDOWS
! HWND hwndEdit;
#define DLLEXPORT __declspec (dllexport)
#define FATAL_EXIT_CODE 33
***************
*** 817,823 ****
# ifdef _WINDOWS
! hWnd = hwnd;
! compilersDC = GetDC (hwnd);
! _CY_ = *Y;
strcpy (msg, "Executing grm ");
for (ndx = 1; ndx < argc; ndx++) {
--- 815,819 ----
# ifdef _WINDOWS
! hwndEdit = hwnd;
strcpy (msg, "Executing grm ");
for (ndx = 1; ndx < argc; ndx++) {
***************
*** 928,933 ****
}
# ifdef _WINDOWS
- *Y = _CY_;
- ReleaseDC (hwnd, compilersDC);
if (error)
return FATAL_EXIT_CODE;
--- 924,927 ----
diff -C 2 -P -X diff-exclude prs.c prs.c
*** batch\prs.c Wed Dec 16 07:31:20 1998
--- batch\prs.c Mon Jan 18 22:14:18 1999
***************
*** 173,179 ****
#ifdef _WINDOWS
! HDC compilersDC;
! HWND hWnd;
! int _CY_;
#define DLLEXPORT __declspec (dllexport)
#include "compilers_f.h"
--- 173,177 ----
#ifdef _WINDOWS
! HWND hwndEdit;
#define DLLEXPORT __declspec (dllexport)
#include "compilers_f.h"
***************
*** 6251,6257 ****
# ifdef _WINDOWS
! hWnd = hwnd;
! compilersDC = GetDC (hwnd);
! _CY_ = *Y;
strcpy (msg, "Executing prs ");
for (ndx = 1; ndx < argc; ndx++) {
--- 6249,6253 ----
# ifdef _WINDOWS
! hwndEdit = hwnd;
strcpy (msg, "Executing prs ");
for (ndx = 1; ndx < argc; ndx++) {
***************
*** 6296,6300 ****
TtaDisplaySimpleMessage (FATAL, PRS, UNKNOWN_FILE);
# ifdef _WINDOWS
- ReleaseDC (hwnd, compilersDC);
return FATAL_EXIT_CODE;
# else /* _WINDOWS */
--- 6292,6295 ----
***************
*** 6314,6318 ****
TtaDisplayMessage (FATAL, TtaGetMessage (PRS, INVALID_FILE), srceFileName);
# ifdef _WINDOWS
- ReleaseDC (hwnd, compilersDC);
return FATAL_EXIT_CODE;
# else /* _WINDOWS */
--- 6309,6312 ----
***************
*** 6363,6367 ****
}
# ifdef _WINDOWS
! i = CPPmain (hwnd, pIndex, cmd, &_CY_);
for (ndx = 0; ndx < pIndex; ndx++) {
free (cmd [ndx]);
--- 6357,6361 ----
}
# ifdef _WINDOWS
! i = CPPmain (hwndEdit, pIndex, cmd, NULL);
for (ndx = 0; ndx < pIndex; ndx++) {
free (cmd [ndx]);
***************
*** 6463,6468 ****
TtaSaveAppRegistry ();
# ifdef _WINDOWS
- *Y = _CY_ ;
- ReleaseDC (hwnd, compilersDC);
if (error)
return FATAL_EXIT_CODE ;
--- 6457,6460 ----
diff -C 2 -P -X diff-exclude str.c str.c
*** batch\str.c Wed Dec 16 07:31:22 1998
--- batch\str.c Mon Jan 18 22:13:58 1999
***************
*** 125,131 ****
#ifdef _WINDOWS
! HDC compilersDC;
! HWND hWnd;
! int _CY_;
#define DLLEXPORT __declspec (dllexport)
#include "compilers_f.h"
--- 125,129 ----
#ifdef _WINDOWS
! HWND hwndEdit;
#define DLLEXPORT __declspec (dllexport)
#include "compilers_f.h"
***************
*** 2842,2848 ****
# ifdef _WINDOWS
! hWnd = hwnd;
! compilersDC = GetDC (hwnd);
! _CY_ = *Y;
strcpy (msg, "Executing str ");
for (ndx = 1; ndx < argc; ndx++) {
--- 2840,2844 ----
# ifdef _WINDOWS
! hwndEdit = hwnd;
strcpy (msg, "Executing str ");
for (ndx = 1; ndx < argc; ndx++) {
***************
*** 2885,2889 ****
TtaDisplaySimpleMessage (FATAL, STR, STR_NO_SUCH_FILE);
# ifdef _WINDOWS
- ReleaseDC (hwnd, compilersDC);
return FATAL_EXIT_CODE;
# else /* _WINDOWS */
--- 2881,2884 ----
***************
*** 2906,2910 ****
TtaDisplayMessage (FATAL, TtaGetMessage (STR, STR_INVALID_FILE), srceFileName);
# ifdef _WINDOWS
- ReleaseDC (hwnd, compilersDC);
return FATAL_EXIT_CODE;
# else /* _WINDOWS */
--- 2901,2904 ----
***************
*** 2957,2961 ****
}
# ifdef _WINDOWS
! i = CPPmain (hwnd, pIndex, cmd, &_CY_);
for (ndx = 0; ndx < pIndex; ndx++) {
free (cmd [ndx]);
--- 2951,2955 ----
}
# ifdef _WINDOWS
! i = CPPmain (hwndEdit, pIndex, cmd, NULL);
for (ndx = 0; ndx < pIndex; ndx++) {
free (cmd [ndx]);
***************
*** 3065,3070 ****
TtaSaveAppRegistry ();
# ifdef _WINDOWS
! *Y = _CY_ ;
! ReleaseDC (hwnd, compilersDC);
return COMP_SUCCESS;
# else /* _WINDOWS */
--- 3059,3064 ----
TtaSaveAppRegistry ();
# ifdef _WINDOWS
! if (error)
! return FATAL_EXIT_CODE;
return COMP_SUCCESS;
# else /* _WINDOWS */
diff -C 2 -P -X diff-exclude tra.c tra.c
*** batch\tra.c Wed Dec 16 07:31:22 1998
--- batch\tra.c Mon Jan 18 22:14:34 1999
***************
*** 139,145 ****
#ifdef _WINDOWS
! HDC compilersDC;
! HWND hWnd;
! int _CY_;
#define DLLEXPORT __declspec (dllexport)
#include "compilers_f.h"
--- 139,143 ----
#ifdef _WINDOWS
! HWND hwndEdit;
#define DLLEXPORT __declspec (dllexport)
#include "compilers_f.h"
***************
*** 3220,3226 ****
# ifdef _WINDOWS
! hWnd = hwnd;
! compilersDC = GetDC (hwnd);
! _CY_ = *Y;
strcpy (msg, "Executing tra ");
for (ndx = 1; ndx < argc; ndx++) {
--- 3218,3222 ----
# ifdef _WINDOWS
! hwndEdit = hwnd;
strcpy (msg, "Executing tra ");
for (ndx = 1; ndx < argc; ndx++) {
***************
*** 3268,3272 ****
TtaDisplaySimpleMessage (FATAL, TRA, MISSING_FILE);
# ifdef _WINDOWS
- ReleaseDC (hwnd, compilersDC);
return FATAL_EXIT_CODE;
# else /* _WINDOWS */
--- 3264,3267 ----
***************
*** 3289,3293 ****
TtaDisplayMessage (FATAL, TtaGetMessage (TRA, INVALID_FILE), srceFileName);
# ifdef _WINDOWS
- ReleaseDC (hwnd, compilersDC);
return FATAL_EXIT_CODE;
# else /* _WINDOWS */
--- 3284,3287 ----
***************
*** 3341,3345 ****
}
# ifdef _WINDOWS
! i = CPPmain (hwnd, pIndex, cmd, &_CY_);
for (ndx = 0; ndx < pIndex; ndx++) {
free (cmd [ndx]);
--- 3335,3339 ----
}
# ifdef _WINDOWS
! i = CPPmain (hwndEdit, pIndex, cmd, NULL);
for (ndx = 0; ndx < pIndex; ndx++) {
free (cmd [ndx]);
***************
*** 3445,3451 ****
}
TtaSaveAppRegistry ();
! # ifdef _WINDOWS
! *Y = _CY_;
! ReleaseDC (hwnd, compilersDC);
return COMP_SUCCESS;
# else /* _WINDOWS */
--- 3439,3445 ----
}
TtaSaveAppRegistry ();
! # ifdef _WINDOWS
! if (error)
! return FATAL_EXIT_CODE;
return COMP_SUCCESS;
# else /* _WINDOWS */
diff -C 2 -P -X diff-exclude winthotcompilers.c winthotcompilers.c
*** batch\winthotcompilers.c Mon Jan 11 07:17:08 1999
--- batch\winthotcompilers.c Mon Jan 18 22:30:56 1999
***************
*** 20,23 ****
--- 20,24 ----
#include "fileaccess.h"
#include "message.h"
+ #include "registry_f.h"
/* #include "compilers_f.h" */
***************
*** 46,51 ****
#define COMP_SUCCESS 0
! HWND hWND = (HWND) 0;
! int Y = 10;
char* cmdLine;
char* SrcPath;
--- 47,51 ----
#define COMP_SUCCESS 0
! HWND hwndEdit = NULL;
char* cmdLine;
char* SrcPath;
***************
*** 68,72 ****
static TCHAR szFileName[256];
static char fileToOpen [256];
- static int iVscrollPos = 0, iVscrollMax, iVscrollInc;
#if 0
--- 68,71 ----
***************
*** 93,144 ****
#endif /* __STDC__ */
{
! TEXTMETRIC textMetric;
! COLORREF oldColor;
! HFONT hFont, hOldFont;
! HDC hDC;
! int cxChar, cyChar;
!
! if (hwnd) {
! hDC = GetDC (hwnd);
! /* hFont = CreateFont (16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
! OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY,
! DEFAULT_PITCH | FF_DONTCARE, "Times New Roman"); */
! hFont = CreateFont (16, 0, 0, 0, FW_SEMIBOLD, FALSE, FALSE, FALSE, ANSI_CHARSET,
! OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY,
! DEFAULT_PITCH | FF_DONTCARE, "Arial");
!
! hOldFont = SelectObject (hDC, hFont);
!
! GetTextMetrics (hDC, &textMetric);
! cxChar = textMetric.tmAveCharWidth;
! cyChar = textMetric.tmHeight + textMetric.tmExternalLeading + 1;
!
! if (Y >= 550) {
! ScrollWindow (hwnd, 0, -cyChar, NULL, NULL);
! UpdateWindow (hwnd);
! } else
! Y += cyChar;
!
! switch (msgType) {
! case FATAL_EXIT_CODE:
! oldColor = SetTextColor (hDC, RGB (255, 0, 0));
! break;
!
! case COMP_WARNING:
! oldColor = SetTextColor (hDC, RGB (0, 0, 255));
! break;
!
! case COMP_SUCCESS:
! oldColor = SetTextColor (hDC, RGB (0, 0, 0));
! break;
! }
! if (!TextOut (hDC, 5, Y, errorMsg, strlen (errorMsg)))
! MessageBox (NULL, "Error Writing text", "Thot Compilers", MB_OK);
!
! SetTextColor (hDC, oldColor);
! SelectObject (hDC, hOldFont);
! DeleteObject (hFont);
! ReleaseDC (hWND, hDC);
! }
}
--- 92,100 ----
#endif /* __STDC__ */
{
! SendMessage(hwndEdit, EM_SETSEL, INT_MAX, INT_MAX);
! SendMessage(hwndEdit, EM_REPLACESEL, 0L, (LPARAM)(LPCTSTR) errorMsg);
! SendMessage(hwndEdit, EM_SETSEL, INT_MAX, INT_MAX);
! SendMessage(hwndEdit, EM_REPLACESEL, 0L, (LPARAM)(LPCTSTR) "\r\n");
! SendMessage(hwndEdit, EM_SETSEL, INT_MAX, INT_MAX);
}
***************
*** 175,178 ****
--- 131,136 ----
fclose (srcFile);
fclose (destFile);
+
+ return COMP_SUCCESS;
}
***************
*** 186,191 ****
#endif /* __STDC__ */
{
! Copy_File (hwnd, src, dest);
_unlink (src);
}
--- 144,153 ----
#endif /* __STDC__ */
{
! int result;
!
! result = Copy_File (hwnd, src, dest);
_unlink (src);
+
+ return result;
}
***************
*** 443,447 ****
/* result = APPmain (hwnd, index, args, &Y); */
! result = ptrMainProc (hwnd, index, args, &Y);
FreeLibrary (hLib);
for (i = 0; i < index; i++) {
--- 405,409 ----
/* result = APPmain (hwnd, index, args, &Y); */
! result = ptrMainProc (hwndEdit, index, args, NULL);
FreeLibrary (hLib);
for (i = 0; i < index; i++) {
***************
*** 534,538 ****
Copy_File (hwnd, SrcFileName, WorkFileName);
! result = ptrMainProc (hwnd, index, args, &Y);
FreeLibrary (hLib);
/* result = PRSmain (hwnd, index, args, &Y); */
--- 496,500 ----
Copy_File (hwnd, SrcFileName, WorkFileName);
! result = ptrMainProc (hwndEdit, index, args, NULL);
FreeLibrary (hLib);
/* result = PRSmain (hwnd, index, args, &Y); */
***************
*** 645,649 ****
Copy_File (hwnd, SrcFileName, WorkFileName);
! result = ptrMainProc (hwnd, index, args, &Y);
FreeLibrary (hLib);
/* result = STRmain (hwnd, index, args, &Y); */
--- 607,611 ----
Copy_File (hwnd, SrcFileName, WorkFileName);
! result = ptrMainProc (hwndEdit, index, args, NULL);
FreeLibrary (hLib);
/* result = STRmain (hwnd, index, args, &Y); */
***************
*** 657,668 ****
}
if (SrcFileName) {
! free (currentFile);
! currentFile = (char*) 0;
}
if (WorkFileName) {
! free (currentFile);
! currentFile = (char*) 0;
}
- _unlink (WorkFileName);
if (result == FATAL_EXIT_CODE)
return result;
--- 619,630 ----
}
if (SrcFileName) {
! free (SrcFileName);
! SrcFileName = (char*) 0;
}
if (WorkFileName) {
! _unlink (WorkFileName);
! free (WorkFileName);
! WorkFileName = (char*) 0;
}
if (result == FATAL_EXIT_CODE)
return result;
***************
*** 795,799 ****
Copy_File (hwnd, SrcFileName, WorkFileName);
! result = ptrMainProc (hwnd, index, args, &Y);
FreeLibrary (hLib);
/* result = TRAmain (hwnd, index, args, &Y); */
--- 757,761 ----
Copy_File (hwnd, SrcFileName, WorkFileName);
! result = ptrMainProc (hwndEdit, index, args, NULL);
FreeLibrary (hLib);
/* result = TRAmain (hwnd, index, args, &Y); */
***************
*** 807,818 ****
}
if (SrcFileName) {
! free (currentFile);
! currentFile = (char*) 0;
}
if (WorkFileName) {
! free (currentFile);
! currentFile = (char*) 0;
}
- _unlink (WorkFileName);
if (result == FATAL_EXIT_CODE)
return result;
--- 769,780 ----
}
if (SrcFileName) {
! free (SrcFileName);
! SrcFileName = (char*) 0;
}
if (WorkFileName) {
! _unlink (WorkFileName);
! free (WorkFileName);
! WorkFileName = (char*) 0;
}
if (result == FATAL_EXIT_CODE)
return result;
***************
*** 858,862 ****
sprintf (SrcFileName, "%s%s", WorkPath, BinFiles [i]);
} else {
! SrcFileName = (char*) malloc (len + strlen (BinFiles) + 2);
sprintf (SrcFileName, "%s\\%s", WorkPath, BinFiles [i]);
}
--- 820,824 ----
sprintf (SrcFileName, "%s%s", WorkPath, BinFiles [i]);
} else {
! SrcFileName = (char*) malloc (len + strlen (BinFiles [i]) + 2);
sprintf (SrcFileName, "%s\\%s", WorkPath, BinFiles [i]);
}
***************
*** 883,887 ****
HWND hwnd;
MSG msg;
! WNDCLASSEX wndClass;
BOOL ok;
int argc ;
--- 845,849 ----
HWND hwnd;
MSG msg;
! WNDCLASS wndClass;
BOOL ok;
int argc ;
***************
*** 920,945 ****
ThotPath = TtaGetEnvString ("THOTDIR");
! wndClass.style = CS_HREDRAW | CS_VREDRAW ;
! wndClass.lpfnWndProc = (WNDPROC) CompilersWndProc ;
! wndClass.cbClsExtra = 0 ;
! wndClass.cbWndExtra = 0 ;
! wndClass.hInstance = hInstance ;
! wndClass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
! wndClass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
! wndClass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
! wndClass.lpszMenuName = NULL ;
! wndClass.lpszClassName = szAppName ;
! wndClass.cbSize = sizeof(WNDCLASSEX);
! wndClass.hIconSm = LoadIcon (hInstance, IDI_APPLICATION) ;
! if (!RegisterClassEx (&wndClass))
return FALSE;
! hwnd = CreateWindowEx (WS_EX_STATICEDGE | WS_EX_OVERLAPPEDWINDOW | WS_EX_DLGMODALFRAME, szAppName, "Thot compilers",
! DS_MODALFRAME | WS_POPUP | WS_VSCROLL |
! WS_VISIBLE | WS_CAPTION | WS_SYSMENU,
! 0, 0,
! 600, 650,
! NULL, NULL, hInstance, NULL) ;
ShowWindow (hwnd, SW_SHOWNORMAL) ;
--- 882,924 ----
ThotPath = TtaGetEnvString ("THOTDIR");
! wndClass.hCursor = LoadCursor (NULL, IDC_ARROW);
! wndClass.hIcon = LoadIcon (NULL, IDI_APPLICATION);
! wndClass.lpszMenuName = NULL;
! wndClass.lpszClassName = szAppName;
! wndClass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
! wndClass.hInstance = hInstance;
! wndClass.style = CS_BYTEALIGNCLIENT;
! wndClass.lpfnWndProc = CompilersWndProc;
! wndClass.cbWndExtra = 0;
! wndClass.cbClsExtra = 0;
!
! if (!RegisterClass(&wndClass))
! return FALSE;
!
! hwnd = CreateWindow(szAppName,
! "Thot Compilers",
! WS_OVERLAPPEDWINDOW,
! 2, 2, 600, 460,
! (HWND) NULL,
! (HMENU) NULL,
! (HINSTANCE) hInstance,
! (LPSTR) NULL
! );
! if (!hwnd)
return FALSE;
! hwndEdit = CreateWindow("EDIT", NULL,
! WS_CHILD | WS_BORDER | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL |
! ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | ES_READONLY,
! 0, 0, 0, 0,
! hwnd, (HMENU) 0, hInstance, NULL);
!
! if (!hwndEdit)
! return FALSE;
!
! SendMessage(hwndEdit, EM_LIMITTEXT, 0, 0);
!
! ShowWindow(hwndEdit, SW_SHOWNORMAL);
ShowWindow (hwnd, SW_SHOWNORMAL) ;
***************
*** 964,981 ****
{
static HMENU menuBar, popupMenu;
- static int cxChar, cyChar, cyClient;
- TEXTMETRIC tm;
- HDC hDC;
int result = COMP_SUCCESS;
switch (iMsg) {
case WM_CREATE:
- hDC = GetDC (hwnd);
- GetTextMetrics (hDC, &tm);
- cxChar = tm.tmAveCharWidth;
- cyChar = tm.tmHeight + tm.tmExternalLeading;
- ReleaseDC (hwnd, hDC);
- SetScrollRange (hwnd, SB_VERT, 0, NUMLINES, FALSE);
- SetScrollPos (hwnd, SB_VERT, iVscrollPos,TRUE);
menuBar = CreateMenu ();
popupMenu = CreateMenu ();
--- 943,950 ----
***************
*** 987,998 ****
SetMenu (hwnd, menuBar);
EnableMenuItem (popupMenu, COMPILE, MFS_GRAYED);
- ShowScrollBar (hwnd, SB_VERT, TRUE);
return 0;
case WM_SIZE:
! cyClient = HIWORD (lParam);
! iVscrollMax = max (0, NUMLINES + 2 - cyClient / cyChar);
! SetScrollRange (hwnd, SB_VERT, 0, iVscrollMax, FALSE);
! SetScrollPos (hwnd, SB_VERT, iVscrollPos, TRUE);
return 0;
--- 956,970 ----
SetMenu (hwnd, menuBar);
EnableMenuItem (popupMenu, COMPILE, MFS_GRAYED);
return 0;
case WM_SIZE:
! if (hwndEdit)
! {
! RECT rc;
! GetClientRect(hwnd, &rc);
! InflateRect(&rc, 1, 1);
! MoveWindow(hwndEdit, rc.top, rc.left,
! rc.right - rc.left, rc.bottom - rc.top, TRUE);
! }
return 0;
***************
*** 1001,1047 ****
return 0;
- case WM_VSCROLL:
- switch (LOWORD (wParam)) {
- case SB_TOP:
- iVscrollPos = 0;
- break;
-
- case SB_BOTTOM:
- iVscrollPos = iVscrollMax;
- break;
-
- case SB_LINEUP:
- iVscrollInc = -1;
- break;
-
- case SB_LINEDOWN:
- iVscrollInc = 1;
- break;
-
- case SB_PAGEUP:
- iVscrollInc = min (-1, cyClient / cyChar);
- break;
-
- case SB_PAGEDOWN:
- iVscrollInc = max (1, cyClient / cyChar);
- break;
-
- case SB_THUMBPOSITION:
- iVscrollInc = HIWORD (wParam) - iVscrollPos;
- break;
-
- default:
- iVscrollInc = 0;
- break;
- }
-
- iVscrollInc = max (-iVscrollPos, min (iVscrollInc, iVscrollMax - iVscrollPos));
- if (iVscrollInc != 0) {
- ScrollWindow (hwnd, 0, -cyChar * iVscrollInc, NULL, NULL);
- SetScrollPos (hwnd, SB_VERT, iVscrollPos, TRUE);
- UpdateWindow (hwnd);
- }
- break;
-
case WM_COMMAND:
switch (LOWORD (wParam)) {
--- 973,976 ----
diff -C 2 -P -X diff-exclude cpperror.c cpperror.c
*** cpp\cpperror.c Fri Jan 8 09:01:12 1999
--- cpp\cpperror.c Mon Jan 18 22:07:26 1999
***************
*** 33,37 ****
#endif /* _WINDOWS */
! extern HWND hWND;
/* Print the file names and line numbers of the #include
--- 33,37 ----
#endif /* _WINDOWS */
! extern HWND hwndEdit;
/* Print the file names and line numbers of the #include
***************
*** 113,117 ****
sprintf (Wmsg, ch, arg1, arg2, arg3);
}
! CPPError (hWND, Wmsg);
# else /* _WINDOWS */
if (is_error)
--- 113,117 ----
sprintf (Wmsg, ch, arg1, arg2, arg3);
}
! CPPError (hwndEdit, Wmsg);
# else /* _WINDOWS */
if (is_error)
diff -C 2 -P -X diff-exclude cppmain.c cppmain.c
*** cpp\cppmain.c Mon Jan 11 02:33:00 1999
--- cpp\cppmain.c Mon Jan 18 22:10:04 1999
***************
*** 48,53 ****
#ifdef _WINDOWS
! HWND hWND;
! int _CY_;
#ifdef __STDC__
void CPPError (HWND hwnd, char* errorMsg)
--- 48,52 ----
#ifdef _WINDOWS
! HWND hwndEdit;
#ifdef __STDC__
void CPPError (HWND hwnd, char* errorMsg)
***************
*** 58,99 ****
#endif /* __STDC__ */
{
! TEXTMETRIC textMetric;
! COLORREF oldColor;
! HFONT hFont, hOldFont;
! HDC hDC;
! int cxChar, cyChar;
!
! if (hWND) {
! hDC = GetDC (hWND);
! /* hFont = CreateFont (16, 0, 0, 0, FW_NORMAL, TRUE, FALSE, FALSE, ANSI_CHARSET,
! OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY,
! DEFAULT_PITCH | FF_DONTCARE, "Times New Roman"); */
! hFont = CreateFont (16, 0, 0, 0, FW_BOLD, TRUE, FALSE, FALSE, ANSI_CHARSET,
! OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY,
! DEFAULT_PITCH | FF_DONTCARE, "Arial");
!
! hOldFont = SelectObject (hDC, hFont);
!
! GetTextMetrics (hDC, &textMetric);
! cxChar = textMetric.tmAveCharWidth;
! cyChar = textMetric.tmHeight + textMetric.tmExternalLeading + 1;
!
! if (_CY_ >= 550) {
! ScrollWindow (hwnd, 0, -cyChar, NULL, NULL);
! UpdateWindow (hwnd);
! } else
! _CY_ += cyChar;
!
! oldColor = SetTextColor (hDC, RGB (180, 0, 0));
!
! if (!TextOut (hDC, 5, _CY_, errorMsg, strlen (errorMsg)))
! MessageBox (NULL, "Error Writing text", "Thot Compilers", MB_OK);
!
! SetTextColor (hDC, oldColor);
!
! SelectObject (hDC, hOldFont);
! DeleteObject (hFont);
! ReleaseDC (hWND, hDC);
! }
}
#endif /* _WINDOWS */
--- 57,65 ----
#endif /* __STDC__ */
{
! SendMessage(hwndEdit, EM_SETSEL, INT_MAX, INT_MAX);
! SendMessage(hwndEdit, EM_REPLACESEL, 0L, (LPARAM)(LPCTSTR) errorMsg);
! SendMessage(hwndEdit, EM_SETSEL, INT_MAX, INT_MAX);
! SendMessage(hwndEdit, EM_REPLACESEL, 0L, (LPARAM)(LPCTSTR) "\r\n");
! SendMessage(hwndEdit, EM_SETSEL, INT_MAX, INT_MAX);
}
#endif /* _WINDOWS */
***************
*** 119,124 ****
FILE* outfile;
! hWND = hwnd;
! _CY_ = *Y;
p = argv[0] + strlen (argv[0]);
--- 85,89 ----
FILE* outfile;
! hwndEdit = hwnd;
p = argv[0] + strlen (argv[0]);
***************
*** 160,165 ****
fclose (outfile);
cpp_finish (&parse_in);
-
- *Y = _CY_;
if (parse_in.errors)
--- 125,128 ----
Received on Tuesday, 19 January 1999 04:14:47 UTC