# HG changeset patch # User Brian Smith # Date 1344042892 18000 # Node ID 9b5da2f35bee2b7ce51691a0e978cb4e4ac2d1d9 # Parent dd61d68f3b75ce259e2cf4355ae80c773bfd66fd Update to latest DW with static text word wrap fix. diff -r dd61d68f3b75 -r 9b5da2f35bee dw.h --- a/dw.h Wed Jul 25 00:05:29 2012 -0500 +++ b/dw.h Fri Aug 03 20:14:52 2012 -0500 @@ -1,4 +1,4 @@ -/* $Id: dw.h 1790 2012-07-24 22:52:57Z bsmith $ */ +/* $Id: dw.h 1796 2012-08-04 00:05:47Z bsmith $ */ #ifndef _H_DW #define _H_DW @@ -332,7 +332,7 @@ #define DW_DT_BOTTOM 0 #define DW_DT_HALFTONE 0 #define DW_DT_MNEMONIC 0 -#define DW_DT_WORDBREAK 0 +#define DW_DT_WORDBREAK (1 << 11) #define DW_DT_ERASERECT 0 #define DW_FCF_CLOSEBUTTON (1 << 1) /* NSClosableWindowMask */ @@ -494,7 +494,7 @@ #endif #endif -#define DW_DT_LEFT SS_LEFT +#define DW_DT_LEFT SS_LEFTNOWORDWRAP #define DW_DT_QUERYEXTENT 0 #define DW_DT_UNDERSCORE 0 #define DW_DT_STRIKEOUT 0 @@ -507,7 +507,7 @@ #define DW_DT_BOTTOM 0 #define DW_DT_HALFTONE 0 #define DW_DT_MNEMONIC 0 -#define DW_DT_WORDBREAK 0 +#define DW_DT_WORDBREAK SS_LEFT #define DW_DT_ERASERECT 0 #define DW_FCF_CLOSEBUTTON 0 diff -r dd61d68f3b75 -r 9b5da2f35bee os2/dw.c --- a/os2/dw.c Wed Jul 25 00:05:29 2012 -0500 +++ b/os2/dw.c Fri Aug 03 20:14:52 2012 -0500 @@ -1616,7 +1616,27 @@ if(WinQueryPresParam(hWnd, PP_FOREGROUNDCOLOR, 0, NULL, sizeof(fcolor), &fcolor, QPF_NOINHERIT) || WinQueryPresParam(hWnd, PP_FOREGROUNDCOLORINDEX, 0, NULL, sizeof(fcolor), &fcolor, QPF_NOINHERIT)) GpiSetColor(hpsPaint, fcolor); - WinDrawText(hpsPaint, -1, (PCH)tempbuf, &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, style | DT_TEXTATTRS | DT_ERASERECT); + if(style & DT_WORDBREAK) + { + int thisheight; + LONG drawn, totaldrawn = 0; + + dw_font_text_extents_get(hWnd, NULL, tempbuf, NULL, &thisheight); + + /* until all chars drawn */ + for(; totaldrawn != len; rclPaint.yTop -= thisheight) + { + /* draw the text */ + drawn = WinDrawText(hpsPaint, len - totaldrawn, (PCH)tempbuf + totaldrawn, + &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, style | DT_TEXTATTRS | DT_ERASERECT); + if(drawn) + totaldrawn += drawn; + else + break; + } + } + else + WinDrawText(hpsPaint, -1, (PCH)tempbuf, &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, style | DT_TEXTATTRS | DT_ERASERECT); } /* Function: BubbleProc @@ -6492,6 +6512,7 @@ { WindowData *blah = calloc(1, sizeof(WindowData)); + ENTRYFDATA efd = { sizeof(ENTRYFDATA), 32000, 0, 0 }; HWND tmp = WinCreateWindow(HWND_OBJECT, WC_ENTRYFIELD, (PSZ)text, @@ -6501,7 +6522,7 @@ NULLHANDLE, HWND_TOP, id, - NULL, + (PVOID)&efd, NULL); blah->oldproc = WinSubclassWindow(tmp, _entryproc); WinSetWindowPtr(tmp, QWP_USER, blah);