Bye bye Xprint. b=326716 r+sr=dbaron

This commit is contained in:
mats.palmgren@bredband.net 2007-06-13 11:02:58 -07:00
parent b05a0247cc
commit 3f7e3e99ea
48 changed files with 21 additions and 11284 deletions

View File

@ -161,7 +161,6 @@ gfx/src/psshared/Makefile
gfx/src/photon/Makefile
gfx/src/mac/Makefile
gfx/src/os2/Makefile
gfx/src/xlibrgb/Makefile
gfx/src/windows/Makefile
gfx/src/thebes/Makefile
gfx/tests/Makefile

View File

@ -391,16 +391,6 @@ then
XSUNSMESIZE="512"
export XSUNTRANSPORT XSUNSMESIZE
fi
## Populate XPSERVERLIST if it was not set yet
if [ "$XPSERVERLIST" = "" ]
then
if [ -f /etc/init.d/xprint ] ; then
XPSERVERLIST="`/bin/sh /etc/init.d/xprint get_xpserverlist`"
if [ "$XPSERVERLIST" != "" ] ; then
export XPSERVERLIST
fi
fi
fi
if [ "$moz_debug" -eq 1 ]
then
@ -423,9 +413,6 @@ then
if [ -n "$FONTCONFIG_PATH" ]; then
echo "FONTCONFIG_PATH=$FONTCONFIG_PATH"
fi
if [ -n "$XPSERVERLIST" ]; then
echo "XPSERVERLIST=$XPSERVERLIST"
fi
if [ -n "$MOZILLA_POSTSCRIPT_PRINTER_LIST" ]; then
echo "MOZILLA_POSTSCRIPT_PRINTER_LIST=$MOZILLA_POSTSCRIPT_PRINTER_LIST"
fi

View File

@ -468,10 +468,6 @@ MOZ_DBUS_GLIB_CFLAGS = @MOZ_DBUS_GLIB_CFLAGS@
MOZ_DBUS_GLIB_LIBS = @MOZ_DBUS_GLIB_LIBS@
MOZ_ENABLE_DBUS = @MOZ_ENABLE_DBUS@
MOZ_XPRINT_CFLAGS = @MOZ_XPRINT_CFLAGS@
MOZ_XPRINT_LDFLAGS = @MOZ_XPRINT_LDFLAGS@
MOZ_ENABLE_XPRINT = @MOZ_ENABLE_XPRINT@
MOZ_ENABLE_FREETYPE2 = @MOZ_ENABLE_FREETYPE2@
FT2_CFLAGS = @FT2_CFLAGS@
FT2_LIBS = @FT2_LIBS@

View File

@ -97,10 +97,6 @@ ifneq (,$(MOZ_ENABLE_GTK2))
STATIC_EXTRA_LIBS += $(XLDFLAGS) $(XT_LIBS)
endif
ifdef MOZ_ENABLE_XPRINT
STATIC_EXTRA_LIBS += $(MOZ_XPRINT_LDFLAGS)
endif
ifdef MOZ_ENABLE_XFT
STATIC_EXTRA_LIBS += $(MOZ_XFT_LIBS)
endif

View File

@ -4834,27 +4834,6 @@ MOZ_ARG_DISABLE_BOOL(postscript,
MOZ_ENABLE_POSTSCRIPT=,
MOZ_ENABLE_POSTSCRIPT=1 )
dnl ========================================================
dnl = Xprint print module
dnl ========================================================
if test "$MOZ_X11"
then
_SAVE_LDFLAGS="$LDFLAGS"
LDFLAGS="$XLDFLAGS $LDFLAGS"
AC_CHECK_LIB(Xp, XpGetPrinterList, [XPRINT_LIBS="-lXp"],
MOZ_ENABLE_XPRINT=, $XEXT_LIBS $XLIBS)
LDFLAGS="$_SAVE_LDFLAGS"
MOZ_XPRINT_CFLAGS="$X_CFLAGS"
MOZ_XPRINT_LDFLAGS="$XLDFLAGS $XPRINT_LIBS"
MOZ_XPRINT_LDFLAGS="$MOZ_XPRINT_LDFLAGS $XEXT_LIBS $X11_LIBS"
MOZ_ARG_DISABLE_BOOL(xprint,
[ --disable-xprint Disable Xprint printing support ],
MOZ_ENABLE_XPRINT=,
MOZ_ENABLE_XPRINT=1 )
fi
dnl ========================================================
dnl = GnomeVFS support module
dnl ========================================================
@ -5009,8 +4988,7 @@ dnl = (see bug 180851)
dnl ========================================================
if test "$MOZ_ENABLE_GTK2" \
&& test "$MOZ_ENABLE_COREXFONTS" \
|| test "$MOZ_ENABLE_XPRINT"
&& test "$MOZ_ENABLE_COREXFONTS"
then
AC_DEFINE(MOZ_EXTRA_X11CONVERTERS)
MOZ_EXTRA_X11CONVERTERS=1
@ -7420,9 +7398,6 @@ AC_SUBST(MOZ_IPCD)
AC_SUBST(HAVE_XIE)
AC_SUBST(MOZ_XIE_LIBS)
AC_SUBST(MOZ_XPRINT_CFLAGS)
AC_SUBST(MOZ_XPRINT_LDFLAGS)
AC_SUBST(MOZ_ENABLE_XPRINT)
AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
AC_SUBST(XPCOM_USE_LEA)

View File

@ -88,13 +88,11 @@ NS_ERROR_GFX_PRINTER_ORIENTATION_NOT_SUPPORTED=There was a problem printing beca
NS_ERROR_GFX_PRINTER_COLORSPACE_NOT_SUPPORTED=There was a problem printing because the print job requires color capabilities that your printer does not support.
NS_ERROR_GFX_PRINTER_TOO_MANY_COPIES=There was a problem printing because you requested too many copies.
NS_ERROR_GFX_PRINTER_DRIVER_CONFIGURATION_ERROR=There was a problem printing. The printer driver is not properly configured.
NS_ERROR_GFX_PRINTER_XPRINT_BROKEN_XPRT=A broken version of the X print server (Xprt) has been detected. Note that printing using this Xprt server may not work properly. Please contact the server vendor for a fixed version.
NS_ERROR_GFX_PRINTER_DOC_IS_BUSY_PP=The browser cannot print preview right now.\nPlease try again when the page has finished loading.
NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED=The page was replaced while you were trying to print.\nPlease try again.
NS_ERROR_GFX_NO_PRINTDIALOG_IN_TOOLKIT=Either pluggable dialogs were not properly installed\nOr this GFX Toolkit no longer supports native Print Dialogs
NS_ERROR_GFX_NO_PRINTROMPTSERVICE=The Printing Prompt Service is missing.
NS_ERROR_GFX_PRINTER_NO_XUL=We are unable to Print or Print Preview this page.
NS_ERROR_GFX_PRINTER_XPRINT_NO_XPRINT_SERVERS_FOUND=There was a problem printing. No Xprint server(s) could be found.\nCheck whether the XPSERVERLIST environment variable contains any valid Xprint servers.\nFor further information see http://xprint.mozdev.org/ or http://www.mozilla.org/projects/xprint/
NS_ERROR_GFX_PRINTER_PLEX_NOT_SUPPORTED=There was a problem printing because the plex mode you specified is not supported by your printer.
NS_ERROR_GFX_PRINTER_DOC_IS_BUSY=The browser cannot print the document while it is being loaded.
NS_ERROR_GFX_PRINTING_NOT_IMPLEMENTED=Printing is not implemented.

View File

@ -47,10 +47,8 @@ components/xpconnect.xpt
;
libgkgfx.so
libxlibrgb.so
libgfxpsshar.so
components/libgfxps.so
components/libgfxxprint.so
components/gfx.xpt
components/widget.xpt

View File

@ -49,11 +49,9 @@ components/xpconnect.xpt
libgkgfx.so
libgtksuperwin.so
libgtkembedmoz.so
libxlibrgb.so
libgfxpsshar.so
components/libgfx_gtk.so
components/libgfxps.so
components/libgfxxprint.so
components/gfx.xpt
components/libwidget_gtk.so
components/libwidget_gtk2.so

View File

@ -39,10 +39,8 @@ components/xpconnect.xpt
;
libgkgfx.so
libxlibrgb.so
libgfxpsshar.so
components/libgfxps.so
components/libgfxxprint.so
components/gfx.xpt
components/widget.xpt

View File

@ -41,11 +41,9 @@ components/xpconnect.xpt
libgkgfx.so
libgtksuperwin.so
libgtkembedmoz.so
libxlibrgb.so
libgfxpsshar.so
components/libgfx_gtk.so
components/libgfxps.so
components/libgfxxprint.so
components/gfx.xpt
components/libwidget_gtk.so
components/libwidget_gtk2.so

View File

@ -124,42 +124,36 @@ typedef void * nsNativeDeviceContext;
/* driver configuration error */
#define NS_ERROR_GFX_PRINTER_DRIVER_CONFIGURATION_ERROR \
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+23)
/* Xprint module specific: Xprt server broken */
#define NS_ERROR_GFX_PRINTER_XPRINT_BROKEN_XPRT \
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+24)
/* The document is still being loaded, can't Print Preview */
#define NS_ERROR_GFX_PRINTER_DOC_IS_BUSY_PP \
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+25)
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+24)
/* The document was asked to be destroyed while we were preparing printing */
#define NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED \
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+26)
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+25)
/* Cannot Print or Print Preview XUL Documents */
#define NS_ERROR_GFX_PRINTER_NO_XUL \
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+27)
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+26)
/* The toolkit no longer supports the Print Dialog (for embedders) */
#define NS_ERROR_GFX_NO_PRINTDIALOG_IN_TOOLKIT \
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+28)
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+27)
/* The was wasn't any Print Prompt service registered (this shouldn't happen) */
#define NS_ERROR_GFX_NO_PRINTROMPTSERVICE \
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+29)
/* Xprint module specific: No Xprint servers found */
#define NS_ERROR_GFX_PRINTER_XPRINT_NO_XPRINT_SERVERS_FOUND \
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+30)
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+28)
/* requested plex mode not supported by printer */
#define NS_ERROR_GFX_PRINTER_PLEX_NOT_SUPPORTED \
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+31)
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+29)
/* The document is still being loaded */
#define NS_ERROR_GFX_PRINTER_DOC_IS_BUSY \
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+32)
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+30)
/* Printing is not implemented */
#define NS_ERROR_GFX_PRINTING_NOT_IMPLEMENTED \
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+33)
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+31)
/* Cannot load the matching print module */
#define NS_ERROR_GFX_COULD_NOT_LOAD_PRINT_MODULE \
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+34)
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+32)
/* requested resolution/quality mode not supported by printer */
#define NS_ERROR_GFX_PRINTER_RESOLUTION_NOT_SUPPORTED \
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+35)
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+33)
/**
* Conts need for Print Preview

View File

@ -74,15 +74,6 @@ DIRS += ps
endif
endif
# Build xlibrgb only for X toolkits and/or Xprint
ifneq (,$(MOZ_ENABLE_XPRINT))
DIRS += xlibrgb
endif
ifdef MOZ_ENABLE_XPRINT
DIRS += xprintutil xprint
endif
ifdef MOZ_ENABLE_CAIRO_GFX
DIRS += thebes
else

View File

@ -68,11 +68,7 @@ ifdef SUNCTL
REQUIRES += ctl
endif
ifdef MOZ_ENABLE_XPRINT
REQUIRES += xprintutil
endif
# Code shared between GTK+, Xlib and Xprint gfx modules
# Code used by the GTK+ gfx module
X11SHARED_LCPPSRCS = \
nsAntiAliasedGlyph.cpp \
nsX11AlphaBlend.cpp \
@ -189,13 +185,6 @@ DEFINES += -DUSE_POSTSCRIPT
EXTRA_DSO_LDOPTS += -lgfxpsshar
endif
ifdef MOZ_ENABLE_XPRINT
DEFINES += -DUSE_XPRINT -DUSE_MOZILLA_TYPES
EXTRA_DSO_LDOPTS += \
-lxprintutil \
$(MOZ_XPRINT_LDFLAGS)
endif
LOCAL_INCLUDES = \
-I../.. \
-I$(srcdir)/. \
@ -210,11 +199,5 @@ INCLUDES += $(FT2_CFLAGS)
LOCAL_INCLUDES += -I$(srcdir)/../freetype
endif
ifdef MOZ_ENABLE_XPRINT
export:: $(addprefix $(srcdir)/../xprint/,$(XPU_LCSRCS)) $(addprefix $(srcdir)/../x11shared/,$(X11SHARED_LCPPSRCS))
$(INSTALL) $^ .
else
export:: $(addprefix $(srcdir)/../x11shared/,$(X11SHARED_LCPPSRCS))
$(INSTALL) $^ .
endif

View File

@ -51,10 +51,6 @@
#include "nsGfxPSCID.h"
#include "nsIDeviceContextPS.h"
#endif /* USE_POSTSCRIPT */
#ifdef USE_XPRINT
#include "nsGfxXPrintCID.h"
#include "nsIDeviceContextXPrint.h"
#endif /* USE_XPRINT */
#include "nsFontMetricsUtils.h"
@ -474,29 +470,6 @@ NS_IMETHODIMP nsDeviceContextGTK::GetDeviceContextFor(nsIDeviceContextSpec *aDev
if (NS_FAILED(rv))
return rv;
#ifdef USE_XPRINT
if (method == pmXprint) { // XPRINT
static NS_DEFINE_CID(kCDeviceContextXp, NS_DEVICECONTEXTXP_CID);
nsCOMPtr<nsIDeviceContextXp> dcxp(do_CreateInstance(kCDeviceContextXp, &rv));
NS_ASSERTION(NS_SUCCEEDED(rv), "Couldn't create Xp Device context.");
if (NS_FAILED(rv))
return NS_ERROR_GFX_COULD_NOT_LOAD_PRINT_MODULE;
rv = dcxp->SetSpec(aDevice);
if (NS_FAILED(rv))
return rv;
rv = dcxp->InitDeviceContextXP((nsIDeviceContext*)aContext,
(nsIDeviceContext*)this);
if (NS_FAILED(rv))
return rv;
rv = dcxp->QueryInterface(NS_GET_IID(nsIDeviceContext),
(void **)&aContext);
return rv;
}
else
#endif /* USE_XPRINT */
#endif
#ifdef USE_POSTSCRIPT
// if (method == pmPostScript) // PostScript

View File

@ -559,7 +559,7 @@ nsFontCache::GetMetricsFor(const nsFont& aFont, nsIAtom* aLangGroup,
return rv;
}
/* PostScript and Xprint module may override this method to create
/* PostScript module may override this method to create
* nsIFontMetrics objects with their own classes
*/
nsresult

View File

@ -40,10 +40,10 @@
#include "gfx-config.h"
/* PostScript/Xprint print modules do not support more than one object
/* PostScript print module do not support more than one object
* instance because they use global vars which cannot be shared between
* multiple instances...
* bug 119491 ("Cleanup global vars in PostScript and Xprint modules) will fix
* bug 119491 ("Cleanup global vars in PostScript module) will fix
* that...
*/
#define WE_DO_NOT_SUPPORT_MULTIPLE_PRINT_DEVICECONTEXTS 1

View File

@ -1,66 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = xlibrgb
LIBRARY_NAME = xlibrgb
EXPORT_LIBRARY = 1
GRE_MODULE = 1
LIBXUL_LIBRARY = 1
PACKAGE_FILE = xlibrgb.pkg
CSRCS = xlibrgb.c
EXPORTS = xlibrgb.h
EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS)
REQUIRES = xpcom
include $(topsrcdir)/config/rules.mk
DEFINES += -DUSE_MOZILLA_TYPES -D_IMPL_XLIBRGB_API
INCLUDES += $(TK_CFLAGS)

