Commit 621a43c4 authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: always stores sheet filename in unix-like notation, and fix a bug...

Eeschema: always stores sheet filename in unix-like notation, and fix a  bug when editing sheet file  name.
Pcbnew: add PDF format  for drill map generation.
Plotter classes: tweaking code.
parent cedcd2ba
...@@ -37,6 +37,28 @@ PLOTTER::PLOTTER( ) ...@@ -37,6 +37,28 @@ PLOTTER::PLOTTER( )
negativeMode = false; negativeMode = false;
} }
/*
* Open or create the plot file aFullFilename
* return true if success, false if the file connot be created/opened
*
* Virtual because some plotters use ascii files, some others binary files (PDF)
* The base class open the file in text mode
*/
bool PLOTTER::OpenFile( const wxString& aFullFilename )
{
filename = aFullFilename;
wxASSERT( !outputFile );
// Open the file in text mode (not suitable for all plotters
// but only for most of them
outputFile = wxFopen( filename, wxT( "wt" ) );
if( outputFile == NULL )
return false ;
return true;
}
/** /**
* Modifies coordinates according to the orientation, * Modifies coordinates according to the orientation,
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <kicad_string.h> #include <kicad_string.h>
/** /**
* Oblique angle for DXF native text * Oblique angle for DXF native text
* (I don't remember if 15 degrees is the ISO value... it looks nice anyway) * (I don't remember if 15 degrees is the ISO value... it looks nice anyway)
*/ */
static const double DXF_OBLIQUE_ANGLE = 15; static const double DXF_OBLIQUE_ANGLE = 15;
...@@ -51,12 +51,11 @@ void DXF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil, ...@@ -51,12 +51,11 @@ void DXF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
/** /**
* Opens the DXF plot with a skeleton header * Opens the DXF plot with a skeleton header
*/ */
bool DXF_PLOTTER::StartPlot( FILE* fout ) bool DXF_PLOTTER::StartPlot()
{ {
wxASSERT( !outputFile ); wxASSERT( outputFile );
outputFile = fout;
// DXF HEADER - Boilerplate // DXF HEADER - Boilerplate
// Defines the minimum for drawing i.e. the angle system and the // Defines the minimum for drawing i.e. the angle system and the
// continuous linetype // continuous linetype
fputs( " 0\n" fputs( " 0\n"
...@@ -105,7 +104,7 @@ bool DXF_PLOTTER::StartPlot( FILE* fout ) ...@@ -105,7 +104,7 @@ bool DXF_PLOTTER::StartPlot( FILE* fout )
"ENDTAB\n", "ENDTAB\n",
outputFile ); outputFile );
// Text styles table // Text styles table
// Defines 4 text styles, one for each bold/italic combination // Defines 4 text styles, one for each bold/italic combination
fputs( " 0\n" fputs( " 0\n"
"TABLE\n" "TABLE\n"
...@@ -115,16 +114,16 @@ bool DXF_PLOTTER::StartPlot( FILE* fout ) ...@@ -115,16 +114,16 @@ bool DXF_PLOTTER::StartPlot( FILE* fout )
"4\n", outputFile ); "4\n", outputFile );
static const char *style_name[4] = {"KICAD", "KICADB", "KICADI", "KICADBI"}; static const char *style_name[4] = {"KICAD", "KICADB", "KICADI", "KICADBI"};
for(int i = 0; i < 4; i++ ) for(int i = 0; i < 4; i++ )
{ {
fprintf( outputFile, fprintf( outputFile,
" 0\n" " 0\n"
"STYLE\n" "STYLE\n"
" 2\n" " 2\n"
"%s\n" // Style name "%s\n" // Style name
" 70\n" " 70\n"
"0\n" // Standard flags "0\n" // Standard flags
" 40\n" " 40\n"
"0\n" // Non-fixed height text "0\n" // Non-fixed height text
" 41\n" " 41\n"
"1\n" // Width factor (base) "1\n" // Width factor (base)
...@@ -143,8 +142,8 @@ bool DXF_PLOTTER::StartPlot( FILE* fout ) ...@@ -143,8 +142,8 @@ bool DXF_PLOTTER::StartPlot( FILE* fout )
} }
// Layer table - one layer per color // Layer table - one layer per color
fprintf( outputFile, fprintf( outputFile,
" 0\n" " 0\n"
"ENDTAB\n" "ENDTAB\n"
" 0\n" " 0\n"
...@@ -160,7 +159,7 @@ bool DXF_PLOTTER::StartPlot( FILE* fout ) ...@@ -160,7 +159,7 @@ bool DXF_PLOTTER::StartPlot( FILE* fout )
- An HSV zone (10-250, 5 values x 2 saturations x 10 hues - An HSV zone (10-250, 5 values x 2 saturations x 10 hues
- Greys (251 - 255) - Greys (251 - 255)
The is *no* black... the white does it on paper, usually, and The is *no* black... the white does it on paper, usually, and
anyway it depends on the plotter configuration, since DXF colors anyway it depends on the plotter configuration, since DXF colors
are meant to be logical only (they represent *both* line color and are meant to be logical only (they represent *both* line color and
width); later version with plot styles only complicate the matter! width); later version with plot styles only complicate the matter!
...@@ -201,14 +200,14 @@ bool DXF_PLOTTER::StartPlot( FILE* fout ) ...@@ -201,14 +200,14 @@ bool DXF_PLOTTER::StartPlot( FILE* fout )
for( int i = 0; i < NBCOLOR; i++ ) for( int i = 0; i < NBCOLOR; i++ )
{ {
wxString cname = ColorRefs[i].m_Name; wxString cname = ColorRefs[i].m_Name;
fprintf( outputFile, fprintf( outputFile,
" 0\n" " 0\n"
"LAYER\n" "LAYER\n"
" 2\n" " 2\n"
"%s\n" // Layer name "%s\n" // Layer name
" 70\n" " 70\n"
"0\n" // Standard flags "0\n" // Standard flags
" 62\n" " 62\n"
"%d\n" // Color number "%d\n" // Color number
" 6\n" " 6\n"
"CONTINUOUS\n",// Linetype name "CONTINUOUS\n",// Linetype name
...@@ -233,7 +232,7 @@ bool DXF_PLOTTER::EndPlot() ...@@ -233,7 +232,7 @@ bool DXF_PLOTTER::EndPlot()
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
// DXF FOOTER // DXF FOOTER
fputs( " 0\n" fputs( " 0\n"
"ENDSEC\n" "ENDSEC\n"
" 0\n" " 0\n"
...@@ -273,8 +272,8 @@ void DXF_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int w ...@@ -273,8 +272,8 @@ void DXF_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int w
} }
/** /**
* DXF circle: full functionality; it even does 'fills' drawing a * DXF circle: full functionality; it even does 'fills' drawing a
* circle with a dual-arc polyline wide as the radius. * circle with a dual-arc polyline wide as the radius.
* *
* I could use this trick to do other filled primitives * I could use this trick to do other filled primitives
...@@ -287,23 +286,23 @@ void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, int ...@@ -287,23 +286,23 @@ void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, int
if( radius > 0 ) if( radius > 0 )
{ {
wxString cname = ColorRefs[currentColor].m_Name; wxString cname = ColorRefs[currentColor].m_Name;
if (!fill) if (!fill)
{ {
fprintf( outputFile, "0\nCIRCLE\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n", fprintf( outputFile, "0\nCIRCLE\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n",
TO_UTF8( cname ), TO_UTF8( cname ),
centre_dev.x, centre_dev.y, radius ); centre_dev.x, centre_dev.y, radius );
} }
if (fill == FILLED_SHAPE) if (fill == FILLED_SHAPE)
{ {
double r = radius*0.5; double r = radius*0.5;
fprintf( outputFile, "0\nPOLYLINE\n"); fprintf( outputFile, "0\nPOLYLINE\n");
fprintf( outputFile, "8\n%s\n66\n1\n70\n1\n", TO_UTF8( cname )); 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, "40\n%g\n41\n%g\n", radius, radius);
fprintf( outputFile, "0\nVERTEX\n8\n%s\n", TO_UTF8( cname )); 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( outputFile, "10\n%g\n 20\n%g\n42\n1.0\n",
centre_dev.x-r, centre_dev.y ); centre_dev.x-r, centre_dev.y );
fprintf( outputFile, "0\nVERTEX\n8\n%s\n", TO_UTF8( cname )); 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( outputFile, "10\n%g\n 20\n%g\n42\n1.0\n",
centre_dev.x+r, centre_dev.y ); centre_dev.x+r, centre_dev.y );
fprintf( outputFile, "0\nSEQEND\n"); fprintf( outputFile, "0\nSEQEND\n");
} }
...@@ -311,10 +310,10 @@ void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, int ...@@ -311,10 +310,10 @@ void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, int
} }
/** /**
* DXF polygon: doesn't fill it but at least it close the filled ones * DXF polygon: doesn't fill it but at least it close the filled ones
*/ */
void DXF_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, void DXF_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth) FILL_T aFill, int aWidth)
{ {
if( aCornerList.size() <= 1 ) if( aCornerList.size() <= 1 )
...@@ -347,7 +346,7 @@ void DXF_PLOTTER::PenTo( const wxPoint& pos, char plume ) ...@@ -347,7 +346,7 @@ void DXF_PLOTTER::PenTo( const wxPoint& pos, char plume )
if( penLastpos != pos && plume == 'D' ) if( penLastpos != pos && plume == 'D' )
{ {
// DXF LINE // DXF LINE
wxString cname = ColorRefs[currentColor].m_Name; wxString cname = ColorRefs[currentColor].m_Name;
fprintf( outputFile, "0\nLINE\n8\n%s\n10\n%g\n20\n%g\n11\n%g\n21\n%g\n", fprintf( outputFile, "0\nLINE\n8\n%s\n10\n%g\n20\n%g\n11\n%g\n21\n%g\n",
TO_UTF8( cname ), TO_UTF8( cname ),
...@@ -403,7 +402,7 @@ void DXF_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int rad ...@@ -403,7 +402,7 @@ void DXF_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int rad
StAngle / 10.0, EndAngle / 10.0 ); StAngle / 10.0, EndAngle / 10.0 );
} }
/** /**
* DXF oval pad: always done in sketch mode * DXF oval pad: always done in sketch mode
*/ */
void DXF_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int orient, void DXF_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int orient,
...@@ -425,7 +424,7 @@ void DXF_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int ori ...@@ -425,7 +424,7 @@ void DXF_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int ori
} }
/** /**
* DXF round pad: always done in sketch mode; it could be filled but it isn't * DXF round pad: always done in sketch mode; it could be filled but it isn't
* pretty if other kinds of pad aren't... * pretty if other kinds of pad aren't...
*/ */
...@@ -447,7 +446,7 @@ void DXF_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize, ...@@ -447,7 +446,7 @@ void DXF_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
wxSize size; wxSize size;
int ox, oy, fx, fy; int ox, oy, fx, fy;
size.x = padsize.x / 2; size.x = padsize.x / 2;
size.y = padsize.y / 2; size.y = padsize.y / 2;
if( size.x < 0 ) if( size.x < 0 )
...@@ -543,7 +542,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos, ...@@ -543,7 +542,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
if( textAsLines ) if( textAsLines )
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
aWidth, aItalic, aBold ); aWidth, aItalic, aBold );
else else
{ {
/* Emit text as a text entity. This loses formatting and shape but it's /* Emit text as a text entity. This loses formatting and shape but it's
more useful as a CAD object */ more useful as a CAD object */
...@@ -553,7 +552,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos, ...@@ -553,7 +552,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
wxString cname = ColorRefs[currentColor].m_Name; wxString cname = ColorRefs[currentColor].m_Name;
DPOINT size_dev = userToDeviceSize( aSize ); DPOINT size_dev = userToDeviceSize( aSize );
int h_code = 0, v_code = 0; int h_code = 0, v_code = 0;
switch( aH_justify ) switch( aH_justify )
{ {
case GR_TEXT_HJUSTIFY_LEFT: case GR_TEXT_HJUSTIFY_LEFT:
h_code = 0; h_code = 0;
...@@ -565,7 +564,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos, ...@@ -565,7 +564,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
h_code = 2; h_code = 2;
break; break;
} }
switch( aV_justify ) switch( aV_justify )
{ {
case GR_TEXT_VJUSTIFY_TOP: case GR_TEXT_VJUSTIFY_TOP:
v_code = 3; v_code = 3;
...@@ -578,7 +577,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos, ...@@ -578,7 +577,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
break; break;
} }
// Position, size, rotation and alignment // Position, size, rotation and alignment
// The two alignment point usages is somewhat idiot (see the DXF ref) // 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 // Anyway since we don't use the fit/aligned options, they're the same
fprintf( outputFile, fprintf( outputFile,
...@@ -614,9 +613,9 @@ void DXF_PLOTTER::Text( const wxPoint& aPos, ...@@ -614,9 +613,9 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
: (aItalic ? "KICADI" : "KICAD"), : (aItalic ? "KICADI" : "KICAD"),
TO_UTF8( cname ), TO_UTF8( cname ),
origin_dev.x, origin_dev.x, origin_dev.x, origin_dev.x,
origin_dev.y, origin_dev.y, origin_dev.y, origin_dev.y,
size_dev.y, fabs( size_dev.y / size_dev.x ), size_dev.y, fabs( size_dev.y / size_dev.x ),
aOrient / 10.0, aOrient / 10.0,
aItalic ? DXF_OBLIQUE_ANGLE : 0, aItalic ? DXF_OBLIQUE_ANGLE : 0,
size_dev.x < 0 ? 2 : 0, // X mirror flag size_dev.x < 0 ? 2 : 0, // X mirror flag
h_code, v_code ); h_code, v_code );
...@@ -631,7 +630,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos, ...@@ -631,7 +630,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
bigfonts which are a massive PITA). Common denominator solution: bigfonts which are a massive PITA). Common denominator solution:
use Latin1 (and however someone could choke on it, anyway). Sorry use Latin1 (and however someone could choke on it, anyway). Sorry
for the extended latin people. If somewant want to try fixing this for the extended latin people. If somewant want to try fixing this
recent version seems to use UTF-8 (and not UCS2 like the rest of recent version seems to use UTF-8 (and not UCS2 like the rest of
Windows) Windows)
XXX Actually there is a *third* issue: older DXF formats are limited XXX Actually there is a *third* issue: older DXF formats are limited
...@@ -649,17 +648,17 @@ void DXF_PLOTTER::Text( const wxPoint& aPos, ...@@ -649,17 +648,17 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
{ {
/* Here I do a bad thing: writing the output one byte at a time! /* Here I do a bad thing: writing the output one byte at a time!
but today I'm lazy and I have no idea on how to coerce a Unicode but today I'm lazy and I have no idea on how to coerce a Unicode
wxString to spit out latin1 encoded text ... wxString to spit out latin1 encoded text ...
Atleast stdio is *supposed* to do output buffering, so there is Atleast stdio is *supposed* to do output buffering, so there is
hope is not too slow */ hope is not too slow */
wchar_t ch = aText[i]; wchar_t ch = aText[i];
if( ch > 255 ) if( ch > 255 )
{ {
// I can't encode this... // I can't encode this...
putc( '?', outputFile ); putc( '?', outputFile );
} }
else else
{ {
if( ch == '~' ) if( ch == '~' )
{ {
......
...@@ -36,13 +36,13 @@ void GERBER_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil, ...@@ -36,13 +36,13 @@ void GERBER_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
/** /**
* Emit a D-Code record, using proper conversions * Emit a D-Code record, using proper conversions
* to format a leading zero omitted gerber coordinate * to format a leading zero omitted gerber coordinate
* (for 4 decimal positions, see header generation in start_plot * (for 4 decimal positions, see header generation in start_plot
*/ */
void GERBER_PLOTTER::emitDcode( const DPOINT& pt, int dcode ) void GERBER_PLOTTER::emitDcode( const DPOINT& pt, int dcode )
{ {
fprintf( outputFile, "X%dY%dD%02d*\n", fprintf( outputFile, "X%dY%dD%02d*\n",
int( pt.x ), int( pt.y ), dcode ); int( pt.x ), int( pt.y ), dcode );
} }
...@@ -50,12 +50,12 @@ void GERBER_PLOTTER::emitDcode( const DPOINT& pt, int dcode ) ...@@ -50,12 +50,12 @@ void GERBER_PLOTTER::emitDcode( const DPOINT& pt, int dcode )
* Function start_plot * Function start_plot
* Write GERBER header to file * Write GERBER header to file
* initialize global variable g_Plot_PlotOutputFile * initialize global variable g_Plot_PlotOutputFile
* @param aFile: an opened file to write to
*/ */
bool GERBER_PLOTTER::StartPlot( FILE* aFile ) bool GERBER_PLOTTER::StartPlot()
{ {
wxASSERT( !outputFile ); wxASSERT( outputFile );
finalFile = aFile;
finalFile = outputFile; // the actual gerber file will be created later
// Create a temporary filename to store gerber file // Create a temporary filename to store gerber file
// note tmpfile() does not work under Vista and W7 in user mode // note tmpfile() does not work under Vista and W7 in user mode
...@@ -213,7 +213,7 @@ void GERBER_PLOTTER::writeApertureList() ...@@ -213,7 +213,7 @@ void GERBER_PLOTTER::writeApertureList()
break; break;
case APERTURE::Rect: case APERTURE::Rect:
sprintf( text, "R,%gX%g*%%\n", sprintf( text, "R,%gX%g*%%\n",
tool->Size.x * fscale, tool->Size.x * fscale,
tool->Size.y * fscale ); tool->Size.y * fscale );
break; break;
...@@ -223,8 +223,8 @@ void GERBER_PLOTTER::writeApertureList() ...@@ -223,8 +223,8 @@ void GERBER_PLOTTER::writeApertureList()
break; break;
case APERTURE::Oval: case APERTURE::Oval:
sprintf( text, "O,%gX%g*%%\n", sprintf( text, "O,%gX%g*%%\n",
tool->Size.x * fscale, tool->Size.x * fscale,
tool->Size.y * fscale ); tool->Size.y * fscale );
break; break;
} }
...@@ -256,7 +256,7 @@ void GERBER_PLOTTER::PenTo( const wxPoint& aPos, char plume ) ...@@ -256,7 +256,7 @@ void GERBER_PLOTTER::PenTo( const wxPoint& aPos, char plume )
} }
void GERBER_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, void GERBER_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
int width ) int width )
{ {
std::vector< wxPoint > cornerList; std::vector< wxPoint > cornerList;
...@@ -312,7 +312,7 @@ void GERBER_PLOTTER::Arc( const wxPoint& aCenter, int aStAngle, int aEndAngle, ...@@ -312,7 +312,7 @@ void GERBER_PLOTTER::Arc( const wxPoint& aCenter, int aStAngle, int aEndAngle,
* Gerber polygon: they can (and *should*) be filled with the * Gerber polygon: they can (and *should*) be filled with the
* appropriate G36/G37 sequence (raster fills are deprecated) * appropriate G36/G37 sequence (raster fills are deprecated)
*/ */
void GERBER_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, void GERBER_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth ) FILL_T aFill, int aWidth )
{ {
if( aCornerList.size() <= 1 ) if( aCornerList.size() <= 1 )
...@@ -344,7 +344,7 @@ void GERBER_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, ...@@ -344,7 +344,7 @@ void GERBER_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
/** /**
* Filled circular flashes are stored as apertures * Filled circular flashes are stored as apertures
*/ */
void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
EDA_DRAW_MODE_T trace_mode ) EDA_DRAW_MODE_T trace_mode )
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
...@@ -383,7 +383,7 @@ void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int ...@@ -383,7 +383,7 @@ void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int
{ {
if( orient == 900 || orient == 2700 ) /* orientation turned 90 deg. */ if( orient == 900 || orient == 2700 ) /* orientation turned 90 deg. */
EXCHG( size.x, size.y ); EXCHG( size.x, size.y );
DPOINT pos_dev = userToDeviceCoordinates( pos ); DPOINT pos_dev = userToDeviceCoordinates( pos );
selectAperture( size, APERTURE::Oval ); selectAperture( size, APERTURE::Oval );
emitDcode( pos_dev, 3 ); emitDcode( pos_dev, 3 );
...@@ -463,9 +463,9 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize, ...@@ -463,9 +463,9 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
} }
break; break;
default: // plot pad shape as polygon default: // plot pad shape as polygon
{ {
// XXX to do: use an aperture macro to declare the rotated pad // XXX to do: use an aperture macro to declare the rotated pad
wxPoint coord[4]; wxPoint coord[4];
// coord[0] is assumed the lower left // coord[0] is assumed the lower left
// coord[1] is assumed the upper left // coord[1] is assumed the upper left
...@@ -497,7 +497,7 @@ void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCo ...@@ -497,7 +497,7 @@ void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCo
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ) int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
{ {
// XXX to do: use an aperture macro to declare the pad // XXX to do: use an aperture macro to declare the pad
// polygon corners list // polygon corners list
std::vector< wxPoint > cornerList; std::vector< wxPoint > cornerList;
...@@ -518,7 +518,7 @@ void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCo ...@@ -518,7 +518,7 @@ void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCo
PlotPoly( cornerList, aTrace_Mode==FILLED ? FILLED_SHAPE : NO_FILL ); PlotPoly( cornerList, aTrace_Mode==FILLED ? FILLED_SHAPE : NO_FILL );
} }
/** /**
* Change the plot polarity and begin a new layer * Change the plot polarity and begin a new layer
* Used to 'scratch off' silk screen away from solder mask * Used to 'scratch off' silk screen away from solder mask
*/ */
......
...@@ -203,10 +203,9 @@ void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil, ...@@ -203,10 +203,9 @@ void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
/** /**
* At the start of the HPGL plot pen speed and number are requested * At the start of the HPGL plot pen speed and number are requested
*/ */
bool HPGL_PLOTTER::StartPlot( FILE* fout ) bool HPGL_PLOTTER::StartPlot()
{ {
wxASSERT( !outputFile ); wxASSERT( outputFile );
outputFile = fout;
fprintf( outputFile, "IN;VS%d;PU;PA;SP%d;\n", penSpeed, penNumber ); fprintf( outputFile, "IN;VS%d;PU;PA;SP%d;\n", penSpeed, penNumber );
return true; return true;
} }
......
...@@ -39,6 +39,28 @@ ...@@ -39,6 +39,28 @@
#include <wx/zstream.h> #include <wx/zstream.h>
#include <wx/mstream.h> #include <wx/mstream.h>
/*
* Open or create the plot file aFullFilename
* return true if success, false if the file cannot be created/opened
*
* Opens the PDF file in binary mode
*/
bool PDF_PLOTTER::OpenFile( const wxString& aFullFilename )
{
filename = aFullFilename;
wxASSERT( !outputFile );
// Open the PDF file in binary mode
outputFile = wxFopen( filename, wxT( "wb" ) );
if( outputFile == NULL )
return false ;
return true;
}
void PDF_PLOTTER::SetPageSettings( const PAGE_INFO& aPageSettings ) void PDF_PLOTTER::SetPageSettings( const PAGE_INFO& aPageSettings )
{ {
wxASSERT( !workFile ); wxASSERT( !workFile );
...@@ -555,11 +577,9 @@ void PDF_PLOTTER::ClosePage() ...@@ -555,11 +577,9 @@ void PDF_PLOTTER::ClosePage()
* 'for free' the following are to be closed and reopened. Between * 'for free' the following are to be closed and reopened. Between
* each page parameters can be set * each page parameters can be set
*/ */
bool PDF_PLOTTER::StartPlot( FILE* fout ) bool PDF_PLOTTER::StartPlot()
{ {
wxASSERT( !outputFile ); wxASSERT( outputFile );
outputFile = fout;
// First things first: the customary null object // First things first: the customary null object
xrefTable.clear(); xrefTable.clear();
......
...@@ -636,12 +636,11 @@ void PS_PLOTTER::PenTo( const wxPoint& pos, char plume ) ...@@ -636,12 +636,11 @@ void PS_PLOTTER::PenTo( const wxPoint& pos, char plume )
* BBox is the boundary box (position and size of the "client rectangle" * BBox is the boundary box (position and size of the "client rectangle"
* for drawings (page - margins) in mils (0.001 inch) * for drawings (page - margins) in mils (0.001 inch)
*/ */
bool PS_PLOTTER::StartPlot( FILE* fout ) bool PS_PLOTTER::StartPlot()
{ {
wxASSERT( !outputFile ); wxASSERT( outputFile );
wxString msg; wxString msg;
outputFile = fout;
static const char* PSMacro[] = static const char* PSMacro[] =
{ {
"%%BeginProlog\n" "%%BeginProlog\n"
......
...@@ -422,12 +422,11 @@ void SVG_PLOTTER::PenTo( const wxPoint& pos, char plume ) ...@@ -422,12 +422,11 @@ void SVG_PLOTTER::PenTo( const wxPoint& pos, char plume )
* The code within this function * The code within this function
* creates SVG files header * creates SVG files header
*/ */
bool SVG_PLOTTER::StartPlot( FILE* fout ) bool SVG_PLOTTER::StartPlot()
{ {
wxASSERT( !outputFile ); wxASSERT( outputFile );
wxString msg; wxString msg;
outputFile = fout;
static const char* header[] = static const char* header[] =
{ {
"<?xml version=\"1.0\" standalone=\"no\"?>\n", "<?xml version=\"1.0\" standalone=\"no\"?>\n",
......
...@@ -67,8 +67,9 @@ const wxString EaglePcbFileWildcard( _( "Eagle ver. 6.x XML PCB files (*.brd)|*. ...@@ -67,8 +67,9 @@ const wxString EaglePcbFileWildcard( _( "Eagle ver. 6.x XML PCB files (*.brd)|*.
const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) ); const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) );
const wxString FootprintLibFileWildcard( _( "KiCad footprint s-expre library file (*.kicad_mod)|*.kicad_mod" ) ); const wxString FootprintLibFileWildcard( _( "KiCad footprint s-expre library file (*.kicad_mod)|*.kicad_mod" ) );
const wxString LegacyFootprintLibFileWildcard( _( "KiCad footprint library file (*.mod)|*.mod" ) ); const wxString LegacyFootprintLibFileWildcard( _( "KiCad footprint library file (*.mod)|*.mod" ) );
const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) );
const wxString MacrosFileWildcard( _( "KiCad recorded macros (*.mcr)|*.mcr" ) ); const wxString MacrosFileWildcard( _( "KiCad recorded macros (*.mcr)|*.mcr" ) );
// generic:
const wxString AllFilesWildcard( _( "All files (*)|*" ) ); const wxString AllFilesWildcard( _( "All files (*)|*" ) );
// Wildcard for cvpcb component to footprint link file // Wildcard for cvpcb component to footprint link file
...@@ -77,6 +78,8 @@ const wxString ComponentFileWildcard( _( "KiCad cmp/footprint link files (*.cmp) ...@@ -77,6 +78,8 @@ const wxString ComponentFileWildcard( _( "KiCad cmp/footprint link files (*.cmp)
// Wildcard for reports and fabrication documents // Wildcard for reports and fabrication documents
const wxString DrillFileWildcard( _( "Drill files (*.drl)|*.drl;*.DRL" ) ); const wxString DrillFileWildcard( _( "Drill files (*.drl)|*.drl;*.DRL" ) );
const wxString SVGFileWildcard( _( "SVG files (*.svg)|*.svg;*.SVG" ) ); const wxString SVGFileWildcard( _( "SVG files (*.svg)|*.svg;*.SVG" ) );
const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) );
const wxString PSFileWildcard( _( "PostScript files (.ps)|*.ps" ) );
const wxString ReportFileWildcard = _( "Report files (*.rpt)|*.rpt" ); const wxString ReportFileWildcard = _( "Report files (*.rpt)|*.rpt" );
const wxString FootprintPlaceFileWildcard = _( "Footprint place files (*.pos)|*.pos" ); const wxString FootprintPlaceFileWildcard = _( "Footprint place files (*.pos)|*.pos" );
const wxString VrmlFileWildcard( _( "Vrml files (*.wrl)|*.wrl" ) ); const wxString VrmlFileWildcard( _( "Vrml files (*.wrl)|*.wrl" ) );
#include <dialog_sch_sheet_props.h> #include <wx/string.h>
#include <dialog_sch_sheet_props.h>
DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( wxWindow* parent ) :
DIALOG_SCH_SHEET_PROPS_BASE( parent ) DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( wxWindow* parent ) :
{ DIALOG_SCH_SHEET_PROPS_BASE( parent )
m_textFileName->SetFocus(); {
m_sdbSizer1OK->SetDefault(); m_textFileName->SetFocus();
} m_sdbSizer1OK->SetDefault();
}
void DIALOG_SCH_SHEET_PROPS::SetFileName( const wxString& aFileName )
{
// Filenames are stored using unix notation
wxString fname = aFileName;
#ifdef __WINDOWS__
fname.Replace( wxT("/"), wxT("\\") );
#endif
m_textFileName->SetValue( fname );
}
const wxString DIALOG_SCH_SHEET_PROPS::GetFileName()
{
// Filenames are stored using unix notation
wxString fname = m_textFileName->GetValue();
fname.Replace( wxT("\\"), wxT("/") );
return fname;
}
This diff is collapsed.
#ifndef __dialog_sch_sheet_props__ #ifndef __dialog_sch_sheet_props__
#define __dialog_sch_sheet_props__ #define __dialog_sch_sheet_props__
/** /**
* @file * @file
* Subclass of DIALOG_SCH_SHEET_PROPS_BASE, which is generated by wxFormBuilder. * Subclass of DIALOG_SCH_SHEET_PROPS_BASE, which is generated by wxFormBuilder.
*/ */
#include <dialog_sch_sheet_props_base.h> #include <dialog_sch_sheet_props_base.h>
/** Implementing DIALOG_SCH_SHEET_PROPS_BASE */ /** Implementing DIALOG_SCH_SHEET_PROPS_BASE */
class DIALOG_SCH_SHEET_PROPS : public DIALOG_SCH_SHEET_PROPS_BASE class DIALOG_SCH_SHEET_PROPS : public DIALOG_SCH_SHEET_PROPS_BASE
{ {
public: public:
/** Constructor */ /** Constructor */
DIALOG_SCH_SHEET_PROPS( wxWindow* parent ); DIALOG_SCH_SHEET_PROPS( wxWindow* parent );
void SetFileName( const wxString& aFileName ) void SetFileName( const wxString& aFileName );
{ const wxString GetFileName();
m_textFileName->SetValue( aFileName );
} void SetSheetName( const wxString& aSheetName )
wxString GetFileName() { return m_textFileName->GetValue(); } {
m_textSheetName->SetValue( aSheetName );
void SetSheetName( const wxString& aSheetName ) }
{ wxString GetSheetName() { return m_textSheetName->GetValue(); }
m_textSheetName->SetValue( aSheetName );
} void SetFileNameTextSize( const wxString& aTextSize )
wxString GetSheetName() { return m_textSheetName->GetValue(); } {
m_textFileNameSize->SetValue( aTextSize );
void SetFileNameTextSize( const wxString& aTextSize ) }
{ wxString GetFileNameTextSize() { return m_textFileNameSize->GetValue(); }
m_textFileNameSize->SetValue( aTextSize );
} void SetSheetNameTextSize( const wxString& aTextSize )
wxString GetFileNameTextSize() { return m_textFileNameSize->GetValue(); } {
m_textSheetNameSize->SetValue( aTextSize );
void SetSheetNameTextSize( const wxString& aTextSize ) }
{ wxString GetSheetNameTextSize() { return m_textSheetNameSize->GetValue(); }
m_textSheetNameSize->SetValue( aTextSize );
} void SetFileNameTextSizeUnits(const wxString& aUnits)
wxString GetSheetNameTextSize() { return m_textSheetNameSize->GetValue(); } {
m_staticFileNameSizeUnits->SetLabel( aUnits );
void SetFileNameTextSizeUnits(const wxString& aUnits) }
{
m_staticFileNameSizeUnits->SetLabel( aUnits ); void SetSheetNameTextSizeUnits(const wxString& aUnits)
} {
m_staticSheetNameSizeUnits->SetLabel( aUnits );
void SetSheetNameTextSizeUnits(const wxString& aUnits) }
{ };
m_staticSheetNameSizeUnits->SetLabel( aUnits );
} #endif // __dialog_sch_sheet_props__
};
#endif // __dialog_sch_sheet_props__
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010) // C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
...@@ -66,19 +66,25 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi ...@@ -66,19 +66,25 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi
m_staticSheetNameSizeUnits->Wrap( -1 ); m_staticSheetNameSizeUnits->Wrap( -1 );
fgSizer1->Add( m_staticSheetNameSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); fgSizer1->Add( m_staticSheetNameSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
mainSizer->Add( fgSizer1, 1, wxALL|wxEXPAND, 12 ); mainSizer->Add( fgSizer1, 1, wxALL|wxEXPAND, 12 );
mainSizer->Add( 0, 0, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); mainSizer->Add( 0, 0, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
mainSizer->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK ); m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK ); m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize(); m_sdbSizer1->Realize();
mainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 ); mainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 );
this->SetSizer( mainSizer ); this->SetSizer( mainSizer );
this->Layout(); this->Layout();
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010) // C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_sch_sheet_props_base__ #ifndef __DIALOG_SCH_SHEET_PROPS_BASE_H__
#define __dialog_sch_sheet_props_base__ #define __DIALOG_SCH_SHEET_PROPS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
...@@ -18,6 +20,7 @@ ...@@ -18,6 +20,7 @@
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
...@@ -26,33 +29,31 @@ ...@@ -26,33 +29,31 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SCH_SHEET_PROPS_BASE /// Class DIALOG_SCH_SHEET_PROPS_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DIALOG_SCH_SHEET_PROPS_BASE : public wxDialog class DIALOG_SCH_SHEET_PROPS_BASE : public DIALOG_SHIM
{ {
private: private:
protected: protected:
wxStaticText* m_staticText1; wxStaticText* m_staticText1;
wxTextCtrl* m_textFileName; wxTextCtrl* m_textFileName;
wxStaticText* m_staticText2; wxStaticText* m_staticText2;
wxTextCtrl* m_textFileNameSize; wxTextCtrl* m_textFileNameSize;
wxStaticText* m_staticFileNameSizeUnits; wxStaticText* m_staticFileNameSizeUnits;
wxStaticText* m_staticText4; wxStaticText* m_staticText4;
wxTextCtrl* m_textSheetName; wxTextCtrl* m_textSheetName;
wxStaticText* m_staticText5; wxStaticText* m_staticText5;
wxTextCtrl* m_textSheetNameSize; wxTextCtrl* m_textSheetNameSize;
wxStaticText* m_staticSheetNameSizeUnits; wxStaticText* m_staticSheetNameSizeUnits;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer1; wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizer1Cancel;
public: public:
DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Sheet Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 453,170 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Sheet Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 453,170 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_SCH_SHEET_PROPS_BASE(); ~DIALOG_SCH_SHEET_PROPS_BASE();
}; };
#endif //__dialog_sch_sheet_props_base__ #endif //__DIALOG_SCH_SHEET_PROPS_BASE_H__
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include <richio.h> #include <richio.h>
#include <general.h> #include <general.h>
//#include <protos.h>
#include <sch_bus_entry.h> #include <sch_bus_entry.h>
#include <sch_marker.h> #include <sch_marker.h>
#include <sch_junction.h> #include <sch_junction.h>
...@@ -78,8 +77,14 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi ...@@ -78,8 +77,14 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi
aScreen->SetFileName( aFullFileName ); aScreen->SetFileName( aFullFileName );
FILE* f; FILE* f;
wxString fname = aFullFileName;
#ifdef __WINDOWS__
fname.Replace( wxT("/"), wxT("\\") );
#else
fname.Replace( wxT("\\"), wxT("/") );
#endif
if( ( f = wxFopen( aFullFileName, wxT( "rt" ) ) ) == NULL ) if( ( f = wxFopen( fname, wxT( "rt" ) ) ) == NULL )
{ {
msgDiag = _( "Failed to open " ) + aFullFileName; msgDiag = _( "Failed to open " ) + aFullFileName;
DisplayError( this, msgDiag ); DisplayError( this, msgDiag );
......
...@@ -107,13 +107,6 @@ bool DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF( const wxString& aFileName, ...@@ -107,13 +107,6 @@ bool DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF( const wxString& aFileName,
double aScale, double aScale,
bool aPlotFrameRef ) bool aPlotFrameRef )
{ {
FILE* output_file = wxFopen( aFileName, wxT( "wt" ) );
if( output_file == NULL )
return false;
LOCALE_IO toggle;
DXF_PLOTTER* plotter = new DXF_PLOTTER(); DXF_PLOTTER* plotter = new DXF_PLOTTER();
const PAGE_INFO& pageInfo = aScreen->GetPageSettings(); const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
...@@ -123,8 +116,16 @@ bool DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF( const wxString& aFileName, ...@@ -123,8 +116,16 @@ bool DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF( const wxString& aFileName,
// Init : // Init :
plotter->SetCreator( wxT( "Eeschema-DXF" ) ); plotter->SetCreator( wxT( "Eeschema-DXF" ) );
plotter->SetFilename( aFileName );
plotter->StartPlot( output_file ); if( ! plotter->OpenFile( aFileName ) )
{
delete plotter;
return false;
}
LOCALE_IO toggle;
plotter->StartPlot();
if( aPlotFrameRef ) if( aPlotFrameRef )
{ {
......
...@@ -205,13 +205,6 @@ bool DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL( const wxString& aFileName, ...@@ -205,13 +205,6 @@ bool DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL( const wxString& aFileName,
double aScale, double aScale,
bool aPlotFrameRef ) bool aPlotFrameRef )
{ {
FILE* output_file = wxFopen( aFileName, wxT( "wt" ) );
if( output_file == NULL )
return false;
LOCALE_IO toggle;
HPGL_PLOTTER* plotter = new HPGL_PLOTTER(); HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
plotter->SetPageSettings( aPageInfo ); plotter->SetPageSettings( aPageInfo );
...@@ -219,12 +212,20 @@ bool DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL( const wxString& aFileName, ...@@ -219,12 +212,20 @@ bool DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL( const wxString& aFileName,
// Init : // Init :
plotter->SetCreator( wxT( "Eeschema-HPGL" ) ); plotter->SetCreator( wxT( "Eeschema-HPGL" ) );
plotter->SetFilename( aFileName );
if( ! plotter->OpenFile( aFileName ) )
{
delete plotter;
return false;
}
LOCALE_IO toggle;
// Pen num and pen speed are not initialized here. // Pen num and pen speed are not initialized here.
// Default HPGL driver values are used // Default HPGL driver values are used
plotter->SetPenDiameter( m_HPGLPenSize ); plotter->SetPenDiameter( m_HPGLPenSize );
plotter->SetPenOverlap( m_HPGLPenSize / 4 ); plotter->SetPenOverlap( m_HPGLPenSize / 4 );
plotter->StartPlot( output_file ); plotter->StartPlot();
plotter->SetColor( BLACK ); plotter->SetColor( BLACK );
......
...@@ -88,20 +88,18 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef ) ...@@ -88,20 +88,18 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
plotFileName = m_parent->GetUniqueFilenameForCurrentSheet() + wxT( "." ) plotFileName = m_parent->GetUniqueFilenameForCurrentSheet() + wxT( "." )
+ PDF_PLOTTER::GetDefaultFileExtension(); + PDF_PLOTTER::GetDefaultFileExtension();
FILE* output_file = wxFopen( plotFileName, wxT( "wb" ) ); if( ! plotter->OpenFile( plotFileName ) )
if( output_file == NULL )
{ {
msg.Printf( _( "** Unable to create %s **\n" ), GetChars( plotFileName ) ); msg.Printf( _( "** Unable to create %s **\n" ), GetChars( plotFileName ) );
m_MessagesBox->AppendText( msg ); m_MessagesBox->AppendText( msg );
delete plotter;
return; return;
} }
// Open the plotter and do the first page // Open the plotter and do the first page
SetLocaleTo_C_standard(); SetLocaleTo_C_standard();
plotter->SetFilename( plotFileName );
setupPlotPagePDF( plotter, screen ); setupPlotPagePDF( plotter, screen );
plotter->StartPlot( output_file ); plotter->StartPlot();
first_page = false; first_page = false;
} }
else else
......
...@@ -137,7 +137,6 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName, ...@@ -137,7 +137,6 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
if( output_file == NULL ) if( output_file == NULL )
return false; return false;
SetLocaleTo_C_standard();
PS_PLOTTER* plotter = new PS_PLOTTER(); PS_PLOTTER* plotter = new PS_PLOTTER();
plotter->SetPageSettings( aPageInfo ); plotter->SetPageSettings( aPageInfo );
plotter->SetDefaultLineWidth( GetDefaultLineThickness() ); plotter->SetDefaultLineWidth( GetDefaultLineThickness() );
...@@ -146,8 +145,15 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName, ...@@ -146,8 +145,15 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
// Init : // Init :
plotter->SetCreator( wxT( "Eeschema-PS" ) ); plotter->SetCreator( wxT( "Eeschema-PS" ) );
plotter->SetFilename( aFileName );
plotter->StartPlot( output_file ); if( ! plotter->OpenFile( aFileName ) )
{
delete plotter;
return false;
}
SetLocaleTo_C_standard();
plotter->StartPlot();
if( aPlotFrameRef ) if( aPlotFrameRef )
{ {
......
...@@ -120,13 +120,6 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( EDA_DRAW_FRAME* aFrame, ...@@ -120,13 +120,6 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( EDA_DRAW_FRAME* aFrame,
bool aPlotBlackAndWhite, bool aPlotBlackAndWhite,
bool aPlotFrameRef ) bool aPlotFrameRef )
{ {
FILE* output_file = wxFopen( aFileName, wxT( "wt" ) );
if( output_file == NULL )
return false;
LOCALE_IO toggle;
SVG_PLOTTER* plotter = new SVG_PLOTTER(); SVG_PLOTTER* plotter = new SVG_PLOTTER();
const PAGE_INFO& pageInfo = aScreen->GetPageSettings(); const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
...@@ -139,8 +132,16 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( EDA_DRAW_FRAME* aFrame, ...@@ -139,8 +132,16 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( EDA_DRAW_FRAME* aFrame,
// Init : // Init :
plotter->SetCreator( wxT( "Eeschema-SVG" ) ); plotter->SetCreator( wxT( "Eeschema-SVG" ) );
plotter->SetFilename( aFileName );
plotter->StartPlot( output_file ); if( ! plotter->OpenFile( aFileName ) )
{
delete plotter;
return false;
}
LOCALE_IO toggle;
plotter->StartPlot();
if( aPlotFrameRef ) if( aPlotFrameRef )
{ {
......
...@@ -469,6 +469,8 @@ public: ...@@ -469,6 +469,8 @@ public:
void SetFileName( const wxString& aFilename ) void SetFileName( const wxString& aFilename )
{ {
m_fileName = aFilename; m_fileName = aFilename;
// Filenames are stored using unix notation
m_fileName.Replace( wxT("\\"), wxT("/") );
} }
bool ChangeFileName( SCH_EDIT_FRAME* aFrame, const wxString& aFileName ); bool ChangeFileName( SCH_EDIT_FRAME* aFrame, const wxString& aFileName );
......
...@@ -93,7 +93,14 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -93,7 +93,14 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
bool loadFromFile = false; bool loadFromFile = false;
SCH_SCREEN* useScreen = NULL; SCH_SCREEN* useScreen = NULL;
if( !g_RootSheet->SearchHierarchy( fileName.GetFullPath(), &useScreen ) ) wxString newFullFilename = fileName.GetFullPath();
// Inside Eeschema, filenames are stored using unix notation
newFullFilename.Replace( wxT("\\"), wxT("/") );
// Search for a schematic file having the same filename exists,
// already in use in the hierarchy, or on disk,
// in order to reuse it
if( !g_RootSheet->SearchHierarchy( newFullFilename, &useScreen ) )
loadFromFile = fileName.FileExists(); loadFromFile = fileName.FileExists();
if( aSheet->GetScreen() == NULL ) // New sheet. if( aSheet->GetScreen() == NULL ) // New sheet.
...@@ -101,7 +108,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -101,7 +108,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
if( ( useScreen != NULL ) || loadFromFile ) // Load from existing file. if( ( useScreen != NULL ) || loadFromFile ) // Load from existing file.
{ {
msg.Printf( _( "A file named \"%s\" already exists" ), msg.Printf( _( "A file named \"%s\" already exists" ),
GetChars( fileName.GetFullName() ) ); GetChars( newFullFilename ) );
if( useScreen != NULL ) if( useScreen != NULL )
msg += _( " in the current schematic hierarchy" ); msg += _( " in the current schematic hierarchy" );
...@@ -114,7 +121,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -114,7 +121,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
else // New file. else // New file.
{ {
aSheet->SetScreen( new SCH_SCREEN() ); aSheet->SetScreen( new SCH_SCREEN() );
aSheet->GetScreen()->SetFileName( fileName.GetFullPath() ); aSheet->GetScreen()->SetFileName( newFullFilename );
} }
} }
else // Existing sheet. else // Existing sheet.
...@@ -122,7 +129,11 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -122,7 +129,11 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
bool isUndoable = true; bool isUndoable = true;
bool renameFile = false; bool renameFile = false;
if( fileName.GetFullName().CmpNoCase( aSheet->GetFileName() ) != 0 ) // We are always using here a case insensitive comparison
// to avoid issues under Windows, although under Unix
// filenames are case sensitive.
// But many users create schematic under both Unix and Windows
if( newFullFilename.CmpNoCase( aSheet->GetFileName() ) != 0 )
{ {
// Sheet file name changes cannot be undone. // Sheet file name changes cannot be undone.
isUndoable = false; isUndoable = false;
...@@ -131,7 +142,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -131,7 +142,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
if( ( useScreen != NULL ) || loadFromFile ) // Load from existing file. if( ( useScreen != NULL ) || loadFromFile ) // Load from existing file.
{ {
tmp.Printf( _( "A file named \"%s\" already exists" ), tmp.Printf( _( "A file named \"%s\" already exists" ),
GetChars( fileName.GetFullName() ) ); GetChars( newFullFilename ) );
msg += tmp; msg += tmp;
if( useScreen != NULL ) if( useScreen != NULL )
...@@ -168,7 +179,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -168,7 +179,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
if( renameFile ) if( renameFile )
{ {
aSheet->GetScreen()->SetFileName( fileName.GetFullName() ); aSheet->GetScreen()->SetFileName( newFullFilename );
SaveEEFile( aSheet->GetScreen() ); SaveEEFile( aSheet->GetScreen() );
// If the the associated screen is shared by more than one sheet, remove the // If the the associated screen is shared by more than one sheet, remove the
...@@ -182,7 +193,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -182,7 +193,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
} }
} }
aSheet->SetFileName( fileName.GetFullPath() ); aSheet->SetFileName( newFullFilename );
if( useScreen ) if( useScreen )
aSheet->SetScreen( useScreen ); aSheet->SetScreen( useScreen );
......
...@@ -77,7 +77,7 @@ public: ...@@ -77,7 +77,7 @@ public:
*/ */
virtual PlotFormat GetPlotterType() const = 0; virtual PlotFormat GetPlotterType() const = 0;
virtual bool StartPlot( FILE* fout ) = 0; virtual bool StartPlot() = 0;
virtual bool EndPlot() = 0; virtual bool EndPlot() = 0;
virtual void SetNegative( bool _negative ) virtual void SetNegative( bool _negative )
...@@ -124,11 +124,6 @@ public: ...@@ -124,11 +124,6 @@ public:
creator = _creator; creator = _creator;
} }
virtual void SetFilename( const wxString& _filename )
{
filename = _filename;
}
/** /**
* Set the plot offset and scaling for the current plot * Set the plot offset and scaling for the current plot
* @param aOffset is the plot offset * @param aOffset is the plot offset
...@@ -141,6 +136,16 @@ public: ...@@ -141,6 +136,16 @@ public:
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil, virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) = 0; double aScale, bool aMirror ) = 0;
/**
* Open or create the plot file aFullFilename
* @param aFullFilename = the full file name of the file to create
* @return true if success, false if the file cannot be created/opened
*
* Virtual because some plotters use ascii files, some others binary files (PDF)
* The base class open the file in text mode
*/
virtual bool OpenFile( const wxString& aFullFilename );
/** /**
* The IUs per decimil are an essential scaling factor when * The IUs per decimil are an essential scaling factor when
* plotting; they are set and saved when establishing the viewport. * plotting; they are set and saved when establishing the viewport.
...@@ -356,7 +361,7 @@ public: ...@@ -356,7 +361,7 @@ public:
return wxString( wxT( "plt" ) ); return wxString( wxT( "plt" ) );
} }
virtual bool StartPlot( FILE* fout ); virtual bool StartPlot();
virtual bool EndPlot(); virtual bool EndPlot();
/// HPGL doesn't handle line thickness or color /// HPGL doesn't handle line thickness or color
...@@ -528,7 +533,7 @@ public: ...@@ -528,7 +533,7 @@ public:
return PLOT_FORMAT_POST; return PLOT_FORMAT_POST;
} }
virtual bool StartPlot( FILE* fout ); virtual bool StartPlot();
virtual bool EndPlot(); virtual bool EndPlot();
virtual void SetCurrentLineWidth( int width ); virtual void SetCurrentLineWidth( int width );
virtual void SetDash( bool dashed ); virtual void SetDash( bool dashed );
...@@ -580,7 +585,17 @@ public: ...@@ -580,7 +585,17 @@ public:
return wxString( wxT( "pdf" ) ); return wxString( wxT( "pdf" ) );
} }
virtual bool StartPlot( FILE* fout ); /**
* Open or create the plot file aFullFilename
* @param aFullFilename = the full file name of the file to create
* @return true if success, false if the file cannot be created/opened
*
* The base class open the file in text mode, so we should have this
* function overlaid for PDF files, which are binary files
*/
virtual bool OpenFile( const wxString& aFullFilename );
virtual bool StartPlot();
virtual bool EndPlot(); virtual bool EndPlot();
virtual void StartPage(); virtual void StartPage();
virtual void ClosePage(); virtual void ClosePage();
...@@ -652,7 +667,7 @@ public: ...@@ -652,7 +667,7 @@ public:
} }
virtual void SetColor( EDA_COLOR_T color ); virtual void SetColor( EDA_COLOR_T color );
virtual bool StartPlot( FILE* fout ); virtual bool StartPlot();
virtual bool EndPlot(); virtual bool EndPlot();
virtual void SetCurrentLineWidth( int width ); virtual void SetCurrentLineWidth( int width );
virtual void SetDash( bool dashed ); virtual void SetDash( bool dashed );
...@@ -758,7 +773,7 @@ public: ...@@ -758,7 +773,7 @@ public:
return wxString( wxT( "pho" ) ); return wxString( wxT( "pho" ) );
} }
virtual bool StartPlot( FILE* fout ); virtual bool StartPlot();
virtual bool EndPlot(); virtual bool EndPlot();
virtual void SetCurrentLineWidth( int width ); virtual void SetCurrentLineWidth( int width );
virtual void SetDefaultLineWidth( int width ); virtual void SetDefaultLineWidth( int width );
...@@ -833,7 +848,7 @@ public: ...@@ -833,7 +848,7 @@ public:
textAsLines = ( mode != PLOTTEXTMODE_NATIVE ); textAsLines = ( mode != PLOTTEXTMODE_NATIVE );
} }
virtual bool StartPlot( FILE* fout ); virtual bool StartPlot();
virtual bool EndPlot(); virtual bool EndPlot();
// For now we don't use 'thick' primitives, so no line width // For now we don't use 'thick' primitives, so no line width
......
...@@ -74,6 +74,7 @@ extern const wxString LegacyPcbFileWildcard; ...@@ -74,6 +74,7 @@ extern const wxString LegacyPcbFileWildcard;
extern const wxString PcbFileWildcard; extern const wxString PcbFileWildcard;
extern const wxString EaglePcbFileWildcard; extern const wxString EaglePcbFileWildcard;
extern const wxString PdfFileWildcard; extern const wxString PdfFileWildcard;
extern const wxString PSFileWildcard;
extern const wxString MacrosFileWildcard; extern const wxString MacrosFileWildcard;
extern const wxString AllFilesWildcard; extern const wxString AllFilesWildcard;
extern const wxString ComponentFileWildcard; extern const wxString ComponentFileWildcard;
......
...@@ -432,14 +432,14 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap) ...@@ -432,14 +432,14 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap)
if( aGenMap ) if( aGenMap )
{ {
const PlotFormat filefmt[5] = const PlotFormat filefmt[6] =
{ // Keep these format ids in the same order than m_Choice_Drill_Map choices { // Keep these format ids in the same order than m_Choice_Drill_Map choices
PLOT_FORMAT_HPGL, PLOT_FORMAT_POST, PLOT_FORMAT_GERBER, PLOT_FORMAT_HPGL, PLOT_FORMAT_POST, PLOT_FORMAT_GERBER,
PLOT_FORMAT_DXF, PLOT_FORMAT_SVG PLOT_FORMAT_DXF, PLOT_FORMAT_SVG, PLOT_FORMAT_PDF
}; };
unsigned choice = (unsigned) m_Choice_Drill_Map->GetSelection(); unsigned choice = (unsigned) m_Choice_Drill_Map->GetSelection();
if( choice > 4 ) if( choice >= m_Choice_Drill_Map->GetCount() )
choice = 1; choice = 1;
fn.SetExt( wxEmptyString ); // Will be modified by GenDrillMap fn.SetExt( wxEmptyString ); // Will be modified by GenDrillMap
...@@ -548,7 +548,7 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName, ...@@ -548,7 +548,7 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName,
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
ext = PS_PLOTTER::GetDefaultFileExtension(); ext = PS_PLOTTER::GetDefaultFileExtension();
wildcard = _( "PostScript files (.ps)|*.ps" ); wildcard = PSFileWildcard;
break; break;
case PLOT_FORMAT_GERBER: case PLOT_FORMAT_GERBER:
...@@ -566,8 +566,13 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName, ...@@ -566,8 +566,13 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName,
wildcard = SVGFileWildcard; wildcard = SVGFileWildcard;
break; break;
case PLOT_FORMAT_PDF:
ext = PDF_PLOTTER::GetDefaultFileExtension();
wildcard = PdfFileWildcard;
break;
default: default:
wxMessageBox( wxT( "DIALOG_GENDRILL::GenDrillMap() error" ) ); wxLogMessage( wxT( "DIALOG_GENDRILL::GenDrillMap() error, fmt % unkown" ), format );
return; return;
} }
......
...@@ -70,9 +70,9 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con ...@@ -70,9 +70,9 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
wxBoxSizer* bMiddleBoxSizer; wxBoxSizer* bMiddleBoxSizer;
bMiddleBoxSizer = new wxBoxSizer( wxVERTICAL ); bMiddleBoxSizer = new wxBoxSizer( wxVERTICAL );
wxString m_Choice_Drill_MapChoices[] = { _("Drill map (HPGL)"), _("Drill map (PostScript)"), _("Drill map (Gerber)"), _("Drill map (DXF)"), _("Drill map (SVG)") }; wxString m_Choice_Drill_MapChoices[] = { _("HPGL"), _("PostScript"), _("Gerber"), _("DXF"), _("SVG"), _("PDF") };
int m_Choice_Drill_MapNChoices = sizeof( m_Choice_Drill_MapChoices ) / sizeof( wxString ); int m_Choice_Drill_MapNChoices = sizeof( m_Choice_Drill_MapChoices ) / sizeof( wxString );
m_Choice_Drill_Map = new wxRadioBox( this, wxID_ANY, _("Drill Map:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_MapNChoices, m_Choice_Drill_MapChoices, 1, wxRA_SPECIFY_COLS ); m_Choice_Drill_Map = new wxRadioBox( this, wxID_ANY, _("Drill Map File Format:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_MapNChoices, m_Choice_Drill_MapChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Drill_Map->SetSelection( 1 ); m_Choice_Drill_Map->SetSelection( 1 );
m_Choice_Drill_Map->SetToolTip( _("Creates a drill map in PS, HPGL or other formats") ); m_Choice_Drill_Map->SetToolTip( _("Creates a drill map in PS, HPGL or other formats") );
......
...@@ -619,7 +619,7 @@ ...@@ -619,7 +619,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="choices">&quot;Drill map (HPGL)&quot; &quot;Drill map (PostScript)&quot; &quot;Drill map (Gerber)&quot; &quot;Drill map (DXF)&quot; &quot;Drill map (SVG)&quot;</property> <property name="choices">&quot;HPGL&quot; &quot;PostScript&quot; &quot;Gerber&quot; &quot;DXF&quot; &quot;SVG&quot; &quot;PDF&quot;</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
...@@ -634,7 +634,7 @@ ...@@ -634,7 +634,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Drill Map:</property> <property name="label">Drill Map File Format:</property>
<property name="majorDimension">1</property> <property name="majorDimension">1</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
......
...@@ -97,6 +97,11 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName, ...@@ -97,6 +97,11 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName,
} }
break; break;
default:
wxASSERT( false );
// fall through
case PLOT_FORMAT_PDF:
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
{ {
PAGE_INFO pageA4( wxT( "A4" ) ); PAGE_INFO pageA4( wxT( "A4" ) );
...@@ -124,9 +129,12 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName, ...@@ -124,9 +129,12 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName,
offset.y = (int) ( (double) bbbox.Centre().y - offset.y = (int) ( (double) bbbox.Centre().y -
( ypagesize_for_board / 2.0 ) / scale ); ( ypagesize_for_board / 2.0 ) / scale );
PS_PLOTTER* ps_plotter = new PS_PLOTTER; if( aFormat == PLOT_FORMAT_PDF )
plotter = ps_plotter; plotter = new PDF_PLOTTER;
ps_plotter->SetPageSettings( pageA4 ); else
plotter = new PS_PLOTTER;
plotter->SetPageSettings( pageA4 );
plotter->SetViewport( offset, IU_PER_DECIMILS, scale, false ); plotter->SetViewport( offset, IU_PER_DECIMILS, scale, false );
} }
break; break;
...@@ -148,23 +156,19 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName, ...@@ -148,23 +156,19 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName,
plotter->SetViewport( offset, IU_PER_DECIMILS, scale, false ); plotter->SetViewport( offset, IU_PER_DECIMILS, scale, false );
} }
break; break;
default:
wxASSERT( false );
} }
FILE* plotfile = wxFopen( aFullFileName, wxT( "wt" ) ); plotter->SetCreator( wxT( "PCBNEW" ) );
plotter->SetDefaultLineWidth( 5 * IU_PER_MILS );
plotter->SetColorMode( false );
if( plotfile == NULL ) if( ! plotter->OpenFile( aFullFileName ) )
{ {
delete plotter; delete plotter;
return false; return false;
} }
plotter->SetCreator( wxT( "PCBNEW" ) ); plotter->StartPlot();
plotter->SetFilename( aFullFileName );
plotter->SetDefaultLineWidth( 10 * IU_PER_DECIMILS );
plotter->StartPlot( plotfile );
// Draw items on edge layer (not all, only items useful for drill map // Draw items on edge layer (not all, only items useful for drill map
BRDITEMS_PLOTTER itemplotter( plotter, m_pcb, plot_opts ); BRDITEMS_PLOTTER itemplotter( plotter, m_pcb, plot_opts );
......
...@@ -612,13 +612,13 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, ...@@ -612,13 +612,13 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts,
wxASSERT( false ); wxASSERT( false );
} }
the_plotter->SetFilename( aFullFileName );
// Compute the viewport and set the other options // Compute the viewport and set the other options
initializePlotter( the_plotter, aBoard, aPlotOpts ); initializePlotter( the_plotter, aBoard, aPlotOpts );
if( the_plotter->StartPlot( output_file ) ) if( the_plotter->OpenFile( aFullFileName ) )
{ {
the_plotter->StartPlot();
// Plot the frame reference if requested // Plot the frame reference if requested
if( aPlotOpts->GetPlotFrameRef() ) if( aPlotOpts->GetPlotFrameRef() )
PlotWorkSheet( the_plotter, aBoard->GetTitleBlock(), PlotWorkSheet( the_plotter, aBoard->GetTitleBlock(),
......
update=19/09/2011 08:20:40 update=13/10/2012 17:48:08
version=1 version=1
last_client=pcbnew last_client=pcbnew
[general] [general]
version=1 version=1
RootSch= RootSch=
BoardNm= BoardNm=
[cvpcb]
version=1
NetIExt=net
[cvpcb/libraries]
EquName1=devcms
[eeschema] [eeschema]
version=1 version=1
LibDir= LibDir=
NetFmt=1 NetFmtName=
HPGLSpd=20
HPGLDm=15
HPGLNum=1
offX_A4=0
offY_A4=0
offX_A3=0
offY_A3=0
offX_A2=0
offY_A2=0
offX_A1=0
offY_A1=0
offX_A0=0
offY_A0=0
offX_A=0
offY_A=0
offX_B=0
offY_B=0
offX_C=0
offY_C=0
offX_D=0
offY_D=0
offX_E=0
offY_E=0
RptD_X=0 RptD_X=0
RptD_Y=100 RptD_Y=100
RptLab=1 RptLab=1
...@@ -67,28 +49,23 @@ LibName27=opto ...@@ -67,28 +49,23 @@ LibName27=opto
LibName28=atmel LibName28=atmel
LibName29=contrib LibName29=contrib
LibName30=valves LibName30=valves
[cvpcb]
version=1
NetIExt=net
[cvpcb/libraries]
EquName1=devcms
[pcbnew] [pcbnew]
version=1 version=1
LastNetListRead=
PadDrlX=320 PadDrlX=320
PadDimH=600 PadDimH=550
PadDimV=600 PadDimV=550
BoardThickness=630 BoardThickness=620
TxtPcbV=800 TxtPcbV=600
TxtPcbH=600 TxtPcbH=600
TxtModV=600 TxtModV=500
TxtModH=600 TxtModH=500
TxtModW=120 TxtModW=100
VEgarde=100 VEgarde=100
DrawLar=150 DrawLar=120
EdgeLar=150 EdgeLar=80
TxtLar=120 TxtLar=120
MSegLar=150 MSegLar=120
LastNetListRead=
[pcbnew/libraries] [pcbnew/libraries]
LibDir= LibDir=
LibName1=sockets LibName1=sockets
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment