Index: trunk/src/helpers/dialog.c
===================================================================
--- trunk/src/helpers/dialog.c	(revision 78)
+++ trunk/src/helpers/dialog.c	(revision 79)
@@ -103,6 +103,6 @@
 
     HPS         hps;
-    const char  *pcszFontLast;
-    LONG        lcidLast;
+    /* const char  *pcszFontLast;
+    LONG        lcidLast; */
 } DLGPRIVATE, *PDLGPRIVATE;
 
@@ -215,4 +215,6 @@
  *@@ CalcAutoSizeText:
  *
+ *@@changed V0.9.12 (2001-05-31) [umoeller]: fixed various things with statics
+ *@@changed V0.9.12 (2001-05-31) [umoeller]: fixed broken fonts
  */
 
@@ -222,6 +224,7 @@
                       PDLGPRIVATE pDlgData)
 {
-    BOOL        fFind = TRUE;
+    BOOL        fFind = FALSE;
     RECTL       rclText;
+    LONG        lcid = 0;
 
     const char *pcszFontThis = pControlDef->pcszFont;
@@ -233,33 +236,19 @@
 
     if (!pDlgData->hps)
-    {
-        // first call: get a PS
         pDlgData->hps = WinGetPS(pDlgData->hwndDlg);
-        fFind = TRUE;
-    }
-    else
-        if (strhcmp(pcszFontThis, pDlgData->pcszFontLast))
-            fFind = TRUE;
-
-    if (fFind)
+
+    if (pcszFontThis)
     {
         FONTMETRICS fm;
-        LONG lcid;
         LONG lPointSize = 0;
-        if (pDlgData->lcidLast)
-        {
-            // delete old font
-            GpiSetCharSet(pDlgData->hps, LCID_DEFAULT);
-            GpiDeleteSetId(pDlgData->hps, pDlgData->lcidLast);
-        }
 
         // create new font
-        pDlgData->lcidLast = gpihFindPresFont(NULLHANDLE,        // no window yet
-                                              FALSE,
-                                              pDlgData->hps,
-                                              pcszFontThis,
-                                              &fm,
-                                              &lPointSize);
-        GpiSetCharSet(pDlgData->hps, pDlgData->lcidLast);
+        lcid = gpihFindPresFont(NULLHANDLE,        // no window yet
+                                FALSE,
+                                pDlgData->hps,
+                                pcszFontThis,
+                                &fm,
+                                &lPointSize);
+        GpiSetCharSet(pDlgData->hps, lcid);
         if (fm.fsDefn & FM_DEFN_OUTLINE)
             gpihSetPointSize(pDlgData->hps, lPointSize);
@@ -275,5 +264,14 @@
         if (fMultiLine)
         {
-            RECTL rcl = {0, 0, 1000, 1000};
+            RECTL rcl = {0, 0, 0, 0};
+            if (pControlDef->szlControlProposed.cx != -1)
+                rcl.xRight = pControlDef->szlControlProposed.cx;   // V0.9.12 (2001-05-31) [umoeller]
+            else
+                rcl.xRight = winhQueryScreenCX() * 2 / 3;
+            if (pControlDef->szlControlProposed.cy != -1)
+                rcl.yTop = pControlDef->szlControlProposed.cy;   // V0.9.12 (2001-05-31) [umoeller]
+            else
+                rcl.yTop = winhQueryScreenCY() * 2 / 3;
+
             winhDrawFormattedText(pDlgData->hps,
                                   &rcl,
@@ -294,4 +292,11 @@
         }
     }
+
+    /* if (lcid)
+    {
+        GpiSetCharSet(pDlgData->hps, LCID_DEFAULT);
+        GpiDeleteSetId(pDlgData->hps, lcid);
+    } */
+
 }
 
@@ -299,4 +304,5 @@
  *@@ CalcAutoSize:
  *
+ *@@changed V0.9.12 (2001-05-31) [umoeller]: fixed various things with statics
  */
 
@@ -336,10 +342,10 @@
 
         case 0xffff0005L: // WC_STATIC:
-            if (pControlDef->flStyle & SS_TEXT)
+            if ((pControlDef->flStyle & 0x0F) == SS_TEXT)
                 CalcAutoSizeText(pControlDef,
                                  ((pControlDef->flStyle & DT_WORDBREAK) != 0),
                                  pszlAuto,
                                  pDlgData);
-            else if (pControlDef->flStyle & SS_BITMAP)
+            else if ((pControlDef->flStyle & 0x0F) == SS_BITMAP)
             {
                 HBITMAP hbm = (HBITMAP)pControlDef->pcszText;
@@ -357,4 +363,9 @@
                 }
             }
