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 )
......
This diff is collapsed.
......@@ -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 );
......
This diff is collapsed.
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// 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__
This diff is collapsed.
/**
* @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();
};
This diff is collapsed.
......@@ -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 );
......
This diff is collapsed.
......@@ -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