File diff suppressed because it is too large Load Diff

View File

@ -1,280 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org Code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* This code is derived from GdkRgb.
* For more information on GdkRgb, see http://www.levien.com/gdkrgb/
* Raph Levien <raph@acm.org>
*/
/* Ported by Christopher Blizzard to Xlib. With permission from the
* original authors of this file, the contents of this file are also
* redistributable under the terms of the Mozilla Public license. For
* information about the Mozilla Public License, please see the
* license information at http://www.mozilla.org/MPL/
*/
/* This code is copyright the following authors:
* Raph Levien <raph@acm.org>
* Manish Singh <manish@gtk.org>
* Tim Janik <timj@gtk.org>
* Peter Mattis <petm@xcf.berkeley.edu>
* Spencer Kimball <spencer@xcf.berkeley.edu>
* Josh MacDonald <jmacd@xcf.berkeley.edu>
* Christopher Blizzard <blizzard@redhat.com>
* Owen Taylor <otaylor@redhat.com>
* Shawn T. Amundson <amundson@gtk.org>
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
*/
#ifndef __XLIB_RGB_H__
#define __XLIB_RGB_H__
/* Force ANSI C prototypes from X11 headers */
#undef FUNCPROTO
#define FUNCPROTO 15
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Intrinsic.h>
_XFUNCPROTOBEGIN
/* Porting Note:
* If you are going to use this code somewhere other than mozilla
* you will need to set these defines. It's pretty easy for Intel
* but I'm not sure about other platforms.
*/
#ifdef USE_MOZILLA_TYPES
/* prtypes contains definitions for uint32/int32 and uint16/int16 */
#include "prtypes.h"
#include "prcpucfg.h"
#include "nscore.h"
#ifdef _IMPL_XLIBRGB_API
#define NS_XLIBRGB_API(type) NS_EXPORT_(type)
#else
#define NS_XLIBRGB_API(type) NS_IMPORT_(type)
#endif
#define NS_TO_XXLIB_RGB(ns) (ns & 0xff) << 16 | (ns & 0xff00) | ((ns >> 16) & 0xff)
#else
typedef unsigned int uint32;
typedef int int32;
typedef unsigned short uint16;
typedef short int16;
#define NS_XLIBRGB_API(type) type
#endif /* USE_MOZILLA_TYPES */
typedef struct _XlibRgbCmap XlibRgbCmap;
typedef struct _XlibRgbHandle XlibRgbHandle;
struct _XlibRgbCmap {
unsigned int colors[256];
unsigned char lut[256]; /* for 8-bit modes */
};
typedef enum
{
XLIB_RGB_DITHER_NONE,
XLIB_RGB_DITHER_NORMAL,
XLIB_RGB_DITHER_MAX
} XlibRgbDither;
typedef struct
{
const char *handle_name;
int pseudogray; /* emulate GrayScale via PseudoColor visuals */
int install_colormap;
int disallow_image_tiling;
int disallow_mit_shmem;
int verbose;
XVisualInfo xtemplate;
long xtemplate_mask;
} XlibRgbArgs;
NS_XLIBRGB_API(XlibRgbHandle *)
xxlib_rgb_create_handle (Display *display, Screen *screen,
XlibRgbArgs *args);
NS_XLIBRGB_API(void)
xxlib_rgb_destroy_handle (XlibRgbHandle *handle);
NS_XLIBRGB_API(unsigned long)
xxlib_rgb_xpixel_from_rgb (XlibRgbHandle *handle, uint32 rgb);
NS_XLIBRGB_API(void)
xxlib_rgb_gc_set_foreground (XlibRgbHandle *handle, GC gc, uint32 rgb);
NS_XLIBRGB_API(void)
xxlib_rgb_gc_set_background (XlibRgbHandle *handle, GC gc, uint32 rgb);
NS_XLIBRGB_API(void)
xxlib_draw_rgb_image (XlibRgbHandle *handle, Drawable drawable,
GC gc,
int x,
int y,
int width,
int height,
XlibRgbDither dith,
unsigned char *rgb_buf,
int rowstride);
NS_XLIBRGB_API(void)
xxlib_draw_rgb_image_dithalign (XlibRgbHandle *handle, Drawable drawable,
GC gc,
int x,
int y,
int width,
int height,
XlibRgbDither dith,
unsigned char *rgb_buf,
int rowstride,
int xdith,
int ydith);
NS_XLIBRGB_API(void)
xxlib_draw_rgb_32_image (XlibRgbHandle *handle, Drawable drawable,
GC gc,
int x,
int y,
int width,
int height,
XlibRgbDither dith,
unsigned char *buf,
int rowstride);
NS_XLIBRGB_API(void)
xxlib_draw_gray_image (XlibRgbHandle *handle, Drawable drawable,
GC gc,
int x,
int y,
int width,
int height,
XlibRgbDither dith,
unsigned char *buf,
int rowstride);
NS_XLIBRGB_API(XlibRgbCmap *)
xxlib_rgb_cmap_new (XlibRgbHandle *handle, uint32 *colors, int n_colors);
NS_XLIBRGB_API(void)
xxlib_rgb_cmap_free (XlibRgbHandle *handle, XlibRgbCmap *cmap);
NS_XLIBRGB_API(void)
xxlib_draw_indexed_image (XlibRgbHandle *handle, Drawable drawable,
GC gc,
int x,
int y,
int width,
int height,
XlibRgbDither dith,
unsigned char *buf,
int rowstride,
XlibRgbCmap *cmap);
NS_XLIBRGB_API(void)
xxlib_draw_xprint_scaled_rgb_image( XlibRgbHandle *handle,
Drawable drawable,
long paper_resolution,
long image_resolution,
GC gc,
int x,
int y,
int width,
int height,
XlibRgbDither dith,
unsigned char *rgb_buf,
int rowstride);
/* Below are some functions which are primarily useful for debugging
and experimentation. */
NS_XLIBRGB_API(Bool)
xxlib_rgb_ditherable (XlibRgbHandle *handle);
NS_XLIBRGB_API(void)
xxlib_rgb_set_verbose (XlibRgbHandle *handle, Bool verbose);
NS_XLIBRGB_API(void)
xxlib_rgb_set_min_colors (XlibRgbHandle *handle, int min_colors);
NS_XLIBRGB_API(Colormap)
xxlib_rgb_get_cmap (XlibRgbHandle *handle);
NS_XLIBRGB_API(Visual *)
xxlib_rgb_get_visual (XlibRgbHandle *handle);
NS_XLIBRGB_API(XVisualInfo *)
xxlib_rgb_get_visual_info (XlibRgbHandle *handle);
NS_XLIBRGB_API(int)
xxlib_rgb_get_depth (XlibRgbHandle *handle);
/* hint: if you don't how to obtain a handle - use |xxlib_find_handle()| :-) */
NS_XLIBRGB_API(Display *)
xxlib_rgb_get_display (XlibRgbHandle *handle);
NS_XLIBRGB_API(Screen *)
xxlib_rgb_get_screen (XlibRgbHandle *handle);
NS_XLIBRGB_API(unsigned long)
xxlib_get_prec_from_mask(unsigned long);
NS_XLIBRGB_API(unsigned long)
xxlib_get_shift_from_mask(unsigned long);
/* default name - for cases where there is only one XlibRgbHandle required */
#define XXLIBRGB_DEFAULT_HANDLE ("xxlib-default")
NS_XLIBRGB_API(Bool)
xxlib_register_handle(const char *name, XlibRgbHandle *handle);
NS_XLIBRGB_API(Bool)
xxlib_deregister_handle(const char *name);
NS_XLIBRGB_API(XlibRgbHandle *)
xxlib_find_handle(const char *name);
_XFUNCPROTOEND
#endif /* !__XLIB_RGB_H__ */

View File

@ -1,4 +0,0 @@
[gecko]
#if SHARED_LIBRARY
dist/bin/@SHARED_LIBRARY@
#endif

View File