+            else if ((pControlDef->flStyle & 0x0F) == SS_ICON)
+            {
+                pszlAuto->cx = WinQuerySysValue(HWND_DESKTOP, SV_CXICON);
+                pszlAuto->cy = WinQuerySysValue(HWND_DESKTOP, SV_CYICON);
+            }
         break;
     }
@@ -397,4 +408,6 @@
  *         after the recursion.
  *
+ *@@changed V0.9.12 (2001-05-31) [umoeller]: added control data
+ *@@changed V0.9.12 (2001-05-31) [umoeller]: fixed font problems
  */
 
@@ -559,4 +572,5 @@
             ULONG       flStyle = 0;
             LHANDLE     lHandleSet = NULLHANDLE;
+            ULONG       flOld = 0;
 
             if (pColumnDef->fIsNestedTable)
@@ -594,10 +608,13 @@
                 // we have used a HBITMAP in there!
                 if (    ((ULONG)pControlDef->pcszClass == 0xffff0005L) // WC_STATIC:
-                     && (flStyle & SS_BITMAP)
+                     && (    ((flStyle & 0x0F) == SS_BITMAP)
+                          || ((flStyle & 0x0F) == SS_ICON)
+                        )
                    )
                 {
-                    // change style flag to not use SS_BITMAP;
+                    // change style flag to not use SS_BITMAP nor SS_ICON;
                     // control creation fails otherwise (stupid, stupid PM)
-                    flStyle = ((flStyle & ~SS_BITMAP) | SS_FGNDFRAME);
+                    flOld = flStyle;
+                    flStyle = ((flStyle & ~0x0F) | SS_FGNDFRAME);
                     pcszTitle = "";
                     lHandleSet = (LHANDLE)pControlDef->pcszText;
@@ -608,5 +625,5 @@
             {
                 // create something:
-                PPRESPARAMS ppp = NULL;
+                // PPRESPARAMS ppp = NULL;
 
                 const char  *pcszFont = pControlDef->pcszFont;
@@ -615,9 +632,9 @@
                     pcszFont = pDlgData->pcszControlsFont;
 
-                if (pcszFont)
+                /* if (pcszFont)
                     winhStorePresParam(&ppp,
                                        PP_FONTNAMESIZE,
                                        strlen(pcszFont),
-                                       (PVOID)pcszFont);
+                                       (PVOID)pcszFont); */
 
                 pColumnDef->hwndControl
@@ -635,12 +652,18 @@
                                       HWND_BOTTOM,
                                       pControlDef->usID,
-                                      NULL,             // @@todo control data
-                                      ppp);
-
-                if (pColumnDef->hwndControl && lHandleSet)
+                                      pControlDef->pvCtlData,
+                                      NULL); // ppp);
+
+                if ((pColumnDef->hwndControl) && (lHandleSet))
                 {
                     // subclass the damn static
-                    ctlPrepareStretchedBitmap(pColumnDef->hwndControl,
-                                              TRUE);
+                    if ((flOld & 0x0F) == SS_ICON)
+                        // this was a static:
+                        ctlPrepareStaticIcon(pColumnDef->hwndControl,
+                                             1);
+                    else
+                        // this was a bitmap:
+                        ctlPrepareStretchedBitmap(pColumnDef->hwndControl,
+                                                  TRUE);
 
                     WinSendMsg(pColumnDef->hwndControl,
@@ -649,7 +672,12 @@
                                0);
                 }
-
-                if (ppp)
-                    free(ppp);
+                else
+                    if (pcszFont)
+                        // we must set the font explicitly here...
+                        // doesn't always work with WinCreateWindow
+                        // presparams parameter, for some reason
+                        // V0.9.12 (2001-05-31) [umoeller]
+                        winhSetWindowFont(pColumnDef->hwndControl,
+                                          pcszFont);
 
                 if (pColumnDef->hwndControl)
@@ -1323,4 +1351,5 @@
 
         FRAMECDATA      fcData = {0};
+        ULONG           flStyle = 0;
 
         #define FCF_DIALOGBOX   0x40000000L
@@ -1328,15 +1357,20 @@
         fcData.cb = sizeof(FRAMECDATA);
         fcData.flCreateFlags = flCreateFlags | FCF_DIALOGBOX;
