changeset 11:9b5da2f35bee

Update to latest DW with static text word wrap fix.
author Brian Smith <brian@dbsoft.org>
date Fri, 03 Aug 2012 20:14:52 -0500
parents dd61d68f3b75
children 840ef4182857
files dw.h os2/dw.c
diffstat 2 files changed, 27 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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);