Commit 7ccdb558 authored by Marco Mattila's avatar Marco Mattila

Add saving of pcb plot settings in board files.

parent e0f4963b
......@@ -154,6 +154,8 @@ set(PCBNEW_SRCS
netlist.cpp
onleftclick.cpp
onrightclick.cpp
pcb_plot_params.cpp
pcb_plot_params_keywords.cpp
pcbnew.cpp
pcbnew_config.cpp
pcbplot.cpp
......@@ -256,6 +258,15 @@ make_lexer(
)
# auto-generate pcb_plot_params_lexer.h and pcb_plot_params_keywords.cpp
make_lexer(
${CMAKE_CURRENT_SOURCE_DIR}/pcb_plot_params.keywords
${CMAKE_CURRENT_SOURCE_DIR}/pcb_plot_params_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/pcb_plot_params_keywords.cpp
PCBPLOTPARAMS_T
)
###
# Create the pcbnew executable
###
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// C++ code generated with wxFormBuilder (version Nov 18 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -91,7 +91,7 @@ class DIALOG_PLOT_BASE : public wxDialog
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void SetPlotFormat( wxCommandEvent& event ) { event.Skip(); }
virtual void Plot( wxCommandEvent& event ) { event.Skip(); }
virtual void savePlotOptions( wxCommandEvent& event ) { event.Skip(); }
virtual void applyPlotSettings( 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(); }
......
......@@ -25,6 +25,8 @@
#include "pcbnew_id.h"
#include "richio.h"
#include "pcb_plot_params.h"
/* ASCII format of structures:
*
* Structure PAD:
......@@ -314,6 +316,27 @@ int WinEDA_BasePcbFrame::ReadSetup( LINE_READER* aReader )
while( aReader->ReadLine() )
{
Line = aReader->Line();
if( strnicmp( Line, "PcbPlotParams", 13 ) == 0 )
{
PCB_PLOT_PARAMS_PARSER parser( &Line[13], aReader->GetSource() );
try
{
g_PcbPlotOptions.Parse( &parser );
}
catch( IO_ERROR& e )
{
wxString msg;
msg.Printf( wxT( "Error reading PcbPlotParams from %s:\n%s" ),
aReader->GetSource().GetData(),
e.errorText.GetData() );
wxMessageBox( msg, wxT( "Open Board File" ), wxICON_ERROR );
}
continue;
}
strtok( Line, " =\n\r" );
data = strtok( NULL, " =\n\r" );
......@@ -576,7 +599,6 @@ int WinEDA_BasePcbFrame::ReadSetup( LINE_READER* aReader )
continue;
}
#endif
}
......@@ -728,6 +750,15 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
aFrame->m_Auxiliary_Axis_Position.x,
aFrame->m_Auxiliary_Axis_Position.y );
STRING_FORMATTER sf;
g_PcbPlotOptions.Format( &sf, 0 );
wxString record = CONV_FROM_UTF8( sf.GetString().c_str() );
record.Replace( wxT("\n"), wxT(""), true );
record.Replace( wxT(" "), wxT(" "), true);
fprintf( aFile, "PcbPlotParams %s\n", CONV_TO_UTF8( record ) );
fprintf( aFile, "$EndSETUP\n\n" );
return 1;
}
......
This diff is collapsed.
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2011 Kicad Developers, see change_log.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
*/
#ifndef PCB_PLOT_PARAMS_H_
#define PCB_PLOT_PARAMS_H_
#include <wx/wx.h>
#include "base_struct.h"
#include "pcb_plot_params_lexer.h"
class PCB_PLOT_PARAMS;
class PCB_PLOT_PARAMS_PARSER;
extern PCB_PLOT_PARAMS g_PcbPlotOptions;
/**
* Class PCB_PLOT_PARAMS
* handles plot parameters and options when plotting/printing a board.
*/
class PCB_PLOT_PARAMS
{
friend class PCB_PLOT_PARAMS_PARSER;
public:
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 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
int m_PlotFormat; // id for plot format (see enum PlotFormat in plot_common.h) */
bool m_PlotMirror;
enum DrillShapeOptT {
NO_DRILL_SHAPE = 0,
SMALL_DRILL_SHAPE = 1,
FULL_DRILL_SHAPE = 2
};
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:
long layerSelection;
bool useGerberExtensions;
bool useAuxOrigin;
bool subtractMaskFromSilk;
int scaleSelection;
wxString outputDirectory;
public:
PCB_PLOT_PARAMS();
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel ) const throw( IO_ERROR );
void Parse( PCB_PLOT_PARAMS_PARSER* aParser ) throw( IO_ERROR, PARSE_ERROR );
PCB_PLOT_PARAMS& operator=( const PCB_PLOT_PARAMS &aPcbPlotParams);
bool operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
bool operator!=( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
void SetOutputDirectory( wxString aDir ) { outputDirectory = aDir; };
wxString GetOutputDirectory() const { return outputDirectory; };
void SetUseGerberExtensions( bool aUse ) { useGerberExtensions = aUse; };
bool GetUseGerberExtensions() const { return useGerberExtensions; };
void SetSubtractMaskFromSilk( bool aSubtract ) { subtractMaskFromSilk = aSubtract; };
bool GetSubtractMaskFromSilk() const { return subtractMaskFromSilk; };
void SetLayerSelection( long aSelection ) { layerSelection = aSelection; };
long GetLayerSelection() const { return layerSelection; };
void SetUseAuxOrigin( bool aAux ) { useAuxOrigin = aAux; };
bool GetUseAuxOrigin() const { return useAuxOrigin; };
void SetScaleSelection( int aSelection ) { scaleSelection = aSelection; };
int GetScaleSelection() const { return scaleSelection; };
};
/**
* Class PCB_PLOT_PARAMS_PARSER
* is the parser class for PCB_PLOT_PARAMS.
*/
class PCB_PLOT_PARAMS_PARSER : public PCB_PLOT_PARAMS_LEXER
{
public:
PCB_PLOT_PARAMS_PARSER( LINE_READER* aReader );
PCB_PLOT_PARAMS_PARSER( char* aLine, wxString aSource );
LINE_READER* GetReader() { return reader; };
void Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_ERROR, PARSE_ERROR );
bool ParseBool() throw( IO_ERROR );
/**
* Function ParseInt
* parses an integer and constrains it between two values.
* @param aMin is the smallest return value.
* @param aMax is the largest return value.
* @return int - the parsed integer.
*/
int ParseInt( int aMin, int aMax ) throw( IO_ERROR );
};
#endif // PCB_PLOT_PARAMS_H_
drillshape
excludeedgelayer
false
hpglpendiameter
hpglpennumber
hpglpenoverlay
hpglpenspeed
layerselection
linewidth
mirror
mode
outputdirectory
outputformat
padsonsilk
pcbplotparams
plotframeref
plotinvisibletext
plotothertext
plotreference
plotvalue
pscolor
psnegative
scaleselection
subtractmaskfromsilk
true
useauxorigin
usegerberextensions
viasonmask
......@@ -398,34 +398,5 @@ PARAM_CFG_ARRAY& WinEDA_PcbFrame::GetConfigurationSettings()
&g_Show_Module_Ratsnest, TRUE ) );
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_PcbPlotOptions.m_PlotFormat, PLOT_FORMAT_GERBER ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "EdgeLayerGerberOpt" ),
&g_PcbPlotOptions.m_ExcludeEdgeLayer, true ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "SubstractMasktoSilk" ),
&g_PcbPlotOptions.m_SubtractMaskFromSilk, false ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PlotPadsOnSilkscreen" ),
&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.
......@@ -5,6 +5,7 @@
#ifndef PCBPLOT_H
#define PCBPLOT_H
#include "pcb_plot_params.h"
/* Shared Config keys for plot and print */
#define OPTKEY_LAYERBASE wxT( "PlotLayer_%d" )
......@@ -25,67 +26,6 @@
// Small drill marks diameter value (in internal value = 1/10000 inch)
#define SMALL_DRILL 150
/* a helper class to handle plot parameters and options when plotting/printing a board
*/
class PCB_PLOT_PARAMS
{
public:
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 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 m_PlotFormat; // Gerber, HPGL ...
bool m_PlotMirror;
enum DrillShapeOptT {
NO_DRILL_SHAPE = 0,
SMALL_DRILL_SHAPE = 1,
FULL_DRILL_SHAPE = 2
};
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_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_PARAMS g_PcbPlotOptions;
void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
GRTraceMode trace_mode );
......
......@@ -12,7 +12,6 @@
#include "confirm.h"
#include "pcbnew.h"
#include "protos.h"
#include "pcbplot.h"
#include "printout_controler.h"
......
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