#include "wx/generic/prntdlgg.h"
#include "wx/paper.h"
#include "wx/filefn.h"
-
-#include <math.h>
+#include "wx/math.h"
#ifdef __WXMSW__
/* 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")
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),
/* 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")
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),
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 )
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)
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)
{
#endif
#ifndef __WXMSW__
- wxPostScriptPrintNativeData *data =
+ wxPostScriptPrintNativeData *data =
(wxPostScriptPrintNativeData *) m_printData.GetNativeData();
if (m_ok && (m_printData.GetPrintMode() == wxPRINT_MODE_PRINTER))
wxCoord translate_x, translate_y;
double scale_x, scale_y;
- wxPostScriptPrintNativeData *data =
+ wxPostScriptPrintNativeData *data =
(wxPostScriptPrintNativeData *) m_printData.GetNativeData();
translate_x = (wxCoord)data->GetPrinterTranslateX();
wxCHECK_RET( fontToUse, wxT("GetTextExtent: no font defined") );
- if (string.IsEmpty())
+ if (string.empty())
{
if (x) (*x) = 0;
if (y) (*y) = 0;
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;
/* 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 */
void wxPostScriptDC::PsPrint( const char* psdata )
{
- wxPostScriptPrintNativeData *data =
+ wxPostScriptPrintNativeData *data =
(wxPostScriptPrintNativeData *) m_printData.GetNativeData();
-
+
switch (m_printData.GetPrintMode())
{
#if wxUSE_STREAMS
void wxPostScriptDC::PsPrint( int ch )
{
- wxPostScriptPrintNativeData *data =
+ wxPostScriptPrintNativeData *data =
(wxPostScriptPrintNativeData *) m_printData.GetNativeData();
-
+
switch (m_printData.GetPrintMode())
{
#if wxUSE_STREAMS
{
wxOutputStream* outputstream = data->GetOutputStream();
wxCHECK_RET( outputstream, wxT("invalid outputstream") );
- outputstream->PutC( ch );
+ outputstream->PutC( (char)ch );
}
break;
#endif // wxUSE_STREAMS