Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
nsGfxDefs.h File Reference
#include "nscore.h"
#include <os2.h>
#include "prlog.h"
#include "nsHashtable.h"
#include <uconv.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define INCL_PM
#define INCL_DOS
#define INCL_DOSERRORS
#define INCL_DEV
#define COLOR_CUBE_SIZE   216
#define CHK_SUCCESS(ReturnCode, SuccessCode)   ReturnCode
#define GFX(ReturnCode, ErrorCode)   ReturnCode
#define min(a, b)   (((a) < (b)) ? (a) : (b))
#define MK_RGB(r, g, b)   ((r) * 65536) + ((g) * 256) + (b)

Functions

void PMERROR (const char *str)
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 *pDx)
BOOL IsDBCS ()

Define Documentation

#define CHK_SUCCESS (   ReturnCode,
  SuccessCode 
)    ReturnCode

Definition at line 100 of file nsGfxDefs.h.

Definition at line 54 of file nsGfxDefs.h.

#define GFX (   ReturnCode,
  ErrorCode 
)    ReturnCode

Definition at line 102 of file nsGfxDefs.h.

Definition at line 47 of file nsGfxDefs.h.

Definition at line 45 of file nsGfxDefs.h.

Definition at line 46 of file nsGfxDefs.h.

Definition at line 44 of file nsGfxDefs.h.

#define min (   a,
  b 
)    (((a) < (b)) ? (a) : (b))

Definition at line 116 of file nsGfxDefs.h.

#define MK_RGB (   r,
  g,
  b 
)    ((r) * 65536) + ((g) * 256) + (b)

Definition at line 119 of file nsGfxDefs.h.


Function Documentation

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

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 *  str)

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: