Commit 7cef5395 authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio

Minor plot driver enhancements

parent 715af961
...@@ -29,13 +29,20 @@ void DXF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil, ...@@ -29,13 +29,20 @@ void DXF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
wxASSERT( !outputFile ); wxASSERT( !outputFile );
plotOffset = aOffset; plotOffset = aOffset;
plotScale = aScale; plotScale = aScale;
// XXX Need to think about this: what is the 'native' unit used for DXF?
/* 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;
/* Like paper size DXF units are abstract too. Anyway there is a
* system variable (MEASUREMENT) which will be set to 1 to indicate
* metric units */
m_IUsPerDecimil = aIusPerDecimil;
iuPerDeviceUnit = 1.0 / aIusPerDecimil; // Gives a DXF in decimils iuPerDeviceUnit = 1.0 / aIusPerDecimil; // Gives a DXF in decimils
iuPerDeviceUnit *= 0.00254; // DXF in mm (I like it best) iuPerDeviceUnit *= 0.00254; // ... now in mm
// Compute the paper size in IUs
paperSize = pageInfo.GetSizeMils();
paperSize.x *= 10.0 * aIusPerDecimil;
paperSize.y *= 10.0 * aIusPerDecimil;
SetDefaultLineWidth( 0 ); // No line width on DXF SetDefaultLineWidth( 0 ); // No line width on DXF
plotMirror = false; // No mirroring on DXF plotMirror = false; // No mirroring on DXF
currentColor = BLACK; currentColor = BLACK;
......
...@@ -25,6 +25,7 @@ void GERBER_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil, ...@@ -25,6 +25,7 @@ void GERBER_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
plotOffset = aOffset; plotOffset = aOffset;
wxASSERT( aScale == 1 ); wxASSERT( aScale == 1 );
plotScale = 1; plotScale = 1;
m_IUsPerDecimil = aIusPerDecimil;
iuPerDeviceUnit = 1.0 / aIusPerDecimil; iuPerDeviceUnit = 1.0 / aIusPerDecimil;
/* We don't handle the filmbox, and it's more useful to keep the /* We don't handle the filmbox, and it's more useful to keep the
* origin at the origin */ * origin at the origin */
......
...@@ -26,6 +26,7 @@ void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil, ...@@ -26,6 +26,7 @@ void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
wxASSERT( !outputFile ); wxASSERT( !outputFile );
plotOffset = aOffset; plotOffset = aOffset;
plotScale = aScale; plotScale = aScale;
m_IUsPerDecimil = aIusPerDecimil;
iuPerDeviceUnit = PLUsPERDECIMIL / aIusPerDecimil; iuPerDeviceUnit = PLUsPERDECIMIL / aIusPerDecimil;
/* Compute the paper size in IUs */ /* Compute the paper size in IUs */
paperSize = pageInfo.GetSizeMils(); paperSize = pageInfo.GetSizeMils();
......
...@@ -52,6 +52,7 @@ void PDF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil, ...@@ -52,6 +52,7 @@ void PDF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
plotMirror = aMirror; plotMirror = aMirror;
plotOffset = aOffset; plotOffset = aOffset;
plotScale = aScale; plotScale = aScale;
m_IUsPerDecimil = aIusPerDecimil;
// The CTM is set to 1 user unit per decimil // The CTM is set to 1 user unit per decimil
iuPerDeviceUnit = 1.0 / aIusPerDecimil; iuPerDeviceUnit = 1.0 / aIusPerDecimil;
...@@ -425,10 +426,6 @@ int PDF_PLOTTER::startPdfStream(int handle) ...@@ -425,10 +426,6 @@ int PDF_PLOTTER::startPdfStream(int handle)
/** /**
* Finish the current PDF stream (writes the deferred length, too) * Finish the current PDF stream (writes the deferred length, too)
* XXX the compression code is not very elegant... is slurps the
* whole stream in RAM, allocates an output buffer of the same size
* and try to FLATE it. Asserts if it couldn't... enhancements are
* welcome but for now it simply works
*/ */
void PDF_PLOTTER::closePdfStream() void PDF_PLOTTER::closePdfStream()
{ {
...@@ -730,7 +727,7 @@ void PDF_PLOTTER::Text( const wxPoint& aPos, ...@@ -730,7 +727,7 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
bool aBold ) bool aBold )
{ {
// Emit native PDF text (if requested) // Emit native PDF text (if requested)
if( psTextMode != PSTEXTMODE_STROKE ) if( m_textMode != PLOTTEXTMODE_STROKE )
{ {
const char *fontname = aItalic ? (aBold ? "/KicadFontBI" : "/KicadFontI") const char *fontname = aItalic ? (aBold ? "/KicadFontBI" : "/KicadFontI")
: (aBold ? "/KicadFontB" : "/KicadFont"); : (aBold ? "/KicadFontB" : "/KicadFont");
...@@ -754,7 +751,7 @@ void PDF_PLOTTER::Text( const wxPoint& aPos, ...@@ -754,7 +751,7 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
fprintf( workFile, "q %f %f %f %f %g %g cm BT %s %g Tf %d Tr %g Tz ", fprintf( workFile, "q %f %f %f %f %g %g cm BT %s %g Tf %d Tr %g Tz ",
ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f, ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f,
fontname, heightFactor, fontname, heightFactor,
(psTextMode == PSTEXTMODE_NATIVE) ? 0 : 3, (m_textMode == PLOTTEXTMODE_NATIVE) ? 0 : 3,
wideningFactor * 100 ); wideningFactor * 100 );
// The text must be escaped correctly // The text must be escaped correctly
...@@ -763,7 +760,7 @@ void PDF_PLOTTER::Text( const wxPoint& aPos, ...@@ -763,7 +760,7 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
/* We are still in text coordinates, plot the overbars (if we're /* We are still in text coordinates, plot the overbars (if we're
* not doing phantom text) */ * not doing phantom text) */
if( psTextMode == PSTEXTMODE_NATIVE ) if( m_textMode == PLOTTEXTMODE_NATIVE )
{ {
std::vector<int> pos_pairs; std::vector<int> pos_pairs;
postscriptOverlinePositions( aText, aSize.x, aItalic, aBold, &pos_pairs ); postscriptOverlinePositions( aText, aSize.x, aItalic, aBold, &pos_pairs );
...@@ -786,7 +783,7 @@ void PDF_PLOTTER::Text( const wxPoint& aPos, ...@@ -786,7 +783,7 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
} }
// Plot the stroked text (if requested) // Plot the stroked text (if requested)
if( psTextMode != PSTEXTMODE_NATIVE ) if( m_textMode != PLOTTEXTMODE_NATIVE )
{ {
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 );
......
...@@ -308,6 +308,7 @@ void PS_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil, ...@@ -308,6 +308,7 @@ void PS_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
plotMirror = aMirror; plotMirror = aMirror;
plotOffset = aOffset; plotOffset = aOffset;
plotScale = aScale; plotScale = aScale;
m_IUsPerDecimil = aIusPerDecimil;
iuPerDeviceUnit = 1.0 / aIusPerDecimil; iuPerDeviceUnit = 1.0 / aIusPerDecimil;
/* Compute the paper size in IUs */ /* Compute the paper size in IUs */
paperSize = pageInfo.GetSizeMils(); paperSize = pageInfo.GetSizeMils();
...@@ -818,7 +819,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos, ...@@ -818,7 +819,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
SetColor( aColor ); SetColor( aColor );
// Draw the native postscript text (if requested) // Draw the native postscript text (if requested)
if( psTextMode == PSTEXTMODE_NATIVE ) if( m_textMode == PLOTTEXTMODE_NATIVE )
{ {
const char *fontname = aItalic ? (aBold ? "/KicadFont-BoldOblique" const char *fontname = aItalic ? (aBold ? "/KicadFont-BoldOblique"
: "/KicadFont-Oblique") : "/KicadFont-Oblique")
...@@ -862,7 +863,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos, ...@@ -862,7 +863,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
} }
// Draw the hidden postscript text (if requested) // Draw the hidden postscript text (if requested)
if( psTextMode == PSTEXTMODE_PHANTOM ) if( m_textMode == PLOTTEXTMODE_PHANTOM )
{ {
fputsPostscriptString( outputFile, aText ); fputsPostscriptString( outputFile, aText );
DPOINT pos_dev = userToDeviceCoordinates( aPos ); DPOINT pos_dev = userToDeviceCoordinates( aPos );
...@@ -871,7 +872,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos, ...@@ -871,7 +872,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
} }
// Draw the stroked text (if requested) // Draw the stroked text (if requested)
if( psTextMode != PSTEXTMODE_NATIVE ) if( m_textMode != PLOTTEXTMODE_NATIVE )
{ {
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 );
......
...@@ -16,6 +16,32 @@ ...@@ -16,6 +16,32 @@
#include <drawtxt.h> #include <drawtxt.h>
#include <class_title_block.h> #include <class_title_block.h>
wxString GetDefaultPlotExtension( PlotFormat aFormat )
{
switch( aFormat )
{
case PLOT_FORMAT_DXF:
return DXF_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT_POST:
return PS_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT_PDF:
return PDF_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT_HPGL:
return HPGL_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT_GERBER:
return GERBER_PLOTTER::GetDefaultFileExtension();
default:
wxASSERT( false );
return wxEmptyString;
}
}
/* Plot sheet references /* Plot sheet references
* margin is in mils (1/1000 inch) * margin is in mils (1/1000 inch)
*/ */
......
...@@ -188,7 +188,8 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( ) ...@@ -188,7 +188,8 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
plot_offset.x = 0; plot_offset.x = 0;
plot_offset.y = 0; plot_offset.y = 0;
plotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".dxf" ); plotFileName = schframe->GetUniqueFilenameForCurrentSheet() + '.'
+ DXF_PLOTTER::GetDefaultFileExtension();
PlotOneSheetDXF( plotFileName, screen, plot_offset, 1 ); PlotOneSheetDXF( plotFileName, screen, plot_offset, 1 );
...@@ -229,9 +230,8 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName, ...@@ -229,9 +230,8 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
const PAGE_INFO& pageInfo = screen->GetPageSettings(); const PAGE_INFO& pageInfo = screen->GetPageSettings();
plotter->SetPageSettings( pageInfo ); plotter->SetPageSettings( pageInfo );
plotter->SetViewport( plot_offset, IU_PER_DECIMILS, scale, 0 );
plotter->SetColorMode( m_plotColorOpt ); plotter->SetColorMode( m_plotColorOpt );
plotter->SetViewport( plot_offset, IU_PER_DECIMILS, scale, false );
// Init : // Init :
plotter->SetCreator( wxT( "Eeschema-DXF" ) ); plotter->SetCreator( wxT( "Eeschema-DXF" ) );
......
...@@ -336,7 +336,8 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll ) ...@@ -336,7 +336,8 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll )
plotOffset.x = -s_Offset.x; plotOffset.x = -s_Offset.x;
plotOffset.y = -s_Offset.y; plotOffset.y = -s_Offset.y;
plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT( ".plt" ); plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + '.'
+ HPGL_PLOTTER::GetDefaultFileExtension();
LOCALE_IO toggle; LOCALE_IO toggle;
...@@ -379,9 +380,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName, ...@@ -379,9 +380,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
HPGL_PLOTTER* plotter = new HPGL_PLOTTER(); HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
plotter->SetPageSettings( pageInfo ); plotter->SetPageSettings( pageInfo );
plotter->SetViewport( offset, IU_PER_DECIMILS, plot_scale, false );
plotter->SetViewport( offset, IU_PER_DECIMILS, plot_scale, 0 );
plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness );
// Init : // Init :
plotter->SetCreator( wxT( "Eeschema-HPGL" ) ); plotter->SetCreator( wxT( "Eeschema-HPGL" ) );
......
...@@ -193,8 +193,6 @@ void DIALOG_PLOT_SCHEMATIC_PDF::createPDFFile() ...@@ -193,8 +193,6 @@ void DIALOG_PLOT_SCHEMATIC_PDF::createPDFFile()
plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness ); plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness );
plotter->SetColorMode( m_plotColorOpt ); plotter->SetColorMode( m_plotColorOpt );
plotter->SetCreator( wxT( "Eeschema-PDF" ) ); plotter->SetCreator( wxT( "Eeschema-PDF" ) );
plotter->SetPsTextMode( PSTEXTMODE_PHANTOM );
// First page handling is different // First page handling is different
bool first_page = true; bool first_page = true;
...@@ -220,8 +218,8 @@ void DIALOG_PLOT_SCHEMATIC_PDF::createPDFFile() ...@@ -220,8 +218,8 @@ void DIALOG_PLOT_SCHEMATIC_PDF::createPDFFile()
if( first_page ) { if( first_page ) {
wxString msg; wxString msg;
wxString plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() wxString plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + '.'
+ wxT( ".pdf" ); + PDF_PLOTTER::GetDefaultFileExtension();
msg.Printf( _( "Plot: %s " ), GetChars( plotFileName ) ); msg.Printf( _( "Plot: %s " ), GetChars( plotFileName ) );
m_MsgBox->AppendText( msg ); m_MsgBox->AppendText( msg );
...@@ -291,8 +289,8 @@ void DIALOG_PLOT_SCHEMATIC_PDF::plotSetupPage( PDF_PLOTTER* plotter, ...@@ -291,8 +289,8 @@ void DIALOG_PLOT_SCHEMATIC_PDF::plotSetupPage( PDF_PLOTTER* plotter,
double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils(); double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils(); double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
double scale = MIN( scalex, scaley ); double scale = MIN( scalex, scaley );
plotter->SetViewport( wxPoint( 0, 0 ), IU_PER_DECIMILS, scale, 0 );
plotter->SetPageSettings( plotPage ); plotter->SetPageSettings( plotPage );
plotter->SetViewport( wxPoint( 0, 0 ), IU_PER_DECIMILS, scale, false );
} }
void DIALOG_PLOT_SCHEMATIC_PDF::plotOneSheet( PDF_PLOTTER* plotter, void DIALOG_PLOT_SCHEMATIC_PDF::plotOneSheet( PDF_PLOTTER* plotter,
......
...@@ -242,7 +242,8 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile() ...@@ -242,7 +242,8 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
plot_offset.x = 0; plot_offset.x = 0;
plot_offset.y = 0; plot_offset.y = 0;
plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT( ".ps" ); plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + '.'
+ PS_PLOTTER::GetDefaultFileExtension();
plotOneSheetPS( plotFileName, screen, plotPage, plot_offset, scale ); plotOneSheetPS( plotFileName, screen, plotPage, plot_offset, scale );
...@@ -281,10 +282,9 @@ void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName, ...@@ -281,10 +282,9 @@ void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
PS_PLOTTER* plotter = new PS_PLOTTER(); PS_PLOTTER* plotter = new PS_PLOTTER();
plotter->SetPageSettings( pageInfo ); plotter->SetPageSettings( pageInfo );
plotter->SetViewport( plot_offset, IU_PER_DECIMILS, scale, 0 );
plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness ); plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness );
plotter->SetColorMode( m_plotColorOpt ); plotter->SetColorMode( m_plotColorOpt );
plotter->SetPsTextMode( PSTEXTMODE_STROKE ); plotter->SetViewport( plot_offset, IU_PER_DECIMILS, scale, false );
// Init : // Init :
plotter->SetCreator( wxT( "Eeschema-PS" ) ); plotter->SetCreator( wxT( "Eeschema-PS" ) );
......
This diff is collapsed.
...@@ -55,7 +55,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, ...@@ -55,7 +55,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
case PLOT_FORMAT_GERBER: case PLOT_FORMAT_GERBER:
offset = auxoffset; offset = auxoffset;
plotter = new GERBER_PLOTTER(); plotter = new GERBER_PLOTTER();
plotter->SetViewport( offset, IU_PER_DECIMILS, scale, 0 ); plotter->SetViewport( offset, IU_PER_DECIMILS, scale, false );
break; break;
case PLOT_FORMAT_HPGL: // Scale for HPGL format. case PLOT_FORMAT_HPGL: // Scale for HPGL format.
...@@ -66,7 +66,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, ...@@ -66,7 +66,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
hpgl_plotter->SetPenSpeed( plot_opts.m_HPGLPenSpeed ); hpgl_plotter->SetPenSpeed( plot_opts.m_HPGLPenSpeed );
hpgl_plotter->SetPenOverlap( 0 ); hpgl_plotter->SetPenOverlap( 0 );
plotter->SetPageSettings( aSheet ); plotter->SetPageSettings( aSheet );
plotter->SetViewport( offset, IU_PER_DECIMILS, scale, 0 ); plotter->SetViewport( offset, IU_PER_DECIMILS, scale, false );
} }
break; break;
...@@ -100,7 +100,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, ...@@ -100,7 +100,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
PS_PLOTTER* ps_plotter = new PS_PLOTTER; PS_PLOTTER* ps_plotter = new PS_PLOTTER;
plotter = ps_plotter; plotter = ps_plotter;
ps_plotter->SetPageSettings( pageA4 ); ps_plotter->SetPageSettings( pageA4 );
plotter->SetViewport( offset, IU_PER_DECIMILS, scale, 0 ); plotter->SetViewport( offset, IU_PER_DECIMILS, scale, false );
} }
break; break;
...@@ -109,7 +109,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, ...@@ -109,7 +109,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER; DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER;
plotter = dxf_plotter; plotter = dxf_plotter;
plotter->SetPageSettings( aSheet ); plotter->SetPageSettings( aSheet );
plotter->SetViewport( offset, IU_PER_DECIMILS, scale, 0 ); plotter->SetViewport( offset, IU_PER_DECIMILS, scale, false );
} }
break; break;
......
...@@ -607,22 +607,22 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName, ...@@ -607,22 +607,22 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName,
switch( format ) switch( format )
{ {
case PLOT_FORMAT_HPGL: case PLOT_FORMAT_HPGL:
ext = wxT( "plt" ); ext = HPGL_PLOTTER::GetDefaultFileExtension();
wildcard = _( "HPGL plot files (.plt)|*.plt" ); wildcard = _( "HPGL plot files (.plt)|*.plt" );
break; break;
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
ext = wxT( "ps" ); ext = PS_PLOTTER::GetDefaultFileExtension();
wildcard = _( "PostScript files (.ps)|*.ps" ); wildcard = _( "PostScript files (.ps)|*.ps" );
break; break;
case PLOT_FORMAT_GERBER: case PLOT_FORMAT_GERBER:
ext = wxT( "pho" ); ext = GERBER_PLOTTER::GetDefaultFileExtension();
wildcard = _( "Gerber files (.pho)|*.pho" ); wildcard = _( "Gerber files (.pho)|*.pho" );
break; break;
case PLOT_FORMAT_DXF: case PLOT_FORMAT_DXF:
ext = wxT( "dxf" ); ext = DXF_PLOTTER::GetDefaultFileExtension();
wildcard = _( "DXF files (.dxf)|*.dxf" ); wildcard = _( "DXF files (.dxf)|*.dxf" );
break; break;
......
...@@ -373,7 +373,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_ ...@@ -373,7 +373,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_
aPcbPlotParams->subtractMaskFromSilk = ParseBool(); aPcbPlotParams->subtractMaskFromSilk = ParseBool();
break; break;
case T_outputformat: case T_outputformat:
aPcbPlotParams->m_PlotFormat = ParseInt( 0, 3 ); aPcbPlotParams->m_PlotFormat = static_cast<PlotFormat>(ParseInt( 0, 3 ));
break; break;
case T_mirror: case T_mirror:
aPcbPlotParams->m_PlotMirror = ParseBool(); aPcbPlotParams->m_PlotMirror = ParseBool();
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <wx/wx.h> #include <wx/wx.h>
#include <pcb_plot_params_lexer.h> #include <pcb_plot_params_lexer.h>
#include <eda_text.h> // EDA_DRAW_MODE_T #include <eda_text.h> // EDA_DRAW_MODE_T
#include <plot_common.h>
class PCB_PLOT_PARAMS_PARSER; class PCB_PLOT_PARAMS_PARSER;
class LINE_READER; class LINE_READER;
...@@ -64,7 +65,7 @@ public: ...@@ -64,7 +65,7 @@ public:
bool m_PlotInvisibleTexts; bool m_PlotInvisibleTexts;
bool m_PlotPadsOnSilkLayer; ///< allows pads outlines on silkscreen layer (when pads are also o, silk screen bool m_PlotPadsOnSilkLayer; ///< allows pads outlines on silkscreen layer (when pads are also o, silk screen
int m_PlotFormat; ///< id for plot format (see enum PlotFormat in plot_common.h) */ PlotFormat m_PlotFormat; ///< id for plot format
bool m_PlotMirror; bool m_PlotMirror;
enum DrillShapeOptT { enum DrillShapeOptT {
...@@ -107,8 +108,8 @@ public: ...@@ -107,8 +108,8 @@ public:
bool operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const; bool operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
bool operator!=( const PCB_PLOT_PARAMS &aPcbPlotParams ) const; bool operator!=( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
void SetPlotFormat( int aFormat ) { m_PlotFormat = aFormat; }; void SetPlotFormat( PlotFormat aFormat ) { m_PlotFormat = aFormat; };
int GetPlotFormat() const { return m_PlotFormat; }; PlotFormat GetPlotFormat() const { return m_PlotFormat; };
void SetOutputDirectory( wxString aDir ) { outputDirectory = aDir; }; void SetOutputDirectory( wxString aDir ) { outputDirectory = aDir; };
wxString GetOutputDirectory() const { return outputDirectory; }; wxString GetOutputDirectory() const { return outputDirectory; };
void SetUseGerberExtensions( bool aUse ) { useGerberExtensions = aUse; }; void SetUseGerberExtensions( bool aUse ) { useGerberExtensions = aUse; };
......
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
#define MIN_SCALE 0.01 #define MIN_SCALE 0.01
#define MAX_SCALE 100.0 #define MAX_SCALE 100.0
static bool setDouble( double* aDouble, double aValue, double aMin, double aMax ) static bool setDouble( double* aDouble, double aValue, double aMin, double aMax )
{ {
if( aValue < aMin ) if( aValue < aMin )
...@@ -111,8 +110,6 @@ private: ...@@ -111,8 +110,6 @@ private:
}; };
//const int UNITS_MILS = 1000;
DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) : DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
DIALOG_PLOT_BASE( aParent ), DIALOG_PLOT_BASE( aParent ),
m_parent( aParent ), m_parent( aParent ),
...@@ -567,7 +564,7 @@ void DIALOG_PLOT::applyPlotSettings() ...@@ -567,7 +564,7 @@ void DIALOG_PLOT::applyPlotSettings()
tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() ); tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() );
tempOptions.SetPlotFormat( m_plotFormatOpt->GetSelection() ); tempOptions.SetPlotFormat( static_cast<PlotFormat>(m_plotFormatOpt->GetSelection()) );
long selectedLayers = 0; long selectedLayers = 0;
unsigned int i; unsigned int i;
...@@ -601,7 +598,6 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -601,7 +598,6 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
{ {
int layer; int layer;
wxFileName fn; wxFileName fn;
wxString ext;
applyPlotSettings(); applyPlotSettings();
...@@ -676,25 +672,16 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -676,25 +672,16 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
switch( m_plotOpts.GetPlotFormat() ) switch( m_plotOpts.GetPlotFormat() )
{ {
case PLOT_FORMAT_POST:
ext = wxT( "ps" );
break;
case PLOT_FORMAT_GERBER: case PLOT_FORMAT_GERBER:
m_plotOpts.m_PlotScale = 1.0; // No scale option allowed in gerber format
ext = wxT( "pho" );
break;
case PLOT_FORMAT_HPGL:
ext = wxT( "plt" );
break;
case PLOT_FORMAT_DXF: case PLOT_FORMAT_DXF:
m_plotOpts.m_PlotScale = 1.0; m_plotOpts.m_PlotScale = 1.0; // No scaling for these
ext = wxT( "dxf" ); break;
default:
break; break;
} }
wxString file_ext( GetDefaultPlotExtension( m_plotOpts.GetPlotFormat() ) );
// Test for a reasonable scale value // Test for a reasonable scale value
if( m_plotOpts.m_PlotScale < MIN_SCALE ) if( m_plotOpts.m_PlotScale < MIN_SCALE )
DisplayInfoMessage( this, DisplayInfoMessage( this,
...@@ -704,6 +691,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -704,6 +691,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
DisplayInfoMessage( this, DisplayInfoMessage( this,
_( "Warning: Scale option set to a very large value" ) ); _( "Warning: Scale option set to a very large value" ) );
// Save the current plot options in the board
m_parent->SetPlotSettings( m_plotOpts ); m_parent->SetPlotSettings( m_plotOpts );
long layerMask = 1; long layerMask = 1;
...@@ -803,7 +791,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -803,7 +791,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
} }
else else
{ {
fn.SetExt( ext ); fn.SetExt( file_ext );
} }
switch( m_plotOpts.GetPlotFormat() ) switch( m_plotOpts.GetPlotFormat() )
......
...@@ -116,7 +116,6 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int ...@@ -116,7 +116,6 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
plotter->SetDefaultLineWidth( plotOpts.m_PlotLineWidth ); plotter->SetDefaultLineWidth( plotOpts.m_PlotLineWidth );
plotter->SetCreator( wxT( "PCBNEW-PS" ) ); plotter->SetCreator( wxT( "PCBNEW-PS" ) );
plotter->SetFilename( aFullFileName ); plotter->SetFilename( aFullFileName );
plotter->SetPsTextMode( PSTEXTMODE_PHANTOM );
plotter->StartPlot( output_file ); plotter->StartPlot( output_file );
/* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */ /* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */
......
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