Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
nsGfxDefs.cpp File Reference
#include "nsGfxDefs.h"
#include <stdio.h>
#include "nsDeviceContextSpecOS2.h"
#include <stdlib.h>

Go to the source code of this file.

Defines

#define DPRINTF   printf

Functions

BOOL GetTextExtentPoint32 (HPS aPS, const char *aString, int aLength, PSIZEL aSizeL)
BOOL ExtTextOut (HPS aPS, int X, int Y, UINT fuOptions, const RECTL *lprc, const char *aString, unsigned int aLength, const int *pSpacing)
BOOL IsDBCS ()
void PMERROR (const char *api)

Variables

static BOOL bIsDBCS
static BOOL bIsDBCSSet = FALSE

Define Documentation

Definition at line 50 of file nsGfxDefs.cpp.


Function Documentation

BOOL ExtTextOut ( HPS  aPS,
int  X,
int  Y,
UINT  fuOptions,
const RECTL *  lprc,
const char *  aString,
unsigned int  aLength,
const int pSpacing 
)

Definition at line 76 of file nsGfxDefs.cpp.

{
  long rc = GPI_OK;
  POINTL ptl = {X, Y};

  GFX (::GpiMove(aPS, &ptl), FALSE);

  // GpiCharString has a max length of 512 chars at a time...
  while (aLength > 0 && rc == GPI_OK) {
    ULONG ulChunkLen = min(aLength, 512);
    if (pSpacing) {
      rc = GFX (::GpiCharStringPos(aPS, nsnull, CHS_VECTOR, ulChunkLen,
                                   (PCH)aString, (PLONG)pSpacing), GPI_ERROR);
      pSpacing += ulChunkLen;
    } else {
      rc = GFX (::GpiCharString(aPS, ulChunkLen, (PCH)aString), GPI_ERROR);
    }
    aLength -= ulChunkLen;
    aString += ulChunkLen;
  }

  if (rc == GPI_OK)
    return TRUE;
  else
    return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL GetTextExtentPoint32 ( HPS  aPS,
const char *  aString,
int  aLength,
PSIZEL  aSizeL 
)

Definition at line 57 of file nsGfxDefs.cpp.

{
  BOOL rc = TRUE;
  POINTL ptls[5];

  aSizeL->cx = 0;

  while(aLength > 0 && rc == TRUE) {
    ULONG thislen = min(aLength, 512);
    rc = GFX (::GpiQueryTextBox(aPS, thislen, (PCH)aString, 5, ptls), FALSE);
    aSizeL->cx += ptls[TXTBOX_CONCAT].x;
    aLength -= thislen;
    aString += thislen;
  }

  aSizeL->cy = ptls[TXTBOX_TOPLEFT].y - ptls[TXTBOX_BOTTOMLEFT].y;
  return rc;
}

Here is the caller graph for this function:

BOOL IsDBCS ( )

Definition at line 107 of file nsGfxDefs.cpp.

{
  if (!bIsDBCSSet) {
    // the following lines of code determine whether the system is a DBCS country
    APIRET rc;
    COUNTRYCODE ctrycodeInfo = {0};
    CHAR        achDBCSInfo[12] = {0};                  // DBCS environmental vector
    ctrycodeInfo.country  = 0;                          // current country
    ctrycodeInfo.codepage = 0;                          // current codepage

    rc = DosQueryDBCSEnv(sizeof(achDBCSInfo), &ctrycodeInfo, achDBCSInfo);
    if (rc == NO_ERROR)
    {
        // NON-DBCS countries will have four bytes in the first four bytes of the
        // DBCS environmental vector
        if (achDBCSInfo[0] != 0 || achDBCSInfo[1] != 0 ||
            achDBCSInfo[2] != 0 || achDBCSInfo[3] != 0)
        {
           bIsDBCS = TRUE;
        }
        else
        {
           bIsDBCS = FALSE;
        }
    } else {
       bIsDBCS = FALSE;
    } /* endif */
    bIsDBCSSet = TRUE;
  } /* endif */
  return bIsDBCS;
}

Here is the caller graph for this function:

void PMERROR ( const char *  api)

Definition at line 173 of file nsGfxDefs.cpp.

{
   ERRORID eid = ::WinGetLastError(0);
   USHORT usError = ERRORIDERROR(eid);
   DPRINTF ( "%s failed, error = 0x%X\n", api, usError);
}

Here is the caller graph for this function:


Variable Documentation

BOOL bIsDBCS [static]

Definition at line 104 of file nsGfxDefs.cpp.

BOOL bIsDBCSSet = FALSE [static]

Definition at line 105 of file nsGfxDefs.cpp.