зеркало из https://github.com/mozilla/pjs.git
Re-enable print preview gui stuff (which was mostly off) on GTK and Xlib
ports. Bug 187125, patch by Roland.Mainz@informatik.med.uni-giessen.de (Roland Mainz), r=smontagu, sr=rbs
This commit is contained in:
Родитель
e01849d5ba
Коммит
d87fde2b51
|
@ -584,19 +584,6 @@ nsPrintEngine::Print(nsIPrintSettings* aPrintSettings,
|
||||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(mContainer));
|
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(mContainer));
|
||||||
NS_ASSERTION(docShell, "This has to be a docshell");
|
NS_ASSERTION(docShell, "This has to be a docshell");
|
||||||
|
|
||||||
|
|
||||||
if (mIsDoingPrintPreview) {
|
|
||||||
PRBool okToPrint = PR_FALSE;
|
|
||||||
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
|
||||||
if (prefBranch) {
|
|
||||||
prefBranch->GetBoolPref("print.whileInPrintPreview", &okToPrint);
|
|
||||||
}
|
|
||||||
if (!okToPrint) {
|
|
||||||
ShowPrintErrorDialog(NS_ERROR_GFX_PRINTER_PRINT_WHILE_PREVIEW, PR_FALSE);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mPrt = new nsPrintData(nsPrintData::eIsPrinting);
|
mPrt = new nsPrintData(nsPrintData::eIsPrinting);
|
||||||
if (!mPrt) {
|
if (!mPrt) {
|
||||||
PR_PL(("NS_ERROR_OUT_OF_MEMORY - Creating PrintData"));
|
PR_PL(("NS_ERROR_OUT_OF_MEMORY - Creating PrintData"));
|
||||||
|
|
|
@ -125,6 +125,11 @@ public:
|
||||||
|
|
||||||
/* Does this device allow to set/change number of copies for an document ? */
|
/* Does this device allow to set/change number of copies for an document ? */
|
||||||
void SetCanChangeNumCopies( PRBool aCanSetNumCopies );
|
void SetCanChangeNumCopies( PRBool aCanSetNumCopies );
|
||||||
|
|
||||||
|
/* Does this device allow multiple devicecontext instances to be used in
|
||||||
|
* parallel (e.g. print while the device is already in use by print-preview
|
||||||
|
* or printing while another print job is in progress) ? */
|
||||||
|
void SetMultipleConcurrentDeviceContextsSupported( PRBool aCanUseMultipleInstances );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* private helper methods */
|
/* private helper methods */
|
||||||
|
@ -204,6 +209,11 @@ void nsPrinterFeatures::SetCanChangeNumCopies( PRBool aCanSetNumCopies )
|
||||||
SetBoolValue("can_change_num_copies", aCanSetNumCopies);
|
SetBoolValue("can_change_num_copies", aCanSetNumCopies);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nsPrinterFeatures::SetMultipleConcurrentDeviceContextsSupported( PRBool aCanUseMultipleInstances )
|
||||||
|
{
|
||||||
|
SetBoolValue("can_use_multiple_devicecontexts_concurrently", aCanUseMultipleInstances);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
|
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
|
||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
|
@ -791,6 +801,10 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
|
||||||
/* Xprint does not allow the client to set a spooler command.
|
/* Xprint does not allow the client to set a spooler command.
|
||||||
* Job spooling is the job of the server side (=Xprt) */
|
* Job spooling is the job of the server side (=Xprt) */
|
||||||
printerFeatures.SetCanChangeSpoolerCommand(PR_FALSE);
|
printerFeatures.SetCanChangeSpoolerCommand(PR_FALSE);
|
||||||
|
|
||||||
|
/* Mozilla's Xprint support allows multiple nsIDeviceContext instances
|
||||||
|
* be used in parallel */
|
||||||
|
printerFeatures.SetMultipleConcurrentDeviceContextsSupported(PR_TRUE);
|
||||||
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
|
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
|
||||||
|
|
||||||
XpuClosePrinterDisplay(pdpy, pcontext);
|
XpuClosePrinterDisplay(pdpy, pcontext);
|
||||||
|
|
|
@ -125,7 +125,12 @@ public:
|
||||||
|
|
||||||
/* Does this device allow to set/change number of copies for an document ? */
|
/* Does this device allow to set/change number of copies for an document ? */
|
||||||
void SetCanChangeNumCopies( PRBool aCanSetNumCopies );
|
void SetCanChangeNumCopies( PRBool aCanSetNumCopies );
|
||||||
|
|
||||||
|
/* Does this device allow multiple devicecontext instances to be used in
|
||||||
|
* parallel (e.g. print while the device is already in use by print-preview
|
||||||
|
* or printing while another print job is in progress) ? */
|
||||||
|
void SetMultipleConcurrentDeviceContextsSupported( PRBool aCanUseMultipleInstances );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* private helper methods */
|
/* private helper methods */
|
||||||
void SetBoolValue( const char *tagname, PRBool value );
|
void SetBoolValue( const char *tagname, PRBool value );
|
||||||
|
@ -204,6 +209,11 @@ void nsPrinterFeatures::SetCanChangeNumCopies( PRBool aCanSetNumCopies )
|
||||||
SetBoolValue("can_change_num_copies", aCanSetNumCopies);
|
SetBoolValue("can_change_num_copies", aCanSetNumCopies);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nsPrinterFeatures::SetMultipleConcurrentDeviceContextsSupported( PRBool aCanUseMultipleInstances )
|
||||||
|
{
|
||||||
|
SetBoolValue("can_use_multiple_devicecontexts_concurrently", aCanUseMultipleInstances);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
|
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
|
||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
|
@ -799,6 +809,10 @@ NS_IMETHODIMP nsPrinterEnumeratorXlib::InitPrintSettingsFromPrinter(const PRUnic
|
||||||
/* Xprint does not allow the client to set a spooler command.
|
/* Xprint does not allow the client to set a spooler command.
|
||||||
* Job spooling is the job of the server side (=Xprt) */
|
* Job spooling is the job of the server side (=Xprt) */
|
||||||
printerFeatures.SetCanChangeSpoolerCommand(PR_FALSE);
|
printerFeatures.SetCanChangeSpoolerCommand(PR_FALSE);
|
||||||
|
|
||||||
|
/* Mozilla's Xprint support allows multiple nsIDeviceContext instances
|
||||||
|
* be used in parallel */
|
||||||
|
printerFeatures.SetMultipleConcurrentDeviceContextsSupported(PR_TRUE);
|
||||||
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
|
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
|
||||||
|
|
||||||
XpuClosePrinterDisplay(pdpy, pcontext);
|
XpuClosePrinterDisplay(pdpy, pcontext);
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "xlibrgb.h"
|
#include "xlibrgb.h"
|
||||||
|
|
||||||
class nsFontMetricsXlibContext;
|
class nsFontMetricsXlibContext;
|
||||||
|
class nsRenderingContextXlibContext;
|
||||||
|
|
||||||
/* common baseclass for |nsDeviceContextXlib| and |nsDeviceContextXp| */
|
/* common baseclass for |nsDeviceContextXlib| and |nsDeviceContextXp| */
|
||||||
class nsDeviceContextX : public DeviceContextImpl
|
class nsDeviceContextX : public DeviceContextImpl
|
||||||
|
@ -60,6 +61,7 @@ public:
|
||||||
NS_IMETHOD GetXlibRgbHandle(XlibRgbHandle *&aHandle) = 0;
|
NS_IMETHOD GetXlibRgbHandle(XlibRgbHandle *&aHandle) = 0;
|
||||||
|
|
||||||
virtual void GetFontMetricsContext(nsFontMetricsXlibContext *&aContext) = 0;
|
virtual void GetFontMetricsContext(nsFontMetricsXlibContext *&aContext) = 0;
|
||||||
|
virtual void GetRCContext(nsRenderingContextXlibContext *&aContext) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* !nsDeviceContextX_h__ */
|
#endif /* !nsDeviceContextX_h__ */
|
||||||
|
|
|
@ -100,7 +100,7 @@ nsDeviceContextXlib::nsDeviceContextXlib()
|
||||||
if (!mXlibRgbHandle)
|
if (!mXlibRgbHandle)
|
||||||
abort();
|
abort();
|
||||||
|
|
||||||
mFontMetricsContextCounter++;
|
mContextCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDeviceContextXlib::~nsDeviceContextXlib()
|
nsDeviceContextXlib::~nsDeviceContextXlib()
|
||||||
|
@ -109,17 +109,20 @@ nsDeviceContextXlib::~nsDeviceContextXlib()
|
||||||
NS_IF_RELEASE(surf);
|
NS_IF_RELEASE(surf);
|
||||||
mSurface = nsnull;
|
mSurface = nsnull;
|
||||||
|
|
||||||
mFontMetricsContextCounter--;
|
mContextCounter--;
|
||||||
|
|
||||||
if (mFontMetricsContext && (mFontMetricsContextCounter == 0))
|
if (mContextCounter == 0)
|
||||||
{
|
{
|
||||||
|
DeleteRenderingContextXlibContext(mRCContext);
|
||||||
DeleteFontMetricsXlibContext(mFontMetricsContext);
|
DeleteFontMetricsXlibContext(mFontMetricsContext);
|
||||||
|
mRCContext = nsnull;
|
||||||
mFontMetricsContext = nsnull;
|
mFontMetricsContext = nsnull;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsFontMetricsXlibContext *nsDeviceContextXlib::mFontMetricsContext = nsnull;
|
nsFontMetricsXlibContext *nsDeviceContextXlib::mFontMetricsContext = nsnull;
|
||||||
int nsDeviceContextXlib::mFontMetricsContextCounter = 0;
|
nsRenderingContextXlibContext *nsDeviceContextXlib::mRCContext = nsnull;
|
||||||
|
int nsDeviceContextXlib::mContextCounter = 0;
|
||||||
|
|
||||||
NS_IMETHODIMP nsDeviceContextXlib::Init(nsNativeWidget aNativeWidget)
|
NS_IMETHODIMP nsDeviceContextXlib::Init(nsNativeWidget aNativeWidget)
|
||||||
{
|
{
|
||||||
|
@ -203,6 +206,15 @@ nsDeviceContextXlib::CommonInit(void)
|
||||||
if (!mFontMetricsContext)
|
if (!mFontMetricsContext)
|
||||||
{
|
{
|
||||||
rv = CreateFontMetricsXlibContext(this, PR_FALSE, &mFontMetricsContext);
|
rv = CreateFontMetricsXlibContext(this, PR_FALSE, &mFontMetricsContext);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mRCContext)
|
||||||
|
{
|
||||||
|
rv = CreateRenderingContextXlibContext(this, &mRCContext);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -89,6 +89,7 @@ public:
|
||||||
XlibRgbHandle *GetXlibRgbHandle() { return mXlibRgbHandle; }
|
XlibRgbHandle *GetXlibRgbHandle() { return mXlibRgbHandle; }
|
||||||
NS_IMETHOD GetDepth( PRUint32 &depth ) { depth = (PRUint32)mDepth; return NS_OK; }
|
NS_IMETHOD GetDepth( PRUint32 &depth ) { depth = (PRUint32)mDepth; return NS_OK; }
|
||||||
virtual void GetFontMetricsContext(nsFontMetricsXlibContext *&aContext) { aContext = mFontMetricsContext; };
|
virtual void GetFontMetricsContext(nsFontMetricsXlibContext *&aContext) { aContext = mFontMetricsContext; };
|
||||||
|
virtual void GetRCContext(nsRenderingContextXlibContext *&aContext) { aContext = mRCContext; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~nsDeviceContextXlib();
|
virtual ~nsDeviceContextXlib();
|
||||||
|
@ -103,8 +104,9 @@ private:
|
||||||
Screen * mScreen;
|
Screen * mScreen;
|
||||||
Visual * mVisual;
|
Visual * mVisual;
|
||||||
int mDepth;
|
int mDepth;
|
||||||
static nsFontMetricsXlibContext *mFontMetricsContext;
|
static nsFontMetricsXlibContext *mFontMetricsContext;
|
||||||
static int mFontMetricsContextCounter;
|
static nsRenderingContextXlibContext *mRCContext;
|
||||||
|
static int mContextCounter;
|
||||||
|
|
||||||
float mWidthFloat;
|
float mWidthFloat;
|
||||||
float mHeightFloat;
|
float mHeightFloat;
|
||||||
|
|
|
@ -201,7 +201,6 @@ static const nsModuleComponentInfo components[] =
|
||||||
PR_STATIC_CALLBACK(void)
|
PR_STATIC_CALLBACK(void)
|
||||||
nsGfxXlibModuleDtor(nsIModule *self)
|
nsGfxXlibModuleDtor(nsIModule *self)
|
||||||
{
|
{
|
||||||
nsRenderingContextXlib::Shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_NSGETMODULE_WITH_DTOR(nsGfxXlibModule, components, nsGfxXlibModuleDtor)
|
NS_IMPL_NSGETMODULE_WITH_DTOR(nsGfxXlibModule, components, nsGfxXlibModuleDtor)
|
||||||
|
|
|
@ -74,7 +74,34 @@ static void Widen8To16AndDraw(Drawable drawable,
|
||||||
int text_length);
|
int text_length);
|
||||||
|
|
||||||
|
|
||||||
nsGCCacheXlib *nsRenderingContextXlib::gcCache = nsnull;
|
class nsRenderingContextXlibContext
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
nsGCCacheXlib mGcCache;
|
||||||
|
};
|
||||||
|
|
||||||
|
nsresult CreateRenderingContextXlibContext(nsIDeviceContext *aDevice, nsRenderingContextXlibContext **aContext)
|
||||||
|
{
|
||||||
|
nsRenderingContextXlibContext *rcctx;
|
||||||
|
|
||||||
|
*aContext = nsnull;
|
||||||
|
|
||||||
|
rcctx = new nsRenderingContextXlibContext();
|
||||||
|
if (!rcctx)
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
/* No |Init()|-function to call (yet) */
|
||||||
|
*aContext = rcctx;
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeleteRenderingContextXlibContext(nsRenderingContextXlibContext *aContext)
|
||||||
|
{
|
||||||
|
if (aContext) {
|
||||||
|
delete aContext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class GraphicsState
|
class GraphicsState
|
||||||
{
|
{
|
||||||
|
@ -142,16 +169,6 @@ nsRenderingContextXlib::~nsRenderingContextXlib()
|
||||||
mGC->Release();
|
mGC->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static*/ nsresult
|
|
||||||
nsRenderingContextXlib::Shutdown()
|
|
||||||
{
|
|
||||||
if (gcCache) {
|
|
||||||
delete gcCache;
|
|
||||||
gcCache = nsnull;
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsRenderingContextXlib::Init(nsIDeviceContext* aContext, nsIWidget *aWindow)
|
nsRenderingContextXlib::Init(nsIDeviceContext* aContext, nsIWidget *aWindow)
|
||||||
{
|
{
|
||||||
|
@ -604,15 +621,13 @@ void nsRenderingContextXlib::UpdateGC()
|
||||||
if (mClipRegion) {
|
if (mClipRegion) {
|
||||||
mClipRegion->GetNativeRegion((void*&)rgn);
|
mClipRegion->GetNativeRegion((void*&)rgn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gcCache) {
|
|
||||||
gcCache = new nsGCCacheXlib();
|
|
||||||
if (!gcCache)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mGC = gcCache->GetGC(mDisplay, drawable,
|
nsRenderingContextXlibContext *rcContext;
|
||||||
valuesMask, &values, rgn);
|
nsIDeviceContext *dc = mContext;
|
||||||
|
NS_STATIC_CAST(nsDeviceContextX *, dc)->GetRCContext(rcContext);
|
||||||
|
|
||||||
|
mGC = rcContext->mGcCache.GetGC(mDisplay, drawable,
|
||||||
|
valuesMask, &values, rgn);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -66,7 +66,6 @@ class nsRenderingContextXlib : public nsRenderingContextImpl
|
||||||
public:
|
public:
|
||||||
nsRenderingContextXlib();
|
nsRenderingContextXlib();
|
||||||
virtual ~nsRenderingContextXlib();
|
virtual ~nsRenderingContextXlib();
|
||||||
static nsresult Shutdown(); // release statics
|
|
||||||
|
|
||||||
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
||||||
|
|
||||||
|
@ -272,8 +271,10 @@ protected:
|
||||||
w = 32766 - x;
|
w = 32766 - x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsGCCacheXlib *gcCache;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Prototypes */
|
||||||
|
nsresult CreateRenderingContextXlibContext(nsIDeviceContext *aDevice, nsRenderingContextXlibContext **aContext);
|
||||||
|
void DeleteRenderingContextXlibContext(nsRenderingContextXlibContext *aContext);
|
||||||
|
|
||||||
#endif /* !nsRenderingContextXlib_h___ */
|
#endif /* !nsRenderingContextXlib_h___ */
|
||||||
|
|
|
@ -62,7 +62,8 @@ nsDeviceContextXp :: nsDeviceContextXp()
|
||||||
mPrintContext(nsnull),
|
mPrintContext(nsnull),
|
||||||
mSpec(nsnull),
|
mSpec(nsnull),
|
||||||
mParentDeviceContext(nsnull),
|
mParentDeviceContext(nsnull),
|
||||||
mFontMetricsContext(nsnull)
|
mFontMetricsContext(nsnull),
|
||||||
|
mRCContext(nsnull)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,15 +145,18 @@ nsDeviceContextXp::InitDeviceContextXP(nsIDeviceContext *aCreatingDeviceContext,
|
||||||
mParentDeviceContext = aParentContext;
|
mParentDeviceContext = aParentContext;
|
||||||
|
|
||||||
/* be sure we've cleaned-up old rubbish - new values will re-populate nsFontMetricsXlib soon... */
|
/* be sure we've cleaned-up old rubbish - new values will re-populate nsFontMetricsXlib soon... */
|
||||||
if (mFontMetricsContext)
|
DeleteRenderingContextXlibContext(mRCContext);
|
||||||
{
|
DeleteFontMetricsXlibContext(mFontMetricsContext);
|
||||||
DeleteFontMetricsXlibContext(mFontMetricsContext);
|
mRCContext = nsnull;
|
||||||
mFontMetricsContext = nsnull;
|
mFontMetricsContext = nsnull;
|
||||||
}
|
|
||||||
|
|
||||||
rv = CreateFontMetricsXlibContext(this, PR_TRUE, &mFontMetricsContext);
|
rv = CreateFontMetricsXlibContext(this, PR_TRUE, &mFontMetricsContext);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
|
rv = CreateRenderingContextXlibContext(this, &mRCContext);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -310,12 +314,10 @@ void nsDeviceContextXp::DestroyXPContext()
|
||||||
* properties (build-in fonts for example ) than the printer
|
* properties (build-in fonts for example ) than the printer
|
||||||
* previously used. */
|
* previously used. */
|
||||||
FlushFontCache();
|
FlushFontCache();
|
||||||
nsRenderingContextXlib::Shutdown();
|
DeleteRenderingContextXlibContext(mRCContext);
|
||||||
if (mFontMetricsContext)
|
DeleteFontMetricsXlibContext(mFontMetricsContext);
|
||||||
{
|
mRCContext = nsnull;
|
||||||
DeleteFontMetricsXlibContext(mFontMetricsContext);
|
mFontMetricsContext = nsnull;
|
||||||
mFontMetricsContext = nsnull;
|
|
||||||
}
|
|
||||||
|
|
||||||
mPrintContext = nsnull; // nsCOMPtr will call |delete mPrintContext;|
|
mPrintContext = nsnull; // nsCOMPtr will call |delete mPrintContext;|
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,8 @@ public:
|
||||||
NS_IMETHOD CreateFontCache();
|
NS_IMETHOD CreateFontCache();
|
||||||
|
|
||||||
virtual void GetFontMetricsContext(nsFontMetricsXlibContext *&aContext) { aContext = mFontMetricsContext; };
|
virtual void GetFontMetricsContext(nsFontMetricsXlibContext *&aContext) { aContext = mFontMetricsContext; };
|
||||||
|
virtual void GetRCContext(nsRenderingContextXlibContext *&aContext) { aContext = mRCContext; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~nsDeviceContextXp();
|
virtual ~nsDeviceContextXp();
|
||||||
void DestroyXPContext();
|
void DestroyXPContext();
|
||||||
|
@ -112,6 +113,7 @@ protected:
|
||||||
nsCOMPtr<nsIDeviceContextSpec> mSpec;
|
nsCOMPtr<nsIDeviceContextSpec> mSpec;
|
||||||
nsCOMPtr<nsIDeviceContext> mParentDeviceContext;
|
nsCOMPtr<nsIDeviceContext> mParentDeviceContext;
|
||||||
nsFontMetricsXlibContext *mFontMetricsContext;
|
nsFontMetricsXlibContext *mFontMetricsContext;
|
||||||
|
nsRenderingContextXlibContext *mRCContext;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* !nsDeviceContextXp_h___ */
|
#endif /* !nsDeviceContextXp_h___ */
|
||||||
|
|
|
@ -584,19 +584,6 @@ nsPrintEngine::Print(nsIPrintSettings* aPrintSettings,
|
||||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(mContainer));
|
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(mContainer));
|
||||||
NS_ASSERTION(docShell, "This has to be a docshell");
|
NS_ASSERTION(docShell, "This has to be a docshell");
|
||||||
|
|
||||||
|
|
||||||
if (mIsDoingPrintPreview) {
|
|
||||||
PRBool okToPrint = PR_FALSE;
|
|
||||||
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
|
||||||
if (prefBranch) {
|
|
||||||
prefBranch->GetBoolPref("print.whileInPrintPreview", &okToPrint);
|
|
||||||
}
|
|
||||||
if (!okToPrint) {
|
|
||||||
ShowPrintErrorDialog(NS_ERROR_GFX_PRINTER_PRINT_WHILE_PREVIEW, PR_FALSE);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mPrt = new nsPrintData(nsPrintData::eIsPrinting);
|
mPrt = new nsPrintData(nsPrintData::eIsPrinting);
|
||||||
if (!mPrt) {
|
if (!mPrt) {
|
||||||
PR_PL(("NS_ERROR_OUT_OF_MEMORY - Creating PrintData"));
|
PR_PL(("NS_ERROR_OUT_OF_MEMORY - Creating PrintData"));
|
||||||
|
|
|
@ -170,15 +170,35 @@
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
|
|
||||||
|
|
||||||
// XXX TEMPORARY
|
// Hide the ``Print...'' button when the underlying gfx code does not
|
||||||
// XXX Until bug 119491 ("Cleanup global vars in PostScript and Xprint
|
// support multiple devicecontext to be used concurrently
|
||||||
// modules") is fixed we will hide the ``Print...'' button
|
// (e.g. printing and printpreview at the same time; required as
|
||||||
|
// legacy support for unices.'s PostScript module (Xprint
|
||||||
|
// on unices.does not have problems with that))
|
||||||
// XXX the scaling widgets, and the orientation widgets on unices.
|
// XXX the scaling widgets, and the orientation widgets on unices.
|
||||||
var canPrint = true;
|
var canPrint = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
|
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
|
||||||
canPrint = prefs.getBoolPref("print.whileInPrintPreview");
|
canPrint = prefs.getBoolPref("print.whileInPrintPreview");
|
||||||
|
if (!canPrint)
|
||||||
|
{
|
||||||
|
// Ask the printerfeatures database if this printer device
|
||||||
|
// supports multiple device instances which can be used
|
||||||
|
// concurrently
|
||||||
|
var smdci = prefs.getBoolPref("print.tmp.printerfeatures." +
|
||||||
|
print.currentPrintSettings.printerName +
|
||||||
|
".can_use_multiple_devicecontexts_concurrently");
|
||||||
|
|
||||||
|
// We can print from print preview when we can use multiple
|
||||||
|
// devicecontext instances in parallel (regardless what
|
||||||
|
// "print.whileInPrintPreview" may say here...)
|
||||||
|
if (smdci)
|
||||||
|
{
|
||||||
|
canPrint = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
|
|
||||||
if (!canPrint)
|
if (!canPrint)
|
||||||
|
@ -197,7 +217,6 @@
|
||||||
document.getAnonymousNodes(this)[i].setAttribute("hidden", "true");
|
document.getAnonymousNodes(this)[i].setAttribute("hidden", "true");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// XXX TEMPORARY
|
|
||||||
]]>
|
]]>
|
||||||
</constructor>
|
</constructor>
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче