Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes
nsDeviceContextOS2 Class Reference

#include <nsDeviceContextOS2.h>

Collaboration diagram for nsDeviceContextOS2:
Collaboration graph
[legend]

List of all members.

Public Types

enum  nsPrintState { nsPrintState_ePreBeginDoc, nsPrintState_eBegunDoc, nsPrintState_eBegunFirstPage, nsPrintState_eEndedDoc }

Public Member Functions

 nsDeviceContextOS2 ()
NS_IMETHOD Init (nsNativeWidget aWidget)
NS_IMETHOD CreateRenderingContext (nsIRenderingContext *&aContext)
NS_IMETHOD SupportsNativeWidgets (PRBool &aSupportsWidgets)
NS_IMETHOD GetScrollBarDimensions (float &aWidth, float &aHeight) const
NS_IMETHOD GetSystemFont (nsSystemFontID anID, nsFont *aFont) const
NS_IMETHOD CheckFontExistence (const nsString &aFontName)
NS_IMETHOD GetDepth (PRUint32 &aDepth)
NS_IMETHOD GetDeviceSurfaceDimensions (PRInt32 &aWidth, PRInt32 &aHeight)
NS_IMETHOD GetRect (nsRect &aRect)
NS_IMETHOD GetClientRect (nsRect &aRect)
NS_IMETHOD GetDeviceContextFor (nsIDeviceContextSpec *aDevice, nsIDeviceContext *&aContext)
NS_IMETHOD PrepareDocument (PRUnichar *aTitle, PRUnichar *aPrintToFileName)
NS_IMETHOD BeginDocument (PRUnichar *aTitle, PRUnichar *aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage)
NS_IMETHOD EndDocument (void)
NS_IMETHOD AbortDocument (void)
NS_IMETHOD BeginPage (void)
NS_IMETHOD EndPage (void)
nsresult SetDPI (PRInt32 aPrefDPI)
int GetDPI ()
BOOL isPrintDC ()
PRBool SupportsRasterFonts ()
PRBool IsPaletteDevice ()
nsresult CreateFontAliasTable ()

Static Public Member Functions

static char * GetACPString (const nsString &aStr)

Public Attributes

HDC mPrintDC
HPS mPrintPS
enum
nsDeviceContextOS2::nsPrintState 
mPrintState

Protected Member Functions

virtual ~nsDeviceContextOS2 ()
void CommonInit (HDC aDC)
nsresult Init (nsNativeDeviceContext aContext, nsIDeviceContext *aOrigContext)
void FindScreen (nsIScreen **outScreen)
void ComputeClientRectUsingScreen (nsRect *outRect)
void ComputeFullAreaUsingScreen (nsRect *outRect)

Protected Attributes

PRBool mCachedClientRect
PRBool mCachedFullRect
PRBool mPrintingStarted
nsIDrawingSurfacemSurface
PRUint32 mDepth
PRBool mIsPaletteDevice
PRInt32 mWidth
PRInt32 mHeight
nsRect mClientRect
nsIDeviceContextSpecmSpec
PRBool mSupportsRasterFonts
nsCOMPtr< nsIScreenManagermScreenManager

Static Protected Attributes

static PRUint32 sNumberOfScreens = 0
static nscoord mDpi = 120

Detailed Description

Definition at line 49 of file nsDeviceContextOS2.h.


Member Enumeration Documentation

Enumerator:
nsPrintState_ePreBeginDoc 
nsPrintState_eBegunDoc 
nsPrintState_eBegunFirstPage 
nsPrintState_eEndedDoc 

Definition at line 118 of file nsDeviceContextOS2.h.


Constructor & Destructor Documentation

