Naming conventions.
This commit is contained in:
parent
f21e308830
commit
7933935b4a
|
@ -37,7 +37,7 @@ WX_HTML_REPORT_PANEL::WX_HTML_REPORT_PANEL( wxWindow* parent,
|
|||
m_reporter( this ),
|
||||
m_severities( -1 ),
|
||||
m_lazyUpdate( false ),
|
||||
m_PrintInfo( true )
|
||||
m_printInfo( true )
|
||||
{
|
||||
syncCheckboxes();
|
||||
m_htmlView->SetPage( addHeader( "" ) );
|
||||
|
@ -314,10 +314,10 @@ void WX_HTML_REPORT_PANEL::onBtnSaveToFile( wxCommandEvent& event )
|
|||
{
|
||||
wxFileName fn;
|
||||
|
||||
if( m_ReportFileName.empty() )
|
||||
if( m_reportFileName.empty() )
|
||||
fn = wxT( "./report.txt" );
|
||||
else
|
||||
fn = m_ReportFileName;
|
||||
fn = m_reportFileName;
|
||||
|
||||
wxFileDialog dlg( this, _( "Save Report to File" ), fn.GetPath(), fn.GetFullName(),
|
||||
TextFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
@ -349,7 +349,7 @@ void WX_HTML_REPORT_PANEL::onBtnSaveToFile( wxCommandEvent& event )
|
|||
ConvertSmartQuotesAndDashes( &s );
|
||||
f.Write( s );
|
||||
}
|
||||
m_ReportFileName = fn.GetFullPath();
|
||||
m_reportFileName = fn.GetFullPath();
|
||||
f.Close();
|
||||
}
|
||||
|
||||
|
@ -387,19 +387,19 @@ int WX_HTML_REPORT_PANEL::GetVisibleSeverities()
|
|||
|
||||
void WX_HTML_REPORT_PANEL::SetFileName( wxString& aReportFileName )
|
||||
{
|
||||
m_ReportFileName = aReportFileName;
|
||||
m_reportFileName = aReportFileName;
|
||||
}
|
||||
|
||||
|
||||
wxString& WX_HTML_REPORT_PANEL::GetFileName( void )
|
||||
{
|
||||
return ( m_ReportFileName );
|
||||
return ( m_reportFileName );
|
||||
}
|
||||
|
||||
|
||||
void WX_HTML_REPORT_PANEL::SetPrintInfo( bool aPrintInfo )
|
||||
{
|
||||
m_PrintInfo = aPrintInfo;
|
||||
m_printInfo = aPrintInfo;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -146,10 +146,10 @@ private:
|
|||
bool m_lazyUpdate;
|
||||
|
||||
///> Print "Info:" at the front of Info messages (default)
|
||||
bool m_PrintInfo;
|
||||
bool m_printInfo;
|
||||
|
||||
///> Use this as the filename instead of /bin/report.txt (default)
|
||||
wxString m_ReportFileName;
|
||||
wxString m_reportFileName;
|
||||
};
|
||||
|
||||
#endif //__WX_HTML_REPORT_PANEL_H__
|
||||
|
|
|
@ -152,21 +152,21 @@ void DXF_PLOTTER::SetUnits( DXF_UNITS aUnit )
|
|||
void DXF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
||||
double aScale, bool aMirror )
|
||||
{
|
||||
plotOffset = aOffset;
|
||||
plotScale = aScale;
|
||||
m_plotOffset = aOffset;
|
||||
m_plotScale = aScale;
|
||||
|
||||
/* DXF paper is 'virtual' so there is no need of a paper size.
|
||||
Also this way we can handle the aux origin which can be useful
|
||||
(for example when aligning to a mechanical drawing) */
|
||||
paperSize.x = 0;
|
||||
paperSize.y = 0;
|
||||
m_paperSize.x = 0;
|
||||
m_paperSize.y = 0;
|
||||
|
||||
/* Like paper size DXF units are abstract too. Anyway there is a
|
||||
* system variable (MEASUREMENT) which will be set to 0 to indicate
|
||||
* english units */
|
||||
m_IUsPerDecimil = aIusPerDecimil;
|
||||
iuPerDeviceUnit = 1.0 / aIusPerDecimil; // Gives a DXF in decimils
|
||||
iuPerDeviceUnit *= GetUnitScaling(); // Get the scaling factor for the current units
|
||||
m_iuPerDeviceUnit = 1.0 / aIusPerDecimil; // Gives a DXF in decimils
|
||||
m_iuPerDeviceUnit *= GetUnitScaling(); // Get the scaling factor for the current units
|
||||
|
||||
m_plotMirror = false; // No mirroring on DXF
|
||||
m_currentColor = COLOR4D::BLACK;
|
||||
|
@ -177,12 +177,12 @@ void DXF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
|||
*/
|
||||
bool DXF_PLOTTER::StartPlot()
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
// DXF HEADER - Boilerplate
|
||||
// Defines the minimum for drawing i.e. the angle system and the
|
||||
// 4 linetypes (CONTINUOUS, DOTDASH, DASHED and DOTTED)
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
" 0\n"
|
||||
"SECTION\n"
|
||||
" 2\n"
|
||||
|
@ -302,12 +302,12 @@ bool DXF_PLOTTER::StartPlot()
|
|||
" 2\n"
|
||||
"STYLE\n"
|
||||
" 70\n"
|
||||
"4\n", outputFile );
|
||||
"4\n", m_outputFile );
|
||||
|
||||
static const char *style_name[4] = {"KICAD", "KICADB", "KICADI", "KICADBI"};
|
||||
for(int i = 0; i < 4; i++ )
|
||||
{
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
" 0\n"
|
||||
"STYLE\n"
|
||||
" 2\n"
|
||||
|
@ -339,7 +339,7 @@ bool DXF_PLOTTER::StartPlot()
|
|||
numLayers = static_cast<EDA_COLOR_T>( 1 );
|
||||
|
||||
// Layer table - one layer per color
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
" 0\n"
|
||||
"ENDTAB\n"
|
||||
" 0\n"
|
||||
|
@ -360,7 +360,7 @@ bool DXF_PLOTTER::StartPlot()
|
|||
|
||||
for( EDA_COLOR_T i = BLACK; i < numLayers; i = static_cast<EDA_COLOR_T>( int( i ) + 1 ) )
|
||||
{
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
" 0\n"
|
||||
"LAYER\n"
|
||||
" 2\n"
|
||||
|
@ -382,7 +382,7 @@ bool DXF_PLOTTER::StartPlot()
|
|||
" 0\n"
|
||||
"SECTION\n"
|
||||
" 2\n"
|
||||
"ENTITIES\n", outputFile );
|
||||
"ENTITIES\n", m_outputFile );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -390,15 +390,15 @@ bool DXF_PLOTTER::StartPlot()
|
|||
|
||||
bool DXF_PLOTTER::EndPlot()
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
// DXF FOOTER
|
||||
fputs( " 0\n"
|
||||
"ENDSEC\n"
|
||||
" 0\n"
|
||||
"EOF\n", outputFile );
|
||||
fclose( outputFile );
|
||||
outputFile = NULL;
|
||||
"EOF\n", m_outputFile );
|
||||
fclose( m_outputFile );
|
||||
m_outputFile = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -409,14 +409,16 @@ bool DXF_PLOTTER::EndPlot()
|
|||
*/
|
||||
void DXF_PLOTTER::SetColor( COLOR4D color )
|
||||
{
|
||||
if( ( colorMode )
|
||||
if( ( m_colorMode )
|
||||
|| ( color == COLOR4D::BLACK )
|
||||
|| ( color == COLOR4D::WHITE ) )
|
||||
{
|
||||
m_currentColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_currentColor = COLOR4D::BLACK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -424,7 +426,7 @@ void DXF_PLOTTER::SetColor( COLOR4D color )
|
|||
*/
|
||||
void DXF_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill, int width )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
MoveTo( p1 );
|
||||
LineTo( wxPoint( p1.x, p2.y ) );
|
||||
LineTo( wxPoint( p2.x, p2.y ) );
|
||||
|
@ -441,7 +443,7 @@ void DXF_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill, in
|
|||
*/
|
||||
void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_TYPE fill, int width )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
double radius = userToDeviceSize( diameter / 2 );
|
||||
DPOINT centre_dev = userToDeviceCoordinates( centre );
|
||||
if( radius > 0 )
|
||||
|
@ -450,7 +452,7 @@ void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_TYPE fill, i
|
|||
|
||||
if( fill == FILL_TYPE::NO_FILL )
|
||||
{
|
||||
fprintf( outputFile, "0\nCIRCLE\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n",
|
||||
fprintf( m_outputFile, "0\nCIRCLE\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n",
|
||||
TO_UTF8( cname ),
|
||||
centre_dev.x, centre_dev.y, radius );
|
||||
}
|
||||
|
@ -458,16 +460,16 @@ void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_TYPE fill, i
|
|||
if( fill == FILL_TYPE::FILLED_SHAPE )
|
||||
{
|
||||
double r = radius*0.5;
|
||||
fprintf( outputFile, "0\nPOLYLINE\n");
|
||||
fprintf( outputFile, "8\n%s\n66\n1\n70\n1\n", TO_UTF8( cname ));
|
||||
fprintf( outputFile, "40\n%g\n41\n%g\n", radius, radius);
|
||||
fprintf( outputFile, "0\nVERTEX\n8\n%s\n", TO_UTF8( cname ));
|
||||
fprintf( outputFile, "10\n%g\n 20\n%g\n42\n1.0\n",
|
||||
fprintf( m_outputFile, "0\nPOLYLINE\n");
|
||||
fprintf( m_outputFile, "8\n%s\n66\n1\n70\n1\n", TO_UTF8( cname ));
|
||||
fprintf( m_outputFile, "40\n%g\n41\n%g\n", radius, radius);
|
||||
fprintf( m_outputFile, "0\nVERTEX\n8\n%s\n", TO_UTF8( cname ));
|
||||
fprintf( m_outputFile, "10\n%g\n 20\n%g\n42\n1.0\n",
|
||||
centre_dev.x-r, centre_dev.y );
|
||||
fprintf( outputFile, "0\nVERTEX\n8\n%s\n", TO_UTF8( cname ));
|
||||
fprintf( outputFile, "10\n%g\n 20\n%g\n42\n1.0\n",
|
||||
fprintf( m_outputFile, "0\nVERTEX\n8\n%s\n", TO_UTF8( cname ));
|
||||
fprintf( m_outputFile, "10\n%g\n 20\n%g\n42\n1.0\n",
|
||||
centre_dev.x+r, centre_dev.y );
|
||||
fprintf( outputFile, "0\nSEQEND\n");
|
||||
fprintf( m_outputFile, "0\nSEQEND\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -583,26 +585,27 @@ void DXF_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
|
|||
|
||||
void DXF_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
if( plume == 'Z' )
|
||||
{
|
||||
return;
|
||||
}
|
||||
DPOINT pos_dev = userToDeviceCoordinates( pos );
|
||||
DPOINT pen_lastpos_dev = userToDeviceCoordinates( penLastpos );
|
||||
DPOINT pen_lastpos_dev = userToDeviceCoordinates( m_penLastpos );
|
||||
|
||||
if( penLastpos != pos && plume == 'D' )
|
||||
if( m_penLastpos != pos && plume == 'D' )
|
||||
{
|
||||
wxASSERT( m_currentLineType >= PLOT_DASH_TYPE::FIRST_TYPE
|
||||
&& m_currentLineType <= PLOT_DASH_TYPE::LAST_TYPE );
|
||||
// DXF LINE
|
||||
wxString cname = getDXFColorName( m_currentColor );
|
||||
const char* lname = getDXFLineType( static_cast<PLOT_DASH_TYPE>( m_currentLineType ) );
|
||||
fprintf( outputFile, "0\nLINE\n8\n%s\n6\n%s\n10\n%g\n20\n%g\n11\n%g\n21\n%g\n",
|
||||
fprintf( m_outputFile, "0\nLINE\n8\n%s\n6\n%s\n10\n%g\n20\n%g\n11\n%g\n21\n%g\n",
|
||||
TO_UTF8( cname ), lname,
|
||||
pen_lastpos_dev.x, pen_lastpos_dev.y, pos_dev.x, pos_dev.y );
|
||||
}
|
||||
penLastpos = pos;
|
||||
m_penLastpos = pos;
|
||||
}
|
||||
|
||||
|
||||
|
@ -647,7 +650,7 @@ void DXF_PLOTTER::ThickSegment( const wxPoint& aStart, const wxPoint& aEnd, int
|
|||
void DXF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
|
||||
FILL_TYPE fill, int width )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
if( radius <= 0 )
|
||||
return;
|
||||
|
@ -665,7 +668,7 @@ void DXF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
|
|||
|
||||
// Emit a DXF ARC entity
|
||||
wxString cname = getDXFColorName( m_currentColor );
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"0\nARC\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n50\n%g\n51\n%g\n",
|
||||
TO_UTF8( cname ),
|
||||
centre_dev.x, centre_dev.y, radius_dev,
|
||||
|
@ -678,7 +681,7 @@ void DXF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
|
|||
void DXF_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient,
|
||||
OUTLINE_MODE trace_mode, void* aData )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
wxSize size( aSize );
|
||||
|
||||
/* The chip is reduced to an oval tablet with size.y > size.x
|
||||
|
@ -700,7 +703,7 @@ void DXF_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double
|
|||
void DXF_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
|
||||
OUTLINE_MODE trace_mode, void* aData )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
Circle( pos, diametre, FILL_TYPE::NO_FILL );
|
||||
}
|
||||
|
||||
|
@ -711,7 +714,7 @@ void DXF_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
|
|||
void DXF_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
|
||||
double orient, OUTLINE_MODE trace_mode, void* aData )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
wxSize size;
|
||||
int ox, oy, fx, fy;
|
||||
|
||||
|
@ -815,7 +818,7 @@ void DXF_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
|
|||
void DXF_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
|
||||
double aPadOrient, OUTLINE_MODE aTrace_Mode, void* aData )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
wxPoint coord[4]; /* coord actual corners of a trapezoidal trace */
|
||||
|
||||
for( int ii = 0; ii < 4; ii++ )
|
||||
|
@ -926,7 +929,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
|
|||
// Position, size, rotation and alignment
|
||||
// The two alignment point usages is somewhat idiot (see the DXF ref)
|
||||
// Anyway since we don't use the fit/aligned options, they're the same
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
" 0\n"
|
||||
"TEXT\n"
|
||||
" 7\n"
|
||||
|
@ -990,7 +993,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
|
|||
|
||||
bool overlining = false;
|
||||
|
||||
fputs( " 1\n", outputFile );
|
||||
fputs( " 1\n", m_outputFile );
|
||||
|
||||
for( unsigned i = 0; i < aText.length(); i++ )
|
||||
{
|
||||
|
@ -1005,7 +1008,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
|
|||
if( ch > 255 )
|
||||
{
|
||||
// I can't encode this...
|
||||
putc( '?', outputFile );
|
||||
putc( '?', m_outputFile );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1027,15 +1030,15 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
|
|||
else
|
||||
{
|
||||
// Handle the overline toggle
|
||||
fputs( overlining ? "%%o" : "%%O", outputFile );
|
||||
fputs( overlining ? "%%o" : "%%O", m_outputFile );
|
||||
overlining = !overlining;
|
||||
}
|
||||
}
|
||||
|
||||
putc( ch, outputFile );
|
||||
putc( ch, m_outputFile );
|
||||
}
|
||||
}
|
||||
putc( '\n', outputFile );
|
||||
putc( '\n', m_outputFile );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,19 +88,19 @@ void GERBER_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
|||
{
|
||||
wxASSERT( aMirror == false );
|
||||
m_plotMirror = false;
|
||||
plotOffset = aOffset;
|
||||
m_plotOffset = aOffset;
|
||||
wxASSERT( aScale == 1 ); // aScale parameter is not used in Gerber
|
||||
plotScale = 1; // Plot scale is *always* 1.0
|
||||
m_plotScale = 1; // Plot scale is *always* 1.0
|
||||
|
||||
m_IUsPerDecimil = aIusPerDecimil;
|
||||
// gives now a default value to iuPerDeviceUnit (because the units of the caller is now known)
|
||||
// which could be modified later by calling SetGerberCoordinatesFormat()
|
||||
iuPerDeviceUnit = pow( 10.0, m_gerberUnitFmt ) / ( m_IUsPerDecimil * 10000.0 );
|
||||
m_iuPerDeviceUnit = pow( 10.0, m_gerberUnitFmt ) / ( m_IUsPerDecimil * 10000.0 );
|
||||
|
||||
// We don't handle the filmbox, and it's more useful to keep the
|
||||
// origin at the origin
|
||||
paperSize.x = 0;
|
||||
paperSize.y = 0;
|
||||
m_paperSize.x = 0;
|
||||
m_paperSize.y = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,26 +109,26 @@ void GERBER_PLOTTER::SetGerberCoordinatesFormat( int aResolution, bool aUseInche
|
|||
m_gerberUnitInch = aUseInches;
|
||||
m_gerberUnitFmt = aResolution;
|
||||
|
||||
iuPerDeviceUnit = pow( 10.0, m_gerberUnitFmt ) / ( m_IUsPerDecimil * 10000.0 );
|
||||
m_iuPerDeviceUnit = pow( 10.0, m_gerberUnitFmt ) / ( m_IUsPerDecimil * 10000.0 );
|
||||
|
||||
if( ! m_gerberUnitInch )
|
||||
iuPerDeviceUnit *= 25.4; // gerber output in mm
|
||||
m_iuPerDeviceUnit *= 25.4; // gerber output in mm
|
||||
}
|
||||
|
||||
|
||||
void GERBER_PLOTTER::emitDcode( const DPOINT& pt, int dcode )
|
||||
{
|
||||
|
||||
fprintf( outputFile, "X%dY%dD%02d*\n", KiROUND( pt.x ), KiROUND( pt.y ), dcode );
|
||||
fprintf( m_outputFile, "X%dY%dD%02d*\n", KiROUND( pt.x ), KiROUND( pt.y ), dcode );
|
||||
}
|
||||
|
||||
void GERBER_PLOTTER::ClearAllAttributes()
|
||||
{
|
||||
// Remove all attributes from object attributes dictionary (TO. and TA commands)
|
||||
if( m_useX2format )
|
||||
fputs( "%TD*%\n", outputFile );
|
||||
fputs( "%TD*%\n", m_outputFile );
|
||||
else
|
||||
fputs( "G04 #@! TD*\n", outputFile );
|
||||
fputs( "G04 #@! TD*\n", m_outputFile );
|
||||
|
||||
m_objectAttributesDictionnary.clear();
|
||||
}
|
||||
|
@ -142,9 +142,9 @@ void GERBER_PLOTTER::clearNetAttribute()
|
|||
|
||||
// Remove all net attributes from object attributes dictionary
|
||||
if( m_useX2format )
|
||||
fputs( "%TD*%\n", outputFile );
|
||||
fputs( "%TD*%\n", m_outputFile );
|
||||
else
|
||||
fputs( "G04 #@! TD*\n", outputFile );
|
||||
fputs( "G04 #@! TD*\n", m_outputFile );
|
||||
|
||||
m_objectAttributesDictionnary.clear();
|
||||
}
|
||||
|
@ -188,12 +188,12 @@ void GERBER_PLOTTER::formatNetAttribute( GBR_NETLIST_METADATA* aData )
|
|||
clearNetAttribute();
|
||||
|
||||
if( !short_attribute_string.empty() )
|
||||
fputs( short_attribute_string.c_str(), outputFile );
|
||||
fputs( short_attribute_string.c_str(), m_outputFile );
|
||||
|
||||
if( m_useX2format && !aData->m_ExtraData.IsEmpty() )
|
||||
{
|
||||
std::string extra_data = TO_UTF8( aData->m_ExtraData );
|
||||
fputs( extra_data.c_str(), outputFile );
|
||||
fputs( extra_data.c_str(), m_outputFile );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,23 +206,23 @@ bool GERBER_PLOTTER::StartPlot()
|
|||
m_hasApertureOutline4P = false; // true is at least one rotated rect/trapezoid aperture is in use
|
||||
m_hasApertureChamferedRect = false; // true is at least one chamfered rect is in use
|
||||
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
finalFile = outputFile; // the actual gerber file will be created later
|
||||
finalFile = m_outputFile; // the actual gerber file will be created later
|
||||
|
||||
// Create a temp file in system temp to avoid potential network share buffer issues for the final read and save
|
||||
m_workFilename = wxFileName::CreateTempFileName( "" );
|
||||
workFile = wxFopen( m_workFilename, wxT( "wt" ));
|
||||
outputFile = workFile;
|
||||
wxASSERT( outputFile );
|
||||
m_outputFile = workFile;
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
if( outputFile == NULL )
|
||||
if( m_outputFile == NULL )
|
||||
return false;
|
||||
|
||||
for( unsigned ii = 0; ii < m_headerExtraLines.GetCount(); ii++ )
|
||||
{
|
||||
if( ! m_headerExtraLines[ii].IsEmpty() )
|
||||
fprintf( outputFile, "%s\n", TO_UTF8( m_headerExtraLines[ii] ) );
|
||||
fprintf( m_outputFile, "%s\n", TO_UTF8( m_headerExtraLines[ii] ) );
|
||||
}
|
||||
|
||||
// Set coordinate format to 3.6 or 4.5 absolute, leading zero omitted
|
||||
|
@ -231,36 +231,36 @@ bool GERBER_PLOTTER::StartPlot()
|
|||
// It is fixed here to 3 (inch) or 4 (mm), but is not actually used
|
||||
int leadingDigitCount = m_gerberUnitInch ? 3 : 4;
|
||||
|
||||
fprintf( outputFile, "%%FSLAX%d%dY%d%d*%%\n",
|
||||
fprintf( m_outputFile, "%%FSLAX%d%dY%d%d*%%\n",
|
||||
leadingDigitCount, m_gerberUnitFmt,
|
||||
leadingDigitCount, m_gerberUnitFmt );
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"G04 Gerber Fmt %d.%d, Leading zero omitted, Abs format (unit %s)*\n",
|
||||
leadingDigitCount, m_gerberUnitFmt,
|
||||
m_gerberUnitInch ? "inch" : "mm" );
|
||||
|
||||
wxString Title = creator + wxT( " " ) + GetBuildVersion();
|
||||
wxString Title = m_creator + wxT( " " ) + GetBuildVersion();
|
||||
// In gerber files, ASCII7 chars only are allowed.
|
||||
// So use a ISO date format (using a space as separator between date and time),
|
||||
// not a localized date format
|
||||
wxDateTime date = wxDateTime::Now();
|
||||
fprintf( outputFile, "G04 Created by KiCad (%s) date %s*\n",
|
||||
fprintf( m_outputFile, "G04 Created by KiCad (%s) date %s*\n",
|
||||
TO_UTF8( Title ), TO_UTF8( date.FormatISOCombined( ' ') ) );
|
||||
|
||||
/* Mass parameter: unit = INCHES/MM */
|
||||
if( m_gerberUnitInch )
|
||||
fputs( "%MOIN*%\n", outputFile );
|
||||
fputs( "%MOIN*%\n", m_outputFile );
|
||||
else
|
||||
fputs( "%MOMM*%\n", outputFile );
|
||||
fputs( "%MOMM*%\n", m_outputFile );
|
||||
|
||||
// Be sure the usual dark polarity is selected:
|
||||
fputs( "%LPD*%\n", outputFile );
|
||||
fputs( "%LPD*%\n", m_outputFile );
|
||||
|
||||
// Set initial interpolation mode: always G01 (linear):
|
||||
fputs( "G01*\n", outputFile );
|
||||
fputs( "G01*\n", m_outputFile );
|
||||
|
||||
// Add aperture list start point
|
||||
fputs( "G04 APERTURE LIST*\n", outputFile );
|
||||
fputs( "G04 APERTURE LIST*\n", m_outputFile );
|
||||
|
||||
// Give a minimal value to the default pen size, used to plot items in sketch mode
|
||||
if( m_renderSettings )
|
||||
|
@ -279,21 +279,21 @@ bool GERBER_PLOTTER::EndPlot()
|
|||
char line[1024];
|
||||
wxString msg;
|
||||
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
/* Outfile is actually a temporary file i.e. workFile */
|
||||
fputs( "M02*\n", outputFile );
|
||||
fflush( outputFile );
|
||||
fputs( "M02*\n", m_outputFile );
|
||||
fflush( m_outputFile );
|
||||
|
||||
fclose( workFile );
|
||||
workFile = wxFopen( m_workFilename, wxT( "rt" ));
|
||||
wxASSERT( workFile );
|
||||
outputFile = finalFile;
|
||||
m_outputFile = finalFile;
|
||||
|
||||
// Placement of apertures in RS274X
|
||||
while( fgets( line, 1024, workFile ) )
|
||||
{
|
||||
fputs( line, outputFile );
|
||||
fputs( line, m_outputFile );
|
||||
|
||||
char* substr = strtok( line, "\n\r" );
|
||||
|
||||
|
@ -304,40 +304,40 @@ bool GERBER_PLOTTER::EndPlot()
|
|||
m_hasApertureOutline4P || m_hasApertureRotRect ||
|
||||
m_hasApertureChamferedRect )
|
||||
{
|
||||
fputs( "G04 Aperture macros list*\n", outputFile );
|
||||
fputs( "G04 Aperture macros list*\n", m_outputFile );
|
||||
|
||||
if( m_hasApertureRoundRect )
|
||||
fputs( APER_MACRO_ROUNDRECT_HEADER, outputFile );
|
||||
fputs( APER_MACRO_ROUNDRECT_HEADER, m_outputFile );
|
||||
|
||||
if( m_hasApertureRotOval )
|
||||
fputs( APER_MACRO_SHAPE_OVAL_HEADER, outputFile );
|
||||
fputs( APER_MACRO_SHAPE_OVAL_HEADER, m_outputFile );
|
||||
|
||||
if( m_hasApertureRotRect )
|
||||
fputs( APER_MACRO_ROT_RECT_HEADER, outputFile );
|
||||
fputs( APER_MACRO_ROT_RECT_HEADER, m_outputFile );
|
||||
|
||||
if( m_hasApertureOutline4P )
|
||||
fputs( APER_MACRO_OUTLINE4P_HEADER, outputFile );
|
||||
fputs( APER_MACRO_OUTLINE4P_HEADER, m_outputFile );
|
||||
|
||||
if( m_hasApertureChamferedRect )
|
||||
{
|
||||
fputs( APER_MACRO_OUTLINE5P_HEADER, outputFile );
|
||||
fputs( APER_MACRO_OUTLINE6P_HEADER, outputFile );
|
||||
fputs( APER_MACRO_OUTLINE7P_HEADER, outputFile );
|
||||
fputs( APER_MACRO_OUTLINE8P_HEADER, outputFile );
|
||||
fputs( APER_MACRO_OUTLINE5P_HEADER, m_outputFile );
|
||||
fputs( APER_MACRO_OUTLINE6P_HEADER, m_outputFile );
|
||||
fputs( APER_MACRO_OUTLINE7P_HEADER, m_outputFile );
|
||||
fputs( APER_MACRO_OUTLINE8P_HEADER, m_outputFile );
|
||||
}
|
||||
|
||||
fputs( "G04 Aperture macros list end*\n", outputFile );
|
||||
fputs( "G04 Aperture macros list end*\n", m_outputFile );
|
||||
}
|
||||
|
||||
writeApertureList();
|
||||
fputs( "G04 APERTURE END LIST*\n", outputFile );
|
||||
fputs( "G04 APERTURE END LIST*\n", m_outputFile );
|
||||
}
|
||||
}
|
||||
|
||||
fclose( workFile );
|
||||
fclose( finalFile );
|
||||
::wxRemoveFile( m_workFilename );
|
||||
outputFile = 0;
|
||||
m_outputFile = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ void GERBER_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
|
|||
int aperture_attribute = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
|
||||
|
||||
selectAperture( wxSize( aWidth, aWidth ), 0, 0.0, APERTURE::AT_PLOTTING, aperture_attribute );
|
||||
currentPenWidth = aWidth;
|
||||
m_currentPenWidth = aWidth;
|
||||
}
|
||||
|
||||
|
||||
|
@ -459,7 +459,7 @@ void GERBER_PLOTTER::selectAperture( const wxSize& aSize, int aRadius, double aR
|
|||
// Pick an existing aperture or create a new one
|
||||
m_currentApertureIdx = GetOrCreateAperture( aSize, aRadius, aRotDegree,
|
||||
aType, aApertureAttribute );
|
||||
fprintf( outputFile, "D%d*\n", m_apertures[m_currentApertureIdx].m_DCode );
|
||||
fprintf( m_outputFile, "D%d*\n", m_apertures[m_currentApertureIdx].m_DCode );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -492,7 +492,7 @@ void GERBER_PLOTTER::selectAperture( const std::vector<wxPoint>& aCorners, doubl
|
|||
// Pick an existing aperture or create a new one
|
||||
m_currentApertureIdx = GetOrCreateAperture( aCorners, aRotDegree,
|
||||
aType, aApertureAttribute );
|
||||
fprintf( outputFile, "D%d*\n", m_apertures[m_currentApertureIdx].m_DCode );
|
||||
fprintf( m_outputFile, "D%d*\n", m_apertures[m_currentApertureIdx].m_DCode );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -513,7 +513,7 @@ void GERBER_PLOTTER::selectAperture( int aDiameter, double aPolygonRotation,
|
|||
|
||||
void GERBER_PLOTTER::writeApertureList()
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
char cbuf[1024];
|
||||
std::string buffer;
|
||||
|
||||
|
@ -527,7 +527,7 @@ void GERBER_PLOTTER::writeApertureList()
|
|||
{
|
||||
// apertude sizes are in inch or mm, regardless the
|
||||
// coordinates format
|
||||
double fscale = 0.0001 * plotScale / m_IUsPerDecimil; // inches
|
||||
double fscale = 0.0001 * m_plotScale / m_IUsPerDecimil; // inches
|
||||
|
||||
if(! m_gerberUnitInch )
|
||||
fscale *= 25.4; // size in mm
|
||||
|
@ -538,7 +538,7 @@ void GERBER_PLOTTER::writeApertureList()
|
|||
{
|
||||
fputs( GBR_APERTURE_METADATA::FormatAttribute(
|
||||
(GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB) attribute,
|
||||
useX1StructuredComment ).c_str(), outputFile );
|
||||
useX1StructuredComment ).c_str(), m_outputFile );
|
||||
}
|
||||
|
||||
sprintf( cbuf, "%%ADD%d", tool.m_DCode );
|
||||
|
@ -685,8 +685,8 @@ void GERBER_PLOTTER::writeApertureList()
|
|||
case APERTURE::AM_FREE_POLYGON:
|
||||
{
|
||||
// Write aperture header
|
||||
fprintf( outputFile, "%%%s%d*\n", "AMFp", tool.m_DCode );
|
||||
fprintf( outputFile, "4,1,%d,", (int)tool.m_Corners.size() );
|
||||
fprintf( m_outputFile, "%%%s%d*\n", "AMFp", tool.m_DCode );
|
||||
fprintf( m_outputFile, "4,1,%d,", (int)tool.m_Corners.size() );
|
||||
|
||||
for( size_t ii = 0; ii <= tool.m_Corners.size(); ii++ )
|
||||
{
|
||||
|
@ -695,11 +695,11 @@ void GERBER_PLOTTER::writeApertureList()
|
|||
if( ii >= tool.m_Corners.size() )
|
||||
jj = 0;
|
||||
|
||||
fprintf( outputFile, "%#f,%#f,",
|
||||
fprintf( m_outputFile, "%#f,%#f,",
|
||||
tool.m_Corners[jj].x * fscale, -tool.m_Corners[jj].y * fscale );
|
||||
}
|
||||
// output rotation parameter
|
||||
fputs( "$1*%\n", outputFile );
|
||||
fputs( "$1*%\n", m_outputFile );
|
||||
|
||||
// Create specialized macro
|
||||
sprintf( cbuf, "%s%d,", "Fp", tool.m_DCode );
|
||||
|
@ -712,7 +712,7 @@ void GERBER_PLOTTER::writeApertureList()
|
|||
}
|
||||
|
||||
buffer += cbuf;
|
||||
fputs( buffer.c_str(), outputFile );
|
||||
fputs( buffer.c_str(), m_outputFile );
|
||||
|
||||
m_apertureAttribute = attribute;
|
||||
|
||||
|
@ -721,9 +721,9 @@ void GERBER_PLOTTER::writeApertureList()
|
|||
if( attribute )
|
||||
{
|
||||
if( m_useX2format )
|
||||
fputs( "%TD*%\n", outputFile );
|
||||
fputs( "%TD*%\n", m_outputFile );
|
||||
else
|
||||
fputs( "G04 #@! TD*\n", outputFile );
|
||||
fputs( "G04 #@! TD*\n", m_outputFile );
|
||||
|
||||
m_apertureAttribute = 0;
|
||||
}
|
||||
|
@ -734,7 +734,7 @@ void GERBER_PLOTTER::writeApertureList()
|
|||
|
||||
void GERBER_PLOTTER::PenTo( const wxPoint& aPos, char plume )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
DPOINT pos_dev = userToDeviceCoordinates( aPos );
|
||||
|
||||
switch( plume )
|
||||
|
@ -750,7 +750,7 @@ void GERBER_PLOTTER::PenTo( const wxPoint& aPos, char plume )
|
|||
emitDcode( pos_dev, 1 );
|
||||
}
|
||||
|
||||
penState = plume;
|
||||
m_penState = plume;
|
||||
}
|
||||
|
||||
|
||||
|
@ -805,18 +805,18 @@ void GERBER_PLOTTER::plotArc( const wxPoint& aCenter, double aStAngle, double aE
|
|||
DPOINT devEnd = userToDeviceCoordinates( end );
|
||||
DPOINT devCenter = userToDeviceCoordinates( aCenter ) - userToDeviceCoordinates( start );
|
||||
|
||||
fprintf( outputFile, "G75*\n" ); // Multiquadrant (360 degrees) mode
|
||||
fprintf( m_outputFile, "G75*\n" ); // Multiquadrant (360 degrees) mode
|
||||
|
||||
if( aStAngle < aEndAngle )
|
||||
fprintf( outputFile, "G03*\n" ); // Active circular interpolation, CCW
|
||||
fprintf( m_outputFile, "G03*\n" ); // Active circular interpolation, CCW
|
||||
else
|
||||
fprintf( outputFile, "G02*\n" ); // Active circular interpolation, CW
|
||||
fprintf( m_outputFile, "G02*\n" ); // Active circular interpolation, CW
|
||||
|
||||
fprintf( outputFile, "X%dY%dI%dJ%dD01*\n",
|
||||
fprintf( m_outputFile, "X%dY%dI%dJ%dD01*\n",
|
||||
KiROUND( devEnd.x ), KiROUND( devEnd.y ),
|
||||
KiROUND( devCenter.x ), KiROUND( devCenter.y ) );
|
||||
|
||||
fprintf( outputFile, "G01*\n" ); // Back to linear interpol (perhaps useless here).
|
||||
fprintf( m_outputFile, "G01*\n" ); // Back to linear interpol (perhaps useless here).
|
||||
}
|
||||
|
||||
|
||||
|
@ -836,7 +836,7 @@ void GERBER_PLOTTER::PlotGerberRegion( const std::vector< wxPoint >& aCornerList
|
|||
|
||||
if( !attrib.empty() )
|
||||
{
|
||||
fputs( attrib.c_str(), outputFile );
|
||||
fputs( attrib.c_str(), m_outputFile );
|
||||
clearTA_AperFunction = true;
|
||||
}
|
||||
}
|
||||
|
@ -848,11 +848,11 @@ void GERBER_PLOTTER::PlotGerberRegion( const std::vector< wxPoint >& aCornerList
|
|||
{
|
||||
if( m_useX2format )
|
||||
{
|
||||
fputs( "%TD.AperFunction*%\n", outputFile );
|
||||
fputs( "%TD.AperFunction*%\n", m_outputFile );
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs( "G04 #@! TD.AperFunction*\n", outputFile );
|
||||
fputs( "G04 #@! TD.AperFunction*\n", m_outputFile );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -873,10 +873,10 @@ void GERBER_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
|
|||
|
||||
if( aFill != FILL_TYPE::NO_FILL )
|
||||
{
|
||||
fputs( "G36*\n", outputFile );
|
||||
fputs( "G36*\n", m_outputFile );
|
||||
|
||||
MoveTo( aCornerList[0] );
|
||||
fputs( "G01*\n", outputFile ); // Set linear interpolation.
|
||||
fputs( "G01*\n", m_outputFile ); // Set linear interpolation.
|
||||
|
||||
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
|
||||
LineTo( aCornerList[ii] );
|
||||
|
@ -885,7 +885,7 @@ void GERBER_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
|
|||
if( aCornerList[0] != aCornerList[aCornerList.size()-1] )
|
||||
FinishTo( aCornerList[0] );
|
||||
|
||||
fputs( "G37*\n", outputFile );
|
||||
fputs( "G37*\n", m_outputFile );
|
||||
}
|
||||
|
||||
if( aWidth > 0 ) // Draw the polyline/polygon outline
|
||||
|
@ -943,9 +943,9 @@ void GERBER_PLOTTER::ThickArc( const wxPoint& centre, double StAngle, double End
|
|||
{
|
||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||
Arc( centre, StAngle, EndAngle,
|
||||
radius - ( width - currentPenWidth ) / 2, FILL_TYPE::NO_FILL,
|
||||
radius - ( width - m_currentPenWidth ) / 2, FILL_TYPE::NO_FILL,
|
||||
DO_NOT_SET_LINE_WIDTH );
|
||||
Arc( centre, StAngle, EndAngle, radius + ( width - currentPenWidth ) / 2, FILL_TYPE::NO_FILL,
|
||||
Arc( centre, StAngle, EndAngle, radius + ( width - m_currentPenWidth ) / 2, FILL_TYPE::NO_FILL,
|
||||
DO_NOT_SET_LINE_WIDTH );
|
||||
}
|
||||
}
|
||||
|
@ -965,15 +965,15 @@ void GERBER_PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
|
|||
else
|
||||
{
|
||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||
wxPoint offsetp1( p1.x - (width - currentPenWidth) / 2,
|
||||
p1.y - (width - currentPenWidth) / 2 );
|
||||
wxPoint offsetp2( p2.x + (width - currentPenWidth) / 2,
|
||||
p2.y + (width - currentPenWidth) / 2 );
|
||||
wxPoint offsetp1( p1.x - (width - m_currentPenWidth) / 2,
|
||||
p1.y - (width - m_currentPenWidth) / 2 );
|
||||
wxPoint offsetp2( p2.x + (width - m_currentPenWidth) / 2,
|
||||
p2.y + (width - m_currentPenWidth) / 2 );
|
||||
Rect( offsetp1, offsetp2, FILL_TYPE::NO_FILL, -1 );
|
||||
offsetp1.x += (width - currentPenWidth);
|
||||
offsetp1.y += (width - currentPenWidth);
|
||||
offsetp2.x -= (width - currentPenWidth);
|
||||
offsetp2.y -= (width - currentPenWidth);
|
||||
offsetp1.x += (width - m_currentPenWidth);
|
||||
offsetp1.y += (width - m_currentPenWidth);
|
||||
offsetp2.x -= (width - m_currentPenWidth);
|
||||
offsetp2.y -= (width - m_currentPenWidth);
|
||||
Rect( offsetp1, offsetp2, FILL_TYPE::NO_FILL, DO_NOT_SET_LINE_WIDTH );
|
||||
}
|
||||
}
|
||||
|
@ -993,9 +993,9 @@ void GERBER_PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width,
|
|||
else
|
||||
{
|
||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, gbr_metadata );
|
||||
Circle( pos, diametre - (width - currentPenWidth),
|
||||
Circle( pos, diametre - (width - m_currentPenWidth),
|
||||
FILL_TYPE::NO_FILL, DO_NOT_SET_LINE_WIDTH );
|
||||
Circle( pos, diametre + (width - currentPenWidth),
|
||||
Circle( pos, diametre + (width - m_currentPenWidth),
|
||||
FILL_TYPE::NO_FILL, DO_NOT_SET_LINE_WIDTH );
|
||||
}
|
||||
}
|
||||
|
@ -1038,7 +1038,7 @@ void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, OUTLINE_M
|
|||
|
||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||
|
||||
Circle( pos, diametre - currentPenWidth, FILL_TYPE::NO_FILL, DO_NOT_SET_LINE_WIDTH );
|
||||
Circle( pos, diametre - m_currentPenWidth, FILL_TYPE::NO_FILL, DO_NOT_SET_LINE_WIDTH );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1058,7 +1058,7 @@ void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, OUTLINE_M
|
|||
void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient,
|
||||
OUTLINE_MODE trace_mode, void* aData )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
wxSize size( aSize );
|
||||
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
|
||||
|
||||
|
@ -1138,7 +1138,7 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
|
|||
double orient, OUTLINE_MODE trace_mode, void* aData )
|
||||
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
wxSize size( aSize );
|
||||
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
|
||||
|
||||
|
@ -1277,7 +1277,7 @@ void GERBER_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
|
|||
|
||||
if( !attrib.empty() )
|
||||
{
|
||||
fputs( attrib.c_str(), outputFile );
|
||||
fputs( attrib.c_str(), m_outputFile );
|
||||
clearTA_AperFunction = true;
|
||||
}
|
||||
}
|
||||
|
@ -1289,9 +1289,9 @@ void GERBER_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
|
|||
if( clearTA_AperFunction )
|
||||
{
|
||||
if( m_useX2format )
|
||||
fputs( "%TD.AperFunction*%\n", outputFile );
|
||||
fputs( "%TD.AperFunction*%\n", m_outputFile );
|
||||
else
|
||||
fputs( "G04 #@! TD.AperFunction*\n", outputFile );
|
||||
fputs( "G04 #@! TD.AperFunction*\n", m_outputFile );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1403,8 +1403,8 @@ void GERBER_PLOTTER::plotRoundRectAsRegion( const wxPoint& aRectCenter, const wx
|
|||
first_pt.x, first_pt.y, last_pt.x, last_pt.y );
|
||||
#endif
|
||||
|
||||
fputs( "G36*\n", outputFile ); // Start region
|
||||
fputs( "G01*\n", outputFile ); // Set linear interpolation.
|
||||
fputs( "G36*\n", m_outputFile ); // Start region
|
||||
fputs( "G01*\n", m_outputFile ); // Set linear interpolation.
|
||||
first_pt = last_pt;
|
||||
MoveTo( first_pt ); // Start point of region, must be same as end point
|
||||
|
||||
|
@ -1421,7 +1421,7 @@ void GERBER_PLOTTER::plotRoundRectAsRegion( const wxPoint& aRectCenter, const wx
|
|||
LineTo( rr_edge.m_end );
|
||||
}
|
||||
|
||||
fputs( "G37*\n", outputFile ); // Close region
|
||||
fputs( "G37*\n", m_outputFile ); // Close region
|
||||
}
|
||||
|
||||
|
||||
|
@ -1711,7 +1711,7 @@ void GERBER_PLOTTER::Text( const wxPoint& aPos, const COLOR4D aColor,
|
|||
void GERBER_PLOTTER::SetLayerPolarity( bool aPositive )
|
||||
{
|
||||
if( aPositive )
|
||||
fprintf( outputFile, "%%LPD*%%\n" );
|
||||
fprintf( m_outputFile, "%%LPD*%%\n" );
|
||||
else
|
||||
fprintf( outputFile, "%%LPC*%%\n" );
|
||||
fprintf( m_outputFile, "%%LPC*%%\n" );
|
||||
}
|
||||
|
|
|
@ -224,14 +224,14 @@ HPGL_PLOTTER::HPGL_PLOTTER()
|
|||
void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
||||
double aScale, bool aMirror )
|
||||
{
|
||||
plotOffset = aOffset;
|
||||
plotScale = aScale;
|
||||
m_plotOffset = aOffset;
|
||||
m_plotScale = aScale;
|
||||
m_IUsPerDecimil = aIusPerDecimil;
|
||||
iuPerDeviceUnit = PLUsPERDECIMIL / aIusPerDecimil;
|
||||
m_iuPerDeviceUnit = PLUsPERDECIMIL / aIusPerDecimil;
|
||||
/* Compute the paper size in IUs */
|
||||
paperSize = pageInfo.GetSizeMils();
|
||||
paperSize.x *= 10.0 * aIusPerDecimil;
|
||||
paperSize.y *= 10.0 * aIusPerDecimil;
|
||||
m_paperSize = m_pageInfo.GetSizeMils();
|
||||
m_paperSize.x *= 10.0 * aIusPerDecimil;
|
||||
m_paperSize.y *= 10.0 * aIusPerDecimil;
|
||||
m_plotMirror = aMirror;
|
||||
}
|
||||
|
||||
|
@ -241,12 +241,12 @@ void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
|||
*/
|
||||
bool HPGL_PLOTTER::StartPlot()
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
fprintf( outputFile, "IN;VS%d;PU;PA;SP%d;\n", penSpeed, penNumber );
|
||||
wxASSERT( m_outputFile );
|
||||
fprintf( m_outputFile, "IN;VS%d;PU;PA;SP%d;\n", penSpeed, penNumber );
|
||||
|
||||
// Set HPGL Pen Thickness (in mm) (usefull in polygon fill command)
|
||||
double penThicknessMM = userToDeviceSize( penDiameter )/40;
|
||||
fprintf( outputFile, "PT %.1f;\n", penThicknessMM );
|
||||
fprintf( m_outputFile, "PT %.1f;\n", penThicknessMM );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -257,10 +257,10 @@ bool HPGL_PLOTTER::StartPlot()
|
|||
*/
|
||||
bool HPGL_PLOTTER::EndPlot()
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
fputs( "PU;PA;SP0;\n", outputFile );
|
||||
fclose( outputFile );
|
||||
outputFile = NULL;
|
||||
wxASSERT( m_outputFile );
|
||||
fputs( "PU;PA;SP0;\n", m_outputFile );
|
||||
fclose( m_outputFile );
|
||||
m_outputFile = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -275,10 +275,10 @@ void HPGL_PLOTTER::SetPenDiameter( double diameter )
|
|||
*/
|
||||
void HPGL_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill, int width )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
DPOINT p2dev = userToDeviceCoordinates( p2 );
|
||||
MoveTo( p1 );
|
||||
fprintf( outputFile, "EA %.0f,%.0f;\n", p2dev.x, p2dev.y );
|
||||
fprintf( m_outputFile, "EA %.0f,%.0f;\n", p2dev.x, p2dev.y );
|
||||
PenFinish();
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ void HPGL_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill, i
|
|||
void HPGL_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_TYPE fill,
|
||||
int width )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
double radius = userToDeviceSize( diameter / 2 );
|
||||
SetCurrentLineWidth( width );
|
||||
|
||||
|
@ -295,15 +295,15 @@ void HPGL_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_TYPE fill,
|
|||
{
|
||||
// Draw the filled area
|
||||
MoveTo( centre );
|
||||
fprintf( outputFile, "PM 0; CI %g;\n", radius );
|
||||
fprintf( outputFile, hpgl_end_polygon_cmd ); // Close, fill polygon and draw outlines
|
||||
fprintf( m_outputFile, "PM 0; CI %g;\n", radius );
|
||||
fprintf( m_outputFile, hpgl_end_polygon_cmd ); // Close, fill polygon and draw outlines
|
||||
PenFinish();
|
||||
}
|
||||
|
||||
if( radius > 0 )
|
||||
{
|
||||
MoveTo( centre );
|
||||
fprintf( outputFile, "CI %g;\n", radius );
|
||||
fprintf( m_outputFile, "CI %g;\n", radius );
|
||||
PenFinish();
|
||||
}
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ void HPGL_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
|
|||
{
|
||||
// Draw the filled area
|
||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||
fprintf( outputFile, "PM 0;\n" ); // Start polygon
|
||||
fprintf( m_outputFile, "PM 0;\n" ); // Start polygon
|
||||
|
||||
for( unsigned ii = 1; ii < aCornerList.size(); ++ii )
|
||||
LineTo( aCornerList[ii] );
|
||||
|
@ -336,7 +336,7 @@ void HPGL_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
|
|||
if( aCornerList[ii] != aCornerList[0] )
|
||||
LineTo( aCornerList[0] );
|
||||
|
||||
fprintf( outputFile, hpgl_end_polygon_cmd ); // Close, fill polygon and draw outlines
|
||||
fprintf( m_outputFile, hpgl_end_polygon_cmd ); // Close, fill polygon and draw outlines
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -363,35 +363,35 @@ void HPGL_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
|
|||
*/
|
||||
void HPGL_PLOTTER::penControl( char plume )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
switch( plume )
|
||||
{
|
||||
case 'U':
|
||||
|
||||
if( penState != 'U' )
|
||||
if( m_penState != 'U' )
|
||||
{
|
||||
fputs( "PU;", outputFile );
|
||||
penState = 'U';
|
||||
fputs( "PU;", m_outputFile );
|
||||
m_penState = 'U';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
|
||||
if( penState != 'D' )
|
||||
if( m_penState != 'D' )
|
||||
{
|
||||
fputs( "PD;", outputFile );
|
||||
penState = 'D';
|
||||
fputs( "PD;", m_outputFile );
|
||||
m_penState = 'D';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
fputs( "PU;", outputFile );
|
||||
penState = 'U';
|
||||
penLastpos.x = -1;
|
||||
penLastpos.y = -1;
|
||||
fputs( "PU;", m_outputFile );
|
||||
m_penState = 'U';
|
||||
m_penLastpos.x = -1;
|
||||
m_penLastpos.y = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ void HPGL_PLOTTER::penControl( char plume )
|
|||
|
||||
void HPGL_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
if( plume == 'Z' )
|
||||
{
|
||||
|
@ -410,10 +410,10 @@ void HPGL_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
|||
penControl( plume );
|
||||
DPOINT pos_dev = userToDeviceCoordinates( pos );
|
||||
|
||||
if( penLastpos != pos )
|
||||
fprintf( outputFile, "PA %.0f,%.0f;\n", pos_dev.x, pos_dev.y );
|
||||
if( m_penLastpos != pos )
|
||||
fprintf( m_outputFile, "PA %.0f,%.0f;\n", pos_dev.x, pos_dev.y );
|
||||
|
||||
penLastpos = pos;
|
||||
m_penLastpos = pos;
|
||||
}
|
||||
|
||||
|
||||
|
@ -422,21 +422,21 @@ void HPGL_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
|||
*/
|
||||
void HPGL_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
switch( dashed )
|
||||
{
|
||||
case PLOT_DASH_TYPE::DASH:
|
||||
fprintf( outputFile, "LT -2 4 1;\n" );
|
||||
fprintf( m_outputFile, "LT -2 4 1;\n" );
|
||||
break;
|
||||
case PLOT_DASH_TYPE::DOT:
|
||||
fprintf( outputFile, "LT -1 2 1;\n" );
|
||||
fprintf( m_outputFile, "LT -1 2 1;\n" );
|
||||
break;
|
||||
case PLOT_DASH_TYPE::DASHDOT:
|
||||
fprintf( outputFile, "LT -4 6 1;\n" );
|
||||
fprintf( m_outputFile, "LT -4 6 1;\n" );
|
||||
break;
|
||||
default:
|
||||
fputs( "LT;\n", outputFile );
|
||||
fputs( "LT;\n", m_outputFile );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -444,9 +444,7 @@ void HPGL_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
|
|||
void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end,
|
||||
int width, OUTLINE_MODE tracemode, void* aData )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxPoint center;
|
||||
wxSize size;
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
// Suppress overlap if pen is too big
|
||||
if( penDiameter >= width )
|
||||
|
@ -455,7 +453,9 @@ void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end,
|
|||
FinishTo( end );
|
||||
}
|
||||
else
|
||||
{
|
||||
segmentAsOval( start, end, width, tracemode );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -470,7 +470,7 @@ void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end,
|
|||
void HPGL_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
|
||||
FILL_TYPE fill, int width )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
double angle;
|
||||
|
||||
if( radius <= 0 )
|
||||
|
@ -492,12 +492,12 @@ void HPGL_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle,
|
|||
cmap.y = centre.y - KiROUND( sindecideg( radius, StAngle ) );
|
||||
DPOINT cmap_dev = userToDeviceCoordinates( cmap );
|
||||
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"PU;PA %.0f,%.0f;PD;AA %.0f,%.0f,",
|
||||
cmap_dev.x, cmap_dev.y,
|
||||
centre_dev.x, centre_dev.y );
|
||||
fprintf( outputFile, "%.0f", angle );
|
||||
fprintf( outputFile, ";PU;\n" );
|
||||
fprintf( m_outputFile, "%.0f", angle );
|
||||
fprintf( m_outputFile, ";PU;\n" );
|
||||
PenFinish();
|
||||
}
|
||||
|
||||
|
@ -507,7 +507,7 @@ void HPGL_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle,
|
|||
void HPGL_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient,
|
||||
OUTLINE_MODE trace_mode, void* aData )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
int deltaxy, cx, cy;
|
||||
wxSize size( aSize );
|
||||
|
||||
|
@ -545,7 +545,7 @@ void HPGL_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double
|
|||
void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
|
||||
OUTLINE_MODE trace_mode, void* aData )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
DPOINT pos_dev = userToDeviceCoordinates( pos );
|
||||
|
||||
int radius = diametre / 2;
|
||||
|
@ -568,13 +568,13 @@ void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
|
|||
// Gives a correct current starting point for the circle
|
||||
MoveTo( wxPoint( pos.x+radius, pos.y ) );
|
||||
// Plot filled area and its outline
|
||||
fprintf( outputFile, "PM 0; PA %.0f,%.0f;CI %.0f;%s",
|
||||
fprintf( m_outputFile, "PM 0; PA %.0f,%.0f;CI %.0f;%s",
|
||||
pos_dev.x, pos_dev.y, rsize, hpgl_end_polygon_cmd );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw outline only:
|
||||
fprintf( outputFile, "PA %.0f,%.0f;CI %.0f;\n",
|
||||
fprintf( m_outputFile, "PA %.0f,%.0f;CI %.0f;\n",
|
||||
pos_dev.x, pos_dev.y, rsize );
|
||||
}
|
||||
|
||||
|
|
|
@ -105,14 +105,14 @@ std::string PDF_PLOTTER::encodeStringForPlotter( const wxString& aText )
|
|||
|
||||
bool PDF_PLOTTER::OpenFile( const wxString& aFullFilename )
|
||||
{
|
||||
filename = aFullFilename;
|
||||
m_filename = aFullFilename;
|
||||
|
||||
wxASSERT( !outputFile );
|
||||
wxASSERT( !m_outputFile );
|
||||
|
||||
// Open the PDF file in binary mode
|
||||
outputFile = wxFopen( filename, wxT( "wb" ) );
|
||||
m_outputFile = wxFopen( m_filename, wxT( "wb" ) );
|
||||
|
||||
if( outputFile == NULL )
|
||||
if( m_outputFile == NULL )
|
||||
return false ;
|
||||
|
||||
return true;
|
||||
|
@ -123,12 +123,12 @@ void PDF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
|||
double aScale, bool aMirror )
|
||||
{
|
||||
m_plotMirror = aMirror;
|
||||
plotOffset = aOffset;
|
||||
plotScale = aScale;
|
||||
m_plotOffset = aOffset;
|
||||
m_plotScale = aScale;
|
||||
m_IUsPerDecimil = aIusPerDecimil;
|
||||
|
||||
// The CTM is set to 1 user unit per decimal
|
||||
iuPerDeviceUnit = 1.0 / aIusPerDecimil;
|
||||
m_iuPerDeviceUnit = 1.0 / aIusPerDecimil;
|
||||
|
||||
/* The paper size in this engine is handled page by page
|
||||
Look in the StartPage function */
|
||||
|
@ -149,10 +149,10 @@ void PDF_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
|
|||
|
||||
wxASSERT_MSG( aWidth > 0, "Plotter called to set negative pen width" );
|
||||
|
||||
if( aWidth != currentPenWidth )
|
||||
if( aWidth != m_currentPenWidth )
|
||||
fprintf( workFile, "%g w\n", userToDeviceSize( aWidth ) );
|
||||
|
||||
currentPenWidth = aWidth;
|
||||
m_currentPenWidth = aWidth;
|
||||
}
|
||||
|
||||
|
||||
|
@ -336,18 +336,18 @@ void PDF_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
|||
|
||||
if( plume == 'Z' )
|
||||
{
|
||||
if( penState != 'Z' )
|
||||
if( m_penState != 'Z' )
|
||||
{
|
||||
fputs( "S\n", workFile );
|
||||
penState = 'Z';
|
||||
penLastpos.x = -1;
|
||||
penLastpos.y = -1;
|
||||
m_penState = 'Z';
|
||||
m_penLastpos.x = -1;
|
||||
m_penLastpos.y = -1;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if( penState != plume || pos != penLastpos )
|
||||
if( m_penState != plume || pos != m_penLastpos )
|
||||
{
|
||||
DPOINT pos_dev = userToDeviceCoordinates( pos );
|
||||
fprintf( workFile, "%g %g %c\n",
|
||||
|
@ -355,8 +355,8 @@ void PDF_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
|||
( plume=='D' ) ? 'l' : 'm' );
|
||||
}
|
||||
|
||||
penState = plume;
|
||||
penLastpos = pos;
|
||||
m_penState = plume;
|
||||
m_penLastpos = pos;
|
||||
}
|
||||
|
||||
|
||||
|
@ -401,7 +401,7 @@ void PDF_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
|
|||
" /CS %s\n"
|
||||
" /W %d\n"
|
||||
" /H %d\n"
|
||||
"ID\n", colorMode ? "/RGB" : "/G", pix_size.x, pix_size.y );
|
||||
"ID\n", m_colorMode ? "/RGB" : "/G", pix_size.x, pix_size.y );
|
||||
|
||||
/* Here comes the stream (in binary!). I *could* have hex or ascii84
|
||||
encoded it, but who cares? I'll go through zlib anyway */
|
||||
|
@ -439,7 +439,7 @@ void PDF_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
|
|||
}
|
||||
|
||||
// As usual these days, stdio buffering has to suffeeeeerrrr
|
||||
if( colorMode )
|
||||
if( m_colorMode )
|
||||
{
|
||||
putc( r, workFile );
|
||||
putc( g, workFile );
|
||||
|
@ -467,29 +467,29 @@ int PDF_PLOTTER::allocPdfObject()
|
|||
|
||||
int PDF_PLOTTER::startPdfObject(int handle)
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
wxASSERT( !workFile );
|
||||
|
||||
if( handle < 0)
|
||||
handle = allocPdfObject();
|
||||
|
||||
xrefTable[handle] = ftell( outputFile );
|
||||
fprintf( outputFile, "%d 0 obj\n", handle );
|
||||
xrefTable[handle] = ftell( m_outputFile );
|
||||
fprintf( m_outputFile, "%d 0 obj\n", handle );
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
void PDF_PLOTTER::closePdfObject()
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
wxASSERT( !workFile );
|
||||
fputs( "endobj\n", outputFile );
|
||||
fputs( "endobj\n", m_outputFile );
|
||||
}
|
||||
|
||||
|
||||
int PDF_PLOTTER::startPdfStream( int handle )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
wxASSERT( !workFile );
|
||||
handle = startPdfObject( handle );
|
||||
|
||||
|
@ -499,13 +499,13 @@ int PDF_PLOTTER::startPdfStream( int handle )
|
|||
|
||||
if( ADVANCED_CFG::GetCfg().m_DebugPDFWriter )
|
||||
{
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"<< /Length %d 0 R >>\n" // Length is deferred
|
||||
"stream\n", handle + 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"<< /Length %d 0 R /Filter /FlateDecode >>\n" // Length is deferred
|
||||
"stream\n", handle + 1 );
|
||||
}
|
||||
|
@ -548,7 +548,7 @@ void PDF_PLOTTER::closePdfStream()
|
|||
if( ADVANCED_CFG::GetCfg().m_DebugPDFWriter )
|
||||
{
|
||||
out_count = stream_len;
|
||||
fwrite( inbuf, out_count, 1, outputFile );
|
||||
fwrite( inbuf, out_count, 1, m_outputFile );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -571,29 +571,29 @@ void PDF_PLOTTER::closePdfStream()
|
|||
wxStreamBuffer* sb = memos.GetOutputStreamBuffer();
|
||||
|
||||
out_count = sb->Tell();
|
||||
fwrite( sb->GetBufferStart(), 1, out_count, outputFile );
|
||||
fwrite( sb->GetBufferStart(), 1, out_count, m_outputFile );
|
||||
}
|
||||
|
||||
delete[] inbuf;
|
||||
fputs( "endstream\n", outputFile );
|
||||
fputs( "endstream\n", m_outputFile );
|
||||
closePdfObject();
|
||||
|
||||
// Writing the deferred length as an indirect object
|
||||
startPdfObject( streamLengthHandle );
|
||||
fprintf( outputFile, "%u\n", out_count );
|
||||
fprintf( m_outputFile, "%u\n", out_count );
|
||||
closePdfObject();
|
||||
}
|
||||
|
||||
|
||||
void PDF_PLOTTER::StartPage()
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
wxASSERT( !workFile );
|
||||
|
||||
// Compute the paper size in IUs
|
||||
paperSize = pageInfo.GetSizeMils();
|
||||
paperSize.x *= 10.0 / iuPerDeviceUnit;
|
||||
paperSize.y *= 10.0 / iuPerDeviceUnit;
|
||||
m_paperSize = m_pageInfo.GetSizeMils();
|
||||
m_paperSize.x *= 10.0 / m_iuPerDeviceUnit;
|
||||
m_paperSize.y *= 10.0 / m_iuPerDeviceUnit;
|
||||
|
||||
// Open the content stream; the page object will go later
|
||||
pageStreamHandle = startPdfStream();
|
||||
|
@ -626,9 +626,9 @@ void PDF_PLOTTER::ClosePage()
|
|||
to use */
|
||||
|
||||
const double BIGPTsPERMIL = 0.072;
|
||||
wxSize psPaperSize = pageInfo.GetSizeMils();
|
||||
wxSize psPaperSize = m_pageInfo.GetSizeMils();
|
||||
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"<<\n"
|
||||
"/Type /Page\n"
|
||||
"/Parent %d 0 R\n"
|
||||
|
@ -652,7 +652,7 @@ void PDF_PLOTTER::ClosePage()
|
|||
|
||||
bool PDF_PLOTTER::StartPlot()
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
// First things first: the customary null object
|
||||
xrefTable.clear();
|
||||
|
@ -661,7 +661,7 @@ bool PDF_PLOTTER::StartPlot()
|
|||
/* The header (that's easy!). The second line is binary junk required
|
||||
to make the file binary from the beginning (the important thing is
|
||||
that they must have the bit 7 set) */
|
||||
fputs( "%PDF-1.5\n%\200\201\202\203\n", outputFile );
|
||||
fputs( "%PDF-1.5\n%\200\201\202\203\n", m_outputFile );
|
||||
|
||||
/* Allocate an entry for the page tree root, it will go in every page
|
||||
parent entry */
|
||||
|
@ -681,7 +681,7 @@ bool PDF_PLOTTER::StartPlot()
|
|||
|
||||
bool PDF_PLOTTER::EndPlot()
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
// Close the current page (often the only one)
|
||||
ClosePage();
|
||||
|
@ -706,7 +706,7 @@ bool PDF_PLOTTER::EndPlot()
|
|||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
fontdefs[i].font_handle = startPdfObject();
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"<< /BaseFont %s\n"
|
||||
" /Type /Font\n"
|
||||
" /Subtype /Type1\n"
|
||||
|
@ -721,15 +721,15 @@ bool PDF_PLOTTER::EndPlot()
|
|||
|
||||
// Named font dictionary (was allocated, now we emit it)
|
||||
startPdfObject( fontResDictHandle );
|
||||
fputs( "<<\n", outputFile );
|
||||
fputs( "<<\n", m_outputFile );
|
||||
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
fprintf( outputFile, " %s %d 0 R\n",
|
||||
fprintf( m_outputFile, " %s %d 0 R\n",
|
||||
fontdefs[i].rsname, fontdefs[i].font_handle );
|
||||
}
|
||||
|
||||
fputs( ">>\n", outputFile );
|
||||
fputs( ">>\n", m_outputFile );
|
||||
closePdfObject();
|
||||
|
||||
/* The page tree: it's a B-tree but luckily we only have few pages!
|
||||
|
@ -738,12 +738,12 @@ bool PDF_PLOTTER::EndPlot()
|
|||
startPdfObject( pageTreeHandle );
|
||||
fputs( "<<\n"
|
||||
"/Type /Pages\n"
|
||||
"/Kids [\n", outputFile );
|
||||
"/Kids [\n", m_outputFile );
|
||||
|
||||
for( unsigned i = 0; i < pageHandles.size(); i++ )
|
||||
fprintf( outputFile, "%d 0 R\n", pageHandles[i] );
|
||||
fprintf( m_outputFile, "%d 0 R\n", pageHandles[i] );
|
||||
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"]\n"
|
||||
"/Count %ld\n"
|
||||
">>\n", (long) pageHandles.size() );
|
||||
|
@ -757,14 +757,14 @@ bool PDF_PLOTTER::EndPlot()
|
|||
strftime( date_buf, 250, "D:%Y%m%d%H%M%S",
|
||||
localtime( <ime ) );
|
||||
|
||||
if( title.IsEmpty() )
|
||||
if( m_title.IsEmpty() )
|
||||
{
|
||||
// Windows uses '\' and other platforms ue '/' as separator
|
||||
title = filename.AfterLast('\\');
|
||||
title = title.AfterLast('/');
|
||||
m_title = m_filename.AfterLast( '\\');
|
||||
m_title = m_title.AfterLast( '/');
|
||||
}
|
||||
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"<<\n"
|
||||
"/Producer (KiCad PDF)\n"
|
||||
"/CreationDate (%s)\n"
|
||||
|
@ -772,15 +772,15 @@ bool PDF_PLOTTER::EndPlot()
|
|||
"/Title %s\n"
|
||||
"/Trapped False\n",
|
||||
date_buf,
|
||||
encodeStringForPlotter( creator ).c_str(),
|
||||
encodeStringForPlotter( title ).c_str() );
|
||||
encodeStringForPlotter( m_creator ).c_str(),
|
||||
encodeStringForPlotter( m_title ).c_str() );
|
||||
|
||||
fputs( ">>\n", outputFile );
|
||||
fputs( ">>\n", m_outputFile );
|
||||
closePdfObject();
|
||||
|
||||
// The catalog, at last
|
||||
int catalogHandle = startPdfObject();
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"<<\n"
|
||||
"/Type /Catalog\n"
|
||||
"/Pages %d 0 R\n"
|
||||
|
@ -793,19 +793,19 @@ bool PDF_PLOTTER::EndPlot()
|
|||
/* Emit the xref table (format is crucial to the byte, each entry must
|
||||
be 20 bytes long, and object zero must be done in that way). Also
|
||||
the offset must be kept along for the trailer */
|
||||
long xref_start = ftell( outputFile );
|
||||
fprintf( outputFile,
|
||||
long xref_start = ftell( m_outputFile );
|
||||
fprintf( m_outputFile,
|
||||
"xref\n"
|
||||
"0 %ld\n"
|
||||
"0000000000 65535 f \n", (long) xrefTable.size() );
|
||||
|
||||
for( unsigned i = 1; i < xrefTable.size(); i++ )
|
||||
{
|
||||
fprintf( outputFile, "%010ld 00000 n \n", xrefTable[i] );
|
||||
fprintf( m_outputFile, "%010ld 00000 n \n", xrefTable[i] );
|
||||
}
|
||||
|
||||
// Done the xref, go for the trailer
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"trailer\n"
|
||||
"<< /Size %lu /Root %d 0 R /Info %d 0 R >>\n"
|
||||
"startxref\n"
|
||||
|
@ -813,8 +813,8 @@ bool PDF_PLOTTER::EndPlot()
|
|||
"%%%%EOF\n",
|
||||
(unsigned long) xrefTable.size(), catalogHandle, infoDictHandle, xref_start );
|
||||
|
||||
fclose( outputFile );
|
||||
outputFile = NULL;
|
||||
fclose( m_outputFile );
|
||||
m_outputFile = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -64,9 +64,9 @@ static int getFillId( FILL_TYPE aFill )
|
|||
|
||||
void PSLIKE_PLOTTER::SetColor( COLOR4D color )
|
||||
{
|
||||
if( colorMode )
|
||||
if( m_colorMode )
|
||||
{
|
||||
if( negativeMode )
|
||||
if( m_negativeMode )
|
||||
emitSetRGBColor( 1 - color.r, 1 - color.g, 1 - color.b );
|
||||
else
|
||||
emitSetRGBColor( color.r, color.g, color.b );
|
||||
|
@ -80,7 +80,7 @@ void PSLIKE_PLOTTER::SetColor( COLOR4D color )
|
|||
double k = 1; // White
|
||||
if( color != COLOR4D::WHITE )
|
||||
k = 0;
|
||||
if( negativeMode )
|
||||
if( m_negativeMode )
|
||||
emitSetRGBColor( 1 - k, 1 - k, 1 - k );
|
||||
else
|
||||
emitSetRGBColor( k, k, k );
|
||||
|
@ -91,7 +91,7 @@ void PSLIKE_PLOTTER::SetColor( COLOR4D color )
|
|||
void PSLIKE_PLOTTER::FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize,
|
||||
double aPadOrient, OUTLINE_MODE aTraceMode, void* aData )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
int x0, y0, x1, y1, delta;
|
||||
wxSize size( aSize );
|
||||
|
||||
|
@ -420,16 +420,16 @@ void PSLIKE_PLOTTER::postscriptOverlinePositions( const wxString& aText, int aXS
|
|||
void PS_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
||||
double aScale, bool aMirror )
|
||||
{
|
||||
wxASSERT( !outputFile );
|
||||
wxASSERT( !m_outputFile );
|
||||
m_plotMirror = aMirror;
|
||||
plotOffset = aOffset;
|
||||
plotScale = aScale;
|
||||
m_plotOffset = aOffset;
|
||||
m_plotScale = aScale;
|
||||
m_IUsPerDecimil = aIusPerDecimil;
|
||||
iuPerDeviceUnit = 1.0 / aIusPerDecimil;
|
||||
m_iuPerDeviceUnit = 1.0 / aIusPerDecimil;
|
||||
/* Compute the paper size in IUs */
|
||||
paperSize = pageInfo.GetSizeMils();
|
||||
paperSize.x *= 10.0 * aIusPerDecimil;
|
||||
paperSize.y *= 10.0 * aIusPerDecimil;
|
||||
m_paperSize = m_pageInfo.GetSizeMils();
|
||||
m_paperSize.x *= 10.0 * aIusPerDecimil;
|
||||
m_paperSize.y *= 10.0 * aIusPerDecimil;
|
||||
}
|
||||
|
||||
|
||||
|
@ -534,7 +534,7 @@ void PSLIKE_PLOTTER::computeTextParameters( const wxPoint& aPos,
|
|||
*/
|
||||
void PS_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
if( aWidth == DO_NOT_SET_LINE_WIDTH )
|
||||
return;
|
||||
|
@ -546,18 +546,18 @@ void PS_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
|
|||
wxASSERT_MSG( aWidth > 0, "Plotter called to set negative pen width" );
|
||||
|
||||
if( aWidth != GetCurrentLineWidth() )
|
||||
fprintf( outputFile, "%g setlinewidth\n", userToDeviceSize( aWidth ) );
|
||||
fprintf( m_outputFile, "%g setlinewidth\n", userToDeviceSize( aWidth ) );
|
||||
|
||||
currentPenWidth = aWidth;
|
||||
m_currentPenWidth = aWidth;
|
||||
}
|
||||
|
||||
|
||||
void PS_PLOTTER::emitSetRGBColor( double r, double g, double b )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
// XXX why %.3g ? shouldn't %g suffice? who cares...
|
||||
fprintf( outputFile, "%.3g %.3g %.3g setrgbcolor\n", r, g, b );
|
||||
fprintf( m_outputFile, "%.3g %.3g %.3g setrgbcolor\n", r, g, b );
|
||||
}
|
||||
|
||||
|
||||
|
@ -569,20 +569,20 @@ void PS_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
|
|||
switch( dashed )
|
||||
{
|
||||
case PLOT_DASH_TYPE::DASH:
|
||||
fprintf( outputFile, "[%d %d] 0 setdash\n",
|
||||
fprintf( m_outputFile, "[%d %d] 0 setdash\n",
|
||||
(int) GetDashMarkLenIU(), (int) GetDashGapLenIU() );
|
||||
break;
|
||||
case PLOT_DASH_TYPE::DOT:
|
||||
fprintf( outputFile, "[%d %d] 0 setdash\n",
|
||||
fprintf( m_outputFile, "[%d %d] 0 setdash\n",
|
||||
(int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
|
||||
break;
|
||||
case PLOT_DASH_TYPE::DASHDOT:
|
||||
fprintf( outputFile, "[%d %d %d %d] 0 setdash\n",
|
||||
fprintf( m_outputFile, "[%d %d %d %d] 0 setdash\n",
|
||||
(int) GetDashMarkLenIU(), (int) GetDashGapLenIU(),
|
||||
(int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
|
||||
break;
|
||||
default:
|
||||
fputs( "solidline\n", outputFile );
|
||||
fputs( "solidline\n", m_outputFile );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -593,26 +593,26 @@ void PS_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill, int
|
|||
DPOINT p2_dev = userToDeviceCoordinates( p2 );
|
||||
|
||||
SetCurrentLineWidth( width );
|
||||
fprintf( outputFile, "%g %g %g %g rect%d\n", p1_dev.x, p1_dev.y,
|
||||
fprintf( m_outputFile, "%g %g %g %g rect%d\n", p1_dev.x, p1_dev.y,
|
||||
p2_dev.x - p1_dev.x, p2_dev.y - p1_dev.y, getFillId( fill ) );
|
||||
}
|
||||
|
||||
|
||||
void PS_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_TYPE fill, int width )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
DPOINT pos_dev = userToDeviceCoordinates( pos );
|
||||
double radius = userToDeviceSize( diametre / 2.0 );
|
||||
|
||||
SetCurrentLineWidth( width );
|
||||
fprintf( outputFile, "%g %g %g cir%d\n", pos_dev.x, pos_dev.y, radius, getFillId( fill ) );
|
||||
fprintf( m_outputFile, "%g %g %g cir%d\n", pos_dev.x, pos_dev.y, radius, getFillId( fill ) );
|
||||
}
|
||||
|
||||
|
||||
void PS_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle,
|
||||
int radius, FILL_TYPE fill, int width )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
if( radius <= 0 )
|
||||
return;
|
||||
|
@ -641,7 +641,7 @@ void PS_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle,
|
|||
}
|
||||
}
|
||||
|
||||
fprintf( outputFile, "%g %g %g %g %g arc%d\n", centre_dev.x, centre_dev.y,
|
||||
fprintf( m_outputFile, "%g %g %g %g %g arc%d\n", centre_dev.x, centre_dev.y,
|
||||
radius_dev, StAngle / 10.0, EndAngle / 10.0, getFillId( fill ) );
|
||||
}
|
||||
|
||||
|
@ -655,16 +655,16 @@ void PS_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
|
|||
SetCurrentLineWidth( aWidth );
|
||||
|
||||
DPOINT pos = userToDeviceCoordinates( aCornerList[0] );
|
||||
fprintf( outputFile, "newpath\n%g %g moveto\n", pos.x, pos.y );
|
||||
fprintf( m_outputFile, "newpath\n%g %g moveto\n", pos.x, pos.y );
|
||||
|
||||
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
|
||||
{
|
||||
pos = userToDeviceCoordinates( aCornerList[ii] );
|
||||
fprintf( outputFile, "%g %g lineto\n", pos.x, pos.y );
|
||||
fprintf( m_outputFile, "%g %g lineto\n", pos.x, pos.y );
|
||||
}
|
||||
|
||||
// Close/(fill) the path
|
||||
fprintf( outputFile, "poly%d\n", getFillId( aFill ) );
|
||||
fprintf( m_outputFile, "poly%d\n", getFillId( aFill ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -690,28 +690,28 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
|
|||
end.x = start.x + drawsize.x;
|
||||
end.y = start.y - drawsize.y;
|
||||
|
||||
fprintf( outputFile, "/origstate save def\n" );
|
||||
fprintf( outputFile, "/pix %d string def\n", pix_size.x );
|
||||
fprintf( m_outputFile, "/origstate save def\n" );
|
||||
fprintf( m_outputFile, "/pix %d string def\n", pix_size.x );
|
||||
|
||||
// Locate lower-left corner of image
|
||||
DPOINT start_dev = userToDeviceCoordinates( start );
|
||||
fprintf( outputFile, "%g %g translate\n", start_dev.x, start_dev.y );
|
||||
fprintf( m_outputFile, "%g %g translate\n", start_dev.x, start_dev.y );
|
||||
// Map image size to device
|
||||
DPOINT end_dev = userToDeviceCoordinates( end );
|
||||
fprintf( outputFile, "%g %g scale\n",
|
||||
fprintf( m_outputFile, "%g %g scale\n",
|
||||
std::abs(end_dev.x - start_dev.x), std::abs(end_dev.y - start_dev.y));
|
||||
|
||||
// Dimensions of source image (in pixels
|
||||
fprintf( outputFile, "%d %d 8", pix_size.x, pix_size.y );
|
||||
fprintf( m_outputFile, "%d %d 8", pix_size.x, pix_size.y );
|
||||
// Map unit square to source
|
||||
fprintf( outputFile, " [%d 0 0 %d 0 %d]\n", pix_size.x, -pix_size.y , pix_size.y);
|
||||
fprintf( m_outputFile, " [%d 0 0 %d 0 %d]\n", pix_size.x, -pix_size.y , pix_size.y);
|
||||
// include image data in ps file
|
||||
fprintf( outputFile, "{currentfile pix readhexstring pop}\n" );
|
||||
fprintf( m_outputFile, "{currentfile pix readhexstring pop}\n" );
|
||||
|
||||
if( colorMode )
|
||||
fputs( "false 3 colorimage\n", outputFile );
|
||||
if( m_colorMode )
|
||||
fputs( "false 3 colorimage\n", m_outputFile );
|
||||
else
|
||||
fputs( "image\n", outputFile );
|
||||
fputs( "image\n", m_outputFile );
|
||||
// Single data source, 3 colors, Output RGB data (hexadecimal)
|
||||
// (or the same downscaled to gray)
|
||||
int jj = 0;
|
||||
|
@ -723,7 +723,7 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
|
|||
if( jj >= 16 )
|
||||
{
|
||||
jj = 0;
|
||||
fprintf( outputFile, "\n");
|
||||
fprintf( m_outputFile, "\n");
|
||||
}
|
||||
|
||||
int red, green, blue;
|
||||
|
@ -756,55 +756,57 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
|
|||
}
|
||||
}
|
||||
|
||||
if( colorMode )
|
||||
fprintf( outputFile, "%2.2X%2.2X%2.2X", red, green, blue );
|
||||
if( m_colorMode )
|
||||
{
|
||||
fprintf( m_outputFile, "%2.2X%2.2X%2.2X", red, green, blue );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Greyscale conversion (CIE 1931)
|
||||
unsigned char grey = KiROUND( red * 0.2126 + green * 0.7152 + blue * 0.0722 );
|
||||
|
||||
fprintf( outputFile, "%2.2X", grey );
|
||||
fprintf( m_outputFile, "%2.2X", grey );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fprintf( outputFile, "\n");
|
||||
fprintf( outputFile, "origstate restore\n" );
|
||||
fprintf( m_outputFile, "\n");
|
||||
fprintf( m_outputFile, "origstate restore\n" );
|
||||
}
|
||||
|
||||
|
||||
void PS_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
if( plume == 'Z' )
|
||||
{
|
||||
if( penState != 'Z' )
|
||||
if( m_penState != 'Z' )
|
||||
{
|
||||
fputs( "stroke\n", outputFile );
|
||||
penState = 'Z';
|
||||
penLastpos.x = -1;
|
||||
penLastpos.y = -1;
|
||||
fputs( "stroke\n", m_outputFile );
|
||||
m_penState = 'Z';
|
||||
m_penLastpos.x = -1;
|
||||
m_penLastpos.y = -1;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if( penState == 'Z' )
|
||||
if( m_penState == 'Z' )
|
||||
{
|
||||
fputs( "newpath\n", outputFile );
|
||||
fputs( "newpath\n", m_outputFile );
|
||||
}
|
||||
|
||||
if( penState != plume || pos != penLastpos )
|
||||
if( m_penState != plume || pos != m_penLastpos )
|
||||
{
|
||||
DPOINT pos_dev = userToDeviceCoordinates( pos );
|
||||
fprintf( outputFile, "%g %g %sto\n",
|
||||
fprintf( m_outputFile, "%g %g %sto\n",
|
||||
pos_dev.x, pos_dev.y,
|
||||
( plume=='D' ) ? "line" : "move" );
|
||||
}
|
||||
|
||||
penState = plume;
|
||||
penLastpos = pos;
|
||||
m_penState = plume;
|
||||
m_penLastpos = pos;
|
||||
}
|
||||
|
||||
|
||||
|
@ -823,7 +825,7 @@ void PS_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
|||
*/
|
||||
bool PS_PLOTTER::StartPlot()
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
wxString msg;
|
||||
|
||||
static const char* PSMacro[] =
|
||||
|
@ -881,16 +883,16 @@ bool PS_PLOTTER::StartPlot()
|
|||
|
||||
time_t time1970 = time( NULL );
|
||||
|
||||
fputs( "%!PS-Adobe-3.0\n", outputFile ); // Print header
|
||||
fputs( "%!PS-Adobe-3.0\n", m_outputFile ); // Print header
|
||||
|
||||
fprintf( outputFile, "%%%%Creator: %s\n", TO_UTF8( creator ) );
|
||||
fprintf( m_outputFile, "%%%%Creator: %s\n", TO_UTF8( m_creator ) );
|
||||
|
||||
/* A "newline" character ("\n") is not included in the following string,
|
||||
because it is provided by the ctime() function. */
|
||||
fprintf( outputFile, "%%%%CreationDate: %s", ctime( &time1970 ) );
|
||||
fprintf( outputFile, "%%%%Title: %s\n", encodeStringForPlotter( title ).c_str() );
|
||||
fprintf( outputFile, "%%%%Pages: 1\n" );
|
||||
fprintf( outputFile, "%%%%PageOrder: Ascend\n" );
|
||||
fprintf( m_outputFile, "%%%%CreationDate: %s", ctime( &time1970 ) );
|
||||
fprintf( m_outputFile, "%%%%Title: %s\n", encodeStringForPlotter( m_title ).c_str() );
|
||||
fprintf( m_outputFile, "%%%%Pages: 1\n" );
|
||||
fprintf( m_outputFile, "%%%%PageOrder: Ascend\n" );
|
||||
|
||||
// Print boundary box in 1/72 pixels per inch, box is in mils
|
||||
const double BIGPTsPERMIL = 0.072;
|
||||
|
@ -898,12 +900,12 @@ bool PS_PLOTTER::StartPlot()
|
|||
/* The coordinates of the lower left corner of the boundary
|
||||
box need to be "rounded down", but the coordinates of its
|
||||
upper right corner need to be "rounded up" instead. */
|
||||
wxSize psPaperSize = pageInfo.GetSizeMils();
|
||||
wxSize psPaperSize = m_pageInfo.GetSizeMils();
|
||||
|
||||
if( !pageInfo.IsPortrait() )
|
||||
psPaperSize.Set( pageInfo.GetHeightMils(), pageInfo.GetWidthMils() );
|
||||
if( !m_pageInfo.IsPortrait() )
|
||||
psPaperSize.Set( m_pageInfo.GetHeightMils(), m_pageInfo.GetWidthMils() );
|
||||
|
||||
fprintf( outputFile, "%%%%BoundingBox: 0 0 %d %d\n",
|
||||
fprintf( m_outputFile, "%%%%BoundingBox: 0 0 %d %d\n",
|
||||
(int) ceil( psPaperSize.x * BIGPTsPERMIL ),
|
||||
(int) ceil( psPaperSize.y * BIGPTsPERMIL ) );
|
||||
|
||||
|
@ -922,29 +924,32 @@ bool PS_PLOTTER::StartPlot()
|
|||
// Also note pageSize is given in mils, not in internal units and must be
|
||||
// converted to internal units.
|
||||
|
||||
if( pageInfo.IsCustom() )
|
||||
fprintf( outputFile, "%%%%DocumentMedia: Custom %d %d 0 () ()\n",
|
||||
if( m_pageInfo.IsCustom() )
|
||||
{
|
||||
fprintf( m_outputFile, "%%%%DocumentMedia: Custom %d %d 0 () ()\n",
|
||||
KiROUND( psPaperSize.x * BIGPTsPERMIL ),
|
||||
KiROUND( psPaperSize.y * BIGPTsPERMIL ) );
|
||||
|
||||
}
|
||||
else // a standard paper size
|
||||
fprintf( outputFile, "%%%%DocumentMedia: %s %d %d 0 () ()\n",
|
||||
TO_UTF8( pageInfo.GetType() ),
|
||||
{
|
||||
fprintf( m_outputFile, "%%%%DocumentMedia: %s %d %d 0 () ()\n",
|
||||
TO_UTF8( m_pageInfo.GetType() ),
|
||||
KiROUND( psPaperSize.x * BIGPTsPERMIL ),
|
||||
KiROUND( psPaperSize.y * BIGPTsPERMIL ) );
|
||||
}
|
||||
|
||||
if( pageInfo.IsPortrait() )
|
||||
fprintf( outputFile, "%%%%Orientation: Portrait\n" );
|
||||
if( m_pageInfo.IsPortrait() )
|
||||
fprintf( m_outputFile, "%%%%Orientation: Portrait\n" );
|
||||
else
|
||||
fprintf( outputFile, "%%%%Orientation: Landscape\n" );
|
||||
fprintf( m_outputFile, "%%%%Orientation: Landscape\n" );
|
||||
|
||||
fprintf( outputFile, "%%%%EndComments\n" );
|
||||
fprintf( m_outputFile, "%%%%EndComments\n" );
|
||||
|
||||
// Now specify various other details.
|
||||
|
||||
for( int ii = 0; PSMacro[ii] != NULL; ii++ )
|
||||
{
|
||||
fputs( PSMacro[ii], outputFile );
|
||||
fputs( PSMacro[ii], m_outputFile );
|
||||
}
|
||||
|
||||
// The following string has been specified here (rather than within
|
||||
|
@ -955,21 +960,21 @@ bool PS_PLOTTER::StartPlot()
|
|||
"%%BeginPageSetup\n"
|
||||
"gsave\n"
|
||||
"0.0072 0.0072 scale\n" // Configure postscript for decimils coordinates
|
||||
"linemode1\n", outputFile );
|
||||
"linemode1\n", m_outputFile );
|
||||
|
||||
|
||||
// Rototranslate the coordinate to achieve the landscape layout
|
||||
if( !pageInfo.IsPortrait() )
|
||||
fprintf( outputFile, "%d 0 translate 90 rotate\n", 10 * psPaperSize.x );
|
||||
if( !m_pageInfo.IsPortrait() )
|
||||
fprintf( m_outputFile, "%d 0 translate 90 rotate\n", 10 * psPaperSize.x );
|
||||
|
||||
// Apply the user fine scale adjustments
|
||||
if( plotScaleAdjX != 1.0 || plotScaleAdjY != 1.0 )
|
||||
fprintf( outputFile, "%g %g scale\n", plotScaleAdjX, plotScaleAdjY );
|
||||
fprintf( m_outputFile, "%g %g scale\n", plotScaleAdjX, plotScaleAdjY );
|
||||
|
||||
// Set default line width
|
||||
fprintf( outputFile, "%g setlinewidth\n",
|
||||
fprintf( m_outputFile, "%g setlinewidth\n",
|
||||
userToDeviceSize( m_renderSettings->GetDefaultPenWidth() ) );
|
||||
fputs( "%%EndPageSetup\n", outputFile );
|
||||
fputs( "%%EndPageSetup\n", m_outputFile );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -977,12 +982,12 @@ bool PS_PLOTTER::StartPlot()
|
|||
|
||||
bool PS_PLOTTER::EndPlot()
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
fputs( "showpage\n"
|
||||
"grestore\n"
|
||||
"%%EOF\n", outputFile );
|
||||
fclose( outputFile );
|
||||
outputFile = NULL;
|
||||
"%%EOF\n", m_outputFile );
|
||||
fclose( m_outputFile );
|
||||
m_outputFile = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1010,7 +1015,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
|
|||
{
|
||||
std::string ps_test = encodeStringForPlotter( aText );
|
||||
DPOINT pos_dev = userToDeviceCoordinates( aPos );
|
||||
fprintf( outputFile, "%s %g %g phantomshow\n", ps_test.c_str(), pos_dev.x, pos_dev.y );
|
||||
fprintf( m_outputFile, "%s %g %g phantomshow\n", ps_test.c_str(), pos_dev.x, pos_dev.y );
|
||||
}
|
||||
|
||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth,
|
||||
|
|
|
@ -180,14 +180,14 @@ void SVG_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
|||
{
|
||||
m_plotMirror = aMirror;
|
||||
m_yaxisReversed = true; // unlike other plotters, SVG has Y axis reversed
|
||||
plotOffset = aOffset;
|
||||
plotScale = aScale;
|
||||
m_plotOffset = aOffset;
|
||||
m_plotScale = aScale;
|
||||
m_IUsPerDecimil = aIusPerDecimil;
|
||||
|
||||
/* Compute the paper size in IUs */
|
||||
paperSize = pageInfo.GetSizeMils();
|
||||
paperSize.x *= 10.0 * aIusPerDecimil;
|
||||
paperSize.y *= 10.0 * aIusPerDecimil;
|
||||
m_paperSize = m_pageInfo.GetSizeMils();
|
||||
m_paperSize.x *= 10.0 * aIusPerDecimil;
|
||||
m_paperSize.y *= 10.0 * aIusPerDecimil;
|
||||
|
||||
// set iuPerDeviceUnit, in 0.1mils ( 2.54um )
|
||||
// this was used before the format was changable, so we set is as default
|
||||
|
@ -201,10 +201,10 @@ void SVG_PLOTTER::SetSvgCoordinatesFormat( unsigned aResolution, bool aUseInches
|
|||
|
||||
// gives now a default value to iuPerDeviceUnit (because the units of the caller is now known)
|
||||
double iusPerMM = m_IUsPerDecimil / 2.54 * 1000;
|
||||
iuPerDeviceUnit = pow( 10.0, m_precision ) / ( iusPerMM );
|
||||
m_iuPerDeviceUnit = pow( 10.0, m_precision ) / ( iusPerMM );
|
||||
|
||||
if( m_useInch )
|
||||
iuPerDeviceUnit /= 25.4; // convert to inch
|
||||
m_iuPerDeviceUnit /= 25.4; // convert to inch
|
||||
}
|
||||
|
||||
|
||||
|
@ -230,23 +230,23 @@ void SVG_PLOTTER::setFillMode( FILL_TYPE fill )
|
|||
void SVG_PLOTTER::setSVGPlotStyle( bool aIsGroup, const std::string& aExtraStyle )
|
||||
{
|
||||
if( aIsGroup )
|
||||
fputs( "</g>\n<g ", outputFile );
|
||||
fputs( "</g>\n<g ", m_outputFile );
|
||||
|
||||
// output the background fill color
|
||||
fprintf( outputFile, "style=\"fill:#%6.6lX; ", m_brush_rgb_color );
|
||||
fprintf( m_outputFile, "style=\"fill:#%6.6lX; ", m_brush_rgb_color );
|
||||
|
||||
switch( m_fillMode )
|
||||
{
|
||||
case FILL_TYPE::NO_FILL:
|
||||
fputs( "fill-opacity:0.0; ", outputFile );
|
||||
fputs( "fill-opacity:0.0; ", m_outputFile );
|
||||
break;
|
||||
|
||||
case FILL_TYPE::FILLED_SHAPE:
|
||||
fputs( "fill-opacity:1.0; ", outputFile );
|
||||
fputs( "fill-opacity:1.0; ", m_outputFile );
|
||||
break;
|
||||
|
||||
case FILL_TYPE::FILLED_WITH_BG_BODYCOLOR:
|
||||
fputs( "fill-opacity:0.6; ", outputFile );
|
||||
fputs( "fill-opacity:0.6; ", m_outputFile );
|
||||
break;
|
||||
|
||||
case FILL_TYPE::FILLED_WITH_COLOR:
|
||||
|
@ -259,21 +259,21 @@ void SVG_PLOTTER::setSVGPlotStyle( bool aIsGroup, const std::string& aExtraStyle
|
|||
if( pen_w < 0.0 ) // Ensure pen width validity
|
||||
pen_w = 0.0;
|
||||
|
||||
fprintf( outputFile, "\nstroke:#%6.6lX; stroke-width:%f; stroke-opacity:1; \n",
|
||||
fprintf( m_outputFile, "\nstroke:#%6.6lX; stroke-width:%f; stroke-opacity:1; \n",
|
||||
m_pen_rgb_color, pen_w );
|
||||
fputs( "stroke-linecap:round; stroke-linejoin:round;", outputFile );
|
||||
fputs( "stroke-linecap:round; stroke-linejoin:round;", m_outputFile );
|
||||
|
||||
//set any extra attributes for non-solid lines
|
||||
switch( m_dashed )
|
||||
{
|
||||
case PLOT_DASH_TYPE::DASH:
|
||||
fprintf( outputFile, "stroke-dasharray:%f,%f;", GetDashMarkLenIU(), GetDashGapLenIU() );
|
||||
fprintf( m_outputFile, "stroke-dasharray:%f,%f;", GetDashMarkLenIU(), GetDashGapLenIU() );
|
||||
break;
|
||||
case PLOT_DASH_TYPE::DOT:
|
||||
fprintf( outputFile, "stroke-dasharray:%f,%f;", GetDotMarkLenIU(), GetDashGapLenIU() );
|
||||
fprintf( m_outputFile, "stroke-dasharray:%f,%f;", GetDotMarkLenIU(), GetDashGapLenIU() );
|
||||
break;
|
||||
case PLOT_DASH_TYPE::DASHDOT:
|
||||
fprintf( outputFile, "stroke-dasharray:%f,%f,%f,%f;", GetDashMarkLenIU(), GetDashGapLenIU(),
|
||||
fprintf( m_outputFile, "stroke-dasharray:%f,%f,%f,%f;", GetDashMarkLenIU(), GetDashGapLenIU(),
|
||||
GetDotMarkLenIU(), GetDashGapLenIU() );
|
||||
break;
|
||||
case PLOT_DASH_TYPE::DEFAULT:
|
||||
|
@ -285,18 +285,18 @@ void SVG_PLOTTER::setSVGPlotStyle( bool aIsGroup, const std::string& aExtraStyle
|
|||
|
||||
if( aExtraStyle.length() )
|
||||
{
|
||||
fputs( aExtraStyle.c_str(), outputFile );
|
||||
fputs( aExtraStyle.c_str(), m_outputFile );
|
||||
}
|
||||
|
||||
fputs( "\"", outputFile );
|
||||
fputs( "\"", m_outputFile );
|
||||
|
||||
if( aIsGroup )
|
||||
{
|
||||
fputs( ">", outputFile );
|
||||
fputs( ">", m_outputFile );
|
||||
m_graphics_changed = false;
|
||||
}
|
||||
|
||||
fputs( "\n", outputFile );
|
||||
fputs( "\n", m_outputFile );
|
||||
}
|
||||
|
||||
/* Set the current line width (in IUs) for the next plot
|
||||
|
@ -312,10 +312,10 @@ void SVG_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
|
|||
|
||||
wxASSERT_MSG( aWidth > 0, "Plotter called to set negative pen width" );
|
||||
|
||||
if( aWidth != currentPenWidth )
|
||||
if( aWidth != m_currentPenWidth )
|
||||
{
|
||||
m_graphics_changed = true;
|
||||
currentPenWidth = aWidth;
|
||||
m_currentPenWidth = aWidth;
|
||||
}
|
||||
|
||||
if( m_graphics_changed )
|
||||
|
@ -327,17 +327,18 @@ void SVG_PLOTTER::StartBlock( void* aData )
|
|||
{
|
||||
std::string* idstr = reinterpret_cast<std::string*>( aData );
|
||||
|
||||
fputs( "<g ", outputFile );
|
||||
if( idstr )
|
||||
fprintf( outputFile, "id=\"%s\"", idstr->c_str() );
|
||||
fputs( "<g ", m_outputFile );
|
||||
|
||||
fprintf( outputFile, ">\n" );
|
||||
if( idstr )
|
||||
fprintf( m_outputFile, "id=\"%s\"", idstr->c_str() );
|
||||
|
||||
fprintf( m_outputFile, ">\n" );
|
||||
}
|
||||
|
||||
|
||||
void SVG_PLOTTER::EndBlock( void* aData )
|
||||
{
|
||||
fprintf( outputFile, "</g>\n" );
|
||||
fprintf( m_outputFile, "</g>\n" );
|
||||
|
||||
m_graphics_changed = true;
|
||||
}
|
||||
|
@ -400,19 +401,20 @@ void SVG_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill, in
|
|||
// Rectangles having a 0 size value for height or width are just not drawn on Inscape,
|
||||
// so use a line when happens.
|
||||
if( rect_dev.GetSize().x == 0.0 || rect_dev.GetSize().y == 0.0 ) // Draw a line
|
||||
fprintf( outputFile,
|
||||
{
|
||||
fprintf( m_outputFile,
|
||||
"<line x1=\"%f\" y1=\"%f\" x2=\"%f\" y2=\"%f\" />\n",
|
||||
rect_dev.GetPosition().x, rect_dev.GetPosition().y,
|
||||
rect_dev.GetEnd().x, rect_dev.GetEnd().y
|
||||
);
|
||||
|
||||
rect_dev.GetEnd().x, rect_dev.GetEnd().y );
|
||||
}
|
||||
else
|
||||
fprintf( outputFile,
|
||||
{
|
||||
fprintf( m_outputFile,
|
||||
"<rect x=\"%f\" y=\"%f\" width=\"%f\" height=\"%f\" rx=\"%f\" />\n",
|
||||
rect_dev.GetPosition().x, rect_dev.GetPosition().y,
|
||||
rect_dev.GetSize().x, rect_dev.GetSize().y,
|
||||
0.0 // radius of rounded corners
|
||||
);
|
||||
0.0 /* radius of rounded corners */ );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -433,7 +435,7 @@ void SVG_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_TYPE fill, int
|
|||
radius = userToDeviceSize( ( diametre / 2.0 ) + ( width / 2.0 ) );
|
||||
}
|
||||
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"<circle cx=\"%f\" cy=\"%f\" r=\"%f\" /> \n",
|
||||
pos_dev.x, pos_dev.y, radius );
|
||||
}
|
||||
|
@ -526,7 +528,7 @@ void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
|
|||
setFillMode( fill );
|
||||
SetCurrentLineWidth( 0 );
|
||||
|
||||
fprintf( outputFile, "<path d=\"M%f %f A%f %f 0.0 %d %d %f %f L %f %f Z\" />\n",
|
||||
fprintf( m_outputFile, "<path d=\"M%f %f A%f %f 0.0 %d %d %f %f L %f %f Z\" />\n",
|
||||
start.x, start.y, radius_dev, radius_dev,
|
||||
flg_arc, flg_sweep,
|
||||
end.x, end.y, centre_dev.x, centre_dev.y );
|
||||
|
@ -534,7 +536,7 @@ void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
|
|||
|
||||
setFillMode( FILL_TYPE::NO_FILL );
|
||||
SetCurrentLineWidth( width );
|
||||
fprintf( outputFile, "<path d=\"M%f %f A%f %f 0.0 %d %d %f %f\" />\n",
|
||||
fprintf( m_outputFile, "<path d=\"M%f %f A%f %f 0.0 %d %d %f %f\" />\n",
|
||||
start.x, start.y, radius_dev, radius_dev,
|
||||
flg_arc, flg_sweep,
|
||||
end.x, end.y );
|
||||
|
@ -555,7 +557,7 @@ void SVG_PLOTTER::BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
|
|||
DPOINT end = userToDeviceCoordinates( aEnd );
|
||||
|
||||
// Generate a cubic curve: start point and 3 other control points.
|
||||
fprintf( outputFile, "<path d=\"M%f,%f C%f,%f %f,%f %f,%f\" />\n",
|
||||
fprintf( m_outputFile, "<path d=\"M%f,%f C%f,%f %f,%f %f,%f\" />\n",
|
||||
start.x, start.y, ctrl1.x, ctrl1.y,
|
||||
ctrl2.x, ctrl2.y, end.x, end.y );
|
||||
#else
|
||||
|
@ -572,7 +574,7 @@ void SVG_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
|
|||
|
||||
setFillMode( aFill );
|
||||
SetCurrentLineWidth( aWidth );
|
||||
fprintf( outputFile, "<path ");
|
||||
fprintf( m_outputFile, "<path ");
|
||||
|
||||
switch( aFill )
|
||||
{
|
||||
|
@ -591,21 +593,21 @@ void SVG_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
|
|||
}
|
||||
|
||||
DPOINT pos = userToDeviceCoordinates( aCornerList[0] );
|
||||
fprintf( outputFile, "d=\"M %f,%f\n", pos.x, pos.y );
|
||||
fprintf( m_outputFile, "d=\"M %f,%f\n", pos.x, pos.y );
|
||||
|
||||
for( unsigned ii = 1; ii < aCornerList.size() - 1; ii++ )
|
||||
{
|
||||
pos = userToDeviceCoordinates( aCornerList[ii] );
|
||||
fprintf( outputFile, "%f,%f\n", pos.x, pos.y );
|
||||
fprintf( m_outputFile, "%f,%f\n", pos.x, pos.y );
|
||||
}
|
||||
|
||||
// If the cornerlist ends where it begins, then close the poly
|
||||
if( aCornerList.front() == aCornerList.back() )
|
||||
fprintf( outputFile, "Z\" /> \n" );
|
||||
fprintf( m_outputFile, "Z\" /> \n" );
|
||||
else
|
||||
{
|
||||
pos = userToDeviceCoordinates( aCornerList.back() );
|
||||
fprintf( outputFile, "%f,%f\n\" /> \n", pos.x, pos.y );
|
||||
fprintf( m_outputFile, "%f,%f\n\" /> \n", pos.x, pos.y );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -644,20 +646,20 @@ void SVG_PLOTTER::PlotImage( const wxImage& aImage, const wxPoint& aPos,
|
|||
img_stream.CopyTo( buffer.data(), buffer.size() );
|
||||
base64::encode( buffer, encoded );
|
||||
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"<image x=\"%f\" y=\"%f\" xlink:href=\"data:image/png;base64,",
|
||||
userToDeviceSize( start.x ), userToDeviceSize( start.y )
|
||||
);
|
||||
|
||||
for( size_t i = 0; i < encoded.size(); i++ )
|
||||
{
|
||||
fprintf( outputFile, "%c", static_cast<char>( encoded[i] ) );
|
||||
fprintf( m_outputFile, "%c", static_cast<char>( encoded[i] ) );
|
||||
|
||||
if( ( i % 64 ) == 63 )
|
||||
fprintf( outputFile, "\n" );
|
||||
fprintf( m_outputFile, "\n" );
|
||||
}
|
||||
|
||||
fprintf( outputFile, "\"\npreserveAspectRatio=\"none\" width=\"%f\" height=\"%f\" />",
|
||||
fprintf( m_outputFile, "\"\npreserveAspectRatio=\"none\" width=\"%f\" height=\"%f\" />",
|
||||
userToDeviceSize( drawsize.x ), userToDeviceSize( drawsize.y ) );
|
||||
}
|
||||
}
|
||||
|
@ -667,18 +669,18 @@ void SVG_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
|||
{
|
||||
if( plume == 'Z' )
|
||||
{
|
||||
if( penState != 'Z' )
|
||||
if( m_penState != 'Z' )
|
||||
{
|
||||
fputs( "\" />\n", outputFile );
|
||||
penState = 'Z';
|
||||
penLastpos.x = -1;
|
||||
penLastpos.y = -1;
|
||||
fputs( "\" />\n", m_outputFile );
|
||||
m_penState = 'Z';
|
||||
m_penLastpos.x = -1;
|
||||
m_penLastpos.y = -1;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if( penState == 'Z' ) // here plume = 'D' or 'U'
|
||||
if( m_penState == 'Z' ) // here plume = 'D' or 'U'
|
||||
{
|
||||
DPOINT pos_dev = userToDeviceCoordinates( pos );
|
||||
|
||||
|
@ -690,18 +692,18 @@ void SVG_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
|||
setSVGPlotStyle();
|
||||
}
|
||||
|
||||
fprintf( outputFile, "<path d=\"M%d %d\n",
|
||||
fprintf( m_outputFile, "<path d=\"M%d %d\n",
|
||||
(int) pos_dev.x, (int) pos_dev.y );
|
||||
}
|
||||
else if( penState != plume || pos != penLastpos )
|
||||
else if( m_penState != plume || pos != m_penLastpos )
|
||||
{
|
||||
DPOINT pos_dev = userToDeviceCoordinates( pos );
|
||||
fprintf( outputFile, "L%d %d\n",
|
||||
fprintf( m_outputFile, "L%d %d\n",
|
||||
(int) pos_dev.x, (int) pos_dev.y );
|
||||
}
|
||||
|
||||
penState = plume;
|
||||
penLastpos = pos;
|
||||
m_penState = plume;
|
||||
m_penLastpos = pos;
|
||||
}
|
||||
|
||||
|
||||
|
@ -711,7 +713,7 @@ void SVG_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
|||
*/
|
||||
bool SVG_PLOTTER::StartPlot()
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
wxASSERT( m_outputFile );
|
||||
wxString msg;
|
||||
|
||||
static const char* header[] =
|
||||
|
@ -730,15 +732,15 @@ bool SVG_PLOTTER::StartPlot()
|
|||
// Write header.
|
||||
for( int ii = 0; header[ii] != NULL; ii++ )
|
||||
{
|
||||
fputs( header[ii], outputFile );
|
||||
fputs( header[ii], m_outputFile );
|
||||
}
|
||||
|
||||
// Write viewport pos and size
|
||||
wxPoint origin; // TODO set to actual value
|
||||
fprintf( outputFile, " width=\"%fcm\" height=\"%fcm\" viewBox=\"%d %d %d %d\">\n",
|
||||
(double) paperSize.x / m_IUsPerDecimil * 2.54 / 10000,
|
||||
(double) paperSize.y / m_IUsPerDecimil * 2.54 / 10000, origin.x, origin.y,
|
||||
(int) ( paperSize.x * iuPerDeviceUnit ), (int) ( paperSize.y * iuPerDeviceUnit) );
|
||||
fprintf( m_outputFile, " width=\"%fcm\" height=\"%fcm\" viewBox=\"%d %d %d %d\">\n",
|
||||
(double) m_paperSize.x / m_IUsPerDecimil * 2.54 / 10000,
|
||||
(double) m_paperSize.y / m_IUsPerDecimil * 2.54 / 10000, origin.x, origin.y,
|
||||
(int) ( m_paperSize.x * m_iuPerDeviceUnit ), (int) ( m_paperSize.y * m_iuPerDeviceUnit) );
|
||||
|
||||
// Write title
|
||||
char date_buf[250];
|
||||
|
@ -746,31 +748,31 @@ bool SVG_PLOTTER::StartPlot()
|
|||
strftime( date_buf, 250, "%Y/%m/%d %H:%M:%S",
|
||||
localtime( <ime ) );
|
||||
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"<title>SVG Picture created as %s date %s </title>\n",
|
||||
TO_UTF8( XmlEsc( wxFileName( filename ).GetFullName() ) ), date_buf );
|
||||
TO_UTF8( XmlEsc( wxFileName( m_filename ).GetFullName() ) ), date_buf );
|
||||
// End of header
|
||||
fprintf( outputFile, " <desc>Picture generated by %s </desc>\n",
|
||||
TO_UTF8( XmlEsc( creator ) ) );
|
||||
fprintf( m_outputFile, " <desc>Picture generated by %s </desc>\n",
|
||||
TO_UTF8( XmlEsc( m_creator ) ) );
|
||||
|
||||
// output the pen and brush color (RVB values in hex) and opacity
|
||||
double opacity = 1.0; // 0.0 (transparent to 1.0 (solid)
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"<g style=\"fill:#%6.6lX; fill-opacity:%f;stroke:#%6.6lX; stroke-opacity:%f;\n",
|
||||
m_brush_rgb_color, opacity, m_pen_rgb_color, opacity );
|
||||
|
||||
// output the pen cap and line joint
|
||||
fputs( "stroke-linecap:round; stroke-linejoin:round;\"\n", outputFile );
|
||||
fputs( " transform=\"translate(0 0) scale(1 1)\">\n", outputFile );
|
||||
fputs( "stroke-linecap:round; stroke-linejoin:round;\"\n", m_outputFile );
|
||||
fputs( " transform=\"translate(0 0) scale(1 1)\">\n", m_outputFile );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool SVG_PLOTTER::EndPlot()
|
||||
{
|
||||
fputs( "</g> \n</svg>\n", outputFile );
|
||||
fclose( outputFile );
|
||||
outputFile = NULL;
|
||||
fputs( "</g> \n</svg>\n", m_outputFile );
|
||||
fclose( m_outputFile );
|
||||
m_outputFile = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -835,31 +837,31 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
|
|||
DPOINT sz_dev = userToDeviceSize( text_size );
|
||||
|
||||
if( aOrient != 0 ) {
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"<g transform=\"rotate(%f %f %f)\">\n",
|
||||
- aOrient * 0.1, anchor_pos_dev.x, anchor_pos_dev.y );
|
||||
}
|
||||
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"<text x=\"%f\" y=\"%f\"\n", text_pos_dev.x, text_pos_dev.y );
|
||||
|
||||
/// If the text is mirrored, we should also mirror the hidden text to match
|
||||
if( aSize.x < 0 )
|
||||
fprintf( outputFile, "transform=\"scale(-1 1) translate(%f 0)\"\n", -2 * text_pos_dev.x );
|
||||
fprintf( m_outputFile, "transform=\"scale(-1 1) translate(%f 0)\"\n", -2 * text_pos_dev.x );
|
||||
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"textLength=\"%f\" font-size=\"%f\" lengthAdjust=\"spacingAndGlyphs\"\n"
|
||||
"text-anchor=\"%s\" opacity=\"0\">%s</text>\n",
|
||||
sz_dev.x, sz_dev.y,
|
||||
hjust, TO_UTF8( XmlEsc( aText ) ) );
|
||||
|
||||
if( aOrient != 0 )
|
||||
fputs( "</g>\n", outputFile );
|
||||
fputs( "</g>\n", m_outputFile );
|
||||
|
||||
fprintf( outputFile,
|
||||
fprintf( m_outputFile,
|
||||
"<g class=\"stroked-text\"><desc>%s</desc>\n",
|
||||
TO_UTF8( XmlEsc( aText ) ) );
|
||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
||||
aWidth, aItalic, aBold, aMultilineAllowed );
|
||||
fputs( "</g>", outputFile );
|
||||
fputs( "</g>", m_outputFile );
|
||||
}
|
||||
|
|
|
@ -49,18 +49,18 @@
|
|||
|
||||
PLOTTER::PLOTTER( )
|
||||
{
|
||||
plotScale = 1;
|
||||
currentPenWidth = -1; // To-be-set marker
|
||||
penState = 'Z'; // End-of-path idle
|
||||
m_plotScale = 1;
|
||||
m_currentPenWidth = -1; // To-be-set marker
|
||||
m_penState = 'Z'; // End-of-path idle
|
||||
m_plotMirror = false; // Plot mirror option flag
|
||||
m_mirrorIsHorizontal = true;
|
||||
m_yaxisReversed = false;
|
||||
outputFile = 0;
|
||||
colorMode = false; // Starts as a BW plot
|
||||
negativeMode = false;
|
||||
m_outputFile = 0;
|
||||
m_colorMode = false; // Starts as a BW plot
|
||||
m_negativeMode = false;
|
||||
// Temporary init to avoid not initialized vars, will be set later
|
||||
m_IUsPerDecimil = 1; // will be set later to the actual value
|
||||
iuPerDeviceUnit = 1; // will be set later to the actual value
|
||||
m_iuPerDeviceUnit = 1; // will be set later to the actual value
|
||||
m_renderSettings = nullptr;
|
||||
}
|
||||
|
||||
|
@ -68,22 +68,22 @@ PLOTTER::~PLOTTER()
|
|||
{
|
||||
// Emergency cleanup, but closing the file is
|
||||
// usually made in EndPlot().
|
||||
if( outputFile )
|
||||
fclose( outputFile );
|
||||
if( m_outputFile )
|
||||
fclose( m_outputFile );
|
||||
}
|
||||
|
||||
|
||||
bool PLOTTER::OpenFile( const wxString& aFullFilename )
|
||||
{
|
||||
filename = aFullFilename;
|
||||
m_filename = aFullFilename;
|
||||
|
||||
wxASSERT( !outputFile );
|
||||
wxASSERT( !m_outputFile );
|
||||
|
||||
// Open the file in text mode (not suitable for all plotters
|
||||
// but only for most of them
|
||||
outputFile = wxFopen( filename, wxT( "wt" ) );
|
||||
m_outputFile = wxFopen( m_filename, wxT( "wt" ) );
|
||||
|
||||
if( outputFile == NULL )
|
||||
if( m_outputFile == NULL )
|
||||
return false ;
|
||||
|
||||
return true;
|
||||
|
@ -92,7 +92,7 @@ bool PLOTTER::OpenFile( const wxString& aFullFilename )
|
|||
|
||||
DPOINT PLOTTER::userToDeviceCoordinates( const wxPoint& aCoordinate )
|
||||
{
|
||||
wxPoint pos = aCoordinate - plotOffset;
|
||||
wxPoint pos = aCoordinate - m_plotOffset;
|
||||
|
||||
// Don't allow overflows; they can cause rendering failures in some file viewers
|
||||
// (such as Acrobat)
|
||||
|
@ -100,22 +100,22 @@ DPOINT PLOTTER::userToDeviceCoordinates( const wxPoint& aCoordinate )
|
|||
pos.x = std::max( -clampSize, std::min( pos.x, clampSize ) );
|
||||
pos.y = std::max( -clampSize, std::min( pos.y, clampSize ) );
|
||||
|
||||
double x = pos.x * plotScale;
|
||||
double y = ( paperSize.y - pos.y * plotScale );
|
||||
double x = pos.x * m_plotScale;
|
||||
double y = ( m_paperSize.y - pos.y * m_plotScale );
|
||||
|
||||
if( m_plotMirror )
|
||||
{
|
||||
if( m_mirrorIsHorizontal )
|
||||
x = ( paperSize.x - pos.x * plotScale );
|
||||
x = ( m_paperSize.x - pos.x * m_plotScale );
|
||||
else
|
||||
y = pos.y * plotScale;
|
||||
y = pos.y * m_plotScale;
|
||||
}
|
||||
|
||||
if( m_yaxisReversed )
|
||||
y = paperSize.y - y;
|
||||
y = m_paperSize.y - y;
|
||||
|
||||
x *= iuPerDeviceUnit;
|
||||
y *= iuPerDeviceUnit;
|
||||
x *= m_iuPerDeviceUnit;
|
||||
y *= m_iuPerDeviceUnit;
|
||||
|
||||
return DPOINT( x, y );
|
||||
}
|
||||
|
@ -123,14 +123,14 @@ DPOINT PLOTTER::userToDeviceCoordinates( const wxPoint& aCoordinate )
|
|||
|
||||
DPOINT PLOTTER::userToDeviceSize( const wxSize& size )
|
||||
{
|
||||
return DPOINT( size.x * plotScale * iuPerDeviceUnit,
|
||||
size.y * plotScale * iuPerDeviceUnit );
|
||||
return DPOINT( size.x * m_plotScale * m_iuPerDeviceUnit,
|
||||
size.y * m_plotScale * m_iuPerDeviceUnit );
|
||||
}
|
||||
|
||||
|
||||
double PLOTTER::userToDeviceSize( double size ) const
|
||||
{
|
||||
return size * plotScale * iuPerDeviceUnit;
|
||||
return size * m_plotScale * m_iuPerDeviceUnit;
|
||||
}
|
||||
|
||||
|
||||
|
@ -458,7 +458,7 @@ void PLOTTER::segmentAsOval( const wxPoint& start, const wxPoint& end, int width
|
|||
void PLOTTER::sketchOval( const wxPoint& pos, const wxSize& aSize, double orient, int width )
|
||||
{
|
||||
SetCurrentLineWidth( width );
|
||||
width = currentPenWidth;
|
||||
width = m_currentPenWidth;
|
||||
int radius, deltaxy, cx, cy;
|
||||
wxSize size( aSize );
|
||||
|
||||
|
@ -536,9 +536,9 @@ void PLOTTER::ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
|
|||
{
|
||||
SetCurrentLineWidth( -1 );
|
||||
Arc( centre, StAngle, EndAngle,
|
||||
radius - ( width - currentPenWidth ) / 2, FILL_TYPE::NO_FILL, -1 );
|
||||
radius - ( width - m_currentPenWidth ) / 2, FILL_TYPE::NO_FILL, -1 );
|
||||
Arc( centre, StAngle, EndAngle,
|
||||
radius + ( width - currentPenWidth ) / 2, FILL_TYPE::NO_FILL, -1 );
|
||||
radius + ( width - m_currentPenWidth ) / 2, FILL_TYPE::NO_FILL, -1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -551,15 +551,15 @@ void PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
|
|||
else
|
||||
{
|
||||
SetCurrentLineWidth( -1 );
|
||||
wxPoint offsetp1( p1.x - (width - currentPenWidth) / 2,
|
||||
p1.y - (width - currentPenWidth) / 2 );
|
||||
wxPoint offsetp2( p2.x + (width - currentPenWidth) / 2,
|
||||
p2.y + (width - currentPenWidth) / 2 );
|
||||
wxPoint offsetp1( p1.x - (width - m_currentPenWidth) / 2,
|
||||
p1.y - (width - m_currentPenWidth) / 2 );
|
||||
wxPoint offsetp2( p2.x + (width - m_currentPenWidth) / 2,
|
||||
p2.y + (width - m_currentPenWidth) / 2 );
|
||||
Rect( offsetp1, offsetp2, FILL_TYPE::NO_FILL, -1 );
|
||||
offsetp1.x += (width - currentPenWidth);
|
||||
offsetp1.y += (width - currentPenWidth);
|
||||
offsetp2.x -= (width - currentPenWidth);
|
||||
offsetp2.y -= (width - currentPenWidth);
|
||||
offsetp1.x += (width - m_currentPenWidth);
|
||||
offsetp1.y += (width - m_currentPenWidth);
|
||||
offsetp2.x -= (width - m_currentPenWidth);
|
||||
offsetp2.y -= (width - m_currentPenWidth);
|
||||
Rect( offsetp1, offsetp2, FILL_TYPE::NO_FILL, -1 );
|
||||
}
|
||||
}
|
||||
|
@ -575,8 +575,8 @@ void PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width, OUTLINE_
|
|||
else
|
||||
{
|
||||
SetCurrentLineWidth( -1 );
|
||||
Circle( pos, diametre - width + currentPenWidth, FILL_TYPE::NO_FILL, -1 );
|
||||
Circle( pos, diametre + width - currentPenWidth, FILL_TYPE::NO_FILL, -1 );
|
||||
Circle( pos, diametre - width + m_currentPenWidth, FILL_TYPE::NO_FILL, -1 );
|
||||
Circle( pos, diametre + width - m_currentPenWidth, FILL_TYPE::NO_FILL, -1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
// For now we don't use 'thick' primitives, so no line width
|
||||
virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override
|
||||
{
|
||||
currentPenWidth = 0;
|
||||
m_currentPenWidth = 0;
|
||||
}
|
||||
|
||||
virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override
|
||||
{
|
||||
// This is the truth
|
||||
currentPenWidth = userToDeviceSize( penDiameter );
|
||||
m_currentPenWidth = userToDeviceSize( penDiameter );
|
||||
}
|
||||
|
||||
virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
|
||||
|
|
|
@ -151,21 +151,21 @@ public:
|
|||
|
||||
virtual void SetNegative( bool aNegative )
|
||||
{
|
||||
negativeMode = aNegative;
|
||||
m_negativeMode = aNegative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plot in B/W or color.
|
||||
* @param aColorMode = true to plot in color, false to plot in black and white
|
||||
*/
|
||||
virtual void SetColorMode( bool aColorMode ) { colorMode = aColorMode; }
|
||||
bool GetColorMode() const { return colorMode; }
|
||||
virtual void SetColorMode( bool aColorMode ) { m_colorMode = aColorMode; }
|
||||
bool GetColorMode() const { return m_colorMode; }
|
||||
|
||||
void SetRenderSettings( RENDER_SETTINGS* aSettings ) { m_renderSettings = aSettings; }
|
||||
RENDER_SETTINGS* RenderSettings() { return m_renderSettings; }
|
||||
|
||||
virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) { pageInfo = aPageSettings; }
|
||||
PAGE_INFO& PageSettings() { return pageInfo; }
|
||||
virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_pageInfo = aPageSettings; }
|
||||
PAGE_INFO& PageSettings() { return m_pageInfo; }
|
||||
|
||||
/**
|
||||
* Set the line width for the next drawing.
|
||||
|
@ -173,21 +173,15 @@ public:
|
|||
* @param aData is an auxiliary parameter, mainly used in gerber plotter
|
||||
*/
|
||||
virtual void SetCurrentLineWidth( int width, void* aData = NULL ) = 0;
|
||||
virtual int GetCurrentLineWidth() const { return currentPenWidth; }
|
||||
virtual int GetCurrentLineWidth() const { return m_currentPenWidth; }
|
||||
|
||||
virtual void SetColor( COLOR4D color ) = 0;
|
||||
|
||||
virtual void SetDash( PLOT_DASH_TYPE dashed ) = 0;
|
||||
|
||||
virtual void SetCreator( const wxString& aCreator )
|
||||
{
|
||||
creator = aCreator;
|
||||
}
|
||||
virtual void SetCreator( const wxString& aCreator ) { m_creator = aCreator; }
|
||||
|
||||
virtual void SetTitle( const wxString& aTitle )
|
||||
{
|
||||
title = aTitle;
|
||||
}
|
||||
virtual void SetTitle( const wxString& aTitle ) { m_title = aTitle; }
|
||||
|
||||
/**
|
||||
* Add a line to the list of free lines to print at the beginning of the file
|
||||
|
@ -575,7 +569,7 @@ protected:
|
|||
|
||||
protected: // variables used in most of plotters:
|
||||
/// Plot scale - chosen by the user (even implicitly with 'fit in a4')
|
||||
double plotScale;
|
||||
double m_plotScale;
|
||||
|
||||
/* Caller scale (how many IUs in a decimil - always); it's a double
|
||||
* because in Eeschema there are 0.1 IUs in a decimil (Eeschema
|
||||
|
@ -583,33 +577,29 @@ protected: // variables used in most of plotters:
|
|||
* or nanometers, so this value would be >= 1 */
|
||||
double m_IUsPerDecimil;
|
||||
|
||||
/// Device scale (from IUs to plotter device units - usually decimils)
|
||||
double iuPerDeviceUnit;
|
||||
|
||||
/// Plot offset (in IUs)
|
||||
wxPoint plotOffset;
|
||||
|
||||
/// X axis orientation (SVG)
|
||||
/// and plot mirrored (only for PS, PDF HPGL and SVG)
|
||||
bool m_plotMirror;
|
||||
bool m_mirrorIsHorizontal; /// true to mirror horizontally (else vertically)
|
||||
bool m_yaxisReversed; /// true if the Y axis is top to bottom (SVG)
|
||||
double m_iuPerDeviceUnit; // Device scale (from IUs to plotter device units;
|
||||
// usually decimils)
|
||||
wxPoint m_plotOffset; // Plot offset (in IUs)
|
||||
bool m_plotMirror; // X axis orientation (SVG)
|
||||
// and plot mirrored (only for PS, PDF HPGL and SVG)
|
||||
bool m_mirrorIsHorizontal; // true to mirror horizontally (else vertically)
|
||||
bool m_yaxisReversed; // true if the Y axis is top to bottom (SVG)
|
||||
|
||||
/// Output file
|
||||
FILE* outputFile;
|
||||
FILE* m_outputFile;
|
||||
|
||||
// Pen handling
|
||||
bool colorMode; // true to plot in color, false to plot in black & white
|
||||
bool negativeMode; // true to generate a negative image (PS mode mainly)
|
||||
int currentPenWidth;
|
||||
char penState; // Current pen state: 'U', 'D' or 'Z' (see PenTo)
|
||||
wxPoint penLastpos; // Last pen positions; set to -1,-1 when the pen is
|
||||
// at rest
|
||||
wxString creator;
|
||||
wxString filename;
|
||||
wxString title;
|
||||
PAGE_INFO pageInfo;
|
||||
wxSize paperSize; // Paper size in IU - not in mils
|
||||
bool m_colorMode; // true to plot in color, otherwise black & white
|
||||
bool m_negativeMode; // true to generate a negative image (PS mode mainly)
|
||||
int m_currentPenWidth;
|
||||
char m_penState; // current pen state: 'U', 'D' or 'Z' (see PenTo)
|
||||
wxPoint m_penLastpos; // last pen position; -1,-1 when pen is at rest
|
||||
|
||||
wxString m_creator;
|
||||
wxString m_filename;
|
||||
wxString m_title;
|
||||
PAGE_INFO m_pageInfo;
|
||||
wxSize m_paperSize; // Paper size in IU - not in mils
|
||||
|
||||
wxArrayString m_headerExtraLines; // a set of string to print in header file
|
||||
|
||||
|
|
|
@ -384,7 +384,7 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap )
|
|||
{
|
||||
EXCELLON_WRITER excellonWriter( m_board );
|
||||
excellonWriter.SetFormat( !m_UnitDrillIsInch, (EXCELLON_WRITER::ZEROS_FMT) m_ZerosFormat,
|
||||
m_Precision.m_lhs, m_Precision.m_rhs );
|
||||
m_Precision.m_Lhs, m_Precision.m_Rhs );
|
||||
excellonWriter.SetOptions( m_Mirror, m_MinimalHeader, m_FileDrillOffset, m_Merge_PTH_NPTH );
|
||||
excellonWriter.SetRouteModeForOvalHoles( m_UseRouteModeForOvalHoles );
|
||||
excellonWriter.SetMapFileFormat( filefmt[choice] );
|
||||
|
|
|
@ -64,19 +64,6 @@ public:
|
|||
m_progressReporter = aProgressReporter;
|
||||
}
|
||||
|
||||
// fixme: don't directly expose any wx UI classes. Currently interface returns only
|
||||
// an anonymous pointer so shouldn't introduce a dependency on wx unless wx is used
|
||||
// by the particular exporter.
|
||||
virtual wxDialog* CreateSettingsDialog( PROPERTIES* aProperties )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual bool HasSettingsDialog() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool Run() = 0;
|
||||
|
||||
protected:
|
||||
|
@ -84,7 +71,7 @@ protected:
|
|||
BOARD* m_board = nullptr;
|
||||
wxFileName m_outputFilePath;
|
||||
REPORTER* m_reporter = nullptr;
|
||||
PROGRESS_REPORTER *m_progressReporter = nullptr;
|
||||
PROGRESS_REPORTER* m_progressReporter = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -72,7 +72,6 @@ public:
|
|||
|
||||
private:
|
||||
BOARD* m_pcb;
|
||||
|
||||
wxWindow* m_parent;
|
||||
|
||||
/// Writes a list of records to the given output stream
|
||||
|
|
|
@ -89,7 +89,9 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
|
|||
{
|
||||
if( ( graphic->GetStart().x == graphic->GetEnd().x )
|
||||
&& ( graphic->GetStart().y == graphic->GetEnd().y ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
sp.x = graphic->GetStart().x * scale + offX;
|
||||
sp.y = -graphic->GetStart().y * scale + offY;
|
||||
|
@ -106,7 +108,9 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
|
|||
{
|
||||
if( ( graphic->GetStart().x == graphic->GetEnd().x )
|
||||
&& ( graphic->GetStart().y == graphic->GetEnd().y ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
double top = graphic->GetStart().y * scale + offY;
|
||||
double left = graphic->GetStart().x * scale + offX;
|
||||
|
@ -130,7 +134,9 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
|
|||
{
|
||||
if( ( graphic->GetCenter().x == graphic->GetArcStart().x )
|
||||
&& ( graphic->GetCenter().y == graphic->GetArcStart().y ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
sp.x = graphic->GetCenter().x * scale + offX;
|
||||
sp.y = -graphic->GetCenter().y * scale + offY;
|
||||
|
@ -479,13 +485,17 @@ static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD
|
|||
comp->SetRefDes( refdes );
|
||||
|
||||
if( top )
|
||||
{
|
||||
comp->SetPosition( aFootprint->GetPosition().x * scale + dx,
|
||||
-aFootprint->GetPosition().y * scale + dy,
|
||||
rotz, IDF3::LYR_TOP );
|
||||
}
|
||||
else
|
||||
{
|
||||
comp->SetPosition( aFootprint->GetPosition().x * scale + dx,
|
||||
-aFootprint->GetPosition().y * scale + dy,
|
||||
rotz, IDF3::LYR_BOTTOM );
|
||||
}
|
||||
|
||||
comp->SetPlacement( IDF3::PS_ECAD );
|
||||
|
||||
|
@ -500,13 +510,17 @@ static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD
|
|||
{
|
||||
// place the item
|
||||
if( top )
|
||||
{
|
||||
comp->SetPosition( aFootprint->GetPosition().x * scale + dx,
|
||||
-aFootprint->GetPosition().y * scale + dy,
|
||||
rotz, IDF3::LYR_TOP );
|
||||
}
|
||||
else
|
||||
{
|
||||
comp->SetPosition( aFootprint->GetPosition().x * scale + dx,
|
||||
-aFootprint->GetPosition().y * scale + dy,
|
||||
rotz, IDF3::LYR_BOTTOM );
|
||||
}
|
||||
|
||||
comp->SetPlacement( IDF3::PS_ECAD );
|
||||
|
||||
|
|
|
@ -341,15 +341,15 @@ void EXCELLON_WRITER::SetFormat( bool aMetric,
|
|||
if( aRightDigits <= 0 )
|
||||
aRightDigits = m_unitsMetric ? 3 : 4;
|
||||
|
||||
m_precision.m_lhs = aLeftDigits;
|
||||
m_precision.m_rhs = aRightDigits;
|
||||
m_precision.m_Lhs = aLeftDigits;
|
||||
m_precision.m_Rhs = aRightDigits;
|
||||
}
|
||||
|
||||
|
||||
void EXCELLON_WRITER::writeCoordinates( char* aLine, double aCoordX, double aCoordY )
|
||||
{
|
||||
wxString xs, ys;
|
||||
int xpad = m_precision.m_lhs + m_precision.m_rhs;
|
||||
int xpad = m_precision.m_Lhs + m_precision.m_Rhs;
|
||||
int ypad = xpad;
|
||||
|
||||
switch( m_zeroFormat )
|
||||
|
@ -393,7 +393,7 @@ void EXCELLON_WRITER::writeCoordinates( char* aLine, double aCoordX, double aCoo
|
|||
break;
|
||||
|
||||
case SUPPRESS_LEADING:
|
||||
for( int i = 0; i< m_precision.m_rhs; i++ )
|
||||
for( int i = 0; i< m_precision.m_Rhs; i++ )
|
||||
{
|
||||
aCoordX *= 10; aCoordY *= 10;
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ void EXCELLON_WRITER::writeCoordinates( char* aLine, double aCoordX, double aCoo
|
|||
|
||||
case SUPPRESS_TRAILING:
|
||||
{
|
||||
for( int i = 0; i < m_precision.m_rhs; i++ )
|
||||
for( int i = 0; i < m_precision.m_Rhs; i++ )
|
||||
{
|
||||
aCoordX *= 10;
|
||||
aCoordY *= 10;
|
||||
|
@ -433,7 +433,7 @@ void EXCELLON_WRITER::writeCoordinates( char* aLine, double aCoordX, double aCoo
|
|||
}
|
||||
|
||||
case KEEP_ZEROS:
|
||||
for( int i = 0; i< m_precision.m_rhs; i++ )
|
||||
for( int i = 0; i< m_precision.m_Rhs; i++ )
|
||||
{
|
||||
aCoordX *= 10; aCoordY *= 10;
|
||||
}
|
||||
|
|
|
@ -113,8 +113,7 @@ public:
|
|||
* @param aGenMap = true to generate a drill map file
|
||||
* @param aReporter = a REPORTER to return activity or any message (can be NULL)
|
||||
*/
|
||||
void CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
|
||||
bool aGenDrill, bool aGenMap,
|
||||
void CreateDrillandMapFilesSet( const wxString& aPlotDirectory, bool aGenDrill, bool aGenMap,
|
||||
REPORTER * aReporter = NULL );
|
||||
|
||||
|
||||
|
@ -125,8 +124,7 @@ private:
|
|||
* @param aFile = an opened file to write to will be closed by CreateDrillFile
|
||||
* @return hole count
|
||||
*/
|
||||
int createDrillFile( FILE * aFile, DRILL_LAYER_PAIR aLayerPair,
|
||||
bool aGenerateNPTH_list );
|
||||
int createDrillFile( FILE * aFile, DRILL_LAYER_PAIR aLayerPair, bool aGenerateNPTH_list );
|
||||
|
||||
|
||||
/* Print the DRILL file header. The full header is somethink like:
|
||||
|
@ -139,8 +137,7 @@ private:
|
|||
* FMAT,2
|
||||
* INCH,TZ
|
||||
*/
|
||||
void writeEXCELLONHeader( DRILL_LAYER_PAIR aLayerPair,
|
||||
bool aGenerateNPTH_list);
|
||||
void writeEXCELLONHeader( DRILL_LAYER_PAIR aLayerPair, bool aGenerateNPTH_list);
|
||||
|
||||
void writeEXCELLONEndOfFile();
|
||||
|
||||
|
|
|
@ -95,13 +95,13 @@ public:
|
|||
class DRILL_PRECISION
|
||||
{
|
||||
public:
|
||||
int m_lhs; // Left digit number (integer value of coordinates)
|
||||
int m_rhs; // Right digit number (decimal value of coordinates)
|
||||
int m_Lhs; // Left digit number (integer value of coordinates)
|
||||
int m_Rhs; // Right digit number (decimal value of coordinates)
|
||||
|
||||
public:
|
||||
DRILL_PRECISION( int l = 2, int r = 4 )
|
||||
{
|
||||
m_lhs = l; m_rhs = r;
|
||||
m_Lhs = l; m_Rhs = r;
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,7 +109,7 @@ public:
|
|||
{
|
||||
wxString text;
|
||||
|
||||
text << m_lhs << wxT( ":" ) << m_rhs;
|
||||
text << m_Lhs << wxT( ":" ) << m_Rhs;
|
||||
return text;
|
||||
}
|
||||
};
|
||||
|
@ -208,8 +208,7 @@ public:
|
|||
* @param aPlotDirectory = the output folder
|
||||
* @param aReporter = a REPORTER to return activity or any message (can be NULL)
|
||||
*/
|
||||
void CreateMapFilesSet( const wxString& aPlotDirectory,
|
||||
REPORTER* aReporter = NULL );
|
||||
void CreateMapFilesSet( const wxString& aPlotDirectory, REPORTER* aReporter = NULL );
|
||||
|
||||
/**
|
||||
* Function GenDrillReportFile
|
||||
|
|
|
@ -275,8 +275,8 @@ void GERBER_WRITER::SetFormat( int aRightDigits )
|
|||
m_conversionUnits = 1.0 / IU_PER_MM; // Gerber units = mm
|
||||
|
||||
// Set precison (unit is mm).
|
||||
m_precision.m_lhs = 4;
|
||||
m_precision.m_rhs = aRightDigits == 6 ? 6 : 5;
|
||||
m_precision.m_Lhs = 4;
|
||||
m_precision.m_Rhs = aRightDigits == 6 ? 6 : 5;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -45,9 +45,6 @@
|
|||
PLACEFILE_GERBER_WRITER::PLACEFILE_GERBER_WRITER( BOARD* aPcb )
|
||||
{
|
||||
m_pcb = aPcb;
|
||||
/* Set conversion scale depending on drill file units */
|
||||
m_conversionUnits = 1.0 / IU_PER_MM; // Gerber units = mm
|
||||
m_forceSmdItems = false;
|
||||
m_plotPad1Marker = true; // Place a marker to pin 1 (or A1) position
|
||||
m_plotOtherPadsMarker = true; // Place a marker to other pins position
|
||||
m_layer = PCB_LAYER_ID::UNDEFINED_LAYER; // No layer set
|
||||
|
|
|
@ -64,8 +64,7 @@ public:
|
|||
* @param aIncludeBrdEdges = true to include board outlines
|
||||
* @return component count, or -1 if the file cannot be created
|
||||
*/
|
||||
int CreatePlaceFile( wxString& aFullFilename, PCB_LAYER_ID aLayer,
|
||||
bool aIncludeBrdEdges );
|
||||
int CreatePlaceFile( wxString& aFullFilename, PCB_LAYER_ID aLayer, bool aIncludeBrdEdges );
|
||||
|
||||
/**
|
||||
* @return a filename which identify the drill file function.
|
||||
|
@ -78,25 +77,21 @@ public:
|
|||
|
||||
private:
|
||||
BOARD* m_pcb;
|
||||
/// The board layer currently used (typically F_Cu or B_Cu)
|
||||
PCB_LAYER_ID m_layer;
|
||||
double m_conversionUnits; // scaling factor to convert the board unites to
|
||||
// Excellon/Gerber units (i.e inches or mm)
|
||||
PCB_LAYER_ID m_layer; // The board layer currently used (typically F_Cu or B_Cu)
|
||||
wxPoint m_offset; // Drill offset coordinates
|
||||
bool m_forceSmdItems;
|
||||
// True to plot a flashed marker shape at pad 1 position
|
||||
bool m_plotPad1Marker;
|
||||
// True to plot a marker shape at other pads position
|
||||
|
||||
bool m_plotPad1Marker; // True to plot a flashed marker shape at pad 1 position
|
||||
bool m_plotOtherPadsMarker; // True to plot a marker shape at other pads position
|
||||
// This is a flashed 0 sized round pad
|
||||
bool m_plotOtherPadsMarker;
|
||||
|
||||
|
||||
/** convert a kicad footprint orientation to gerber rotation
|
||||
/**
|
||||
* convert a kicad footprint orientation to gerber rotation
|
||||
* both are in degrees
|
||||
*/
|
||||
double mapRotationAngle( double aAngle );
|
||||
|
||||
/** Find the pad(s) 1 (or pad "A1") of a footprint
|
||||
/**
|
||||
* Find the pad(s) 1 (or pad "A1") of a footprint
|
||||
* Usefull to plot a marker at this (these) position(s)
|
||||
* @param aPadList is the list to fill
|
||||
* @param aFootprint is the footprint to test
|
||||
|
|
|
@ -41,8 +41,10 @@ public:
|
|||
class IMPORTED_LINE : public IMPORTED_SHAPE
|
||||
{
|
||||
public:
|
||||
IMPORTED_LINE( const VECTOR2D& aStart, const VECTOR2D& aEnd, double aWidth )
|
||||
: m_start( aStart ), m_end( aEnd ), m_width( aWidth )
|
||||
IMPORTED_LINE( const VECTOR2D& aStart, const VECTOR2D& aEnd, double aWidth ) :
|
||||
m_start( aStart ),
|
||||
m_end( aEnd ),
|
||||
m_width( aWidth )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -61,8 +63,10 @@ private:
|
|||
class IMPORTED_CIRCLE : public IMPORTED_SHAPE
|
||||
{
|
||||
public:
|
||||
IMPORTED_CIRCLE( const VECTOR2D& aCenter, double aRadius, double aWidth )
|
||||
: m_center( aCenter ), m_radius( aRadius ), m_width( aWidth )
|
||||
IMPORTED_CIRCLE( const VECTOR2D& aCenter, double aRadius, double aWidth ) :
|
||||
m_center( aCenter ),
|
||||
m_radius( aRadius ),
|
||||
m_width( aWidth )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -81,8 +85,11 @@ private:
|
|||
class IMPORTED_ARC : public IMPORTED_SHAPE
|
||||
{
|
||||
public:
|
||||
IMPORTED_ARC( const VECTOR2D& aCenter, const VECTOR2D& aStart, double aAngle, double aWidth )
|
||||
: m_center( aCenter ), m_start( aStart ), m_angle( aAngle ), m_width( aWidth )
|
||||
IMPORTED_ARC( const VECTOR2D& aCenter, const VECTOR2D& aStart, double aAngle, double aWidth ) :
|
||||
m_center( aCenter ),
|
||||
m_start( aStart ),
|
||||
m_angle( aAngle ),
|
||||
m_width( aWidth )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -102,8 +109,9 @@ private:
|
|||
class IMPORTED_POLYGON : public IMPORTED_SHAPE
|
||||
{
|
||||
public:
|
||||
IMPORTED_POLYGON( const std::vector< VECTOR2D >& aVertices, double aWidth )
|
||||
: m_vertices( aVertices ), m_width( aWidth )
|
||||
IMPORTED_POLYGON( const std::vector< VECTOR2D >& aVertices, double aWidth ) :
|
||||
m_vertices( aVertices ),
|
||||
m_width( aWidth )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -113,7 +121,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
const std::vector< VECTOR2D > m_vertices;
|
||||
const std::vector<VECTOR2D> m_vertices;
|
||||
double m_width;
|
||||
};
|
||||
|
||||
|
@ -121,13 +129,17 @@ private:
|
|||
class IMPORTED_TEXT : public IMPORTED_SHAPE
|
||||
{
|
||||
public:
|
||||
IMPORTED_TEXT( const VECTOR2D& aOrigin, const wxString& aText,
|
||||
double aHeight, double aWidth, double aThickness, double aOrientation,
|
||||
EDA_TEXT_HJUSTIFY_T aHJustify, EDA_TEXT_VJUSTIFY_T aVJustify )
|
||||
: m_origin( aOrigin ), m_text( aText ),
|
||||
m_height( aHeight ), m_width( aWidth ), m_thickness( aThickness ),
|
||||
IMPORTED_TEXT( const VECTOR2D& aOrigin, const wxString& aText, double aHeight, double aWidth,
|
||||
double aThickness, double aOrientation, EDA_TEXT_HJUSTIFY_T aHJustify,
|
||||
EDA_TEXT_VJUSTIFY_T aVJustify ) :
|
||||
m_origin( aOrigin ),
|
||||
m_text( aText ),
|
||||
m_height( aHeight ),
|
||||
m_width( aWidth ),
|
||||
m_thickness( aThickness ),
|
||||
m_orientation( aOrientation ),
|
||||
m_hJustify( aHJustify ), m_vJustify( aVJustify )
|
||||
m_hJustify( aHJustify ),
|
||||
m_vJustify( aVJustify )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -153,9 +165,12 @@ class IMPORTED_SPLINE : public IMPORTED_SHAPE
|
|||
{
|
||||
public:
|
||||
IMPORTED_SPLINE( const VECTOR2D& aStart, const VECTOR2D& aBezierControl1,
|
||||
const VECTOR2D& aBezierControl2, const VECTOR2D& aEnd, double aWidth )
|
||||
: m_start( aStart ), m_bezierControl1( aBezierControl1 ),
|
||||
m_bezierControl2( aBezierControl2 ), m_end( aEnd ), m_width( aWidth )
|
||||
const VECTOR2D& aBezierControl2, const VECTOR2D& aEnd, double aWidth ) :
|
||||
m_start( aStart ),
|
||||
m_bezierControl1( aBezierControl1 ),
|
||||
m_bezierControl2( aBezierControl2 ),
|
||||
m_end( aEnd ),
|
||||
m_width( aWidth )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -366,20 +366,20 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN&
|
|||
|
||||
auto pt = aInductorPattern.m_End - aInductorPattern.m_Start;
|
||||
int min_len = KiROUND( EuclideanNorm( pt ) );
|
||||
aInductorPattern.m_length = min_len;
|
||||
aInductorPattern.m_Length = min_len;
|
||||
|
||||
// Enter the desired length.
|
||||
msg = StringFromValue( editFrame.GetUserUnits(), aInductorPattern.m_length );
|
||||
msg = StringFromValue( editFrame.GetUserUnits(), aInductorPattern.m_Length );
|
||||
WX_TEXT_ENTRY_DIALOG dlg( &editFrame, _( "Length of Trace:" ), wxEmptyString, msg );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
return nullptr; // canceled by user
|
||||
|
||||
msg = dlg.GetValue();
|
||||
aInductorPattern.m_length = ValueFromString( editFrame.GetUserUnits(), msg );
|
||||
aInductorPattern.m_Length = ValueFromString( editFrame.GetUserUnits(), msg );
|
||||
|
||||
// Control values (ii = minimum length)
|
||||
if( aInductorPattern.m_length < min_len )
|
||||
if( aInductorPattern.m_Length < min_len )
|
||||
{
|
||||
aErrorMessage = _( "Requested length < minimum length" );
|
||||
return nullptr;
|
||||
|
@ -388,7 +388,7 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN&
|
|||
// Calculate the elements.
|
||||
std::vector <wxPoint> buffer;
|
||||
const INDUCTOR_S_SHAPE_RESULT res = BuildCornersList_S_Shape( buffer, aInductorPattern.m_Start,
|
||||
aInductorPattern.m_End, aInductorPattern.m_length, aInductorPattern.m_Width );
|
||||
aInductorPattern.m_End, aInductorPattern.m_Length, aInductorPattern.m_Width );
|
||||
|
||||
switch( res )
|
||||
{
|
||||
|
|
|
@ -45,7 +45,7 @@ struct MICROWAVE_INDUCTOR_PATTERN
|
|||
public:
|
||||
wxPoint m_Start;
|
||||
wxPoint m_End;
|
||||
int m_length; // full length trace.
|
||||
int m_Length; // full length trace.
|
||||
int m_Width; // Trace width.
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue