Get printing working on carbon after it was broken in the landing of print options. fix a memory leak that was leaking the deviceContextSpec on mac. r=sdagley/sr=sfraser. bug# 58254.

This commit is contained in:
pinkerton%netscape.com 2001-07-13 22:34:29 +00:00
Родитель 2ce095c68d
Коммит 8006642304
5 изменённых файлов: 25 добавлений и 19 удалений

Просмотреть файл

@ -62,7 +62,7 @@ PRUint32 nsDeviceContextMac::sNumberOfScreens = 0;
* @update 12/9/98 dwc
*/
nsDeviceContextMac :: nsDeviceContextMac()
: mSpec(nsnull), mSurface(nsnull), mOldPort(nsnull)
: mSurface(nsnull), mOldPort(nsnull)
{
NS_INIT_REFCNT();
@ -686,7 +686,6 @@ NS_IMETHODIMP nsDeviceContextMac::GetDeviceContextFor(nsIDeviceContextSpec *aDev
macDC = (nsDeviceContextMac*)aContext;
macDC->mSpec = aDevice;
NS_ADDREF(aDevice);
::GetPort(&curPort);

Просмотреть файл

@ -83,7 +83,7 @@ protected:
nsDrawingSurface mSurface;
Rect mPageRect;
nsIDeviceContextSpec *mSpec;
nsCOMPtr<nsIDeviceContextSpec> mSpec;
GrafPtr mOldPort;
nsCOMPtr<nsIScreenManager> mScreenManager;
nsCOMPtr<nsIScreen> mPrimaryScreen; // cache the screen for single-monitor systems

Просмотреть файл

@ -42,12 +42,7 @@ nsDeviceContextSpecX::nsDeviceContextSpecX()
*/
nsDeviceContextSpecX::~nsDeviceContextSpecX()
{
if (mPrintSettings != kPMNoPrintSettings)
PMRelease(&mPrintSettings);
if (mPageFormat != kPMNoPageFormat)
PMRelease(&mPageFormat);
if (mPrintSession)
::PMRelease(&mPrintSession);
ClosePrintManager();
}
NS_IMPL_ISUPPORTS2(nsDeviceContextSpecX, nsIDeviceContextSpec, nsIPrintingContext)
@ -96,12 +91,12 @@ NS_IMETHODIMP nsDeviceContextSpecX::PrintManagerOpen(PRBool* aIsOpen)
*/
NS_IMETHODIMP nsDeviceContextSpecX::ClosePrintManager()
{
if (mPrintSettings != kPMNoPrintSettings)
::PMRelease(&mPrintSettings);
if (mPageFormat != kPMNoPageFormat)
::PMRelease(&mPageFormat);
if (mPrintSession)
::PMRelease(&mPrintSession);
if (mPrintSettings != kPMNoPrintSettings)
::PMRelease(mPrintSettings);
if (mPageFormat != kPMNoPageFormat)
::PMRelease(mPageFormat);
if (mPrintSession)
::PMRelease(mPrintSession);
return NS_OK;
}

Просмотреть файл

@ -42,9 +42,7 @@
#include "nsScreenManagerMac.h"
#include "nsBlender.h"
#include "nsCOMPtr.h"
#if !TARGET_CARBON
#include "nsPrintOptionsMac.h"
#endif
static NS_DEFINE_IID(kCFontMetrics, NS_FONT_METRICS_CID);
static NS_DEFINE_IID(kCFontEnumerator, NS_FONT_ENUMERATOR_CID);
@ -141,11 +139,9 @@ nsresult nsGfxFactoryMac::CreateInstance(nsISupports *aOuter,
#endif
inst = dcSpec;
}
#if !TARGET_CARBON
else if (mClassID.Equals(kCPrintOptions)) {
NS_NEWXPCOM(inst, nsPrintOptionsMac);
}
#endif
else if (mClassID.Equals(kCDeviceContextSpecFactory)) {
NS_NEWXPCOM(inst, nsDeviceContextSpecFactoryMac);
}

Просмотреть файл

@ -30,12 +30,15 @@
//*****************************************************************************
//*** nsPrintOptions
//*****************************************************************************
#if !TARGET_CARBON
class nsPrintOptionsMac : public nsPrintOptions
{
public:
nsPrintOptionsMac();
virtual ~nsPrintOptionsMac();
private:
THPrint GetPrintRecord(void) {return mPrintRecord;}
NS_IMETHOD ShowNativeDialog(void);
@ -45,6 +48,19 @@ public:
};
#else
class nsPrintOptionsMac : public nsPrintOptions
{
public:
nsPrintOptionsMac() { };
virtual ~nsPrintOptionsMac() { };
private:
//XXX FILL IN PRINT OPTIONS HERE FOR CARBON
};
#endif
#endif /* nsPrintOptionsMac_h__ */