Definition at line 63 of file nsDeviceContextOS2.cpp.

  : DeviceContextImpl()
{
  mSurface = NULL;
  mIsPaletteDevice = PR_FALSE;
  mPrintDC = NULL;
  mWidth = -1;
  mHeight = -1;
  mSpec = nsnull;
  mCachedClientRect = PR_FALSE;
  mCachedFullRect = PR_FALSE;
  mSupportsRasterFonts = PR_FALSE;
  mPrintingStarted = PR_FALSE;
#ifdef XP_OS2
  mPrintState = nsPrintState_ePreBeginDoc;
#endif

  // The first time in we initialize gIsWarp4 flag
  if (NOT_SETUP == gIsWarp4) {
    unsigned long ulValues[2];
    DosQuerySysInfo( QSV_VERSION_MAJOR, QSV_VERSION_MINOR,
                     ulValues, sizeof(ulValues));
    gIsWarp4 = (ulValues[0] >= 20) && (ulValues[1] >= 40);
  }
}

Here is the caller graph for this function:

nsDeviceContextOS2::~nsDeviceContextOS2 ( ) [protected, virtual]

Definition at line 89 of file nsDeviceContextOS2.cpp.

{
  if(mPrintDC)
  {
    GFX (::GpiDestroyPS (mPrintPS), FALSE);
    ::DevCloseDC(mPrintDC);
  } else {
    nsresult rv;
    nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
    if (NS_SUCCEEDED(rv)) {
      prefs->UnregisterCallback("layout.css.dpi",
                                prefChanged, (void *)this);
    }
  }
  NS_IF_RELEASE(mSpec);
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 807 of file nsDeviceContextOS2.cpp.

{
  if (NULL != mPrintDC)
  {
    long ldummy = 0;
    long lResult = ::DevEscape(mPrintDC, DEVESC_ABORTDOC, 0, NULL,
                               &ldummy, NULL);
    if (lResult == DEV_OK)
      return NS_OK;
    else
      return NS_ERROR_ABORT;
  }

  return NS_OK;
}
nsresult nsDeviceContextOS2::BeginDocument ( PRUnichar aTitle,
PRUnichar aPrintToFileName,
PRInt32  aStartPage,
PRInt32  aEndPage 
)

Definition at line 783 of file nsDeviceContextOS2.cpp.

{
  // Everything is done in PrepareDocument
  return NS_OK;
}

Definition at line 824 of file nsDeviceContextOS2.cpp.

{
  if (mPrintingStarted) {
    mPrintingStarted = PR_FALSE;
    return NS_OK;
  }

  if (NULL != mPrintDC)
  {
    long lDummy = 0;
    long lResult = ::DevEscape(mPrintDC, DEVESC_NEWFRAME, 0, NULL,
                               &lDummy, NULL);

    if (lResult == DEV_OK)
      return NS_OK;
    else
      return NS_ERROR_GFX_PRINTER_STARTPAGE;
  }

  return NS_OK;

}

Definition at line 531 of file nsDeviceContextOS2.cpp.

{
  HPS     hps = NULL;

  if (NULL != mPrintDC){
    hps = mPrintPS;
  } else {
    hps = ::WinGetPS((HWND)mWidget);
  }

  nsAutoCharBuffer fontName;
  PRInt32 fontNameLength;
  WideCharToMultiByte(0, aFontName.get(), aFontName.Length(),
                      fontName, fontNameLength);

  long lWant = 0;
  long lFonts = GFX (::GpiQueryFonts(hps, QF_PUBLIC | QF_PRIVATE,
                                     fontName.get(), &lWant, 0, 0),
                     GPI_ALTERROR);

  if (NULL == mPrintDC)
    ::WinReleasePS(hps);

  if (lFonts > 0)
    return NS_OK;
  else
    return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

void nsDeviceContextOS2::CommonInit ( HDC  aDC) [protected]

Definition at line 206 of file nsDeviceContextOS2.cpp.

{
  LONG alArray[CAPS_DEVICE_POLYSET_POINTS];

  GFX (::DevQueryCaps(aDC, CAPS_FAMILY, CAPS_DEVICE_POLYSET_POINTS, alArray), FALSE);

  mDepth = alArray[CAPS_COLOR_BITCOUNT];
  mIsPaletteDevice = ((alArray[CAPS_ADDITIONAL_GRAPHICS] & CAPS_PALETTE_MANAGER) == CAPS_PALETTE_MANAGER);

  mWidth = alArray[CAPS_WIDTH];
  mHeight = alArray[CAPS_HEIGHT];

  if (alArray[CAPS_TECHNOLOGY] == CAPS_TECH_RASTER_DISPLAY)
  {
    // init the screen manager and compute our client rect based on the
    // screen objects. We'll save the result 
    nsresult ignore;
    mScreenManager = do_GetService("@mozilla.org/gfx/screenmanager;1", &ignore);   
    if ( !sNumberOfScreens )
      mScreenManager->GetNumberOfScreens(&sNumberOfScreens);
    mSupportsRasterFonts = !!(alArray[CAPS_RASTER_CAPS] & CAPS_RASTER_FONTS);
  } // if this dc is not a print device

  DeviceContextImpl::CommonInit();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 233 of file nsDeviceContextOS2.cpp.

{
  if ( !mCachedClientRect ) {
    nsCOMPtr<nsIScreen> screen;
    FindScreen ( getter_AddRefs(screen) );
    if ( screen ) {
      PRInt32 x, y, width, height;
      screen->GetAvailRect ( &x, &y, &width, &height );
    
      // convert to device units
      outRect->y = NSToIntRound(y * mDevUnitsToAppUnits);
      outRect->x = NSToIntRound(x * mDevUnitsToAppUnits);
      outRect->width = NSToIntRound(width * mDevUnitsToAppUnits);
      outRect->height = NSToIntRound(height * mDevUnitsToAppUnits);

      mCachedClientRect = PR_TRUE;
      mClientRect = *outRect;
    }
  }
  else
    *outRect = mClientRect;

} // ComputeClientRectUsingScreen

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 259 of file nsDeviceContextOS2.cpp.

{
  if ( !mCachedFullRect ) {
    nsCOMPtr<nsIScreen> screen;
    FindScreen ( getter_AddRefs(screen) );
    if ( screen ) {
      PRInt32 x, y, width, height;
      screen->GetRect ( &x, &y, &width, &height );
    
      // convert to device units
      outRect->y = NSToIntRound(y * mDevUnitsToAppUnits);
      outRect->x = NSToIntRound(x * mDevUnitsToAppUnits);
      outRect->width = NSToIntRound(width * mDevUnitsToAppUnits);
      outRect->height = NSToIntRound(height * mDevUnitsToAppUnits);

      mWidth = width;
      mHeight = height;
      mCachedFullRect = PR_TRUE;
    }
  }
  else {
      outRect->y = 0;
      outRect->x = 0;
      outRect->width = NSToIntRound(mWidth * mDevUnitsToAppUnits);
      outRect->height = NSToIntRound(mHeight * mDevUnitsToAppUnits);
  }
 
} // ComputeFullRectUsingScreen

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 708 of file nsDeviceContextOS2.cpp.

{
   nsresult result = NS_OK;

   if( !mFontAliasTable)
   {
      mFontAliasTable = new nsHashtable;

      nsAutoString  times;              times.AssignLiteral("Times");
      nsAutoString  timesNewRoman;      timesNewRoman.AssignLiteral("Times New Roman");
      nsAutoString  timesRoman;         timesRoman.AssignLiteral("Tms Rmn");
      nsAutoString  arial;              arial.AssignLiteral("Arial");
      nsAutoString  helv;               helv.AssignLiteral("Helv");
      nsAutoString  helvetica;          helvetica.AssignLiteral("Helvetica");
      nsAutoString  courier;            courier.AssignLiteral("Courier");
      nsAutoString  courierNew;         courierNew.AssignLiteral("Courier New");
      nsAutoString  sans;               sans.AssignLiteral("Sans");
      nsAutoString  unicode;            unicode.AssignLiteral("Unicode");
      nsAutoString  timesNewRomanMT30;  timesNewRomanMT30.AssignLiteral("Times New Roman MT 30");
      nsAutoString  nullStr;

      AliasFont(times, timesNewRoman, timesRoman, PR_FALSE);
      AliasFont(timesRoman, timesNewRoman, times, PR_FALSE);
      AliasFont(timesNewRoman, timesRoman, times, PR_FALSE);
      AliasFont(arial, helv, helvetica, PR_FALSE);
      AliasFont(helvetica, helv, arial, PR_FALSE);
      AliasFont(courier, courierNew, nullStr, PR_TRUE);
      AliasFont(courierNew, courier, nullStr, PR_FALSE);
      AliasFont(sans, helv, arial, PR_FALSE);

      // Is this right?
      AliasFont(unicode, timesNewRomanMT30, nullStr, PR_FALSE);
   }
   return result;
}

Definition at line 307 of file nsDeviceContextOS2.cpp.

{
#ifdef NS_PRINT_PREVIEW
   // Defer to Alt when there is one
  if (mAltDC && ((mUseAltDC & kUseAltDCFor_CREATERC_PAINT) || (mUseAltDC & kUseAltDCFor_CREATERC_REFLOW))) {
      return mAltDC->CreateRenderingContext(aContext);  
  }
#endif

   NS_ASSERTION( mPrintDC, "CreateRenderingContext for non-print DC");

   nsIRenderingContext *pContext = new nsRenderingContextOS2;
   if (!pContext)
     return NS_ERROR_OUT_OF_MEMORY;
   NS_ADDREF(pContext);

   nsPrintSurface *surf = new nsPrintSurface;
   if (!surf)
     return NS_ERROR_OUT_OF_MEMORY;

   surf->Init( mPrintPS, mWidth, mHeight, 0);

   nsresult rc = pContext->Init(this, surf);

   if( NS_OK != rc)
   {
      delete surf;
      NS_IF_RELEASE(pContext);
   }

   aContext = pContext;

   return rc;
}

Here is the call graph for this function:

Definition at line 789 of file nsDeviceContextOS2.cpp.

{
  if (NULL != mPrintDC)
  {
    long   lOutCount = 2;
    USHORT usJobID = 0;
    long   lResult = ::DevEscape(mPrintDC, DEVESC_ENDDOC,
                                 0, NULL,
                                 &lOutCount, (PBYTE)&usJobID);
    if (lResult == DEV_OK)
      return NS_OK;
    else
      return NS_ERROR_GFX_PRINTER_ENDDOC;
  }

  return NS_OK;
}

Definition at line 847 of file nsDeviceContextOS2.cpp.

{
   return NS_OK;
}
void nsDeviceContextOS2::FindScreen ( nsIScreen **  outScreen) [protected]

Definition at line 295 of file nsDeviceContextOS2.cpp.

{
  // optimize for the case where we only have one monitor.
  static nsCOMPtr<nsIScreen> sPrimaryScreen;
  if ( !sPrimaryScreen && mScreenManager )
    mScreenManager->GetPrimaryScreen ( getter_AddRefs(sPrimaryScreen) );  
  NS_IF_ADDREF(*outScreen = sPrimaryScreen.get());
  return;
} // FindScreen

Here is the call graph for this function:

Here is the caller graph for this function:

char * nsDeviceContextOS2::GetACPString ( const nsString aStr) [static]

Definition at line 853 of file nsDeviceContextOS2.cpp.

{
   if (aStr.Length() == 0) {
      return nsnull;
   }

   nsAutoCharBuffer acp;
   PRInt32 acpLength;
   WideCharToMultiByte(0, aStr.get(), aStr.Length(), acp, acpLength);
   return ToNewCString(nsDependentCString(acp.get()));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 658 of file nsDeviceContextOS2.cpp.

{
  if ( mSpec )
  {
    // we have a printer device
    aRect.x = 0;
    aRect.y = 0;
    aRect.width = NSToIntRound(mWidth * mDevUnitsToAppUnits);
    aRect.height = NSToIntRound(mHeight * mDevUnitsToAppUnits);
  }
  else
    ComputeClientRectUsingScreen ( &aRect );

  return NS_OK;
}

Here is the call graph for this function:

Definition at line 560 of file nsDeviceContextOS2.cpp.

{
  aDepth = mDepth;
  return NS_OK;
}

Definition at line 674 of file nsDeviceContextOS2.cpp.

{
  PRTQUEUE *pq;

  aContext = new nsDeviceContextOS2();
  if(nsnull != aContext){
    NS_ADDREF(aContext);
  } else {
    return NS_ERROR_OUT_OF_MEMORY;
  }
 
  ((nsDeviceContextOS2 *)aContext)->mSpec = aDevice;
  NS_ADDREF(aDevice);
  
  int numCopies = 0;
  int printerDest = 0;
  char *file = nsnull;

  ((nsDeviceContextSpecOS2 *)aDevice)->GetPRTQUEUE(pq);
  ((nsDeviceContextSpecOS2 *)aDevice)->GetCopies(numCopies);
  ((nsDeviceContextSpecOS2 *)aDevice)->GetDestination(printerDest);
  if (!printerDest) 
     ((nsDeviceContextSpecOS2 *)aDevice)->GetPath(&file);

  HDC dc = PrnOpenDC(pq, "Mozilla", numCopies, printerDest, file);

  if (!dc) {
     return NS_ERROR_FAILURE; //PMERROR("DevOpenDC");
  } /* endif */

  return ((nsDeviceContextOS2 *)aContext)->Init((nsNativeDeviceContext)dc, this);
}

Here is the call graph for this function:

Definition at line 617 of file nsDeviceContextOS2.cpp.

{
#ifdef NS_PRINT_PREVIEW
  // Defer to Alt when there is one
  if (mAltDC && (mUseAltDC & kUseAltDCFor_SURFACE_DIM))
    return mAltDC->GetDeviceSurfaceDimensions(aWidth, aHeight);
#endif

  if ( mSpec )
  {
    // we have a printer device
    aWidth = NSToIntRound(mWidth * mDevUnitsToAppUnits);
    aHeight = NSToIntRound(mHeight * mDevUnitsToAppUnits);
  }
  else {
    nsRect area;
    ComputeFullAreaUsingScreen ( &area );
    aWidth = area.width;
    aHeight = area.height;
  }

  return NS_OK;
}

Here is the call graph for this function:

Definition at line 87 of file nsDeviceContextOS2.h.

{ return mDpi; };

Here is the caller graph for this function:

Definition at line 641 of file nsDeviceContextOS2.cpp.

{
  if ( mSpec )
  {
    // we have a printer device
    aRect.x = 0;
    aRect.y = 0;
    aRect.width = NSToIntRound(mWidth * mDevUnitsToAppUnits);
    aRect.height = NSToIntRound(mHeight * mDevUnitsToAppUnits);
  }
  else
    ComputeFullAreaUsingScreen ( &aRect );

  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsDeviceContextOS2::GetScrollBarDimensions ( float &  aWidth,
float &  aHeight 
) const

Definition at line 352 of file nsDeviceContextOS2.cpp.

{
  float scale = mCPixelScale;
  aWidth = ::WinQuerySysValue( HWND_DESKTOP, SV_CXVSCROLL) * mDevUnitsToAppUnits * scale;
  aHeight = ::WinQuerySysValue( HWND_DESKTOP, SV_CYHSCROLL) * mDevUnitsToAppUnits * scale;
  return NS_OK;
}

Definition at line 498 of file nsDeviceContextOS2.cpp.

Here is the call graph for this function:

Definition at line 106 of file nsDeviceContextOS2.cpp.

{
  mWidget = aWidget;

  CommonInit(::WinOpenWindowDC((HWND)aWidget));

  static int initialized = 0;
  PRInt32 prefVal = -1;
  if (!initialized) {
    initialized = 1;

    // Set prefVal the value of the preference
    // "layout.css.dpi"
    // or -1 if we can't get it.
    // If it's negative, we pretend it's not set.
    // If it's 0, it means force use of the operating system's logical
    // resolution.
    // If it's positive, we use it as the logical resolution
    nsresult res;

    nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res));
    if (NS_SUCCEEDED(res) && prefs) {
      res = prefs->GetIntPref("layout.css.dpi", &prefVal);
      if (NS_FAILED(res)) {
        prefVal = -1;
      }
      prefs->RegisterCallback("layout.css.dpi", prefChanged,
                              (void *)this);
    }

    SetDPI(prefVal);
  } else {
    SetDPI(mDpi); // to setup p2t and t2p
  }

  return NS_OK;
}

Here is the call graph for this function:

nsresult nsDeviceContextOS2::Init ( nsNativeDeviceContext  aContext,
nsIDeviceContext aOrigContext 
) [protected]

Definition at line 145 of file nsDeviceContextOS2.cpp.

{
  float origscale, newscale;
  float t2d, a2d;

  mPrintDC = (HDC)aContext;

  NS_ASSERTION( mPrintDC, "!ERROR! - Received empty DC for printer");

#ifdef XP_OS2
  // Create a print PS now.  This is necessary 'cos we need it from
  // odd places to do font-y things, where the only common reference
  // point is this DC.  We can't just create a new PS because only one
  // PS can be associated with a given DC, and we can't get that PS from
  // the DC (really?).  And it would be slow :-)
  SIZEL sizel = { 0 , 0 };
  mPrintPS = GFX (::GpiCreatePS ( 0/*hab*/, mPrintDC, &sizel, 
                  PU_PELS | GPIT_MICRO | GPIA_ASSOC), GPI_ERROR);
#endif

  CommonInit( mPrintDC);

  long dpi;
  GFX (::DevQueryCaps(mPrintDC, CAPS_VERTICAL_FONT_RES, 1, &dpi), FALSE);

  mPixelsToTwips = ((float)NSIntPointsToTwips(72)) / ((float)dpi);
  mTwipsToPixels = 1.0 / mPixelsToTwips;

  newscale = TwipsToDevUnits();
// On OS/2, origscale can be different based on the video resolution.
// On 640x480, it's 1/15, on everything else it is 1/12.
// For consistent printing, 1/15 is the correct value to use.
// It is the closest to 4.x and to Windows.
//  origscale = aOrigContext->TwipsToDevUnits();
  origscale = 1.0/15.0;

  mCPixelScale = newscale / origscale;

  t2d = aOrigContext->TwipsToDevUnits();
  a2d = aOrigContext->AppUnitsToDevUnits();

  mAppUnitsToDevUnits = (a2d / t2d) * mTwipsToPixels;
  mDevUnitsToAppUnits = 1.0f / mAppUnitsToDevUnits;

#ifdef XP_OS2
  HCINFO hcinfo;
  PrnQueryHardcopyCaps( mPrintDC, &hcinfo);
  mWidth = hcinfo.xPels;
  mHeight = hcinfo.yPels;
  // XXX hsb says there are margin problems, must be from here...
#ifdef DEBUG
  printf( "Got surface of size %d x %d pixels (%d Kb)\n", mWidth, mHeight, mWidth * mHeight * mDepth / 8 / 1024);
  printf( "mCPixelScale = %f\n", mCPixelScale);
#endif

#endif

  return NS_OK;
}

Here is the call graph for this function:

Definition at line 128 of file nsDeviceContextOS2.h.

{return mIsPaletteDevice;};

Definition at line 865 of file nsDeviceContextOS2.cpp.

{
   if ( mPrintDC == nsnull )
      return 0;

   else
      return 1;
}
nsresult nsDeviceContextOS2::PrepareDocument ( PRUnichar aTitle,
PRUnichar aPrintToFileName 
)

Definition at line 745 of file nsDeviceContextOS2.cpp.

{
  nsresult rv = NS_OK;

  if (NULL != mPrintDC){
    nsString titleStr;
    titleStr = aTitle;
    char *title = GetACPString(titleStr);

    PSZ pszDocName;
    const PSZ pszGenericDocName = "MozillaDocument";

    if (title) {
      pszDocName = title;
    } else {
      pszDocName = pszGenericDocName;
    } 

    long lDummy = 0;
    long lResult = ::DevEscape(mPrintDC, DEVESC_STARTDOC,
                               strlen(pszDocName) + 1, pszDocName,
                               &lDummy, NULL);

    mPrintingStarted = PR_TRUE;

    if (lResult == DEV_OK)
      rv = NS_OK;
    else
      rv = NS_ERROR_GFX_PRINTER_STARTDOC;

    if (title != nsnull) {
      nsMemory::Free(title);
    }
  }

  return rv;
}

Here is the call graph for this function:

Definition at line 567 of file nsDeviceContextOS2.cpp.

{
  // Set OSVal to what the operating system thinks the logical resolution is.
  long OSVal;
  HPS ps = ::WinGetScreenPS(HWND_DESKTOP);
  HDC hdc = GFX (::GpiQueryDevice (ps), HDC_ERROR);
  GFX (::DevQueryCaps(hdc, CAPS_HORIZONTAL_FONT_RES, 1, &OSVal), FALSE);
  ::WinReleasePS(ps);

  if (aPrefDPI > 0) {
    // If there's a valid pref value for the logical resolution,
    // use it.
    mDpi = aPrefDPI;
  } else if ((aPrefDPI == 0) || (OSVal > 96)) {
    // Either if the pref is 0 (force use of OS value) or the OS
    // value is bigger than 96, use the OS value.
    mDpi = OSVal;
  } else {
    // if we couldn't get the pref or it's negative, and the OS
    // value is under 96ppi, then use 96.
    mDpi = 96;
  }

  int pt2t = 72;

  // make p2t a nice round number - this prevents rounding problems
  mPixelsToTwips = float(NSToIntRound(float(NSIntPointsToTwips(pt2t)) / float(mDpi)));
  mTwipsToPixels = 1.0f / mPixelsToTwips;

  // XXX need to reflow all documents
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 342 of file nsDeviceContextOS2.cpp.

{
  if (nsnull == mPrintDC)
    aSupportsWidgets = PR_TRUE;
  else
    aSupportsWidgets = PR_FALSE;

  return NS_OK;
}

Definition at line 873 of file nsDeviceContextOS2.cpp.

Here is the caller graph for this function:


Member Data Documentation

Definition at line 97 of file nsDeviceContextOS2.h.

Definition at line 98 of file nsDeviceContextOS2.h.

Definition at line 106 of file nsDeviceContextOS2.h.

Definition at line 102 of file nsDeviceContextOS2.h.

nscoord nsDeviceContextOS2::mDpi = 120 [static, protected]

Definition at line 112 of file nsDeviceContextOS2.h.

Definition at line 105 of file nsDeviceContextOS2.h.

Definition at line 103 of file nsDeviceContextOS2.h.

Definition at line 115 of file nsDeviceContextOS2.h.

Definition at line 99 of file nsDeviceContextOS2.h.

Definition at line 116 of file nsDeviceContextOS2.h.

Definition at line 110 of file nsDeviceContextOS2.h.

Definition at line 107 of file nsDeviceContextOS2.h.

Definition at line 108 of file nsDeviceContextOS2.h.

Definition at line 101 of file nsDeviceContextOS2.h.

Definition at line 104 of file nsDeviceContextOS2.h.

Definition at line 111 of file nsDeviceContextOS2.h.


The documentation for this class was generated from the following files: