Combined files so 3 were deleted, one added. The Rendering and Device contexts

no longer need deligates, so they were removed.  Cleaned up alot of code no
longer needed
This commit is contained in:
dcone%netscape.com 1999-01-22 16:21:58 +00:00
Родитель cecaf27f77
Коммит 261d0f0c9b
11 изменённых файлов: 872 добавлений и 508 удалений

Просмотреть файл

@ -20,16 +20,23 @@
#include "nsRenderingContextPS.h" #include "nsRenderingContextPS.h"
#include "nsString.h" #include "nsString.h"
#include "nsFontMetricsPS.h" #include "nsFontMetricsPS.h"
#include "prprf.h" #include "prprf.h"
#include "nsPSUtil.h"
#include "nsPrintManager.h"
#include "xlate.h"
static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID); static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID);
#define NS_LETTER_SIZE 0
#define NS_LEGAL_SIZE 1
#define NS_EXECUTIVE_SIZE 2
#define PAGE_WIDTH 612 // Points
#define PAGE_HEIGHT 792 //Points
/** --------------------------------------------------- /** ---------------------------------------------------
* See documentation in nsIDeviceContext.h * See documentation in nsIDeviceContext.h
* @update 12/21/98 dwc * @update 12/21/98 dwc
@ -39,7 +46,6 @@ nsDeviceContextPS :: nsDeviceContextPS()
NS_INIT_REFCNT(); NS_INIT_REFCNT();
mSpec = nsnull; mSpec = nsnull;
mDelContext = nsnull;
} }
@ -75,7 +81,6 @@ float origscale, newscale;
float t2d, a2d; float t2d, a2d;
mDepth = 1; mDepth = 1;
mDelContext = aCreatingDeviceContext;
mDC = aTheDC; mDC = aTheDC;
@ -94,7 +99,6 @@ float t2d, a2d;
return NS_OK; return NS_OK;
} }
/** --------------------------------------------------- /** ---------------------------------------------------
* Create a Postscript RenderingContext. This will create a RenderingContext * Create a Postscript RenderingContext. This will create a RenderingContext
* from the deligate RenderingContext and intall that into our Postscript RenderingContext. * from the deligate RenderingContext and intall that into our Postscript RenderingContext.
@ -104,26 +108,18 @@ float t2d, a2d;
*/ */
NS_IMETHODIMP nsDeviceContextPS :: CreateRenderingContext(nsIRenderingContext *&aContext) NS_IMETHODIMP nsDeviceContextPS :: CreateRenderingContext(nsIRenderingContext *&aContext)
{ {
nsIRenderingContext *delContext; nsresult rv = NS_ERROR_OUT_OF_MEMORY;
nsresult rv = NS_ERROR_OUT_OF_MEMORY;
if(mDelContext){ aContext = new nsRenderingContextPS();
// create the platform specific RenderingContext from the deligate if (nsnull != aContext){
mDelContext->CreateRenderingContext(delContext); NS_ADDREF(aContext);
rv = ((nsRenderingContextPS*) aContext)->Init(this);
}else{
rv = NS_ERROR_OUT_OF_MEMORY;
}
// create a new postscript renderingcontext if (NS_OK != rv){
aContext = new nsRenderingContextPS(); NS_IF_RELEASE(aContext);
if (nsnull != aContext){
NS_ADDREF(aContext);
rv = ((nsRenderingContextPS*) aContext)->Init(this,delContext);
}
else{
rv = NS_ERROR_OUT_OF_MEMORY;
}
if (NS_OK != rv){
NS_IF_RELEASE(aContext);
}
} }
return rv; return rv;
@ -161,8 +157,7 @@ NS_IMETHODIMP nsDeviceContextPS :: GetScrollBarDimensions(float &aWidth, float &
*/ */
NS_IMETHODIMP nsDeviceContextPS :: GetDrawingSurface(nsIRenderingContext &aContext, nsDrawingSurface &aSurface) NS_IMETHODIMP nsDeviceContextPS :: GetDrawingSurface(nsIRenderingContext &aContext, nsDrawingSurface &aSurface)
{ {
return NS_OK;
return(mDelContext->GetDrawingSurface(aContext,aSurface));
} }
/** --------------------------------------------------- /** ---------------------------------------------------
@ -172,7 +167,6 @@ NS_IMETHODIMP nsDeviceContextPS :: GetDrawingSurface(nsIRenderingContext &aConte
NS_IMETHODIMP nsDeviceContextPS::GetDepth(PRUint32& aDepth) NS_IMETHODIMP nsDeviceContextPS::GetDepth(PRUint32& aDepth)
{ {
return(1); // postscript is 1 bit return(1); // postscript is 1 bit
} }
/** --------------------------------------------------- /** ---------------------------------------------------
@ -181,8 +175,7 @@ NS_IMETHODIMP nsDeviceContextPS::GetDepth(PRUint32& aDepth)
*/ */
NS_IMETHODIMP nsDeviceContextPS::CreateILColorSpace(IL_ColorSpace*& aColorSpace) NS_IMETHODIMP nsDeviceContextPS::CreateILColorSpace(IL_ColorSpace*& aColorSpace)
{ {
nsresult result = NS_OK; return NS_OK;
return result;
} }
/** --------------------------------------------------- /** ---------------------------------------------------
@ -191,7 +184,8 @@ NS_IMETHODIMP nsDeviceContextPS::CreateILColorSpace(IL_ColorSpace*& aColorSpace)
*/ */
NS_IMETHODIMP nsDeviceContextPS::GetILColorSpace(IL_ColorSpace*& aColorSpace) NS_IMETHODIMP nsDeviceContextPS::GetILColorSpace(IL_ColorSpace*& aColorSpace)
{ {
return (mDelContext->GetILColorSpace(aColorSpace)); aColorSpace = nsnull;
return NS_OK;
} }
@ -202,9 +196,8 @@ NS_IMETHODIMP nsDeviceContextPS::GetILColorSpace(IL_ColorSpace*& aColorSpace)
NS_IMETHODIMP nsDeviceContextPS :: CheckFontExistence(const nsString& aFontName) NS_IMETHODIMP nsDeviceContextPS :: CheckFontExistence(const nsString& aFontName)
{ {
return (mDelContext->CheckFontExistence(aFontName)); // XXX this needs to find out if this font is supported for postscript
return NS_OK;
//return NS_OK;
} }
/** --------------------------------------------------- /** ---------------------------------------------------
@ -238,9 +231,8 @@ NS_IMETHODIMP nsDeviceContextPS::BeginDocument(void)
PrintInfo* pi = new PrintInfo(); PrintInfo* pi = new PrintInfo();
PrintSetup* ps = new PrintSetup(); PrintSetup* ps = new PrintSetup();
//XXX:PS Get rid of the need for a MWContext mPrintContext = new PSContext();
mPrintContext = new MWContext(); memset(mPrintContext, 0, sizeof(struct PSContext_));
memset(mPrintContext, 0, sizeof(struct MWContext_));
memset(ps, 0, sizeof(struct PrintSetup_)); memset(ps, 0, sizeof(struct PrintSetup_));
memset(pi, 0, sizeof(struct PrintInfo_)); memset(pi, 0, sizeof(struct PrintInfo_));

Просмотреть файл

@ -26,7 +26,19 @@
#include "nsIRenderingContext.h" #include "nsIRenderingContext.h"
#include "nsPrintManager.h" #include "nsPrintManager.h"
#include "nsVoidArray.h" #include "nsVoidArray.h"
#include "nsPSStructs.h"
extern "C" void xl_begin_document(PSContext *cx);
extern "C" void xl_initialize_translation(PSContext *cx, PrintSetup* ps);
extern "C" void xl_end_document(PSContext *cx);
extern "C" void xl_begin_page(PSContext *cx, int pn);
extern "C" void xl_end_page(PSContext *cx, int pn);
extern "C" void xl_finalize_translation(PSContext *cx);
extern "C" void xl_show(PSContext *cx, char* txt, int len, char *align);
extern "C" void xl_translate(PSContext* cx, int x, int y);
extern "C" void xl_moveto(PSContext* cx, int x, int y);
extern "C" void xl_line(PSContext* cx, int x1, int y1, int x2, int y2, int thick);
extern "C" void xl_box(PSContext* cx, int w, int h);
class nsDeviceContextWin; // need to be a friend of the class using us. class nsDeviceContextWin; // need to be a friend of the class using us.
@ -76,9 +88,8 @@ protected:
nsDrawingSurface mSurface; nsDrawingSurface mSurface;
PRUint32 mDepth; PRUint32 mDepth;
MWContext *mPrintContext; //XXX: Remove need for MWContext PSContext *mPrintContext;
nsIDeviceContextSpec *mSpec; nsIDeviceContextSpec *mSpec;
nsIDeviceContext *mDelContext; // since this is not really a device context, we ned a deligate
PrintSetup *mPrintSetup; PrintSetup *mPrintSetup;
float mPixelScale; float mPixelScale;
nsVoidArray mFontMetrics; // we are not using the normal font cache, this is special for PostScript. nsVoidArray mFontMetrics; // we are not using the normal font cache, this is special for PostScript.
@ -87,7 +98,7 @@ protected:
public: public:
//static bool GetMacFontNumber(const nsString& aFontName, short &fontNum); //static bool GetMacFontNumber(const nsString& aFontName, short &fontNum);
MWContext* GetPrintContext() { return mPrintContext; } PSContext* GetPrintContext() { return mPrintContext; }
public: public:
HDC mDC; HDC mDC;

Просмотреть файл

Просмотреть файл

@ -1,34 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsPrintManager_h___
#define nsPrintManager_h___
#include "xp.h"
#include "structs.h"
#include "xlate.h"
#define NS_LETTER_SIZE 0
#define NS_LEGAL_SIZE 1
#define NS_EXECUTIVE_SIZE 2
#define PAGE_WIDTH 612 // Points
#define PAGE_HEIGHT 792 //Points
#endif
/* nsPSUtil_h___ */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -33,8 +33,9 @@
#include "nsIDeviceContext.h" #include "nsIDeviceContext.h"
#include "nsVoidArray.h" #include "nsVoidArray.h"
#include "nsPrintManager.h" #include "nsPrintManager.h"
#include "nsPSStructs.h"
class GraphicState; class PS_State;
typedef void* nsDrawingSurfacePS; typedef void* nsDrawingSurfacePS;
class nsRenderingContextPS : public nsIRenderingContext class nsRenderingContextPS : public nsIRenderingContext
@ -53,22 +54,11 @@ public:
// nsIPrinterRenderingContext methods // nsIPrinterRenderingContext methods
// Postscript utilities
void PostscriptColor(nscolor aColor);
void PostscriptFillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
void PostscriptDrawBitmap(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight, IL_Pixmap *aImage, IL_Pixmap *aMask);
void PostscriptFont(nscoord aHeight, PRUint8 aStyle,
PRUint8 aVariant, PRUint16 aWeight, PRUint8 decorations);
void PostscriptTextOut(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY, nscoord aWidth,
const nscoord* aSpacing, PRBool aIsUnicode);
protected: protected:
public: public:
// nsIRenderingContext // nsIRenderingContext
NS_IMETHOD Init(nsIDeviceContext* aContext, nsIRenderingContext *aDelRenderingContext); NS_IMETHOD Init(nsIDeviceContext* aContext);
NS_IMETHOD Init(nsIDeviceContext* aContext, nsIWidget *aWidget){return NS_OK;} NS_IMETHOD Init(nsIDeviceContext* aContext, nsIWidget *aWidget){return NS_OK;}
NS_IMETHOD Init(nsIDeviceContext* aContext, nsDrawingSurface aSurface){return NS_OK;} NS_IMETHOD Init(nsIDeviceContext* aContext, nsDrawingSurface aSurface){return NS_OK;}
@ -162,6 +152,41 @@ public:
const nsRect &aDestBounds, PRUint32 aCopyFlags); const nsRect &aDestBounds, PRUint32 aCopyFlags);
// Postscript utilities
/** ---------------------------------------------------
* Set the color of the Postscript to a file set up by the nsDeviceContextPS
* @update 12/21/98 dwc
*/
void PostscriptColor(nscolor aColor);
/** ---------------------------------------------------
* Fill a postscript rectangle to a file set up by the nsDeviceContextPS
* @update 12/21/98 dwc
*/
void PostscriptFillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
/** ---------------------------------------------------
* Render a bitmap in postscript to a file set up by the nsDeviceContextPS
* @update 12/21/98 dwc
*/
void PostscriptDrawBitmap(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight, IL_Pixmap *aImage, IL_Pixmap *aMask);
/** ---------------------------------------------------
* Set the current postscript font
* @update 12/21/98 dwc
*/
void PostscriptFont(nscoord aHeight, PRUint8 aStyle,
PRUint8 aVariant, PRUint16 aWeight, PRUint8 decorations);
/** ---------------------------------------------------
* Output postscript text to a file set up by the nsDeviceContextPS
* @update 12/21/98 dwc
*/
void PostscriptTextOut(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY, nscoord aWidth,
const nscoord* aSpacing, PRBool aIsUnicode);
private: private:
nsresult CommonInit(void); nsresult CommonInit(void);
void SetupFontAndColor(void); void SetupFontAndColor(void);
@ -169,11 +194,17 @@ private:
protected: protected:
nsIDeviceContext *mContext; nsIDeviceContext *mContext;
nsIRenderingContext *mDelRenderingContext; nsIFontMetrics *mFontMetrics;
nsLineStyle mCurrLineStyle;
PS_State *mStates;
nsVoidArray *mStateCache;
nsTransform2D *mTMatrix;
float mP2T;
//state management //state management
PRUint8 *mGammaTable; PRUint8 *mGammaTable;
MWContext *mPrintContext; //XXX: Remove need for MWContext PSContext *mPrintContext; //XXX: Remove need for MWContext
}; };

Просмотреть файл

@ -1,41 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// STOLEN for mozilla/include/libi18n.h
// XXX: Need a real implementation for this
#include "prtypes.h"
#include "structs.h"
void
INTL_CharSetIDToName(int16 csid, char *charset)
{
//XXX: Fill me in with code from mozilla/lib/libi18n
}
/*
** Here's a lovely hack. This routine draws the header or footer for a page.
*/
/* XXX: Added this from print.c */
void
xl_annotate_page(MWContext *cx, char *template, int y, int delta_dir, int pn)
{
}

Просмотреть файл

Просмотреть файл

@ -40,7 +40,7 @@ char* paper_string[]={ "Letter", "Legal", "Executive", "A4" };
** rotation. ** rotation.
*/ */
void xl_initialize_translation(MWContext *cx, PrintSetup* pi) void xl_initialize_translation(PSContext *cx, PrintSetup* pi)
{ {
PrintSetup *dup = XP_NEW(PrintSetup); PrintSetup *dup = XP_NEW(PrintSetup);
*dup = *pi; *dup = *pi;
@ -59,13 +59,13 @@ void xl_initialize_translation(MWContext *cx, PrintSetup* pi)
} }
} }
void xl_finalize_translation(MWContext *cx) void xl_finalize_translation(PSContext *cx)
{ {
XP_DELETE(cx->prSetup); XP_DELETE(cx->prSetup);
cx->prSetup = NULL; cx->prSetup = NULL;
} }
void xl_begin_document(MWContext *cx) void xl_begin_document(PSContext *cx)
{ {
int i; int i;
XP_File f; XP_File f;
@ -208,7 +208,7 @@ void xl_begin_document(MWContext *cx)
XP_FilePrintf(f, "%%%%EndProlog\n"); XP_FilePrintf(f, "%%%%EndProlog\n");
} }
void xl_begin_page(MWContext *cx, int pn) void xl_begin_page(PSContext *cx, int pn)
{ {
XP_File f; XP_File f;
@ -232,7 +232,7 @@ void xl_begin_page(MWContext *cx, int pn)
XP_FilePrintf(f, " closepath clip newpath\n"); XP_FilePrintf(f, " closepath clip newpath\n");
} }
void xl_end_page(MWContext *cx, int pn) void xl_end_page(PSContext *cx, int pn)
{ {
#if 0 #if 0
xl_annotate_page(cx, cx->prSetup->footer, xl_annotate_page(cx, cx->prSetup->footer,
@ -249,12 +249,12 @@ void xl_end_page(MWContext *cx, int pn)
XP_FilePrintf(cx->prSetup->out, "showpage\n"); XP_FilePrintf(cx->prSetup->out, "showpage\n");
} }
void xl_end_document(MWContext *cx) void xl_end_document(PSContext *cx)
{ {
XP_FilePrintf(cx->prSetup->out, "%%%%EOF\n"); XP_FilePrintf(cx->prSetup->out, "%%%%EOF\n");
} }
void xl_moveto(MWContext* cx, int x, int y) void xl_moveto(PSContext* cx, int x, int y)
{ {
XL_SET_NUMERIC_LOCALE(); XL_SET_NUMERIC_LOCALE();
y -= cx->prInfo->page_topy; y -= cx->prInfo->page_topy;
@ -268,7 +268,7 @@ void xl_moveto(MWContext* cx, int x, int y)
XL_RESTORE_NUMERIC_LOCALE(); XL_RESTORE_NUMERIC_LOCALE();
} }
void xl_moveto_loc(MWContext* cx, int x, int y) void xl_moveto_loc(PSContext* cx, int x, int y)
{ {
/* This routine doesn't care about the clip region in the page */ /* This routine doesn't care about the clip region in the page */
@ -284,7 +284,20 @@ void xl_moveto_loc(MWContext* cx, int x, int y)
XL_RESTORE_NUMERIC_LOCALE(); XL_RESTORE_NUMERIC_LOCALE();
} }
void xl_translate(MWContext* cx, int x, int y) void xl_lineto(PSContext* cx, int x1, int y1)
{
XL_SET_NUMERIC_LOCALE();
y1 -= cx->prInfo->page_topy;
y1 = (cx->prInfo->page_height - y1 - 1) + cx->prSetup->bottom;
XP_FilePrintf(cx->prSetup->out, "%g %g lineto\n",
PAGE_TO_POINT_F(x1), PAGE_TO_POINT_F(y1));
XL_RESTORE_NUMERIC_LOCALE();
}
void xl_translate(PSContext* cx, int x, int y)
{ {
XL_SET_NUMERIC_LOCALE(); XL_SET_NUMERIC_LOCALE();
y -= cx->prInfo->page_topy; y -= cx->prInfo->page_topy;
@ -297,7 +310,7 @@ void xl_translate(MWContext* cx, int x, int y)
XL_RESTORE_NUMERIC_LOCALE(); XL_RESTORE_NUMERIC_LOCALE();
} }
void xl_show(MWContext *cx, char* txt, int len, char *align) void xl_show(PSContext *cx, char* txt, int len, char *align)
{ {
XP_File f; XP_File f;
@ -322,14 +335,14 @@ void xl_show(MWContext *cx, char* txt, int len, char *align)
XP_FilePrintf(f, ") %sshow\n", align); XP_FilePrintf(f, ") %sshow\n", align);
} }
void xl_circle(MWContext* cx, int w, int h) void xl_circle(PSContext* cx, int w, int h)
{ {
XL_SET_NUMERIC_LOCALE(); XL_SET_NUMERIC_LOCALE();
XP_FilePrintf(cx->prSetup->out, "%g %g c ", PAGE_TO_POINT_F(w)/2.0, PAGE_TO_POINT_F(h)/2.0); XP_FilePrintf(cx->prSetup->out, "%g %g c ", PAGE_TO_POINT_F(w)/2.0, PAGE_TO_POINT_F(h)/2.0);
XL_RESTORE_NUMERIC_LOCALE(); XL_RESTORE_NUMERIC_LOCALE();
} }
void xl_box(MWContext* cx, int w, int h) void xl_box(PSContext* cx, int w, int h)
{ {
XL_SET_NUMERIC_LOCALE(); XL_SET_NUMERIC_LOCALE();
XP_FilePrintf(cx->prSetup->out, "%g 0 rlineto 0 %g rlineto %g 0 rlineto closepath ", XP_FilePrintf(cx->prSetup->out, "%g 0 rlineto 0 %g rlineto %g 0 rlineto closepath ",
@ -338,7 +351,7 @@ void xl_box(MWContext* cx, int w, int h)
} }
MODULE_PRIVATE void MODULE_PRIVATE void
xl_draw_border(MWContext *cx, int x, int y, int w, int h, int thick) xl_draw_border(PSContext *cx, int x, int y, int w, int h, int thick)
{ {
XL_SET_NUMERIC_LOCALE(); XL_SET_NUMERIC_LOCALE();
XP_FilePrintf(cx->prSetup->out, "gsave %g setlinewidth\n ", XP_FilePrintf(cx->prSetup->out, "gsave %g setlinewidth\n ",
@ -351,7 +364,7 @@ xl_draw_border(MWContext *cx, int x, int y, int w, int h, int thick)
} }
MODULE_PRIVATE void MODULE_PRIVATE void
xl_draw_3d_border(MWContext *cx, int x, int y, int w, int h, int thick, int tl, int br) xl_draw_3d_border(PSContext *cx, int x, int y, int w, int h, int thick, int tl, int br)
{ {
int llx, lly; int llx, lly;
@ -389,7 +402,7 @@ xl_draw_3d_border(MWContext *cx, int x, int y, int w, int h, int thick, int tl,
} }
MODULE_PRIVATE void MODULE_PRIVATE void
xl_draw_3d_radiobox(MWContext *cx, int x, int y, int w, int h, int thick, xl_draw_3d_radiobox(PSContext *cx, int x, int y, int w, int h, int thick,
int top, int bottom, int center) int top, int bottom, int center)
{ {
int lx, ly; int lx, ly;
@ -439,7 +452,7 @@ xl_draw_3d_radiobox(MWContext *cx, int x, int y, int w, int h, int thick,
} }
MODULE_PRIVATE void MODULE_PRIVATE void
xl_draw_3d_checkbox(MWContext *cx, int x, int y, int w, int h, int thick, xl_draw_3d_checkbox(PSContext *cx, int x, int y, int w, int h, int thick,
int tl, int br, int center) int tl, int br, int center)
{ {
int llx, lly; int llx, lly;
@ -488,7 +501,7 @@ xl_draw_3d_checkbox(MWContext *cx, int x, int y, int w, int h, int thick,
XL_RESTORE_NUMERIC_LOCALE(); XL_RESTORE_NUMERIC_LOCALE();
} }
extern void xl_draw_3d_arrow(MWContext *cx, int x , int y, int thick, int w, extern void xl_draw_3d_arrow(PSContext *cx, int x , int y, int thick, int w,
int h, XP_Bool up, int left, int right, int base) int h, XP_Bool up, int left, int right, int base)
{ {
int tx, ty; int tx, ty;
@ -569,7 +582,7 @@ extern void xl_draw_3d_arrow(MWContext *cx, int x , int y, int thick, int w,
XL_RESTORE_NUMERIC_LOCALE(); XL_RESTORE_NUMERIC_LOCALE();
} }
void xl_line(MWContext* cx, int x1, int y1, int x2, int y2, int thick) void xl_line(PSContext* cx, int x1, int y1, int x2, int y2, int thick)
{ {
XL_SET_NUMERIC_LOCALE(); XL_SET_NUMERIC_LOCALE();
XP_FilePrintf(cx->prSetup->out, "gsave %g setlinewidth\n ", XP_FilePrintf(cx->prSetup->out, "gsave %g setlinewidth\n ",
@ -589,12 +602,12 @@ void xl_line(MWContext* cx, int x1, int y1, int x2, int y2, int thick)
XL_RESTORE_NUMERIC_LOCALE(); XL_RESTORE_NUMERIC_LOCALE();
} }
void xl_stroke(MWContext *cx) void xl_stroke(PSContext *cx)
{ {
XP_FilePrintf(cx->prSetup->out, " stroke \n"); XP_FilePrintf(cx->prSetup->out, " stroke \n");
} }
void xl_fill(MWContext *cx) void xl_fill(PSContext *cx)
{ {
XP_FilePrintf(cx->prSetup->out, " fill \n"); XP_FilePrintf(cx->prSetup->out, " fill \n");
} }
@ -615,7 +628,7 @@ void xl_fill(MWContext *cx)
** + It should squish the image if squishing is currently in effect. ** + It should squish the image if squishing is currently in effect.
*/ */
void xl_colorimage(MWContext *cx, int x, int y, int w, int h, IL_Pixmap *image, void xl_colorimage(PSContext *cx, int x, int y, int w, int h, IL_Pixmap *image,
IL_Pixmap *mask) IL_Pixmap *mask)
{ {
uint8 pixmap_depth; uint8 pixmap_depth;
@ -738,7 +751,7 @@ void xl_colorimage(MWContext *cx, int x, int y, int w, int h, IL_Pixmap *image,
} }
MODULE_PRIVATE void MODULE_PRIVATE void
xl_begin_squished_text(MWContext *cx, float scale) xl_begin_squished_text(PSContext *cx, float scale)
{ {
XL_SET_NUMERIC_LOCALE(); XL_SET_NUMERIC_LOCALE();
XP_FilePrintf(cx->prSetup->out, "gsave %g 1 scale\n", scale); XP_FilePrintf(cx->prSetup->out, "gsave %g 1 scale\n", scale);
@ -746,7 +759,7 @@ xl_begin_squished_text(MWContext *cx, float scale)
} }
MODULE_PRIVATE void MODULE_PRIVATE void
xl_end_squished_text(MWContext *cx) xl_end_squished_text(PSContext *cx)
{ {
XP_FilePrintf(cx->prSetup->out, "grestore\n"); XP_FilePrintf(cx->prSetup->out, "grestore\n");
} }

Просмотреть файл

Просмотреть файл

@ -16,52 +16,45 @@
* Reserved. * Reserved.
*/ */
#define M12N //#define M12N
#include "xp.h" #include "xp.h"
#include "xlate.h" #include "xlate.h"
#include "nsPSStructs.h"
#define MAKE_FE_FUNCS_PREFIX(f) TXFE_##f
#define MAKE_FE_FUNCS_EXTERN
#include "mk_cx_fn.h"
extern PS_FontInfo *PSFE_MaskToFI[N_FONTS]; extern PS_FontInfo *PSFE_MaskToFI[N_FONTS];
#define LINE_WIDTH 160 #define LINE_WIDTH 160
#define TEXT_WIDTH 8 #define TEXT_WIDTH 8
#define TEXT_HEIGHT 16 #define TEXT_HEIGHT 16
#define MAKE_FE_FUNCS_PREFIX(f) PSFE_##f // this should be in the devicecontext now.
#define MAKE_FE_FUNCS_EXTERN extern void xl_begin_document(PSContext*);
#include "mk_cx_fn.h" extern void xl_begin_page(PSContext*,int);
extern void xl_end_page(PSContext*,int);
extern void xl_end_document(PSContext*);
extern void xl_show(PSContext *cx, char* txt, int len, char*);
extern void xl_moveto(PSContext* cx, int x, int y);
extern void xl_moveto_loc(PSContext* cx, int x, int y);
extern void xl_lineto(PSContext* cx, int x1, int y1);
extern void xl_circle(PSContext* cx, int w, int h);
extern void xl_box(PSContext* cx, int w, int h);
extern void xl_line(PSContext* cx, int x1, int y1, int x2, int y2, int thick);
extern void xl_stroke(PSContext*);
extern void xl_fill(PSContext*);
extern void xl_colorimage(PSContext *cx, int x, int y, int w, int h,IL_Pixmap *image, IL_Pixmap *mask);
extern void xl_begin_squished_text(PSContext*, float);
extern void xl_end_squished_text(PSContext*);
extern void xl_initialize_translation(PSContext*, PrintSetup*);
extern void xl_finalize_translation(PSContext*);
extern void xl_annotate_page(PSContext*, char*, int, int, int);
extern void xl_draw_border(PSContext *, int , int , int , int , int );
extern void xl_draw_3d_border(PSContext *, int , int , int , int , int, int tl, int br );
extern void xl_draw_3d_radiobox(PSContext *, int , int , int , int , int, int t, int b, int c);
extern void xl_draw_3d_checkbox(PSContext *, int , int , int , int , int, int tl, int br, int c);
extern void xl_draw_3d_arrow(PSContext *, int, int, int, int, int, XP_Bool, int, int, int);
extern XP_Bool xl_item_span(PSContext* cx, int top, int bottom);
extern void xl_begin_document(MWContext*); extern XP_Bool psfe_init_image_callbacks(PSContext *cx);
extern void xl_begin_page(MWContext*,int);
extern void xl_end_page(MWContext*,int);
extern void xl_end_document(MWContext*);
extern void xl_show(MWContext *cx, char* txt, int len, char*);
extern void xl_moveto(MWContext* cx, int x, int y);
extern void xl_moveto_loc(MWContext* cx, int x, int y);
extern void xl_circle(MWContext* cx, int w, int h);
extern void xl_box(MWContext* cx, int w, int h);
extern void xl_line(MWContext* cx, int x1, int y1, int x2, int y2, int thick);
extern void xl_stroke(MWContext*);
extern void xl_fill(MWContext*);
extern void xl_colorimage(MWContext *cx, int x, int y, int w, int h,
IL_Pixmap *image, IL_Pixmap *mask);
extern void xl_begin_squished_text(MWContext*, float);
extern void xl_end_squished_text(MWContext*);
extern void xl_initialize_translation(MWContext*, PrintSetup*);
extern void xl_finalize_translation(MWContext*);
extern void xl_annotate_page(MWContext*, char*, int, int, int);
extern void xl_draw_border(MWContext *, int , int , int , int , int );
extern void xl_draw_3d_border(MWContext *, int , int , int , int , int, int tl, int br );
extern void xl_draw_3d_radiobox(MWContext *, int , int , int , int , int, int t, int b, int c);
extern void xl_draw_3d_checkbox(MWContext *, int , int , int , int , int, int tl, int br, int c);
extern void xl_draw_3d_arrow(MWContext *, int, int, int, int, int, XP_Bool, int, int, int);
extern XP_Bool xl_item_span(MWContext* cx, int top, int bottom);
extern XP_Bool psfe_init_image_callbacks(MWContext *cx);
struct LineRecord_struct; struct LineRecord_struct;