New PostScript code

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1112 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-12-05 21:02:04 +00:00
parent b749747d9d
commit ed880dd448
12 changed files with 5359 additions and 17 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+14 -1
View File
@@ -9,6 +9,12 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __WXGTK__
#include "wx/gtk/dcps.h"
#else
#ifndef _WX_POSTSCRPH__
#define _WX_POSTSCRPH__
@@ -308,6 +314,13 @@ private:
WXDLLEXPORT_DATA(extern wxPrintPaperDatabase*) wxThePrintPaperDatabase;
#endif // wxUSE_POSTSCRIPT
#endif
// wxUSE_POSTSCRIPT
#endif
// _WX_POSTSCRPH__
#endif
// __WXGTK__
+6 -3
View File
@@ -383,6 +383,7 @@ bool MyPrintout::OnPrintPage(int page)
DrawPageTwo(dc);
dc->SetDeviceOrigin(0, 0);
dc->SetUserScale(1.0, 1.0);
char buf[200];
sprintf(buf, "PAGE %d", page);
@@ -499,8 +500,8 @@ void MyPrintout::DrawPageTwo(wxDC *dc)
float logUnitsFactor = (float)(ppiPrinterX/(scale*25.1));
float logUnits = (float)(50*logUnitsFactor);
dc->SetPen(* wxBLACK_PEN);
dc->DrawLine(50, 50, (long)(50.0 + logUnits), 50);
dc->DrawLine(50, 50, 50, (long)(50.0 + logUnits));
dc->DrawLine(50, 250, (long)(50.0 + logUnits), 250);
dc->DrawLine(50, 250, 50, (long)(250.0 + logUnits));
dc->SetFont(* wxGetApp().m_testFont);
dc->SetBackgroundMode(wxTRANSPARENT);
@@ -522,7 +523,7 @@ void MyPrintout::DrawPageTwo(wxDC *dc)
float bottomMarginLogical = (float)(logUnitsFactor*(pageHeightMM - bottomMargin));
float rightMarginLogical = (float)(logUnitsFactor*(pageWidthMM - rightMargin));
dc->SetPen(wxBLACK_PEN);
dc->SetPen(wxRED_PEN);
dc->DrawLine( (long)leftMarginLogical, (long)topMarginLogical,
(long)rightMarginLogical, (long)topMarginLogical);
dc->DrawLine( (long)leftMarginLogical, (long)bottomMarginLogical,
@@ -534,12 +535,14 @@ void MyPrintout::DrawPageTwo(wxDC *dc)
// Writes a header on a page. Margin units are in millimetres.
bool WritePageHeader(wxPrintout *printout, wxDC *dc, char *text, float mmToLogical)
{
/*
static wxFont *headerFont = (wxFont *) NULL;
if (!headerFont)
{
headerFont = wxTheFontList->FindOrCreateFont(16, wxSWISS, wxNORMAL, wxBOLD);
}
dc->SetFont(headerFont);
*/
int pageWidthMM, pageHeightMM;
+9
View File
@@ -2594,6 +2594,15 @@ void wxPrintPaperDatabase::CreateDatabase()
AddPaperType(_("A3 297 x 420 mm"), 297, 420, 842, 1191);
AddPaperType(_("Letter 8 1/2 x 11 in"), 216, 279, 612, 791);
AddPaperType(_("Legal 8 1/2 x 14 in"), 216, 356, 612, 1009);
/*
This is for 100 ppi
AddPaperType(_("A4 210 x 297 mm"), 210, 297, 210*4, 297*4 );
AddPaperType(_("A3 297 x 420 mm"), 297, 420, 297*4, 420*4 );
AddPaperType(_("Letter 8 1/2 x 11 in"), 216, 279, 216*4, 279*4 );
AddPaperType(_("Legal 8 1/2 x 14 in"), 216, 356, 216*4, 356*4 );
*/
}
void wxPrintPaperDatabase::ClearDatabase()
+2 -2
View File
@@ -708,7 +708,7 @@ bool wxPrintPreviewBase::DrawBlankPage(wxWindow *canvas, wxDC& dc)
/*
dc.DrawRectangle((int)(x-1 + shadowOffset), (int)(y-1 + shadowOffset), (int)(actualWidth+2), (int)(actualHeight+2));
*/
dc.DrawRectangle((int)(x + shadowOffset), (int)(y + actualHeight), (int)(actualWidth), shadowOffset);
dc.DrawRectangle((int)(x + shadowOffset), (int)(y + actualHeight+1), (int)(actualWidth), shadowOffset);
dc.DrawRectangle((int)(x + actualWidth), (int)(y + shadowOffset), shadowOffset, (int)(actualHeight));
// Draw blank page allowing for 1-pixel border AROUND the actual page
@@ -722,7 +722,7 @@ bool wxPrintPreviewBase::DrawBlankPage(wxWindow *canvas, wxDC& dc)
printf( "x: %d y: %d w: %d h: %d.\n", (int)r.x, (int)r.y, (int)r.width, (int)r.height );
*/
dc.DrawRectangle((int)(x-1), (int)(y-1), (int)(actualWidth+2), (int)(actualHeight+2));
dc.DrawRectangle((int)(x-2), (int)(y-1), (int)(actualWidth+3), (int)(actualHeight+2));
return TRUE;
}
+9 -2
View File
@@ -124,11 +124,17 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
int logPPIPrinterX = 0;
int logPPIPrinterY = 0;
// Correct values for X/PostScript?
logPPIScreenX = 100;
logPPIScreenY = 100;
/*
// Correct values for X/PostScript?
logPPIPrinterX = 100;
logPPIPrinterY = 100;
*/
logPPIPrinterX = 72;
logPPIPrinterY = 72;
printout->SetPPIScreen(logPPIScreenX, logPPIScreenY);
printout->SetPPIPrinter(logPPIPrinterX, logPPIPrinterY);
@@ -238,7 +244,8 @@ void wxPostScriptPrintPreview::DetermineScaling(void)
if (paper)
{
m_previewPrintout->SetPPIScreen(100, 100);
m_previewPrintout->SetPPIPrinter(100, 100);
// m_previewPrintout->SetPPIPrinter(100, 100);
m_previewPrintout->SetPPIPrinter(72, 72);
// If in landscape mode, we need to swap the width and height.
if ( m_printData.GetOrientation() == wxLANDSCAPE )
+1 -1
View File
@@ -35,7 +35,6 @@ LIB_CPP_SRC=\
common/module.cpp \
common/object.cpp \
common/odbc.cpp \
common/postscrp.cpp \
common/prntbase.cpp \
common/resource.cpp \
common/serbase.cpp \
@@ -83,6 +82,7 @@ LIB_CPP_SRC=\
gtk/dc.cpp \
gtk/dcclient.cpp \
gtk/dcmemory.cpp \
gtk/dcps.cpp \
gtk/dcscreen.cpp \
gtk/dnd.cpp \
gtk/dialog.cpp \
+4 -4
View File
@@ -143,10 +143,10 @@ void wxWindowDC::DrawLine( long x1, long y1, long x2, long y2 )
{
gdk_draw_line( m_window, m_penGC,
XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) );
CalcBoundingBox(x1, y1);
CalcBoundingBox(x2, y2);
}
CalcBoundingBox(x1, y1);
CalcBoundingBox(x2, y2);
}
void wxWindowDC::CrossHair( long x, long y )
@@ -487,7 +487,7 @@ void wxWindowDC::DrawEllipse( long x, long y, long width, long height )
if (m_pen.GetStyle() != wxTRANSPARENT)
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, 0, 360*64 );
CalcBoundingBox( x, y );
CalcBoundingBox( x - width, y - height );
CalcBoundingBox( x + width, y + height );
}
+2309
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -143,10 +143,10 @@ void wxWindowDC::DrawLine( long x1, long y1, long x2, long y2 )
{
gdk_draw_line( m_window, m_penGC,
XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) );
CalcBoundingBox(x1, y1);
CalcBoundingBox(x2, y2);
}
CalcBoundingBox(x1, y1);
CalcBoundingBox(x2, y2);
}
void wxWindowDC::CrossHair( long x, long y )
@@ -487,7 +487,7 @@ void wxWindowDC::DrawEllipse( long x, long y, long width, long height )
if (m_pen.GetStyle() != wxTRANSPARENT)
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, 0, 360*64 );
CalcBoundingBox( x, y );
CalcBoundingBox( x - width, y - height );
CalcBoundingBox( x + width, y + height );
}
+2309
View File
File diff suppressed because it is too large Load Diff