m_signY = -1; // default y-axis bottom up -> top down
m_printData = printData;
+
+ m_ok = TRUE;
}
wxPostScriptDC::~wxPostScriptDC ()
wxFAIL_MSG( _T("wxPostScriptDC::Clear not implemented.") );
}
-void wxPostScriptDC::FloodFill (long WXUNUSED(x), long WXUNUSED(y), const wxColour &WXUNUSED(col), int WXUNUSED(style))
+void wxPostScriptDC::DoFloodFill (long WXUNUSED(x), long WXUNUSED(y), const wxColour &WXUNUSED(col), int WXUNUSED(style))
{
wxFAIL_MSG( _T("wxPostScriptDC::FloodFill not implemented.") );
}
-bool wxPostScriptDC::GetPixel (long WXUNUSED(x), long WXUNUSED(y), wxColour * WXUNUSED(col)) const
+bool wxPostScriptDC::DoGetPixel (long WXUNUSED(x), long WXUNUSED(y), wxColour * WXUNUSED(col)) const
{
wxFAIL_MSG( _T("wxPostScriptDC::GetPixel not implemented.") );
return FALSE;
}
-void wxPostScriptDC::CrossHair (long WXUNUSED(x), long WXUNUSED(y))
+void wxPostScriptDC::DoCrossHair (long WXUNUSED(x), long WXUNUSED(y))
{
wxFAIL_MSG( _T("wxPostScriptDC::CrossHair not implemented.") );
}
-void wxPostScriptDC::DrawLine (long x1, long y1, long x2, long y2)
+void wxPostScriptDC::DoDrawLine (long x1, long y1, long x2, long y2)
{
wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
#define RAD2DEG 57.29577951308
-void wxPostScriptDC::DrawArc (long x1, long y1, long x2, long y2, long xc, long yc)
+void wxPostScriptDC::DoDrawArc (long x1, long y1, long x2, long y2, long xc, long yc)
{
wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
CalcBoundingBox( xc+radius, yc+radius );
}
-void wxPostScriptDC::DrawEllipticArc(long x,long y,long w,long h,double sa,double ea)
+void wxPostScriptDC::DoDrawEllipticArc(long x,long y,long w,long h,double sa,double ea)
{
wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
}
}
-void wxPostScriptDC::DrawPoint (long x, long y)
+void wxPostScriptDC::DoDrawPoint (long x, long y)
{
wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
CalcBoundingBox( x, y );
}
-void wxPostScriptDC::DrawPolygon (int n, wxPoint points[], long xoffset, long yoffset, int WXUNUSED(fillStyle))
+void wxPostScriptDC::DoDrawPolygon (int n, wxPoint points[], long xoffset, long yoffset, int WXUNUSED(fillStyle))
{
wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
}
}
-void wxPostScriptDC::DrawLines (int n, wxPoint points[], long xoffset, long yoffset)
+void wxPostScriptDC::DoDrawLines (int n, wxPoint points[], long xoffset, long yoffset)
{
wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
*m_pstream << "stroke\n";
}
-void wxPostScriptDC::DrawRectangle (long x, long y, long width, long height)
+void wxPostScriptDC::DoDrawRectangle (long x, long y, long width, long height)
{
wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
}
}
-void wxPostScriptDC::DrawRoundedRectangle (long x, long y, long width, long height, double radius)
+void wxPostScriptDC::DoDrawRoundedRectangle (long x, long y, long width, long height, double radius)
{
wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
}
}
-void wxPostScriptDC::DrawEllipse (long x, long y, long width, long height)
+void wxPostScriptDC::DoDrawEllipse (long x, long y, long width, long height)
{
wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
}
}
-void wxPostScriptDC::DrawIcon( const wxIcon& icon, long x, long y )
+void wxPostScriptDC::DoDrawIcon( const wxIcon& icon, long x, long y )
{
DrawBitmap( icon, x, y, TRUE );
}
-void wxPostScriptDC::DrawBitmap( const wxBitmap& bitmap, long x, long y, bool WXUNUSED(useMask) )
+void wxPostScriptDC::DoDrawBitmap( const wxBitmap& bitmap, long x, long y, bool WXUNUSED(useMask) )
{
wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
}
}
-void wxPostScriptDC::DrawText( const wxString& text, long x, long y, bool WXUNUSED(use16bit) )
+void wxPostScriptDC::DoDrawText( const wxString& text, long x, long y )
{
wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
*m_pstream << XLOG2DEV(x) << " " << YLOG2DEV(by) << " moveto\n";
*m_pstream << "(";
- wxWX2MBbuf textbuf = text.mb_str();
+ const wxWX2MBbuf textbuf = text.mb_str();
int len = strlen (textbuf);
int i;
for (i = 0; i < len; i++)
wxFAIL_MSG( _T("wxPostScriptDC::SetLogicalFunction not implemented.") );
}
-void wxPostScriptDC::DrawSpline( wxList *points )
+void wxPostScriptDC::DoDrawSpline( wxList *points )
{
wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
*m_pstream << XLOG2DEV((long)c) << " " << YLOG2DEV((long)d) << " lineto stroke\n";
}
-long wxPostScriptDC::GetCharWidth ()
+long wxPostScriptDC::GetCharWidth() const
{
// Chris Breeze: reasonable approximation using wxMODERN/Courier
return (long) (GetCharHeight() * 72.0 / 120.0);
wxDC::SetDeviceOrigin( x, h-y );
}
-void wxPostScriptDC::GetSize(int* width, int* height) const
+void wxPostScriptDC::DoGetSize(int* width, int* height) const
{
wxPaperSize id = m_printData.GetPaperId();
}
}
-void wxPostScriptDC::GetSizeMM(int *width, int *height) const
+void wxPostScriptDC::DoGetSizeMM(int *width, int *height) const
{
wxPaperSize id = m_printData.GetPaperId();
*m_pstream << "%!PS-Adobe-2.0\n"; /* PostScript magic strings */
*m_pstream << "%%Title: " << m_title.mb_str() << "\n";
*m_pstream << "%%Creator: " << wxTheApp->argv[0] << "\n";
- *m_pstream << "%%CreationDate: " << wxNow() << "\n";
+ *m_pstream << "%%CreationDate: " << wxNow().mb_str() << "\n";
wxChar userID[256];
if ( wxGetEmailAddress(userID, sizeof(userID)) )
*m_pstream << "showpage\n";
}
-bool wxPostScriptDC::Blit( long xdest, long ydest,
+bool wxPostScriptDC::DoBlit( long xdest, long ydest,
long fwidth, long fheight,
wxDC *source,
long xsrc, long ysrc,
return TRUE;
}
-long wxPostScriptDC::GetCharHeight()
+long wxPostScriptDC::GetCharHeight() const
{
if (m_font.Ok())
return m_font.GetPointSize();
}
void wxPostScriptDC::GetTextExtent( const wxString& string, long *x, long *y,
- long *descent, long *externalLeading, wxFont *theFont,
- bool WXUNUSED(use16) )
+ long *descent, long *externalLeading, wxFont *theFont ) const
{
wxFont *fontToUse = theFont;
wxCHECK_RET( x, _T("GetTextExtent: x == NULL") );
wxCHECK_RET( y, _T("GetTextExtent: y == NULL") );
- wxWX2MBbuf strbuf = string.mb_str();
+ const wxWX2MBbuf strbuf = string.mb_str();
#if !USE_AFM_FOR_POSTSCRIPT
/* Provide a VERY rough estimate (avoid using it).
/* get the directory of the AFM files */
char afmName[256];
afmName[0] = 0;
- wxString fmPath(m_printData.GetFontMetricPath());
- if (fmPath != "") strcpy( afmName, (const char*) fmPath );
+
+ if (!m_printData.GetFontMetricPath().IsEmpty())
+ {
+ strcpy( afmName, m_printData.GetFontMetricPath().mb_str() )
+ }
/* 2. open and process the file
/ a short explanation of the AFM format:
strcat(afmName,name);
strcat(afmName,".afm");
FILE *afmFile = fopen(afmName,"r");
- if ( afmFile==NULL )
+
+#ifdef __UNIX__
+ if (afmFile==NULL)
+ {
+ strcpy( afmName, "/usr/local/share/wx/gs_afm/" );
+ strcat(afmName,name);
+ strcat(afmName,".afm");
+ FILE *afmFile = fopen(afmName,"r");
+ }
+
+ if (afmFile==NULL)
+ {
+ strcpy( afmName, "/usr/share/wx/gs_afm/" );
+ strcat(afmName,name);
+ strcat(afmName,".afm");
+ FILE *afmFile = fopen(afmName,"r");
+ }
+#endif
+
+ if (afmFile==NULL)
{
wxLogDebug( "GetTextExtent: can't open AFM file '%s'\n", afmName );
wxLogDebug( " using approximate values\n");