From d9451d58d296533ca224a915634bd4f29bc84865 Mon Sep 17 00:00:00 2001 From: "syd%netscape.com" Date: Sat, 13 Mar 1999 03:21:16 +0000 Subject: [PATCH] Call GTK print dialog. Currently, Init routine returns FAILURE, effectively stubbing out this functionality. Done Cone will turn it on at a later time. Gtk+ print menu crashes will temporarily disappear because of this change. --- gfx/src/gtk/nsDeviceContextSpecG.cpp | 36 ++++++++++++++++++++++-- widget/src/gtk2/nsDeviceContextSpecG.cpp | 36 ++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 6 deletions(-) diff --git a/gfx/src/gtk/nsDeviceContextSpecG.cpp b/gfx/src/gtk/nsDeviceContextSpecG.cpp index a1c6aadd1eef..f989d596b187 100644 --- a/gfx/src/gtk/nsDeviceContextSpecG.cpp +++ b/gfx/src/gtk/nsDeviceContextSpecG.cpp @@ -21,7 +21,7 @@ //#include "plstr.h" /** ------------------------------------------------------- - * Construct the nsDeviceContextSpecMac + * Construct the nsDeviceContextSpecGTK * @update dc 12/02/98 */ nsDeviceContextSpecGTK :: nsDeviceContextSpecGTK() @@ -31,7 +31,7 @@ nsDeviceContextSpecGTK :: nsDeviceContextSpecGTK() } /** ------------------------------------------------------- - * Destroy the nsDeviceContextSpecMac + * Destroy the nsDeviceContextSpecGTK * @update dc 2/15/98 */ nsDeviceContextSpecGTK :: ~nsDeviceContextSpecGTK() @@ -49,10 +49,40 @@ NS_IMPL_RELEASE(nsDeviceContextSpecGTK) /** ------------------------------------------------------- * Initialize the nsDeviceContextSpecGTK * @update dc 2/15/98 + * @update syd 3/2/99 */ NS_IMETHODIMP nsDeviceContextSpecGTK :: Init(PRBool aQuiet) { - return NS_OK; + char *path; + + // XXX for now, neutering this per rickg until dcone can play with it + + return NS_ERROR_FAILURE; + + // XXX these settings should eventually come out of preferences + + mPrData.toPrinter = PR_TRUE; + mPrData.fpf = PR_TRUE; + mPrData.grayscale = PR_FALSE; + mPrData.size = SizeLetter; + mPrData.stream = (FILE *) NULL; + sprintf( mPrData.command, "lpr" ); + + // PWD, HOME, or fail + + if ( ( path = getenv( "PWD" ) ) == (char *) NULL ) + if ( ( path = getenv( "HOME" ) ) == (char *) NULL ) + strcpy( mPrData.path, "netscape.ps" ); + if ( path != (char *) NULL ) + sprintf( mPrData.path, "%s/netscape.ps", path ); + else + return NS_ERROR_FAILURE; + + ::UnixPrDialog( &mPrData ); + if ( mPrData.cancel == PR_TRUE ) + return NS_ERROR_FAILURE; + else + return NS_OK; } /** ------------------------------------------------------- diff --git a/widget/src/gtk2/nsDeviceContextSpecG.cpp b/widget/src/gtk2/nsDeviceContextSpecG.cpp index a1c6aadd1eef..f989d596b187 100644 --- a/widget/src/gtk2/nsDeviceContextSpecG.cpp +++ b/widget/src/gtk2/nsDeviceContextSpecG.cpp @@ -21,7 +21,7 @@ //#include "plstr.h" /** ------------------------------------------------------- - * Construct the nsDeviceContextSpecMac + * Construct the nsDeviceContextSpecGTK * @update dc 12/02/98 */ nsDeviceContextSpecGTK :: nsDeviceContextSpecGTK() @@ -31,7 +31,7 @@ nsDeviceContextSpecGTK :: nsDeviceContextSpecGTK() } /** ------------------------------------------------------- - * Destroy the nsDeviceContextSpecMac + * Destroy the nsDeviceContextSpecGTK * @update dc 2/15/98 */ nsDeviceContextSpecGTK :: ~nsDeviceContextSpecGTK() @@ -49,10 +49,40 @@ NS_IMPL_RELEASE(nsDeviceContextSpecGTK) /** ------------------------------------------------------- * Initialize the nsDeviceContextSpecGTK * @update dc 2/15/98 + * @update syd 3/2/99 */ NS_IMETHODIMP nsDeviceContextSpecGTK :: Init(PRBool aQuiet) { - return NS_OK; + char *path; + + // XXX for now, neutering this per rickg until dcone can play with it + + return NS_ERROR_FAILURE; + + // XXX these settings should eventually come out of preferences + + mPrData.toPrinter = PR_TRUE; + mPrData.fpf = PR_TRUE; + mPrData.grayscale = PR_FALSE; + mPrData.size = SizeLetter; + mPrData.stream = (FILE *) NULL; + sprintf( mPrData.command, "lpr" ); + + // PWD, HOME, or fail + + if ( ( path = getenv( "PWD" ) ) == (char *) NULL ) + if ( ( path = getenv( "HOME" ) ) == (char *) NULL ) + strcpy( mPrData.path, "netscape.ps" ); + if ( path != (char *) NULL ) + sprintf( mPrData.path, "%s/netscape.ps", path ); + else + return NS_ERROR_FAILURE; + + ::UnixPrDialog( &mPrData ); + if ( mPrData.cancel == PR_TRUE ) + return NS_ERROR_FAILURE; + else + return NS_OK; } /** -------------------------------------------------------