Changeset 4602 for trunk/src/gdi32/text.cpp
- Timestamp:
- Nov 16, 2000, 5:34:49 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.