Commit 5daccd29 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew plot functions: code cleanup, coding and UI policy fixes and minor enhancements

parents 9e8fb761 6964a4b6
......@@ -6,7 +6,7 @@
#endif
#ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION "(2010-04-19 BZR 23xx)"
#define KICAD_BUILD_VERSION "(2010-12-10 BZR 26xx)"
#endif
//#define VERSION_STABILITY "stable"
......
......@@ -28,7 +28,7 @@ PLOTTER::PLOTTER( PlotFormat aPlotType )
default_pen_width = 0;
current_pen_width = -1; /* To-be-set marker */
pen_state = 'Z'; /* End-of-path idle */
plot_orient_options = 0; /* Mirror flag */
plotMirror = 0; /* Mirror flag */
output_file = 0;
color_mode = false; /* Start as a BW plot */
negative_mode = false;
......@@ -43,7 +43,7 @@ void PLOTTER::user_to_device_coordinates( wxPoint& pos )
{
pos.x = (int) ( (pos.x - plot_offset.x) * plot_scale * device_scale );
if( plot_orient_options == PLOT_MIROIR )
if( plotMirror )
pos.y = (int) ( ( pos.y - plot_offset.y ) * plot_scale * device_scale );
else
pos.y = (int) ( ( paper_size.y - ( pos.y - plot_offset.y )
......
......@@ -14,15 +14,14 @@
/* Set the plot offset for the current plotting
*/
void DXF_PLOTTER::set_viewport( wxPoint offset,
double aScale, int orient )
void DXF_PLOTTER::set_viewport( wxPoint aOffset, double aScale, bool aMirror )
{
wxASSERT( !output_file );
plot_offset = offset;
plot_offset = aOffset;
plot_scale = aScale;
device_scale = 1;
set_default_line_width( 0 ); /* No line width on DXF */
plot_orient_options = 0; /* No mirroring on DXF */
plotMirror = false; /* No mirroring on DXF */
current_color = BLACK;
}
......
......@@ -21,13 +21,12 @@
* @param aOffset = plot offset
* @param aScale = coordinate scale (scale coefficient for coordinates)
*/
void GERBER_PLOTTER::set_viewport( wxPoint offset,
double aScale, int orient )
void GERBER_PLOTTER::set_viewport( wxPoint aOffset, double aScale, bool aMirror )
{
wxASSERT( !output_file );
wxASSERT( orient == 0 );
plot_orient_options = 0;
plot_offset = offset;
wxASSERT( aMirror == false );
plotMirror = false;
plot_offset = aOffset;
wxASSERT( aScale == 1 );
plot_scale = 1;
device_scale = 1;
......
......@@ -17,14 +17,14 @@ const double SCALE_HPGL = 0.102041;
/* Set the plot offset for the current plotting
*/
void HPGL_PLOTTER::set_viewport( wxPoint offset, double aScale, int orient )
void HPGL_PLOTTER::set_viewport( wxPoint aOffset, double aScale, bool aMirror )
{
wxASSERT( !output_file );
plot_offset = offset;
plot_offset = aOffset;
plot_scale = aScale;
device_scale = SCALE_HPGL;
set_default_line_width( 100 ); /* default line width in 1 / 1000 inch */
plot_orient_options = orient;
plotMirror = aMirror;
}
......@@ -213,7 +213,7 @@ void HPGL_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
cpos = centre;
user_to_device_coordinates( cpos );
if( plot_orient_options == PLOT_MIROIR )
if( plotMirror )
angle = (StAngle - EndAngle) / 10.0;
else
angle = (EndAngle - StAngle) / 10.0;
......
......@@ -13,11 +13,11 @@
/* Set the plot offset for the current plotting */
void PS_PLOTTER::set_viewport( wxPoint offset, double aScale, int orient )
void PS_PLOTTER::set_viewport( wxPoint aOffset, double aScale, bool aMirror )
{
wxASSERT( !output_file );
plot_orient_options = orient;
plot_offset = offset;
plotMirror = aMirror;
plot_offset = aOffset;
plot_scale = aScale;
device_scale = 1; /* PS references in decimals */
set_default_line_width( 100 ); /* default line width in 1/1000 inch */
......@@ -157,7 +157,7 @@ void PS_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int radius,
// Calculate start point.
user_to_device_coordinates( centre );
radius = wxRound( user_to_device_size( radius ) );
if( plot_orient_options == PLOT_MIROIR )
if( plotMirror )
fprintf( output_file, "%d %d %d %g %g arc%d\n", centre.x, centre.y,
radius, (double) -EndAngle / 10, (double) -StAngle / 10,
fill );
......
......@@ -27,14 +27,11 @@ enum PlotFormat {
PLOT_FORMAT_DXF
};
const int PLOT_MIROIR = 1;
class PLOTTER
{
public:
PlotFormat m_PlotType; // type of plot
public:
PLOTTER( PlotFormat aPlotType );
public: PLOTTER( PlotFormat aPlotType );
virtual ~PLOTTER()
{
......@@ -92,8 +89,7 @@ public:
}
virtual void set_viewport( wxPoint offset,
double scale, int orient ) = 0;
virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror ) = 0;
// Standard primitives
virtual void rect( wxPoint p1, wxPoint p2, FILL_T fill,
......@@ -121,6 +117,7 @@ public:
GRTraceMode trace_mode ) = 0;
virtual void flash_pad_rect( wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode ) = 0;
/** virtual function flash_pad_trapez
* flash a trapezoidal pad
* @param aPadPos = the position of the shape
......@@ -206,8 +203,7 @@ protected:
int current_pen_width;
char pen_state;
wxPoint pen_lastpos;
// Other stuff
int plot_orient_options; // For now, mirror plot
bool plotMirror;
wxString creator;
wxString filename;
Ki_PageDescr* sheet;
......@@ -216,11 +212,11 @@ protected:
class HPGL_PLOTTER : public PLOTTER
{
public:
HPGL_PLOTTER() : PLOTTER(PLOT_FORMAT_HPGL)
public: HPGL_PLOTTER() : PLOTTER( PLOT_FORMAT_HPGL )
{
}
virtual bool start_plot( FILE* fout );
virtual bool end_plot();
......@@ -262,8 +258,7 @@ public:
}
virtual void set_viewport( wxPoint offset,
double scale, int orient );
virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror );
virtual void rect( wxPoint p1, wxPoint p2, FILL_T fill, int width = -1 );
virtual void circle( wxPoint pos, int diametre, FILL_T fill, int width = -1 );
virtual void poly( int nb_segm, int* coord, FILL_T fill, int width = -1 );
......@@ -278,6 +273,7 @@ public:
GRTraceMode trace_mode );
virtual void flash_pad_rect( wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode );
virtual void flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
int aPadOrient, GRTraceMode aTrace_Mode );
......@@ -295,13 +291,13 @@ protected:
class PS_PLOTTER : public PLOTTER
{
public:
PS_PLOTTER() : PLOTTER(PLOT_FORMAT_POST)
public: PS_PLOTTER() : PLOTTER( PLOT_FORMAT_POST )
{
plot_scale_adjX = 1;
plot_scale_adjY = 1;
}
virtual bool start_plot( FILE* fout );
virtual bool end_plot();
virtual void set_current_line_width( int width );
......@@ -316,8 +312,7 @@ public:
}
virtual void set_viewport( wxPoint offset,
double scale, int orient );
virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror );
virtual void rect( wxPoint p1, wxPoint p2, FILL_T fill, int width = -1 );
virtual void circle( wxPoint pos, int diametre, FILL_T fill, int width = -1 );
virtual void arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
......@@ -330,6 +325,7 @@ public:
GRTraceMode trace_mode );
virtual void flash_pad_rect( wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode );
virtual void flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
int aPadOrient, GRTraceMode aTrace_Mode );
......@@ -362,25 +358,22 @@ struct APERTURE
class GERBER_PLOTTER : public PLOTTER
{
public:
GERBER_PLOTTER() : PLOTTER(PLOT_FORMAT_GERBER)
public: GERBER_PLOTTER() : PLOTTER( PLOT_FORMAT_GERBER )
{
work_file = 0;
final_file = 0;
current_aperture = apertures.end();
}
virtual bool start_plot( FILE* fout );
virtual bool end_plot();
virtual void set_current_line_width( int width );
virtual void set_default_line_width( int width );
// RS274X has no dashing, nor colours
virtual void set_dash( bool dashed ) {}
virtual void set_color( int color ) {}
virtual void set_viewport( wxPoint offset,
double scale, int orient );
/* RS274X has no dashing, nor colours */
virtual void set_dash( bool dashed ) {};
virtual void set_color( int color ) {};
virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror );
virtual void rect( wxPoint p1, wxPoint p2, FILL_T fill, int width = -1 );
virtual void circle( wxPoint pos, int diametre, FILL_T fill, int width = -1 );
virtual void poly( int nb_segm, int* coord, FILL_T fill, int width = -1 );
......@@ -391,6 +384,7 @@ public:
GRTraceMode trace_mode );
virtual void flash_pad_rect( wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode );
virtual void flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
int aPadOrient, GRTraceMode aTrace_Mode );
......@@ -414,11 +408,11 @@ protected:
class DXF_PLOTTER : public PLOTTER
{
public:
DXF_PLOTTER() : PLOTTER(PLOT_FORMAT_DXF)
public: DXF_PLOTTER() : PLOTTER( PLOT_FORMAT_DXF )
{
}
virtual bool start_plot( FILE* fout );
virtual bool end_plot();
......@@ -439,8 +433,7 @@ public:
virtual void set_color( int color );
virtual void set_viewport( wxPoint offset,
double scale, int orient );
virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror );
virtual void rect( wxPoint p1, wxPoint p2, FILL_T fill, int width = -1 );
virtual void circle( wxPoint pos, int diametre, FILL_T fill, int width = -1 );
virtual void poly( int nb_segm, int* coord, FILL_T fill, int width = -1 );
......@@ -455,6 +448,7 @@ public:
GRTraceMode trace_mode );
virtual void flash_pad_rect( wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode );
virtual void flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
int aPadOrient, GRTraceMode aTrace_Mode );
......
......@@ -133,11 +133,11 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
m_MicroViaDrillValue->SetLabel( _( "Use Netclasses values" ) );
msg.Empty();
msg << g_pcb_plot_options.HPGL_Pen_Num;
msg << g_PcbPlotOptions.m_HPGLPenNum;
m_PenNum->SetValue( msg );
msg.Empty();
msg << g_pcb_plot_options.HPGL_Pen_Speed;
msg << g_PcbPlotOptions.m_HPGLPenSpeed;
m_PenSpeed->SetValue( msg );
// See if we have some buried vias or/and microvias, and display
......@@ -290,11 +290,11 @@ void DIALOG_GENDRILL::SetParams( void )
msg = m_PenSpeed->GetValue();
if( msg.ToLong( &ltmp ) )
g_pcb_plot_options.HPGL_Pen_Speed = ltmp;
g_PcbPlotOptions.m_HPGLPenSpeed = ltmp;
msg = m_PenNum->GetValue();
if( msg.ToLong( &ltmp ) )
g_pcb_plot_options.HPGL_Pen_Num = ltmp;
g_PcbPlotOptions.m_HPGLPenNum = ltmp;
if( m_Choice_Drill_Offset->GetSelection() == 0 )
m_FileDrillOffset = wxPoint( 0, 0 );
else
......
This diff is collapsed.
This diff is collapsed.
......@@ -36,77 +36,70 @@ class DIALOG_PLOT_BASE : public wxDialog
protected:
enum
{
ID_USE_GERBER_EXTENSIONS = 1000,
ID_ALLOW_PRINT_PAD_ON_SILKSCREEN,
ID_PRINT_VALUE,
ID_ALLOW_PRINT_PAD_ON_SILKSCREEN = 1000,
ID_PRINT_REF,
ID_PRINT_MODULE_TEXTS,
ID_FORCE_PRINT_INVISIBLE_TEXT,
ID_DRILL_SHAPE_OPT,
ID_BROWSE_OUTPUT_DIRECTORY,
ID_MIROR_OPT,
ID_MASKVIA_OPT,
ID_EXEC_PLOT,
ID_SAVE_OPT_PLOT,
ID_CREATE_DRILL_FILE,
};
wxStaticBoxSizer* m_CopperLayersBoxSizer;
wxStaticBoxSizer* m_TechnicalLayersBoxSizer;
wxCheckBox* m_Use_Gerber_Extensions;
wxCheckBox* m_Exclude_Edges_Pcb;
wxCheckBox* m_SubtractMaskFromSilk;
wxCheckBox* m_Plot_Sheet_Ref;
wxCheckBox* m_Plot_Pads_on_Silkscreen;
wxCheckBox* m_Plot_Text_Value;
wxCheckBox* m_Plot_Text_Ref;
wxCheckBox* m_Plot_Text_Div;
wxCheckBox* m_Plot_Invisible_Text;
wxRadioBox* m_Drill_Shape_Opt;
wxRadioBox* m_Scale_Opt;
wxRadioBox* m_PlotModeOpt;
wxRadioBox* m_Choice_Plot_Offset;
wxRadioBox* m_PlotFormatOpt;
wxCheckBox* m_useGerberExtensions;
wxCheckBox* m_excludeEdgeLayerOpt;
wxCheckBox* m_subtractMaskFromSilk;
wxCheckBox* m_plotSheetRef;
wxCheckBox* m_plotPads_on_Silkscreen;
wxCheckBox* m_plotModuleValueOpt;
wxCheckBox* m_plotModuleRefOpt;
wxCheckBox* m_plotTextOther;
wxCheckBox* m_plotInvisibleText;
wxRadioBox* m_drillShapeOpt;
wxRadioBox* m_scaleOpt;
wxRadioBox* m_plotModeOpt;
wxRadioBox* m_choicePlotOffset;
wxRadioBox* m_plotFormatOpt;
wxStaticText* m_textPenSize;
wxTextCtrl* m_HPGLPenSizeOpt;
wxStaticText* m_staticText3;
wxTextCtrl* m_HPGLPenSpeedOpt;
wxStaticText* m_textPenOvr;
wxTextCtrl* m_HPGLPenOverlayOpt;
wxCheckBox* m_Plot_PS_Negative;
wxTextCtrl* m_OutputDirectory;
wxButton* m_BrowseButton;
wxCheckBox* m_PlotMirorOpt;
wxCheckBox* m_PlotNoViaOnMaskOpt;
wxCheckBox* m_plotPSNegativeOpt;
wxCheckBox* m_plotMirrorOpt;
wxCheckBox* m_plotNoViaOnMaskOpt;
wxStaticText* m_staticText6;
wxTextCtrl* m_LinesWidth;
wxTextCtrl* m_linesWidth;
wxStaticText* m_staticText7;
wxTextCtrl* m_FineAdjustXscaleOpt;
wxTextCtrl* m_fineAdjustXscaleOpt;
wxStaticText* m_staticText8;
wxTextCtrl* m_FineAdjustYscaleOpt;
wxTextCtrl* m_fineAdjustYscaleOpt;
wxButton* m_PlotButton;
wxButton* m_plotButton;
wxButton* m_buttonSaveOpt;
wxButton* m_buttonDrill;
wxButton* m_buttonQuit;
wxStaticText* m_staticTextDir;
wxTextCtrl* m_outputDirectoryName;
wxButton* m_browseButton;
wxStaticText* m_staticText2;
wxTextCtrl* m_MessagesBox;
wxTextCtrl* m_messagesBox;
// Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( 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 Plot( wxCommandEvent& event ) { event.Skip(); }
virtual void SaveOptPlot( wxCommandEvent& event ) { event.Skip(); }
virtual void savePlotOptions( wxCommandEvent& event ) { event.Skip(); }
virtual void CreateDrillFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOutputDirectoryBrowseClicked( 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( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 571,616 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_BASE();
};
......
......@@ -194,9 +194,9 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintButtonClick( wxCommandEvent& event )
s_Parameters.m_Print_Black_and_White = m_ModeColorOption->GetSelection();
s_Parameters.m_PrintScale = s_ScaleList[m_ScaleOption->GetSelection()];
g_pcb_plot_options.ScaleAdjX = s_Parameters.m_XScaleAdjust;
g_pcb_plot_options.ScaleAdjX = s_Parameters.m_YScaleAdjust;
g_pcb_plot_options.Scale = s_Parameters.m_PrintScale;
g_PcbPlotOptions.m_FineScaleAdjustX = s_Parameters.m_XScaleAdjust;
g_PcbPlotOptions.m_FineScaleAdjustY = s_Parameters.m_YScaleAdjust;
g_PcbPlotOptions.m_PlotScale = s_Parameters.m_PrintScale;
wxPrintDialogData printDialogData( *g_PrintData );
wxPrinter printer( &printDialogData );
......
......@@ -383,7 +383,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( )
int idx = m_ScaleOption->GetSelection();
s_Parameters.m_PrintScale = s_ScaleList[idx];
g_pcb_plot_options.Scale = s_Parameters.m_PrintScale;
g_PcbPlotOptions.m_PlotScale = s_Parameters.m_PrintScale;
if( m_FineAdjustXscaleOpt )
{
......@@ -400,8 +400,8 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( )
DisplayInfoMessage( NULL, _( "Warning: Scale option set to a very small value" ) );
m_FineAdjustYscaleOpt->GetValue().ToDouble( &s_Parameters.m_YScaleAdjust );
}
g_pcb_plot_options.ScaleAdjX = s_Parameters.m_XScaleAdjust;
g_pcb_plot_options.ScaleAdjX = s_Parameters.m_YScaleAdjust;
g_PcbPlotOptions.m_FineScaleAdjustX = s_Parameters.m_XScaleAdjust;
g_PcbPlotOptions.m_FineScaleAdjustY = s_Parameters.m_YScaleAdjust;
SetPenWidth();
}
......
......@@ -4,8 +4,6 @@
#include "fctsys.h"
using namespace std;
#include <vector>
#include "common.h"
......@@ -67,8 +65,8 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
scale = 1;
HPGL_PLOTTER* hpgl_plotter = new HPGL_PLOTTER;
plotter = hpgl_plotter;
hpgl_plotter->set_pen_number( g_pcb_plot_options.HPGL_Pen_Num );
hpgl_plotter->set_pen_speed( g_pcb_plot_options.HPGL_Pen_Speed );
hpgl_plotter->set_pen_number( g_PcbPlotOptions.m_HPGLPenNum );
hpgl_plotter->set_pen_speed( g_PcbPlotOptions.m_HPGLPenSpeed );
hpgl_plotter->set_pen_overlap( 0 );
plotter->set_paper_size( aSheet );
plotter->set_viewport( offset, scale, 0 );
......
......@@ -388,18 +388,6 @@ PARAM_CFG_ARRAY& WinEDA_PcbFrame::GetConfigurationSettings()
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "CoRatsN" ),
ITEM_COLOR( RATSNEST_VISIBLE ),
WHITE ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "HPGLnum" ),
&g_pcb_plot_options.HPGL_Pen_Num,
1, 1, 16 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "HPGdiam" ),
&g_pcb_plot_options.HPGL_Pen_Diam,
15, 0, 100 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "HPGLSpd" ),
&g_pcb_plot_options.HPGL_Pen_Speed,
20, 0, 1000 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "HPGLrec" ),
&g_pcb_plot_options.HPGL_Pen_Recouvrement,
2, 0, 0x100 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "TimeOut" ), &g_TimeOut,
600, 0, 60000 ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DPolair" ),
......@@ -411,14 +399,33 @@ PARAM_CFG_ARRAY& WinEDA_PcbFrame::GetConfigurationSettings()
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "TwoSegT" ),
&g_TwoSegmentTrackBuild, TRUE ) );
// Plot options:
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "HPGLnum" ),
&g_PcbPlotOptions.m_HPGLPenNum,
1, 1, 16 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "HPGdiam" ),
&g_PcbPlotOptions.m_HPGLPenDiam,
15, 0, 100 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "HPGLSpd" ),
&g_PcbPlotOptions.m_HPGLPenSpeed,
20, 0, 1000 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "HPGLrec" ),
&g_PcbPlotOptions.m_HPGLPenOvr,
2, 0, 0x100 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PlotOutputFormat" ),
&g_pcb_plot_options.PlotFormat, PLOT_FORMAT_GERBER ) );
&g_PcbPlotOptions.m_PlotFormat, PLOT_FORMAT_GERBER ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "EdgeLayerGerberOpt" ),
&g_pcb_plot_options.Exclude_Edges_Pcb, true ) );
&g_PcbPlotOptions.m_ExcludeEdgeLayer, true ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "SubstractMasktoSilk" ),
&g_pcb_plot_options.m_SubtractMaskFromSilk, false ) );
&g_PcbPlotOptions.m_SubtractMaskFromSilk, false ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PlotPadsOnSilkscreen" ),
&g_pcb_plot_options.PlotPadsOnSilkLayer, false ) );
&g_PcbPlotOptions.m_PlotPadsOnSilkLayer, false ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PlotFrameRef" ),
&g_PcbPlotOptions.m_PlotFrameRef, false ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PlotViasOnMask" ),
&g_PcbPlotOptions.m_PlotViaOnMaskLayer, false ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PlotHolesOpt" ),
(int*)&g_PcbPlotOptions.m_DrillShapeOpt,
PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE ) );
return m_configSettings;
}
This diff is collapsed.
......@@ -25,61 +25,66 @@
// Small drill marks diameter value (in internal value = 1/10000 inch)
#define SMALL_DRILL 150
/* Plot Options : */
class PCB_Plot_Options
/* a helper class to handle plot parameters and options when plotting/printing a board
*/
class PCB_PLOT_PARAMS
{
public:
bool Exclude_Edges_Pcb;
int PlotLine_Width;
bool Plot_Frame_Ref; // True to plot/print frame references
bool DrawViaOnMaskLayer; // True if vias are drawn on Mask layer
bool m_ExcludeEdgeLayer; // True: do not plot edge layer when plotting other layers
// False: Edge layer always plotted (merged) when plotting other layers
int m_PlotLineWidth;
bool m_PlotFrameRef; // True to plot/print frame references
bool m_PlotViaOnMaskLayer; // True if vias are drawn on Mask layer
// (ie protected by mask)
GRTraceMode Trace_Mode;
bool Plot_Set_MIROIR;
int HPGL_Pen_Num;
int HPGL_Pen_Speed;
int HPGL_Pen_Diam;
int HPGL_Pen_Recouvrement;
int PlotPSColorOpt; // True for color Postscript output
bool Plot_PS_Negative; // True to create a negative board ps plot
/// Flags to enable or disable ploting of various PCB elements.
bool Sel_Texte_Reference;
bool Sel_Texte_Valeur;
bool Sel_Texte_Divers;
bool Sel_Texte_Invisible;
bool PlotPadsOnSilkLayer; ///< allows pads on silkscreen
GRTraceMode m_PlotMode; // = FILAIRE, FILLED or SKETCH: select how to plot filled objects.
// depending on plot format or layers, all options are not always allowed
int m_HPGLPenNum;
int m_HPGLPenSpeed;
int m_HPGLPenDiam;
int m_HPGLPenOvr;
int m_PlotPSColorOpt; // True for color Postscript output
bool m_PlotPSNegative; // True to create a negative board ps plot
/* Flags to enable or disable ploting of various PCB elements. */
bool m_PlotReference;
bool m_PlotValue;
bool m_PlotTextOther;
bool m_PlotInvisibleTexts;
bool m_PlotPadsOnSilkLayer; ///< allows pads outlines on silkscreen layer (when pads are also o, silk screen
bool m_SubtractMaskFromSilk;
/// id for plot format (see enum PlotFormat in plot_common.h)
int PlotFormat;
int PlotOrient;
int PlotScaleOpt;
/// id for plot format (see enum PlotFormat in plot_common.h) */
int m_PlotFormat; // Gerber, HPGL ...
bool m_PlotMirror;
enum DrillShapeOptT
{
enum DrillShapeOptT {
NO_DRILL_SHAPE = 0,
SMALL_DRILL_SHAPE = 1,
FULL_DRILL_SHAPE = 2
};
DrillShapeOptT DrillShapeOpt;
double Scale;
double ScaleAdjX;
double ScaleAdjY;
DrillShapeOptT m_DrillShapeOpt; // For postscript output: holes can be not plotted,
// or have a small size or plotted with their actual size
bool m_AutoScale; // If true, use the better scale to fit in page
double m_PlotScale; // The global scale factor. a 1.0 scale factor plot a board
// with its actual size.
// These next two scale factors are intended to compensable plotters (and mainly printers) X and Y scale error.
// Therefore they are expected very near 1.0
// Only X and Y dimensions are adjusted: circles are plotted as circle, even if X and Y fine scale differ.
double m_FineScaleAdjustX; // fine scale adjust X axis
double m_FineScaleAdjustY; // dine scale adjust Y axis
private:
wxString outputDirectory;
public:
PCB_Plot_Options();
PCB_PLOT_PARAMS();
void SetOutputDirectory( wxString aDir ) { outputDirectory = aDir; };
wxString GetOutputDirectory() { return outputDirectory; };
void SetSubtractMaskFromSilk( bool aSubtract ) { m_SubtractMaskFromSilk = aSubtract; };
bool GetSubtractMaskFromSilk() { return m_SubtractMaskFromSilk; };
};
extern PCB_Plot_Options g_pcb_plot_options;
extern PCB_PLOT_PARAMS g_PcbPlotOptions;
void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
......
......@@ -67,7 +67,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
/* Plot pads (creates pads outlines, for pads on silkscreen layers) */
int layersmask_plotpads = masque_layer;
// Calculate the mask layers of allowed layers for pads
if( !g_pcb_plot_options.PlotPadsOnSilkLayer ) // Do not plot pads on silk screen layers
if( !g_PcbPlotOptions.m_PlotPadsOnSilkLayer ) // Do not plot pads on silk screen layers
layersmask_plotpads &= ~(SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT );
if( layersmask_plotpads )
{
......@@ -112,8 +112,8 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
for( MODULE* Module = m_Pcb->m_Modules; Module; Module = Module->Next() )
{
/* see if we want to plot VALUE and REF fields */
trace_val = g_pcb_plot_options.Sel_Texte_Valeur;
trace_ref = g_pcb_plot_options.Sel_Texte_Reference;
trace_val = g_PcbPlotOptions.m_PlotValue;
trace_ref = g_PcbPlotOptions.m_PlotReference;
TEXTE_MODULE* text = Module->m_Reference;
unsigned textLayer = text->GetLayer();
......@@ -132,7 +132,7 @@ module\n %s's \"reference\" text." ),
if( ( ( 1 << textLayer ) & masque_layer ) == 0 )
trace_ref = FALSE;
if( text->m_NoShow && !g_pcb_plot_options.Sel_Texte_Invisible )
if( text->m_NoShow && !g_PcbPlotOptions.m_PlotInvisibleTexts )
trace_ref = FALSE;
text = Module->m_Value;
......@@ -152,7 +152,7 @@ module\n %s's \"value\" text." ),
if( ( (1 << textLayer) & masque_layer ) == 0 )
trace_val = FALSE;
if( text->m_NoShow && !g_pcb_plot_options.Sel_Texte_Invisible )
if( text->m_NoShow && !g_PcbPlotOptions.m_PlotInvisibleTexts )
trace_val = FALSE;
/* Plot text fields, if allowed */
......@@ -169,10 +169,10 @@ module\n %s's \"value\" text." ),
if( pt_texte->Type() != TYPE_TEXTE_MODULE )
continue;
if( !g_pcb_plot_options.Sel_Texte_Divers )
if( !g_PcbPlotOptions.m_PlotTextOther )
continue;
if( (pt_texte->m_NoShow)
&& !g_pcb_plot_options.Sel_Texte_Invisible )
&& !g_PcbPlotOptions.m_PlotInvisibleTexts )
continue;
textLayer = pt_texte->GetLayer();
......@@ -644,7 +644,7 @@ void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* pt_segm, int masque_layer,
return;
if( trace_mode == FILAIRE )
thickness = g_pcb_plot_options.PlotLine_Width;
thickness = g_PcbPlotOptions.m_PlotLineWidth;
else
thickness = pt_segm->m_Width;
......@@ -697,7 +697,7 @@ void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer,
// in addition to the contents of the currently specified layer.
int layer_mask = g_TabOneLayerMask[Layer];
if( !g_pcb_plot_options.Exclude_Edges_Pcb )
if( !g_PcbPlotOptions.m_ExcludeEdgeLayer )
layer_mask |= EDGE_LAYER;
switch( Layer )
......@@ -722,21 +722,19 @@ void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer,
// Adding drill marks, if required and if the plotter is able to plot
// them:
if( g_pcb_plot_options.DrillShapeOpt !=
PCB_Plot_Options::NO_DRILL_SHAPE )
if( g_PcbPlotOptions.m_DrillShapeOpt != PCB_PLOT_PARAMS::NO_DRILL_SHAPE )
{
if( plotter->GetPlotterType() == PLOT_FORMAT_POST )
PlotDrillMark( plotter,
trace_mode,
g_pcb_plot_options.DrillShapeOpt ==
PCB_Plot_Options::SMALL_DRILL_SHAPE );
PlotDrillMark( plotter, trace_mode,
g_PcbPlotOptions.m_DrillShapeOpt ==
PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE );
}
break;
case SOLDERMASK_N_BACK:
case SOLDERMASK_N_FRONT:
Plot_Standard_Layer( plotter, layer_mask,
g_pcb_plot_options.DrawViaOnMaskLayer, trace_mode );
g_PcbPlotOptions.m_PlotViaOnMaskLayer, trace_mode );
break;
case SOLDERPASTE_N_BACK:
......@@ -749,7 +747,7 @@ void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer,
// Gerber: Subtract soldermask from silkscreen if enabled
if( plotter->GetPlotterType() == PLOT_FORMAT_GERBER
&& g_pcb_plot_options.GetSubtractMaskFromSilk() )
&& g_PcbPlotOptions.GetSubtractMaskFromSilk() )
{
if( Layer == SILKSCREEN_N_FRONT )
{
......@@ -763,7 +761,7 @@ void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer,
// Set layer polarity to negative
plotter->SetLayerPolarity( false );
Plot_Standard_Layer( plotter, layer_mask,
g_pcb_plot_options.DrawViaOnMaskLayer,
g_PcbPlotOptions.m_PlotViaOnMaskLayer,
trace_mode );
}
break;
......@@ -1013,8 +1011,7 @@ void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter,
if( pts->Type() != TYPE_VIA )
continue;
pos = pts->m_Start;
if( g_pcb_plot_options.DrillShapeOpt ==
PCB_Plot_Options::SMALL_DRILL_SHAPE )
if( g_PcbPlotOptions.m_DrillShapeOpt == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE )
diam.x = diam.y = SMALL_DRILL;
else
diam.x = diam.y = pts->GetDrillValue();
......
......@@ -32,7 +32,7 @@ bool WinEDA_BasePcbFrame::Genere_DXF( const wxString& FullFileName, int Layer,
plotter->set_filename( FullFileName );
plotter->start_plot( output_file );
if( g_pcb_plot_options.Plot_Frame_Ref )
if( g_PcbPlotOptions.m_PlotFrameRef )
PlotWorkSheet( plotter, GetScreen() );
Plot_Layer( plotter, Layer, trace_mode );
......
......@@ -42,7 +42,7 @@ bool WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer
wxPoint offset;
/* Calculate scaling from pcbnew units (in 0.1 mil or 0.0001 inch) to gerber units */
double scale = g_pcb_plot_options.Scale;
double scale = g_PcbPlotOptions.m_PlotScale;
if( PlotOriginIsAuxAxis )
offset = m_Auxiliary_Axis_Position;
......@@ -56,17 +56,17 @@ bool WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer
PLOTTER* plotter = new GERBER_PLOTTER();
/* No mirror and scaling for gerbers! */
plotter->set_viewport( offset, scale, 0 );
plotter->set_default_line_width( g_pcb_plot_options.PlotLine_Width );
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
plotter->set_creator( wxT( "PCBNEW-RS274X" ) );
plotter->set_filename( FullFileName );
if( plotter->start_plot( output_file ) )
{
// Sheet refs on gerber CAN be useful... and they're always 1:1
if( g_pcb_plot_options.Plot_Frame_Ref )
if( g_PcbPlotOptions.m_PlotFrameRef )
PlotWorkSheet( plotter, GetScreen() );
Plot_Layer( plotter, Layer, trace_mode );
Plot_Layer( plotter, Layer, trace_mode );
plotter->end_plot();
}
......
......@@ -29,26 +29,26 @@ bool WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
{
return false;
}
// Compute pen_dim (from g_HPGL_Pen_Diam in mils) in pcb units,
// with plot scale (if Scale is 2, pen diameter is always g_HPGL_Pen_Diam
// Compute pen_dim (from g_m_HPGLPenDiam in mils) in pcb units,
// with plot scale (if Scale is 2, pen diameter is always g_m_HPGLPenDiam
// so apparent pen diam is real pen diam / Scale
int pen_diam = wxRound( (g_pcb_plot_options.HPGL_Pen_Diam * U_PCB) / g_pcb_plot_options.Scale );
int pen_diam = wxRound( (g_PcbPlotOptions.m_HPGLPenDiam * U_PCB) / g_PcbPlotOptions.m_PlotScale );
// compute pen_recouvrement (from g_HPGL_Pen_Recouvrement in mils)
// compute pen_overlay (from g_m_HPGLPenOvr in mils)
// with plot scale
if( g_pcb_plot_options.HPGL_Pen_Recouvrement < 0 )
g_pcb_plot_options.HPGL_Pen_Recouvrement = 0;
if( g_pcb_plot_options.HPGL_Pen_Recouvrement >= g_pcb_plot_options.HPGL_Pen_Diam )
g_pcb_plot_options.HPGL_Pen_Recouvrement = g_pcb_plot_options.HPGL_Pen_Diam - 1;
int pen_recouvrement = wxRound(
g_pcb_plot_options.HPGL_Pen_Recouvrement * 10.0 / g_pcb_plot_options.Scale );
if( g_PcbPlotOptions.m_HPGLPenOvr < 0 )
g_PcbPlotOptions.m_HPGLPenOvr = 0;
if( g_PcbPlotOptions.m_HPGLPenOvr >= g_PcbPlotOptions.m_HPGLPenDiam )
g_PcbPlotOptions.m_HPGLPenOvr = g_PcbPlotOptions.m_HPGLPenDiam - 1;
int pen_overlay = wxRound(
g_PcbPlotOptions.m_HPGLPenOvr * 10.0 / g_PcbPlotOptions.m_PlotScale );
SetLocaleTo_C_standard();
if( g_pcb_plot_options.PlotScaleOpt != 1 )
Center = TRUE; // Scale != 1 so center PCB plot.
if( g_PcbPlotOptions.m_PlotScale != 1.0 || g_PcbPlotOptions.m_AutoScale )
Center = true; // when scale != 1.0 we must calculate the position in page
// because actual position has no meaning
// Scale units from 0.0001" to HPGL plot units.
SheetSize.x = currentsheet->m_Size.x * U_PCB;
......@@ -59,7 +59,7 @@ bool WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
BoardSize = m_Pcb->m_BoundaryBox.GetSize();
BoardCenter = m_Pcb->m_BoundaryBox.Centre();
if( g_pcb_plot_options.PlotScaleOpt == 0 ) // Optimum scale
if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale
{
double Xscale, Yscale;
......@@ -69,7 +69,7 @@ bool WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
scale = MIN( Xscale, Yscale );
}
else
scale = g_pcb_plot_options.Scale;
scale = g_PcbPlotOptions.m_PlotScale;
// Calculate the page size offset.
if( Center )
......@@ -87,20 +87,19 @@ bool WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
plotter->set_paper_size( currentsheet );
plotter->set_viewport( offset, scale,
g_pcb_plot_options.PlotOrient );
plotter->set_default_line_width( g_pcb_plot_options.PlotLine_Width );
plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror );
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
plotter->set_creator( wxT( "PCBNEW-HPGL" ) );
plotter->set_filename( FullFileName );
plotter->set_pen_speed( g_pcb_plot_options.HPGL_Pen_Speed );
plotter->set_pen_number( g_pcb_plot_options.HPGL_Pen_Num );
plotter->set_pen_overlap( pen_recouvrement );
plotter->set_pen_speed( g_PcbPlotOptions.m_HPGLPenSpeed );
plotter->set_pen_number( g_PcbPlotOptions.m_HPGLPenNum );
plotter->set_pen_overlap( pen_overlay );
plotter->set_pen_diameter( pen_diam );
plotter->start_plot( output_file );
/* The worksheet is not significant with scale!=1... It is with
* paperscale!=1, anyway */
if( g_pcb_plot_options.Plot_Frame_Ref && !Center )
if( g_PcbPlotOptions.m_PlotFrameRef && !Center )
PlotWorkSheet( plotter, GetScreen() );
Plot_Layer( plotter, Layer, trace_mode );
......
......@@ -37,12 +37,13 @@ bool WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
SetLocaleTo_C_standard();
if( g_pcb_plot_options.PlotScaleOpt != 1 )
Center = TRUE; // Scale != 1 so center plot.
if( g_PcbPlotOptions.m_PlotScale != 1.0 || g_PcbPlotOptions.m_AutoScale )
Center = true; // when scale != 1.0 we must calculate the position in page
// because actual position has no meaning
// Set default line width
if( g_pcb_plot_options.PlotLine_Width < 1 )
g_pcb_plot_options.PlotLine_Width = 1;
if( g_PcbPlotOptions.m_PlotLineWidth < 1 )
g_PcbPlotOptions.m_PlotLineWidth = 1;
SheetSize.x = currentsheet->m_Size.x * U_PCB;
SheetSize.y = currentsheet->m_Size.y * U_PCB;
......@@ -65,7 +66,7 @@ bool WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
BoardSize = m_Pcb->m_BoundaryBox.GetSize();
BoardCenter = m_Pcb->m_BoundaryBox.Centre();
if( g_pcb_plot_options.PlotScaleOpt == 0 ) // Optimum scale
if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale
{
double Xscale, Yscale;
......@@ -75,7 +76,7 @@ bool WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
scale = MIN( Xscale, Yscale );
}
else
scale = g_pcb_plot_options.Scale * paperscale;
scale = g_PcbPlotOptions.m_PlotScale * paperscale;
if( Center )
{
......@@ -92,24 +93,23 @@ bool WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
PS_PLOTTER* plotter = new PS_PLOTTER();
plotter->set_paper_size( SheetPS );
plotter->set_scale_adjust( g_pcb_plot_options.ScaleAdjX,
g_pcb_plot_options.ScaleAdjY );
plotter->set_viewport( offset, scale,
g_pcb_plot_options.PlotOrient );
plotter->set_default_line_width( g_pcb_plot_options.PlotLine_Width );
plotter->set_scale_adjust( g_PcbPlotOptions.m_FineScaleAdjustX,
g_PcbPlotOptions.m_FineScaleAdjustX );
plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror );
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
plotter->set_creator( wxT( "PCBNEW-PS" ) );
plotter->set_filename( FullFileName );
plotter->start_plot( output_file );
/* The worksheet is not significant with scale!=1... It is with
* paperscale!=1, anyway */
if( g_pcb_plot_options.Plot_Frame_Ref && !Center )
if( g_PcbPlotOptions.m_PlotFrameRef && !Center )
PlotWorkSheet( plotter, GetScreen() );
// If plot a negative board:
// Draw a black rectangle (background for plot board in white)
// and switch the current color to WHITE
if( g_pcb_plot_options.Plot_PS_Negative )
if( g_PcbPlotOptions.m_PlotPSNegative )
{
int margin = 500; // Add a 0.5 inch margin around the board
plotter->set_negative( true );
......
release version:
2010 dec 06 (BZR testing 2644)
2010 dec 10 (BZR testing 26xx)
files (.zip,.tgz):
kicad-2010-12-06-testing
kicad-2010-12-10-testing
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