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
common_plotPDF_functions.cpp
common_plotGERBER_functions.cpp
common_plotDXF_functions.cpp
common_plotSVG_functions.cpp
confirm.cpp
copy_to_clipboard.cpp
dcsvg.cpp
......
......@@ -260,7 +260,7 @@ void BITMAP_BASE::PlotImage( PLOTTER* aPlotter,
return;
// 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->SetCurrentLineWidth( aDefaultPensize );
......
......@@ -9,7 +9,7 @@
* POSTSCRIPT
* GERBER
* DXF
* an SVG 'plot' is also provided along with the 'print' function by wx, but
* an SVG 'plot' is also provided along with the 'print' function by wx, but
* is not handled here.
*/
......@@ -29,11 +29,11 @@ PLOTTER::PLOTTER( )
{
plotScale = 1;
defaultPenWidth = 0;
currentPenWidth = -1; // To-be-set marker
currentPenWidth = -1; // To-be-set marker
penState = 'Z'; // End-of-path idle
plotMirror = 0; // Mirror flag
plotMirror = false; // Mirror flag
outputFile = 0;
colorMode = false; // Starts as a BW plot
colorMode = false; // Starts as a BW plot
negativeMode = false;
}
......@@ -53,7 +53,7 @@ DPOINT PLOTTER::userToDeviceCoordinates( const wxPoint& pos )
else
y = ( paperSize.y - ( pos.y - plotOffset.y )
* plotScale ) * iuPerDeviceUnit ;
return DPOINT( x, y );
return DPOINT( x, y );
}
/**
......@@ -76,14 +76,14 @@ double PLOTTER::userToDeviceSize( double size )
}
/**
* Generic fallback: arc rendered as a polyline
/**
* Generic fallback: arc rendered as a polyline
*/
void PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius,
FILL_T fill, int width )
{
wxPoint start, end;
const int delta = 50; // increment (in 0.1 degrees) to draw circles
const int delta = 50; // increment (in 0.1 degrees) to draw circles
double alpha;
if( StAngle > EndAngle )
......@@ -112,7 +112,7 @@ void PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius,
/**
* Fallback: if it doesn't handle bitmaps, we plot a rectangle
*/
void PLOTTER::PlotImage(const wxImage & aImage, const wxPoint& aPos,
void PLOTTER::PlotImage(const wxImage & aImage, const wxPoint& aPos,
double aScaleFactor )
{
wxSize size( aImage.GetWidth() * aScaleFactor,
......@@ -236,7 +236,7 @@ void PLOTTER::markerVBar( const wxPoint& pos, int radius )
void PLOTTER::Marker( const wxPoint& position, int diametre, unsigned aShapeId )
{
int radius = diametre / 2;
/* Marker are composed by a series of 'parts' superimposed; not every
/* Marker are composed by a series of 'parts' superimposed; not every
combination make sense, obviously. Since they are used in order I
tried to keep the uglier/more complex constructions at the end.
Also I avoided the |/ |\ -/ -\ construction because they're *very*
......@@ -245,7 +245,7 @@ void PLOTTER::Marker( const wxPoint& position, int diametre, unsigned aShapeId )
If Visual C++ supported the 0b literals they would be optimally
and easily encoded as an integer array. We have to do with octal */
static const unsigned char marker_patterns[MARKER_COUNT] = {
// Bit order: O Square Lozenge - | \ /
// Bit order: O Square Lozenge - | \ /
// First choice: simple shapes
0003, // X
0100, // O
......@@ -316,32 +316,32 @@ void PLOTTER::Marker( const wxPoint& position, int diametre, unsigned aShapeId )
{
// Fallback shape
markerCircle( position, radius );
}
else
}
else
{
// Decode the pattern and draw the corresponding parts
unsigned char pat = marker_patterns[aShapeId];
if( pat & 0001 )
markerSlash( position, radius );
if( pat & 0002 )
markerBackSlash( position, radius );
if( pat & 0004 )
markerVBar( position, radius );
if( pat & 0010 )
markerHBar( position, radius );
if( pat & 0020 )
markerLozenge( position, radius );
if( pat & 0040 )
markerSquare( position, radius );
if( pat & 0100 )
markerCircle( position, radius );
if( pat & 0001 )
markerSlash( position, radius );
if( pat & 0002 )
markerBackSlash( position, radius );
if( pat & 0004 )
markerVBar( position, radius );
if( pat & 0010 )
markerHBar( position, radius );
if( pat & 0020 )
markerLozenge( position, radius );
if( pat & 0040 )
markerSquare( position, radius );
if( pat & 0100 )
markerCircle( position, radius );
}
}
/**
* Convert a thick segment and plot it as an oval
* Convert a thick segment and plot it as an oval
*/
void PLOTTER::segmentAsOval( const wxPoint& start, const wxPoint& end, int width,
EDA_DRAW_MODE_T tracemode )
......
/**
* @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 )
case PLOT_FORMAT_GERBER:
return GERBER_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT_SVG:
return SVG_PLOTTER::GetDefaultFileExtension();
default:
wxASSERT( false );
return wxEmptyString;
......
......@@ -129,7 +129,7 @@ void DIALOG_PLOT_SCHEMATIC_PDF::OnPlotCurrent( wxCommandEvent& event )
initOptVars();
createPDFFile();
m_MsgBox->AppendText( wxT( "*****\n" ) );
m_MsgBox->AppendText( wxT( "*\n" ) );
}
......@@ -143,7 +143,7 @@ void DIALOG_PLOT_SCHEMATIC_PDF::OnPlotAll( wxCommandEvent& event )
initOptVars();
createPDFFile();
m_MsgBox->AppendText( wxT( "*****\n" ) );
m_MsgBox->AppendText( wxT( "*\n" ) );
}
......
......@@ -20,11 +20,14 @@
* of the radio buttons in the plot panel/windows.
*/
enum PlotFormat {
PLOT_FORMAT_HPGL,
PLOT_FIRST_FORMAT = 0,
PLOT_FORMAT_HPGL = PLOT_FIRST_FORMAT,
PLOT_FORMAT_GERBER,
PLOT_FORMAT_POST,
PLOT_FORMAT_DXF,
PLOT_FORMAT_PDF
PLOT_FORMAT_PDF,
PLOT_FORMAT_SVG,
PLOT_LAST_FORMAT = PLOT_FORMAT_SVG
};
/**
......@@ -336,7 +339,8 @@ protected:
FILE* outputFile;
// 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 currentPenWidth;
/// Current pen state: 'U', 'D' or 'Z' (see PenTo)
......@@ -556,12 +560,12 @@ public:
static wxString GetDefaultFileExtension()
{
return wxString( wxT( "ps" ) );
return wxString( wxT( "ps" ) );
}
virtual PlotFormat GetPlotterType() const
{
return PLOT_FORMAT_POST;
return PLOT_FORMAT_POST;
}
virtual bool StartPlot( FILE* fout );
......@@ -608,12 +612,12 @@ public:
virtual PlotFormat GetPlotterType() const
{
return PLOT_FORMAT_PDF;
return PLOT_FORMAT_PDF;
}
static wxString GetDefaultFileExtension()
{
return wxString( wxT( "pdf" ) );
return wxString( wxT( "pdf" ) );
}
virtual bool StartPlot( FILE* fout );
......@@ -672,6 +676,87 @@ protected:
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 : */
#define FIRST_DCODE_VALUE 10 // D_CODE < 10 is a command, D_CODE >= 10 is a tool
......@@ -705,12 +790,12 @@ public:
virtual PlotFormat GetPlotterType() const
{
return PLOT_FORMAT_GERBER;
return PLOT_FORMAT_GERBER;
}
static wxString GetDefaultFileExtension()
{
return wxString( wxT( "pho" ) );
return wxString( wxT( "pho" ) );
}
virtual bool StartPlot( FILE* fout );
......@@ -772,12 +857,12 @@ public:
virtual PlotFormat GetPlotterType() const
{
return PLOT_FORMAT_DXF;
return PLOT_FORMAT_DXF;
}
static wxString GetDefaultFileExtension()
{
return wxString( wxT( "dxf" ) );
return wxString( wxT( "dxf" ) );
}
/**
......
......@@ -83,6 +83,7 @@ set(PCBNEW_DIALOGS
dialogs/dialog_pcbnew_config_libs_and_paths.cpp
dialogs/dialog_pcbnew_config_libs_and_paths_fbp.cpp
dialogs/dialog_plot_base.cpp
dialogs/dialog_plot.cpp
dialogs/dialog_print_for_modedit.cpp
dialogs/dialog_print_for_modedit_base.cpp
dialogs/dialog_print_using_printer.cpp
......
......@@ -215,7 +215,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll )
fn.SetName( fn.GetName() + wxT( "-brd" ) );
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(false);
fn.SetName( fn.GetName() + wxT( "-" ) + extraname );
......
......@@ -112,7 +112,6 @@ void DIALOG_GENDRILL::initDialog()
void DIALOG_GENDRILL::InitDisplayParams()
{
wxString msg;
const PCB_PLOT_PARAMS& plot_opts = m_board->GetPlotOptions();
m_Choice_Unit->SetSelection( m_UnitDrillIsInch ? 1 : 0 );
m_Choice_Precision->SetSelection( m_PrecisionFormat );
......@@ -137,14 +136,6 @@ void DIALOG_GENDRILL::InitDisplayParams()
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
// microvias drill value if so
m_throughViasCount = 0;
......@@ -289,7 +280,6 @@ void DIALOG_GENDRILL::UpdatePrecisionOptions()
void DIALOG_GENDRILL::SetParams()
{
wxString msg;
long ltmp;
PCB_PLOT_PARAMS plot_opts = m_board->GetPlotOptions();
......@@ -305,15 +295,7 @@ void DIALOG_GENDRILL::SetParams()
m_DrillOriginIsAuxAxis = m_Choice_Drill_Offset->GetSelection();
m_PrecisionFormat = m_Choice_Precision->GetSelection();
msg = m_PenSpeed->GetValue();
if( msg.ToLong( &ltmp ) )
plot_opts.SetHPGLPenSpeed( ltmp );
msg = m_PenNum->GetValue();
if( msg.ToLong( &ltmp ) )
plot_opts.SetHPGLPenNum( ltmp );
plot_opts.SetHPGLPenNum( 1 );
if( m_Choice_Drill_Offset->GetSelection() == 0 )
m_FileDrillOffset = wxPoint( 0, 0 );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_gendrill_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* m_LeftBoxSizer;
m_LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
wxString m_Choice_UnitChoices[] = { _("Millimeters"), _("Inches") };
int m_Choice_UnitNChoices = sizeof( m_Choice_UnitChoices ) / sizeof( wxString );
m_Choice_Unit = new wxRadioBox( this, wxID_ANY, _("Drill Units:"), wxDefaultPosition, wxDefaultSize, m_Choice_UnitNChoices, m_Choice_UnitChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Unit->SetSelection( 1 );
m_LeftBoxSizer->Add( m_Choice_Unit, 0, wxALL|wxEXPAND, 5 );
wxString m_Choice_Zeros_FormatChoices[] = { _("Decimal format"), _("Suppress leading zeros"), _("Suppress trailing zeros"), _("Keep zeros") };
int m_Choice_Zeros_FormatNChoices = sizeof( m_Choice_Zeros_FormatChoices ) / sizeof( wxString );
m_Choice_Zeros_Format = new wxRadioBox( this, wxID_ANY, _("Zeros Format"), wxDefaultPosition, wxDefaultSize, m_Choice_Zeros_FormatNChoices, m_Choice_Zeros_FormatChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Zeros_Format->SetSelection( 0 );
m_Choice_Zeros_Format->SetToolTip( _("Choose EXCELLON numbers notation") );
m_LeftBoxSizer->Add( m_Choice_Zeros_Format, 0, wxALL|wxEXPAND, 5 );
wxString m_Choice_PrecisionChoices[] = { _("2:3"), _("2:4") };
int m_Choice_PrecisionNChoices = sizeof( m_Choice_PrecisionChoices ) / sizeof( wxString );
m_Choice_Precision = new wxRadioBox( this, wxID_ANY, _("Precision"), wxDefaultPosition, wxDefaultSize, m_Choice_PrecisionNChoices, m_Choice_PrecisionChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Precision->SetSelection( 1 );
m_Choice_Precision->SetToolTip( _("Choose EXCELLON numbers precision") );
m_LeftBoxSizer->Add( m_Choice_Precision, 0, wxALL|wxEXPAND, 5 );
wxString m_Choice_Drill_OffsetChoices[] = { _("Absolute"), _("Auxiliary axis") };
int m_Choice_Drill_OffsetNChoices = sizeof( m_Choice_Drill_OffsetChoices ) / sizeof( wxString );
m_Choice_Drill_Offset = new wxRadioBox( this, wxID_ANY, _("Drill Origin:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_OffsetNChoices, m_Choice_Drill_OffsetChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Drill_Offset->SetSelection( 0 );
m_Choice_Drill_Offset->SetToolTip( _("Choose the coordinate origin: absolute or relative to the auxiliray axis") );
m_LeftBoxSizer->Add( m_Choice_Drill_Offset, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( m_LeftBoxSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bMiddleBoxSizer;
bMiddleBoxSizer = new wxBoxSizer( wxVERTICAL );
wxString m_Choice_Drill_MapChoices[] = { _("None"), _("Drill map (HPGL)"), _("Drill map (PostScript)"), _("Drill map (Gerber)"), _("Drill map (DXF)") };
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->SetSelection( 0 );
m_Choice_Drill_Map->SetToolTip( _("Creates a drill map in PS, HPGL or other formats") );
bMiddleBoxSizer->Add( m_Choice_Drill_Map, 0, wxALL|wxEXPAND, 5 );
wxString m_Choice_Drill_ReportChoices[] = { _("None"), _("Drill report") };
int m_Choice_Drill_ReportNChoices = sizeof( m_Choice_Drill_ReportChoices ) / sizeof( wxString );
m_Choice_Drill_Report = new wxRadioBox( this, wxID_ANY, _("Drill Report:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_ReportNChoices, m_Choice_Drill_ReportChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Drill_Report->SetSelection( 0 );
m_Choice_Drill_Report->SetToolTip( _("Creates a plain text report") );
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;
sbOptSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL );
m_Check_Mirror = new wxCheckBox( this, wxID_ANY, _("Mirror y axis"), wxDefaultPosition, wxDefaultSize, 0 );
sbOptSizer->Add( m_Check_Mirror, 0, wxRIGHT|wxLEFT, 5 );
m_Check_Minimal = new wxCheckBox( this, wxID_ANY, _("Minimal header"), wxDefaultPosition, wxDefaultSize, 0 );
sbOptSizer->Add( m_Check_Minimal, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
bMiddleBoxSizer->Add( sbOptSizer, 0, wxEXPAND, 5 );
bMainSizer->Add( bMiddleBoxSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bRightBoxSizer;
bRightBoxSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerInfo;
sbSizerInfo = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Info:") ), wxVERTICAL );
m_DefaultViasDrillSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Default Vias Drill:") ), wxVERTICAL );
m_ViaDrillValue = new wxStaticText( this, wxID_ANY, _("Via Drill Value"), wxDefaultPosition, wxDefaultSize, 0 );
m_ViaDrillValue->Wrap( -1 );
m_DefaultViasDrillSizer->Add( m_ViaDrillValue, 0, wxALL, 5 );
sbSizerInfo->Add( m_DefaultViasDrillSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_MicroViasDrillSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Micro Vias Drill:") ), wxVERTICAL );
m_MicroViaDrillValue = new wxStaticText( this, wxID_ANY, _("Micro Via Drill Value"), wxDefaultPosition, wxDefaultSize, 0 );
m_MicroViaDrillValue->Wrap( -1 );
m_MicroViasDrillSizer->Add( m_MicroViaDrillValue, 0, wxALL, 5 );
sbSizerInfo->Add( m_MicroViasDrillSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
wxStaticBoxSizer* sbSizerHoles;
sbSizerHoles = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Holes Count:") ), wxVERTICAL );
m_PlatedPadsCountInfoMsg = new wxStaticText( this, wxID_ANY, _("Plated Pads:"), wxDefaultPosition, wxDefaultSize, 0 );
m_PlatedPadsCountInfoMsg->Wrap( -1 );
sbSizerHoles->Add( m_PlatedPadsCountInfoMsg, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_NotPlatedPadsCountInfoMsg = new wxStaticText( this, wxID_ANY, _("Not Plated Pads:"), wxDefaultPosition, wxDefaultSize, 0 );
m_NotPlatedPadsCountInfoMsg->Wrap( -1 );
sbSizerHoles->Add( m_NotPlatedPadsCountInfoMsg, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ThroughViasInfoMsg = new wxStaticText( this, wxID_ANY, _("Through Vias:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ThroughViasInfoMsg->Wrap( -1 );
sbSizerHoles->Add( m_ThroughViasInfoMsg, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_MicroViasInfoMsg = new wxStaticText( this, wxID_ANY, _("Micro Vias:"), wxDefaultPosition, wxDefaultSize, 0 );
m_MicroViasInfoMsg->Wrap( -1 );
sbSizerHoles->Add( m_MicroViasInfoMsg, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_BuriedViasInfoMsg = new wxStaticText( this, wxID_ANY, _("Buried Vias:"), wxDefaultPosition, wxDefaultSize, 0 );
m_BuriedViasInfoMsg->Wrap( -1 );
sbSizerHoles->Add( m_BuriedViasInfoMsg, 0, wxALL, 5 );
sbSizerInfo->Add( sbSizerHoles, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
bRightBoxSizer->Add( sbSizerInfo, 0, wxEXPAND|wxTOP, 5 );
bRightBoxSizer->Add( 10, 10, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
m_OkButton = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
m_OkButton->SetDefault();
bRightBoxSizer->Add( m_OkButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_CancelButton = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bRightBoxSizer->Add( m_CancelButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
bMainSizer->Add( bRightBoxSizer, 1, wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
m_Choice_Unit->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnSelDrillUnitsSelected ), NULL, this );
m_Choice_Zeros_Format->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnSelZerosFmtSelected ), NULL, this );
m_OkButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnOkClick ), NULL, this );
m_CancelButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnCancelClick ), NULL, this );
}
DIALOG_GENDRILL_BASE::~DIALOG_GENDRILL_BASE()
{
// Disconnect Events
m_Choice_Unit->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnSelDrillUnitsSelected ), NULL, this );
m_Choice_Zeros_Format->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnSelZerosFmtSelected ), NULL, this );
m_OkButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnOkClick ), NULL, this );
m_CancelButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnCancelClick ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_gendrill_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* m_LeftBoxSizer;
m_LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
wxString m_Choice_UnitChoices[] = { _("Millimeters"), _("Inches") };
int m_Choice_UnitNChoices = sizeof( m_Choice_UnitChoices ) / sizeof( wxString );
m_Choice_Unit = new wxRadioBox( this, wxID_ANY, _("Drill Units:"), wxDefaultPosition, wxDefaultSize, m_Choice_UnitNChoices, m_Choice_UnitChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Unit->SetSelection( 1 );
m_LeftBoxSizer->Add( m_Choice_Unit, 0, wxALL|wxEXPAND, 5 );
wxString m_Choice_Zeros_FormatChoices[] = { _("Decimal format"), _("Suppress leading zeros"), _("Suppress trailing zeros"), _("Keep zeros") };
int m_Choice_Zeros_FormatNChoices = sizeof( m_Choice_Zeros_FormatChoices ) / sizeof( wxString );
m_Choice_Zeros_Format = new wxRadioBox( this, wxID_ANY, _("Zeros Format"), wxDefaultPosition, wxDefaultSize, m_Choice_Zeros_FormatNChoices, m_Choice_Zeros_FormatChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Zeros_Format->SetSelection( 0 );
m_Choice_Zeros_Format->SetToolTip( _("Choose EXCELLON numbers notation") );
m_LeftBoxSizer->Add( m_Choice_Zeros_Format, 0, wxALL|wxEXPAND, 5 );
wxString m_Choice_PrecisionChoices[] = { _("2:3"), _("2:4") };
int m_Choice_PrecisionNChoices = sizeof( m_Choice_PrecisionChoices ) / sizeof( wxString );
m_Choice_Precision = new wxRadioBox( this, wxID_ANY, _("Precision"), wxDefaultPosition, wxDefaultSize, m_Choice_PrecisionNChoices, m_Choice_PrecisionChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Precision->SetSelection( 1 );
m_Choice_Precision->SetToolTip( _("Choose EXCELLON numbers precision") );
m_LeftBoxSizer->Add( m_Choice_Precision, 0, wxALL|wxEXPAND, 5 );
wxString m_Choice_Drill_OffsetChoices[] = { _("Absolute"), _("Auxiliary axis") };
int m_Choice_Drill_OffsetNChoices = sizeof( m_Choice_Drill_OffsetChoices ) / sizeof( wxString );
m_Choice_Drill_Offset = new wxRadioBox( this, wxID_ANY, _("Drill Origin:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_OffsetNChoices, m_Choice_Drill_OffsetChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Drill_Offset->SetSelection( 0 );
m_Choice_Drill_Offset->SetToolTip( _("Choose the coordinate origin: absolute or relative to the auxiliray axis") );
m_LeftBoxSizer->Add( m_Choice_Drill_Offset, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( m_LeftBoxSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bMiddleBoxSizer;
bMiddleBoxSizer = new wxBoxSizer( wxVERTICAL );
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 );
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->SetToolTip( _("Creates a drill map in PS, HPGL or other formats") );
bMiddleBoxSizer->Add( m_Choice_Drill_Map, 0, wxALL|wxEXPAND, 5 );
wxString m_Choice_Drill_ReportChoices[] = { _("None"), _("Drill report") };
int m_Choice_Drill_ReportNChoices = sizeof( m_Choice_Drill_ReportChoices ) / sizeof( wxString );
m_Choice_Drill_Report = new wxRadioBox( this, wxID_ANY, _("Drill Report:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_ReportNChoices, m_Choice_Drill_ReportChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Drill_Report->SetSelection( 0 );
m_Choice_Drill_Report->SetToolTip( _("Creates a plain text report") );
bMiddleBoxSizer->Add( m_Choice_Drill_Report, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbOptSizer;
sbOptSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL );
m_Check_Mirror = new wxCheckBox( this, wxID_ANY, _("Mirror y axis"), wxDefaultPosition, wxDefaultSize, 0 );
sbOptSizer->Add( m_Check_Mirror, 0, wxRIGHT|wxLEFT, 5 );
m_Check_Minimal = new wxCheckBox( this, wxID_ANY, _("Minimal header"), wxDefaultPosition, wxDefaultSize, 0 );
sbOptSizer->Add( m_Check_Minimal, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
bMiddleBoxSizer->Add( sbOptSizer, 0, wxEXPAND, 5 );
bMainSizer->Add( bMiddleBoxSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bRightBoxSizer;
bRightBoxSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerInfo;
sbSizerInfo = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Info:") ), wxVERTICAL );
m_DefaultViasDrillSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Default Vias Drill:") ), wxVERTICAL );
m_ViaDrillValue = new wxStaticText( this, wxID_ANY, _("Via Drill Value"), wxDefaultPosition, wxDefaultSize, 0 );
m_ViaDrillValue->Wrap( -1 );
m_DefaultViasDrillSizer->Add( m_ViaDrillValue, 0, wxALL, 5 );
sbSizerInfo->Add( m_DefaultViasDrillSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_MicroViasDrillSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Micro Vias Drill:") ), wxVERTICAL );
m_MicroViaDrillValue = new wxStaticText( this, wxID_ANY, _("Micro Via Drill Value"), wxDefaultPosition, wxDefaultSize, 0 );
m_MicroViaDrillValue->Wrap( -1 );
m_MicroViasDrillSizer->Add( m_MicroViaDrillValue, 0, wxALL, 5 );
sbSizerInfo->Add( m_MicroViasDrillSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
wxStaticBoxSizer* sbSizerHoles;
sbSizerHoles = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Holes Count:") ), wxVERTICAL );
m_PlatedPadsCountInfoMsg = new wxStaticText( this, wxID_ANY, _("Plated Pads:"), wxDefaultPosition, wxDefaultSize, 0 );
m_PlatedPadsCountInfoMsg->Wrap( -1 );
sbSizerHoles->Add( m_PlatedPadsCountInfoMsg, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_NotPlatedPadsCountInfoMsg = new wxStaticText( this, wxID_ANY, _("Not Plated Pads:"), wxDefaultPosition, wxDefaultSize, 0 );
m_NotPlatedPadsCountInfoMsg->Wrap( -1 );
sbSizerHoles->Add( m_NotPlatedPadsCountInfoMsg, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ThroughViasInfoMsg = new wxStaticText( this, wxID_ANY, _("Through Vias:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ThroughViasInfoMsg->Wrap( -1 );
sbSizerHoles->Add( m_ThroughViasInfoMsg, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_MicroViasInfoMsg = new wxStaticText( this, wxID_ANY, _("Micro Vias:"), wxDefaultPosition, wxDefaultSize, 0 );
m_MicroViasInfoMsg->Wrap( -1 );
sbSizerHoles->Add( m_MicroViasInfoMsg, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_BuriedViasInfoMsg = new wxStaticText( this, wxID_ANY, _("Buried Vias:"), wxDefaultPosition, wxDefaultSize, 0 );
m_BuriedViasInfoMsg->Wrap( -1 );
sbSizerHoles->Add( m_BuriedViasInfoMsg, 0, wxALL, 5 );
sbSizerInfo->Add( sbSizerHoles, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
bRightBoxSizer->Add( sbSizerInfo, 0, wxEXPAND|wxTOP, 5 );
bRightBoxSizer->Add( 10, 10, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
m_OkButton = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
m_OkButton->SetDefault();
bRightBoxSizer->Add( m_OkButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_CancelButton = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bRightBoxSizer->Add( m_CancelButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
bMainSizer->Add( bRightBoxSizer, 1, wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_Choice_Unit->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnSelDrillUnitsSelected ), NULL, this );
m_Choice_Zeros_Format->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnSelZerosFmtSelected ), NULL, this );
m_OkButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnOkClick ), NULL, this );
m_CancelButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnCancelClick ), NULL, this );
}
DIALOG_GENDRILL_BASE::~DIALOG_GENDRILL_BASE()
{
// Disconnect Events
m_Choice_Unit->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnSelDrillUnitsSelected ), NULL, this );
m_Choice_Zeros_Format->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnSelZerosFmtSelected ), NULL, this );
m_OkButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnOkClick ), NULL, this );
m_CancelButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnCancelClick ), NULL, this );
}
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_GENDRILL_BASE_H__
#define __DIALOG_GENDRILL_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GENDRILL_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GENDRILL_BASE : public DIALOG_SHIM
{
private:
protected:
wxRadioBox* m_Choice_Unit;
wxRadioBox* m_Choice_Zeros_Format;
wxRadioBox* m_Choice_Precision;
wxRadioBox* m_Choice_Drill_Offset;
wxRadioBox* m_Choice_Drill_Map;
wxRadioBox* m_Choice_Drill_Report;
wxStaticText* m_staticText1;
wxTextCtrl* m_PenSpeed;
wxStaticText* m_staticText2;
wxTextCtrl* m_PenNum;
wxCheckBox* m_Check_Mirror;
wxCheckBox* m_Check_Minimal;
wxStaticBoxSizer* m_DefaultViasDrillSizer;
wxStaticText* m_ViaDrillValue;
wxStaticBoxSizer* m_MicroViasDrillSizer;
wxStaticText* m_MicroViaDrillValue;
wxStaticText* m_PlatedPadsCountInfoMsg;
wxStaticText* m_NotPlatedPadsCountInfoMsg;
wxStaticText* m_ThroughViasInfoMsg;
wxStaticText* m_MicroViasInfoMsg;
wxStaticText* m_BuriedViasInfoMsg;
wxButton* m_OkButton;
wxButton* m_CancelButton;
// Virtual event handlers, overide them in your derived class
virtual void OnSelDrillUnitsSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelZerosFmtSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
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();
};
#endif //__DIALOG_GENDRILL_BASE_H__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_GENDRILL_BASE_H__
#define __DIALOG_GENDRILL_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GENDRILL_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GENDRILL_BASE : public DIALOG_SHIM
{
private:
protected:
wxRadioBox* m_Choice_Unit;
wxRadioBox* m_Choice_Zeros_Format;
wxRadioBox* m_Choice_Precision;
wxRadioBox* m_Choice_Drill_Offset;
wxRadioBox* m_Choice_Drill_Map;
wxRadioBox* m_Choice_Drill_Report;
wxCheckBox* m_Check_Mirror;
wxCheckBox* m_Check_Minimal;
wxStaticBoxSizer* m_DefaultViasDrillSizer;
wxStaticText* m_ViaDrillValue;
wxStaticBoxSizer* m_MicroViasDrillSizer;
wxStaticText* m_MicroViaDrillValue;
wxStaticText* m_PlatedPadsCountInfoMsg;
wxStaticText* m_NotPlatedPadsCountInfoMsg;
wxStaticText* m_ThroughViasInfoMsg;
wxStaticText* m_MicroViasInfoMsg;
wxStaticText* m_BuriedViasInfoMsg;
wxButton* m_OkButton;
wxButton* m_CancelButton;
// Virtual event handlers, overide them in your derived class
virtual void OnSelDrillUnitsSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelZerosFmtSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
public:
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();
};
#endif //__DIALOG_GENDRILL_BASE_H__
/**
* @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)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_plot_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
m_MainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer12;
bSizer12 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer26;
bSizer26 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer27;
bSizer27 = new wxBoxSizer( wxVERTICAL );
m_staticText121 = new wxStaticText( this, wxID_ANY, _("Plot format:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText121->Wrap( -1 );
bSizer27->Add( m_staticText121, 0, wxTOP, 5 );
wxString m_plotFormatOptChoices[] = { _("HPGL"), _("Gerber"), _("Postscript"), _("DXF") };
int m_plotFormatOptNChoices = sizeof( m_plotFormatOptChoices ) / sizeof( wxString );
m_plotFormatOpt = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_plotFormatOptNChoices, m_plotFormatOptChoices, 0 );
m_plotFormatOpt->SetSelection( 0 );
bSizer27->Add( m_plotFormatOpt, 0, 0, 5 );
bSizer26->Add( bSizer27, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizer28;
bSizer28 = new wxBoxSizer( wxVERTICAL );
m_staticTextDir = new wxStaticText( this, wxID_ANY, _("Output directory:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDir->Wrap( -1 );
bSizer28->Add( m_staticTextDir, 0, wxEXPAND|wxTOP|wxLEFT, 5 );
wxBoxSizer* bSizer29;
bSizer29 = new wxBoxSizer( wxHORIZONTAL );
m_outputDirectoryName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_outputDirectoryName->SetToolTip( _("Target directory for plot files. Can be absolute or relative to the board file location.") );
bSizer29->Add( m_outputDirectoryName, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_browseButton = new wxButton( this, wxID_ANY, _("Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
bSizer29->Add( m_browseButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
bSizer28->Add( bSizer29, 1, wxEXPAND, 5 );
bSizer26->Add( bSizer28, 1, 0, 5 );
bSizer12->Add( bSizer26, 0, wxEXPAND, 5 );
wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
m_LayersSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Layers") ), wxHORIZONTAL );
wxArrayString m_layerCheckListBoxChoices;
m_layerCheckListBox = new wxCheckListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_layerCheckListBoxChoices, 0 );
m_LayersSizer->Add( m_layerCheckListBox, 1, wxEXPAND, 5 );
bUpperSizer->Add( m_LayersSizer, 1, wxALL|wxEXPAND, 3 );
m_PlotOptionsSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbOptionsSizer;
sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL );
wxBoxSizer* bSizer192;
bSizer192 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerPlotItems;
bSizerPlotItems = new wxBoxSizer( wxVERTICAL );
m_plotSheetRef = new wxCheckBox( this, wxID_ANY, _("Plot sheet reference on all layers"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPlotItems->Add( m_plotSheetRef, 0, wxTOP|wxRIGHT|wxLEFT, 2 );
m_plotPads_on_Silkscreen = new wxCheckBox( this, ID_ALLOW_PRINT_PAD_ON_SILKSCREEN, _("Plot pads on silkscreen"), wxDefaultPosition, wxDefaultSize, 0 );
m_plotPads_on_Silkscreen->SetToolTip( _("Enable/disable print/plot pads on silkscreen layers\nWhen disable, pads are never potted on silkscreen layers\nWhen enable, pads are potted only if they appear on silkscreen layers") );
bSizerPlotItems->Add( m_plotPads_on_Silkscreen, 0, wxTOP|wxRIGHT|wxLEFT, 2 );
m_plotModuleValueOpt = new wxCheckBox( this, wxID_ANY, _("Plot module value on silkscreen"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPlotItems->Add( m_plotModuleValueOpt, 0, wxTOP|wxRIGHT|wxLEFT, 2 );
m_plotModuleRefOpt = new wxCheckBox( this, ID_PRINT_REF, _("Plot module reference on silkscreen"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPlotItems->Add( m_plotModuleRefOpt, 0, wxTOP|wxRIGHT|wxLEFT, 2 );
m_plotTextOther = new wxCheckBox( this, wxID_ANY, _("Plot other module texts on silkscreen"), wxDefaultPosition, wxDefaultSize, 0 );
m_plotTextOther->SetToolTip( _("Enable/disable print/plot module field texts on silkscreen layers") );
bSizerPlotItems->Add( m_plotTextOther, 0, wxTOP|wxRIGHT|wxLEFT, 2 );
m_plotInvisibleText = new wxCheckBox( this, wxID_ANY, _("Plot invisible texts on silkscreen"), wxDefaultPosition, wxDefaultSize, 0 );
m_plotInvisibleText->SetToolTip( _("Force print/plot module invisible texts on silkscreen layers") );
bSizerPlotItems->Add( m_plotInvisibleText, 0, wxALL, 2 );
m_plotNoViaOnMaskOpt = new wxCheckBox( this, wxID_ANY, _("Do not tent vias"), wxDefaultPosition, wxDefaultSize, 0 );
m_plotNoViaOnMaskOpt->SetToolTip( _("Remove soldermask on vias.") );
bSizerPlotItems->Add( m_plotNoViaOnMaskOpt, 0, wxALL, 2 );
m_plotMirrorOpt = new wxCheckBox( this, ID_MIROR_OPT, _("Mirrored plot"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPlotItems->Add( m_plotMirrorOpt, 0, wxALL, 2 );
bSizer192->Add( bSizerPlotItems, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer14;
bSizer14 = new wxBoxSizer( wxVERTICAL );
m_staticText11 = new wxStaticText( this, wxID_ANY, _("Drill marks:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText11->Wrap( -1 );
bSizer14->Add( m_staticText11, 0, wxRIGHT|wxLEFT, 5 );
wxString m_drillShapeOptChoices[] = { _("None"), _("Small"), _("Actual size") };
int m_drillShapeOptNChoices = sizeof( m_drillShapeOptChoices ) / sizeof( wxString );
m_drillShapeOpt = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_drillShapeOptNChoices, m_drillShapeOptChoices, 0 );
m_drillShapeOpt->SetSelection( 0 );
bSizer14->Add( m_drillShapeOpt, 0, wxEXPAND|wxLEFT, 5 );
m_staticText12 = new wxStaticText( this, wxID_ANY, _("Scaling:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText12->Wrap( -1 );
bSizer14->Add( m_staticText12, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxString m_scaleOptChoices[] = { _("Auto"), _("1:1"), _("3:2"), _("2:1"), _("3:1") };
int m_scaleOptNChoices = sizeof( m_scaleOptChoices ) / sizeof( wxString );
m_scaleOpt = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_scaleOptNChoices, m_scaleOptChoices, 0 );
m_scaleOpt->SetSelection( 0 );
bSizer14->Add( m_scaleOpt, 0, wxEXPAND|wxLEFT, 5 );
m_staticText13 = new wxStaticText( this, wxID_ANY, _("Plot mode:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText13->Wrap( -1 );
bSizer14->Add( m_staticText13, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxString m_plotModeOptChoices[] = { _("Line"), _("Filled"), _("Sketch") };
int m_plotModeOptNChoices = sizeof( m_plotModeOptChoices ) / sizeof( wxString );
m_plotModeOpt = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_plotModeOptNChoices, m_plotModeOptChoices, 0 );
m_plotModeOpt->SetSelection( 0 );
bSizer14->Add( m_plotModeOpt, 0, wxEXPAND|wxLEFT, 5 );
m_textDefaultPenSize = new wxStaticText( this, wxID_ANY, _("Default linewidth"), wxDefaultPosition, wxDefaultSize, 0 );
m_textDefaultPenSize->Wrap( -1 );
m_textDefaultPenSize->SetToolTip( _("Pen size used to draw items that have no pen size specified.\nUsed mainly to draw items in sketch mode.") );
bSizer14->Add( m_textDefaultPenSize, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_linesWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_linesWidth->SetToolTip( _("Line width for, e.g., sheet references.") );
bSizer14->Add( m_linesWidth, 0, wxBOTTOM|wxEXPAND|wxLEFT, 5 );
bSizer192->Add( bSizer14, 1, wxRIGHT|wxLEFT, 3 );
sbOptionsSizer->Add( bSizer192, 0, wxEXPAND, 5 );
m_PlotOptionsSizer->Add( sbOptionsSizer, 0, wxALL|wxEXPAND, 3 );
m_GerberOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Gerber Options") ), wxVERTICAL );
m_useGerberExtensions = new wxCheckBox( this, wxID_ANY, _("Use proper filename extensions"), wxDefaultPosition, wxDefaultSize, 0 );
m_useGerberExtensions->SetToolTip( _("Use proper Gerber extensions - .GBL, .GTL, etc...") );
m_GerberOptionsSizer->Add( m_useGerberExtensions, 0, wxLEFT|wxRIGHT|wxTOP, 2 );
m_excludeEdgeLayerOpt = new wxCheckBox( this, wxID_ANY, _("Exclude PCB edge layer from other layers"), wxDefaultPosition, wxDefaultSize, 0 );
m_excludeEdgeLayerOpt->SetToolTip( _("Exclude contents of the pcb edge layer from all other layers") );
m_GerberOptionsSizer->Add( m_excludeEdgeLayerOpt, 0, wxTOP|wxRIGHT|wxLEFT, 2 );
m_subtractMaskFromSilk = new wxCheckBox( this, wxID_ANY, _("Subtract soldermask from silkscreen"), wxDefaultPosition, wxDefaultSize, 0 );
m_subtractMaskFromSilk->SetToolTip( _("Remove silkscreen from areas without soldermask") );
m_GerberOptionsSizer->Add( m_subtractMaskFromSilk, 0, wxTOP|wxRIGHT|wxLEFT, 2 );
m_useAuxOriginCheckBox = new wxCheckBox( this, wxID_ANY, _("Use auxiliary axis as origin"), wxDefaultPosition, wxDefaultSize, 0 );
m_useAuxOriginCheckBox->SetToolTip( _("Use auxiliary axis as coordinates origin in Gerber files.") );
m_GerberOptionsSizer->Add( m_useAuxOriginCheckBox, 0, wxALL, 2 );
m_PlotOptionsSizer->Add( m_GerberOptionsSizer, 0, wxALL|wxEXPAND, 3 );
m_HPGLOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("HPGL Options") ), wxVERTICAL );
wxBoxSizer* bSizer22;
bSizer22 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer20;
bSizer20 = new wxBoxSizer( wxVERTICAL );
m_textPenSize = new wxStaticText( this, wxID_ANY, _("Pen size"), wxDefaultPosition, wxDefaultSize, 0 );
m_textPenSize->Wrap( -1 );
bSizer20->Add( m_textPenSize, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_HPGLPenSizeOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer20->Add( m_HPGLPenSizeOpt, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_textPenOvr = new wxStaticText( this, wxID_ANY, _("Pen overlay"), wxDefaultPosition, wxDefaultSize, 0 );
m_textPenOvr->Wrap( -1 );
bSizer20->Add( m_textPenOvr, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_HPGLPenOverlayOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_HPGLPenOverlayOpt->SetToolTip( _("Set plot overlay for filling") );
bSizer20->Add( m_HPGLPenOverlayOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizer22->Add( bSizer20, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer21;
bSizer21 = new wxBoxSizer( wxVERTICAL );
m_textPenSpeed = new wxStaticText( this, wxID_ANY, _("Pen speed (cm/s):"), wxDefaultPosition, wxDefaultSize, 0 );
m_textPenSpeed->Wrap( -1 );
bSizer21->Add( m_textPenSpeed, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_HPGLPenSpeedOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_HPGLPenSpeedOpt->SetToolTip( _("Set pen speed in cm/s") );
bSizer21->Add( m_HPGLPenSpeedOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizer22->Add( bSizer21, 1, wxEXPAND, 5 );
m_HPGLOptionsSizer->Add( bSizer22, 1, wxEXPAND, 5 );
m_PlotOptionsSizer->Add( m_HPGLOptionsSizer, 0, wxALL|wxEXPAND, 3 );
m_PSOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Postscript Options") ), wxVERTICAL );
wxBoxSizer* bSizer17;
bSizer17 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer18;
bSizer18 = new wxBoxSizer( wxVERTICAL );
m_staticText7 = new wxStaticText( this, wxID_ANY, _("X scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 );
bSizer18->Add( m_staticText7, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_fineAdjustXscaleOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_fineAdjustXscaleOpt->SetToolTip( _("Set global X scale adjust for exact scale postscript output.") );
bSizer18->Add( m_fineAdjustXscaleOpt, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizer17->Add( bSizer18, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer19;
bSizer19 = new wxBoxSizer( wxVERTICAL );
m_staticText8 = new wxStaticText( this, wxID_ANY, _("Y scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText8->Wrap( -1 );
bSizer19->Add( m_staticText8, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_fineAdjustYscaleOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_fineAdjustYscaleOpt->SetToolTip( _("Set global Y scale adjust for exact scale postscript output.") );
bSizer19->Add( m_fineAdjustYscaleOpt, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizer17->Add( bSizer19, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer191;
bSizer191 = new wxBoxSizer( wxVERTICAL );
m_textPSFineAdjustWidth = new wxStaticText( this, wxID_ANY, _("Width correction"), wxDefaultPosition, wxDefaultSize, 0 );
m_textPSFineAdjustWidth->Wrap( -1 );
bSizer191->Add( m_textPSFineAdjustWidth, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_PSFineAdjustWidthOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_PSFineAdjustWidthOpt->SetToolTip( _("Set global width correction for exact width postscript output.\nThese width correction is intended to compensate tracks width and also pads and vias size errors.\nThe reasonable width correction value must be in a range of [-(MinTrackWidth-1), +(MinClearanceValue-1)] in decimils.") );
bSizer191->Add( m_PSFineAdjustWidthOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
bSizer17->Add( bSizer191, 1, wxEXPAND, 5 );
m_PSOptionsSizer->Add( bSizer17, 1, wxEXPAND, 5 );
m_plotPSNegativeOpt = new wxCheckBox( this, wxID_ANY, _("Negative plot"), wxDefaultPosition, wxDefaultSize, 0 );
m_PSOptionsSizer->Add( m_plotPSNegativeOpt, 0, wxALL, 2 );
m_forcePSA4OutputOpt = new wxCheckBox( this, wxID_ANY, _("Force A4 output"), wxDefaultPosition, wxDefaultSize, 0 );
m_PSOptionsSizer->Add( m_forcePSA4OutputOpt, 0, wxALL, 2 );
m_PlotOptionsSizer->Add( m_PSOptionsSizer, 0, wxALL|wxEXPAND, 3 );
bUpperSizer->Add( m_PlotOptionsSizer, 0, 0, 5 );
bSizer12->Add( bUpperSizer, 0, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerMsg;
sbSizerMsg = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Messages:") ), wxVERTICAL );
m_messagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
m_messagesBox->SetMinSize( wxSize( -1,70 ) );
sbSizerMsg->Add( m_messagesBox, 1, wxEXPAND, 5 );
bSizer12->Add( sbSizerMsg, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerButtons;
bSizerButtons = new wxBoxSizer( wxHORIZONTAL );
m_plotButton = new wxButton( this, wxID_ANY, _("Plot"), wxDefaultPosition, wxDefaultSize, 0 );
m_plotButton->SetDefault();
bSizerButtons->Add( m_plotButton, 0, wxALL, 5 );
m_buttonDrill = new wxButton( this, ID_CREATE_DRILL_FILE, _("Generate Drill File"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonDrill, 0, wxALL, 5 );
m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonQuit, 0, wxALL, 5 );
bSizer12->Add( bSizerButtons, 0, wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 );
m_MainSizer->Add( bSizer12, 1, wxALL|wxEXPAND, 5 );
this->SetSizer( m_MainSizer );
this->Layout();
m_MainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_BASE::OnClose ) );
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PLOT_BASE::OnInitDialog ) );
m_plotFormatOpt->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::SetPlotFormat ), NULL, this );
m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
m_scaleOpt->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnSetScaleOpt ), NULL, this );
m_plotButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::Plot ), NULL, this );
m_buttonDrill->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this );
m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnQuit ), NULL, this );
}
DIALOG_PLOT_BASE::~DIALOG_PLOT_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_BASE::OnClose ) );
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PLOT_BASE::OnInitDialog ) );
m_plotFormatOpt->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::SetPlotFormat ), NULL, this );
m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
m_scaleOpt->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnSetScaleOpt ), NULL, this );
m_plotButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::Plot ), NULL, this );
m_buttonDrill->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this );
m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnQuit ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_plot_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
m_MainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer12;
bSizer12 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer26;
bSizer26 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer27;
bSizer27 = new wxBoxSizer( wxVERTICAL );
m_staticText121 = new wxStaticText( this, wxID_ANY, _("Plot format:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText121->Wrap( -1 );
bSizer27->Add( m_staticText121, 0, wxTOP, 5 );
wxString m_plotFormatOptChoices[] = { _("Gerber"), _("Postscript"), _("SVG"), _("DXF"), _("HPGL") };
int m_plotFormatOptNChoices = sizeof( m_plotFormatOptChoices ) / sizeof( wxString );
m_plotFormatOpt = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_plotFormatOptNChoices, m_plotFormatOptChoices, 0 );
m_plotFormatOpt->SetSelection( 0 );
bSizer27->Add( m_plotFormatOpt, 0, 0, 5 );
bSizer26->Add( bSizer27, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizer28;
bSizer28 = new wxBoxSizer( wxVERTICAL );
m_staticTextDir = new wxStaticText( this, wxID_ANY, _("Output directory:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDir->Wrap( -1 );
bSizer28->Add( m_staticTextDir, 0, wxEXPAND|wxTOP|wxLEFT, 5 );
wxBoxSizer* bSizer29;
bSizer29 = new wxBoxSizer( wxHORIZONTAL );
m_outputDirectoryName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_outputDirectoryName->SetToolTip( _("Target directory for plot files. Can be absolute or relative to the board file location.") );
bSizer29->Add( m_outputDirectoryName, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_browseButton = new wxButton( this, wxID_ANY, _("Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
bSizer29->Add( m_browseButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
bSizer28->Add( bSizer29, 1, wxEXPAND, 5 );
bSizer26->Add( bSizer28, 1, 0, 5 );
bSizer12->Add( bSizer26, 0, wxEXPAND, 5 );
wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
m_LayersSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Layers") ), wxHORIZONTAL );
wxArrayString m_layerCheckListBoxChoices;
m_layerCheckListBox = new wxCheckListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_layerCheckListBoxChoices, 0 );
m_LayersSizer->Add( m_layerCheckListBox, 1, wxEXPAND, 5 );
bUpperSizer->Add( m_LayersSizer, 1, wxALL|wxEXPAND, 3 );
m_PlotOptionsSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbOptionsSizer;
sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL );
wxBoxSizer* bSizer192;
bSizer192 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerPlotItems;
bSizerPlotItems = new wxBoxSizer( wxVERTICAL );
m_plotSheetRef = new wxCheckBox( this, wxID_ANY, _("Plot sheet reference on all layers"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPlotItems->Add( m_plotSheetRef, 0, wxTOP|wxRIGHT|wxLEFT, 2 );
m_plotPads_on_Silkscreen = new wxCheckBox( this, ID_ALLOW_PRINT_PAD_ON_SILKSCREEN, _("Plot pads on silkscreen"), wxDefaultPosition, wxDefaultSize, 0 );
m_plotPads_on_Silkscreen->SetToolTip( _("Enable/disable print/plot pads on silkscreen layers\nWhen disable, pads are never potted on silkscreen layers\nWhen enable, pads are potted only if they appear on silkscreen layers") );
bSizerPlotItems->Add( m_plotPads_on_Silkscreen, 0, wxTOP|wxRIGHT|wxLEFT, 2 );
m_plotModuleValueOpt = new wxCheckBox( this, wxID_ANY, _("Plot module value on silkscreen"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPlotItems->Add( m_plotModuleValueOpt, 0, wxTOP|wxRIGHT|wxLEFT, 2 );
m_plotModuleRefOpt = new wxCheckBox( this, ID_PRINT_REF, _("Plot module reference on silkscreen"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPlotItems->Add( m_plotModuleRefOpt, 0, wxTOP|wxRIGHT|wxLEFT, 2 );
m_plotTextOther = new wxCheckBox( this, wxID_ANY, _("Plot other module texts on silkscreen"), wxDefaultPosition, wxDefaultSize, 0 );
m_plotTextOther->SetToolTip( _("Enable/disable print/plot module field texts on silkscreen layers") );
bSizerPlotItems->Add( m_plotTextOther, 0, wxTOP|wxRIGHT|wxLEFT, 2 );
m_plotInvisibleText = new wxCheckBox( this, wxID_ANY, _("Plot invisible texts on silkscreen"), wxDefaultPosition, wxDefaultSize, 0 );
m_plotInvisibleText->SetToolTip( _("Force print/plot module invisible texts on silkscreen layers") );
bSizerPlotItems->Add( m_plotInvisibleText, 0, wxALL, 2 );
m_plotNoViaOnMaskOpt = new wxCheckBox( this, wxID_ANY, _("Do not tent vias"), wxDefaultPosition, wxDefaultSize, 0 );
m_plotNoViaOnMaskOpt->SetToolTip( _("Remove soldermask on vias.") );
bSizerPlotItems->Add( m_plotNoViaOnMaskOpt, 0, wxALL, 2 );
m_plotMirrorOpt = new wxCheckBox( this, ID_MIROR_OPT, _("Mirrored plot"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPlotItems->Add( m_plotMirrorOpt, 0, wxALL, 2 );
bSizer192->Add( bSizerPlotItems, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer14;
bSizer14 = new wxBoxSizer( wxVERTICAL );
m_staticText11 = new wxStaticText( this, wxID_ANY, _("Drill marks:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText11->Wrap( -1 );
bSizer14->Add( m_staticText11, 0, wxRIGHT|wxLEFT, 5 );
wxString m_drillShapeOptChoices[] = { _("None"), _("Small"), _("Actual size") };
int m_drillShapeOptNChoices = sizeof( m_drillShapeOptChoices ) / sizeof( wxString );
m_drillShapeOpt = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_drillShapeOptNChoices, m_drillShapeOptChoices, 0 );
m_drillShapeOpt->SetSelection( 0 );
bSizer14->Add( m_drillShapeOpt, 0, wxEXPAND|wxLEFT, 5 );
m_staticText12 = new wxStaticText( this, wxID_ANY, _("Scaling:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText12->Wrap( -1 );
bSizer14->Add( m_staticText12, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxString m_scaleOptChoices[] = { _("Auto"), _("1:1"), _("3:2"), _("2:1"), _("3:1") };
int m_scaleOptNChoices = sizeof( m_scaleOptChoices ) / sizeof( wxString );
m_scaleOpt = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_scaleOptNChoices, m_scaleOptChoices, 0 );
m_scaleOpt->SetSelection( 1 );
bSizer14->Add( m_scaleOpt, 0, wxEXPAND|wxLEFT, 5 );
m_staticText13 = new wxStaticText( this, wxID_ANY, _("Plot mode:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText13->Wrap( -1 );
bSizer14->Add( m_staticText13, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxString m_plotModeOptChoices[] = { _("Line"), _("Filled"), _("Sketch") };
int m_plotModeOptNChoices = sizeof( m_plotModeOptChoices ) / sizeof( wxString );
m_plotModeOpt = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_plotModeOptNChoices, m_plotModeOptChoices, 0 );
m_plotModeOpt->SetSelection( 0 );
bSizer14->Add( m_plotModeOpt, 0, wxEXPAND|wxLEFT, 5 );
m_textDefaultPenSize = new wxStaticText( this, wxID_ANY, _("Default linewidth"), wxDefaultPosition, wxDefaultSize, 0 );
m_textDefaultPenSize->Wrap( -1 );
m_textDefaultPenSize->SetToolTip( _("Pen size used to draw items that have no pen size specified.\nUsed mainly to draw items in sketch mode.") );
bSizer14->Add( m_textDefaultPenSize, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_linesWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_linesWidth->SetToolTip( _("Line width for, e.g., sheet references.") );
bSizer14->Add( m_linesWidth, 0, wxBOTTOM|wxEXPAND|wxLEFT, 5 );
bSizer192->Add( bSizer14, 1, wxRIGHT|wxLEFT, 3 );
sbOptionsSizer->Add( bSizer192, 0, wxEXPAND, 5 );
m_PlotOptionsSizer->Add( sbOptionsSizer, 0, wxALL|wxEXPAND, 3 );
m_GerberOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Gerber Options") ), wxVERTICAL );
m_useGerberExtensions = new wxCheckBox( this, wxID_ANY, _("Use proper filename extensions"), wxDefaultPosition, wxDefaultSize, 0 );
m_useGerberExtensions->SetToolTip( _("Use proper Gerber extensions - .GBL, .GTL, etc...") );
m_GerberOptionsSizer->Add( m_useGerberExtensions, 0, wxLEFT|wxRIGHT|wxTOP, 2 );
m_excludeEdgeLayerOpt = new wxCheckBox( this, wxID_ANY, _("Exclude PCB edge layer from other layers"), wxDefaultPosition, wxDefaultSize, 0 );
m_excludeEdgeLayerOpt->SetToolTip( _("Exclude contents of the pcb edge layer from all other layers") );
m_GerberOptionsSizer->Add( m_excludeEdgeLayerOpt, 0, wxTOP|wxRIGHT|wxLEFT, 2 );
m_subtractMaskFromSilk = new wxCheckBox( this, wxID_ANY, _("Subtract soldermask from silkscreen"), wxDefaultPosition, wxDefaultSize, 0 );
m_subtractMaskFromSilk->SetToolTip( _("Remove silkscreen from areas without soldermask") );
m_GerberOptionsSizer->Add( m_subtractMaskFromSilk, 0, wxTOP|wxRIGHT|wxLEFT, 2 );
m_useAuxOriginCheckBox = new wxCheckBox( this, wxID_ANY, _("Use auxiliary axis as origin"), wxDefaultPosition, wxDefaultSize, 0 );
m_useAuxOriginCheckBox->SetToolTip( _("Use auxiliary axis as coordinates origin in Gerber files.") );
m_GerberOptionsSizer->Add( m_useAuxOriginCheckBox, 0, wxALL, 2 );
m_PlotOptionsSizer->Add( m_GerberOptionsSizer, 0, wxALL|wxEXPAND, 3 );
m_HPGLOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("HPGL Options") ), wxVERTICAL );
wxBoxSizer* bSizer22;
bSizer22 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer20;
bSizer20 = new wxBoxSizer( wxVERTICAL );
m_textPenSize = new wxStaticText( this, wxID_ANY, _("Pen size"), wxDefaultPosition, wxDefaultSize, 0 );
m_textPenSize->Wrap( -1 );
bSizer20->Add( m_textPenSize, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_HPGLPenSizeOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer20->Add( m_HPGLPenSizeOpt, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_textPenOvr = new wxStaticText( this, wxID_ANY, _("Pen overlay"), wxDefaultPosition, wxDefaultSize, 0 );
m_textPenOvr->Wrap( -1 );
bSizer20->Add( m_textPenOvr, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_HPGLPenOverlayOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_HPGLPenOverlayOpt->SetToolTip( _("Set plot overlay for filling") );
bSizer20->Add( m_HPGLPenOverlayOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizer22->Add( bSizer20, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer21;
bSizer21 = new wxBoxSizer( wxVERTICAL );
m_textPenSpeed = new wxStaticText( this, wxID_ANY, _("Pen speed (cm/s):"), wxDefaultPosition, wxDefaultSize, 0 );
m_textPenSpeed->Wrap( -1 );
bSizer21->Add( m_textPenSpeed, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_HPGLPenSpeedOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_HPGLPenSpeedOpt->SetToolTip( _("Set pen speed in cm/s") );
bSizer21->Add( m_HPGLPenSpeedOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizer22->Add( bSizer21, 1, wxEXPAND, 5 );
m_HPGLOptionsSizer->Add( bSizer22, 1, wxEXPAND, 5 );
m_PlotOptionsSizer->Add( m_HPGLOptionsSizer, 0, wxALL|wxEXPAND, 3 );
m_PSOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Postscript Options") ), wxVERTICAL );
wxBoxSizer* bSizer17;
bSizer17 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer18;
bSizer18 = new wxBoxSizer( wxVERTICAL );
m_staticText7 = new wxStaticText( this, wxID_ANY, _("X scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 );
bSizer18->Add( m_staticText7, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_fineAdjustXscaleOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_fineAdjustXscaleOpt->SetToolTip( _("Set global X scale adjust for exact scale postscript output.") );
bSizer18->Add( m_fineAdjustXscaleOpt, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizer17->Add( bSizer18, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer19;
bSizer19 = new wxBoxSizer( wxVERTICAL );
m_staticText8 = new wxStaticText( this, wxID_ANY, _("Y scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText8->Wrap( -1 );
bSizer19->Add( m_staticText8, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_fineAdjustYscaleOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_fineAdjustYscaleOpt->SetToolTip( _("Set global Y scale adjust for exact scale postscript output.") );
bSizer19->Add( m_fineAdjustYscaleOpt, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizer17->Add( bSizer19, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer191;
bSizer191 = new wxBoxSizer( wxVERTICAL );
m_textPSFineAdjustWidth = new wxStaticText( this, wxID_ANY, _("Width correction"), wxDefaultPosition, wxDefaultSize, 0 );
m_textPSFineAdjustWidth->Wrap( -1 );
bSizer191->Add( m_textPSFineAdjustWidth, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_PSFineAdjustWidthOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_PSFineAdjustWidthOpt->SetToolTip( _("Set global width correction for exact width postscript output.\nThese width correction is intended to compensate tracks width and also pads and vias size errors.\nThe reasonable width correction value must be in a range of [-(MinTrackWidth-1), +(MinClearanceValue-1)] in decimils.") );
bSizer191->Add( m_PSFineAdjustWidthOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
bSizer17->Add( bSizer191, 1, wxEXPAND, 5 );
m_PSOptionsSizer->Add( bSizer17, 1, wxEXPAND, 5 );
m_plotPSNegativeOpt = new wxCheckBox( this, wxID_ANY, _("Negative plot"), wxDefaultPosition, wxDefaultSize, 0 );
m_PSOptionsSizer->Add( m_plotPSNegativeOpt, 0, wxALL, 2 );
m_forcePSA4OutputOpt = new wxCheckBox( this, wxID_ANY, _("Force A4 output"), wxDefaultPosition, wxDefaultSize, 0 );
m_PSOptionsSizer->Add( m_forcePSA4OutputOpt, 0, wxALL, 2 );
m_PlotOptionsSizer->Add( m_PSOptionsSizer, 0, wxALL|wxEXPAND, 3 );
bUpperSizer->Add( m_PlotOptionsSizer, 0, 0, 5 );
bSizer12->Add( bUpperSizer, 0, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerMsg;
sbSizerMsg = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Messages:") ), wxVERTICAL );
m_messagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
m_messagesBox->SetMinSize( wxSize( -1,70 ) );
sbSizerMsg->Add( m_messagesBox, 1, wxEXPAND, 5 );
bSizer12->Add( sbSizerMsg, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerButtons;
bSizerButtons = new wxBoxSizer( wxHORIZONTAL );
m_plotButton = new wxButton( this, wxID_ANY, _("Plot"), wxDefaultPosition, wxDefaultSize, 0 );
m_plotButton->SetDefault();
bSizerButtons->Add( m_plotButton, 0, wxALL, 5 );
m_buttonDrill = new wxButton( this, ID_CREATE_DRILL_FILE, _("Generate Drill File"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonDrill, 0, wxALL, 5 );
m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonQuit, 0, wxALL, 5 );
bSizer12->Add( bSizerButtons, 0, wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 );
m_MainSizer->Add( bSizer12, 1, wxALL|wxEXPAND, 5 );
this->SetSizer( m_MainSizer );
this->Layout();
m_MainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_BASE::OnClose ) );
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PLOT_BASE::OnInitDialog ) );
m_plotFormatOpt->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::SetPlotFormat ), NULL, this );
m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
m_scaleOpt->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnSetScaleOpt ), NULL, this );
m_plotButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::Plot ), NULL, this );
m_buttonDrill->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this );
m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnQuit ), NULL, this );
}
DIALOG_PLOT_BASE::~DIALOG_PLOT_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_BASE::OnClose ) );
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PLOT_BASE::OnInitDialog ) );
m_plotFormatOpt->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::SetPlotFormat ), NULL, this );
m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
m_scaleOpt->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnSetScaleOpt ), NULL, this );
m_plotButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::Plot ), NULL, this );
m_buttonDrill->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this );
m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnQuit ), NULL, this );
}
......@@ -219,7 +219,7 @@
<property name="caption"></property>
<property name="caption_visible">1</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="context_help"></property>
<property name="context_menu">1</property>
......@@ -1745,7 +1745,7 @@
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="selection">1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_PLOT_BASE_H__
#define __DIALOG_PLOT_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/checklst.h>
#include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PLOT_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PLOT_BASE : public DIALOG_SHIM
{
private:
protected:
enum
{
ID_ALLOW_PRINT_PAD_ON_SILKSCREEN = 1000,
ID_PRINT_REF,
ID_MIROR_OPT,
ID_CREATE_DRILL_FILE
};
wxBoxSizer* m_MainSizer;
wxStaticText* m_staticText121;
wxChoice* m_plotFormatOpt;
wxStaticText* m_staticTextDir;
wxTextCtrl* m_outputDirectoryName;
wxButton* m_browseButton;
wxStaticBoxSizer* m_LayersSizer;
wxCheckListBox* m_layerCheckListBox;
wxBoxSizer* m_PlotOptionsSizer;
wxCheckBox* m_plotSheetRef;
wxCheckBox* m_plotPads_on_Silkscreen;
wxCheckBox* m_plotModuleValueOpt;
wxCheckBox* m_plotModuleRefOpt;
wxCheckBox* m_plotTextOther;
wxCheckBox* m_plotInvisibleText;
wxCheckBox* m_plotNoViaOnMaskOpt;
wxCheckBox* m_plotMirrorOpt;
wxStaticText* m_staticText11;
wxChoice* m_drillShapeOpt;
wxStaticText* m_staticText12;
wxChoice* m_scaleOpt;
wxStaticText* m_staticText13;
wxChoice* m_plotModeOpt;
wxStaticText* m_textDefaultPenSize;
wxTextCtrl* m_linesWidth;
wxStaticBoxSizer* m_GerberOptionsSizer;
wxCheckBox* m_useGerberExtensions;
wxCheckBox* m_excludeEdgeLayerOpt;
wxCheckBox* m_subtractMaskFromSilk;
wxCheckBox* m_useAuxOriginCheckBox;
wxStaticBoxSizer* m_HPGLOptionsSizer;
wxStaticText* m_textPenSize;
wxTextCtrl* m_HPGLPenSizeOpt;
wxStaticText* m_textPenOvr;
wxTextCtrl* m_HPGLPenOverlayOpt;
wxStaticText* m_textPenSpeed;
wxTextCtrl* m_HPGLPenSpeedOpt;
wxStaticBoxSizer* m_PSOptionsSizer;
wxStaticText* m_staticText7;
wxTextCtrl* m_fineAdjustXscaleOpt;
wxStaticText* m_staticText8;
wxTextCtrl* m_fineAdjustYscaleOpt;
wxStaticText* m_textPSFineAdjustWidth;
wxTextCtrl* m_PSFineAdjustWidthOpt;
wxCheckBox* m_plotPSNegativeOpt;
wxCheckBox* m_forcePSA4OutputOpt;
wxTextCtrl* m_messagesBox;
wxButton* m_plotButton;
wxButton* m_buttonDrill;
wxButton* m_buttonQuit;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void SetPlotFormat( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSetScaleOpt( wxCommandEvent& event ) { event.Skip(); }
virtual void Plot( wxCommandEvent& event ) { event.Skip(); }
virtual void CreateDrillFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_BASE();
};
#endif //__DIALOG_PLOT_BASE_H__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_PLOT_BASE_H__
#define __DIALOG_PLOT_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/checklst.h>
#include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PLOT_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PLOT_BASE : public DIALOG_SHIM
{
private:
protected:
enum
{
ID_ALLOW_PRINT_PAD_ON_SILKSCREEN = 1000,
ID_PRINT_REF,
ID_MIROR_OPT,
ID_CREATE_DRILL_FILE
};
wxBoxSizer* m_MainSizer;
wxStaticText* m_staticText121;
wxChoice* m_plotFormatOpt;
wxStaticText* m_staticTextDir;
wxTextCtrl* m_outputDirectoryName;
wxButton* m_browseButton;
wxStaticBoxSizer* m_LayersSizer;
wxCheckListBox* m_layerCheckListBox;
wxBoxSizer* m_PlotOptionsSizer;
wxCheckBox* m_plotSheetRef;
wxCheckBox* m_plotPads_on_Silkscreen;
wxCheckBox* m_plotModuleValueOpt;
wxCheckBox* m_plotModuleRefOpt;
wxCheckBox* m_plotTextOther;
wxCheckBox* m_plotInvisibleText;
wxCheckBox* m_plotNoViaOnMaskOpt;
wxCheckBox* m_plotMirrorOpt;
wxStaticText* m_staticText11;
wxChoice* m_drillShapeOpt;
wxStaticText* m_staticText12;
wxChoice* m_scaleOpt;
wxStaticText* m_staticText13;
wxChoice* m_plotModeOpt;
wxStaticText* m_textDefaultPenSize;
wxTextCtrl* m_linesWidth;
wxStaticBoxSizer* m_GerberOptionsSizer;
wxCheckBox* m_useGerberExtensions;
wxCheckBox* m_excludeEdgeLayerOpt;
wxCheckBox* m_subtractMaskFromSilk;
wxCheckBox* m_useAuxOriginCheckBox;
wxStaticBoxSizer* m_HPGLOptionsSizer;
wxStaticText* m_textPenSize;
wxTextCtrl* m_HPGLPenSizeOpt;
wxStaticText* m_textPenOvr;
wxTextCtrl* m_HPGLPenOverlayOpt;
wxStaticText* m_textPenSpeed;
wxTextCtrl* m_HPGLPenSpeedOpt;
wxStaticBoxSizer* m_PSOptionsSizer;
wxStaticText* m_staticText7;
wxTextCtrl* m_fineAdjustXscaleOpt;
wxStaticText* m_staticText8;
wxTextCtrl* m_fineAdjustYscaleOpt;
wxStaticText* m_textPSFineAdjustWidth;
wxTextCtrl* m_PSFineAdjustWidthOpt;
wxCheckBox* m_plotPSNegativeOpt;
wxCheckBox* m_forcePSA4OutputOpt;
wxTextCtrl* m_messagesBox;
wxButton* m_plotButton;
wxButton* m_buttonDrill;
wxButton* m_buttonQuit;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void SetPlotFormat( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSetScaleOpt( wxCommandEvent& event ) { event.Skip(); }
virtual void Plot( wxCommandEvent& event ) { event.Skip(); }
virtual void CreateDrillFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_BASE();
};
#endif //__DIALOG_PLOT_BASE_H__
......@@ -113,6 +113,15 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
}
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:
wxASSERT( false );
}
......
......@@ -205,6 +205,11 @@ void DIALOG_GENDRILL::GenDrillAndReportFiles()
GenDrillMap( dlg.GetPath(), s_HoleListBuffer, s_ToolListBuffer,
PLOT_FORMAT_DXF );
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,
wildcard = _( "DXF files (.dxf)|*.dxf" );
break;
case PLOT_FORMAT_SVG:
ext = SVG_PLOTTER::GetDefaultFileExtension();
wildcard = SVGFileWildcard;
break;
default:
DisplayError( this, wxT( "DIALOG_GENDRILL::GenDrillMap() error" ) );
return;
......
......@@ -111,7 +111,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
m_color = BLACK;
m_referenceColor = BLACK;
m_valueColor = BLACK;
m_textMode = PLOTTEXTMODE_PHANTOM;
m_textMode = PLOTTEXTMODE_PHANTOM;
}
......@@ -333,7 +333,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_
break;
case T_linewidth:
aPcbPlotParams->m_lineWidth = ParseInt( PLOT_LINEWIDTH_MIN,
PLOT_LINEWIDTH_MAX );
PLOT_LINEWIDTH_MAX );
break;
case T_plotframeref:
aPcbPlotParams->m_plotFrameRef = ParseBool();
......@@ -388,13 +388,15 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_
aPcbPlotParams->m_subtractMaskFromSilk = ParseBool();
break;
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;
case T_mirror:
aPcbPlotParams->m_mirror = ParseBool();
break;
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;
case T_scaleselection:
aPcbPlotParams->m_scaleSelection = ParseInt( 0, 4 );
......
......@@ -28,55 +28,21 @@
*/
#include <fctsys.h>
#include <appl_wxstruct.h>
#include <plot_common.h>
#include <confirm.h>
#include <gestfich.h>
#include <wxPcbStruct.h>
#include <pcbplot.h>
#include <worksheet.h>
#include <pcbstruct.h>
#include <macros.h>
#include <base_units.h>
#include <class_board.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 <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;
return true;
}
/** Get the 'traditional' gerber extension depending on the layer */
/** Get the 'traditional' gerber extension depending on the layer
*/
static wxString GetGerberExtension( int layer )/*{{{*/
{
switch( layer )
......@@ -206,541 +172,10 @@ static bool EnsureOutputDirectory( wxFileName *aOutputDir, /*{{{*/
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 )
{
int layer;
......@@ -797,11 +232,11 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
// Test for a reasonable scale value
// XXX could this actually happen? isn't it constrained in the apply
// function?
if( m_plotOpts.GetScale() < MIN_SCALE )
if( m_plotOpts.GetScale() < PLOT_MIN_SCALE )
DisplayInfoMessage( this,
_( "Warning: Scale option set to a very small value" ) );
if( m_plotOpts.GetScale() > MAX_SCALE )
if( m_plotOpts.GetScale() > PLOT_MAX_SCALE )
DisplayInfoMessage( this,
_( "Warning: Scale option set to a very large value" ) );
......@@ -858,7 +293,6 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
DisplayError( this, _( "No layer selected" ) );
}
void PCB_EDIT_FRAME::ToPlotter( wxCommandEvent& event )
{
DIALOG_PLOT dlg( this );
......
......@@ -26,6 +26,13 @@ class ZONE_CONTAINER;
#define OPTKEY_PRINT_PAGE_FRAME wxT( "PrintPageFrame" )
#define OPTKEY_PRINT_MONOCHROME_MODE wxT( "PrintMonochrome" )
#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.
// Convert pcb dimension of 0.1 mil to PS units of inches.
......@@ -34,7 +41,7 @@ class ZONE_CONTAINER;
// Convert dimension 0.1 mil -> HPGL units:
#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
......
......@@ -1226,7 +1226,7 @@ PLOTTER *StartPlotBoard( BOARD *aBoard,
PS_PLOTTER* PS_plotter;
PS_plotter = new PS_PLOTTER();
PS_plotter->SetScaleAdjust( aPlotOpts->GetFineScaleAdjustX(),
aPlotOpts->GetFineScaleAdjustY() );
aPlotOpts->GetFineScaleAdjustY() );
the_plotter = PS_plotter;
break;
......@@ -1248,6 +1248,10 @@ PLOTTER *StartPlotBoard( BOARD *aBoard,
the_plotter = new GERBER_PLOTTER();
break;
case PLOT_FORMAT_SVG:
the_plotter = new SVG_PLOTTER();
break;
default:
wxASSERT( false );
}
......@@ -1281,8 +1285,6 @@ PLOTTER *StartPlotBoard( BOARD *aBoard,
// error in start_plot( ) or before
DisplayError( NULL, _("Error creating plot file"));
if( the_plotter )
delete the_plotter;
delete the_plotter;
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