@ -1,131 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = gfx
LIBRARY_NAME = gfxxprint
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
MODULE_NAME = nsGfxXprintModule
GRE_MODULE = 1
LIBXUL_LIBRARY = 1
EXTRA_DSO_LIBS = gfxshared_s gkgfx
REQUIRES = xpcom \
string \
xlibrgb \
xprintutil \
widget \
pref \
locale \
uconv \
unicharutil \
imglib2 \
$(NULL)
# Sun's Complex Text Layout support
ifdef SUNCTL
REQUIRES += ctl
endif
# Code shared between GTK+, Xlib and Xprint gfx modules
# (empty for now - but this will be filled soon...)
X11SHARED_LCPPSRCS = \
$(NULL)
# nsDrawingSurfaceXlib only required for staticbuild
XLIB_LCPPSRCS = \
nsDrawingSurfaceXlib.cpp \
nsFontMetricsXlib.cpp \
nsRenderingContextXlib.cpp \
nsRegionXlib.cpp \
nsGCCache.cpp \
$(NULL)
CPPSRCS = \
$(X11SHARED_LCPPSRCS) \
$(XLIB_LCPPSRCS) \
nsDeviceContextXP.cpp \
nsGfxFactoryXP.cpp \
nsXPrintContext.cpp \
nsRenderingContextXp.cpp \
$(NULL)
EXPORTS = \
nsIDeviceContextXPrint.h \
nsGfxXPrintCID.h \
nsIDeviceContextSpecXPrint.h \
$(NULL)
CXXFLAGS += $(MOZ_XPRINT_CFLAGS)
GARBAGE += $(X11SHARED_LCPPSRCS) $(XLIB_LCPPSRCS) $(wildcard *.$(OBJ_SUFFIX))
include $(topsrcdir)/config/rules.mk
DEFINES += -DUSE_MOZILLA_TYPES -DUSE_XPRINT
CFLAGS += $(TK_CFLAGS)
CXXFLAGS += $(TK_CFLAGS)
EXTRA_DSO_LDOPTS += \
$(LIBS_DIR) \
-lxlibrgb \
-lxprintutil \
$(EXTRA_DSO_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(MOZ_XPRINT_LDFLAGS) \
$(MOZ_UNICHARUTIL_LIBS) \
$(NULL)
LOCAL_INCLUDES = \
-I../.. \
-I$(srcdir) \
-I$(srcdir)/../xlib \
-I$(srcdir)/../x11shared \
-I$(srcdir)/.. \
$(NULL)
export:: $(addprefix $(srcdir)/../x11shared/,$(X11SHARED_LCPPSRCS)) $(addprefix $(srcdir)/../xlib/,$(XLIB_LCPPSRCS))
$(INSTALL) $^ .

View File

@ -1,401 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
* Bradley Baetz <bbaetz@cs.mcgill.ca>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG 1 /* Allow logging in the release build */
#endif /* MOZ_LOGGING */
#include "prlog.h"
#include "nsDeviceContextXP.h"
#include "nsRenderingContextXp.h"
#include "nsFontMetricsXlib.h"
#include "nsIDeviceContext.h"
#include "nsIDeviceContextSpecXPrint.h"
#include "nspr.h"
#include "nsXPrintContext.h"
#ifdef PR_LOGGING
static PRLogModuleInfo *nsDeviceContextXpLM = PR_NewLogModule("nsDeviceContextXp");
#endif /* PR_LOGGING */
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
*/
nsDeviceContextXp :: nsDeviceContextXp()
: nsDeviceContextX(),
mPrintContext(nsnull),
mSpec(nsnull),
mParentDeviceContext(nsnull),
mFontMetricsContext(nsnull),
mRCContext(nsnull)
{
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
* @update 12/21/98 dwc
*/
nsDeviceContextXp :: ~nsDeviceContextXp()
{
DestroyXPContext();
}
NS_IMETHODIMP
nsDeviceContextXp::SetSpec(nsIDeviceContextSpec* aSpec)
{
nsresult rv = NS_ERROR_FAILURE;
PR_LOG(nsDeviceContextXpLM, PR_LOG_DEBUG, ("nsDeviceContextXp::SetSpec()\n"));
nsCOMPtr<nsIDeviceContextSpecXp> xpSpec;
mSpec = aSpec;
if (mPrintContext)
DestroyXPContext(); // we cannot reuse that...
mPrintContext = new nsXPrintContext();
if (!mPrintContext)
return NS_ERROR_OUT_OF_MEMORY;
xpSpec = do_QueryInterface(mSpec, &rv);
if (NS_SUCCEEDED(rv)) {
rv = mPrintContext->Init(this, xpSpec);
if (NS_FAILED(rv)) {
DestroyXPContext();
}
}
return rv;
}
NS_IMPL_ISUPPORTS_INHERITED1(nsDeviceContextXp,
DeviceContextImpl,
nsIDeviceContextXp)
/** ---------------------------------------------------
* See documentation in nsDeviceContextXp.h
*
* This method is called after SetSpec
*/
NS_IMETHODIMP
nsDeviceContextXp::InitDeviceContextXP(nsIDeviceContext *aCreatingDeviceContext,nsIDeviceContext *aParentContext)
{
nsresult rv;
// Initialization moved to SetSpec to be done after creating the Print Context
float origscale, newscale;
float t2d, a2d;
int print_x_resolution,
print_y_resolution;
mPrintContext->GetPrintResolution(print_x_resolution, print_y_resolution);
if (print_x_resolution != print_y_resolution) {
PR_LOG(nsDeviceContextXpLM, PR_LOG_DEBUG, ("print_x_resolution != print_y_resolution not yet supported by Mozilla's layout engine\n"));
return NS_ERROR_NOT_IMPLEMENTED; /* this error code should be more detailed */
}
mPixelsToTwips = (float)NSIntPointsToTwips(72) / (float)print_x_resolution;
mTwipsToPixels = 1.0f / mPixelsToTwips;
newscale = TwipsToDevUnits();
origscale = aParentContext->TwipsToDevUnits();
mCPixelScale = newscale / origscale;
t2d = aParentContext->TwipsToDevUnits();
a2d = aParentContext->AppUnitsToDevUnits();
mAppUnitsToDevUnits = (a2d / t2d) * mTwipsToPixels;
mDevUnitsToAppUnits = 1.0f / mAppUnitsToDevUnits;
NS_ASSERTION(aParentContext, "aCreatingDeviceContext cannot be NULL!!!");
mParentDeviceContext = aParentContext;
/* be sure we've cleaned-up old rubbish - new values will re-populate nsFontMetricsXlib soon... */
DeleteRenderingContextXlibContext(mRCContext);
DeleteFontMetricsXlibContext(mFontMetricsContext);
mRCContext = nsnull;
mFontMetricsContext = nsnull;
rv = CreateFontMetricsXlibContext(this, PR_TRUE, &mFontMetricsContext);
if (NS_FAILED(rv))
return rv;
rv = CreateRenderingContextXlibContext(this, &mRCContext);
if (NS_FAILED(rv))
return rv;
return NS_OK;
}
/** ---------------------------------------------------
*/
NS_IMETHODIMP nsDeviceContextXp :: CreateRenderingContext(nsIRenderingContext *&aContext)
{
nsresult rv;
aContext = nsnull;
NS_ENSURE_TRUE(mPrintContext != nsnull, NS_ERROR_NULL_POINTER);
nsCOMPtr<nsRenderingContextXp> renderingContext = new nsRenderingContextXp();
if (!renderingContext)
return NS_ERROR_OUT_OF_MEMORY;
rv = renderingContext->Init(this);
if (NS_SUCCEEDED(rv)) {
aContext = renderingContext;
NS_ADDREF(aContext);
}
return rv;
}
NS_IMETHODIMP nsDeviceContextXp::CreateRenderingContextInstance(nsIRenderingContext *&aContext)
{
nsCOMPtr<nsIRenderingContext> renderingContext = new nsRenderingContextXp();
if (!renderingContext)
return NS_ERROR_OUT_OF_MEMORY;
aContext = renderingContext;
NS_ADDREF(aContext);
return NS_OK;
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
*/
NS_IMETHODIMP nsDeviceContextXp :: SupportsNativeWidgets(PRBool &aSupportsWidgets)
{
aSupportsWidgets = PR_FALSE;
return NS_OK;
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
* @update 12/21/98 dwc
*/
NS_IMETHODIMP nsDeviceContextXp :: CheckFontExistence(const nsString& aFontName)
{
return nsFontMetricsXlib::FamilyExists(mFontMetricsContext, aFontName);
}
NS_IMETHODIMP nsDeviceContextXp :: GetSystemFont(nsSystemFontID aID,
nsFont *aFont) const
{
if (mParentDeviceContext != nsnull) {
return mParentDeviceContext->GetSystemFont(aID, aFont);
}
return NS_ERROR_FAILURE;
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
*/
NS_IMETHODIMP nsDeviceContextXp::GetDeviceSurfaceDimensions(PRInt32 &aWidth,
PRInt32 &aHeight)
{
NS_ENSURE_TRUE(mPrintContext != nsnull, NS_ERROR_NULL_POINTER);
float width, height;
width = (float) mPrintContext->GetWidth();
height = (float) mPrintContext->GetHeight();
aWidth = NSToIntRound(width * mDevUnitsToAppUnits);
aHeight = NSToIntRound(height * mDevUnitsToAppUnits);
return NS_OK;
}
NS_IMETHODIMP nsDeviceContextXp::GetRect(nsRect &aRect)
{
NS_ENSURE_TRUE(mPrintContext != nsnull, NS_ERROR_NULL_POINTER);
PRInt32 width, height;
nsresult rv;
rv = GetDeviceSurfaceDimensions(width, height);
aRect.x = 0;
aRect.y = 0;
aRect.width = width;
aRect.height = height;
return rv;
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
*/
NS_IMETHODIMP nsDeviceContextXp::GetClientRect(nsRect &aRect)
{
return GetRect(aRect);
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
*/
NS_IMETHODIMP nsDeviceContextXp::GetDeviceContextFor(nsIDeviceContextSpec *aDevice, nsIDeviceContext *&aContext)
{
aContext = nsnull;
return NS_OK;
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
*/
NS_IMETHODIMP nsDeviceContextXp::BeginDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage)
{
PR_LOG(nsDeviceContextXpLM, PR_LOG_DEBUG, ("nsDeviceContextXp::BeginDocument()\n"));
NS_ENSURE_TRUE(mPrintContext != nsnull, NS_ERROR_NULL_POINTER);
return mPrintContext->BeginDocument(aTitle, aPrintToFileName, aStartPage, aEndPage);
}
void nsDeviceContextXp::DestroyXPContext()
{
PR_LOG(nsDeviceContextXpLM, PR_LOG_DEBUG, ("nsDeviceContextXp::DestroyXPContext()\n"));
if (!mPrintContext)
return;
/* gisburn: mPrintContext cannot be reused between to print
* tasks as the destination print server may be a different one
* or the printer used on the same print server has other
* properties (build-in fonts for example ) than the printer
* previously used. */
FlushFontCache();
DeleteRenderingContextXlibContext(mRCContext);
DeleteFontMetricsXlibContext(mFontMetricsContext);
mRCContext = nsnull;
mFontMetricsContext = nsnull;
mPrintContext = nsnull; // nsCOMPtr will call |delete mPrintContext;|
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
*/
NS_IMETHODIMP nsDeviceContextXp::EndDocument(void)
{
PR_LOG(nsDeviceContextXpLM, PR_LOG_DEBUG, ("nsDeviceContextXp::EndDocument()\n"));
NS_ENSURE_TRUE(mPrintContext != nsnull, NS_ERROR_NULL_POINTER);
nsresult rv = mPrintContext->EndDocument();
DestroyXPContext();
return rv;
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
*/
NS_IMETHODIMP nsDeviceContextXp::AbortDocument(void)
{
PR_LOG(nsDeviceContextXpLM, PR_LOG_DEBUG, ("nsDeviceContextXp::AbortDocument()\n"));
NS_ENSURE_TRUE(mPrintContext != nsnull, NS_ERROR_NULL_POINTER);
nsresult rv = mPrintContext->AbortDocument();
DestroyXPContext();
return rv;
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
*/
NS_IMETHODIMP nsDeviceContextXp::BeginPage(void)
{
NS_ENSURE_TRUE(mPrintContext != nsnull, NS_ERROR_NULL_POINTER);
return mPrintContext->BeginPage();
}
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
* @update 12/21/98 dwc
*/
NS_IMETHODIMP nsDeviceContextXp::EndPage(void)
{
NS_ENSURE_TRUE(mPrintContext != nsnull, NS_ERROR_NULL_POINTER);
return mPrintContext->EndPage();
}
NS_IMETHODIMP
nsDeviceContextXp::GetPrintContext(nsXPrintContext*& aContext)
{
aContext = mPrintContext;
return NS_OK;
}
class nsFontCacheXp : public nsFontCache
{
public:
/* override DeviceContextImpl::CreateFontCache() */
virtual nsresult CreateFontMetricsInstance(nsIFontMetrics** aResult);
};
nsresult nsFontCacheXp::CreateFontMetricsInstance(nsIFontMetrics** aResult)
{
NS_PRECONDITION(aResult, "null out param");
nsIFontMetrics *fm = new nsFontMetricsXlib();
if (!fm)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(fm);
*aResult = fm;
return NS_OK;
}
/* override DeviceContextImpl::CreateFontCache() */
NS_IMETHODIMP nsDeviceContextXp::CreateFontCache()
{
mFontCache = new nsFontCacheXp();
if (nsnull == mFontCache) {
return NS_ERROR_OUT_OF_MEMORY;
}
return mFontCache->Init(this);
}

View File

@ -1,115 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsDeviceContextXp_h___
#define nsDeviceContextXp_h___
#include "nsDeviceContextX.h"
#include "nsRenderingContextXp.h"
#include "nsIDeviceContextXPrint.h"
#include "nsXPrintContext.h"
class nsDeviceContextXp : public nsDeviceContextX,
public nsIDeviceContextXp
{
public:
nsDeviceContextXp();
NS_DECL_ISUPPORTS_INHERITED
/**
* This method does nothing since a postscript devicecontext will never be created
* with a NativeWidget.
* @update 12/21/98 dwc
*/
NS_IMETHOD InitDeviceContextXP(nsIDeviceContext *aCreatingDeviceContext,nsIDeviceContext *aPrinterContext);
NS_IMETHOD CreateRenderingContext(nsIRenderingContext *&aContext);
NS_IMETHOD CreateRenderingContext(nsIView *aView, nsIRenderingContext *&aContext) {return (DeviceContextImpl::CreateRenderingContext(aView,aContext));}
NS_IMETHOD CreateRenderingContext(nsIWidget *aWidget, nsIRenderingContext *&aContext) {return (DeviceContextImpl::CreateRenderingContext(aWidget,aContext));}
#ifdef NOT_NOW
/* Xprint API supports offscreen surfaces but Mozilla does not make use of
* them, see bug 124761 ("RFE: Make use of "offpaper" drawing surfaces in
* some printing APIs"))
*/
NS_IMETHOD CreateRenderingContext(nsIDrawingSurface* aSurface, nsIRenderingContext *&aContext) {return (DeviceContextImpl::CreateRenderingContext(aSurface, aContext));}
#else
NS_IMETHOD CreateRenderingContext(nsIDrawingSurface* aSurface, nsIRenderingContext *&aContext) {return NS_ERROR_NOT_IMPLEMENTED;}
#endif /* NOT_NOW */
NS_IMETHOD CreateRenderingContextInstance(nsIRenderingContext *&aContext);
NS_IMETHOD SupportsNativeWidgets(PRBool &aSupportsWidgets);
NS_IMETHOD CheckFontExistence(const nsString& aFontName);
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 GetSystemFont(nsSystemFontID anID, nsFont *aFont) const;
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);
NS_IMETHOD SetSpec(nsIDeviceContextSpec *aSpec);
NS_IMETHOD GetXlibRgbHandle(XlibRgbHandle *&aHandle)
{ return mPrintContext->GetXlibRgbHandle(aHandle); }
XlibRgbHandle *GetXlibRgbHandle() { XlibRgbHandle *h; mPrintContext->GetXlibRgbHandle(h); return h; }
NS_IMETHOD GetDepth(PRUint32 &depth)
{ depth = xxlib_rgb_get_depth(GetXlibRgbHandle()); return NS_OK; }
NS_IMETHOD GetPrintContext(nsXPrintContext*& aContext);
NS_IMETHOD CreateFontCache();
virtual void GetFontMetricsContext(nsFontMetricsXlibContext *&aContext) { aContext = mFontMetricsContext; };
virtual void GetRCContext(nsRenderingContextXlibContext *&aContext) { aContext = mRCContext; };
protected:
virtual ~nsDeviceContextXp();
void DestroyXPContext();
nsCOMPtr<nsXPrintContext> mPrintContext;
nsCOMPtr<nsIDeviceContextSpec> mSpec;
nsCOMPtr<nsIDeviceContext> mParentDeviceContext;
nsFontMetricsXlibContext *mFontMetricsContext;
nsRenderingContextXlibContext *mRCContext;
};
#endif /* !nsDeviceContextXp_h___ */

View File

@ -1,60 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include <stdio.h>
#include "nscore.h"
#include "nsIFactory.h"
#include "nsIGenericFactory.h" // need this for ps code
#include "nsISupports.h"
#include "nsGfxCIID.h"
#include "nsIModule.h"
#include "nsCOMPtr.h"
#include "nsDeviceContextXP.h"
#include "nsGfxXPrintCID.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextXp)
static const nsModuleComponentInfo components[] =
{
{ "GFX Xprint Device Context",
NS_DEVICECONTEXTXP_CID,
"@mozilla.org/gfx/decidecontext/xprint;1",
nsDeviceContextXpConstructor }
};
NS_IMPL_NSGETMODULE(nsGfxXprintModule, components)

View File

@ -1,47 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsGfxFactoryXp_h__
#define nsGfxFactoryXp_h__
/* {4c2bb896-13c9-11d3-9304-006008948010} */
#define NS_DEVICECONTEXTXP_CID \
{0x4c2bb896, 0x13c9, 0x11d3, \
{0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}}
#endif

View File

@ -1,200 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
* Julien Lafon <julien.lafon@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsIDeviceContextSpecXP_h___
#define nsIDeviceContextSpecXP_h___
#include "nsISupports.h"
/* UUID=12ab7845-a341-41ba-bc12-6025e0b11e0e */
#define NS_IDEVICE_CONTEXT_SPEC_XP_IID { 0x12ab7845, 0xa341, 0x41ba, { 0x60, 0x25, 0xe0, 0xb1, 0x1e, 0x0e } }
class nsIDeviceContextSpecXp : public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDEVICE_CONTEXT_SPEC_XP_IID)
/*
* If PR_TRUE, print to printer
* @update
* @param aToPrinter --
* @return
**/
NS_IMETHOD GetToPrinter( PRBool &aToPrinter ) = 0;
/*
* If PR_TRUE, first page first
* @update
* @param aFpf --
* @return
**/
NS_IMETHOD GetFirstPageFirst ( PRBool &aFpf ) = 0;
/*
* If PR_TRUE, print grayscale
* @update
* @param aGrayscale --
* @return
**/
NS_IMETHOD GetGrayscale( PRBool &aGrayscale ) = 0;
/*
* Top margin
* @update
* @param aValue --
* @return
**/
NS_IMETHOD GetTopMargin ( float &aValue ) = 0;
/*
* Bottom margin
* @update
* @param aValue --
* @return
**/
NS_IMETHOD GetBottomMargin ( float &aValue ) = 0;
/*
* Left margin
* @update
* @param aValue --
* @return
**/
NS_IMETHOD GetLeftMargin ( float &aValue ) = 0;
/*
* Right margin
* @update
* @param aValue --
* @return
**/
NS_IMETHOD GetRightMargin ( float &aValue ) = 0;
/*
* Printer name e.g., myprinter or myprinter@myxprt:5
* @update
* @param aPrinter --
* @return
**/
NS_IMETHOD GetPrinterName ( const char **aPrinter ) = 0;
/*
* If PR_TRUE, user chose Landscape
* @update
* @param aLandscape
* @return
**/
NS_IMETHOD GetLandscape ( PRBool &aLandscape ) = 0;
/*
* If toPrinter = PR_FALSE, dest file
* @update
* @param aPath --
* @return
**/
NS_IMETHOD GetPath ( const char **aPath ) = 0;
/*
* If PR_TRUE, user cancelled
* @update
* @param aCancel --
* @return
**/
NS_IMETHOD GetUserCancelled( PRBool &aCancel ) = 0;
/*
* Paper name e.g., "din-a4" or "manual/din-a4"
* @update
* @param aPaperName --
* @return
**/
NS_IMETHOD GetPaperName ( const char **aPaperName ) = 0;
/*
* Plex name e.g., "simplex", "duplex", "tumble" or any
* driver/printer-specific custom value
* @update
* @param aPlexName --
* @return
**/
NS_IMETHOD GetPlexName ( const char **aPlexName ) = 0;
/*
* Resolution/quality name e.g., "600", "600x300", "high-res",
* "med-res"
* driver/printer-specific custom value
* @update
* @param aResolutionName --
* @return
**/
NS_IMETHOD GetResolutionName ( const char **aResolutionName ) = 0;
/*
* Colorspace name e.g., "TrueColor", "Grayscale/10bit", "b/w",
* "CYMK"
* driver/printer-specific custom value
* @update
* @param aColorspace --
* @return
**/
NS_IMETHOD GetColorspace ( const char **aColorspace ) = 0;
/*
* If PR_TRUE, enable font download to printer
* @update
* @param aDownloadFonts --
* @return
**/
NS_IMETHOD GetDownloadFonts( PRBool &aDownloadFonts ) = 0;
/*
* Return number of copies to print
* @update
* @param aCopies
* @return
**/
NS_IMETHOD GetCopies ( int &aCopies ) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDeviceContextSpecXp,
NS_IDEVICE_CONTEXT_SPEC_XP_IID)
#endif /* !nsIDeviceContextSpecXP_h___ */

View File

@ -1,66 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.h"
#ifndef __nsIDeviceContextXp_h
#define __nsIDeviceContextXp_h
/* {35efd8b6-13cc-11d3-9d3a-006008948010} */
#define NS_IDEVICECONTEXTXP_IID \
{0x35efd8b6, 0x13cc, 0x11d3, \
{0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}}
class nsXPrintContext;
class nsIDeviceContextXp : public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDEVICECONTEXTXP_IID)
NS_IMETHOD SetSpec(nsIDeviceContextSpec *aSpec) = 0;
NS_IMETHOD InitDeviceContextXP(nsIDeviceContext *aCreatingDeviceContext,
nsIDeviceContext *aPrinterContext) = 0;
NS_IMETHOD GetPrintContext(nsXPrintContext*& aContext) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDeviceContextXp, NS_IDEVICECONTEXTXP_IID)
#endif /* !__nsIDeviceContextXp_h */

View File

@ -1,316 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
* Julien Lafon <julien.lafon@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsRenderingContextXp.h"
#include "nsFontMetricsXlib.h"
#include "nsDeviceContextXP.h"
#include "nsCompressedCharMap.h"
#include "xlibrgb.h"
#include "prprf.h"
#include "prmem.h"
#include "prlog.h"
#include "nsGCCache.h"
#include "imgIContainer.h"
#include "gfxIImageFrame.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsLocalFile.h"
#include <sys/mman.h>
#include <errno.h>
#ifdef PR_LOGGING
static PRLogModuleInfo *RenderingContextXpLM = PR_NewLogModule("RenderingContextXp");
#endif /* PR_LOGGING */
nsRenderingContextXp::nsRenderingContextXp()
: nsRenderingContextXlib(),
mPrintContext(nsnull)
{
}
nsRenderingContextXp::~nsRenderingContextXp()
{
}
NS_IMETHODIMP
nsRenderingContextXp::Init(nsIDeviceContext* aContext)
{
PR_LOG(RenderingContextXpLM, PR_LOG_DEBUG, ("nsRenderingContextXp::Init(nsIDeviceContext *)\n"));
NS_ENSURE_TRUE(nsnull != aContext, NS_ERROR_NULL_POINTER);
mContext = aContext;
if (mContext) {
nsIDeviceContext *dc = mContext;
NS_STATIC_CAST(nsDeviceContextXp *,dc)->GetPrintContext(mPrintContext);
}
NS_ENSURE_TRUE(nsnull != mPrintContext, NS_ERROR_NULL_POINTER);
mPrintContext->GetXlibRgbHandle(mXlibRgbHandle);
mDisplay = xxlib_rgb_get_display(mXlibRgbHandle);
/* A printer usually does not support things like multiple drawing surfaces
* (nor "offscreen" drawing surfaces... would be quite difficult to
* implement) - however the Xprint API supports offscreen surfaces for
* all DDX implementations.
*/
mOffscreenSurface = mSurface = mPrintContext;
UpdateGC(); /* Fill |mGC| */
mPrintContext->SetGC(mGC);
return CommonInit();
}
NS_IMETHODIMP nsRenderingContextXp::Init(nsIDeviceContext* aContext, nsIWidget *aWidget)
{
PR_LOG(RenderingContextXpLM, PR_LOG_DEBUG, ("nsRenderingContextXp::Init(nsIDeviceContext* aContext, nsIWidget *aWidget)\n"));
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsRenderingContextXp::Init(nsIDeviceContext* aContext, nsIDrawingSurface* aSurface)
{
PR_LOG(RenderingContextXpLM, PR_LOG_DEBUG, ("nsRenderingContextXp::Init(nsIDeviceContext* aContext, nsIDrawingSurface* aSurface)\n"));
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsRenderingContextXp::LockDrawingSurface(PRInt32 aX, PRInt32 aY,
PRUint32 aWidth, PRUint32 aHeight,
void **aBits,
PRInt32 *aStride,
PRInt32 *aWidthBytes,
PRUint32 aFlags)
{
PR_LOG(RenderingContextXpLM, PR_LOG_DEBUG, ("nsRenderingContextXp::LockDrawingSurface()\n"));
PushState();
return NS_OK;
}
NS_IMETHODIMP
nsRenderingContextXp::UnlockDrawingSurface(void)
{
PR_LOG(RenderingContextXpLM, PR_LOG_DEBUG, ("nsRenderingContextXp::UnlockDrawingSurface()\n"));
PopState();
return NS_OK;
}
NS_IMETHODIMP nsRenderingContextXp::DrawImage(imgIContainer *aImage, const nsRect & aSrcRect, const nsRect & aDestRect)
{
PR_LOG(RenderingContextXpLM, PR_LOG_DEBUG, ("nsRenderingContextXp::DrawImage()\n"));
nsRect dr = aDestRect;
mTranMatrix->TransformCoord(&dr.x, &dr.y, &dr.width, &dr.height);
nsCOMPtr<gfxIImageFrame> iframe;
aImage->GetCurrentFrame(getter_AddRefs(iframe));
if (!iframe)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIImage> img(do_GetInterface(iframe));
if (!img)
return NS_ERROR_FAILURE;
// doesn't it seem like we should use more of the params here?
// img->Draw(*this, surface, sr.x, sr.y, sr.width, sr.height, dr.x, dr.y, dr.width, dr.height);
nsRect sr = aSrcRect;
mTranMatrix->TransformCoord(&sr.x, &sr.y, &sr.width, &sr.height);
sr.x = aSrcRect.x;
sr.y = aSrcRect.y;
mTranMatrix->TransformNoXLateCoord(&sr.x, &sr.y);
UpdateGC();
return mPrintContext->DrawImage(mSurface->GetDrawable(),
mGC, img,
sr.x, sr.y,
sr.width, sr.height,
dr.x, dr.y,
dr.width, dr.height);
}
#ifdef JULIEN_NOTNOW
static
void TilePixmap(Display *dpy, Pixmap src, Pixmap dest, PRInt32 aSXOffset,
PRInt32 aSYOffset, const nsRect &destRect,
const nsRect &clipRect, PRBool useClip)
{
GC gc;
XGCValues values;
unsigned long valuesMask;
memset(&values, 0, sizeof(XGCValues));
values.fill_style = FillTiled;
values.tile = src;
values.ts_x_origin = destRect.x - aSXOffset;
values.ts_y_origin = destRect.y - aSYOffset;
valuesMask = GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle;
gc = XCreateGC(dpy, src, valuesMask, &values);
if (useClip) {
XRectangle xrectangle;
xrectangle.x = clipRect.x;
xrectangle.y = clipRect.y;
xrectangle.width = clipRect.width;
xrectangle.height = clipRect.height;
XSetClipRectangles(dpy, gc, 0, 0, &xrectangle, 1, Unsorted);
}
XFillRectangle(dpy, dest, gc, destRect.x, destRect.y,
destRect.width, destRect.height);
XFreeGC(dpy, gc);
}
#endif /* JULIEN_NOTNOW */
NS_IMETHODIMP
nsRenderingContextXp::DrawTile(imgIContainer *aImage,
nscoord aSXOffset,
nscoord aSYOffset,
const nsRect *aTileRect)
{
PR_LOG(RenderingContextXpLM, PR_LOG_DEBUG,
("nsRenderingContextXp::DrawTile(imgIContainer *aImage, nscoord aXImageStart, nscoord aYImageStart, const nsRect *aTargetRect)\n"));
/* xxx_julien: Either this code or the PDF DDX needs a fix */
#ifdef JULIEN_NOTNOW
nsCOMPtr<gfxIImageFrame> iframe;
aImage->GetCurrentFrame(getter_AddRefs(iframe));
if (!iframe)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIImage> img(do_GetInterface(iframe));
if (!img)
return NS_ERROR_FAILURE;
PushState();
nscoord imgwidth, imgheight;
aImage->GetWidth(&imgwidth);
aImage->GetHeight(&imgheight);
imgwidth = NSToCoordRound(imgwidth*mP2T);
imgheight = NSToCoordRound(imgheight*mP2T);
Drawable srcdrawable;
Drawable destdrawable;
mSurface->GetDrawable(destdrawable);
UpdateGC();
srcdrawable = XCreatePixmap(mDisplay, destdrawable,
imgwidth, imgheight,
xxlib_rgb_get_depth(mXlibRgbHandle));
XGCValues values;
unsigned long valuesMask = 0;
nsRenderingContextXlibContext *rcContext;
nsIDeviceContext *dc = mContext;
NS_STATIC_CAST(nsDeviceContextX *, dc)->GetRCContext(rcContext);
xGC *xgc = rcContext->mGcCache.GetGC(mDisplay, srcdrawable, valuesMask, &values, NULL);
mPrintContext->DrawImage(srcdrawable,
xgc, img,
0, 0,
img->GetWidth(), img->GetHeight(),
0, 0,
imgwidth, imgheight);
/* Xlib API can tile for us */
nsRect clipRect;
PRBool isValid;
GetClipRect(clipRect, isValid);
TilePixmap(mDisplay, srcdrawable, destdrawable, aSXOffset, aSYOffset,
*aTileRect, clipRect, PR_FALSE);
xgc->Release();
XFreePixmap(mDisplay, srcdrawable);
PopState();
#endif /* JULIEN_NOTNOW */
return NS_OK;
}
NS_IMETHODIMP
nsRenderingContextXp::RenderEPS(const nsRect& aRect, FILE *aDataFile)
{
nsresult rv;
int fd;
const unsigned char *data;
size_t datalen;
PR_LOG(RenderingContextXpLM, PR_LOG_DEBUG, ("nsRenderingContextXp::RenderPostScriptDataFragment()\n"));
/* Get file size */
fseek(aDataFile, 0, SEEK_END);
datalen = ftell(aDataFile);
PR_LOG(RenderingContextXpLM, PR_LOG_DEBUG, ("file size=%ld\n", (long)datalen));
/* Safeguard against bogus values
* (make sure we clamp the size to a reasonable value (say... 128 MB)) */
if (datalen <= 0 || datalen > (128 * 1024 * 1024)) {
PR_LOG(RenderingContextXpLM, PR_LOG_DEBUG, ("error: file size %ld too large\n", (long)datalen));
return NS_ERROR_FAILURE;
}
fflush(aDataFile);
fd = fileno(aDataFile);
PR_LOG(RenderingContextXpLM, PR_LOG_DEBUG, ("fileno=%d\n", fd));
data = (const unsigned char *)mmap(0, datalen, PROT_READ, MAP_SHARED, fd, 0);
if (MAP_FAILED == data) {
int saved_errno = errno;
PR_LOG(RenderingContextXpLM, PR_LOG_DEBUG, ("mmap() failure, errno=%s/%d\n",
strerror(saved_errno), saved_errno));
return nsresultForErrno(saved_errno);
}
PushState();
nsRect trect = aRect;
mTranMatrix->TransformCoord(&trect.x, &trect.y, &trect.width, &trect.height);
UpdateGC();
rv = mPrintContext->RenderEPS(mSurface->GetDrawable(), trect, data, datalen);
PopState();
munmap((char *)data, datalen);
return rv;
}

View File

@ -1,77 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsRenderingContextXp_h___
#define nsRenderingContextXp_h___ 1
#include "nsXPrintContext.h"
#include "nsRenderingContextXlib.h"
/* Rendering context class to match the special needs of Xprint (X11 print
* system). Nearly identical to nsRenderingContextXlib - except two details:
* - "offscreen" drawing surfaces are not supported by printers, therefore
* we "disable" those functions here by overriding them with empty versions.
* - images are handeled by nsXPrintContext class instead of nsImageXlib
*/
class nsRenderingContextXp : public nsRenderingContextXlib
{
public:
nsRenderingContextXp();
virtual ~nsRenderingContextXp();
NS_IMETHOD Init(nsIDeviceContext* aContext);
NS_IMETHOD Init(nsIDeviceContext* aContext, nsIWidget *aWindow);
NS_IMETHOD Init(nsIDeviceContext* aContext, nsIDrawingSurface* aSurface);
NS_IMETHOD LockDrawingSurface(PRInt32 aX, PRInt32 aY, PRUint32 aWidth, PRUint32 aHeight,
void **aBits, PRInt32 *aStride, PRInt32 *aWidthBytes,
PRUint32 aFlags);
NS_IMETHOD UnlockDrawingSurface(void);
NS_IMETHOD DrawImage(imgIContainer *aImage, const nsRect & aSrcRect, const nsRect & aDestRect);
NS_IMETHOD DrawTile(imgIContainer *aImage, nscoord aXImageStart, nscoord aYImageStart, const nsRect *aTargetRect);
NS_IMETHOD RenderEPS(const nsRect& aRect, FILE *aDataFile);
protected:
nsXPrintContext *mPrintContext; /* identical to |mRenderingSurface|
* (except the different type)
*/
};
#endif /* !nsRenderingContextXp_h___ */

File diff suppressed because it is too large Load Diff

View File

@ -1,151 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
* Leon Sha <leon.sha@sun.com>
* Julien Lafon <julien.lafon@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _XPCONTEXT_H_
#define _XPCONTEXT_H_
#include <X11/Xlib.h>
#include <X11/extensions/Print.h>
#include "nsColor.h"
#include "nsCoord.h"
#include "nsIImage.h"
#include "nsGCCache.h"
#include "nsIDeviceContextSpecXPrint.h"
#include "nsDrawingSurfaceXlib.h"
#include "xlibrgb.h"
class nsDeviceContextXp;
class nsXPrintContext : public nsIDrawingSurfaceXlib
{
public:
nsXPrintContext();
virtual ~nsXPrintContext();
NS_DECL_ISUPPORTS
NS_IMETHOD Lock(PRInt32 aX, PRInt32 aY, PRUint32 aWidth, PRUint32 aHeight,
void **aBits, PRInt32 *aStride, PRInt32 *aWidthBytes,
PRUint32 aFlags) { return NS_OK; };
NS_IMETHOD Unlock(void) { return NS_OK; };
NS_IMETHOD GetDimensions(PRUint32 *aWidth, PRUint32 *aHeight);
NS_IMETHOD IsOffscreen(PRBool *aOffScreen);
NS_IMETHOD IsPixelAddressable(PRBool *aAddressable);
NS_IMETHOD GetPixelFormat(nsPixelFormat *aFormat);
NS_IMETHOD Init(nsDeviceContextXp *dc, nsIDeviceContextSpecXp *aSpec);
NS_IMETHOD BeginPage();
NS_IMETHOD EndPage();
NS_IMETHOD RenderEPS(Drawable aDrawable, const nsRect& aRect, const unsigned char *aData, unsigned long aDatalen);
NS_IMETHOD BeginDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage);
NS_IMETHOD EndDocument();
NS_IMETHOD AbortDocument();
int GetHeight() { return mHeight; }
int GetWidth() { return mWidth; }
NS_IMETHOD GetDrawable(Drawable &aDrawable) { aDrawable = mDrawable; return NS_OK; }
NS_IMETHOD GetXlibRgbHandle(XlibRgbHandle *&aHandle) { aHandle = mXlibRgbHandle; return NS_OK; }
NS_IMETHOD GetGC(xGC *&aXGC) { mGC->AddRef(); aXGC = mGC; return NS_OK; }
virtual Drawable GetDrawable() { return mDrawable; }
void SetGC(xGC *aGC) { mGC = aGC; mGC->AddRef(); }
NS_IMETHOD GetPrintResolution(int &aXres, int &aYres);
NS_IMETHOD DrawImage(Drawable aDrawable, xGC *gc, nsIImage *aImage,
PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight);
NS_IMETHOD DrawImage(Drawable aDrawable, xGC *gc, nsIImage *aImage,
PRInt32 aX, PRInt32 aY,
PRInt32 aWidth, PRInt32 aHeight);
private:
nsresult DrawImageBitsScaled(Drawable aDrawable,
xGC *gc, nsIImage *aImage,
PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight);
nsresult DrawImageBits(Drawable aDrawable, xGC *gc,
PRUint8 *alphaBits, PRInt32 alphaRowBytes, PRUint8 alphaDepth,
PRUint8 *image_bits, PRInt32 row_bytes,
PRInt32 aX, PRInt32 aY,
PRInt32 aWidth, PRInt32 aHeight);
XlibRgbHandle *mXlibRgbHandle;
Display *mPDisplay;
Screen *mScreen;
Visual *mVisual;
Drawable mDrawable; /* window/paper surface */
nsPixelFormat mPixFormat;
xGC *mGC;
int mXpEventBase, /* XpExtension X event base */
mXpErrorBase; /* XpExtension X error base */
int mDepth;
int mScreenNumber;
int mWidth;
int mHeight;
XPContext mPContext;
PRBool mJobStarted; /* |PR_TRUE| when being between XpStartJob() and XpEndJob() */
PRBool mIsGrayscale; /* color or grayscale ? */
PRBool mIsAPrinter; /* destination: printer or file ? */
const char *mPrintFile; /* file to "print" to */
void *mXpuPrintToFileHandle; /* handle for XpuPrintToFile/XpuWaitForPrintFileChild when printing to file */
long mPrintXResolution,
mPrintYResolution;
nsDeviceContextXp *mContext; /* DeviceContext which created this object */
static PRUint8 ConvertMaskToCount(unsigned long val);
static PRUint8 GetShiftForMask(unsigned long val);
nsresult SetupWindow(int x, int y, int width, int height);
nsresult SetupPrintContext(nsIDeviceContextSpecXp *aSpec);
nsresult SetMediumSize(const char *paper_name);
nsresult SetOrientation(int landscape);
nsresult SetPlexMode(const char *plexname);
nsresult SetResolution(const char *resolution_name);
};
#endif /* !_XPCONTEXT_H_ */

View File

@ -1,6 +0,0 @@
[gecko]
#if SHARED_LIBRARY
dist/bin/components/@SHARED_LIBRARY@
#else
!staticcomp @LIBRARY@ @MODULE_NAME@
#endif

View File

@ -1,63 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = xprintutil
LIBRARY_NAME = xprintutil
FORCE_STATIC_LIB= 1
EXPORT_LIBRARY=1
LIBXUL_LIBRARY = 1
CSRCS = \
xprintutil.c \
xprintutil_printtofile.c
EXPORTS = xprintutil.h
CFLAGS += $(MOZ_XPRINT_CFLAGS)
include $(topsrcdir)/config/rules.mk
DEFINES += -DUSE_MOZILLA_TYPES -DUSE_XPRINT

File diff suppressed because it is too large Load Diff

View File

@ -1,256 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
#ifndef XPRINTUTIL_H
#define XPRINTUTIL_H 1
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the X11 print system utilities library.
*
* The Initial Developer of the Original Code is
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* Force ANSI C prototypes from X11 headers */
#ifndef FUNCPROTO
#define FUNCPROTO 15
#endif /* !FUNCPROTO */
#include <X11/Xlibint.h>
#include <X11/extensions/Print.h>
#include <X11/Intrinsic.h>
/* I don't know how to make this "better" yet... ;-( */
#ifdef USE_MOZILLA_TYPES
#include <prtypes.h>
#include <prmem.h>
#include <prthread.h>
#define XPU_USE_NSPR 1
/*
* Disabled for now - Threaded codepath does not work properly always.
* See bug 134570 ("Print-to-file not working with threaded XprintUtil")
* #define XPU_USE_THREADS 1
*/
#endif /* USE_MOZILLA_TYPES */
#ifdef DEBUG
/* trace function calls */
#define XPU_TRACE(EX) (puts(#EX),EX)
/* trace function calls in child */
#define XPU_TRACE_CHILD(EX) (puts("child: " #EX),EX)
/* execute function EX only in debug mode */
#define XPU_DEBUG_ONLY(EX) (EX)
#else
#define XPU_TRACE(EX) (EX)
#define XPU_TRACE_CHILD(EX) (EX)
#define XPU_DEBUG_ONLY(EX)
#endif /* DEBUG */
/* debug/logging: replace NULLptrs with "<NULL>" string */
#define XPU_NULLXSTR(s) (((s)!=NULL)?(s):("<NULL>"))
/*
* Struct for XpuGetMediumSourceSizeList(), XpuFreeMediumSourceSizeList(),
* XpuSetDocMediumSourceSize(), XpuSetPageMediumSourceSize(),
* XpuFindMediumSourceSizeBy*()
*/
typedef struct {
const char *tray_name;
const char *medium_name;
int mbool;
float ma1;
float ma2;
float ma3;
float ma4;
} XpuMediumSourceSizeRec, *XpuMediumSourceSizeList;
/*
* Struct for XpuGetResolutionList(), XpuFreeResolutionList(),
* XpuGetResolution(), XpuSetPageResolution(), XpuSetDocResolution(),
* XpuFindResolutionByName()
*/
typedef struct {
const char *name;
long x_dpi;
long y_dpi;
} XpuResolutionRec, *XpuResolutionList;
/*
* Struct for XpuGetOrientationList(), XpuFreeOrientationList(),
* XpuFindOrientationBy*(), XpuSetPageResolution(),
* XpuSetDocOrientation()
*/
typedef struct {
const char *orientation;
} XpuOrientationRec, *XpuOrientationList;
/*
* Struct for XpuGetPlexList(), XpuFreePlexList(), XpuFindPlexBy*(),
* XpuSetDocPlex(), XpuSetPagePlex()
*/
typedef struct {
const char *plex;
} XpuPlexRec, *XpuPlexList;
/*
* Struct for XpuGetColorspaceList(), XpuFreeColorspaceList()
*/
typedef struct
{
const char *name;
XVisualInfo visualinfo;
} XpuColorspaceRec, *XpuColorspaceList;
/* XPUATTRIBUTESUPPORTED_*:
* Flags which indicate whether it is allowed to set/change a specific attribute
*/
typedef long XpuSupportedFlags;
/* Job attributes */
#define XPUATTRIBUTESUPPORTED_JOB_NAME (1L<<0)
#define XPUATTRIBUTESUPPORTED_JOB_OWNER (1L<<1)
#define XPUATTRIBUTESUPPORTED_NOTIFICATION_PROFILE (1L<<2)
/* Document/Page attributes */
#define XPUATTRIBUTESUPPORTED_COPY_COUNT (1L<<3)
#define XPUATTRIBUTESUPPORTED_DOCUMENT_FORMAT (1L<<4)
#define XPUATTRIBUTESUPPORTED_CONTENT_ORIENTATION (1L<<5)
#define XPUATTRIBUTESUPPORTED_DEFAULT_PRINTER_RESOLUTION (1L<<6)
#define XPUATTRIBUTESUPPORTED_DEFAULT_INPUT_TRAY (1L<<7)
#define XPUATTRIBUTESUPPORTED_DEFAULT_MEDIUM (1L<<8)
#define XPUATTRIBUTESUPPORTED_PLEX (1L<<9)
#define XPUATTRIBUTESUPPORTED_LISTFONTS_MODES (1L<<10)
/* prototypes */
_XFUNCPROTOBEGIN
int XpuCheckExtension( Display *pdpy );
/* Create/destroy connection to printer */
Bool XpuXprintServersAvailable( void );
int XpuGetPrinter( const char *printername, Display **pdpyptr, XPContext *pcontextptr );
void XpuClosePrinterDisplay(Display *pdpy, XPContext pcontext);
/* Misc. functions */
void XpuSetOneAttribute( Display *pdpy, XPContext pcontext,
XPAttributes type, const char *attribute_name, const char *value, XPAttrReplacement replacement_rule );
void XpuSetOneLongAttribute( Display *pdpy, XPContext pcontext,
XPAttributes type, const char *attribute_name, long value, XPAttrReplacement replacement_rule );
int XpuCheckSupported( Display *pdpy, XPContext pcontext, XPAttributes type, const char *attribute_name, const char *query );
int XpuSetJobTitle( Display *pdpy, XPContext pcontext, const char *title );
int XpuGetOneLongAttribute( Display *pdpy, XPContext pcontext, XPAttributes type, const char *attribute_name, long *result );
#ifdef DEBUG
void dumpXpAttributes( Display *pdpy, XPContext pcontext );
#endif /* DEBUG */
void XpuWaitForPrintNotify( Display *pdpy, int xp_event_base, int detail );
/* Get list of printers */
XPPrinterList XpuGetPrinterList( const char *printer, int *res_list_count );
void XpuFreePrinterList( XPPrinterList list );
/* Set number of document copies */
int XpuSetDocumentCopies( Display *pdpy, XPContext pcontext, long num_copies );
/* Get/Set/Query supported mediums (paper sizes) */
XpuMediumSourceSizeList XpuGetMediumSourceSizeList( Display *pdpy, XPContext pcontext, int *numEntriesPtr );
void XpuFreeMediumSourceSizeList( XpuMediumSourceSizeList list );
int XpuSetDocMediumSourceSize( Display *pdpy, XPContext pcontext, XpuMediumSourceSizeRec *medium_spec );
int XpuSetPageMediumSourceSize( Display *pdpy, XPContext pcontext, XpuMediumSourceSizeRec *medium_spec );
XpuMediumSourceSizeRec *
XpuFindMediumSourceSizeBySize( XpuMediumSourceSizeList mlist, int mlist_count,
float page_width_mm, float page_height_mm, float tolerance );
XpuMediumSourceSizeRec *
XpuFindMediumSourceSizeByBounds( XpuMediumSourceSizeList mlist, int mlist_count,
float m1, float m2, float m3, float m4, float tolerance );
XpuMediumSourceSizeRec *
XpuFindMediumSourceSizeByName( XpuMediumSourceSizeList mlist, int mlist_count,
const char *tray_name, const char *medium_name );
/* Get/Set resolution */
XpuResolutionList XpuGetResolutionList( Display *pdpy, XPContext pcontext, int *numEntriesPtr );
void XpuFreeResolutionList( XpuResolutionList list );
Bool XpuGetResolution( Display *pdpy, XPContext pcontext, long *x_dpi, long *y_dpi );
Bool XpuSetPageResolution( Display *pdpy, XPContext pcontext, XpuResolutionRec * );
Bool XpuSetDocResolution( Display *pdpy, XPContext pcontext, XpuResolutionRec * );
XpuResolutionRec *XpuFindResolutionByName( XpuResolutionList list, int list_count, const char *resolution_name);
/* Get/Set orientation */
XpuOrientationList XpuGetOrientationList( Display *pdpy, XPContext pcontext, int *numEntriesPtr );
void XpuFreeOrientationList( XpuOrientationList list );
XpuOrientationRec *
XpuFindOrientationByName( XpuOrientationList list, int list_count, const char *orientation );
int XpuSetDocOrientation( Display *pdpy, XPContext pcontext, XpuOrientationRec *rec );
int XpuSetPageOrientation( Display *pdpy, XPContext pcontext, XpuOrientationRec *rec );
/* Get/set plex modes */
XpuPlexList XpuGetPlexList( Display *pdpy, XPContext pcontext, int *numEntriesPtr );
void XpuFreePlexList( XpuPlexList list );
XpuPlexRec *XpuFindPlexByName( XpuPlexList list, int list_count, const char *plex );
int XpuSetDocPlex( Display *pdpy, XPContext pcontext, XpuPlexRec *rec );
int XpuSetPagePlex( Display *pdpy, XPContext pcontext, XpuPlexRec *rec );
/* Set/get usage of fonts */
Bool XpuGetEnableFontDownload( Display *pdpy, XPContext pcontext );
int XpuSetEnableFontDownload( Display *pdpy, XPContext pcontext, Bool enableFontDownload );
/* Get per-printer colorspace information */
XpuColorspaceList XpuGetColorspaceList( Display *pdpy, XPContext pcontext, int *numEntriesPtr );
void XpuFreeColorspaceList( XpuColorspaceList list );
XpuColorspaceRec *XpuFindColorspaceByName( XpuColorspaceList list, int list_count, const char *colorspace );
/* Start job to printer (spooler) or file */
void XpuStartJobToSpooler(Display *pdpy);
void *XpuStartJobToFile( Display *pdpy, XPContext pcontext, const char *filename );
XPGetDocStatus XpuWaitForPrintFileChild( void *handle );
/* Get flags which indicate whether it is allowed to set/change a specific attribute */
XpuSupportedFlags XpuGetSupportedJobAttributes(Display *pdpy, XPContext pcontext);
XpuSupportedFlags XpuGetSupportedDocAttributes(Display *pdpy, XPContext pcontext);
XpuSupportedFlags XpuGetSupportedPageAttributes(Display *pdpy, XPContext pcontext);
/* Encode/decode resource strings */
char *XpuResourceEncode( const char *str );
char *XpuResourceDecode( const char *str );
void XpuResourceFreeString( char *s );
/* COMPOUND_TEXT <----> local encoding string converters */
const char *XpuXmbToCompoundText(Display *dpy, const char *xmbtext);
void XpuFreeCompundTextString( const char *s );
const char *XpuCompoundTextToXmb(Display *dpy, const char *ct);
void XpuFreeXmbString( const char *s );
_XFUNCPROTOEND
#define XpuGetJobAttributes( pdpy, pcontext ) XpGetAttributes( (pdpy), (pcontext), XPJobAttr )
#define XpuGetDocAttributes( pdpy, pcontext ) XpGetAttributes( (pdpy), (pcontext), XPDocAttr )
#define XpuGetPageAttributes( pdpy, pcontext ) XpGetAttributes( (pdpy), (pcontext), XPPageAttr )
#define XpuGetPrinterAttributes( pdpy, pcontext ) XpGetAttributes( (pdpy), (pcontext), XPPrinterAttr )
#define XpuGetServerAttributes( pdpy, pcontext ) XpGetAttributes( (pdpy), (pcontext), XPServerAttr )
#endif /* !XPRINTUTIL_H */
/* EOF. */

View File

@ -1,505 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the X11 print system utilities library.
*
* The Initial Developer of the Original Code is
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "xprintutil.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <limits.h>
#include <errno.h>
#ifdef XPU_USE_THREADS
#include <time.h>
#ifdef XPU_USE_NSPR
#include <prthread.h>
#else
#include <pthread.h>
#endif /* XPU_USE_NSPR */
#endif /* XPU_USE_THREADS */
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
/* local prototypes */
#ifdef DEBUG
static void PrintXPGetDocStatus( XPGetDocStatus status );
#endif
static Bool XNextEventTimeout( Display *display, XEvent *event_return, struct timeval *timeout );
static void *XpuPrintToFile( Display *pdpy, XPContext pcontext, const char *filename );
static void MyPrintToFileProc( Display *pdpy, XPContext pcontext, unsigned char *data, unsigned int data_len, XPointer client_data );
static void MyFinishProc( Display *pdpy, XPContext pcontext, XPGetDocStatus status, XPointer client_data );
#ifdef XPU_USE_NSPR
static void PrintToFile_Consumer( void *handle );
#else
static void *PrintToFile_Consumer( void *handle );
#endif
void XpuStartJobToSpooler(Display *pdpy)
{
XpStartJob(pdpy, XPSpool);
}
void *XpuStartJobToFile( Display *pdpy, XPContext pcontext, const char *filename )
{
void *handle;
XpStartJob(pdpy, XPGetData);
handle = XpuPrintToFile(pdpy, pcontext, filename);
if (!handle)
{
/* Cancel the print job and discard all events... */
XpCancelJob(pdpy, True);
}
return(handle);
}
#ifdef DEBUG
/* DEBUG: Print XPGetDocStatus */
static
void PrintXPGetDocStatus( XPGetDocStatus status )
{
switch(status)
{
case XPGetDocFinished: puts("PrintXPGetDocStatus: XPGetDocFinished"); break;
case XPGetDocSecondConsumer: puts("PrintXPGetDocStatus: XPGetDocSecondConsumer"); break;
case XPGetDocError: puts("PrintXPGetDocStatus: XPGetDocError"); break;
default: puts("PrintXPGetDocStatus: <unknown value"); break;
}
}
#endif /* DEBUG */
/* XNextEvent() with timeout */
static
Bool XNextEventTimeout( Display *display, XEvent *event_return, struct timeval *timeout )
{
int res;
fd_set readfds;
int display_fd = XConnectionNumber(display);
/* small shortcut... */
if( timeout == NULL )
{
XNextEvent(display, event_return);
return(True);
}
FD_ZERO(&readfds);
FD_SET(display_fd, &readfds);
/* Note/bug: In the case of internal X events (like used to trigger callbacks
* registered by XpGetDocumentData()&co.) select() will return with "new info"
* - but XNextEvent() below processes these _internal_ events silently - and
* will block if there are no other non-internal events.
* The workaround here is to check with XEventsQueued() if there are non-internal
* events queued - if not select() will be called again - unfortunately we use
* the old timeout here instead of the "remaining" time... (this only would hurt
* if the timeout would be really long - but for current use with values below
* 1/2 secs it does not hurt... =:-)
*/
while( XEventsQueued(display, QueuedAfterFlush) == 0 )
{
res = select(display_fd+1, &readfds, NULL, NULL, timeout);
switch(res)
{
case -1: /* select() error - should not happen */
perror("XNextEventTimeout: select() failure");
return(False);
case 0: /* timeout */
return(False);
}
}
XNextEvent(display, event_return);
return(True);
}
#ifdef XPU_USE_THREADS
/**
** XpuPrintToFile() - threaded version
** Create consumer thread which creates it's own display connection to print server
** (a 2nd display connection/thread is required to avoid deadlocks within Xlib),
** registers (Xlib-internal) consumer callback (via XpGetDocumentData(3Xp)) and
** processes/eats all incoming events via MyPrintToFileProc(). A final call to
** MyPrintToFileProc() cleans-up all stuff and sets the "done" flag.
** Note that these callbacks are called directly by Xlib while waiting for events in
** XNextEvent() because XpGetDocumentData() registeres them as "internal" callbacks,
** e.g. XNextEvent() does _not_ return before/after processing these events !!
**
** Usage:
** XpStartJob(pdpy, XPGetData);
** handle = XpuPrintToFile(pdpy, pcontext, "myfile");
** // render something
** XpEndJob(); // or XpCancelJob()
** status = XpuWaitForPrintFileChild(handle);
**
*/
typedef struct
{
#ifdef XPU_USE_NSPR
PRThread *prthread;
#else
pthread_t tid;
#endif
char *displayname;
Display *pdpy;
Display *parent_pdpy;
XPContext pcontext;
const char *file_name;
FILE *file;
XPGetDocStatus status;
Bool done;
} MyPrintFileData;
static
void *XpuPrintToFile( Display *pdpy, XPContext pcontext, const char *filename )
{
MyPrintFileData *mpfd; /* warning: shared between threads !! */
if( (mpfd = malloc(sizeof(MyPrintFileData))) == NULL )
return(NULL);
mpfd->parent_pdpy = pdpy;
mpfd->displayname = XDisplayString(pdpy);
mpfd->pdpy = NULL;
mpfd->pcontext = pcontext;
mpfd->file_name = filename;
mpfd->file = NULL;
mpfd->status = XPGetDocError;
/* make sure we can open the file for writing */
if( (mpfd->file = fopen(mpfd->file_name, "w")) == NULL )
{
/* fopen() error */
free(mpfd);
return(NULL);
}
/* its important to flush before we start the consumer thread,
* to make sure that the XpStartJob gets through first in the parent
*/
XFlush(pdpy);
#ifdef XPU_USE_NSPR
if( (mpfd->prthread = PR_CreateThread(PR_SYSTEM_THREAD, PrintToFile_Consumer, mpfd, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0)) == NULL )
#else
if( pthread_create(&(mpfd->tid), NULL, PrintToFile_Consumer, mpfd) != 0 )
#endif
{
/* pthread_create() error */
fclose(mpfd->file);
free(mpfd);
return(NULL);
}
/* we're still in the parent */
XPU_DEBUG_ONLY(printf("### parent started consumer thread.\n" ));
return(mpfd);
}
XPGetDocStatus XpuWaitForPrintFileChild( void *handle )
{
MyPrintFileData *mpfd = (MyPrintFileData *)handle;
void *res;
XPGetDocStatus status;
/* Flush data a last time to make sure we send all data to Xprt and that
* the Xlib internal hooks have called a last time */
XFlush(mpfd->parent_pdpy);
#ifdef XPU_USE_NSPR
if( PR_JoinThread(mpfd->prthread) != PR_SUCCESS )
perror("XpuWaitForPrintFileChild: PR_JoinThread() failure"); /* fixme(later): use NSPR error handling calls... */
#else
if( XPU_TRACE(pthread_join(mpfd->tid, &res)) != 0 )
perror("XpuWaitForPrintFileChild: pthread_join() failure");
#endif
status = mpfd->status;
free(handle);
XPU_DEBUG_ONLY(PrintXPGetDocStatus(status));
return(status);
}
#else /* XPU_USE_THREADS */
/**
** XpuPrintToFile() - fork() version
** Create consumer thread which creates it's own display connection to print server
** (a 2nd display connection/process is required to avoid deadlocks within Xlib),
** registers (Xlib-internal) consumer callback (via XpGetDocumentData(3Xp)) and
** processes/eats all incoming events via MyPrintToFileProc(). A final call to
** MyPrintToFileProc() cleans-up all stuff and sets the "done" flag.
** Note that these callbacks are called directly by Xlib while waiting for events in
** XNextEvent() because XpGetDocumentData() registeres them as "internal" callbacks,
** e.g. XNextEvent() does _not_ return before/after processing these events !!
**
** Usage:
** XpStartJob(pdpy, XPGetData);
** handle = XpuPrintToFile(pdpy, pcontext, "myfile");
** // render something
** XpEndJob(); // or XpCancelJob()
** status = XpuWaitForPrintFileChild(handle);
**
*/
typedef struct
{
pid_t pid;
int pipe[2]; /* child-->parent communication pipe */
const char *displayname;
Display *pdpy;
Display *parent_pdpy;
XPContext pcontext;
const char *file_name;
FILE *file;
XPGetDocStatus status;
Bool done;
} MyPrintFileData;
static
void *XpuPrintToFile( Display *pdpy, XPContext pcontext, const char *filename )
{
MyPrintFileData *mpfd;
if( (mpfd = (MyPrintFileData *)malloc(sizeof(MyPrintFileData))) == NULL )
return(NULL);
/* create pipe */
if( pipe(mpfd->pipe) == -1 )
{
/* this should never happen, but... */
perror("XpuPrintToFile: cannot create pipe");
free(mpfd);
return(NULL);
}
mpfd->parent_pdpy = pdpy;
mpfd->displayname = XDisplayString(pdpy);
mpfd->pcontext = pcontext;
mpfd->file_name = filename;
mpfd->file = NULL;
mpfd->status = XPGetDocError;
/* make sure we can open the file for writing */
if( (mpfd->file = fopen(mpfd->file_name, "w")) == NULL )
{
/* fopen() error */
close(mpfd->pipe[1]);
close(mpfd->pipe[0]);
free(mpfd);
return(NULL);
}
/* its important to flush before we fork, to make sure that the
* XpStartJob gets through first in the parent
*/
XFlush(pdpy);
mpfd->pid = fork();
if( mpfd->pid == 0 )
{
/* we're now in the fork()'ed child */
PrintToFile_Consumer(mpfd);
}
else if( mpfd->pid < 0 )
{
/* fork() error */
close(mpfd->pipe[1]);
close(mpfd->pipe[0]);
fclose(mpfd->file);
free(mpfd);
return(NULL);
}
/* we're still in the parent */
XPU_DEBUG_ONLY(printf("### parent fork()'ed consumer child.\n"));
/* child will write into file - we don't need it anymore here... :-) */
fclose(mpfd->file);
close(mpfd->pipe[1]);
return(mpfd);
}
XPGetDocStatus XpuWaitForPrintFileChild( void *handle )
{
MyPrintFileData *mpfd = (MyPrintFileData *)handle;
int res;
XPGetDocStatus status = XPGetDocError; /* used when read() from pipe fails */
/* Flush data a last time to make sure we send all data to Xprt and that
* the Xlib internal hooks have called a last time */
XFlush(mpfd->parent_pdpy);
if( XPU_TRACE(waitpid(mpfd->pid, &res, 0)) == -1 )
perror("XpuWaitForPrintFileChild: waitpid failure");
/* read the status from the child */
if( read(mpfd->pipe[0], &status, sizeof(XPGetDocStatus)) != sizeof(XPGetDocStatus) )
{
perror("XpuWaitForPrintFileChild: can't read XPGetDocStatus");
}
close(mpfd->pipe[0]);
free(handle);
XPU_DEBUG_ONLY(PrintXPGetDocStatus(status));
return(status);
}
#endif /* XPU_USE_THREADS */
static
void MyPrintToFileProc( Display *pdpy,
XPContext pcontext,
unsigned char *data,
unsigned int data_len,
XPointer client_data )
{
MyPrintFileData *mpfd = (MyPrintFileData *)client_data;
/* write to the file */
XPU_TRACE_CHILD((void)fwrite(data, data_len, 1, mpfd->file)); /* what about error handling ? */
}
static
void MyFinishProc( Display *pdpy,
XPContext pcontext,
XPGetDocStatus status,
XPointer client_data )
{
MyPrintFileData *mpfd = (MyPrintFileData *)client_data;
/* remove the file if unsuccessful */
if( status != XPGetDocFinished )
{
XPU_DEBUG_ONLY(printf("MyFinishProc: error %d\n", (int)status));
XPU_TRACE_CHILD(remove(mpfd->file_name));
}
XPU_TRACE_CHILD((void)fclose(mpfd->file)); /* what about error handling ? */
mpfd->status = status;
mpfd->done = True;
}
static
#ifdef XPU_USE_NSPR
void PrintToFile_Consumer( void *handle )
#else
void *PrintToFile_Consumer( void *handle )
#endif
{
MyPrintFileData *mpfd = (MyPrintFileData *)handle;
XEvent dummy;
struct timeval timeout;
timeout.tv_sec = 0;
timeout.tv_usec = 100000; /* 1/10 s */
XPU_DEBUG_ONLY(printf("### child running, getting data from '%s'.\n", mpfd->displayname));
/* we cannot reuse fork()'ed display handles - our child needs his own one */
if( (mpfd->pdpy = XPU_TRACE_CHILD(XOpenDisplay(mpfd->displayname))) == NULL )
{
perror("child cannot open display");
#ifdef XPU_USE_NSPR
return;
#else
return(NULL);
#endif
}
mpfd->done = False;
/* register "consumer" callbacks */
if( XPU_TRACE_CHILD(XpGetDocumentData(mpfd->pdpy, mpfd->pcontext,
MyPrintToFileProc, MyFinishProc,
(XPointer)mpfd)) == 0 )
{
XPU_DEBUG_ONLY(printf("XpGetDocumentData cannot register callbacks\n"));
#ifdef XPU_USE_NSPR
return;
#else
return(NULL);
#endif
}
/* loop forever - libXp has registered hidden event callbacks for the consumer
* callbacks - the finishCB will call set the "done" boolean after all...
*/
while( mpfd->done != True )
{
XNextEventTimeout(mpfd->pdpy, &dummy, &timeout);
}
XCloseDisplay(mpfd->pdpy);
#ifdef XPU_USE_THREADS
#ifdef XPU_USE_NSPR
return;
#else
return(NULL);
#endif
#else
/* write the status to the parent */
if( XPU_TRACE_CHILD(write(mpfd->pipe[1], &mpfd->status, sizeof(XPGetDocStatus))) != sizeof(XPGetDocStatus) )
{
perror("PrintToFile_Consumer: can't write XPGetDocStatus");
}
/* we don't do any free's or close's, as we are just
* going to exit, in fact, get out without calling any C++
* destructors, etc., as we don't want anything funny to happen
* to the parent
*/
XPU_TRACE_CHILD(_exit(EXIT_SUCCESS));
#endif /* XPU_USE_THREADS */
}
/* EOF. */

View File

@ -1484,13 +1484,11 @@ nsPrintEngine::ShowPrintErrorDialog(nsresult aPrintError, PRBool aIsPrinting)
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_COLORSPACE_NOT_SUPPORTED)
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_TOO_MANY_COPIES)
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_DRIVER_CONFIGURATION_ERROR)
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_XPRINT_BROKEN_XPRT)
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY_PP)
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED)
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_NO_PRINTDIALOG_IN_TOOLKIT)
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_NO_PRINTROMPTSERVICE)
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_NO_XUL) // Temporary code for Bug 136185 / bug 240490
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_XPRINT_NO_XPRINT_SERVERS_FOUND)
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_PLEX_NOT_SUPPORTED)
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY)
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTING_NOT_IMPLEMENTED)

