X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/01b5396fcee869baf17192225451c9e310fe53c2..488b2c29c0cf468f96f148003b21952611325dbf:/src/generic/dcpsg.cpp diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index f59a161f7a..e2ad7059e1 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -39,8 +39,7 @@ #include "wx/generic/prntdlgg.h" #include "wx/paper.h" #include "wx/filefn.h" - -#include +#include "wx/math.h" #ifdef __WXMSW__ @@ -745,7 +744,7 @@ void wxPostScriptDC::DoDrawRoundedRectangle (wxCoord x, wxCoord y, wxCoord width /* Draw rectangle anticlockwise */ PsPrintf( wxT("newpath\n") wxT("%d %d %d 90 180 arc\n") - wxT("%d %d moveto\n") + wxT("%d %d lineto\n") wxT("%d %d %d 180 270 arc\n") wxT("%d %d lineto\n") wxT("%d %d %d 270 0 arc\n") @@ -755,7 +754,7 @@ void wxPostScriptDC::DoDrawRoundedRectangle (wxCoord x, wxCoord y, wxCoord width wxT("closepath\n") wxT("fill\n"), LogicalToDeviceX(x + rad), LogicalToDeviceY(y + rad), LogicalToDeviceXRel(rad), - LogicalToDeviceX(x), LogicalToDeviceY(y + rad), + LogicalToDeviceX(x), LogicalToDeviceY(y + height - rad), LogicalToDeviceX(x + rad), LogicalToDeviceY(y + height - rad), LogicalToDeviceXRel(rad), LogicalToDeviceX(x + width - rad), LogicalToDeviceY(y + height), LogicalToDeviceX(x + width - rad), LogicalToDeviceY(y + height - rad), LogicalToDeviceXRel(rad), @@ -774,7 +773,7 @@ void wxPostScriptDC::DoDrawRoundedRectangle (wxCoord x, wxCoord y, wxCoord width /* Draw rectangle anticlockwise */ PsPrintf( wxT("newpath\n") wxT("%d %d %d 90 180 arc\n") - wxT("%d %d moveto\n") + wxT("%d %d lineto\n") wxT("%d %d %d 180 270 arc\n") wxT("%d %d lineto\n") wxT("%d %d %d 270 0 arc\n") @@ -784,7 +783,7 @@ void wxPostScriptDC::DoDrawRoundedRectangle (wxCoord x, wxCoord y, wxCoord width wxT("closepath\n") wxT("stroke\n"), LogicalToDeviceX(x + rad), LogicalToDeviceY(y + rad), LogicalToDeviceXRel(rad), - LogicalToDeviceX(x), LogicalToDeviceY(y + rad), + LogicalToDeviceX(x), LogicalToDeviceY(y + height - rad), LogicalToDeviceX(x + rad), LogicalToDeviceY(y + height - rad), LogicalToDeviceXRel(rad), LogicalToDeviceX(x + width - rad), LogicalToDeviceY(y + height), LogicalToDeviceX(x + width - rad), LogicalToDeviceY(y + height - rad), LogicalToDeviceXRel(rad), @@ -1474,10 +1473,7 @@ void wxPostScriptDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) m_signX = (xLeftRight ? 1 : -1); m_signY = (yBottomUp ? 1 : -1); - // FIXME there is no such function in MSW nor in OS2/PM -#if !defined(__WXMSW__) && !defined(__WXPM__) ComputeScaleAndOrigin(); -#endif } void wxPostScriptDC::SetDeviceOrigin( wxCoord x, wxCoord y ) @@ -1556,7 +1552,7 @@ wxSize wxPostScriptDC::GetPPI(void) const bool wxPostScriptDC::StartDoc( const wxString& message ) { wxCHECK_MSG( m_ok, false, wxT("invalid postscript dc") ); - + if (m_printData.GetPrintMode() != wxPRINT_MODE_STREAM ) { if (m_printData.GetFilename() == wxEmptyString) @@ -1565,8 +1561,7 @@ bool wxPostScriptDC::StartDoc( const wxString& message ) m_printData.SetFilename(filename); } - // FIXME: use fn_str() here under Unicode? - m_pstream = wxFopen( m_printData.GetFilename().c_str(), wxT("w+") ); + m_pstream = wxFopen( m_printData.GetFilename(), wxT("w+") ); if (!m_pstream) { @@ -1718,7 +1713,7 @@ void wxPostScriptDC::EndDoc () #endif #ifndef __WXMSW__ - wxPostScriptPrintNativeData *data = + wxPostScriptPrintNativeData *data = (wxPostScriptPrintNativeData *) m_printData.GetNativeData(); if (m_ok && (m_printData.GetPrintMode() == wxPRINT_MODE_PRINTER)) @@ -1755,7 +1750,7 @@ void wxPostScriptDC::StartPage() wxCoord translate_x, translate_y; double scale_x, scale_y; - wxPostScriptPrintNativeData *data = + wxPostScriptPrintNativeData *data = (wxPostScriptPrintNativeData *) m_printData.GetNativeData(); translate_x = (wxCoord)data->GetPrinterTranslateX(); @@ -1833,7 +1828,7 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, wxCHECK_RET( fontToUse, wxT("GetTextExtent: no font defined") ); - if (string.IsEmpty()) + if (string.empty()) { if (x) (*x) = 0; if (y) (*y) = 0; @@ -1967,12 +1962,12 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, FILE *afmFile = NULL; - wxPostScriptPrintNativeData *data = + wxPostScriptPrintNativeData *data = (wxPostScriptPrintNativeData *) m_printData.GetNativeData(); - + // Get the directory of the AFM files wxString afmName; - if (!data->GetFontMetricPath().IsEmpty()) + if (!data->GetFontMetricPath().empty()) { afmName = data->GetFontMetricPath(); afmName << wxFILE_SEP_PATH << name; @@ -2019,8 +2014,10 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, /* init the widths array */ for(int i=0; i<256; i++) lastWidths[i] = INT_MIN; /* some variables for holding parts of a line */ - char cString[10],semiString[10],WXString[10],descString[20]; - char upString[30], utString[30], encString[50]; + char cString[10], semiString[10], WXString[10]; + char descString[20]; + char upString[30], utString[30]; + char encString[50]; char line[256]; int ascii,cWidth; /* read in the file and parse it */ @@ -2187,9 +2184,9 @@ void wxPostScriptDC::PsPrintf( const wxChar* fmt, ... ) void wxPostScriptDC::PsPrint( const char* psdata ) { - wxPostScriptPrintNativeData *data = + wxPostScriptPrintNativeData *data = (wxPostScriptPrintNativeData *) m_printData.GetNativeData(); - + switch (m_printData.GetPrintMode()) { #if wxUSE_STREAMS @@ -2212,9 +2209,9 @@ void wxPostScriptDC::PsPrint( const char* psdata ) void wxPostScriptDC::PsPrint( int ch ) { - wxPostScriptPrintNativeData *data = + wxPostScriptPrintNativeData *data = (wxPostScriptPrintNativeData *) m_printData.GetNativeData(); - + switch (m_printData.GetPrintMode()) { #if wxUSE_STREAMS @@ -2223,7 +2220,7 @@ void wxPostScriptDC::PsPrint( int ch ) { wxOutputStream* outputstream = data->GetOutputStream(); wxCHECK_RET( outputstream, wxT("invalid outputstream") ); - outputstream->PutC( ch ); + outputstream->PutC( (char)ch ); } break; #endif // wxUSE_STREAMS