diff --git a/gfx/src/gtk/nsDeviceContextGTK.cpp b/gfx/src/gtk/nsDeviceContextGTK.cpp index 19232a88034..26645d64818 100644 --- a/gfx/src/gtk/nsDeviceContextGTK.cpp +++ b/gfx/src/gtk/nsDeviceContextGTK.cpp @@ -26,7 +26,8 @@ #include "nsDeviceContextGTK.h" #include "nsGfxCIID.h" -#include "../ps/nsDeviceContextPS.h" +#include "nsGfxPSCID.h" +#include "nsIDeviceContextPS.h" #include #include @@ -363,11 +364,29 @@ NS_IMETHODIMP nsDeviceContextGTK::GetDeviceSurfaceDimensions(PRInt32 &aWidth, PR NS_IMETHODIMP nsDeviceContextGTK::GetDeviceContextFor(nsIDeviceContextSpec *aDevice, nsIDeviceContext *&aContext) { + static NS_DEFINE_CID(kCDeviceContextPS, NS_DEVICECONTEXTPS_CID); + // Create a Postscript device context - aContext = new nsDeviceContextPS(); - ((nsDeviceContextPS *)aContext)->SetSpec(aDevice); - NS_ADDREF(aDevice); - return((nsDeviceContextPS *) aContext)->Init((nsIDeviceContext*)aContext, (nsIDeviceContext*)this); + nsresult rv; + nsIDeviceContextPS *dcps; + + rv = nsComponentManager::CreateInstance(kCDeviceContextPS, + nsnull, + nsIDeviceContextPS::GetIID(), + (void **)&dcps); + + NS_ASSERTION(NS_SUCCEEDED(rv), "Couldn't create PS Device context"); + + dcps->SetSpec(aDevice); + dcps->InitDeviceContextPS((nsIDeviceContext*)aContext, + (nsIDeviceContext*)this); + + rv = dcps->QueryInterface(nsIDeviceContext::GetIID(), + (void **)&aContext); + + NS_RELEASE(dcps); + + return rv; } NS_IMETHODIMP nsDeviceContextGTK::BeginDocument(void) diff --git a/gfx/src/ps/Makefile.in b/gfx/src/ps/Makefile.in index 7e40e58af28..fa4f9b59d38 100644 --- a/gfx/src/ps/Makefile.in +++ b/gfx/src/ps/Makefile.in @@ -27,7 +27,7 @@ include $(topsrcdir)/config/config.mk LIBRARY_NAME = gfxps MODULE=raptor - +IS_COMPONENT=1 DEFINES += -D_IMPL_NS_GFXONXP CFLAGS += $(TK_CFLAGS) @@ -40,11 +40,15 @@ CPPSRCS = \ nsRenderingContextPS.cpp \ nsPostScriptObj.cpp \ nsAFMObject.cpp \ + nsGfxFactoryPS.cpp \ + $(NULL) CSRCS = \ font_metrics.c \ EXPORTS = \ + nsIDeviceContextPS.h \ + nsGfxPSCID.h \ nsIDeviceContextSpecPS.h \ nsPostScriptObj.h diff --git a/gfx/src/ps/nsDeviceContextPS.cpp b/gfx/src/ps/nsDeviceContextPS.cpp index 61bc1976913..fe7800507b1 100644 --- a/gfx/src/ps/nsDeviceContextPS.cpp +++ b/gfx/src/ps/nsDeviceContextPS.cpp @@ -58,21 +58,24 @@ PRInt32 i, n; } -void nsDeviceContextPS :: SetSpec(nsIDeviceContextSpec* aSpec) +NS_IMETHODIMP +nsDeviceContextPS :: SetSpec(nsIDeviceContextSpec* aSpec) { mSpec = aSpec; NS_ADDREF(aSpec); + return NS_OK; } -NS_IMPL_QUERY_INTERFACE(nsDeviceContextPS, kDeviceContextIID) -NS_IMPL_ADDREF(nsDeviceContextPS) -NS_IMPL_RELEASE(nsDeviceContextPS) +NS_IMPL_ISUPPORTS_INHERITED(nsDeviceContextPS, + DeviceContextImpl, + nsIDeviceContextPS) /** --------------------------------------------------- * See documentation in nsDeviceContextPS.h * @update 12/21/98 dwc */ -NS_IMETHODIMP nsDeviceContextPS :: Init(nsIDeviceContext *aCreatingDeviceContext,nsIDeviceContext *aPrinterContext) +NS_IMETHODIMP +nsDeviceContextPS::InitDeviceContextPS(nsIDeviceContext *aCreatingDeviceContext,nsIDeviceContext *aPrinterContext) { float origscale, newscale; float t2d, a2d; diff --git a/gfx/src/ps/nsDeviceContextPS.h b/gfx/src/ps/nsDeviceContextPS.h index 68bea6987de..a8ea76e8e36 100644 --- a/gfx/src/ps/nsDeviceContextPS.h +++ b/gfx/src/ps/nsDeviceContextPS.h @@ -25,23 +25,25 @@ #include "nsIView.h" #include "nsIRenderingContext.h" #include "nsVoidArray.h" +#include "nsIDeviceContextPS.h" class nsPostScriptObj; class nsDeviceContextWin; // need to be a friend of the class using us. -class nsDeviceContextPS : public DeviceContextImpl +class nsDeviceContextPS : public DeviceContextImpl, + public nsIDeviceContextPS { public: nsDeviceContextPS(); - NS_DECL_ISUPPORTS + 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 Init(nsIDeviceContext *aCreatingDeviceContext,nsIDeviceContext *aPrinterContext); + NS_IMETHOD InitDeviceContextPS(nsIDeviceContext *aCreatingDeviceContext,nsIDeviceContext *aPrinterContext); NS_IMETHOD CreateRenderingContext(nsIRenderingContext *&aContext); NS_IMETHOD SupportsNativeWidgets(PRBool &aSupportsWidgets); @@ -68,7 +70,9 @@ public: NS_IMETHOD EndDocument(void); NS_IMETHOD BeginPage(void); NS_IMETHOD EndPage(void); - virtual void SetSpec(nsIDeviceContextSpec *aSpec); + + + NS_IMETHOD SetSpec(nsIDeviceContextSpec *aSpec); protected: virtual ~nsDeviceContextPS(); diff --git a/gfx/tests/Makefile.in b/gfx/tests/Makefile.in index d5dfd3d76c0..89e92953299 100644 --- a/gfx/tests/Makefile.in +++ b/gfx/tests/Makefile.in @@ -37,7 +37,6 @@ INCLUDES+=-I$(srcdir)/../src -I$(PUBLIC)/raptor -I$(PUBLIC)/xpcom LIBS = \ -lraptorgfx \ -lgfx$(MOZ_TOOLKIT) \ - -lgfxps \ -lnetlib \ -lhttpurl \ -lgophurl \ diff --git a/htmlparser/robot/Makefile.in b/htmlparser/robot/Makefile.in index 0eeed382880..9b8aacc76d5 100644 --- a/htmlparser/robot/Makefile.in +++ b/htmlparser/robot/Makefile.in @@ -51,7 +51,6 @@ LIBS = \ -l$(MOZ_LIB_JS_PREFIX)js \ -lgfx$(MOZ_TOOLKIT) \ -lraptorgfx \ - -lgfxps \ -limg \ -lmozutil \ -lxpcom \ diff --git a/layout/base/tests/Makefile.in b/layout/base/tests/Makefile.in index 50ce175f4d5..4340981db33 100644 --- a/layout/base/tests/Makefile.in +++ b/layout/base/tests/Makefile.in @@ -51,7 +51,6 @@ LIBS = \ -lsecfree \ -lraptorgfx \ -lgfx$(MOZ_TOOLKIT) \ - -lgfxps \ -limg \ -l$(MOZ_LIB_UTIL_PREFIX)util \ $(PNG_LIBS) \ diff --git a/layout/html/tests/Makefile.in b/layout/html/tests/Makefile.in index c94f62fbc21..f0788837022 100644 --- a/layout/html/tests/Makefile.in +++ b/layout/html/tests/Makefile.in @@ -58,7 +58,6 @@ LIBS = \ -ljsdom \ -lraptorgfx \ -lgfx$(MOZ_TOOLKIT) \ - -lgfxps \ -lxpcom \ -lxp \ -lraptorhtmlpars \ diff --git a/mailnews/compose/tests/compose/Makefile.in b/mailnews/compose/tests/compose/Makefile.in index d896f8ae212..bc6dbda843e 100644 --- a/mailnews/compose/tests/compose/Makefile.in +++ b/mailnews/compose/tests/compose/Makefile.in @@ -59,7 +59,6 @@ LIBS = \ $(NSPR_LIBS) \ -lgfx$(MOZ_TOOLKIT) \ -lraptorgfx \ - -lgfxps \ -limg \ -lmozutil \ $(TK_LIBS) \ diff --git a/mailnews/compose/tests/geturl/Makefile.in b/mailnews/compose/tests/geturl/Makefile.in index 3729e910fc2..98f80ea953c 100644 --- a/mailnews/compose/tests/geturl/Makefile.in +++ b/mailnews/compose/tests/geturl/Makefile.in @@ -48,7 +48,6 @@ GECKO_LIBS = \ $(TOOLKIT_WIDGET_LIB) \ -lraptorgfx \ $(TOOLKIT_GFX_LIB) \ - -lgfxps \ -lraptorhtmlpars \ -lexpat \ -lxmltok \ diff --git a/mailnews/compose/tests/smtp/Makefile.in b/mailnews/compose/tests/smtp/Makefile.in index 19129593020..7f59d12e02d 100644 --- a/mailnews/compose/tests/smtp/Makefile.in +++ b/mailnews/compose/tests/smtp/Makefile.in @@ -63,7 +63,6 @@ LIBS = \ -lxp \ -lgfx$(MOZ_TOOLKIT) \ -lraptorgfx \ - -lgfxps \ -lmozutil \ -lsecfree \ $(ZLIB_LIBS) \ diff --git a/mailnews/imap/tests/harness/Makefile.in b/mailnews/imap/tests/harness/Makefile.in index 3c1792a5584..85bc1601f0b 100644 --- a/mailnews/imap/tests/harness/Makefile.in +++ b/mailnews/imap/tests/harness/Makefile.in @@ -60,7 +60,6 @@ LIBS = \ -limg \ -lgfx$(MOZ_TOOLKIT) \ -lraptorgfx \ - -lgfxps \ -lmozutil \ -lmsgbaseutil \ $(JPEG_LIBS) \ diff --git a/mailnews/local/tests/pop3/Makefile.in b/mailnews/local/tests/pop3/Makefile.in index 6b0d67a6323..084a1676d00 100644 --- a/mailnews/local/tests/pop3/Makefile.in +++ b/mailnews/local/tests/pop3/Makefile.in @@ -59,7 +59,6 @@ LIBS = \ $(NSPR_LIBS) \ -lgfx$(MOZ_TOOLKIT) \ -lraptorgfx \ - -lgfxps \ -limg \ -lmozutil \ $(TK_LIBS) \ diff --git a/mailnews/mime/tests/mimetest/Makefile.in b/mailnews/mime/tests/mimetest/Makefile.in index 961e692a8c4..51d0b7f7b12 100644 --- a/mailnews/mime/tests/mimetest/Makefile.in +++ b/mailnews/mime/tests/mimetest/Makefile.in @@ -46,7 +46,6 @@ GECKO_LIBS = \ $(TOOLKIT_WIDGET_LIB) \ -lraptorgfx \ $(TOOLKIT_GFX_LIB) \ - -lgfxps \ -lraptorhtmlpars \ -lexpat \ -lxmltok \ diff --git a/mailnews/news/tests/newsParser/Makefile.in b/mailnews/news/tests/newsParser/Makefile.in index a3a731d2490..1fed132b1b0 100644 --- a/mailnews/news/tests/newsParser/Makefile.in +++ b/mailnews/news/tests/newsParser/Makefile.in @@ -61,7 +61,6 @@ LIBS = \ -limg \ -lgfx$(MOZ_TOOLKIT) \ -lraptorgfx \ - -lgfxps \ -lmozutil \ $(DIST)/lib/libmsgnews_s.a \ -lmsgbaseutil \ diff --git a/mailnews/news/tests/nntp/Makefile.in b/mailnews/news/tests/nntp/Makefile.in index bdf81d5ea10..2540db1a79c 100644 --- a/mailnews/news/tests/nntp/Makefile.in +++ b/mailnews/news/tests/nntp/Makefile.in @@ -63,7 +63,6 @@ LIBS = \ $(JPEG_LIBS) \ -lgfx$(MOZ_TOOLKIT) \ -lraptorgfx \ - -lgfxps \ -lmozutil \ -lmsgbaseutil \ $(ZLIB_LIBS) \ diff --git a/network/module/tests/Makefile.in b/network/module/tests/Makefile.in index 21617185d41..5bd7431a9cb 100644 --- a/network/module/tests/Makefile.in +++ b/network/module/tests/Makefile.in @@ -35,7 +35,6 @@ REQUIRES = raptor netlib xpcom reg pref LIBS = \ -lraptorgfx \ -lgfx$(MOZ_TOOLKIT) \ - -lgfxps \ -lnetlib \ -labouturl \ -lfileurl \ diff --git a/parser/htmlparser/robot/Makefile.in b/parser/htmlparser/robot/Makefile.in index 0eeed382880..9b8aacc76d5 100644 --- a/parser/htmlparser/robot/Makefile.in +++ b/parser/htmlparser/robot/Makefile.in @@ -51,7 +51,6 @@ LIBS = \ -l$(MOZ_LIB_JS_PREFIX)js \ -lgfx$(MOZ_TOOLKIT) \ -lraptorgfx \ - -lgfxps \ -limg \ -lmozutil \ -lxpcom \ diff --git a/rdf/tests/rdfcat/Makefile.in b/rdf/tests/rdfcat/Makefile.in index 00b3636f02c..734e9712d2e 100644 --- a/rdf/tests/rdfcat/Makefile.in +++ b/rdf/tests/rdfcat/Makefile.in @@ -46,7 +46,6 @@ GECKO_LIBS = \ $(TOOLKIT_WIDGET_LIB) \ -lraptorgfx \ $(TOOLKIT_GFX_LIB) \ - -lgfxps \ -lraptorhtmlpars \ -lexpat \ -lxmltok \ diff --git a/rdf/tests/rdfpoll/Makefile.in b/rdf/tests/rdfpoll/Makefile.in index 1f32bd89509..132bf6aacfe 100644 --- a/rdf/tests/rdfpoll/Makefile.in +++ b/rdf/tests/rdfpoll/Makefile.in @@ -46,7 +46,6 @@ GECKO_LIBS = \ $(TOOLKIT_WIDGET_LIB) \ -lraptorgfx \ $(TOOLKIT_GFX_LIB) \ - -lgfxps \ -lraptorhtmlpars \ -lexpat \ -lxmltok \ diff --git a/webshell/embed/gtk/lib/Makefile.am b/webshell/embed/gtk/lib/Makefile.am index ce0edd619b9..8459269c346 100644 --- a/webshell/embed/gtk/lib/Makefile.am +++ b/webshell/embed/gtk/lib/Makefile.am @@ -40,7 +40,6 @@ GECKO_LIBS = \ $(TOOLKIT_WIDGET_LIB) \ -lraptorgfx \ $(TOOLKIT_GFX_LIB) \ - -lgfxps \ -lraptorhtmlpars \ -lexpat \ -lxmltok \ diff --git a/webshell/embed/gtk/lib/Makefile.in b/webshell/embed/gtk/lib/Makefile.in index 6dbe06500f2..9326e5b060d 100644 --- a/webshell/embed/gtk/lib/Makefile.in +++ b/webshell/embed/gtk/lib/Makefile.in @@ -102,7 +102,7 @@ BASE_LIBS = -lpref $(ZLIB_LIBS) -lreg TOOLKIT_WIDGET_LIB = -lwidgetgtk TOOLKIT_GFX_LIB = -lgfxgtk -GECKO_LIBS = -lraptorwebwidget $(TOOLKIT_WIDGET_LIB) -lraptorgfx $(TOOLKIT_GFX_LIB) -lgfxps -lraptorhtmlpars -lexpat -lxmltok -ljsdom $(NULL) +GECKO_LIBS = -lraptorwebwidget $(TOOLKIT_WIDGET_LIB) -lraptorgfx $(TOOLKIT_GFX_LIB) -lraptorhtmlpars -lexpat -lxmltok -ljsdom $(NULL) JPEG_LIBS = -ljpeg diff --git a/webshell/tests/viewer/Makefile.in b/webshell/tests/viewer/Makefile.in index 3b297dfa779..97c67021483 100644 --- a/webshell/tests/viewer/Makefile.in +++ b/webshell/tests/viewer/Makefile.in @@ -119,7 +119,6 @@ GECKO_LIBS = \ $(TOOLKIT_WIDGET_LIB) \ -lraptorgfx \ $(TOOLKIT_GFX_LIB) \ - -lgfxps \ -lraptorhtmlpars \ -lexpat \ -lxmltok \ diff --git a/widget/tests/scribble/Makefile.in b/widget/tests/scribble/Makefile.in index b0057d2aaa2..80a02c4d3f7 100644 --- a/widget/tests/scribble/Makefile.in +++ b/widget/tests/scribble/Makefile.in @@ -51,7 +51,6 @@ LIBS := \ $(TOOLKIT_WIDGET_LIB) \ -lraptorgfx \ $(TOOLKIT_GFX_LIB) \ - -lgfxps \ -lraptorhtmlpars \ -lraptorview \ -labouturl \ diff --git a/widget/tests/widget/Makefile.in b/widget/tests/widget/Makefile.in index e97a3a0845a..95890bf9ccf 100644 --- a/widget/tests/widget/Makefile.in +++ b/widget/tests/widget/Makefile.in @@ -40,7 +40,6 @@ CPPSRCS = \ LIBS := \ -lraptorgfx \ - -lgfxps \ -lnetlib \ -lremoturl \ -lnetcnvts \ @@ -67,7 +66,6 @@ LIBS := \ -lgfx$(MOZ_TOOLKIT) \ $(TK_LIBS) \ -lraptorgfx \ - -lgfxps \ -lxp \ -lraptorhtmlpars \ -lexpat \ diff --git a/xpcom/tests/Makefile.in b/xpcom/tests/Makefile.in index 8f4c4aac96f..f7d1c047419 100644 --- a/xpcom/tests/Makefile.in +++ b/xpcom/tests/Makefile.in @@ -79,7 +79,6 @@ NETLIB_LIBS = \ LIBS = \ -lraptorgfx \ -lgfx$(MOZ_TOOLKIT) \ - -lgfxps \ -lnetlib \ -labouturl \ -lfileurl \ diff --git a/xpfe/bootstrap/Makefile.in b/xpfe/bootstrap/Makefile.in index 1d08bd3f1cb..f05de9573fa 100644 --- a/xpfe/bootstrap/Makefile.in +++ b/xpfe/bootstrap/Makefile.in @@ -42,7 +42,6 @@ LIBS = \ $(TOOLKIT_WIDGET_LIB)\ -lraptorgfx \ $(TOOLKIT_GFX_LIB)\ - -lgfxps \ -lreg \ -labouturl \ -lhttpurl \