From 41abb256135f29010556087f327c752d174b7f1c Mon Sep 17 00:00:00 2001 From: "kjh-5727%comcast.net" Date: Tue, 7 Feb 2006 01:15:05 +0000 Subject: [PATCH] Bug 226600 - Add a print preview flag to *nix print device context specs. r=blizzard, sr=roc --- widget/src/gtk2/nsDeviceContextSpecFactoryG.cpp | 2 +- widget/src/gtk2/nsDeviceContextSpecG.cpp | 13 +++++++++---- widget/src/gtk2/nsDeviceContextSpecG.h | 12 +++++++----- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/widget/src/gtk2/nsDeviceContextSpecFactoryG.cpp b/widget/src/gtk2/nsDeviceContextSpecFactoryG.cpp index ec664711a76..816eed8446a 100644 --- a/widget/src/gtk2/nsDeviceContextSpecFactoryG.cpp +++ b/widget/src/gtk2/nsDeviceContextSpecFactoryG.cpp @@ -82,7 +82,7 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryGTK :: CreateDeviceContextSpec(nsIWidget nsCOMPtr devSpec = do_CreateInstance(kDeviceContextSpecCID, &rv); if (NS_SUCCEEDED(rv)) { - rv = ((nsDeviceContextSpecGTK *)devSpec.get())->Init(aPrintSettings); + rv = ((nsDeviceContextSpecGTK *)devSpec.get())->Init(aPrintSettings, aIsPrintPreview); if (NS_SUCCEEDED(rv)) { aNewSpec = devSpec; diff --git a/widget/src/gtk2/nsDeviceContextSpecG.cpp b/widget/src/gtk2/nsDeviceContextSpecG.cpp index ba213d2469d..2e608864a94 100644 --- a/widget/src/gtk2/nsDeviceContextSpecG.cpp +++ b/widget/src/gtk2/nsDeviceContextSpecG.cpp @@ -319,13 +319,11 @@ NS_IMPL_ISUPPORTS1(nsDeviceContextSpecGTK, * - Xlib-toolkit: * file: mozilla/gfx/src/xlib/nsDeviceContextSpecXlib.cpp * function: NS_IMETHODIMP nsDeviceContextSpecXlib::Init() - * - Qt-toolkit: - * file: mozilla/gfx/src/qt/nsDeviceContextSpecQT.cpp - * function: NS_IMETHODIMP nsDeviceContextSpecQT::Init() * * ** Please update the other toolkits when changing this function. */ -NS_IMETHODIMP nsDeviceContextSpecGTK::Init(nsIPrintSettings *aPS) +NS_IMETHODIMP nsDeviceContextSpecGTK::Init(nsIPrintSettings *aPS, + PRBool aIsPrintPreview) { DO_PR_DEBUG_LOG(("nsDeviceContextSpecGTK::Init(aPS=%p)\n", aPS)); nsresult rv = NS_ERROR_FAILURE; @@ -408,6 +406,7 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::Init(nsIPrintSettings *aPS) mOrientation = orientation; mToPrinter = !tofile; mCopies = copies; + mIsPPreview = aIsPrintPreview; } return rv; @@ -419,6 +418,12 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::GetToPrinter(PRBool &aToPrinter) return NS_OK; } +NS_IMETHODIMP nsDeviceContextSpecGTK::GetIsPrintPreview(PRBool &aIsPPreview) +{ + aIsPPreview = mIsPPreview; + return NS_OK; +} + NS_IMETHODIMP nsDeviceContextSpecGTK::GetPrinterName ( const char **aPrinter ) { *aPrinter = mPrinter; diff --git a/widget/src/gtk2/nsDeviceContextSpecG.h b/widget/src/gtk2/nsDeviceContextSpecG.h index 701ec524a3b..01e3b22bd3e 100644 --- a/widget/src/gtk2/nsDeviceContextSpecG.h +++ b/widget/src/gtk2/nsDeviceContextSpecG.h @@ -75,10 +75,11 @@ public: NS_DECL_ISUPPORTS - NS_IMETHOD Init(nsIPrintSettings* aPS); + NS_IMETHOD Init(nsIPrintSettings* aPS, PRBool aIsPrintPreview); NS_IMETHOD ClosePrintManager(); NS_IMETHOD GetToPrinter(PRBool &aToPrinter); + NS_IMETHOD GetIsPrintPreview(PRBool &aIsPPreview); NS_IMETHOD GetPrinterName ( const char **aPrinter ); NS_IMETHOD GetCopies ( int &aCopies ); NS_IMETHOD GetFirstPageFirst(PRBool &aFpf); @@ -100,9 +101,11 @@ public: protected: nsCOMPtr mPrintSettings; - PRBool mToPrinter; /* If PR_TRUE, print to printer */ - PRBool mFpf; /* If PR_TRUE, first page first */ - PRBool mGrayscale; /* If PR_TRUE, print grayscale */ + PRBool mToPrinter : 1; /* If PR_TRUE, print to printer */ + PRBool mIsPPreview : 1; /* If PR_TRUE, is print preview */ + PRBool mFpf : 1; /* If PR_TRUE, first page first */ + PRBool mGrayscale : 1; /* If PR_TRUE, print grayscale */ + PRBool mCancel : 1; /* If PR_TRUE, user cancelled */ int mOrientation; /* Orientation e.g. Portrait */ char mCommand[PATH_MAX]; /* Print command e.g., lpr */ char mPath[PATH_MAX]; /* If toPrinter = PR_FALSE, dest file */ @@ -110,7 +113,6 @@ protected: char mPaperName[256]; /* Printer name */ char mPlexName[256]; /* Plex mode name */ int mCopies; /* number of copies */ - PRBool mCancel; /* If PR_TRUE, user cancelled */ float mLeft; /* left margin */ float mRight; /* right margin */ float mTop; /* top margin */