- Timestamp:
- Nov 16, 2000, 5:34:49 PM (25 years ago)
- Location:
- trunk/src/gdi32
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/gdi32.cpp
r4598 r4602 1 /* $Id: gdi32.cpp,v 1.6 2 2000-11-15 16:10:41sandervl Exp $ */1 /* $Id: gdi32.cpp,v 1.63 2000-11-16 16:34:48 sandervl Exp $ */ 2 2 3 3 /* … … 32 32 //****************************************************************************** 33 33 //****************************************************************************** 34 BOOL WIN32API GetTextExtentPointA(HDC hdc, LPCSTR lpsz, int cbString, LPSIZE lpSize)35 {36 BOOL rc;37 38 lpSize->cx = lpSize->cy = 0;39 rc = O32_GetTextExtentPoint(hdc, lpsz, cbString, lpSize);40 dprintf(("GDI32: GetTextExtentPointA of %s returned %d\n", lpsz, rc));41 return(rc);42 }43 34 //****************************************************************************** 44 35 //****************************************************************************** … … 754 745 //****************************************************************************** 755 746 //****************************************************************************** 756 BOOL WIN32API GetCharWidth32A( HDC arg1, UINT arg2, UINT arg3, PINT arg4) 757 { 758 dprintf(("GDI32: GetCharWidth32A")); 759 return O32_GetCharWidth(arg1, arg2, arg3, arg4); 747 BOOL WIN32API GetCharWidth32A( HDC hdc, UINT iFirstChar, UINT iLastChar, PINT pWidthArray) 748 { 749 BOOL ret; 750 751 dprintf(("GDI32: GetCharWidth32A %x %x %x %x", hdc, iFirstChar, iLastChar, pWidthArray)); 752 ret = O32_GetCharWidth(hdc, iFirstChar, iLastChar, pWidthArray); 753 dprintf(("GDI32: GetCharWidth32A returned %d", ret)); 754 #ifdef DEBUG 755 if(ret) { 756 for(int i=iFirstChar;i<iLastChar;i++) { 757 if((i >= 'a' && i <= 'z') || (i >= 'A' && i <= 'Z')) { 758 dprintf2(("Char %c -> width %d", i, pWidthArray[i])); 759 } 760 else dprintf2(("Char %x -> width %d", i, pWidthArray[i])); 761 } 762 } 763 #endif 764 return ret; 760 765 } 761 766 //****************************************************************************** 762 767 //TODO: Cut off Unicode chars? 763 768 //****************************************************************************** 764 BOOL WIN32API GetCharWidth32W(HDC arg1, UINT iFirstChar, UINT iLastChar, PINT arg4)769 BOOL WIN32API GetCharWidth32W(HDC hdc, UINT iFirstChar, UINT iLastChar, PINT pWidthArray) 765 770 { 766 771 dprintf(("GDI32: GetCharWidth32W, not properly implemented")); 767 return O32_GetCharWidth( arg1, iFirstChar, iLastChar, arg4);772 return O32_GetCharWidth(hdc, iFirstChar, iLastChar, pWidthArray); 768 773 } 769 774 //****************************************************************************** … … 891 896 //****************************************************************************** 892 897 //****************************************************************************** 893 BOOL WIN32API GetTextExtentPoint32A( HDC hdc, LPCSTR lpsz, int cbString, PSIZE lpSize)894 {895 BOOL rc;896 897 lpSize->cx = lpSize->cy = 0;898 rc = O32_GetTextExtentPoint32(hdc, lpsz, cbString, lpSize);899 dprintf(("GDI32: GetTextExtentPoint32A %x %s %d returned %d (%d,%d)", hdc, lpsz, cbString, rc, lpSize->cx, lpSize->cy));900 return rc;901 }902 //******************************************************************************903 //******************************************************************************904 BOOL WIN32API GetTextExtentPoint32W(HDC arg1, LPCWSTR arg2, int arg3, PSIZE lpSize)905 {906 char *astring = UnicodeToAsciiString((LPWSTR)arg2);907 BOOL rc;908 909 dprintf(("GDI32: GetTextExtentPoint32W %s\n", astring));910 lpSize->cx = lpSize->cy = 0;911 rc = O32_GetTextExtentPoint32(arg1, astring, arg3, lpSize);912 FreeAsciiString(astring);913 return(rc);914 }915 //******************************************************************************916 //******************************************************************************917 BOOL WIN32API GetTextExtentPointW(HDC hdc,918 LPCWSTR lpString,919 int cbString,920 PSIZE lpSize)921 {922 char *astring = UnicodeToAsciiString((LPWSTR)lpString);923 BOOL rc;924 925 lpSize->cx = lpSize->cy = 0;926 rc = O32_GetTextExtentPoint(hdc,927 astring,928 cbString,929 lpSize);930 dprintf(("GDI32: GetTextExtentPointW %X %s (size %08xh) returned %d\n", hdc, astring, cbString, rc));931 dprintf(("GDI32: GetTextExtentPointW (%d,%d)\n", lpSize->cx, lpSize->cy));932 933 FreeAsciiString(astring);934 return(rc);935 }936 898 //****************************************************************************** 937 899 //****************************************************************************** -
trunk/src/gdi32/oslibgpi.cpp
r4596 r4602 1 /* $Id: oslibgpi.cpp,v 1. 8 2000-11-15 13:56:45sandervl Exp $ */1 /* $Id: oslibgpi.cpp,v 1.9 2000-11-16 16:34:49 sandervl Exp $ */ 2 2 3 3 /* … … 242 242 } 243 243 244 LONG OSLibGpiQueryTabbedTextExtent( PVOIDpHps,INT lCount,LPCSTR pchString,INT lTabCount,PINT puTabStops)245 { 246 return GpiQueryTabbedTextExtent( GetDCData(pHps)->hps,lCount,(PCH)pchString,lTabCount,(PULONG)puTabStops);244 LONG OSLibGpiQueryTabbedTextExtent(pDCData pHps,INT lCount,LPCSTR pchString,INT lTabCount,PINT puTabStops) 245 { 246 return GpiQueryTabbedTextExtent(pHps->hps,lCount,(PCH)pchString,lTabCount,(PULONG)puTabStops); 247 247 } 248 248 … … 252 252 } 253 253 254 BOOL OSLibGpiQueryTextBox( PVOIDpHps,LONG lCount1,LPCSTR pchString,LONG lCount2,PPOINTLOS2 aptlPoints)255 { 256 return GpiQueryTextBox( GetDCData(pHps)->hps,lCount1,(PCH)pchString,lCount2,(PPOINTL)aptlPoints);254 BOOL OSLibGpiQueryTextBox(pDCData pHps,LONG lCount1,LPCSTR pchString,LONG lCount2,PPOINTLOS2 aptlPoints) 255 { 256 return GpiQueryTextBox(pHps->hps,lCount1,(PCH)pchString,lCount2,(PPOINTL)aptlPoints); 257 257 } 258 258 … … 265 265 { 266 266 point->y = labs (box[TXTBOX_BOTTOMLEFT].y-box[TXTBOX_TOPLEFT].y); 267 point->x = labs (box[TXTBOX_ CONCAT].x-box[TXTBOX_BOTTOMLEFT].x);267 point->x = labs (box[TXTBOX_BOTTOMRIGHT].x-box[TXTBOX_BOTTOMLEFT].x); 268 268 269 269 if (box[TXTBOX_BOTTOMLEFT].x != box[TXTBOX_TOPLEFT].x) … … 435 435 } 436 436 #endif 437 438 BOOL OSLibDevQueryCaps(pDCData pHps, LONG lStart, LONG lCount, LONG *alArray) 439 { 440 return DevQueryCaps(pHps->hdc, lStart, lCount, alArray); 441 } -
trunk/src/gdi32/oslibgpi.h
r4596 r4602 1 /* $Id: oslibgpi.h,v 1. 8 2000-11-15 13:56:45sandervl Exp $ */1 /* $Id: oslibgpi.h,v 1.9 2000-11-16 16:34:49 sandervl Exp $ */ 2 2 3 3 /* … … 12 12 #define __OSLIBGPI_H__ 13 13 14 #include <dcdata.h> 14 15 15 16 #ifdef DEBUG … … 133 134 BOOL OSLibGpiQueryTextAlignment(PVOID pHps,PLONG plHoriz,PLONG plVert); 134 135 135 LONG OSLibGpiQueryTabbedTextExtent( PVOIDpHps,INT lCount,LPCSTR pchString,INT lTabCount,PINT puTabStops);136 LONG OSLibGpiQueryTabbedTextExtent(pDCData pHps,INT lCount,LPCSTR pchString,INT lTabCount,PINT puTabStops); 136 137 LONG OSLibGpiTabbedCharStringAt(PVOID pHps,PPOINTLOS2 pPtStart,PRECTLOS2 prclRect,ULONG flOptions,INT lCount,LPCSTR pchString,INT lTabCount,PINT puTabStops,INT lTabOrigin); 137 138 … … 143 144 #define TXTBOXOS_COUNT 5L 144 145 145 BOOL OSLibGpiQueryTextBox( PVOIDpHps,LONG lCount1,LPCSTR pchString,LONG lCount2,PPOINTLOS2 aptlPoints);146 BOOL OSLibGpiQueryTextBox(pDCData pHps,LONG lCount1,LPCSTR pchString,LONG lCount2,PPOINTLOS2 aptlPoints); 146 147 147 148 VOID calcDimensions(POINTLOS2 box[],PPOINTLOS2 point); … … 208 209 BOOL OSLibGpiSetCp(HDC hdc, ULONG codepage); 209 210 211 #define OSLIB_CAPS_HORIZONTAL_RESOLUTION 8L /* pels per meter */ 212 #define OSLIB_CAPS_VERTICAL_RESOLUTION 9L /* pels per meter */ 213 214 BOOL OSLibDevQueryCaps(pDCData hHps, LONG lStart, LONG lCount, LONG *alArray); 210 215 211 216 // from pmddi.h: -
trunk/src/gdi32/text.cpp
r4365 r4602 1 /* $Id: text.cpp,v 1.1 3 2000-10-02 13:11:47 phallerExp $ */1 /* $Id: text.cpp,v 1.14 2000-11-16 16:34:49 sandervl Exp $ */ 2 2 3 3 /* … … 18 18 #include <float.h> 19 19 #include "oslibgpi.h" 20 #include <dcdata.h> 20 21 21 22 #define DBG_LOCALLOG DBG_text … … 112 113 } 113 114 114 PVOID pHps =OSLibGpiQueryDCData(hdc);115 pDCData pHps = (pDCData)OSLibGpiQueryDCData(hdc); 115 116 116 117 if (!pHps) … … 167 168 } 168 169 } 169 170 #ifdef INVERT 170 171 flCmd = DTOS_INVERT | DTOS_WORLDRECT | DTOS_TEXTATTRS | DTOS_AMPERSAND | DTOS_VERTICALEXTENT; 172 #else 173 flCmd = DTOS_WORLDRECT | DTOS_TEXTATTRS | DTOS_AMPERSAND | DTOS_VERTICALEXTENT; 174 #endif 171 175 172 176 LONG lMixMode = OSLibGpiQueryBackMix(pHps); … … 231 235 rectPtr->bottom = lprc->bottom; 232 236 } 233 } 237 238 #ifndef INVERT 239 if (pHps->yInvert > 0) { 240 int temp = pHps->yInvert - rectPtr->bottom; 241 rectPtr->bottom = pHps->yInvert - rectPtr->top; 242 rectPtr->top = temp; 243 } 244 #endif 245 } 246 247 #ifndef INVERT 248 //// dwDTFormat &= ~DT_INVERT; 249 //// dwDTFormat |= DT_INVERTCHAR; 250 int top = rectPtr->top; 251 #endif 234 252 235 253 if (dwDTFormat & DT_EXPANDTABS) … … 398 416 if (dwDTFormat & DT_CALCRECT) 399 417 { 418 #ifndef INVERT 419 if (pHps->yInvert > 0) { 420 top = top - rectPtr->top; 421 rectPtr->top += top; 422 rectPtr->bottom += top; 423 } /* endif */ 424 #endif 400 425 if (!(dwDTFormat & DT_RIGHT) && (rectPtr->left < xLeft)) 401 426 { … … 440 465 DWORD SYSTEM EXPORT InternalGetTabbedTextExtentA(HDC hDC,LPCSTR lpString,INT nCount,INT nTabPositions,LPINT lpnTabStopPositions) 441 466 { 442 PVOID pHps =OSLibGpiQueryDCData(hDC);467 pDCData pHps = (pDCData)OSLibGpiQueryDCData(hDC); 443 468 BOOL result; 444 469 POINTLOS2 pts[TXTBOXOS_COUNT]; … … 496 521 LONG SYSTEM EXPORT InternalTabbedTextOutA(HDC hdc,INT x,INT y,LPCSTR lpString,INT nCount,INT nTabPositions,LPINT lpnTabStopPositions,INT nTabOrigin) 497 522 { 498 PVOID pHps =OSLibGpiQueryDCData(hdc);523 pDCData pHps = (pDCData)OSLibGpiQueryDCData(hdc); 499 524 POINTLOS2 ptl; 500 525 DWORD dimensions; … … 521 546 return 0; 522 547 } 523 if (getAlignUpdateCP(pHps) == TRUE) 548 if (getAlignUpdateCP(pHps) == TRUE) { 524 549 OSLibGpiQueryCurrentPosition(pHps,&ptl); 550 } 525 551 else 526 552 { 527 553 ptl.x = x; 528 554 ptl.y = y; 555 #ifndef INVERT 556 if (pHps->yInvert > 0) { 557 ptl.y = pHps->yInvert - ptl.y; 558 } 559 #endif 529 560 } 530 561 … … 569 600 BOOL InternalTextOutA(HDC hdc,int X,int Y,UINT fuOptions,CONST RECT *lprc,LPCSTR lpszString,INT cbCount,CONST INT *lpDx,BOOL IsExtTextOut) 570 601 { 571 PVOID pHps =OSLibGpiQueryDCData(hdc);602 pDCData pHps = (pDCData)OSLibGpiQueryDCData(hdc); 572 603 ULONG flOptions = 0; 573 604 RECTLOS2 pmRect; … … 607 638 return TRUE; 608 639 } 640 #ifndef INVERT 641 if (pHps->yInvert > 0) { 642 int temp = pHps->yInvert - pmRect.yTop; 643 pmRect.yTop = pHps->yInvert - pmRect.yBottom; 644 pmRect.yBottom = temp; 645 } 646 #endif 609 647 610 648 if (fuOptions & ETO_CLIPPED) flOptions |= CHSOS_CLIP; … … 642 680 ptl.x = X; 643 681 ptl.y = Y; 682 683 #ifndef INVERT 684 if (pHps->yInvert > 0) { 685 ptl.y = pHps->yInvert - Y; 686 } 687 #endif 644 688 645 689 flOptions |= CHSOS_LEAVEPOS; … … 670 714 ptl.y += getWorldYDeltaFor1Pixel(pHps); 671 715 716 #ifndef INVERT 717 int vertAdjust = 0; 718 if ((pHps->taMode & 0x18) == TA_TOP) 719 { 720 vertAdjust = OSLibGpiQueryFontMaxHeight(pHps->hps); 721 } 722 ptl.y -= vertAdjust; 723 #endif 724 672 725 hits = OSLibGpiCharStringPosAt(pHps,&ptl,&pmRect,flOptions,cbCount,lpszString,lpDx); 673 726 … … 684 737 OSLibGpiQueryCurrentPosition(pHps,&ptl); 685 738 ptl.y -= getWorldYDeltaFor1Pixel(pHps); 739 #ifndef INVERT 740 ptl.y += vertAdjust; 741 #endif 686 742 OSLibGpiSetCurrentPosition(pHps,&ptl); 687 743 } … … 705 761 BOOL WIN32API ExtTextOutA(HDC hdc,int X,int Y,UINT fuOptions,CONST RECT *lprc,LPCSTR lpszString,UINT cbCount,CONST INT *lpDx) 706 762 { 707 dprintf(("GDI32: ExtTextOutA %x %s", hdc, lpszString)); 708 709 return InternalTextOutA(hdc,X,Y,fuOptions,lprc,lpszString,cbCount,lpDx,TRUE); 763 dprintf(("GDI32: ExtTextOutA %x %s (%d,%d) %x %d %x", hdc, lpszString, X, Y, fuOptions, cbCount, lpDx)); 764 return InternalTextOutA(hdc, X, Y, fuOptions, lprc, lpszString, cbCount, lpDx, TRUE); 710 765 } 711 766 //****************************************************************************** … … 714 769 { 715 770 dprintf(("GDI32: ExtTextOutW\n")); 716 717 return InternalTextOutW(hdc,X,Y,fuOptions,lprc,lpszString,cbCount,lpDx,TRUE); 771 return InternalTextOutW(hdc, X, Y, fuOptions, lprc, lpszString, cbCount, lpDx, TRUE); 718 772 } 719 773 //****************************************************************************** … … 721 775 BOOL WIN32API TextOutA(HDC hdc,int nXStart,int nYStart,LPCSTR lpszString,int cbString) 722 776 { 723 dprintf(("GDI32: TextOutA %x %s", hdc, lpszString));777 dprintf(("GDI32: TextOutA %x (%d,%d) %s", hdc, nXStart, nYStart, lpszString)); 724 778 725 779 return InternalTextOutA(hdc,nXStart,nYStart,0,NULL,lpszString,cbString,NULL,FALSE); … … 765 819 return TRUE; 766 820 } 821 //****************************************************************************** 822 //****************************************************************************** 823 BOOL WIN32API GetTextExtentPointA(HDC hdc, LPCTSTR lpsz, int cbString, 824 LPSIZE lpsSize) 825 { 826 BOOL rc; 827 POINTLOS2 pts[TXTBOXOS_COUNT]; 828 POINTLOS2 widthHeight = { 0, 0}; 829 pDCData pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc); 830 831 dprintf(("GDI32: GetTextExtentPointA %s\n", lpsz)); 832 if(pHps == NULL) 833 { 834 SetLastError(ERROR_INVALID_HANDLE); 835 return FALSE; 836 } 837 838 if(lpsz == NULL || cbString < 0 || lpsSize == NULL) 839 { 840 SetLastError(ERROR_INVALID_PARAMETER); 841 return FALSE; 842 } 843 844 lpsSize->cx = 0; 845 lpsSize->cy = 0; 846 847 // Verified with NT4, SP6 848 if(cbString == 0) 849 { 850 SetLastError(ERROR_SUCCESS); 851 return TRUE; 852 } 853 if(cbString > 512) { 854 dprintf(("ERROR: Oh, oh, string too long!!")); 855 DebugInt3(); 856 } 857 858 rc = OSLibGpiQueryTextBox(pHps, cbString, lpsz, TXTBOXOS_COUNT, pts); 859 if(rc == FALSE) 860 { 861 SetLastError(ERROR_INVALID_PARAMETER); //todo wrong error 862 return FALSE; 863 } 864 calcDimensions(pts, &widthHeight); 865 lpsSize->cx = widthHeight.x; 866 lpsSize->cy = widthHeight.y; 867 868 if(pHps && pHps->isPrinter && pHps->hdc) 869 {//scale for printer dcs 870 LONG alArray[2]; 871 872 if (OSLibDevQueryCaps(pHps, OSLIB_CAPS_HORIZONTAL_RESOLUTION, 2, &alArray[0])) 873 lpsSize->cx = lpsSize->cx * alArray[0] / alArray[1]; 874 } 875 876 dprintf(("GDI32: GetTextExtentPointA %x %s %d returned %d (%d,%d)", hdc, lpsz, cbString, rc, lpsSize->cx, lpsSize->cy)); 877 SetLastError(ERROR_SUCCESS); 878 return TRUE; 879 } 880 //****************************************************************************** 881 //****************************************************************************** 882 BOOL WIN32API GetTextExtentPointW(HDC hdc, 883 LPCWSTR lpString, 884 int cbString, 885 PSIZE lpSize) 886 { 887 char *astring = UnicodeToAsciiString((LPWSTR)lpString); 888 BOOL rc; 889 890 dprintf(("GDI32: GetTextExtentPointW %s\n", astring)); 891 lpSize->cx = lpSize->cy = 0; 892 rc = GetTextExtentPointA(hdc, 893 astring, 894 cbString, 895 lpSize); 896 FreeAsciiString(astring); 897 return(rc); 898 } 899 //****************************************************************************** 900 //****************************************************************************** 901 BOOL WIN32API GetTextExtentPoint32A( HDC hdc, LPCSTR lpsz, int cbString, PSIZE lpSize) 902 { 903 BOOL rc; 904 905 dprintf(("GDI32: GetTextExtentPoint32A %s\n", lpsz)); 906 lpSize->cx = lpSize->cy = 0; 907 rc = GetTextExtentPointA(hdc, lpsz, cbString, lpSize); 908 return rc; 909 } 910 //****************************************************************************** 911 //****************************************************************************** 912 BOOL WIN32API GetTextExtentPoint32W(HDC arg1, LPCWSTR arg2, int arg3, PSIZE lpSize) 913 { 914 char *astring = UnicodeToAsciiString((LPWSTR)arg2); 915 BOOL rc; 916 917 dprintf(("GDI32: GetTextExtentPoint32W %s\n", astring)); 918 rc = GetTextExtentPointA(arg1, astring, arg3, lpSize); 919 FreeAsciiString(astring); 920 return(rc); 921 } 922 //****************************************************************************** 923 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.