diff options
Diffstat (limited to 'app/wlib/mswlib/mswtext.c')
-rw-r--r-- | app/wlib/mswlib/mswtext.c | 78 |
1 files changed, 34 insertions, 44 deletions
diff --git a/app/wlib/mswlib/mswtext.c b/app/wlib/mswlib/mswtext.c index 0a0ce88..b43a5d4 100644 --- a/app/wlib/mswlib/mswtext.c +++ b/app/wlib/mswlib/mswtext.c @@ -58,23 +58,17 @@ struct wText_t { HANDLE hText; }; -BOOL_T textPrintAbort = FALSE; - void wTextClear( wText_p b) { - long rc; - rc = SendMessage(b->hWnd, EM_SETREADONLY, 0, 0L); -#ifdef WIN32 - rc = SendMessage(b->hWnd, EM_SETSEL, 0, -1); -#else - rc = SendMessage(b->hWnd, EM_SETSEL, 1, MAKELONG(0, -1)); -#endif - rc = SendMessage(b->hWnd, WM_CLEAR, 0, 0L); + LRESULT rc; + rc = SendMessage(b->hWnd, EM_SETREADONLY, (WPARAM)0, (LPARAM)0); + rc = SendMessage(b->hWnd, EM_SETSEL, (WPARAM)0, (LPARAM)-1); + rc = SendMessage(b->hWnd, WM_CLEAR, (WPARAM)0, (LPARAM)0); if (b->option&BO_READONLY) { - rc = SendMessage(b->hWnd, EM_SETREADONLY, 1, 0L); + rc = SendMessage(b->hWnd, EM_SETREADONLY, (WPARAM)1, (LPARAM)0); } } @@ -97,7 +91,7 @@ void wTextAppend( char *buffer; char *extText; int textSize; - int len = strlen(text); + size_t len = strlen(text); if (!len) { return; @@ -135,11 +129,11 @@ void wTextAppend( } if (b->option&BO_READONLY) { - SendMessage(b->hWnd, EM_SETREADONLY, 1, 0L); + SendMessage(b->hWnd, EM_SETREADONLY, (WPARAM)1, (LPARAM)0); } // scroll to bottom of text box - SendMessage(b->hWnd, EM_LINESCROLL, 0, 10000L); + SendMessage(b->hWnd, EM_LINESCROLL, (WPARAM)0, (LPARAM)10000); } @@ -157,11 +151,11 @@ BOOL_T wTextSave( return FALSE; } - lc = (int)SendMessage(b->hWnd, EM_GETLINECOUNT, 0, 0L); + lc = (int)SendMessage(b->hWnd, EM_GETLINECOUNT, (WPARAM)0, (LPARAM)0); for (l=0; l<lc; l++) { *(WORD*)line = sizeof(line)-1; - len = (int)SendMessage(b->hWnd, EM_GETLINE, l, (DWORD)(LPSTR)line); + len = (int)SendMessage(b->hWnd, EM_GETLINE, (WPARAM)l, (LPARAM)line); line[len] = '\0'; fprintf(f, "%s\n", line); } @@ -213,17 +207,17 @@ BOOL_T wTextPrint( lineSpace = textMetric.tmHeight + textMetric.tmExternalLeading; linesPerPage = GetDeviceCaps(hDc, VERTRES) / lineSpace; currentLine = 1; - lc = (int)SendMessage(b->hWnd, EM_GETLINECOUNT, 0, 0L); + lc = (int)SendMessage(b->hWnd, EM_GETLINECOUNT, (WPARAM)0, (LPARAM)0); IOStatus = 0; for (l=0; l<lc; l++) { *(WORD*)line = sizeof(line)-1; - len = (int)SendMessage(b->hWnd, EM_GETLINE, l, (DWORD)(LPSTR)line); + len = (int)SendMessage(b->hWnd, EM_GETLINE, (WPARAM)l, (LPARAM)line); TextOut(hDc, 0, currentLine*lineSpace, line, len); if (++currentLine > linesPerPage) { IOStatus = EndPage(hDc); - if (IOStatus < 0 || textPrintAbort) { + if (IOStatus < 0 ) { break; } StartPage(hDc); @@ -231,7 +225,7 @@ BOOL_T wTextPrint( } } - if (IOStatus >= 0 && !textPrintAbort) { + if (IOStatus >= 0 ) { EndPage(hDc); EndDoc(hDc); } @@ -246,7 +240,7 @@ wBool_t wTextGetModified( wText_p b) { int rc; - rc = (int)SendMessage(b->hWnd, EM_GETMODIFY, 0, 0L); + rc = (int)SendMessage(b->hWnd, EM_GETMODIFY, (WPARAM)0, (LPARAM)0); return (wBool_t)rc; } @@ -311,14 +305,14 @@ void wTextSetReadonly( b->option &= ~BO_READONLY; } - SendMessage(b->hWnd, EM_SETREADONLY, ro, 0L); + SendMessage(b->hWnd, EM_SETREADONLY, (WPARAM)ro, (LPARAM)0); } void wTextSetSize( wText_p bt, - wPos_t width, - wPos_t height) + wWinPix_t width, + wWinPix_t height) { bt->w = width; bt->h = height; @@ -332,13 +326,13 @@ void wTextSetSize( void wTextComputeSize( wText_p bt, - int rows, - int lines, - wPos_t * w, - wPos_t * h) + wWinPix_t rows, + wWinPix_t lines, + wWinPix_t * w, + wWinPix_t * h) { - static wPos_t scrollV_w = -1; - static wPos_t scrollH_h = -1; + static wWinPix_t scrollV_w = -1; + static wWinPix_t scrollH_h = -1; HDC hDc; TEXTMETRIC metrics; @@ -366,8 +360,8 @@ void wTextSetPosition( wText_p bt, int pos) { - long rc; - rc = SendMessage(bt->hWnd, EM_LINESCROLL, 0, MAKELONG(-65535, 0)); + LRESULT rc; + rc = SendMessage(bt->hWnd, EM_LINESCROLL, (WPARAM)0, (LPARAM)MAKELONG(-65535, 0)); } static void textDoneProc(wControl_p b) @@ -387,13 +381,13 @@ static callBacks_t textCallBacks = { wText_p wTextCreate( wWin_p parent, - POS_T x, - POS_T y, + wWinPix_t x, + wWinPix_t y, const char * helpStr, const char * labelStr, long option, - POS_T width, - POS_T height) + wWinPix_t width, + wWinPix_t height) { wText_p b; DWORD style; @@ -416,17 +410,13 @@ wText_p wTextCreate( b->hWnd = CreateWindow("EDIT", NULL, style, b->x, b->y, width, height, - ((wControl_p)parent)->hWnd, (HMENU)index, mswHInst, NULL); + ((wControl_p)parent)->hWnd, (HMENU)(UINT_PTR)index, mswHInst, NULL); if (b->hWnd == NULL) { mswFail("CreateWindow(TEXT)"); return b; } -#ifdef CONTROL3D - Ctl3dSubclassCtl(b->hWnd); -#endif - if (option & BT_FIXEDFONT) { if (fixedTextFont == (HFONT)0) { fixedTextFont = CreateFontIndirect(&fixedFont); @@ -434,13 +424,13 @@ wText_p wTextCreate( SendMessage(b->hWnd, WM_SETFONT, (WPARAM)fixedTextFont, (LPARAM)MAKELONG(1, 0)); } else if (!mswThickFont) { - SendMessage(b->hWnd, WM_SETFONT, (WPARAM)mswLabelFont, 0L); + SendMessage(b->hWnd, WM_SETFONT, (WPARAM)mswLabelFont, (LPARAM)0); } - b->hText = (HANDLE)SendMessage(b->hWnd, EM_GETHANDLE, 0, 0L); + b->hText = (HANDLE)SendMessage(b->hWnd, EM_GETHANDLE, (WPARAM)0, (LPARAM)0); if (option & BT_CHARUNITS) { - wPos_t w, h; + wWinPix_t w, h; wTextComputeSize(b, width, height, &w, &h); if (!SetWindowPos(b->hWnd, HWND_TOP, 0, 0, |