Changeset 5810 for trunk/src


Ignore:
Timestamp:
May 27, 2001, 9:01:35 PM (24 years ago)
Author:
sandervl
Message:

Replaced TabbedTextOutA/W & GetTabbedTextExtentA/W with Wine version

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gdi32/gdi32.DEF

    r5390 r5810  
    1 ; $Id: gdi32.DEF,v 1.16 2001-03-27 20:47:52 sandervl Exp $
     1; $Id: gdi32.DEF,v 1.17 2001-05-27 19:01:14 sandervl Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    367367    InternalDrawTextExA                                         @1205 NONAME
    368368    InternalDrawTextExW                                         @1206 NONAME
    369     InternalTabbedTextOutA                                      @1207 NONAME
    370     InternalTabbedTextOutW                                      @1208 NONAME
    371     InternalGetTabbedTextExtentA                                @1209 NONAME
    372     InternalGetTabbedTextExtentW                                @1210 NONAME
     369;;    InternalTabbedTextOutA                                      @1207 NONAME
     370;;    InternalTabbedTextOutW                                      @1208 NONAME
     371;;    InternalGetTabbedTextExtentA                                @1209 NONAME
     372;;    InternalGetTabbedTextExtentW                                @1210 NONAME
    373373    _setWinDeviceRegionFromPMDeviceRegion@16                    @1211 NONAME
    374374
  • trunk/src/gdi32/text.cpp

    r5799 r5810  
    1 /* $Id: text.cpp,v 1.22 2001-05-25 10:05:29 sandervl Exp $ */
     1/* $Id: text.cpp,v 1.23 2001-05-27 19:01:14 sandervl Exp $ */
    22
    33/*
     
    470470  return(rc);
    471471}
     472#if 0
     473//Replaced with Wine functions in user32\text.cpp)
    472474//******************************************************************************
    473475// CB: USER32 function, but here is the better place
     
    488490    return 0;
    489491  }
    490   if ((lpString == NULL) || (nCount >  512) || ((nTabPositions > 0) && (lpnTabStopPositions == NULL)))
     492  if ((lpString == NULL) || ((nTabPositions > 0) && (lpnTabStopPositions == NULL)))
    491493  {
    492494    SetLastError(ERROR_INVALID_PARAMETER);
    493495    return 0;
    494496  }
     497  if(nCount > 512) {
     498      DWORD cbStringNew;
     499      DWORD ret1;
     500      DWORD ret = 0;
     501
     502      dprintf(("WARNING: InternalGetTabbedTextExtentA string longer than 512 chars; splitting up"));
     503      while(nCount) {
     504         cbStringNew = min(500, nCount);
     505
     506         ret = InternalGetTabbedTextExtentA(hDC, lpString, cbStringNew, nTabPositions, lpnTabStopPositions);
     507         lpString += cbStringNew;
     508         nCount   -= cbStringNew;
     509      }
     510      return ret;
     511  }
     512
    495513  //CB: Win95 supports negative values for right aligned text
    496514  for (INT i = 0;i < nTabPositions;i++)
     
    623641  return(rc);
    624642}
     643#endif
    625644//******************************************************************************
    626645// todo: metafile support
  • trunk/src/user32/text.cpp

    r5796 r5810  
    1 /* $Id: text.cpp,v 1.11 2001-05-24 19:26:59 sandervl Exp $ */
     1/* $Id: text.cpp,v 1.12 2001-05-27 19:01:35 sandervl Exp $ */
    22
    33/*
     
    1414#include "user32.h"
    1515#include "syscolor.h"
     16#include <winnls.h>
    1617
    1718#define DBG_LOCALLOG    DBG_text
     
    5051  return InternalDrawTextExW(hdc,lpchText,cchText,lprc,dwDTFormat,lpDTParams,TRUE);
    5152}
     53#if 1
     54//Based on Wine version 20010510
     55/***********************************************************************
     56 *           TEXT_TabbedTextOut
     57 *
     58 * Helper function for TabbedTextOut() and GetTabbedTextExtent().
     59 * Note: this doesn't work too well for text-alignment modes other
     60 *       than TA_LEFT|TA_TOP. But we want bug-for-bug compatibility :-)
     61 */
     62static LONG TEXT_TabbedTextOut( HDC hdc, INT x, INT y, LPCSTR lpstr,
     63                                INT count, INT cTabStops, const INT16 *lpTabPos16,
     64                                const INT *lpTabPos32, INT nTabOrg,
     65                                BOOL fDisplayText )
     66{
     67    INT defWidth;
     68    SIZE extent;
     69    int i, tabPos = x;
     70    int start = x;
     71
     72    extent.cx = 0;
     73    extent.cy = 0;
     74
     75    if (cTabStops == 1)
     76    {
     77        defWidth = lpTabPos32 ? *lpTabPos32 : *lpTabPos16;
     78        cTabStops = 0;
     79    }
     80    else
     81    {
     82        TEXTMETRICA tm;
     83        GetTextMetricsA( hdc, &tm );
     84        defWidth = 8 * tm.tmAveCharWidth;
     85    }
     86
     87    while (count > 0)
     88    {
     89        for (i = 0; i < count; i++)
     90            if (lpstr[i] == '\t') break;
     91        GetTextExtentPointA( hdc, lpstr, i, &extent );
     92        if (lpTabPos32)
     93        {
     94            while ((cTabStops > 0) &&
     95                   (nTabOrg + *lpTabPos32 <= x + extent.cx))
     96            {
     97                lpTabPos32++;
     98                cTabStops--;
     99            }
     100        }
     101        else
     102        {
     103            while ((cTabStops > 0) &&
     104                   (nTabOrg + *lpTabPos16 <= x + extent.cx))
     105            {
     106                lpTabPos16++;
     107                cTabStops--;
     108            }
     109        }
     110        if (i == count)
     111            tabPos = x + extent.cx;
     112        else if (cTabStops > 0)
     113            tabPos = nTabOrg + (lpTabPos32 ? *lpTabPos32 : *lpTabPos16);
     114        else
     115            tabPos = nTabOrg + ((x + extent.cx - nTabOrg) / defWidth + 1) * defWidth;
     116        if (fDisplayText)
     117        {
     118            RECT r;
     119            r.left   = x;
     120            r.top    = y;
     121            r.right  = tabPos;
     122            r.bottom = y + extent.cy;
     123            ExtTextOutA( hdc, x, y,
     124                           GetBkMode(hdc) == OPAQUE ? ETO_OPAQUE : 0,
     125                           &r, lpstr, i, NULL );
     126        }
     127        x = tabPos;
     128        count -= i+1;
     129        lpstr += i+1;
     130    }
     131    return MAKELONG(tabPos - start, extent.cy);
     132}
     133
     134
     135
     136/***********************************************************************
     137 *           TabbedTextOutA    (USER32.@)
     138 */
     139LONG WINAPI TabbedTextOutA( HDC hdc, INT x, INT y, LPCSTR lpstr, INT count,
     140                            INT cTabStops, INT *lpTabPos, INT nTabOrg )
     141{
     142    dprintf(("USER32: TabbedTextOutA %x (%d,%d) %s %d %d %x %d", hdc, x, y, lpstr, count, cTabStops, lpTabPos, nTabOrg));
     143    return TEXT_TabbedTextOut( hdc, x, y, lpstr, count, cTabStops,
     144                               NULL, lpTabPos, nTabOrg, TRUE );
     145}
     146
     147
     148/***********************************************************************
     149 *           TabbedTextOutW    (USER32.@)
     150 */
     151LONG WINAPI TabbedTextOutW( HDC hdc, INT x, INT y, LPCWSTR str, INT count,
     152                            INT cTabStops, INT *lpTabPos, INT nTabOrg )
     153{
     154    LONG ret;
     155    LPSTR p;
     156    INT acount;
     157    UINT codepage = CP_ACP; /* FIXME: get codepage of font charset */
     158
     159    acount = WideCharToMultiByte(codepage,0,str,count,NULL,0,NULL,NULL);
     160    p = (LPSTR)HeapAlloc( GetProcessHeap(), 0, acount );
     161    if(p == NULL) return 0; /* FIXME: is this the correct return on failure */
     162    acount = WideCharToMultiByte(codepage,0,str,count,p,acount,NULL,NULL);
     163    ret = TabbedTextOutA( hdc, x, y, p, acount, cTabStops, lpTabPos, nTabOrg );
     164    HeapFree( GetProcessHeap(), 0, p );
     165    return ret;
     166}
     167
     168
     169
     170/***********************************************************************
     171 *           GetTabbedTextExtentA    (USER32.@)
     172 */
     173DWORD WINAPI GetTabbedTextExtentA( HDC hdc, LPCSTR lpstr, INT count,
     174                                   INT cTabStops, INT *lpTabPos )
     175{
     176    dprintf(("USER32: GetTabbedTextExtentA %x %s %d %d %x",hdc, lpstr, count, cTabStops, lpTabPos));
     177
     178    return TEXT_TabbedTextOut( hdc, 0, 0, lpstr, count, cTabStops,
     179                               NULL, lpTabPos, 0, FALSE );
     180}
     181
     182
     183/***********************************************************************
     184 *           GetTabbedTextExtentW    (USER32.@)
     185 */
     186DWORD WINAPI GetTabbedTextExtentW( HDC hdc, LPCWSTR lpstr, INT count,
     187                                   INT cTabStops, INT *lpTabPos )
     188{
     189    LONG ret;
     190    LPSTR p;
     191    INT acount;
     192    UINT codepage = CP_ACP; /* FIXME: get codepage of font charset */
     193
     194    acount = WideCharToMultiByte(codepage,0,lpstr,count,NULL,0,NULL,NULL);
     195    p = (LPSTR)HeapAlloc( GetProcessHeap(), 0, acount );
     196    if(p == NULL) return 0; /* FIXME: is this the correct failure value? */
     197    acount = WideCharToMultiByte(codepage,0,lpstr,count,p,acount,NULL,NULL);
     198    ret = GetTabbedTextExtentA( hdc, p, acount, cTabStops, lpTabPos );
     199    HeapFree( GetProcessHeap(), 0, p );
     200    return ret;
     201}
     202#else
    52203//******************************************************************************
    53204//******************************************************************************
     
    82233  return InternalTabbedTextOutW(hdc,x,y,lpString,nCount,nTabPositions,lpnTabStopPositions,nTabOrigin);
    83234}
     235#endif
    84236//******************************************************************************
    85237// WINE/objects/text.c
  • trunk/src/user32/win32wbase.cpp

    r5725 r5810  
    1 /* $Id: win32wbase.cpp,v 1.258 2001-05-17 09:50:30 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.259 2001-05-27 19:01:35 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    19991999  }
    20002000  fInternalMsg = fInternalMsgBackup;
     2001  dprintf2(("SendMessageA %x %x %x %x returned %d", getWindowHandle(), Msg, wParam, lParam, rc));
    20012002  return rc;
    20022003}
     
    20592060  }
    20602061  fInternalMsg = fInternalMsgBackup;
     2062  dprintf2(("SendMessageW %x %x %x %x returned %d", getWindowHandle(), Msg, wParam, lParam, rc));
    20612063  return rc;
    20622064}
Note: See TracChangeset for help on using the changeset viewer.