Index: trunk/src/gdi32/gdi32.DEF
===================================================================
--- trunk/src/gdi32/gdi32.DEF	(revision 7675)
+++ trunk/src/gdi32/gdi32.DEF	(revision 7682)
@@ -1,3 +1,3 @@
-; $Id: gdi32.DEF,v 1.20 2001-09-19 15:38:42 sandervl Exp $
+; $Id: gdi32.DEF,v 1.21 2001-12-26 11:33:10 sandervl Exp $
 
 ;Created by BLAST for IBM's compiler
@@ -365,10 +365,4 @@
 ; Function exported to USER32
 ;
-    InternalDrawTextExA                                         @1205 NONAME
-    InternalDrawTextExW                                         @1206 NONAME
-;;    InternalTabbedTextOutA                                      @1207 NONAME
-;;    InternalTabbedTextOutW                                      @1208 NONAME
-;;    InternalGetTabbedTextExtentA                                @1209 NONAME
-;;    InternalGetTabbedTextExtentW                                @1210 NONAME
     _setWinDeviceRegionFromPMDeviceRegion@16                    @1211 NONAME
 
Index: trunk/src/gdi32/text.cpp
===================================================================
--- trunk/src/gdi32/text.cpp	(revision 7675)
+++ trunk/src/gdi32/text.cpp	(revision 7682)
@@ -1,3 +1,3 @@
-/* $Id: text.cpp,v 1.27 2001-09-09 12:24:13 sandervl Exp $ */
+/* $Id: text.cpp,v 1.28 2001-12-26 11:33:10 sandervl Exp $ */
 
 /*
@@ -70,554 +70,4 @@
     return GetTextCharsetInfo(hdc, NULL, 0);
 }
-//******************************************************************************
-// CB: USER32 function, but here is the better place
-//******************************************************************************
-INT SYSTEM EXPORT InternalDrawTextExA(HDC hdc,LPCSTR lpchText,INT cchText,LPRECT lprc,UINT dwDTFormat,LPDRAWTEXTPARAMS lpDTParams,BOOL isDrawTextEx)
-{
-  INT rc;
-  ULONG flCmd;
-  RECT localRectangle;
-  PRECT rectPtr;
-  LONG lTabs,xLeft,yTop;
-  UINT fpuctrlword;
-
-  //SvL: Open32's DrawText messes up the fpu control word! (@#$@#$@#$)
-  //CB: don't know if this is still the case with WinDrawTabbedText (-> testcase)
-  fpuctrlword = _control87(0, 0);
-
-  if ((!lpchText) || (cchText == 0) || (cchText < -1) || (lprc == NULL))
-  {
-    SetLastError(ERROR_INVALID_PARAMETER);
-    return 0;
-  }
-
-  pDCData pHps = (pDCData)OSLibGpiQueryDCData(hdc);
-
-  if (!pHps)
-  {
-    SetLastError(ERROR_INVALID_HANDLE);
-    return 0;
-  }
-
-  if (cchText == -1)
-  {
-    cchText = strlen(lpchText);
-    if (cchText == 0)
-      return 0; //CB: does Win32 return textheight in this case?
-  }
-
-  if (lpDTParams)
-  {
-    // set margins
-    lprc->left += lpDTParams->iLeftMargin;
-    lprc->right -= lpDTParams->iRightMargin;
-
-    // just assume all the text has been drawn
-    lpDTParams->uiLengthDrawn = cchText;
-  }
-
-  if (!(dwDTFormat & DT_CALCRECT))
-  {
-    BOOL bTopBottomIsOkay;
-
-    if ((getIsTopTop(pHps) && lprc->top > lprc->bottom) ||
-        (!getIsTopTop(pHps) && lprc->top < lprc->bottom))
-      bTopBottomIsOkay = FALSE;
-    else
-      bTopBottomIsOkay = TRUE;
-
-    if ((lprc->left >= lprc->right) || !bTopBottomIsOkay)
-    {
-      TEXTMETRICA txtMetrics;
-      BOOL result;
-
-      result = GetTextMetricsA(hdc,&txtMetrics);
-      if (result)
-        rc = (int)txtMetrics.tmHeight;
-      else
-        rc = 0;
-
-      if (lpDTParams)
-      {
-        lprc->left -= lpDTParams->iLeftMargin;
-        lprc->right += lpDTParams->iRightMargin;
-      }
-
-      return rc;
-    }
-  }
-#ifdef INVERT
-  flCmd = DTOS_INVERT | DTOS_WORLDRECT | DTOS_TEXTATTRS | DTOS_AMPERSAND | DTOS_VERTICALEXTENT;
-#else
-  flCmd = DTOS_INVERT | DTOS_WORLDRECT | DTOS_TEXTATTRS | DTOS_AMPERSAND | DTOS_VERTICALEXTENT;
-#endif
-
-  LONG lMixMode = OSLibGpiQueryBackMix(pHps);
-  if (lMixMode == BMOS_OVERPAINT) flCmd |= DTOS_OPAQUE;
-
-  if (dwDTFormat & DT_CALCRECT)
-  {
-    rectPtr = lprc;
-    flCmd |= DTOS_QUERYEXTENT;
-
-    xLeft = rectPtr->left;
-    yTop = rectPtr->top;
-
-    if (dwDTFormat & DT_RIGHT)
-    {
-      if (rectPtr->left >= rectPtr->right)
-        rectPtr->left = rectPtr->right-1;
-    } else
-    {
-      if (rectPtr->right <= rectPtr->left)
-        rectPtr->right = rectPtr->left+1;
-    }
-
-    if (dwDTFormat & DT_BOTTOM)
-    {
-      if (rectPtr->top >= rectPtr->bottom)
-        rectPtr->top = rectPtr->bottom-1;
-    } else
-    {
-      if (rectPtr->bottom <= rectPtr->top)
-        rectPtr->bottom = rectPtr->top+1;
-    }
-  } else
-  {
-    rectPtr = &localRectangle;
-
-    if ((getMapMode(pHps) == MMOS_ANISOTROPIC) || (getMapMode(pHps) == MMOS_ISOTROPIC))
-    {
-      if (doesYAxisGrowNorth(pHps))
-      {
-        flCmd &= ~DTOS_INVERT;
-        flCmd |=  DTOS_INVERTCHAR;
-      }
-    }
-
-    if (lprc->left > lprc->right)
-    {
-      rectPtr->left  = lprc->right;
-      rectPtr->right = lprc->left;
-    } else
-    {
-      rectPtr->left  = lprc->left;
-      rectPtr->right = lprc->right;
-    }
-    if (lprc->top > lprc->bottom)
-    {
-      rectPtr->top    = lprc->bottom;
-      rectPtr->bottom = lprc->top;
-    } else
-    {
-      rectPtr->top    = lprc->top;
-      rectPtr->bottom = lprc->bottom;
-    }
-
-#ifndef INVERT
-    if (pHps->yInvert > 0) {
-      int temp        = pHps->yInvert - rectPtr->bottom;
-      rectPtr->bottom = pHps->yInvert - rectPtr->top;
-      rectPtr->top    = temp;
-    }
-#endif
-  }
-
-#ifndef INVERT
-////  dwDTFormat &= ~DT_INVERT;
-////  dwDTFormat |=  DT_INVERTCHAR;
-  int top = rectPtr->top;
-#endif
-
-  if (dwDTFormat & DT_EXPANDTABS)
-  {
-    if (isDrawTextEx)
-    {
-      lTabs = (lpDTParams && (dwDTFormat & DT_TABSTOP)) ? lpDTParams->iTabLength:8;
-    } else
-    {
-      lTabs = 8;
-
-      if (dwDTFormat & DT_TABSTOP)
-      {
-        lTabs = (dwDTFormat >> 8) & 0x000000FF;
-        dwDTFormat &= 0xFFFF00FF;
-      }
-    }
-  } else lTabs = -1;
-
-  if (dwDTFormat & DT_RIGHT)
-    flCmd |= DTOS_RIGHT;
-  else
-    if (dwDTFormat & DT_CENTER) flCmd |= DTOS_CENTER;
-  if (dwDTFormat & DT_BOTTOM)          flCmd |= DTOS_BOTTOM;
-  if (dwDTFormat & DT_VCENTER)         flCmd |= DTOS_VCENTER;
-  if (dwDTFormat & DT_WORDBREAK)       flCmd |= DTOS_WORDBREAK;
-  if (dwDTFormat & DT_EXTERNALLEADING) flCmd |= DTOS_EXTERNALLEADING;
-  if (!(dwDTFormat & DT_NOPREFIX))     flCmd |= DTOS_MNEMONIC;
-  if (dwDTFormat & DT_SINGLELINE)
-    flCmd |= DTOS_SINGLELINE;
-  else
-    flCmd |= DTOS_MULTILINE;
-  if (dwDTFormat & DT_NOCLIP)          flCmd |= DTOS_NOCLIP;
-
-  //CB: DT_EDITCONTROL, DT_RTLREADING ignored
-
-  BOOL done = FALSE;
-
-  if ((dwDTFormat & DT_END_ELLIPSIS) && (cchText > 1))
-  {
-    int textWidth,width;
-    RECT rect;
-
-    SetRectEmpty(&rect);
-    OSLibWinDrawTabbedText(pHps,cchText,lTabs,lpchText,&rect,0,0,flCmd | DTOS_QUERYEXTENT);
-    width = rectPtr->right-rectPtr->left;
-    textWidth = rect.right-rect.left;
-    if ((textWidth > width) && (width > 0))
-    {
-      char* newText;
-      int newTextLen = cchText-1+ELLIPSISLEN;
-      int preLen = cchText-1;
-
-      newText = (char*)malloc(newTextLen+1);
-      strncpy(newText,lpchText,cchText-1);
-      do
-      {
-        strcpy(&newText[preLen],ELLIPSIS);
-        OSLibWinDrawTabbedText(pHps,newTextLen,lTabs,newText,&rect,0,0,flCmd | DTOS_QUERYEXTENT);
-        textWidth = rect.right-rect.left;
-        if (textWidth <= width || preLen == 1) break;
-        newTextLen--;
-        preLen--;
-      } while (TRUE);
-      rc = OSLibWinDrawTabbedText(pHps,newTextLen,lTabs,newText,rectPtr,0,0,flCmd);
-      if (dwDTFormat & DT_MODIFYSTRING) strcpy((LPSTR)lpchText,newText); //check length?
-      free(newText);
-
-      done = TRUE;
-    }
-  } else if ((dwDTFormat & DT_PATH_ELLIPSIS) && (cchText > 1))
-  {
-    int textWidth,width;
-    RECT rect;
-
-//CB: code not yet checked (-> testcase)
-
-    SetRectEmpty(&rect);
-    OSLibWinDrawTabbedText(pHps,cchText,lTabs,lpchText,&rect,0,0,flCmd | DTOS_QUERYEXTENT);
-    width = rectPtr->right-rectPtr->left;
-    textWidth = rect.right-rect.left;
-    if ((textWidth > width) && (width > 0))
-    {
-      char *newText,*slashPos;
-      int newTextLen = cchText+ELLIPSISLEN;
-
-      newText = (char*)malloc(newTextLen+1);
-      strncpy(newText,lpchText,cchText);
-      
-      // PH 2000/10/01 "//" appeared wrong ...
-      slashPos = strrchr(newText,(int)'\\');
-      if (slashPos != NULL)
-      {
-        int preLen = slashPos-newText;
-        char* endPtr = (char*)lpchText+preLen;
-        int endLen = cchText-preLen;
-        BOOL ok = FALSE;
-
-        //delete start
-        do
-        {
-          strcpy(&newText[preLen],ELLIPSIS);
-          strncpy(&newText[preLen+ELLIPSISLEN],endPtr,endLen);
-          OSLibWinDrawTabbedText(pHps,newTextLen,lTabs,newText,&rect,0,0,flCmd | DTOS_QUERYEXTENT);
-          textWidth = rect.right-rect.left;
-          if (textWidth <= width)
-          {
-            ok = TRUE;
-            break;
-          }
-          if (preLen == 0) break;
-          newTextLen--;
-          preLen--;
-        } while (TRUE);
-
-        if (!ok)
-        {
-          //delete end
-          do
-          {
-            endPtr++;
-            endLen--;
-            newTextLen--;
-            strncpy(&newText[ELLIPSISLEN],endPtr,endLen);
-            OSLibWinDrawTabbedText(pHps,newTextLen,lTabs,newText,&rect,0,0,flCmd | DTOS_QUERYEXTENT);
-            textWidth = rect.right-rect.left;
-            if ((textWidth <= width) || (endLen == 0)) break;
-          } while (TRUE);
-        }
-      } else
-      {
-        int preLen,endLen;
-
-        preLen = cchText/2;
-        endLen = cchText-preLen; //endLen >= preLen
-        char* endPtr = (char*)lpchText+preLen;
-
-        do
-        {
-          strcpy(&newText[preLen],ELLIPSIS);
-          strncpy(&newText[preLen+ELLIPSISLEN],endPtr,endLen);
-          OSLibWinDrawTabbedText(pHps,newTextLen,lTabs,newText,&rect,0,0,flCmd | DTOS_QUERYEXTENT);
-          textWidth = rect.right-rect.left;
-          if ((textWidth <= width) || (preLen+endLen == 0)) break;
-          if (endLen > preLen)
-          {
-            endLen--;
-            endPtr++;
-          } else preLen--;
-          newTextLen--;
-        } while (TRUE);
-      }
-      rc = OSLibWinDrawTabbedText(pHps,newTextLen,lTabs,newText,rectPtr,0,0,flCmd);
-      if (dwDTFormat & DT_MODIFYSTRING) strcpy((LPSTR)lpchText,newText); //check length?
-      free(newText);
-
-      done = TRUE;
-    }
-  }
-
-  if (!done)
-  {
-    rc = OSLibWinDrawTabbedText(pHps,cchText,lTabs,lpchText,rectPtr,0,0,flCmd);
-  }
-
-  if (dwDTFormat & DT_CALCRECT)
-  {
-#ifndef INVERT
-    if (pHps->yInvert > 0) {
-         top              = top - rectPtr->top;
-         rectPtr->top    += top;
-         rectPtr->bottom += top;
-    } /* endif */
-#endif
-    if (!(dwDTFormat & DT_RIGHT) && (rectPtr->left < xLeft))
-    {
-      rectPtr->right = xLeft+(rectPtr->right-rectPtr->left);
-      rectPtr->left = xLeft;
-    }
-    if (!(dwDTFormat & DT_BOTTOM) && (rectPtr->top < yTop))
-    {
-      rectPtr->bottom = yTop+(rectPtr->bottom-rectPtr->top);
-      rectPtr->top = yTop;
-    }
-  }
-
-  if (lpDTParams)
-  {
-    // don't forget to restore the margins
-    lprc->left -= lpDTParams->iLeftMargin;
-    lprc->right += lpDTParams->iRightMargin;
-  }
-
-  _control87(fpuctrlword, 0xFFFF);
-
-  return rc;
-}
-//******************************************************************************
-//******************************************************************************
-INT SYSTEM EXPORT InternalDrawTextExW(HDC hdc,LPCWSTR lpchText,INT cchText,LPRECT lprc,UINT dwDTFormat,LPDRAWTEXTPARAMS lpDTParams,BOOL isDrawTextEx)
-{
-  char *astring = NULL;
-  INT  rc;
-
-  if(cchText == -1) {
-     astring = UnicodeToAsciiString((LPWSTR)lpchText);
-  }
-  else {
-     astring = (char *)HEAP_malloc(cchText+1);
-     UnicodeToAsciiN((LPWSTR)lpchText, astring, cchText+1);
-     astring[cchText] = 0;
-  }
-
-  dprintf(("InternalDrawTextExW %x %s %d %x", hdc, astring, cchText, dwDTFormat));
-  rc = InternalDrawTextExA(hdc,astring,cchText,lprc,dwDTFormat,lpDTParams,isDrawTextEx);
-  if (dwDTFormat & DT_MODIFYSTRING && (dwDTFormat & (DT_END_ELLIPSIS | DT_PATH_ELLIPSIS))) AsciiToUnicode(astring,(LPWSTR)lpchText);
-  FreeAsciiString(astring);
-
-  return(rc);
-}
-#if 0
-//Replaced with Wine functions in user32\text.cpp)
-//******************************************************************************
-// CB: USER32 function, but here is the better place
-//******************************************************************************
-DWORD SYSTEM EXPORT InternalGetTabbedTextExtentA(HDC hDC,LPCSTR lpString,INT nCount,INT nTabPositions,LPINT lpnTabStopPositions)
-{
-  pDCData pHps = (pDCData)OSLibGpiQueryDCData(hDC);
-  BOOL result;
-  POINTLOS2 pts[TXTBOXOS_COUNT];
-  POINTLOS2 widthHeight = {0,0};
-
-  if (!pHps || (nCount == 0) || (nTabPositions < 0))
-    return 0;
-
-  if (nCount < 0)
-  {
-    SetLastError(ERROR_STACK_OVERFLOW);
-    return 0;
-  }
-  if ((lpString == NULL) || ((nTabPositions > 0) && (lpnTabStopPositions == NULL)))
-  {
-    SetLastError(ERROR_INVALID_PARAMETER);
-    return 0;
-  }
-  if(nCount > 512) {
-      DWORD cbStringNew;
-      DWORD ret1;
-      DWORD ret = 0;
-
-      dprintf(("WARNING: InternalGetTabbedTextExtentA string longer than 512 chars; splitting up"));
-      while(nCount) {
-         cbStringNew = min(500, nCount);
-
-         ret = InternalGetTabbedTextExtentA(hDC, lpString, cbStringNew, nTabPositions, lpnTabStopPositions);
-         lpString += cbStringNew;
-         nCount   -= cbStringNew;
-      }
-      return ret;
-  }
-
-  //CB: Win95 supports negative values for right aligned text
-  for (INT i = 0;i < nTabPositions;i++)
-  {
-    if (lpnTabStopPositions[i] < 0)
-    {
-      SetLastError(ERROR_INVALID_PARAMETER);
-      return 0;
-    }
-  }
-
-  result = OSLibGpiQueryTextBox(pHps,(nCount > 1) ? 1:nCount,lpString,TXTBOXOS_COUNT,pts);
-  if (result == FALSE)
-    return 0;
-  calcDimensions(pts,&widthHeight);
-
-  LONG rv1 = OSLibGpiQueryTabbedTextExtent(pHps,nCount,lpString,nTabPositions,lpnTabStopPositions);
-  if (rv1 == GPIOS_ERROR)
-    return 0;
-
-  return (widthHeight.y <<16)+labs(rv1);
-}
-//******************************************************************************
-//******************************************************************************
-DWORD SYSTEM EXPORT InternalGetTabbedTextExtentW(HDC hDC,LPCWSTR lpString,INT nCount,INT nTabPositions,LPINT lpnTabStopPositions)
-{
-  char *astring;
-  DWORD rc;
-
-  if(nCount == -1) {
-     astring = UnicodeToAsciiString((LPWSTR)lpString);
-  }
-  else {
-     astring = (char *)HEAP_malloc(nCount+1);
-     UnicodeToAsciiN((LPWSTR)lpString, astring, nCount+1);
-     astring[nCount] = 0;
-  }
-
-  rc = InternalGetTabbedTextExtentA(hDC,astring,nCount,nTabPositions,lpnTabStopPositions);
-  FreeAsciiString(astring);
-
-  return(rc);
-}
-//******************************************************************************
-// CB: USER32 function, but here is the better place
-//******************************************************************************
-LONG SYSTEM EXPORT InternalTabbedTextOutA(HDC hdc,INT x,INT y,LPCSTR lpString,INT nCount,INT nTabPositions,LPINT lpnTabStopPositions,INT nTabOrigin)
-{
-  pDCData pHps = (pDCData)OSLibGpiQueryDCData(hdc);
-  POINTLOS2 ptl;
-  DWORD dimensions;
-
-  if ((pHps == NULL) || (lpString == NULL))
-  {
-    SetLastError(ERROR_INVALID_HANDLE);
-    return 0;
-  }
-  if (nCount == -1)
-    nCount = strlen(lpString);
-  if (nCount < 1)
-  {
-    SetLastError(ERROR_INVALID_HANDLE);
-    return 0;
-  }
-  if (lpnTabStopPositions == NULL)
-    nTabPositions = 0;
-  if (nTabPositions == 0)
-    lpnTabStopPositions = NULL;
-  if (nTabPositions < 0)
-  {
-    SetLastError(ERROR_INVALID_HANDLE);
-    return 0;
-  }
-  if (getAlignUpdateCP(pHps) == TRUE) {
-    OSLibGpiQueryCurrentPosition(pHps,&ptl);
-  }
-  else
-  {
-    ptl.x = x;
-    ptl.y = y;
-#ifndef INVERT
-    if (pHps->yInvert > 0) {
-       ptl.y = pHps->yInvert - ptl.y;
-    }
-#endif
-  }
-
-  //CB: nTabOrigin is ignored! -> wrong size (width)!
-  //    todo: change low word (width), height is ok
-  dimensions = InternalGetTabbedTextExtentA(hdc,lpString,nCount,nTabPositions,lpnTabStopPositions);
-  if (dimensions != 0)
-  {
-    LONG rcGPI;
-
-    ptl.y += getWorldYDeltaFor1Pixel(pHps);
-
-    rcGPI = OSLibGpiTabbedCharStringAt(pHps,&ptl,NULL,0,nCount,lpString,nTabPositions,lpnTabStopPositions,nTabOrigin);
-    if (rcGPI == GPIOS_ALTERROR)
-      return 0;
-    if (getAlignUpdateCP(pHps))
-    {
-      OSLibGpiQueryCurrentPosition (pHps,&ptl);
-      ptl.y -= getWorldYDeltaFor1Pixel(pHps);
-      OSLibGpiSetCurrentPosition (pHps,&ptl);
-    }
-
-    return dimensions;
-  }
-  return 0;
-}
-//******************************************************************************
-//******************************************************************************
-LONG SYSTEM EXPORT InternalTabbedTextOutW(HDC hdc,INT x,INT y,LPCWSTR lpString,INT nCount,INT nTabPositions,LPINT lpnTabStopPositions,INT nTabOrigin)
-{
-  char *astring;
-  LONG rc;
-
-  if(nCount == -1) {
-     astring = UnicodeToAsciiString((LPWSTR)lpString);
-  }
-  else {
-     astring = (char *)HEAP_malloc(nCount+1);
-     UnicodeToAsciiN((LPWSTR)lpString, astring, nCount+1);
-     astring[nCount] = 0;
-  }
-
-  rc = InternalTabbedTextOutA(hdc,x,y,astring,nCount,nTabPositions,lpnTabStopPositions,nTabOrigin);
-  FreeAsciiString(astring);
-
-  return(rc);
-}
-#endif
 //******************************************************************************
 // todo: metafile support
@@ -847,5 +297,5 @@
 BOOL WIN32API PolyTextOutA(HDC hdc,POLYTEXTA *pptxt,int cStrings)
 {
-  dprintf(("GDI32: PolyTextOutA"));
+  dprintf(("GDI32: PolyTextOutA %x %x %d", hdc, pptxt, cStrings));
 
   for (INT x = 0;x < cStrings;x++)
@@ -863,5 +313,5 @@
 BOOL WIN32API PolyTextOutW(HDC hdc,POLYTEXTW *pptxt,int cStrings)
 {
-  dprintf(("GDI32: PolyTextOutW"));
+  dprintf(("GDI32: PolyTextOutW %x %x %d", hdc, pptxt, cStrings));
 
   for (INT x = 0;x < cStrings;x++)