View File

@ -2236,7 +2236,7 @@ pref("font.min-size.fixed.zh-HK", 10);
* - xdisplay = X11 display name (like "host:0.0" (string)
* - xdpy = X DPI (X screen resolution) (integer)
* - ydpy = Y DPI (Y screen resolution) (integer)
* - xdevice = "display" or "printer" (Xprint)
* - xdevice = "display" or "printer" (Xprint - now obsolete)
* Patterns use the regular expressions described in the EXTENDED REGULAR
* EXPRESSIONS section of the regex(5) manual page.
* Note that prefs strings can always be concatenated via the '+'-operator,
@ -2250,19 +2250,6 @@ pref("font.min-size.fixed.zh-HK", 10);
//pref("font.x11.rejectfontpattern",
// "fname=-urw.*;scalable=false;outline_scaled=false;xdisplay=.*;xdpy=.*;ydpy=.*;xdevice=.*");
/* reject font if accept pattern does not match it... */
pref("print.xprint.font.acceptfontpattern", ".*");
/* reject font if reject pattern matches it...
* Current bans:
* - bug 148470 ("Ban "-dt-*" (bitmap!!) fonts from Xprint")
* pattern="fname=-dt-.*;scalable=.*;outline_scaled=false;xdisplay=.*;xdpy=.*;ydpy=.*;xdevice=.*"
*/
pref("print.xprint.font.rejectfontpattern",
"fname=-dt-.*;scalable=.*;outline_scaled=false;xdisplay=.*;xdpy=.*;ydpy=.*;xdevice=.*");
/* Xprint print module prefs */
pref("print.xprint.font.force_outline_scaled_fonts", true);
/* PostScript print module prefs */
// pref("print.postscript.enabled", true);
pref("print.postscript.paper_size", "letter");

View File

@ -171,8 +171,7 @@
// Hide the ``Print...'' button when the underlying gfx code does not
// support multiple devicecontext to be used concurrently
// (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))
// legacy support for unices.'s PostScript module
// XXX the scaling widgets, and the orientation widgets on unices.
var canPrint = true;
try

View File

@ -203,10 +203,6 @@ ifdef MOZ_ENABLE_STARTUP_NOTIFICATION
EXTRA_DSO_LDOPTS += $(MOZ_STARTUP_NOTIFICATION_LIBS)
endif
ifdef MOZ_ENABLE_XPRINT
EXTRA_DSO_LDOPTS += $(MOZ_XPRINT_LDFLAGS)
endif
ifeq ($(OS_ARCH),BeOS)
EXTRA_DSO_LDOPTS += -lbe -ltracker
endif

View File

@ -232,16 +232,6 @@ ifdef MOZ_MATHML
COMPONENT_LIBS += ucvmath
endif
ifneq (,$(MOZ_ENABLE_XPRINT))
STATIC_LIBS += xlibrgb
endif
ifdef MOZ_ENABLE_XPRINT
DEFINES += -DMOZ_ENABLE_XPRINT
STATIC_LIBS += xprintutil
COMPONENTS_LIBS += gfxxprint
endif
ifdef MOZ_ENABLE_GTK2
COMPONENT_LIBS += widget_gtk2
ifdef MOZ_PREF_EXTENSIONS

View File

@ -121,12 +121,6 @@
#define ICON_MODULE
#endif
#ifdef MOZ_ENABLE_XPRINT
#define XPRINT_MODULES MODULE(nsGfxXprintModule)
#else
#define XPRINT_MODULES
#endif
#ifdef MOZ_RDF
#define RDF_MODULE MODULE(nsRDFModule)
#else

View File

@ -61,10 +61,6 @@
#include "nsStringEnumerator.h"
#include "nsIServiceManager.h"
#ifdef USE_XPRINT
#include "xprintutil.h"
#endif /* USE_XPRINT */
#ifdef USE_POSTSCRIPT
#include "nsPSPrinters.h"
#include "nsPaperPS.h" /* Paper size list */
@ -394,32 +390,18 @@ nsDeviceContextSpecGTK::~nsDeviceContextSpecGTK()
delete mPrintJob;
}
/* Use both PostScript and Xprint module */
#ifdef MOZ_CAIRO_GFX
NS_IMPL_ISUPPORTS1(nsDeviceContextSpecGTK,
nsIDeviceContextSpec)
#else
#if defined(USE_XPRINT) && defined(USE_POSTSCRIPT)
NS_IMPL_ISUPPORTS3(nsDeviceContextSpecGTK,
nsIDeviceContextSpec,
nsIDeviceContextSpecPS,
nsIDeviceContextSpecXp)
/* Use only PostScript module */
#elif !defined(USE_XPRINT) && defined(USE_POSTSCRIPT)
#if defined(USE_POSTSCRIPT)
NS_IMPL_ISUPPORTS2(nsDeviceContextSpecGTK,
nsIDeviceContextSpec,
nsIDeviceContextSpecPS)
/* Use only Xprint module module */
#elif defined(USE_XPRINT) && !defined(USE_POSTSCRIPT)
NS_IMPL_ISUPPORTS2(nsDeviceContextSpecGTK,
nsIDeviceContextSpec,
nsIDeviceContextSpecXp)
/* Both Xprint and PostScript module are missing */
#elif !defined(USE_XPRINT) && !defined(USE_POSTSCRIPT)
#else
NS_IMPL_ISUPPORTS1(nsDeviceContextSpecGTK,
nsIDeviceContextSpec)
#else
#error "This should not happen"
#endif
#endif
@ -715,17 +697,7 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::GetPrintMethod(PrintMethod &aMethod)
/* static !! */
nsresult nsDeviceContextSpecGTK::GetPrintMethod(const char *aPrinter, PrintMethod &aMethod)
{
#if defined(USE_POSTSCRIPT) && defined(USE_XPRINT)
if (nsPSPrinterList::kTypeUnknown ==
nsPSPrinterList::GetPrinterType(nsDependentCString(aPrinter)))
aMethod = pmXprint;
else
aMethod = pmPostScript;
return NS_OK;
#elif defined(USE_XPRINT)
aMethod = pmXprint;
return NS_OK;
#elif defined(USE_POSTSCRIPT)
#if defined(USE_POSTSCRIPT)
aMethod = pmPostScript;
return NS_OK;
#else
@ -930,266 +902,6 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
aPrintSettings->SetIsInitializedFromPrinter(PR_TRUE);
#ifdef USE_XPRINT
if (type == pmXprint) {
DO_PR_DEBUG_LOG(("InitPrintSettingsFromPrinter() for Xprint printer\n"));
/* Setup the capabilities list of Mozilla's Xprint print module */
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
nsPrinterFeatures printerFeatures(fullPrinterName);
printerFeatures.SetSupportsPaperSizeChange(PR_TRUE);
printerFeatures.SetSupportsOrientationChange(PR_TRUE);
printerFeatures.SetSupportsPlexChange(PR_TRUE);
printerFeatures.SetSupportsResolutionNameChange(PR_TRUE);
printerFeatures.SetSupportsColorspaceChange(PR_TRUE);
printerFeatures.SetSupportsJobTitleChange(PR_TRUE);
printerFeatures.SetSupportsSpoolerCommandChange(PR_FALSE); /* won't work by design and very good reasons! */
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
/* Setup the capabilities list of this specific printer */
Display *pdpy;
XPContext pcontext;
if (XpuGetPrinter(printerName, &pdpy, &pcontext) != 1)
return NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND;
XpuSupportedFlags supported_doc_attrs = XpuGetSupportedDocAttributes(pdpy, pcontext);
/* Setup orientation stuff */
XpuOrientationList olist;
int ocount;
XpuOrientationRec *default_orientation;
/* Setup plex stuff */
XpuPlexList plexlist;
int plexcount;
XpuPlexRec *default_plex;
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
PRBool canSetOrientation = MAKE_PR_BOOL(supported_doc_attrs & XPUATTRIBUTESUPPORTED_CONTENT_ORIENTATION);
printerFeatures.SetCanChangeOrientation(canSetOrientation);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
/* Get list of supported orientations */
olist = XpuGetOrientationList(pdpy, pcontext, &ocount);
if (olist) {
default_orientation = &olist[0]; /* First entry is the default one */
if (!PL_strcasecmp(default_orientation->orientation, "portrait")) {
DO_PR_DEBUG_LOG(("setting default orientation to 'portrait'\n"));
aPrintSettings->SetOrientation(nsIPrintSettings::kPortraitOrientation);
}
else if (!PL_strcasecmp(default_orientation->orientation, "landscape")) {
DO_PR_DEBUG_LOG(("setting default orientation to 'landscape'\n"));
aPrintSettings->SetOrientation(nsIPrintSettings::kLandscapeOrientation);
}
else {
DO_PR_DEBUG_LOG(("Unknown default orientation '%s'\n", default_orientation->orientation));
}
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
int i;
for( i = 0 ; i < ocount ; i++ )
{
XpuOrientationRec *curr = &olist[i];
printerFeatures.SetOrientationRecord(i, curr->orientation);
}
printerFeatures.SetNumOrientationRecords(ocount);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
XpuFreeOrientationList(olist);
}
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
PRBool canSetPlexMode = MAKE_PR_BOOL(supported_doc_attrs & XPUATTRIBUTESUPPORTED_PLEX);
printerFeatures.SetCanChangePlex(canSetPlexMode);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
/* Get list of supported plex modes */
plexlist = XpuGetPlexList(pdpy, pcontext, &plexcount);
if (plexlist) {
default_plex = &plexlist[0]; /* First entry is the default one */
DO_PR_DEBUG_LOG(("setting default plex to '%s'\n", default_plex->plex));
aPrintSettings->SetPlexName(NS_ConvertUTF8toUTF16(default_plex->plex).get());
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
int i;
for( i = 0 ; i < plexcount ; i++ )
{
XpuPlexRec *curr = &plexlist[i];
printerFeatures.SetPlexRecord(i, curr->plex);
}
printerFeatures.SetNumPlexRecords(plexcount);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
XpuFreePlexList(plexlist);
}
/* Setup Number of Copies */
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
PRBool canSetNumCopies = MAKE_PR_BOOL(supported_doc_attrs & XPUATTRIBUTESUPPORTED_COPY_COUNT);
printerFeatures.SetCanChangeNumCopies(canSetNumCopies);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
long numCopies;
if( XpuGetOneLongAttribute(pdpy, pcontext, XPDocAttr, "copy-count", &numCopies) != 1 )
{
/* Fallback on failure */
numCopies = 1;
}
aPrintSettings->SetNumCopies(numCopies);
/* Setup paper size stuff */
XpuMediumSourceSizeList mlist;
int mcount;
XpuMediumSourceSizeRec *default_medium;
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
PRBool canSetPaperSize = MAKE_PR_BOOL(supported_doc_attrs & XPUATTRIBUTESUPPORTED_DEFAULT_MEDIUM);
printerFeatures.SetCanChangePaperSize(canSetPaperSize);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
mlist = XpuGetMediumSourceSizeList(pdpy, pcontext, &mcount);
if (mlist) {
nsCAutoString papername;
default_medium = &mlist[0]; /* First entry is the default one */
double total_width = default_medium->ma1 + default_medium->ma2,
total_height = default_medium->ma3 + default_medium->ma4;
/* Either "paper" or "tray/paper" */
if (default_medium->tray_name) {
papername.Append(default_medium->tray_name);
papername.Append('/');
}
papername.Append(default_medium->medium_name);
DO_PR_DEBUG_LOG(("setting default paper size to '%s' (%g/%g mm)\n", papername.get(), total_width, total_height));
aPrintSettings->SetPaperSizeType(nsIPrintSettings::kPaperSizeDefined);
aPrintSettings->SetPaperSizeUnit(nsIPrintSettings::kPaperSizeMillimeters);
aPrintSettings->SetPaperWidth(total_width);
aPrintSettings->SetPaperHeight(total_height);
aPrintSettings->SetPaperName(NS_ConvertUTF8toUTF16(papername).get());
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
int i;
for( i = 0 ; i < mcount ; i++ )
{
XpuMediumSourceSizeRec *curr = &mlist[i];
double total_width = curr->ma1 + curr->ma2,
total_height = curr->ma3 + curr->ma4;
papername.Truncate();
if (curr->tray_name) {
papername.Append(curr->tray_name);
papername.Append('/');
}
papername.Append(curr->medium_name);
printerFeatures.SetPaperRecord(i, papername.get(), PRInt32(total_width), PRInt32(total_height), PR_FALSE);
}
printerFeatures.SetNumPaperSizeRecords(mcount);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
XpuFreeMediumSourceSizeList(mlist);
}
/* Setup resolution/quality stuff */
XpuResolutionList rlist;
int rcount;
XpuResolutionRec *default_resolution;
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
PRBool canSetResolutionName = MAKE_PR_BOOL(supported_doc_attrs & XPUATTRIBUTESUPPORTED_DEFAULT_PRINTER_RESOLUTION);
printerFeatures.SetCanChangeResolutionName(canSetResolutionName);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
rlist = XpuGetResolutionList(pdpy, pcontext, &rcount);
if (rlist) {
default_resolution = &rlist[0]; /* First entry is the default one */
DO_PR_DEBUG_LOG(("setting default resolution to '%s'/%ldx%ld\n",
default_resolution->name,
default_resolution->x_dpi,
default_resolution->y_dpi));
aPrintSettings->SetResolutionName(NS_ConvertUTF8toUTF16(default_resolution->name).get());
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
int i;
for( i = 0 ; i < rcount ; i++ )
{
XpuResolutionRec *curr = &rlist[i];
printerFeatures.SetResolutionNameRecord(i, curr->name);
}
printerFeatures.SetNumResolutionNameRecords(rcount);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
XpuFreeResolutionList(rlist);
}
/* We still support the old print-in-color boolean */
printerFeatures.SetSupportsPrintInColorChange(PR_TRUE);
printerFeatures.SetCanChangePrintInColor(PR_TRUE);
/* Setup colorspace stuff */
XpuColorspaceList cslist;
int cscount;
XpuColorspaceRec *default_colorspace;
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
printerFeatures.SetCanChangeColorspace(PR_TRUE);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
cslist = XpuGetColorspaceList(pdpy, pcontext, &cscount);
if (cslist) {
default_colorspace = &cslist[0]; /* First entry is the default one */
DO_PR_DEBUG_LOG(("setting default colorspace to '%s'\n", default_colorspace->name));
aPrintSettings->SetColorspace(NS_ConvertUTF8toUTF16(default_colorspace->name).get());
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
int i;
for( i = 0 ; i < cscount ; i++ )
{
XpuColorspaceRec *curr = &cslist[i];
printerFeatures.SetColorspaceRecord(i, curr->name);
}
printerFeatures.SetNumColorspaceRecords(cscount);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
XpuFreeColorspaceList(cslist);
}
/* Fonts */
PRBool canSetListFontsMode = MAKE_PR_BOOL(supported_doc_attrs & XPUATTRIBUTESUPPORTED_LISTFONTS_MODES);
printerFeatures.SetCanChangeDownloadFonts(canSetListFontsMode);
printerFeatures.SetSupportsDownloadFontsChange(PR_TRUE);
Bool downloadFonts = XpuGetEnableFontDownload(pdpy, pcontext);
aPrintSettings->SetDownloadFonts(downloadFonts);
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
/* Xprint does not allow the client to set a spooler command.
* Job spooling is the job of the server side (=Xprt) */
printerFeatures.SetCanChangeSpoolerCommand(PR_FALSE);
/* Check whether printer/driver allow changes of the job name */
PRBool canSetJobName = MAKE_PR_BOOL(XpuGetSupportedJobAttributes(pdpy, pcontext) & XPUATTRIBUTESUPPORTED_JOB_NAME);
printerFeatures.SetCanChangeJobTitle(canSetJobName);
/* Mozilla's Xprint support allows multiple nsIDeviceContext instances
* be used in parallel */
printerFeatures.SetMultipleConcurrentDeviceContextsSupported(PR_TRUE);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
XpuClosePrinterDisplay(pdpy, pcontext);
return NS_OK;
}
else
#endif /* USE_XPRINT */
#ifdef USE_POSTSCRIPT
if (type == pmPostScript) {
DO_PR_DEBUG_LOG(("InitPrintSettingsFromPrinter() for PostScript printer\n"));
@ -1365,26 +1077,6 @@ nsresult GlobalPrinters::InitializeGlobalPrinters ()
if (NS_FAILED(rv))
return rv;
#ifdef USE_XPRINT
int printerCount;
XPPrinterList plist = XpuGetPrinterList(nsnull, &printerCount);
if (plist)
{
int i;
for( i = 0 ; i < printerCount ; i++ )
{
/* Add name to our list of printers... */
mGlobalPrinterList->AppendString(nsString(NS_ConvertUTF8toUTF16(plist[i].name)));
/* ... and store the description text for this printer */
pPrefs->SetCharPref(nsPrintfCString(256, "print.printer_%s.printer_description", plist[i].name).get(), plist[i].desc);
}
XpuFreePrinterList(plist);
}
#endif /* USE_XPRINT */
#ifdef USE_POSTSCRIPT
nsPSPrinterList psMgr;
if (NS_SUCCEEDED(psMgr.Init()) && psMgr.Enabled()) {
@ -1401,13 +1093,6 @@ nsresult GlobalPrinters::InitializeGlobalPrinters ()
/* Make sure we do not cache an empty printer list */
FreeGlobalPrinters();
#ifdef USE_XPRINT
/* Check if there are actually any Xprint servers available */
if (!XpuXprintServersAvailable()) {
return NS_ERROR_GFX_PRINTER_XPRINT_NO_XPRINT_SERVERS_FOUND;
}
#endif /* USE_XPRINT */
return NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE;
}

View File

@ -49,9 +49,6 @@
#ifdef USE_POSTSCRIPT
#include "nsIDeviceContextSpecPS.h"
#endif /* USE_POSTSCRIPT */
#ifdef USE_XPRINT
#include "nsIDeviceContextSpecXPrint.h"
#endif /* USE_XPRINT */
#endif
#include "nsCRT.h" /* should be <limits.h>? */
@ -64,7 +61,6 @@
typedef enum
{
pmInvalid = 0,
pmXprint,
pmPostScript
} PrintMethod;
@ -73,9 +69,6 @@ class nsDeviceContextSpecGTK : public nsIDeviceContextSpec
#ifdef USE_POSTSCRIPT
, public nsIDeviceContextSpecPS
#endif /* USE_POSTSCRIPT */
#ifdef USE_XPRINT
, public nsIDeviceContextSpecXp
#endif /* USE_XPRINT */
#endif
{
public:

View File

@ -110,9 +110,6 @@ nsDeviceContextSpecOS2 :: ~nsDeviceContextSpecOS2()
}
static NS_DEFINE_IID(kIDeviceContextSpecIID, NS_IDEVICE_CONTEXT_SPEC_IID);
#ifdef USE_XPRINT
static NS_DEFINE_IID(kIDeviceContextSpecXPIID, NS_IDEVICE_CONTEXT_SPEC_XP_IID);
#endif
void SetupDevModeFromSettings(ULONG printer, nsIPrintSettings* aPrintSettings)
{
@ -235,16 +232,6 @@ NS_IMETHODIMP nsDeviceContextSpecOS2 :: QueryInterface(REFNSIID aIID, void** aIn
return NS_OK;
}
#ifdef USE_XPRINT
if (aIID.Equals(kIDeviceContextSpecXPIID))
{
nsIDeviceContextSpecXp *tmp = this;
*aInstancePtr = (void*) tmp;
NS_ADDREF_THIS();
return NS_OK;
}
#endif /* USE_XPRINT */
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kISupportsIID))

View File

@ -52,9 +52,6 @@
#include "nsIPrintOptions.h"
#include "nsIPrintSettings.h"
#include "nsVoidArray.h"
#ifdef USE_XPRINT
#include "nsIDeviceContextSpecXPrint.h"
#endif /* USE_XPRINT */
#include "nsPrintdOS2.h"
#include <os2.h>
#include <pmddim.h>
@ -65,9 +62,6 @@
//---------------------------------------------------------------------
class nsDeviceContextSpecOS2 : public nsIDeviceContextSpec
#ifdef USE_XPRINT
, public nsIDeviceContextSpecXp
#endif
{
public:
/**

View File

@ -169,8 +169,7 @@
// Hide the ``Print...'' button when the underlying gfx code does not
// support multiple devicecontext to be used concurrently
// (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))
// legacy support for unices.'s PostScript module
// XXX the scaling widgets, and the orientation widgets on unices.
var canPrint = true;
try

View File

@ -93,8 +93,6 @@ bin/xpicleanup
bin/res/cmessage.txt
; this is used by gtk embedding clients
bin/libgtkembedmoz.so
; this is used by Xprint and Xlib gfx
bin/libxlibrgb.so
; This is used by libgfxps and libgfx_gtk
bin/libgfxpsshar.so
bin/components/alerts.xpt