wxChar userId[256];
wxGetUserId (userId, sizeof (userId) / sizeof (char));
wxChar tmp[256];
- wxStrcpy (tmp, _T("/tmp/preview_"));
+ wxStrcpy (tmp, wxT("/tmp/preview_"));
wxStrcat (tmp, userId);
m_printData.SetFilename(tmp);
#endif
wxChar tmp2[256];
wxStrcpy(tmp2, m_printData.GetFilename());
- wxStrcat (tmp2, _T(".ps"));
+ wxStrcat (tmp2, wxT(".ps"));
m_printData.SetFilename(tmp2);
}
- else if ((m_printData.GetFilename() == _T("")) && (m_printData.GetPrintMode() == wxPRINT_MODE_FILE))
+ else if ((m_printData.GetFilename() == wxT("")) && (m_printData.GetPrintMode() == wxPRINT_MODE_FILE))
{
- wxString file = wxSaveFileSelector (_("PostScript"), _T("ps"));
+ wxString file = wxSaveFileSelector (_("PostScript"), wxT("ps"));
if ( file.IsEmpty() )
{
m_ok = FALSE;
void wxPostScriptDC::SetClippingRegion (long x, long y, long w, long h)
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
if (m_clipping) return;
void wxPostScriptDC::SetClippingRegion( const wxRegion &WXUNUSED(region) )
{
- wxFAIL_MSG( _T("wxPostScriptDC::SetClippingRegion not implemented.") );
+ wxFAIL_MSG( wxT("wxPostScriptDC::SetClippingRegion not implemented.") );
}
void wxPostScriptDC::DestroyClippingRegion()
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
wxDC::DestroyClippingRegion();
void wxPostScriptDC::Clear()
{
- wxFAIL_MSG( _T("wxPostScriptDC::Clear not implemented.") );
+ wxFAIL_MSG( wxT("wxPostScriptDC::Clear not implemented.") );
}
void wxPostScriptDC::DoFloodFill (long WXUNUSED(x), long WXUNUSED(y), const wxColour &WXUNUSED(col), int WXUNUSED(style))
{
- wxFAIL_MSG( _T("wxPostScriptDC::FloodFill not implemented.") );
+ wxFAIL_MSG( wxT("wxPostScriptDC::FloodFill not implemented.") );
}
bool wxPostScriptDC::DoGetPixel (long WXUNUSED(x), long WXUNUSED(y), wxColour * WXUNUSED(col)) const
{
- wxFAIL_MSG( _T("wxPostScriptDC::GetPixel not implemented.") );
+ wxFAIL_MSG( wxT("wxPostScriptDC::GetPixel not implemented.") );
return FALSE;
}
void wxPostScriptDC::DoCrossHair (long WXUNUSED(x), long WXUNUSED(y))
{
- wxFAIL_MSG( _T("wxPostScriptDC::CrossHair not implemented.") );
+ wxFAIL_MSG( wxT("wxPostScriptDC::CrossHair not implemented.") );
}
void wxPostScriptDC::DoDrawLine (long x1, long y1, long x2, long y2)
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
if (m_pen.GetStyle() == wxTRANSPARENT) return;
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") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
long dx = x1 - xc;
long dy = y1 - yc;
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") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
if (sa>=360 || sa<=-360) sa=sa-int(sa/360)*360;
if (ea>=360 || ea<=-360) ea=ea-int(ea/360)*360;
void wxPostScriptDC::DoDrawPoint (long x, long y)
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
if (m_pen.GetStyle() == wxTRANSPARENT) return;
void wxPostScriptDC::DoDrawPolygon (int n, wxPoint points[], long xoffset, long yoffset, int WXUNUSED(fillStyle))
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
if (n <= 0) return;
void wxPostScriptDC::DoDrawLines (int n, wxPoint points[], long xoffset, long yoffset)
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
if (m_pen.GetStyle() == wxTRANSPARENT) return;
void wxPostScriptDC::DoDrawRectangle (long x, long y, long width, long height)
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
if (m_brush.GetStyle () != wxTRANSPARENT)
{
void wxPostScriptDC::DoDrawRoundedRectangle (long x, long y, long width, long height, double radius)
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
if (radius < 0.0)
{
void wxPostScriptDC::DoDrawEllipse (long x, long y, long width, long height)
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
if (m_brush.GetStyle () != wxTRANSPARENT)
{
void wxPostScriptDC::DoDrawBitmap( const wxBitmap& bitmap, long x, long y, bool WXUNUSED(useMask) )
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
if (!bitmap.Ok()) return;
void wxPostScriptDC::SetFont( const wxFont& font )
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
if (!font.Ok()) return;
void wxPostScriptDC::SetPen( const wxPen& pen )
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
if (!pen.Ok()) return;
void wxPostScriptDC::SetBrush( const wxBrush& brush )
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
if (!brush.Ok()) return;
void wxPostScriptDC::DoDrawText( const wxString& text, long x, long y )
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
SetFont( m_font );
void wxPostScriptDC::SetLogicalFunction (int WXUNUSED(function))
{
- wxFAIL_MSG( _T("wxPostScriptDC::SetLogicalFunction not implemented.") );
+ wxFAIL_MSG( wxT("wxPostScriptDC::SetLogicalFunction not implemented.") );
}
void wxPostScriptDC::DoDrawSpline( wxList *points )
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
SetPen( m_pen );
void wxPostScriptDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
m_signX = (xLeftRight ? 1 : -1);
m_signY = (yBottomUp ? 1 : -1);
void wxPostScriptDC::SetDeviceOrigin( long x, long y )
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
int h = 0;
int w = 0;
bool wxPostScriptDC::StartDoc( const wxString& message )
{
- wxCHECK_MSG( m_ok, FALSE, _T("invalid postscript dc") );
+ wxCHECK_MSG( m_ok, FALSE, wxT("invalid postscript dc") );
if (m_printData.GetFilename() == "")
{
void wxPostScriptDC::EndDoc ()
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
if (m_clipping)
{
wxChar userID[256];
if ( wxGetEmailAddress(userID, sizeof(userID)) )
{
- fprintf( m_pstream, "%%%%For: %s ", MBSTRINGCAST wxConvCurrent->cWX2MB(userID) );
+ fprintf( m_pstream, "%%%%For: %s ", wxMBSTRINGCAST wxConvCurrent->cWX2MB(userID) );
wxChar userName[245];
if (wxGetUserName(userName, sizeof(userName)))
- fprintf( m_pstream, " (%s)", MBSTRINGCAST wxConvCurrent->cWX2MB(userName) );
+ fprintf( m_pstream, " (%s)", wxMBSTRINGCAST wxConvCurrent->cWX2MB(userName) );
fprintf( m_pstream, "\n" );
}
else if ( wxGetUserName(userID, sizeof(userID)) )
{
- fprintf( m_pstream, "%%%%For: %s\n", MBSTRINGCAST wxConvCurrent->cWX2MB(userID) );;
+ fprintf( m_pstream, "%%%%For: %s\n", wxMBSTRINGCAST wxConvCurrent->cWX2MB(userID) );;
}
// THE FOLLOWING HAS BEEN CONTRIBUTED BY Andy Fyfe <andy@hyperparallel.com>
void wxPostScriptDC::StartPage()
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
fprintf( m_pstream, "%%%%Page: %d\n", wxPageNumber++ );
void wxPostScriptDC::EndPage ()
{
- wxCHECK_RET( m_ok && m_pstream, _T("invalid postscript dc") );
+ wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
fprintf( m_pstream, "showpage\n" );
}
long xsrc, long ysrc,
int rop, bool WXUNUSED(useMask) )
{
- wxCHECK_MSG( m_ok && m_pstream, FALSE, _T("invalid postscript dc") );
+ wxCHECK_MSG( m_ok && m_pstream, FALSE, wxT("invalid postscript dc") );
- wxCHECK_MSG( source, FALSE, _T("invalid source dc") );
+ wxCHECK_MSG( source, FALSE, wxT("invalid source dc") );
/* blit into a bitmap */
wxBitmap bitmap( (int)fwidth, (int)fheight );
if (!fontToUse) fontToUse = (wxFont*) &m_font;
- wxCHECK_RET( fontToUse, _T("GetTextExtent: no font defined") );
- wxCHECK_RET( x, _T("GetTextExtent: x == NULL") );
- wxCHECK_RET( y, _T("GetTextExtent: y == NULL") );
+ wxCHECK_RET( fontToUse, wxT("GetTextExtent: no font defined") );
+ wxCHECK_RET( x, wxT("GetTextExtent: x == NULL") );
+ wxCHECK_RET( y, wxT("GetTextExtent: y == NULL") );
const wxWX2MBbuf strbuf = string.mb_str();
static int lastDescender = INT_MIN;
static int lastWidths[256]; /* widths of the characters */
- static float UnderlinePosition = 0.0;
- static float UnderlineThickness = 0.0;
+ double UnderlinePosition = 0.0;
+ double UnderlineThickness = 0.0;
/* get actual parameters */
const int Family = fontToUse->GetFamily();
if ((Style == wxITALIC) && (Weight == wxBOLD)) name = "TimesBoO";
else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = "TimesBo";
else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = "TimesO";
-// else if name = "TimesRo"; /* no typo */
- else name = "TimesRo"; /* VS maybe no typo, but it did not compile */
+ else name = "TimesRo";
}
break;
default:
FILE *afmFile = fopen(afmName,"r");
#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");
- }
+ if (afmFile==NULL)
+ {
+ strcpy( afmName, "/usr/local/share/wx/afm/" );
+ strcat(afmName,name);
+ strcat(afmName,".afm");
+ afmFile = fopen(afmName,"r");
+ }
+
+ if (afmFile==NULL)
+ {
+ strcpy( afmName, "/usr/share/wx/afm/" );
+ strcat(afmName,name);
+ strcat(afmName,".afm");
+ afmFile = fopen(afmName,"r");
+ }
#endif
if (afmFile==NULL)
}
/* JC: calculate UnderlineThickness/UnderlinePosition */
-// m_underlinePosition = m_underlinePosition * fontToUse->GetPointSize() / 1000.0f;
-// m_underlineThickness = m_underlineThickness * fontToUse->GetPointSize() / 1000.0f * m_scaleFactor;
-// VS: can't do this - we're in const method. m_underline* seems to be never used!
+ {
+ // VS: dirty, but is there any better solution?
+ double *pt;
+ pt = (double*) &m_underlinePosition;
+ *pt = UnderlinePosition * fontToUse->GetPointSize() / 1000.0f;
+ pt = (double*) &m_underlineThickness;
+ *pt = UnderlineThickness * fontToUse->GetPointSize() / 1000.0f * m_scaleFactor;
+ }
/* 3. now the font metrics are read in, calc size this
/ is done by adding the widths of the characters in the
/ string. they are given in 1/1000 of the size! */
- long widthSum=0;
+ double widthSum=0;
long height=Size; /* by default */
unsigned char *p;
for(p=(unsigned char *)strbuf; *p; p++)
if(lastWidths[*p]== INT_MIN)
{
wxLogDebug("GetTextExtent: undefined width for character '%c' (%d)\n", *p,*p);
- widthSum += (long)(lastWidths[' ']/1000.0F * Size); /* assume space */
+ widthSum += /*(long)*/(lastWidths[' ']/1000.0F * Size); /* assume space */
}
else
{
- widthSum += (long)((lastWidths[*p]/1000.0F)*Size);
+ widthSum += /*(long)*/((lastWidths[*p]/1000.0F)*Size);
}
}
/* add descender to height (it is usually a negative value) */
- if (lastDescender!=INT_MIN)
+ if (lastDescender != INT_MIN)
{
height += (long)(((-lastDescender)/1000.0F) * Size); /* MATTHEW: forgot scale */
}
/* return size values */
- *x = widthSum;
+ *x = (long)widthSum;
*y = height;
/* return other parameters */