+
+        if (flCreateFlags & FCF_SIZEBORDER)
+            // dialog has size border:
+            // add "clip siblings" style
+            flStyle |= WS_CLIPSIBLINGS;
 
         pDlgData->hwndDlg = WinCreateWindow(HWND_DESKTOP,
                                             WC_FRAME,
                                             (PSZ)pcszDlgTitle,
-                                            0,               // style; invisible for now
+                                            flStyle,        // style; invisible for now
                                             0, 0, 0, 0,
                                             hwndOwner,
                                             HWND_TOP,
-                                            0,               // ID
+                                            0,              // ID
                                             &fcData,
-                                            NULL);           // presparams
+                                            NULL);          // presparams
 
         if (!pDlgData->hwndDlg)
@@ -1357,19 +1391,6 @@
                        PROCESS_CALC_SIZES);
 
-            // this might have created a HPS and a font in dlgdata
-            // for auto-sizing controls
             if (pDlgData->hps)
-            {
-                if (pDlgData->lcidLast)
-                {
-                    // delete old font
-                    GpiSetCharSet(pDlgData->hps, LCID_DEFAULT);
-                    GpiDeleteSetId(pDlgData->hps, pDlgData->lcidLast);
-                    pDlgData->lcidLast = 0;
-                }
-
                 WinReleasePS(pDlgData->hps);
-                pDlgData->hps = NULLHANDLE;
-            }
 
             WinSubclassWindow(pDlgData->hwndDlg, pfnwpDialogProc);
@@ -1649,5 +1670,5 @@
             // control
 
-            _Pmpf((__FUNCTION__ ": hwnd 0x%lX", hwnd));
+            // _Pmpf((__FUNCTION__ ": hwnd 0x%lX", hwnd));
 
             // check if this is a focusable control
@@ -1702,10 +1723,10 @@
             if (!strcmp(szClass, "#3"))    // button
             {
-                _Pmpf((__FUNCTION__ ": found button"));
+                // _Pmpf((__FUNCTION__ ": found button"));
                 if (    (WinQueryWindowULong(hwnd, QWL_STYLE) & (BS_PUSHBUTTON | BS_DEFAULT))
                      == (BS_PUSHBUTTON | BS_DEFAULT)
                    )
                 {
-                    _Pmpf(("   is default!"));
+                    // _Pmpf(("   is default!"));
                     WinPostMsg(hwnd,
                                BM_CLICK,
Index: trunk/src/helpers/gpih.c
===================================================================
--- trunk/src/helpers/gpih.c	(revision 78)
+++ trunk/src/helpers/gpih.c	(revision 79)
@@ -650,4 +650,6 @@
  *      See gpihLockLCIDs for how to serialize this.
  *
+ *      Code was extensively re-tested, works (V0.9.12 (2001-05-31) [umoeller]).
+ *
  *@@added V0.9.3 (2000-05-06) [umoeller]
  *@@changed V0.9.9 (2001-04-01) [umoeller]: removed all those sick sub-allocs
@@ -664,7 +666,14 @@
                              //  of objects for which information
                              //  can be returned
+
+    // _Pmpf((__FUNCTION__ ": Entering"));
+
     if (lCount == 0)
+    {
         // none in use yet:
-        lcidNext = 1;
+        lcidNext = 15;
+
+        // _Pmpf(("  no lcids in use"));
+    }
     else
     {
@@ -688,5 +697,7 @@
                 // FINALLY we have all the lcids in use.
                 BOOL    fContinue = TRUE;
-                lcidNext = 1;
+                lcidNext = 15;
+
+                // _Pmpf(("  %d fonts in use, browsing...", lCount));
 
                 // now, check if this lcid is in use already:
@@ -711,8 +722,13 @@
                         // lcid found:
                         // try next higher one
+
+                        // _Pmpf(("       %d is busy...", lcidNext));
+
                         lcidNext++;
                         fContinue = TRUE;
                     }
-                    // else: return that one
+                    // else
+                        // else: return that one
+                        // _Pmpf(("  %d is free", lcidNext));
                 }
             }
@@ -815,4 +831,6 @@
         */
     }
+
+    // _Pmpf((__FUNCTION__ ": Returning lcid %d", lcidNext));
 
     return (lcidNext);
@@ -1189,4 +1207,6 @@
     }
 
+    _Pmpf((__FUNCTION__ ": returning lcid %d", lLCIDReturn));
+
     return (lLCIDReturn);
 }
@@ -1274,4 +1294,5 @@
         }
     }
+
     return (0);
 }
