projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added ::IsOk() to wxDataStream for error checking in
[wxWidgets.git]
/
src
/
generic
/
dcpsg.cpp
diff --git
a/src/generic/dcpsg.cpp
b/src/generic/dcpsg.cpp
index 963735393b5dbf9edb765b716d4c03cc343b2c8a..ab2064457652d8afa087cdb551c60fa00771ad0d 100644
(file)
--- a/
src/generic/dcpsg.cpp
+++ b/
src/generic/dcpsg.cpp
@@
-21,8
+21,6
@@
#endif
#ifndef WX_PRECOMP
#endif
#ifndef WX_PRECOMP
- #include "wx/setup.h"
- #include "wx/defs.h"
#endif // WX_PRECOMP
#if wxUSE_PRINTING_ARCHITECTURE
#endif // WX_PRECOMP
#if wxUSE_PRINTING_ARCHITECTURE
@@
-39,7
+37,7
@@
#include "wx/image.h"
#include "wx/log.h"
#include "wx/generic/dcpsg.h"
#include "wx/image.h"
#include "wx/log.h"
#include "wx/generic/dcpsg.h"
-#include "wx/
generic/prntdlg
g.h"
+#include "wx/
printdl
g.h"
#include "wx/button.h"
#include "wx/stattext.h"
#include "wx/radiobox.h"
#include "wx/button.h"
#include "wx/stattext.h"
#include "wx/radiobox.h"
@@
-244,7
+242,7
@@
int wxPostScriptDC::GetResolution()
{
return (int)(ms_PSScaleFactor * 72.0);
}
{
return (int)(ms_PSScaleFactor * 72.0);
}
-
+
wxPostScriptDC::wxPostScriptDC ()
wxPostScriptDC::wxPostScriptDC ()
@@
-1564,7
+1562,7
@@
void wxPostScriptDC::DoGetSizeMM(int *width, int *height) const
// Resolution in pixels per logical inch
wxSize wxPostScriptDC::GetPPI(void) const
{
// Resolution in pixels per logical inch
wxSize wxPostScriptDC::GetPPI(void) const
{
- return wxSize((int)(72 * ms_PSScaleFactor),
+ return wxSize((int)(72 * ms_PSScaleFactor),
(int)(72 * ms_PSScaleFactor));
}
(int)(72 * ms_PSScaleFactor));
}
@@
-1672,16
+1670,16
@@
void wxPostScriptDC::EndDoc ()
wxCoord minY = (wxCoord) YLOG2DEV(m_minY);
wxCoord maxX = (wxCoord) XLOG2DEV(m_maxX);
wxCoord maxY = (wxCoord) YLOG2DEV(m_maxY);
wxCoord minY = (wxCoord) YLOG2DEV(m_minY);
wxCoord maxX = (wxCoord) XLOG2DEV(m_maxX);
wxCoord maxY = (wxCoord) YLOG2DEV(m_maxY);
-
+
// LOG2DEV may have changed the minimum to maximum vice versa
if ( minX > maxX ) { wxCoord tmp = minX; minX = maxX; maxX = tmp; }
if ( minY > maxY ) { wxCoord tmp = minY; minY = maxY; maxY = tmp; }
// LOG2DEV may have changed the minimum to maximum vice versa
if ( minX > maxX ) { wxCoord tmp = minX; minX = maxX; maxX = tmp; }
if ( minY > maxY ) { wxCoord tmp = minY; minY = maxY; maxY = tmp; }
-
+
// account for used scaling (boundingbox is before scaling in ps-file)
double scale_x = m_printData.GetPrinterScaleX() / ms_PSScaleFactor;
double scale_y = m_printData.GetPrinterScaleY() / ms_PSScaleFactor;
// account for used scaling (boundingbox is before scaling in ps-file)
double scale_x = m_printData.GetPrinterScaleX() / ms_PSScaleFactor;
double scale_y = m_printData.GetPrinterScaleY() / ms_PSScaleFactor;
-
- wxCoord llx, lly, urx, ury;
+
+ wxCoord llx, lly, urx, ury;
llx = (wxCoord) ((minX+wx_printer_translate_x)*scale_x);
lly = (wxCoord) ((minY+wx_printer_translate_y)*scale_y);
urx = (wxCoord) ((maxX+wx_printer_translate_x)*scale_x);
llx = (wxCoord) ((minX+wx_printer_translate_x)*scale_x);
lly = (wxCoord) ((minY+wx_printer_translate_y)*scale_y);
urx = (wxCoord) ((maxX+wx_printer_translate_x)*scale_x);
@@
-1817,7
+1815,7
@@
void wxPostScriptDC::StartPage()
}
char buffer[100];
}
char buffer[100];
- sprintf( buffer, "%.8f %.8f scale\n", scale_x / ms_PSScaleFactor,
+ sprintf( buffer, "%.8f %.8f scale\n", scale_x / ms_PSScaleFactor,
scale_y / ms_PSScaleFactor);
for (int i = 0; i < 100; i++)
if (buffer[i] == ',') buffer[i] = '.';
scale_y / ms_PSScaleFactor);
for (int i = 0; i < 100; i++)
if (buffer[i] == ',') buffer[i] = '.';
@@
-1837,7
+1835,7
@@
bool wxPostScriptDC::DoBlit( wxCoord xdest, wxCoord ydest,
wxCoord fwidth, wxCoord fheight,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
wxCoord fwidth, wxCoord fheight,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
- int rop, bool WXUNUSED(useMask) )
+ int rop, bool WXUNUSED(useMask)
, wxCoord WXUNUSED(xsrcMask), wxCoord WXUNUSED(ysrcMask)
)
{
wxCHECK_MSG( m_ok && m_pstream, FALSE, wxT("invalid postscript dc") );
{
wxCHECK_MSG( m_ok && m_pstream, FALSE, wxT("invalid postscript dc") );
@@
-2022,7
+2020,7
@@
void wxPostScriptDC::DoGetTextExtent(const wxString& string,
afmName << name;
FILE *afmFile = wxFopen(afmName,wxT("r"));
afmName << name;
FILE *afmFile = wxFopen(afmName,wxT("r"));
-
+
if (afmFile==NULL)
{
afmName = wxThePrintSetupData->GetAFMPath();
if (afmFile==NULL)
{
afmName = wxThePrintSetupData->GetAFMPath();
@@
-2036,7
+2034,7
@@
void wxPostScriptDC::DoGetTextExtent(const wxString& string,
- afmFile = fopen() may fail and in that case the next if branch
MUST be executed - and it would not if there was "else" */
{
- afmFile = fopen() may fail and in that case the next if branch
MUST be executed - and it would not if there was "else" */
{
- afmName = wx
INSTALL_PREFIX
;
+ afmName = wx
GetInstallPrefix()
;
afmName << wxFILE_SEP_PATH
<< wxT("share") << wxFILE_SEP_PATH
<< wxT("wx") << wxFILE_SEP_PATH
afmName << wxFILE_SEP_PATH
<< wxT("share") << wxFILE_SEP_PATH
<< wxT("wx") << wxFILE_SEP_PATH
@@
-2052,8
+2050,8
@@
void wxPostScriptDC::DoGetTextExtent(const wxString& string,
if (afmFile==NULL)
{
if (afmFile==NULL)
{
- wxLogDebug( wxT("GetTextExtent: can't open AFM file '%hs'
\n
"), afmName.c_str() );
- wxLogDebug( wxT(" using approximate values
\n
"));
+ wxLogDebug( wxT("GetTextExtent: can't open AFM file '%hs'"), afmName.c_str() );
+ wxLogDebug( wxT(" using approximate values"));
for (int i=0; i<256; i++) lastWidths[i] = 500; /* an approximate value */
lastDescender = -150; /* dito. */
}
for (int i=0; i<256; i++) lastWidths[i] = 500; /* an approximate value */
lastDescender = -150; /* dito. */
}
@@
-2075,7
+2073,7
@@
void wxPostScriptDC::DoGetTextExtent(const wxString& string,
if ((sscanf(line,"%s%d",descString,&lastDescender)!=2) ||
(strcmp(descString,"Descender")!=0))
{
if ((sscanf(line,"%s%d",descString,&lastDescender)!=2) ||
(strcmp(descString,"Descender")!=0))
{
- wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad descender)
\n
"), afmName.c_str(),line );
+ wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad descender)"), afmName.c_str(),line );
}
}
/* JC 1.) check for UnderlinePosition */
}
}
/* JC 1.) check for UnderlinePosition */
@@
-2084,7
+2082,7
@@
void wxPostScriptDC::DoGetTextExtent(const wxString& string,
if ((sscanf(line,"%s%lf",upString,&UnderlinePosition)!=2) ||
(strcmp(upString,"UnderlinePosition")!=0))
{
if ((sscanf(line,"%s%lf",upString,&UnderlinePosition)!=2) ||
(strcmp(upString,"UnderlinePosition")!=0))
{
- wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad UnderlinePosition)
\n
"), afmName.c_str(), line );
+ wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad UnderlinePosition)"), afmName.c_str(), line );
}
}
/* JC 2.) check for UnderlineThickness */
}
}
/* JC 2.) check for UnderlineThickness */
@@
-2093,7
+2091,7
@@
void wxPostScriptDC::DoGetTextExtent(const wxString& string,
if ((sscanf(line,"%s%lf",utString,&UnderlineThickness)!=2) ||
(strcmp(utString,"UnderlineThickness")!=0))
{
if ((sscanf(line,"%s%lf",utString,&UnderlineThickness)!=2) ||
(strcmp(utString,"UnderlineThickness")!=0))
{
- wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad UnderlineThickness)
\n
"), afmName.c_str(), line );
+ wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad UnderlineThickness)"), afmName.c_str(), line );
}
}
/* JC 3.) check for EncodingScheme */
}
}
/* JC 3.) check for EncodingScheme */
@@
-2102,11
+2100,11
@@
void wxPostScriptDC::DoGetTextExtent(const wxString& string,
if ((sscanf(line,"%s%s",utString,encString)!=2) ||
(strcmp(utString,"EncodingScheme")!=0))
{
if ((sscanf(line,"%s%s",utString,encString)!=2) ||
(strcmp(utString,"EncodingScheme")!=0))
{
- wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad EncodingScheme)
\n
"), afmName.c_str(), line );
+ wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad EncodingScheme)"), afmName.c_str(), line );
}
else if (strncmp(encString, "AdobeStandardEncoding", 21))
{
}
else if (strncmp(encString, "AdobeStandardEncoding", 21))
{
- wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (unsupported EncodingScheme %hs)
\n
"),
+ wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (unsupported EncodingScheme %hs)"),
afmName.c_str(),line, encString);
}
}
afmName.c_str(),line, encString);
}
}
@@
-2115,11
+2113,11
@@
void wxPostScriptDC::DoGetTextExtent(const wxString& string,
{
if (sscanf(line,"%s%d%s%s%d",cString,&ascii,semiString,WXString,&cWidth)!=5)
{
{
if (sscanf(line,"%s%d%s%s%d",cString,&ascii,semiString,WXString,&cWidth)!=5)
{
- wxLogDebug(wxT("AFM-file '%hs': line '%hs' has an error (bad character width)
\n
"),afmName.c_str(),line);
+ wxLogDebug(wxT("AFM-file '%hs': line '%hs' has an error (bad character width)"),afmName.c_str(),line);
}
if(strcmp(cString,"C")!=0 || strcmp(semiString,";")!=0 || strcmp(WXString,"WX")!=0)
{
}
if(strcmp(cString,"C")!=0 || strcmp(semiString,";")!=0 || strcmp(WXString,"WX")!=0)
{
- wxLogDebug(wxT("AFM-file '%hs': line '%hs' has a format error
\n
"),afmName.c_str(),line);
+ wxLogDebug(wxT("AFM-file '%hs': line '%hs' has a format error"),afmName.c_str(),line);
}
/* printf(" char '%c'=%d has width '%d'\n",ascii,ascii,cWidth); */
if (ascii>=0 && ascii<256)
}
/* printf(" char '%c'=%d has width '%d'\n",ascii,ascii,cWidth); */
if (ascii>=0 && ascii<256)
@@
-2129,7
+2127,7
@@
void wxPostScriptDC::DoGetTextExtent(const wxString& string,
else
{
/* MATTHEW: this happens a lot; don't print an error */
else
{
/* MATTHEW: this happens a lot; don't print an error */
- /* wxLogDebug("AFM-file '%s': ASCII value %d out of range
\n
",afmName.c_str(),ascii); */
+ /* wxLogDebug("AFM-file '%s': ASCII value %d out of range",afmName.c_str(),ascii); */
}
}
/* C.) ignore other entries. */
}
}
/* C.) ignore other entries. */
@@
-2171,7
+2169,7
@@
void wxPostScriptDC::DoGetTextExtent(const wxString& string,
{
if(lastWidths[*p]== INT_MIN)
{
{
if(lastWidths[*p]== INT_MIN)
{
- wxLogDebug(wxT("GetTextExtent: undefined width for character '%hc' (%d)
\n
"), *p,*p);
+ wxLogDebug(wxT("GetTextExtent: undefined width for character '%hc' (%d)"), *p,*p);
sum += lastWidths[' ']; /* assume space */
}
else
sum += lastWidths[' ']; /* assume space */
}
else
@@
-2179,11
+2177,11
@@
void wxPostScriptDC::DoGetTextExtent(const wxString& string,
sum += lastWidths[*p];
}
}
sum += lastWidths[*p];
}
}
-
+
double widthSum = sum;
widthSum *= Size;
widthSum /= 1000.0F;
double widthSum = sum;
widthSum *= Size;
widthSum /= 1000.0F;
-
+
/* add descender to height (it is usually a negative value) */
//if (lastDescender != INT_MIN)
//{
/* add descender to height (it is usually a negative value) */
//if (lastDescender != INT_MIN)
//{