Commit a9744e3f authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: added: SVG plotter. Need refinements, but works.

Mainly to plot drill maps, but can be used to plot boards, for documentation.
The print svg still exists, but the plot SVG has more options (mirroring, holes in pads),
however  print svg allows color print, and full board printing, and plot does not.
parent a2b9241e
...@@ -46,6 +46,7 @@ set(COMMON_SRCS ...@@ -46,6 +46,7 @@ set(COMMON_SRCS
common_plotPDF_functions.cpp common_plotPDF_functions.cpp
common_plotGERBER_functions.cpp common_plotGERBER_functions.cpp
common_plotDXF_functions.cpp common_plotDXF_functions.cpp
common_plotSVG_functions.cpp
confirm.cpp confirm.cpp
copy_to_clipboard.cpp copy_to_clipboard.cpp
dcsvg.cpp dcsvg.cpp
......
...@@ -260,7 +260,7 @@ void BITMAP_BASE::PlotImage( PLOTTER* aPlotter, ...@@ -260,7 +260,7 @@ void BITMAP_BASE::PlotImage( PLOTTER* aPlotter,
return; return;
// These 2 lines are useful only fot plotters that cannot plot a bitmap // These 2 lines are useful only fot plotters that cannot plot a bitmap
// and plot arectangle instead of. // and plot a rectangle instead of.
aPlotter->SetColor( aDefaultColor ); aPlotter->SetColor( aDefaultColor );
aPlotter->SetCurrentLineWidth( aDefaultPensize ); aPlotter->SetCurrentLineWidth( aDefaultPensize );
......
...@@ -31,7 +31,7 @@ PLOTTER::PLOTTER( ) ...@@ -31,7 +31,7 @@ PLOTTER::PLOTTER( )
defaultPenWidth = 0; defaultPenWidth = 0;
currentPenWidth = -1; // To-be-set marker currentPenWidth = -1; // To-be-set marker
penState = 'Z'; // End-of-path idle penState = 'Z'; // End-of-path idle
plotMirror = 0; // Mirror flag plotMirror = false; // Mirror flag
outputFile = 0; outputFile = 0;
colorMode = false; // Starts as a BW plot colorMode = false; // Starts as a BW plot
negativeMode = false; negativeMode = false;
......
/**
* @file common_plotPS_functions.cpp
* @brief Kicad: Common plot SVG functions
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* Some info on basic items SVG format, used here:
* The root element of all SVG files is the <svg> element.
*
* The <g> element is used to group SVG shapes together.
* Once grouped you can transform the whole group of shapes as if it was a single shape.
* This is an advantage compared to a nested <svg> element
* which cannot be the target of transformation by itself.
*
* The <rect> element represents a rectangle.
* Using this element you can draw rectangles of various width, height,
* with different stroke (outline) and fill colors, with sharp or rounded corners etc.
*
* <svg xmlns="http://www.w3.org/2000/svg"
* xmlns:xlink="http://www.w3.org/1999/xlink">
*
* <rect x="10" y="10" height="100" width="100"
* style="stroke:#006600; fill: #00cc00"/>
*
* </svg>
*
* The <circle> element is used to draw circles.
* <circle cx="40" cy="40" r="24" style="stroke:#006600; fill:#00cc00"/>
*
* The <ellipse> element is used to draw ellipses.
* An ellipse is a circle that does not have equal height and width.
* Its radius in the x and y directions are different, in other words.
* <ellipse cx="40" cy="40" rx="30" ry="15"
* style="stroke:#006600; fill:#00cc00"/>
*
* The <line> element is used to draw lines.
*
* <line x1="0" y1="10" x2="0" y2="100" style="stroke:#006600;"/>
* <line x1="10" y1="10" x2="100" y2="100" style="stroke:#006600;"/>
*
* The <polyline> element is used to draw multiple connected lines
* Here is a simple example:
*
* <polyline points="0,0 30,0 15,30" style="stroke:#006600;"/>
*
* The <polygon> element is used to draw with multiple (3 or more) sides / edges.
* Here is a simple example:
*
* <polygon points="0,0 50,0 25,50" style="stroke:#660000; fill:#cc3333;"/>
*
* The <path> element is used to draw advanced shapes combined from lines and archs,
* with or without fill.
* It is probably the most advanced and versatile SVG shape of them all.
* It is probably also the hardest element to master.
* <path d="M50,50
* A30,30 0 0,1 35,20
* L100,100
* M110,110
* L100,0"
* style="stroke:#660000; fill:none;"/>
*/
#include <fctsys.h>
#include <trigo.h>
#include <wxstruct.h>
#include <base_struct.h>
#include <common.h>
#include <plot_common.h>
#include <macros.h>
#include <kicad_string.h>
SVG_PLOTTER::SVG_PLOTTER()
{
m_graphics_changed = true;
SetTextMode( PLOTTEXTMODE_STROKE );
m_fillMode = NO_FILL; // or FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR
m_pen_rgb_color = 0; // current color value (black)
m_brush_rgb_color = 0; // current color value (black)
}
void SVG_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
wxASSERT( !outputFile );
plotMirror = not aMirror; // unlike other plotters, SVG has Y axis reversed
plotOffset = aOffset;
plotScale = aScale;
m_IUsPerDecimil = aIusPerDecimil;
iuPerDeviceUnit = 1.0 / aIusPerDecimil;
/* Compute the paper size in IUs */
paperSize = pageInfo.GetSizeMils();
paperSize.x *= 10.0 * aIusPerDecimil;
paperSize.y *= 10.0 * aIusPerDecimil;
SetDefaultLineWidth( 100 * aIusPerDecimil ); // arbitrary default
}
void SVG_PLOTTER::SetColor( EDA_COLOR_T color )
{
PSLIKE_PLOTTER::SetColor( color );
}
void SVG_PLOTTER::setFillMode( FILL_T fill )
{
if( m_fillMode != fill )
{
m_graphics_changed = true;
m_fillMode = fill;
}
}
void SVG_PLOTTER::setSVGPlotStyle()
{
fputs( "</g>\n<g style=\"", outputFile );
fputs( "fill:#", outputFile );
// output the background fill color
fprintf( outputFile, "%6.6lX; ", m_brush_rgb_color );
switch( m_fillMode )
{
case NO_FILL:
fputs( "fill-opacity:0.0;\n", outputFile );
break;
case FILLED_SHAPE:
fputs( "fill-opacity:1.0;\n", outputFile );
break;
case FILLED_WITH_BG_BODYCOLOR:
fputs( "fill-opacity:0.3;\n", outputFile );
break;
}
// output the pen color (RVB values in hex) and opacity
double pen_opacity = 1.0; // 0.0 (transparent to 1.0 (solid)
fprintf( outputFile, " stroke:#%6.6lX; stroke-opacity:%g;\n",
m_pen_rgb_color, pen_opacity );
// output the pen cap
int pen_cap = 0; // round, square, butt (currenly not used)
switch( pen_cap )
{
case 1:
fputs( "stroke-linecap:square; ", outputFile );
break;
case 2:
fputs( "stroke-linecap:butt; ", outputFile );
break;
case 0:
default:
fputs( "stroke-linecap:round; ", outputFile );
}
fputs( "stroke-linejoin:round; ", outputFile );
int pen_w = (int) userToDeviceSize( GetCurrentLineWidth() );
fprintf( outputFile,
"stroke-width:%d\" \n transform=\"translate(%.2g %.2g) scale(%.2g %.2g)\">\n",
pen_w,
userToDeviceSize( plotOffset.x ), userToDeviceSize( plotOffset.y ),
plotScale, plotScale );
m_graphics_changed = false;
}
/* Set the current line width (in IUs) for the next plot
*/
void SVG_PLOTTER::SetCurrentLineWidth( int width )
{
int pen_width;
if( width >= 0 )
pen_width = width;
else
pen_width = defaultPenWidth;
if( pen_width != currentPenWidth )
{
m_graphics_changed = true;
currentPenWidth = pen_width;
}
if( m_graphics_changed )
setSVGPlotStyle();
}
/* initialize m_red, m_green, m_blue ( 0 ... 255)
* from reduced values r, g ,b ( 0.0 to 1.0 )
*/
void SVG_PLOTTER::emitSetRGBColor( double r, double g, double b )
{
int red = (int) ( 255.0 * r );
int green = (int) ( 255.0 * g );
int blue = (int) ( 255.0 * b );
long rgb_color = (red << 16) | (green << 8) | blue;
if( m_pen_rgb_color != rgb_color )
{
m_graphics_changed = true;
m_pen_rgb_color = rgb_color;
// Currently, use the same color for brush and pen
// (i.e. to draw and fill a contour)
m_brush_rgb_color = rgb_color;
}
}
/**
* SVG supports dashed lines
*/
void SVG_PLOTTER::SetDash( bool dashed )
{
}
void SVG_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width )
{
DPOINT p1_dev = userToDeviceCoordinates( p1 );
DPOINT p2_dev = userToDeviceCoordinates( p2 );
setFillMode( fill );
SetCurrentLineWidth( width );
fprintf( outputFile,
"<rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" rx=\"%d\" />\n",
(int) p1_dev.x, (int) p1_dev.y, // origin
(int) (p2_dev.x - p1_dev.x), (int) (p2_dev.y - p1_dev.y), // size
0 // radius of rounded corners
);
}
void SVG_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int width )
{
DPOINT pos_dev = userToDeviceCoordinates( pos );
double radius = userToDeviceSize( diametre / 2.0 );
setFillMode( fill );
SetCurrentLineWidth( width );
fprintf( outputFile,
"<circle cx=\"%g\" cy=\"%g\" r=\"%g\" /> \n",
pos_dev.x, pos_dev.y, radius );
}
void SVG_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius,
FILL_T fill, int width )
{
/* Draws an arc of a circle, centred on (xc,yc), with starting point
* (x1, y1) and ending at (x2, y2). The current pen is used for the outline
* and the current brush for filling the shape.
*
* The arc is drawn in an anticlockwise direction from the start point to
* the end point
*/
if( radius <= 0 )
return;
if( StAngle > EndAngle )
EXCHG( StAngle, EndAngle );
setFillMode( fill );
SetCurrentLineWidth( width );
// Calculate start point.
DPOINT centre_dev = userToDeviceCoordinates( centre );
double radius_dev = userToDeviceSize( radius );
if( plotMirror )
{
int tmp = StAngle;
StAngle = -EndAngle;
EndAngle = -tmp;
}
DPOINT start = centre_dev;
start.x += radius_dev;
DPOINT end = start;
RotatePoint( &start.x, &start.y, StAngle );
RotatePoint( &end.x, &end.y, EndAngle );
double theta1 = StAngle * M_PI / 1800.0;
if( theta1 < 0 )
theta1 = theta1 + M_PI * 2;
double theta2 = EndAngle * M_PI / 1800.0;
if( theta2 < 0 )
theta2 = theta2 + M_PI * 2;
if( theta2 < theta1 )
theta2 = theta2 + M_PI * 2;
int flg_arc = 0; // flag for large or small arc. 0 means less than 180 degrees
if( fabs( theta2 - theta1 ) > M_PI )
flg_arc = 1;
int flg_sweep = 0; // flag for sweep always 0
// Draw a single arc: an arc is one of 3 curve commands (2 other are 2 bezier curves)
// params are start point, radius1, radius2, X axe rotation,
// flag arc size (0 = small arc > 180 deg, 1 = large arc > 180 deg),
// sweep arc ( 0 = CCW, 1 = CW),
// end point,
// center point (optional, needed to draw a pie
fprintf( outputFile, "<path d=\"M%d %d A%d %d 0.0 %d %d %d %d \" /> \n",
(int) start.x, (int) start.y,
(int) radius_dev, (int) radius_dev,
flg_arc, flg_sweep,
(int) end.x, (int) end.y );
}
void SVG_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
FILL_T aFill, int aWidth )
{
if( aCornerList.size() <= 1 )
return;
setFillMode( aFill );
SetCurrentLineWidth( aWidth );
fprintf( outputFile, "<polygon style=\"fill-rule:evenodd;\"\n" );
DPOINT pos = userToDeviceCoordinates( aCornerList[0] );
fprintf( outputFile, "points=\"%d,%d\n", (int) pos.x, (int) pos.y );
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
{
pos = userToDeviceCoordinates( aCornerList[ii] );
fprintf( outputFile, "%d,%d\n", (int) pos.x, (int) pos.y );
}
// Close/(fill) the path
fprintf( outputFile, "\" /> \n" );
}
/**
* Postscript-likes at the moment are the only plot engines supporting bitmaps...
*/
void SVG_PLOTTER::PlotImage( const wxImage& aImage, const wxPoint& aPos,
double aScaleFactor )
{
// in svg file we must insert a link to a png image file to plot an image
// the image itself is not included in the svg file.
// So we prefer skip the image, and just draw a rectangle,
// like othe plotter which do not support images
PLOTTER::PlotImage( aImage, aPos, aScaleFactor );
}
void SVG_PLOTTER::PenTo( const wxPoint& pos, char plume )
{
if( plume == 'Z' )
{
if( penState != 'Z' )
{
fputs( "\" />\n", outputFile );
penState = 'Z';
penLastpos.x = -1;
penLastpos.y = -1;
}
return;
}
if( penState == 'Z' ) // here plume = 'D' or 'U'
{
DPOINT pos_dev = userToDeviceCoordinates( pos );
fprintf( outputFile, "<path d=\"M%d %d\n",
(int) pos_dev.x, (int) pos_dev.y );
}
else if( penState != plume || pos != penLastpos )
{
DPOINT pos_dev = userToDeviceCoordinates( pos );
fprintf( outputFile, "L%d %d\n",
(int) pos_dev.x, (int) pos_dev.y );
}
penState = plume;
penLastpos = pos;
}
/**
* The code within this function
* creates SVG files header
*/
bool SVG_PLOTTER::StartPlot( FILE* fout )
{
wxASSERT( !outputFile );
wxString msg;
outputFile = fout;
static const char* header[] =
{
"<?xml version=\"1.0\" standalone=\"no\"?>\n",
" <!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"> \n",
"<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" \n",
NULL
};
// Write header.
for( int ii = 0; header[ii] != NULL; ii++ )
{
fputs( header[ii], outputFile );
}
// Write viewport pos and size
wxPoint origin; // TODO set to actual value
fprintf( outputFile,
" width=\"%gcm\" height=\"%gcm\" 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 / m_IUsPerDecimil ),
(int) ( paperSize.y / m_IUsPerDecimil) );
// Write title
char date_buf[250];
time_t ltime = time( NULL );
strftime( date_buf, 250, "%Y/%m/%d %H:%M:%S",
localtime( &ltime ) );
fprintf( outputFile,
"<title>SVG Picture created as %s date %s </title>\n",
TO_UTF8( wxFileName( filename ).GetFullName() ), date_buf );
// End of header
fprintf( outputFile, " <desc>Picture generated by %s </desc>\n",
TO_UTF8( creator ) );
fputs( "<g style=\"fill:black; stroke:black; stroke-width:1\">\n",
outputFile );
setSVGPlotStyle();
return true;
}
bool SVG_PLOTTER::EndPlot()
{
fputs( "</g> \n</svg>\n", outputFile );
fclose( outputFile );
outputFile = NULL;
return true;
}
void SVG_PLOTTER::Text( const wxPoint& aPos,
enum EDA_COLOR_T aColor,
const wxString& aText,
int aOrient,
const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
int aWidth,
bool aItalic,
bool aBold )
{
setFillMode( NO_FILL );
SetColor( aColor );
SetCurrentLineWidth( aWidth );
// TODO: see if the postscript native text code can be used in SVG plotter
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
aWidth, aItalic, aBold );
}
...@@ -36,6 +36,9 @@ wxString GetDefaultPlotExtension( PlotFormat aFormat ) ...@@ -36,6 +36,9 @@ wxString GetDefaultPlotExtension( PlotFormat aFormat )
case PLOT_FORMAT_GERBER: case PLOT_FORMAT_GERBER:
return GERBER_PLOTTER::GetDefaultFileExtension(); return GERBER_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT_SVG:
return SVG_PLOTTER::GetDefaultFileExtension();
default: default:
wxASSERT( false ); wxASSERT( false );
return wxEmptyString; return wxEmptyString;
......
...@@ -129,7 +129,7 @@ void DIALOG_PLOT_SCHEMATIC_PDF::OnPlotCurrent( wxCommandEvent& event ) ...@@ -129,7 +129,7 @@ void DIALOG_PLOT_SCHEMATIC_PDF::OnPlotCurrent( wxCommandEvent& event )
initOptVars(); initOptVars();
createPDFFile(); createPDFFile();
m_MsgBox->AppendText( wxT( "*****\n" ) ); m_MsgBox->AppendText( wxT( "*\n" ) );
} }
...@@ -143,7 +143,7 @@ void DIALOG_PLOT_SCHEMATIC_PDF::OnPlotAll( wxCommandEvent& event ) ...@@ -143,7 +143,7 @@ void DIALOG_PLOT_SCHEMATIC_PDF::OnPlotAll( wxCommandEvent& event )
initOptVars(); initOptVars();
createPDFFile(); createPDFFile();
m_MsgBox->AppendText( wxT( "*****\n" ) ); m_MsgBox->AppendText( wxT( "*\n" ) );
} }
......
...@@ -20,11 +20,14 @@ ...@@ -20,11 +20,14 @@
* of the radio buttons in the plot panel/windows. * of the radio buttons in the plot panel/windows.
*/ */
enum PlotFormat { enum PlotFormat {
PLOT_FORMAT_HPGL, PLOT_FIRST_FORMAT = 0,
PLOT_FORMAT_HPGL = PLOT_FIRST_FORMAT,
PLOT_FORMAT_GERBER, PLOT_FORMAT_GERBER,
PLOT_FORMAT_POST, PLOT_FORMAT_POST,
PLOT_FORMAT_DXF, PLOT_FORMAT_DXF,
PLOT_FORMAT_PDF PLOT_FORMAT_PDF,
PLOT_FORMAT_SVG,
PLOT_LAST_FORMAT = PLOT_FORMAT_SVG
}; };
/** /**
...@@ -336,7 +339,8 @@ protected: ...@@ -336,7 +339,8 @@ protected:
FILE* outputFile; FILE* outputFile;
// Pen handling // Pen handling
bool colorMode, negativeMode; bool colorMode; /// true to plot in color, false to plot in black and white
bool negativeMode; /// true to generate a negative image (PS mode mainly)
int defaultPenWidth; int defaultPenWidth;
int currentPenWidth; int currentPenWidth;
/// Current pen state: 'U', 'D' or 'Z' (see PenTo) /// Current pen state: 'U', 'D' or 'Z' (see PenTo)
...@@ -672,6 +676,87 @@ protected: ...@@ -672,6 +676,87 @@ protected:
std::vector<long> xrefTable; /// The PDF xref offset table std::vector<long> xrefTable; /// The PDF xref offset table
}; };
class SVG_PLOTTER : public PSLIKE_PLOTTER
{
public:
SVG_PLOTTER();
static wxString GetDefaultFileExtension()
{
return wxString( wxT( "svg" ) );
}
virtual PlotFormat GetPlotterType() const
{
return PLOT_FORMAT_SVG;
}
virtual void SetColor( EDA_COLOR_T color );
virtual bool StartPlot( FILE* fout );
virtual bool EndPlot();
virtual void SetCurrentLineWidth( int width );
virtual void SetDash( bool dashed );
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror );
virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
int width = DEFAULT_LINE_WIDTH );
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
int width = DEFAULT_LINE_WIDTH );
virtual void Arc( const wxPoint& centre, int StAngle, int EndAngle,
int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH );
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth = DEFAULT_LINE_WIDTH );
virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
double aScaleFactor );
virtual void PenTo( const wxPoint& pos, char plume );
virtual void Text( const wxPoint& aPos,
enum EDA_COLOR_T aColor,
const wxString& aText,
int aOrient,
const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
int aWidth,
bool aItalic,
bool aBold );
protected:
FILL_T m_fillMode; // true if the current contour
// rect, arc, circle, polygon must be filled
long m_pen_rgb_color; // current rgb color value: each color has
// a value 0 ... 255, and the 3 colors are
// grouped in a 3x8 bits value
// (written in hex to svg files)
long m_brush_rgb_color; // same as m_pen_rgb_color, used to fill
// some contours.
bool m_graphics_changed; // true if a pen/brush parameter is modified
// color, pen size, fil mode ...
// the new SVG stype must be output on file
/**
* function emitSetRGBColor()
* initialize m_pen_rgb_color from reduced values r, g ,b
* ( reduced values are 0.0 to 1.0 )
*/
virtual void emitSetRGBColor( double r, double g, double b );
/**
* function setSVGPlotStyle()
* output the string which define pen and brush color, shape, transparence
*/
void setSVGPlotStyle();
/**
* function setFillMode()
* prepare parameters for setSVGPlotStyle()
*/
void setFillMode( FILL_T fill );
};
/* Class to handle a D_CODE when plotting a board : */ /* Class to handle a D_CODE when plotting a board : */
#define FIRST_DCODE_VALUE 10 // D_CODE < 10 is a command, D_CODE >= 10 is a tool #define FIRST_DCODE_VALUE 10 // D_CODE < 10 is a command, D_CODE >= 10 is a tool
......
...@@ -83,6 +83,7 @@ set(PCBNEW_DIALOGS ...@@ -83,6 +83,7 @@ set(PCBNEW_DIALOGS
dialogs/dialog_pcbnew_config_libs_and_paths.cpp dialogs/dialog_pcbnew_config_libs_and_paths.cpp
dialogs/dialog_pcbnew_config_libs_and_paths_fbp.cpp dialogs/dialog_pcbnew_config_libs_and_paths_fbp.cpp
dialogs/dialog_plot_base.cpp dialogs/dialog_plot_base.cpp
dialogs/dialog_plot.cpp
dialogs/dialog_print_for_modedit.cpp dialogs/dialog_print_for_modedit.cpp
dialogs/dialog_print_for_modedit_base.cpp dialogs/dialog_print_for_modedit_base.cpp
dialogs/dialog_print_using_printer.cpp dialogs/dialog_print_using_printer.cpp
......
...@@ -215,7 +215,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll ) ...@@ -215,7 +215,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll )
fn.SetName( fn.GetName() + wxT( "-brd" ) ); fn.SetName( fn.GetName() + wxT( "-brd" ) );
else else
{ {
wxString extraname = m_BoxSelectLayer[layer]->GetLabel(); wxString extraname = m_Parent->GetBoard()->GetLayerName( layer, false );
extraname.Trim(); // remove leading and trailing spaces if any extraname.Trim(); // remove leading and trailing spaces if any
extraname.Trim(false); extraname.Trim(false);
fn.SetName( fn.GetName() + wxT( "-" ) + extraname ); fn.SetName( fn.GetName() + wxT( "-" ) + extraname );
......
...@@ -112,7 +112,6 @@ void DIALOG_GENDRILL::initDialog() ...@@ -112,7 +112,6 @@ void DIALOG_GENDRILL::initDialog()
void DIALOG_GENDRILL::InitDisplayParams() void DIALOG_GENDRILL::InitDisplayParams()
{ {
wxString msg; wxString msg;
const PCB_PLOT_PARAMS& plot_opts = m_board->GetPlotOptions();
m_Choice_Unit->SetSelection( m_UnitDrillIsInch ? 1 : 0 ); m_Choice_Unit->SetSelection( m_UnitDrillIsInch ? 1 : 0 );
m_Choice_Precision->SetSelection( m_PrecisionFormat ); m_Choice_Precision->SetSelection( m_PrecisionFormat );
...@@ -137,14 +136,6 @@ void DIALOG_GENDRILL::InitDisplayParams() ...@@ -137,14 +136,6 @@ void DIALOG_GENDRILL::InitDisplayParams()
m_MicroViaDrillValue->SetLabel( _( "Use Netclasses values" ) ); m_MicroViaDrillValue->SetLabel( _( "Use Netclasses values" ) );
msg.Empty();
msg << plot_opts.GetHPGLPenNum();
m_PenNum->SetValue( msg );
msg.Empty();
msg << plot_opts.GetHPGLPenSpeed();
m_PenSpeed->SetValue( msg );
// See if we have some buried vias or/and microvias, and display // See if we have some buried vias or/and microvias, and display
// microvias drill value if so // microvias drill value if so
m_throughViasCount = 0; m_throughViasCount = 0;
...@@ -289,7 +280,6 @@ void DIALOG_GENDRILL::UpdatePrecisionOptions() ...@@ -289,7 +280,6 @@ void DIALOG_GENDRILL::UpdatePrecisionOptions()
void DIALOG_GENDRILL::SetParams() void DIALOG_GENDRILL::SetParams()
{ {
wxString msg; wxString msg;
long ltmp;
PCB_PLOT_PARAMS plot_opts = m_board->GetPlotOptions(); PCB_PLOT_PARAMS plot_opts = m_board->GetPlotOptions();
...@@ -305,15 +295,7 @@ void DIALOG_GENDRILL::SetParams() ...@@ -305,15 +295,7 @@ void DIALOG_GENDRILL::SetParams()
m_DrillOriginIsAuxAxis = m_Choice_Drill_Offset->GetSelection(); m_DrillOriginIsAuxAxis = m_Choice_Drill_Offset->GetSelection();
m_PrecisionFormat = m_Choice_Precision->GetSelection(); m_PrecisionFormat = m_Choice_Precision->GetSelection();
msg = m_PenSpeed->GetValue(); plot_opts.SetHPGLPenNum( 1 );
if( msg.ToLong( &ltmp ) )
plot_opts.SetHPGLPenSpeed( ltmp );
msg = m_PenNum->GetValue();
if( msg.ToLong( &ltmp ) )
plot_opts.SetHPGLPenNum( ltmp );
if( m_Choice_Drill_Offset->GetSelection() == 0 ) if( m_Choice_Drill_Offset->GetSelection() == 0 )
m_FileDrillOffset = wxPoint( 0, 0 ); m_FileDrillOffset = wxPoint( 0, 0 );
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 19 2012) // 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!
...@@ -55,7 +55,7 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con ...@@ -55,7 +55,7 @@ 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[] = { _("None"), _("Drill map (HPGL)"), _("Drill map (PostScript)"), _("Drill map (Gerber)"), _("Drill map (DXF)") }; wxString m_Choice_Drill_MapChoices[] = { _("None"), _("Drill map (HPGL)"), _("Drill map (PostScript)"), _("Drill map (Gerber)"), _("Drill map (DXF)"), _("Drill map (SVG)") };
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 Sheet:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_MapNChoices, m_Choice_Drill_MapChoices, 1, wxRA_SPECIFY_COLS ); m_Choice_Drill_Map = new wxRadioBox( this, wxID_ANY, _("Drill Sheet:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_MapNChoices, m_Choice_Drill_MapChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Drill_Map->SetSelection( 0 ); m_Choice_Drill_Map->SetSelection( 0 );
...@@ -71,26 +71,6 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con ...@@ -71,26 +71,6 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
bMiddleBoxSizer->Add( m_Choice_Drill_Report, 0, wxALL|wxEXPAND, 5 ); bMiddleBoxSizer->Add( m_Choice_Drill_Report, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbHPGOptionsSizer;
sbHPGOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("HPGL plotter Options:") ), wxVERTICAL );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Speed (cm/s)"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
sbHPGOptionsSizer->Add( m_staticText1, 0, wxRIGHT|wxLEFT, 5 );
m_PenSpeed = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbHPGOptionsSizer->Add( m_PenSpeed, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Pen Number"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
sbHPGOptionsSizer->Add( m_staticText2, 0, wxRIGHT|wxLEFT, 5 );
m_PenNum = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbHPGOptionsSizer->Add( m_PenNum, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bMiddleBoxSizer->Add( sbHPGOptionsSizer, 0, wxEXPAND, 5 );
wxStaticBoxSizer* sbOptSizer; wxStaticBoxSizer* sbOptSizer;
sbOptSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL ); sbOptSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL );
...@@ -175,7 +155,6 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con ...@@ -175,7 +155,6 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
bMainSizer->Fit( this );
this->Centre( wxBOTH ); this->Centre( wxBOTH );
......
...@@ -25,62 +25,28 @@ ...@@ -25,62 +25,28 @@
<property name="use_enum">0</property> <property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1"> <object class="Dialog" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_managed">0</property> <property name="aui_managed">0</property>
<property name="aui_name"></property> <property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center">wxBOTH</property> <property name="center">wxBOTH</property>
<property name="center_pane">0</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>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="event_handler">impl_virtual</property> <property name="event_handler">impl_virtual</property>
<property name="extra_style"></property> <property name="extra_style"></property>
<property name="fg"></property> <property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property> <property name="font"></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="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">DIALOG_GENDRILL_BASE</property> <property name="name">DIALOG_GENDRILL_BASE</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="pin_button">1</property>
<property name="pos"></property> <property name="pos"></property>
<property name="resize">Resizable</property> <property name="size">455,358</property>
<property name="show">1</property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Drill Files Generation</property> <property name="title">Drill Files Generation</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
...@@ -523,7 +489,7 @@ ...@@ -523,7 +489,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;None&quot; &quot;Drill map (HPGL)&quot; &quot;Drill map (PostScript)&quot; &quot;Drill map (Gerber)&quot; &quot;Drill map (DXF)&quot;</property> <property name="choices">&quot;None&quot; &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="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>
...@@ -685,376 +651,6 @@ ...@@ -685,376 +651,6 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">HPGL plotter Options:</property>
<property name="minimum_size"></property>
<property name="name">sbHPGOptionsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Speed (cm/s)</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_PenSpeed</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Pen Number</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText2</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_PenNum</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
...@@ -1334,10 +930,6 @@ ...@@ -1334,10 +930,6 @@
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
...@@ -1435,10 +1027,6 @@ ...@@ -1435,10 +1027,6 @@
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
...@@ -1536,10 +1124,6 @@ ...@@ -1536,10 +1124,6 @@
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
...@@ -1623,10 +1207,6 @@ ...@@ -1623,10 +1207,6 @@
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
...@@ -1710,10 +1290,6 @@ ...@@ -1710,10 +1290,6 @@
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
...@@ -1797,10 +1373,6 @@ ...@@ -1797,10 +1373,6 @@
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
...@@ -1884,10 +1456,6 @@ ...@@ -1884,10 +1456,6 @@
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 19 2012) // 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!
...@@ -19,10 +19,9 @@ ...@@ -19,10 +19,9 @@
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/statbox.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
...@@ -43,10 +42,6 @@ class DIALOG_GENDRILL_BASE : public DIALOG_SHIM ...@@ -43,10 +42,6 @@ class DIALOG_GENDRILL_BASE : public DIALOG_SHIM
wxRadioBox* m_Choice_Drill_Offset; wxRadioBox* m_Choice_Drill_Offset;
wxRadioBox* m_Choice_Drill_Map; wxRadioBox* m_Choice_Drill_Map;
wxRadioBox* m_Choice_Drill_Report; wxRadioBox* m_Choice_Drill_Report;
wxStaticText* m_staticText1;
wxTextCtrl* m_PenSpeed;
wxStaticText* m_staticText2;
wxTextCtrl* m_PenNum;
wxCheckBox* m_Check_Mirror; wxCheckBox* m_Check_Mirror;
wxCheckBox* m_Check_Minimal; wxCheckBox* m_Check_Minimal;
wxStaticBoxSizer* m_DefaultViasDrillSizer; wxStaticBoxSizer* m_DefaultViasDrillSizer;
...@@ -70,7 +65,7 @@ class DIALOG_GENDRILL_BASE : public DIALOG_SHIM ...@@ -70,7 +65,7 @@ class DIALOG_GENDRILL_BASE : public DIALOG_SHIM
public: public:
DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Drill Files Generation"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Drill Files Generation"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 455,358 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GENDRILL_BASE(); ~DIALOG_GENDRILL_BASE();
}; };
......
/**
* @file pcbnew/dialog_plot.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <appl_wxstruct.h>
#include <plot_common.h>
#include <confirm.h>
#include <wxPcbStruct.h>
#include <pcbplot.h>
#include <base_units.h>
#include <class_board.h>
#include <plotcontroller.h>
#include <wx/ffile.h>
#include <dialog_plot.h>
/**
* Class DIALOG_PLOT
*/
DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
DIALOG_PLOT_BASE( aParent ), m_parent( aParent ),
m_board( aParent->GetBoard() ),
m_plotOpts( aParent->GetPlotSettings() )
{
m_config = wxGetApp().GetSettings();
Init_Dialog();
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
}
void DIALOG_PLOT::Init_Dialog()
{
wxString msg;
wxFileName fileName;
m_config->Read( OPTKEY_PLOT_X_FINESCALE_ADJ, &m_XScaleAdjust );
m_config->Read( OPTKEY_PLOT_Y_FINESCALE_ADJ, &m_YScaleAdjust );
m_config->Read( CONFIG_PS_FINEWIDTH_ADJ, &m_PSWidthAdjust );
// The reasonable width correction value must be in a range of
// [-(MinTrackWidth-1), +(MinClearanceValue-1)] decimils.
m_WidthAdjustMinValue = -(m_board->GetDesignSettings().m_TrackMinWidth - 1);
m_WidthAdjustMaxValue = m_board->GetSmallestClearanceValue() - 1;
switch( m_plotOpts.GetFormat() )
{
default:
case PLOT_FORMAT_GERBER:
m_plotFormatOpt->SetSelection( 0 );
break;
case PLOT_FORMAT_POST:
m_plotFormatOpt->SetSelection( 1 );
break;
case PLOT_FORMAT_SVG:
m_plotFormatOpt->SetSelection( 2 );
break;
case PLOT_FORMAT_DXF:
m_plotFormatOpt->SetSelection( 3 );
break;
case PLOT_FORMAT_HPGL:
m_plotFormatOpt->SetSelection( 4 );
break;
}
// Set units and value for HPGL pen size (this param in in mils).
AddUnitSymbol( *m_textPenSize, g_UserUnit );
msg = ReturnStringFromValue( g_UserUnit,
m_plotOpts.GetHPGLPenDiameter() * IU_PER_MILS );
m_HPGLPenSizeOpt->AppendText( msg );
// Units are *always* cm/s for HPGL pen speed, from 1 to 99.
msg = ReturnStringFromValue( UNSCALED_UNITS, m_plotOpts.GetHPGLPenSpeed() );
m_HPGLPenSpeedOpt->AppendText( msg );
// Set units and value for HPGL pen overlay (this param in in mils).
AddUnitSymbol( *m_textPenOvr, g_UserUnit );
msg = ReturnStringFromValue( g_UserUnit,
m_plotOpts.GetHPGLPenOverlay() * IU_PER_MILS );
m_HPGLPenOverlayOpt->AppendText( msg );
AddUnitSymbol( *m_textDefaultPenSize, g_UserUnit );
msg = ReturnStringFromValue( g_UserUnit, m_plotOpts.GetLineWidth() );
m_linesWidth->AppendText( msg );
// Set units for PS global width correction.
AddUnitSymbol( *m_textPSFineAdjustWidth, g_UserUnit );
m_useAuxOriginCheckBox->SetValue( m_plotOpts.GetUseAuxOrigin() );
// Test for a reasonable scale value. Set to 1 if problem
if( m_XScaleAdjust < PLOT_MIN_SCALE || m_YScaleAdjust < PLOT_MIN_SCALE
|| m_XScaleAdjust > PLOT_MAX_SCALE || m_YScaleAdjust > PLOT_MAX_SCALE )
m_XScaleAdjust = m_YScaleAdjust = 1.0;
msg.Printf( wxT( "%f" ), m_XScaleAdjust );
m_fineAdjustXscaleOpt->AppendText( msg );
msg.Printf( wxT( "%f" ), m_YScaleAdjust );
m_fineAdjustYscaleOpt->AppendText( msg );
// Test for a reasonable PS width correction value. Set to 0 if problem.
if( m_PSWidthAdjust < m_WidthAdjustMinValue || m_PSWidthAdjust > m_WidthAdjustMaxValue )
m_PSWidthAdjust = 0.;
msg.Printf( wxT( "%f" ), To_User_Unit( g_UserUnit, m_PSWidthAdjust ) );
m_PSFineAdjustWidthOpt->AppendText( msg );
m_plotPSNegativeOpt->SetValue( m_plotOpts.GetNegative() );
m_forcePSA4OutputOpt->SetValue( m_plotOpts.GetA4Output() );
// List layers in same order than in setup layers dialog
// (Front or Top to Back or Bottom)
DECLARE_LAYERS_ORDER_LIST( layersOrder );
int layerIndex, checkIndex, layer;
for( layerIndex = 0; layerIndex < NB_LAYERS; layerIndex++ )
{
layer = layersOrder[layerIndex];
wxASSERT( layer < NB_LAYERS );
if( !m_board->IsLayerEnabled( layer ) )
continue;
layerList.push_back( layer );
checkIndex = m_layerCheckListBox->Append( m_board->GetLayerName( layer ) );
if( m_plotOpts.GetLayerSelection() & ( 1 << layer ) )
m_layerCheckListBox->Check( checkIndex );
}
// Option for using proper Gerber extensions
m_useGerberExtensions->SetValue( m_plotOpts.GetUseGerberExtensions() );
// Option for excluding contents of "Edges Pcb" layer
m_excludeEdgeLayerOpt->SetValue( m_plotOpts.GetExcludeEdgeLayer() );
m_subtractMaskFromSilk->SetValue( m_plotOpts.GetSubtractMaskFromSilk() );
// Option to plot page references:
m_plotSheetRef->SetValue( m_plotOpts.GetPlotFrameRef() );
// Option to allow pads on silkscreen layers
m_plotPads_on_Silkscreen->SetValue( m_plotOpts.GetPlotPadsOnSilkLayer() );
// Options to plot texts on footprints
m_plotModuleValueOpt->SetValue( m_plotOpts.GetPlotValue() );
m_plotModuleRefOpt->SetValue( m_plotOpts.GetPlotReference() );
m_plotTextOther->SetValue( m_plotOpts.GetPlotOtherText() );
m_plotInvisibleText->SetValue( m_plotOpts.GetPlotInvisibleText() );
// Options to plot pads and vias holes
m_drillShapeOpt->SetSelection( m_plotOpts.GetDrillMarksType() );
// Scale option
m_scaleOpt->SetSelection( m_plotOpts.GetScaleSelection() );
// Plot mode
m_plotModeOpt->SetSelection( m_plotOpts.GetMode() );
// Plot mirror option
m_plotMirrorOpt->SetValue( m_plotOpts.GetMirror() );
// Put vias on mask layer
m_plotNoViaOnMaskOpt->SetValue( m_plotOpts.GetPlotViaOnMaskLayer() );
// Output directory
m_outputDirectoryName->SetValue( m_plotOpts.GetOutputDirectory() );
// Update options values:
wxCommandEvent cmd_event;
SetPlotFormat( cmd_event );
OnSetScaleOpt( cmd_event );
}
void DIALOG_PLOT::OnQuit( wxCommandEvent& event )
{
Close( true ); // true is to force the frame to close
}
void DIALOG_PLOT::OnClose( wxCloseEvent& event )
{
applyPlotSettings();
EndModal( 0 );
}
void DIALOG_PLOT::CreateDrillFile( wxCommandEvent& event )
{
m_parent->InstallDrillFrame( event );
}
void DIALOG_PLOT::OnSetScaleOpt( wxCommandEvent& event )
{
/* Disable sheet reference for scale != 1:1 */
bool scale1 = ( m_scaleOpt->GetSelection() == 1 );
m_plotSheetRef->Enable( scale1 );
if( !scale1 )
m_plotSheetRef->SetValue( false );
}
void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
{
// Build the absolute path of current output plot directory
// to preselect it when opening the dialog.
wxFileName fn( m_outputDirectoryName->GetValue() );
wxString path;
if( fn.IsRelative() )
path = wxGetCwd() + fn.GetPathSeparator() + m_outputDirectoryName->GetValue();
else
path = m_outputDirectoryName->GetValue();
wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
if( dirDialog.ShowModal() == wxID_CANCEL )
return;
wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
wxMessageDialog dialog( this, _( "Use a relative path? " ),
_( "Plot Output Directory" ),
wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
if( dialog.ShowModal() == wxID_YES )
{
wxString boardFilePath = ( (wxFileName) m_parent->GetBoard()->GetFileName() ).GetPath();
if( !dirName.MakeRelativeTo( boardFilePath ) )
wxMessageBox( _(
"Cannot make path relative (target volume different from board file volume)!" ),
_( "Plot Output Directory" ), wxOK | wxICON_ERROR );
}
m_outputDirectoryName->SetValue( dirName.GetFullPath() );
}
PlotFormat DIALOG_PLOT::GetPlotFormat()
{
// plot format id's are ordered like displayed in m_plotFormatOpt
static const PlotFormat plotFmt[] =
{
PLOT_FORMAT_GERBER,
PLOT_FORMAT_POST,
PLOT_FORMAT_SVG,
PLOT_FORMAT_DXF,
PLOT_FORMAT_HPGL,
PLOT_FORMAT_PDF
};
return plotFmt[ m_plotFormatOpt->GetSelection() ];
}
void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
{
switch( GetPlotFormat() )
{
case PLOT_FORMAT_PDF:
case PLOT_FORMAT_SVG:
m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( false );
m_plotMirrorOpt->Enable( true );
m_useAuxOriginCheckBox->Enable( false );
m_useAuxOriginCheckBox->SetValue( false );
m_linesWidth->Enable( true );
m_HPGLPenSizeOpt->Enable( false );
m_HPGLPenSpeedOpt->Enable( false );
m_HPGLPenOverlayOpt->Enable( false );
m_excludeEdgeLayerOpt->Enable( true );
m_subtractMaskFromSilk->Enable( false );
m_subtractMaskFromSilk->SetValue( false );
m_useGerberExtensions->Enable( false );
m_useGerberExtensions->SetValue( false );
m_scaleOpt->Enable( false );
m_fineAdjustXscaleOpt->Enable( false );
m_fineAdjustYscaleOpt->Enable( false );
m_PSFineAdjustWidthOpt->Enable( false );
m_plotPSNegativeOpt->Enable( false );
m_forcePSA4OutputOpt->Enable( false );
m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
break;
case PLOT_FORMAT_POST:
m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( true );
m_plotMirrorOpt->Enable( true );
m_useAuxOriginCheckBox->Enable( false );
m_useAuxOriginCheckBox->SetValue( false );
m_linesWidth->Enable( true );
m_HPGLPenSizeOpt->Enable( false );
m_HPGLPenSpeedOpt->Enable( false );
m_HPGLPenOverlayOpt->Enable( false );
m_excludeEdgeLayerOpt->Enable( true );
m_subtractMaskFromSilk->Enable( false );
m_subtractMaskFromSilk->SetValue( false );
m_useGerberExtensions->Enable( false );
m_useGerberExtensions->SetValue( false );
m_scaleOpt->Enable( true );
m_fineAdjustXscaleOpt->Enable( true );
m_fineAdjustYscaleOpt->Enable( true );
m_PSFineAdjustWidthOpt->Enable( true );
m_plotPSNegativeOpt->Enable( true );
m_forcePSA4OutputOpt->Enable( true );
m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
m_PlotOptionsSizer->Show( m_PSOptionsSizer );
break;
case PLOT_FORMAT_GERBER:
m_drillShapeOpt->Enable( false );
m_drillShapeOpt->SetSelection( 0 );
m_plotModeOpt->Enable( false );
m_plotModeOpt->SetSelection( 1 );
m_plotMirrorOpt->Enable( false );
m_plotMirrorOpt->SetValue( false );
m_useAuxOriginCheckBox->Enable( true );
m_linesWidth->Enable( true );
m_HPGLPenSizeOpt->Enable( false );
m_HPGLPenSpeedOpt->Enable( false );
m_HPGLPenOverlayOpt->Enable( false );
m_excludeEdgeLayerOpt->Enable( true );
m_subtractMaskFromSilk->Enable( true );
m_useGerberExtensions->Enable( true );
m_scaleOpt->Enable( false );
m_scaleOpt->SetSelection( 1 );
m_fineAdjustXscaleOpt->Enable( false );
m_fineAdjustYscaleOpt->Enable( false );
m_PSFineAdjustWidthOpt->Enable( false );
m_plotPSNegativeOpt->Enable( false );
m_plotPSNegativeOpt->SetValue( false );
m_forcePSA4OutputOpt->Enable( false );
m_forcePSA4OutputOpt->SetValue( false );
m_PlotOptionsSizer->Show( m_GerberOptionsSizer );
m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
break;
case PLOT_FORMAT_HPGL:
m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( true );
m_plotMirrorOpt->Enable( true );
m_useAuxOriginCheckBox->Enable( false );
m_useAuxOriginCheckBox->SetValue( false );
m_linesWidth->Enable( false );
m_HPGLPenSizeOpt->Enable( true );
m_HPGLPenSpeedOpt->Enable( true );
m_HPGLPenOverlayOpt->Enable( true );
m_excludeEdgeLayerOpt->Enable( true );
m_subtractMaskFromSilk->Enable( false );
m_subtractMaskFromSilk->SetValue( false );
m_useGerberExtensions->Enable( false );
m_useGerberExtensions->SetValue( false );
m_scaleOpt->Enable( true );
m_fineAdjustXscaleOpt->Enable( false );
m_fineAdjustYscaleOpt->Enable( false );
m_PSFineAdjustWidthOpt->Enable( false );
m_plotPSNegativeOpt->SetValue( false );
m_plotPSNegativeOpt->Enable( false );
m_forcePSA4OutputOpt->Enable( true );
m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
m_PlotOptionsSizer->Show( m_HPGLOptionsSizer );
m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
break;
case PLOT_FORMAT_DXF:
m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( true );
m_plotMirrorOpt->Enable( false );
m_plotMirrorOpt->SetValue( false );
m_useAuxOriginCheckBox->Enable( true );
m_linesWidth->Enable( false );
m_HPGLPenSizeOpt->Enable( false );
m_HPGLPenSpeedOpt->Enable( false );
m_HPGLPenOverlayOpt->Enable( false );
m_excludeEdgeLayerOpt->Enable( true );
m_subtractMaskFromSilk->Enable( false );
m_subtractMaskFromSilk->SetValue( false );
m_useGerberExtensions->Enable( false );
m_useGerberExtensions->SetValue( false );
m_scaleOpt->Enable( false );
m_scaleOpt->SetSelection( 1 );
m_fineAdjustXscaleOpt->Enable( false );
m_fineAdjustYscaleOpt->Enable( false );
m_PSFineAdjustWidthOpt->Enable( false );
m_plotPSNegativeOpt->Enable( false );
m_plotPSNegativeOpt->SetValue( false );
m_forcePSA4OutputOpt->Enable( false );
m_forcePSA4OutputOpt->SetValue( false );
m_PlotOptionsSizer->Show( m_GerberOptionsSizer );
m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
break;
default:
wxASSERT( false );
}
/* Update the interlock between scale and frame reference
* (scaling would mess up the frame border...) */
OnSetScaleOpt( event );
Layout();
m_MainSizer->SetSizeHints( this );
}
// A helper function to "clip" aValue between aMin and aMax
// and write result in * aResult
// return false if clipped, true if aValue is just copied into * aResult
static bool setDouble( double* aResult, double aValue, double aMin, double aMax )
{
if( aValue < aMin )
{
*aResult = aMin;
return false;
}
else if( aValue > aMax )
{
*aResult = aMax;
return false;
}
*aResult = aValue;
return true;
}
void DIALOG_PLOT::applyPlotSettings()
{
PCB_PLOT_PARAMS tempOptions;
tempOptions.SetExcludeEdgeLayer( m_excludeEdgeLayerOpt->GetValue() );
tempOptions.SetSubtractMaskFromSilk( m_subtractMaskFromSilk->GetValue() );
tempOptions.SetPlotFrameRef( m_plotSheetRef->GetValue() );
tempOptions.SetPlotPadsOnSilkLayer( m_plotPads_on_Silkscreen->GetValue() );
tempOptions.SetUseAuxOrigin( m_useAuxOriginCheckBox->GetValue() );
tempOptions.SetPlotValue( m_plotModuleValueOpt->GetValue() );
tempOptions.SetPlotReference( m_plotModuleRefOpt->GetValue() );
tempOptions.SetPlotOtherText( m_plotTextOther->GetValue() );
tempOptions.SetPlotInvisibleText( m_plotInvisibleText->GetValue() );
tempOptions.SetScaleSelection( m_scaleOpt->GetSelection() );
tempOptions.SetDrillMarksType( static_cast<PCB_PLOT_PARAMS::DrillMarksType>
( m_drillShapeOpt->GetSelection() ) );
tempOptions.SetMirror( m_plotMirrorOpt->GetValue() );
tempOptions.SetMode( static_cast<EDA_DRAW_MODE_T>( m_plotModeOpt->GetSelection() ) );
tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() );
// Update settings from text fields. Rewrite values back to the fields,
// since the values may have been constrained by the setters.
// read HPLG pen size (this param is stored in mils)
wxString msg = m_HPGLPenSizeOpt->GetValue();
int tmp = ReturnValueFromString( g_UserUnit, msg ) / IU_PER_MILS;
if( !tempOptions.SetHPGLPenDiameter( tmp ) )
{
msg = ReturnStringFromValue( g_UserUnit, tempOptions.GetHPGLPenDiameter() * IU_PER_MILS );
m_HPGLPenSizeOpt->SetValue( msg );
msg.Printf( _( "HPGL pen size constrained!\n" ) );
m_messagesBox->AppendText( msg );
}
// read HPGL pen speed (this param is stored in cm/s)
msg = m_HPGLPenSpeedOpt->GetValue();
tmp = ReturnValueFromString( UNSCALED_UNITS, msg );
if( !tempOptions.SetHPGLPenSpeed( tmp ) )
{
msg = ReturnStringFromValue( UNSCALED_UNITS, tempOptions.GetHPGLPenSpeed() );
m_HPGLPenSpeedOpt->SetValue( msg );
msg.Printf( _( "HPGL pen speed constrained!\n" ) );
m_messagesBox->AppendText( msg );
}
// Read HPGL pen overlay (this param is stored in mils)
msg = m_HPGLPenOverlayOpt->GetValue();
tmp = ReturnValueFromString( g_UserUnit, msg ) / IU_PER_MILS;
if( !tempOptions.SetHPGLPenOverlay( tmp ) )
{
msg = ReturnStringFromValue( g_UserUnit,
tempOptions.GetHPGLPenOverlay() * IU_PER_MILS );
m_HPGLPenOverlayOpt->SetValue( msg );
msg.Printf( _( "HPGL pen overlay constrained!\n" ) );
m_messagesBox->AppendText( msg );
}
// Default linewidth
msg = m_linesWidth->GetValue();
tmp = ReturnValueFromString( g_UserUnit, msg );
if( !tempOptions.SetLineWidth( tmp ) )
{
msg = ReturnStringFromValue( g_UserUnit, tempOptions.GetLineWidth() );
m_linesWidth->SetValue( msg );
msg.Printf( _( "Default linewidth constrained!\n" ) );
m_messagesBox->AppendText( msg );
}
// X scale
double tmpDouble;
msg = m_fineAdjustXscaleOpt->GetValue();
msg.ToDouble( &tmpDouble );
if( !setDouble( &m_XScaleAdjust, tmpDouble, PLOT_MIN_SCALE, PLOT_MAX_SCALE ) )
{
msg.Printf( wxT( "%f" ), m_XScaleAdjust );
m_fineAdjustXscaleOpt->SetValue( msg );
msg.Printf( _( "X scale constrained!\n" ) );
m_messagesBox->AppendText( msg );
}
m_config->Write( OPTKEY_PLOT_X_FINESCALE_ADJ, m_XScaleAdjust );
// Y scale
msg = m_fineAdjustYscaleOpt->GetValue();
msg.ToDouble( &tmpDouble );
if( !setDouble( &m_YScaleAdjust, tmpDouble, PLOT_MIN_SCALE, PLOT_MAX_SCALE ) )
{
msg.Printf( wxT( "%f" ), m_YScaleAdjust );
m_fineAdjustYscaleOpt->SetValue( msg );
msg.Printf( _( "Y scale constrained!\n" ) );
m_messagesBox->AppendText( msg );
}
m_config->Write( OPTKEY_PLOT_Y_FINESCALE_ADJ, m_YScaleAdjust );
// PS Width correction
msg = m_PSFineAdjustWidthOpt->GetValue();
tmpDouble = ReturnValueFromString( g_UserUnit, msg );
if( !setDouble( &m_PSWidthAdjust, tmpDouble, m_WidthAdjustMinValue, m_WidthAdjustMaxValue ) )
{
msg = ReturnStringFromValue( g_UserUnit, m_PSWidthAdjust );
m_PSFineAdjustWidthOpt->SetValue( msg );
msg.Printf( _( "Width correction constrained!\n"
"The reasonable width correction value must be in a range of\n"
" [%+f; %+f] (%s) for current design rules!\n" ),
To_User_Unit( g_UserUnit, m_WidthAdjustMinValue ),
To_User_Unit( g_UserUnit, m_WidthAdjustMaxValue ),
( g_UserUnit == INCHES ) ? wxT( "\"" ) : wxT( "mm" ) );
m_messagesBox->AppendText( msg );
}
m_config->Write( CONFIG_PS_FINEWIDTH_ADJ, m_PSWidthAdjust );
tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() );
tempOptions.SetFormat( GetPlotFormat() );
long selectedLayers = 0;
unsigned int i;
for( i = 0; i < layerList.size(); i++ )
{
if( m_layerCheckListBox->IsChecked( i ) )
selectedLayers |= (1 << layerList[i]);
}
tempOptions.SetLayerSelection( selectedLayers );
tempOptions.SetNegative( m_plotPSNegativeOpt->GetValue() );
tempOptions.SetA4Output( m_forcePSA4OutputOpt->GetValue() );
// Set output directory and replace backslashes with forward ones
wxString dirStr;
dirStr = m_outputDirectoryName->GetValue();
dirStr.Replace( wxT( "\\" ), wxT( "/" ) );
tempOptions.SetOutputDirectory( dirStr );
if( m_plotOpts != tempOptions )
{
m_parent->SetPlotSettings( tempOptions );
m_plotOpts = tempOptions;
m_parent->OnModify();
}
}
/**
* @file pcbnew/dialog_plot.h
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <class_board.h>
#include <dialog_plot_base.h>
#include <pcb_plot_params.h>
/**
* Class DIALOG_PLOT
*
*/
class DIALOG_PLOT : public DIALOG_PLOT_BASE
{
public:
DIALOG_PLOT( PCB_EDIT_FRAME* parent );
private:
PCB_EDIT_FRAME* m_parent;
BOARD* m_board;
wxConfig* m_config;
std::vector<int> layerList; // List to hold CheckListBox layer numbers
double m_XScaleAdjust; // X scale factor adjust to compensate
// plotter X scaling error
double m_YScaleAdjust; // X scale factor adjust to compensate
// plotter Y scaling error
double m_PSWidthAdjust; // Global width correction for exact line width
// in postscript output.
// this is a correction factor for tracks width
// when plotted
double m_WidthAdjustMinValue; // Global track width limits
double m_WidthAdjustMaxValue; // tracks width will be "clipped" whenever the
// m_PSWidthAdjust to these limits.
PCB_PLOT_PARAMS m_plotOpts;
void Init_Dialog();
void Plot( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event );
void OnClose( wxCloseEvent& event );
void OnOutputDirectoryBrowseClicked( wxCommandEvent& event );
void SetPlotFormat( wxCommandEvent& event );
void OnSetScaleOpt( wxCommandEvent& event );
void applyPlotSettings();
void CreateDrillFile( wxCommandEvent& event );
PlotFormat GetPlotFormat();
};
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 19 2012) // 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!
...@@ -28,7 +28,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr ...@@ -28,7 +28,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
m_staticText121->Wrap( -1 ); m_staticText121->Wrap( -1 );
bSizer27->Add( m_staticText121, 0, wxTOP, 5 ); bSizer27->Add( m_staticText121, 0, wxTOP, 5 );
wxString m_plotFormatOptChoices[] = { _("HPGL"), _("Gerber"), _("Postscript"), _("DXF") }; wxString m_plotFormatOptChoices[] = { _("Gerber"), _("Postscript"), _("SVG"), _("DXF"), _("HPGL") };
int m_plotFormatOptNChoices = sizeof( m_plotFormatOptChoices ) / sizeof( wxString ); int m_plotFormatOptNChoices = sizeof( m_plotFormatOptChoices ) / sizeof( wxString );
m_plotFormatOpt = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_plotFormatOptNChoices, m_plotFormatOptChoices, 0 ); m_plotFormatOpt = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_plotFormatOptNChoices, m_plotFormatOptChoices, 0 );
m_plotFormatOpt->SetSelection( 0 ); m_plotFormatOpt->SetSelection( 0 );
...@@ -142,7 +142,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr ...@@ -142,7 +142,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
wxString m_scaleOptChoices[] = { _("Auto"), _("1:1"), _("3:2"), _("2:1"), _("3:1") }; wxString m_scaleOptChoices[] = { _("Auto"), _("1:1"), _("3:2"), _("2:1"), _("3:1") };
int m_scaleOptNChoices = sizeof( m_scaleOptChoices ) / sizeof( wxString ); int m_scaleOptNChoices = sizeof( m_scaleOptChoices ) / sizeof( wxString );
m_scaleOpt = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_scaleOptNChoices, m_scaleOptChoices, 0 ); m_scaleOpt = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_scaleOptNChoices, m_scaleOptChoices, 0 );
m_scaleOpt->SetSelection( 0 ); m_scaleOpt->SetSelection( 1 );
bSizer14->Add( m_scaleOpt, 0, wxEXPAND|wxLEFT, 5 ); bSizer14->Add( m_scaleOpt, 0, wxEXPAND|wxLEFT, 5 );
m_staticText13 = new wxStaticText( this, wxID_ANY, _("Plot mode:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText13 = new wxStaticText( this, wxID_ANY, _("Plot mode:"), wxDefaultPosition, wxDefaultSize, 0 );
......
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,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;HPGL&quot; &quot;Gerber&quot; &quot;Postscript&quot; &quot;DXF&quot;</property> <property name="choices">&quot;Gerber&quot; &quot;Postscript&quot; &quot;SVG&quot; &quot;DXF&quot; &quot;HPGL&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>
...@@ -1745,7 +1745,7 @@ ...@@ -1745,7 +1745,7 @@
<property name="pin_button">1</property> <property name="pin_button">1</property>
<property name="pos"></property> <property name="pos"></property>
<property name="resize">Resizable</property> <property name="resize">Resizable</property>
<property name="selection">0</property> <property name="selection">1</property>
<property name="show">1</property> <property name="show">1</property>
<property name="size"></property> <property name="size"></property>
<property name="style"></property> <property name="style"></property>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 19 2012) // 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!
......
...@@ -113,6 +113,15 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, ...@@ -113,6 +113,15 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
} }
break; break;
case PLOT_FORMAT_SVG:
{
SVG_PLOTTER* svg_plotter = new SVG_PLOTTER;
plotter = svg_plotter;
plotter->SetPageSettings( aSheet );
plotter->SetViewport( offset, IU_PER_DECIMILS, scale, false );
}
break;
default: default:
wxASSERT( false ); wxASSERT( false );
} }
......
...@@ -205,6 +205,11 @@ void DIALOG_GENDRILL::GenDrillAndReportFiles() ...@@ -205,6 +205,11 @@ void DIALOG_GENDRILL::GenDrillAndReportFiles()
GenDrillMap( dlg.GetPath(), s_HoleListBuffer, s_ToolListBuffer, GenDrillMap( dlg.GetPath(), s_HoleListBuffer, s_ToolListBuffer,
PLOT_FORMAT_DXF ); PLOT_FORMAT_DXF );
break; break;
case 5:
GenDrillMap( dlg.GetPath(), s_HoleListBuffer, s_ToolListBuffer,
PLOT_FORMAT_SVG );
break;
} }
} }
...@@ -626,6 +631,11 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName, ...@@ -626,6 +631,11 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName,
wildcard = _( "DXF files (.dxf)|*.dxf" ); wildcard = _( "DXF files (.dxf)|*.dxf" );
break; break;
case PLOT_FORMAT_SVG:
ext = SVG_PLOTTER::GetDefaultFileExtension();
wildcard = SVGFileWildcard;
break;
default: default:
DisplayError( this, wxT( "DIALOG_GENDRILL::GenDrillMap() error" ) ); DisplayError( this, wxT( "DIALOG_GENDRILL::GenDrillMap() error" ) );
return; return;
......
...@@ -388,13 +388,15 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_ ...@@ -388,13 +388,15 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_
aPcbPlotParams->m_subtractMaskFromSilk = ParseBool(); aPcbPlotParams->m_subtractMaskFromSilk = ParseBool();
break; break;
case T_outputformat: case T_outputformat:
aPcbPlotParams->m_format = static_cast<PlotFormat>( ParseInt( 0, 3 ) ); aPcbPlotParams->m_format = static_cast<PlotFormat>(
ParseInt( PLOT_FIRST_FORMAT, PLOT_LAST_FORMAT ) );
break; break;
case T_mirror: case T_mirror:
aPcbPlotParams->m_mirror = ParseBool(); aPcbPlotParams->m_mirror = ParseBool();
break; break;
case T_drillshape: case T_drillshape:
aPcbPlotParams->m_drillMarks = static_cast<PCB_PLOT_PARAMS::DrillMarksType>( ParseInt( 0, 2 ) ); aPcbPlotParams->m_drillMarks = static_cast<PCB_PLOT_PARAMS::DrillMarksType>
( ParseInt( 0, 2 ) );
break; break;
case T_scaleselection: case T_scaleselection:
aPcbPlotParams->m_scaleSelection = ParseInt( 0, 4 ); aPcbPlotParams->m_scaleSelection = ParseInt( 0, 4 );
......
...@@ -28,55 +28,21 @@ ...@@ -28,55 +28,21 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
#include <appl_wxstruct.h>
#include <plot_common.h> #include <plot_common.h>
#include <confirm.h> #include <confirm.h>
#include <gestfich.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <pcbplot.h> #include <pcbplot.h>
#include <worksheet.h>
#include <pcbstruct.h> #include <pcbstruct.h>
#include <macros.h>
#include <base_units.h> #include <base_units.h>
#include <class_board.h> #include <class_board.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <pcbnew_id.h>
#include <protos.h>
#include <dialog_plot_base.h>
#include <pcb_plot_params.h>
#include <pcb_plot_params_lexer.h>
#include <plotcontroller.h> #include <plotcontroller.h>
#include <wx/ffile.h> #include <wx/ffile.h>
#include <dialog_plot.h>
/* Keywords to r/w options in m_config */
#define CONFIG_XFINESCALE_ADJ wxT( "PlotXFineScaleAdj" )
#define CONFIG_YFINESCALE_ADJ wxT( "PlotYFineScaleAdj" )
#define CONFIG_PS_FINEWIDTH_ADJ wxT( "PSPlotFineWidthAdj" )
// Define min and max reasonable values for print scale
#define MIN_SCALE 0.01
#define MAX_SCALE 100.0
static bool setDouble( double* aDouble, double aValue, double aMin, double aMax )
{
if( aValue < aMin )
{
*aDouble = aMin;
return false;
}
else if( aValue > aMax )
{
*aDouble = aMax;
return false;
}
*aDouble = aValue; /** Get the 'traditional' gerber extension depending on the layer
return true; */
}
/** Get the 'traditional' gerber extension depending on the layer */
static wxString GetGerberExtension( int layer )/*{{{*/ static wxString GetGerberExtension( int layer )/*{{{*/
{ {
switch( layer ) switch( layer )
...@@ -206,541 +172,10 @@ static bool EnsureOutputDirectory( wxFileName *aOutputDir, /*{{{*/ ...@@ -206,541 +172,10 @@ static bool EnsureOutputDirectory( wxFileName *aOutputDir, /*{{{*/
return true; return true;
}/*}}}*/ }/*}}}*/
/** /*
* Class DIALOG_PLOT * DIALOG_PLOT:Plot
* * Actually creates the files
*/ */
class DIALOG_PLOT : public DIALOG_PLOT_BASE
{
public:
DIALOG_PLOT( PCB_EDIT_FRAME* parent );
private:
PCB_EDIT_FRAME* m_parent;
BOARD* m_board;
wxConfig* m_config;
std::vector<int> layerList; // List to hold CheckListBox layer numbers
double m_XScaleAdjust;
double m_YScaleAdjust;
double m_PSWidthAdjust; // Global width correction for exact width postscript output.
double m_WidthAdjustMinValue; // Global width correction
double m_WidthAdjustMaxValue; // margins.
PCB_PLOT_PARAMS m_plotOpts;
void Init_Dialog();
void Plot( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event );
void OnClose( wxCloseEvent& event );
void OnOutputDirectoryBrowseClicked( wxCommandEvent& event );
void SetPlotFormat( wxCommandEvent& event );
void OnSetScaleOpt( wxCommandEvent& event );
void applyPlotSettings();
void CreateDrillFile( wxCommandEvent& event );
};
DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
DIALOG_PLOT_BASE( aParent ),
m_parent( aParent ),
m_board( aParent->GetBoard() ),
m_plotOpts( aParent->GetPlotSettings() )
{
m_config = wxGetApp().GetSettings();
Init_Dialog();
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
}
void DIALOG_PLOT::Init_Dialog()
{
wxString msg;
wxFileName fileName;
m_config->Read( CONFIG_XFINESCALE_ADJ, &m_XScaleAdjust );
m_config->Read( CONFIG_YFINESCALE_ADJ, &m_YScaleAdjust );
m_config->Read( CONFIG_PS_FINEWIDTH_ADJ, &m_PSWidthAdjust);
// The reasonable width correction value must be in a range of
// [-(MinTrackWidth-1), +(MinClearanceValue-1)] decimils.
m_WidthAdjustMinValue = -(m_board->GetDesignSettings().m_TrackMinWidth - 1);
m_WidthAdjustMaxValue = m_board->GetSmallestClearanceValue() - 1;
m_plotFormatOpt->SetSelection( m_plotOpts.GetFormat() );
// Set units and value for HPGL pen size (this param in in mils).
AddUnitSymbol( *m_textPenSize, g_UserUnit );
msg = ReturnStringFromValue( g_UserUnit,
m_plotOpts.GetHPGLPenDiameter() * IU_PER_MILS );
m_HPGLPenSizeOpt->AppendText( msg );
// Units are *always* cm/s for HPGL pen speed, from 1 to 99.
msg = ReturnStringFromValue( UNSCALED_UNITS, m_plotOpts.GetHPGLPenSpeed() );
m_HPGLPenSpeedOpt->AppendText( msg );
// Set units and value for HPGL pen overlay (this param in in mils).
AddUnitSymbol( *m_textPenOvr, g_UserUnit );
msg = ReturnStringFromValue( g_UserUnit,
m_plotOpts.GetHPGLPenOverlay() * IU_PER_MILS );
m_HPGLPenOverlayOpt->AppendText( msg );
AddUnitSymbol( *m_textDefaultPenSize, g_UserUnit );
msg = ReturnStringFromValue( g_UserUnit, m_plotOpts.GetLineWidth() );
m_linesWidth->AppendText( msg );
// Set units for PS global width correction.
AddUnitSymbol( *m_textPSFineAdjustWidth, g_UserUnit );
m_useAuxOriginCheckBox->SetValue( m_plotOpts.GetUseAuxOrigin() );
// Test for a reasonable scale value. Set to 1 if problem
if( m_XScaleAdjust < MIN_SCALE || m_YScaleAdjust < MIN_SCALE
|| m_XScaleAdjust > MAX_SCALE || m_YScaleAdjust > MAX_SCALE )
m_XScaleAdjust = m_YScaleAdjust = 1.0;
msg.Printf( wxT( "%f" ), m_XScaleAdjust );
m_fineAdjustXscaleOpt->AppendText( msg );
msg.Printf( wxT( "%f" ), m_YScaleAdjust );
m_fineAdjustYscaleOpt->AppendText( msg );
// Test for a reasonable PS width correction value. Set to 0 if problem.
if( m_PSWidthAdjust < m_WidthAdjustMinValue || m_PSWidthAdjust > m_WidthAdjustMaxValue )
m_PSWidthAdjust = 0.;
msg.Printf( wxT( "%f" ), To_User_Unit( g_UserUnit, m_PSWidthAdjust ) );
m_PSFineAdjustWidthOpt->AppendText( msg );
m_plotPSNegativeOpt->SetValue( m_plotOpts.GetNegative() );
m_forcePSA4OutputOpt->SetValue( m_plotOpts.GetA4Output() );
// List layers in same order than in setup layers dialog
// (Front or Top to Back or Bottom)
DECLARE_LAYERS_ORDER_LIST( layersOrder );
int layerIndex, checkIndex, layer;
for( layerIndex = 0; layerIndex < NB_LAYERS; layerIndex++ )
{
layer = layersOrder[layerIndex];
wxASSERT( layer < NB_LAYERS );
if( !m_board->IsLayerEnabled( layer ) )
continue;
layerList.push_back( layer );
checkIndex = m_layerCheckListBox->Append( m_board->GetLayerName( layer ) );
if( m_plotOpts.GetLayerSelection() & ( 1 << layer ) )
m_layerCheckListBox->Check( checkIndex );
}
// Option for using proper Gerber extensions
m_useGerberExtensions->SetValue( m_plotOpts.GetUseGerberExtensions() );
// Option for excluding contents of "Edges Pcb" layer
m_excludeEdgeLayerOpt->SetValue( m_plotOpts.GetExcludeEdgeLayer() );
m_subtractMaskFromSilk->SetValue( m_plotOpts.GetSubtractMaskFromSilk() );
// Option to plot page references:
m_plotSheetRef->SetValue( m_plotOpts.GetPlotFrameRef() );
// Option to allow pads on silkscreen layers
m_plotPads_on_Silkscreen->SetValue( m_plotOpts.GetPlotPadsOnSilkLayer() );
// Options to plot texts on footprints
m_plotModuleValueOpt->SetValue( m_plotOpts.GetPlotValue() );
m_plotModuleRefOpt->SetValue( m_plotOpts.GetPlotReference() );
m_plotTextOther->SetValue( m_plotOpts.GetPlotOtherText() );
m_plotInvisibleText->SetValue( m_plotOpts.GetPlotInvisibleText() );
// Options to plot pads and vias holes
m_drillShapeOpt->SetSelection( m_plotOpts.GetDrillMarksType() );
// Scale option
m_scaleOpt->SetSelection( m_plotOpts.GetScaleSelection() );
// Plot mode
m_plotModeOpt->SetSelection( m_plotOpts.GetMode() );
// Plot mirror option
m_plotMirrorOpt->SetValue( m_plotOpts.GetMirror() );
// Put vias on mask layer
m_plotNoViaOnMaskOpt->SetValue( m_plotOpts.GetPlotViaOnMaskLayer() );
// Output directory
m_outputDirectoryName->SetValue( m_plotOpts.GetOutputDirectory() );
// Update options values:
wxCommandEvent cmd_event;
SetPlotFormat( cmd_event );
OnSetScaleOpt( cmd_event );
}
void DIALOG_PLOT::OnQuit( wxCommandEvent& event )
{
Close( true ); // true is to force the frame to close
}
void DIALOG_PLOT::OnClose( wxCloseEvent& event )
{
applyPlotSettings();
EndModal( 0 );
}
void DIALOG_PLOT::CreateDrillFile( wxCommandEvent& event )
{
( (PCB_EDIT_FRAME*) m_parent )->InstallDrillFrame( event );
}
void DIALOG_PLOT::OnSetScaleOpt( wxCommandEvent& event )
{
/* Disable sheet reference for scale != 1:1 */
bool scale1 = ( m_scaleOpt->GetSelection() == 1 );
m_plotSheetRef->Enable( scale1 );
if( !scale1 )
m_plotSheetRef->SetValue( false );
}
void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
{
// Build the absolute path of current output plot directory
// to preselect it when opening the dialog.
wxFileName fn( m_outputDirectoryName->GetValue() );
wxString path;
if( fn.IsRelative() )
path = wxGetCwd() + fn.GetPathSeparator() + m_outputDirectoryName->GetValue();
else
path = m_outputDirectoryName->GetValue();
wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
if( dirDialog.ShowModal() == wxID_CANCEL )
return;
wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
wxMessageDialog dialog( this, _( "Use a relative path? "),
_( "Plot Output Directory" ),
wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
if( dialog.ShowModal() == wxID_YES ) {
wxString boardFilePath = ( (wxFileName) m_parent->GetBoard()->GetFileName()).GetPath();
if( !dirName.MakeRelativeTo( boardFilePath ) )
wxMessageBox( _( "Cannot make path relative (target volume different from board file volume)!" ),
_( "Plot Output Directory" ), wxOK | wxICON_ERROR );
}
m_outputDirectoryName->SetValue( dirName.GetFullPath() );
}
void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
{
switch( m_plotFormatOpt->GetSelection() )
{
case PLOT_FORMAT_POST:
m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( true );
m_plotMirrorOpt->Enable( true );
m_useAuxOriginCheckBox->Enable( false );
m_useAuxOriginCheckBox->SetValue( false );
m_linesWidth->Enable( true );
m_HPGLPenSizeOpt->Enable( false );
m_HPGLPenSpeedOpt->Enable( false );
m_HPGLPenOverlayOpt->Enable( false );
m_excludeEdgeLayerOpt->Enable( true );
m_subtractMaskFromSilk->Enable( false );
m_subtractMaskFromSilk->SetValue( false );
m_useGerberExtensions->Enable( false );
m_useGerberExtensions->SetValue( false );
m_scaleOpt->Enable( true );
m_fineAdjustXscaleOpt->Enable( true );
m_fineAdjustYscaleOpt->Enable( true );
m_PSFineAdjustWidthOpt->Enable( true );
m_plotPSNegativeOpt->Enable( true );
m_forcePSA4OutputOpt->Enable( true );
m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
m_PlotOptionsSizer->Show( m_PSOptionsSizer );
break;
case PLOT_FORMAT_GERBER:
m_drillShapeOpt->Enable( false );
m_drillShapeOpt->SetSelection( 0 );
m_plotModeOpt->Enable( false );
m_plotModeOpt->SetSelection( 1 );
m_plotMirrorOpt->Enable( false );
m_plotMirrorOpt->SetValue( false );
m_useAuxOriginCheckBox->Enable( true );
m_linesWidth->Enable( true );
m_HPGLPenSizeOpt->Enable( false );
m_HPGLPenSpeedOpt->Enable( false );
m_HPGLPenOverlayOpt->Enable( false );
m_excludeEdgeLayerOpt->Enable( true );
m_subtractMaskFromSilk->Enable( true );
m_useGerberExtensions->Enable( true );
m_scaleOpt->Enable( false );
m_scaleOpt->SetSelection( 1 );
m_fineAdjustXscaleOpt->Enable( false );
m_fineAdjustYscaleOpt->Enable( false );
m_PSFineAdjustWidthOpt->Enable( false );
m_plotPSNegativeOpt->Enable( false );
m_plotPSNegativeOpt->SetValue( false );
m_forcePSA4OutputOpt->Enable( false );
m_forcePSA4OutputOpt->SetValue( false );
m_PlotOptionsSizer->Show( m_GerberOptionsSizer );
m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
break;
case PLOT_FORMAT_HPGL:
m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( true );
m_plotMirrorOpt->Enable( true );
m_useAuxOriginCheckBox->Enable( false );
m_useAuxOriginCheckBox->SetValue( false );
m_linesWidth->Enable( false );
m_HPGLPenSizeOpt->Enable( true );
m_HPGLPenSpeedOpt->Enable( true );
m_HPGLPenOverlayOpt->Enable( true );
m_excludeEdgeLayerOpt->Enable( true );
m_subtractMaskFromSilk->Enable( false );
m_subtractMaskFromSilk->SetValue( false );
m_useGerberExtensions->Enable( false );
m_useGerberExtensions->SetValue( false );
m_scaleOpt->Enable( true );
m_fineAdjustXscaleOpt->Enable( false );
m_fineAdjustYscaleOpt->Enable( false );
m_PSFineAdjustWidthOpt->Enable( false );
m_plotPSNegativeOpt->SetValue( false );
m_plotPSNegativeOpt->Enable( false );
m_forcePSA4OutputOpt->Enable( true );
m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
m_PlotOptionsSizer->Show( m_HPGLOptionsSizer );
m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
break;
case PLOT_FORMAT_DXF:
m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( true );
m_plotMirrorOpt->Enable( false );
m_plotMirrorOpt->SetValue( false );
m_useAuxOriginCheckBox->Enable( true );
m_linesWidth->Enable( false );
m_HPGLPenSizeOpt->Enable( false );
m_HPGLPenSpeedOpt->Enable( false );
m_HPGLPenOverlayOpt->Enable( false );
m_excludeEdgeLayerOpt->Enable( true );
m_subtractMaskFromSilk->Enable( false );
m_subtractMaskFromSilk->SetValue( false );
m_useGerberExtensions->Enable( false );
m_useGerberExtensions->SetValue( false );
m_scaleOpt->Enable( false );
m_scaleOpt->SetSelection( 1 );
m_fineAdjustXscaleOpt->Enable( false );
m_fineAdjustYscaleOpt->Enable( false );
m_PSFineAdjustWidthOpt->Enable( false );
m_plotPSNegativeOpt->Enable( false );
m_plotPSNegativeOpt->SetValue( false );
m_forcePSA4OutputOpt->Enable( false );
m_forcePSA4OutputOpt->SetValue( false );
m_PlotOptionsSizer->Show( m_GerberOptionsSizer );
m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
break;
default:
wxASSERT( false );
}
/* Update the interlock between scale and frame reference
* (scaling would mess up the frame border...) */
OnSetScaleOpt( event );
Layout();
m_MainSizer->SetSizeHints( this );
}
void DIALOG_PLOT::applyPlotSettings()
{
PCB_PLOT_PARAMS tempOptions;
tempOptions.SetExcludeEdgeLayer( m_excludeEdgeLayerOpt->GetValue() );
tempOptions.SetSubtractMaskFromSilk( m_subtractMaskFromSilk->GetValue() );
tempOptions.SetPlotFrameRef( m_plotSheetRef->GetValue() );
tempOptions.SetPlotPadsOnSilkLayer( m_plotPads_on_Silkscreen->GetValue() );
tempOptions.SetUseAuxOrigin( m_useAuxOriginCheckBox->GetValue() );
tempOptions.SetPlotValue( m_plotModuleValueOpt->GetValue() );
tempOptions.SetPlotReference( m_plotModuleRefOpt->GetValue() );
tempOptions.SetPlotOtherText( m_plotTextOther->GetValue() );
tempOptions.SetPlotInvisibleText( m_plotInvisibleText->GetValue() );
tempOptions.SetScaleSelection( m_scaleOpt->GetSelection() );
tempOptions.SetDrillMarksType( static_cast<PCB_PLOT_PARAMS::DrillMarksType>
( m_drillShapeOpt->GetSelection() ) );
tempOptions.SetMirror( m_plotMirrorOpt->GetValue() );
tempOptions.SetMode( static_cast<EDA_DRAW_MODE_T>( m_plotModeOpt->GetSelection() ) );
tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() );
// Update settings from text fields. Rewrite values back to the fields,
// since the values may have been constrained by the setters.
// read HPLG pen size (this param is stored in mils)
wxString msg = m_HPGLPenSizeOpt->GetValue();
int tmp = ReturnValueFromString( g_UserUnit, msg ) / IU_PER_MILS;
if( !tempOptions.SetHPGLPenDiameter( tmp ) )
{
msg = ReturnStringFromValue( g_UserUnit, tempOptions.GetHPGLPenDiameter() * IU_PER_MILS );
m_HPGLPenSizeOpt->SetValue( msg );
msg.Printf( _( "HPGL pen size constrained!\n" ) );
m_messagesBox->AppendText( msg );
}
// read HPGL pen speed (this param is stored in cm/s)
msg = m_HPGLPenSpeedOpt->GetValue();
tmp = ReturnValueFromString( UNSCALED_UNITS, msg );
if( !tempOptions.SetHPGLPenSpeed( tmp ) )
{
msg = ReturnStringFromValue( UNSCALED_UNITS, tempOptions.GetHPGLPenSpeed() );
m_HPGLPenSpeedOpt->SetValue( msg );
msg.Printf( _( "HPGL pen speed constrained!\n" ) );
m_messagesBox->AppendText( msg );
}
// Read HPGL pen overlay (this param is stored in mils)
msg = m_HPGLPenOverlayOpt->GetValue();
tmp = ReturnValueFromString( g_UserUnit, msg ) / IU_PER_MILS;
if( !tempOptions.SetHPGLPenOverlay( tmp ) )
{
msg = ReturnStringFromValue( g_UserUnit,
tempOptions.GetHPGLPenOverlay() * IU_PER_MILS );
m_HPGLPenOverlayOpt->SetValue( msg );
msg.Printf( _( "HPGL pen overlay constrained!\n" ) );
m_messagesBox->AppendText( msg );
}
// Default linewidth
msg = m_linesWidth->GetValue();
tmp = ReturnValueFromString( g_UserUnit, msg );
if( !tempOptions.SetLineWidth( tmp ) )
{
msg = ReturnStringFromValue( g_UserUnit, tempOptions.GetLineWidth() );
m_linesWidth->SetValue( msg );
msg.Printf( _( "Default linewidth constrained!\n" ) );
m_messagesBox->AppendText( msg );
}
// X scale
double tmpDouble;
msg = m_fineAdjustXscaleOpt->GetValue();
msg.ToDouble( &tmpDouble );
if( !setDouble( &m_XScaleAdjust, tmpDouble, MIN_SCALE, MAX_SCALE ) )
{
msg.Printf( wxT( "%f" ), m_XScaleAdjust );
m_fineAdjustXscaleOpt->SetValue( msg );
msg.Printf( _( "X scale constrained!\n" ) );
m_messagesBox->AppendText( msg );
}
m_config->Write( CONFIG_XFINESCALE_ADJ, m_XScaleAdjust );
// Y scale
msg = m_fineAdjustYscaleOpt->GetValue();
msg.ToDouble( &tmpDouble );
if( !setDouble( &m_YScaleAdjust, tmpDouble, MIN_SCALE, MAX_SCALE ) )
{
msg.Printf( wxT( "%f" ), m_YScaleAdjust );
m_fineAdjustYscaleOpt->SetValue( msg );
msg.Printf( _( "Y scale constrained!\n" ) );
m_messagesBox->AppendText( msg );
}
m_config->Write( CONFIG_YFINESCALE_ADJ, m_YScaleAdjust );
// PS Width correction
msg = m_PSFineAdjustWidthOpt->GetValue();
tmpDouble = ReturnValueFromString( g_UserUnit, msg );
if( !setDouble( &m_PSWidthAdjust, tmpDouble, m_WidthAdjustMinValue, m_WidthAdjustMaxValue ) )
{
msg = ReturnStringFromValue( g_UserUnit, m_PSWidthAdjust );
m_PSFineAdjustWidthOpt->SetValue( msg );
msg.Printf( _( "Width correction constrained!\n"
"The reasonable width correction value must be in a range of\n"
" [%+f; %+f] (%s) for current design rules!\n" ),
To_User_Unit( g_UserUnit, m_WidthAdjustMinValue ),
To_User_Unit( g_UserUnit, m_WidthAdjustMaxValue ),
( g_UserUnit == INCHES )? wxT("\"") : wxT("mm") );
m_messagesBox->AppendText( msg );
}
m_config->Write( CONFIG_PS_FINEWIDTH_ADJ, m_PSWidthAdjust );
tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() );
tempOptions.SetFormat( static_cast<PlotFormat>( m_plotFormatOpt->GetSelection() ) );
long selectedLayers = 0;
unsigned int i;
for( i = 0; i < layerList.size(); i++ )
{
if( m_layerCheckListBox->IsChecked( i ) )
selectedLayers |= (1 << layerList[i]);
}
tempOptions.SetLayerSelection( selectedLayers );
tempOptions.SetNegative( m_plotPSNegativeOpt->GetValue() );
tempOptions.SetA4Output( m_forcePSA4OutputOpt->GetValue() );
// Set output directory and replace backslashes with forward ones
wxString dirStr;
dirStr = m_outputDirectoryName->GetValue();
dirStr.Replace( wxT( "\\" ), wxT( "/" ) );
tempOptions.SetOutputDirectory( dirStr );
if( m_plotOpts != tempOptions )
{
m_parent->SetPlotSettings( tempOptions );
m_plotOpts = tempOptions;
m_parent->OnModify();
}
}
void DIALOG_PLOT::Plot( wxCommandEvent& event ) void DIALOG_PLOT::Plot( wxCommandEvent& event )
{ {
int layer; int layer;
...@@ -797,11 +232,11 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -797,11 +232,11 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
// Test for a reasonable scale value // Test for a reasonable scale value
// XXX could this actually happen? isn't it constrained in the apply // XXX could this actually happen? isn't it constrained in the apply
// function? // function?
if( m_plotOpts.GetScale() < MIN_SCALE ) if( m_plotOpts.GetScale() < PLOT_MIN_SCALE )
DisplayInfoMessage( this, DisplayInfoMessage( this,
_( "Warning: Scale option set to a very small value" ) ); _( "Warning: Scale option set to a very small value" ) );
if( m_plotOpts.GetScale() > MAX_SCALE ) if( m_plotOpts.GetScale() > PLOT_MAX_SCALE )
DisplayInfoMessage( this, DisplayInfoMessage( this,
_( "Warning: Scale option set to a very large value" ) ); _( "Warning: Scale option set to a very large value" ) );
...@@ -858,7 +293,6 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -858,7 +293,6 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
DisplayError( this, _( "No layer selected" ) ); DisplayError( this, _( "No layer selected" ) );
} }
void PCB_EDIT_FRAME::ToPlotter( wxCommandEvent& event ) void PCB_EDIT_FRAME::ToPlotter( wxCommandEvent& event )
{ {
DIALOG_PLOT dlg( this ); DIALOG_PLOT dlg( this );
......
...@@ -26,6 +26,13 @@ class ZONE_CONTAINER; ...@@ -26,6 +26,13 @@ class ZONE_CONTAINER;
#define OPTKEY_PRINT_PAGE_FRAME wxT( "PrintPageFrame" ) #define OPTKEY_PRINT_PAGE_FRAME wxT( "PrintPageFrame" )
#define OPTKEY_PRINT_MONOCHROME_MODE wxT( "PrintMonochrome" ) #define OPTKEY_PRINT_MONOCHROME_MODE wxT( "PrintMonochrome" )
#define OPTKEY_PRINT_PADS_DRILL wxT( "PrintPadsDrillOpt" ) #define OPTKEY_PRINT_PADS_DRILL wxT( "PrintPadsDrillOpt" )
#define OPTKEY_PLOT_X_FINESCALE_ADJ wxT( "PlotXFineScaleAdj" )
#define OPTKEY_PLOT_Y_FINESCALE_ADJ wxT( "PlotYFineScaleAdj" )
#define CONFIG_PS_FINEWIDTH_ADJ wxT( "PSPlotFineWidthAdj" )
// Define min and max reasonable values for plot/print scale
#define PLOT_MIN_SCALE 0.01
#define PLOT_MAX_SCALE 100.0
// Conversion unit constants. // Conversion unit constants.
// Convert pcb dimension of 0.1 mil to PS units of inches. // Convert pcb dimension of 0.1 mil to PS units of inches.
...@@ -34,7 +41,7 @@ class ZONE_CONTAINER; ...@@ -34,7 +41,7 @@ class ZONE_CONTAINER;
// Convert dimension 0.1 mil -> HPGL units: // Convert dimension 0.1 mil -> HPGL units:
#define SCALE_HPGL 0.102041 #define SCALE_HPGL 0.102041
// Small drill marks diameter value (in internal value = 1/10000 inch) // Small drill marks diameter value (in 1/10000 inch)
#define SMALL_DRILL 150 #define SMALL_DRILL 150
......
...@@ -1248,6 +1248,10 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, ...@@ -1248,6 +1248,10 @@ PLOTTER *StartPlotBoard( BOARD *aBoard,
the_plotter = new GERBER_PLOTTER(); the_plotter = new GERBER_PLOTTER();
break; break;
case PLOT_FORMAT_SVG:
the_plotter = new SVG_PLOTTER();
break;
default: default:
wxASSERT( false ); wxASSERT( false );
} }
...@@ -1281,8 +1285,6 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, ...@@ -1281,8 +1285,6 @@ PLOTTER *StartPlotBoard( BOARD *aBoard,
// error in start_plot( ) or before // error in start_plot( ) or before
DisplayError( NULL, _("Error creating plot file")); DisplayError( NULL, _("Error creating plot file"));
if( the_plotter )
delete the_plotter; delete the_plotter;
return NULL; return NULL;
} }
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