//-------------------------------------------------------------------------------
-#if wxUSE_NEW_DC
-
IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC)
wxPostScriptDC::wxPostScriptDC()
+ : wxDC(new wxPostScriptDCImpl(this))
{
- m_pimpl = new wxPostScriptDCImpl( this );
}
wxPostScriptDC::wxPostScriptDC(const wxPrintData& printData)
+ : wxDC(new wxPostScriptDCImpl(this, printData))
{
- m_pimpl = new wxPostScriptDCImpl( this, printData );
}
-#endif
-
-
// conversion
static const double RAD2DEG = 180.0 / M_PI;
#define YLOG2DEVREL(x) ((double)(LogicalToDeviceYRel(x)) * DEV2PS)
-#if wxUSE_NEW_DC
IMPLEMENT_ABSTRACT_CLASS(wxPostScriptDCImpl, wxDCImpl)
-#else
-IMPLEMENT_ABSTRACT_CLASS(wxPostScriptDC, wxDC)
-#endif
//-------------------------------------------------------------------------------
-#if wxUSE_NEW_DC
wxPostScriptDCImpl::wxPostScriptDCImpl( wxPostScriptDC *owner ) :
wxDCImpl( owner )
{
Init();
m_pageHeight = 842 * PS2DEV;
-
+
m_ok = true;
}
wxDCImpl( owner )
{
Init();
-
+
// this calculates m_pageHeight required for
// taking the inverted Y axis into account
SetPrintData( data );
m_ok = true;
}
-#endif
-#if wxUSE_NEW_DC
wxPostScriptDCImpl::wxPostScriptDCImpl( wxPrinterDC *owner ) :
wxDCImpl( owner )
-#else
-wxPostScriptDC::wxPostScriptDC()
-#endif
{
Init();
m_pageHeight = 842 * PS2DEV;
-
+
m_ok = true;
}
-#if wxUSE_NEW_DC
wxPostScriptDCImpl::wxPostScriptDCImpl( wxPrinterDC *owner, const wxPrintData& data ) :
wxDCImpl( owner )
-#else
-wxPostScriptDC::wxPostScriptDC( const wxPrintData& data )
-#endif
{
Init();
-
+
// this calculates m_pageHeight required for
// taking the inverted Y axis into account
SetPrintData( data );
if (m_clipping)
DestroyClippingRegion();
-#if wxUSE_NEW_DC
m_clipX1 = x;
m_clipY1 = y;
m_clipX2 = x + w;
m_clipY2 = y + h;
-#else
- wxDC::DoSetClippingRegion(x, y, w, h);
-#endif
m_clipping = true;
PsPrint( "grestore\n" );
}
-#if wxUSE_NEW_DC
wxDCImpl::DestroyClippingRegion();
-#else
- wxDC::DestroyClippingRegion();
-#endif
}
void wxPostScriptDCImpl::Clear()
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
- if (m_pen.GetStyle() == wxTRANSPARENT) return;
+ if (m_pen.GetStyle() == wxPENSTYLE_TRANSPARENT) return;
SetPen( m_pen );
int i_radius = wxRound( radius );
- if (m_brush.GetStyle() != wxTRANSPARENT)
+ if (m_brush.GetStyle() != wxBRUSHSTYLE_TRANSPARENT)
{
SetBrush( m_brush );
CalcBoundingBox( xc+i_radius, yc+i_radius );
}
- if (m_pen.GetStyle() != wxTRANSPARENT)
+ if (m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT)
{
SetPen( m_pen );
return;
}
- if (m_brush.GetStyle () != wxTRANSPARENT)
+ if (m_brush.GetStyle () != wxBRUSHSTYLE_TRANSPARENT)
{
SetBrush( m_brush );
CalcBoundingBox( x+w, y+h );
}
- if (m_pen.GetStyle () != wxTRANSPARENT)
+ if (m_pen.GetStyle () != wxPENSTYLE_TRANSPARENT)
{
SetPen( m_pen );
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
- if (m_pen.GetStyle() == wxTRANSPARENT) return;
+ if (m_pen.GetStyle() == wxPENSTYLE_TRANSPARENT) return;
SetPen (m_pen);
if (n <= 0) return;
- if (m_brush.GetStyle () != wxTRANSPARENT)
+ if (m_brush.GetStyle () != wxBRUSHSTYLE_TRANSPARENT)
{
SetBrush( m_brush );
PsPrint( (fillStyle == wxODDEVEN_RULE ? "eofill\n" : "fill\n") );
}
- if (m_pen.GetStyle () != wxTRANSPARENT)
+ if (m_pen.GetStyle () != wxPENSTYLE_TRANSPARENT)
{
SetPen( m_pen );
if (n <= 0) return;
- if (m_brush.GetStyle () != wxTRANSPARENT)
+ if (m_brush.GetStyle () != wxBRUSHSTYLE_TRANSPARENT)
{
SetBrush( m_brush );
PsPrint( (fillStyle == wxODDEVEN_RULE ? "eofill\n" : "fill\n") );
}
- if (m_pen.GetStyle () != wxTRANSPARENT)
+ if (m_pen.GetStyle () != wxPENSTYLE_TRANSPARENT)
{
SetPen( m_pen );
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
- if (m_pen.GetStyle() == wxTRANSPARENT) return;
+ if (m_pen.GetStyle() == wxPENSTYLE_TRANSPARENT) return;
if (n <= 0) return;
width--;
height--;
- if (m_brush.GetStyle () != wxTRANSPARENT)
+ if (m_brush.GetStyle () != wxBRUSHSTYLE_TRANSPARENT)
{
SetBrush( m_brush );
CalcBoundingBox( x + width, y + height );
}
- if (m_pen.GetStyle () != wxTRANSPARENT)
+ if (m_pen.GetStyle () != wxPENSTYLE_TRANSPARENT)
{
SetPen (m_pen);
wxCoord rad = (wxCoord) radius;
- if (m_brush.GetStyle () != wxTRANSPARENT)
+ if (m_brush.GetStyle () != wxBRUSHSTYLE_TRANSPARENT)
{
SetBrush( m_brush );
CalcBoundingBox( x + width, y + height );
}
- if (m_pen.GetStyle () != wxTRANSPARENT)
+ if (m_pen.GetStyle () != wxPENSTYLE_TRANSPARENT)
{
SetPen (m_pen);
width--;
height--;
- if (m_brush.GetStyle () != wxTRANSPARENT)
+ if (m_brush.GetStyle () != wxBRUSHSTYLE_TRANSPARENT)
{
SetBrush (m_brush);
CalcBoundingBox( x + width, y + height );
}
- if (m_pen.GetStyle () != wxTRANSPARENT)
+ if (m_pen.GetStyle () != wxPENSTYLE_TRANSPARENT)
{
SetPen (m_pen);
switch (m_pen.GetStyle())
{
- case wxDOT: psdash = dotted; break;
- case wxSHORT_DASH: psdash = short_dashed; break;
- case wxLONG_DASH: psdash = wxCoord_dashed; break;
- case wxDOT_DASH: psdash = dotted_dashed; break;
- case wxUSER_DASH:
+ case wxPENSTYLE_DOT: psdash = dotted; break;
+ case wxPENSTYLE_SHORT_DASH: psdash = short_dashed; break;
+ case wxPENSTYLE_LONG_DASH: psdash = wxCoord_dashed; break;
+ case wxPENSTYLE_DOT_DASH: psdash = dotted_dashed; break;
+ case wxPENSTYLE_USER_DASH:
{
wxDash *dashes;
int nDashes = m_pen.GetDashes (&dashes);
psdash = 0;
}
break;
- case wxSOLID:
- case wxTRANSPARENT:
+ case wxPENSTYLE_SOLID:
+ case wxPENSTYLE_TRANSPARENT:
default: psdash = "[] 0"; break;
}
PsPrint( buffer );
PsPrint( "(" );
- size_t len = strlen(textbuf);
- size_t i;
- for (i = 0; i < len; i++)
+ for ( const char *p = textbuf; *p != '\0'; p++ )
{
- int c = (unsigned char) textbuf[i];
+ int c = (unsigned char)*p;
if (c == ')' || c == '(' || c == '\\')
{
/* Cope with special characters */
PsPrint( "(" );
const wxWX2MBbuf textbuf = text.mb_str();
- size_t len = strlen(textbuf);
- size_t i;
- for (i = 0; i < len; i++)
+ if ( textbuf )
{
- int c = (unsigned char) textbuf[i];
- if (c == ')' || c == '(' || c == '\\')
- {
- /* Cope with special characters */
- PsPrint( "\\" );
- PsPrint( (char) c );
- }
- else if ( c >= 128 )
- {
- /* Cope with character codes > 127 */
- buffer.Printf( "\\%o", c);
- PsPrint( buffer );
- }
- else
+ for ( const char *p = textbuf; *p != '\0'; p++ )
{
- PsPrint( (char) c );
+ int c = (unsigned char)*p;
+ if (c == ')' || c == '(' || c == '\\')
+ {
+ /* Cope with special characters */
+ PsPrint( "\\" );
+ PsPrint( (char) c );
+ }
+ else if ( c >= 128 )
+ {
+ /* Cope with character codes > 127 */
+ buffer.Printf( "\\%o", c);
+ PsPrint( buffer );
+ }
+ else
+ {
+ PsPrint( (char) c );
+ }
}
}
m_pageHeight = h * PS2DEV;
}
-#if wxUSE_NEW_DC
-#else
-void wxPostScriptDCImpl::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
-{
- wxDCBase::SetAxisOrientation(xLeftRight,yBottomUp);
-}
-
-void wxPostScriptDCImpl::SetMapMode(int mode)
-{
- wxDCBase::SetMapMode(mode);
-}
-
-void wxPostScriptDCImpl::SetUserScale(double x, double y)
-{
- wxDCBase::SetUserScale(x,y);
-}
-
-void wxPostScriptDCImpl::SetLogicalScale(double x, double y)
-{
- wxDCBase::SetLogicalScale(x,y);
-}
-
-void wxPostScriptDCImpl::SetLogicalOrigin(wxCoord x, wxCoord y)
-{
- wxDCBase::SetLogicalOrigin(x,y);
-}
-
-void wxPostScriptDCImpl::SetDeviceOrigin(wxCoord x, wxCoord y)
-{
- wxDCBase::SetDeviceOrigin(x,y);
-}
-#endif
-
void wxPostScriptDCImpl::ComputeScaleAndOrigin()
{
const wxRealPoint origScale(m_scaleX, m_scaleY);
-#if wxUSE_NEW_DC
wxDCImpl::ComputeScaleAndOrigin();
-#else
- wxDC::ComputeScaleAndOrigin();
-#endif
// If scale has changed call SetPen to recalulate the line width
// and SetFont to recalculate font size
/ these values from AFM files, too. Maybe later ... */
// NB: casts to int are needed to suppress gcc 3.3 warnings
- lastWidths[196] = lastWidths[(int)'A']; // Ä
- lastWidths[228] = lastWidths[(int)'a']; // ä
- lastWidths[214] = lastWidths[(int)'O']; // Ö
- lastWidths[246] = lastWidths[(int)'o']; // ö
- lastWidths[220] = lastWidths[(int)'U']; // Ü
- lastWidths[252] = lastWidths[(int)'u']; // ü
- lastWidths[223] = lastWidths[(int)251]; // ß
+ lastWidths[196] = lastWidths[(int)'A']; // U+00C4 A Umlaute
+ lastWidths[228] = lastWidths[(int)'a']; // U+00E4 a Umlaute
+ lastWidths[214] = lastWidths[(int)'O']; // U+00D6 O Umlaute
+ lastWidths[246] = lastWidths[(int)'o']; // U+00F6 o Umlaute
+ lastWidths[220] = lastWidths[(int)'U']; // U+00DC U Umlaute
+ lastWidths[252] = lastWidths[(int)'u']; // U+00FC u Umlaute
+ lastWidths[223] = lastWidths[(int)251]; // U+00DF eszett (scharfes s)
/* JC: calculate UnderlineThickness/UnderlinePosition */