2011-01-28 22:54:16 +00:00
|
|
|
|
|
|
|
/*
|
2011-09-30 18:15:37 +00:00
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
2011-01-28 22:54:16 +00:00
|
|
|
*
|
2011-09-30 18:15:37 +00:00
|
|
|
* Copyright (C) 1992-2011 KiCad Developers, see change_log.txt for contributors.
|
2011-01-28 22:54:16 +00:00
|
|
|
*
|
|
|
|
* 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 <wx/wx.h>
|
|
|
|
#include "pcb_plot_params.h"
|
|
|
|
#include "pcb_plot_params_lexer.h"
|
|
|
|
#include "layers_id_colors_and_visibility.h"
|
|
|
|
#include "plot_common.h"
|
|
|
|
#include "macros.h"
|
|
|
|
|
2011-02-28 18:36:19 +00:00
|
|
|
#define PLOT_LINEWIDTH_MIN 0
|
2011-02-03 22:26:30 +00:00
|
|
|
#define PLOT_LINEWIDTH_MAX 200
|
|
|
|
#define HPGL_PEN_DIAMETER_MIN 0
|
|
|
|
#define HPGL_PEN_DIAMETER_MAX 100
|
|
|
|
#define HPGL_PEN_SPEED_MIN 0
|
|
|
|
#define HPGL_PEN_SPEED_MAX 1000
|
|
|
|
#define HPGL_PEN_NUMBER_MIN 1
|
|
|
|
#define HPGL_PEN_NUMBER_MAX 16
|
|
|
|
#define HPGL_PEN_OVERLAY_MIN 0
|
|
|
|
#define HPGL_PEN_OVERLAY_MAX 0x100
|
|
|
|
|
2011-01-28 22:54:16 +00:00
|
|
|
extern int g_DrawDefaultLineThickness;
|
|
|
|
|
|
|
|
PCB_PLOT_PARAMS g_PcbPlotOptions;
|
|
|
|
|
|
|
|
using namespace PCBPLOTPARAMS_T;
|
|
|
|
|
2011-02-03 22:26:30 +00:00
|
|
|
|
|
|
|
static const char* getTokenName( T aTok )
|
2011-01-28 22:54:16 +00:00
|
|
|
{
|
|
|
|
return PCB_PLOT_PARAMS_LEXER::TokenName( aTok );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-03 22:26:30 +00:00
|
|
|
static bool setInt( int* aInt, int aValue, int aMin, int aMax )
|
|
|
|
{
|
|
|
|
int temp = aValue;
|
|
|
|
|
|
|
|
if( aValue < aMin )
|
|
|
|
temp = aMin;
|
|
|
|
else if( aValue > aMax )
|
|
|
|
temp = aMax;
|
|
|
|
|
|
|
|
*aInt = temp;
|
|
|
|
return (temp == aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-28 22:54:16 +00:00
|
|
|
// PCB_PLOT_PARAMS
|
|
|
|
|
|
|
|
PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
|
|
|
|
{
|
|
|
|
layerSelection = LAYER_BACK | LAYER_FRONT
|
|
|
|
| SILKSCREEN_LAYER_FRONT | SILKSCREEN_LAYER_BACK;
|
|
|
|
useGerberExtensions = true;
|
2011-08-19 13:08:24 +00:00
|
|
|
m_SkipNPTH_Pads = false;
|
2011-01-28 22:54:16 +00:00
|
|
|
m_ExcludeEdgeLayer = true;
|
|
|
|
m_PlotLineWidth = g_DrawDefaultLineThickness;
|
|
|
|
m_PlotFrameRef = false;
|
|
|
|
m_PlotViaOnMaskLayer = false;
|
|
|
|
m_PlotMode = FILLED;
|
|
|
|
useAuxOrigin = false;
|
|
|
|
m_HPGLPenNum = 1;
|
|
|
|
m_HPGLPenSpeed = 20;
|
|
|
|
m_HPGLPenDiam = 15;
|
|
|
|
m_HPGLPenOvr = 2;
|
|
|
|
m_PlotPSColorOpt = true;
|
|
|
|
m_PlotPSNegative = false;
|
2011-02-17 17:11:20 +00:00
|
|
|
psA4Output = false;
|
2011-01-28 22:54:16 +00:00
|
|
|
m_PlotReference = true;
|
|
|
|
m_PlotValue = true;
|
|
|
|
m_PlotTextOther = true;
|
|
|
|
m_PlotInvisibleTexts = false;
|
|
|
|
m_PlotPadsOnSilkLayer = false;
|
|
|
|
subtractMaskFromSilk = false;
|
|
|
|
m_PlotFormat = PLOT_FORMAT_GERBER;
|
|
|
|
m_PlotMirror = false;
|
|
|
|
m_DrillShapeOpt = SMALL_DRILL_SHAPE;
|
|
|
|
m_AutoScale = false;
|
|
|
|
m_PlotScale = 1.0;
|
|
|
|
scaleSelection = 1;
|
|
|
|
m_FineScaleAdjustX = 1.0;
|
|
|
|
m_FineScaleAdjustY = 1.0;
|
|
|
|
outputDirectory = wxT( "" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter,
|
|
|
|
int aNestLevel ) const throw( IO_ERROR )
|
|
|
|
{
|
2011-02-03 22:26:30 +00:00
|
|
|
const char* falseStr = getTokenName( T_false );
|
|
|
|
const char* trueStr = getTokenName( T_true );
|
2011-01-28 22:54:16 +00:00
|
|
|
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel, "(%s", getTokenName( T_pcbplotparams ) );
|
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %ld)\n", getTokenName( T_layerselection ),
|
2011-01-28 22:54:16 +00:00
|
|
|
layerSelection );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberextensions ),
|
2011-01-28 22:54:16 +00:00
|
|
|
useGerberExtensions ? trueStr : falseStr );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_excludeedgelayer ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_ExcludeEdgeLayer ? trueStr : falseStr );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_linewidth ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_PlotLineWidth );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotframeref ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_PlotFrameRef ? trueStr : falseStr );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_viasonmask ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_PlotViaOnMaskLayer ? trueStr : falseStr );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_mode ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_PlotMode );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_useauxorigin ),
|
2011-01-28 22:54:16 +00:00
|
|
|
useAuxOrigin ? trueStr : falseStr );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpennumber ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_HPGLPenNum );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpenspeed ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_HPGLPenSpeed );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpendiameter ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_HPGLPenDiam );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpenoverlay ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_HPGLPenOvr );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_pscolor ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_PlotPSColorOpt ? trueStr : falseStr );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_psnegative ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_PlotPSNegative ? trueStr : falseStr );
|
2011-02-17 17:11:20 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_psa4output ),
|
|
|
|
psA4Output ? trueStr : falseStr );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotreference ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_PlotReference ? trueStr : falseStr );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotvalue ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_PlotValue ? trueStr : falseStr );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotothertext ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_PlotTextOther ? trueStr : falseStr );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotinvisibletext ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_PlotInvisibleTexts ? trueStr : falseStr );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_padsonsilk ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_PlotPadsOnSilkLayer ? trueStr : falseStr );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_subtractmaskfromsilk ),
|
2011-01-28 22:54:16 +00:00
|
|
|
subtractMaskFromSilk ? trueStr : falseStr );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_outputformat ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_PlotFormat );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_mirror ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_PlotMirror ? trueStr : falseStr );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_drillshape ),
|
2011-01-28 22:54:16 +00:00
|
|
|
m_DrillShapeOpt );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_scaleselection ),
|
2011-01-28 22:54:16 +00:00
|
|
|
scaleSelection );
|
2011-02-03 22:26:30 +00:00
|
|
|
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_outputdirectory ),
|
2011-02-02 19:41:35 +00:00
|
|
|
aFormatter->Quotew( outputDirectory ).c_str() );
|
2011-01-28 22:54:16 +00:00
|
|
|
aFormatter->Print( 0, ")\n" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_PLOT_PARAMS::Parse( PCB_PLOT_PARAMS_PARSER* aParser ) throw( IO_ERROR, PARSE_ERROR )
|
|
|
|
{
|
|
|
|
aParser->Parse( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool PCB_PLOT_PARAMS::operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
|
|
|
|
{
|
|
|
|
if( layerSelection != aPcbPlotParams.layerSelection )
|
|
|
|
return false;
|
|
|
|
if( useGerberExtensions != aPcbPlotParams.useGerberExtensions )
|
|
|
|
return false;
|
|
|
|
if( m_ExcludeEdgeLayer != aPcbPlotParams.m_ExcludeEdgeLayer )
|
|
|
|
return false;
|
|
|
|
if( m_PlotLineWidth != aPcbPlotParams.m_PlotLineWidth )
|
|
|
|
return false;
|
|
|
|
if( m_PlotFrameRef != aPcbPlotParams.m_PlotFrameRef )
|
|
|
|
return false;
|
|
|
|
if( m_PlotViaOnMaskLayer != aPcbPlotParams.m_PlotViaOnMaskLayer )
|
|
|
|
return false;
|
|
|
|
if( m_PlotMode != aPcbPlotParams.m_PlotMode )
|
|
|
|
return false;
|
|
|
|
if( useAuxOrigin != aPcbPlotParams.useAuxOrigin )
|
|
|
|
return false;
|
|
|
|
if( m_HPGLPenNum != aPcbPlotParams.m_HPGLPenNum )
|
|
|
|
return false;
|
|
|
|
if( m_HPGLPenSpeed != aPcbPlotParams.m_HPGLPenSpeed )
|
|
|
|
return false;
|
|
|
|
if( m_HPGLPenDiam != aPcbPlotParams.m_HPGLPenDiam )
|
|
|
|
return false;
|
|
|
|
if( m_HPGLPenOvr != aPcbPlotParams.m_HPGLPenOvr )
|
|
|
|
return false;
|
|
|
|
if( m_PlotPSColorOpt != aPcbPlotParams.m_PlotPSColorOpt )
|
|
|
|
return false;
|
|
|
|
if( m_PlotPSNegative != aPcbPlotParams.m_PlotPSNegative )
|
|
|
|
return false;
|
2011-02-17 17:11:20 +00:00
|
|
|
if( psA4Output != aPcbPlotParams.psA4Output )
|
|
|
|
return false;
|
2011-01-28 22:54:16 +00:00
|
|
|
if( m_PlotReference != aPcbPlotParams.m_PlotReference )
|
|
|
|
return false;
|
|
|
|
if( m_PlotValue != aPcbPlotParams.m_PlotValue )
|
|
|
|
return false;
|
|
|
|
if( m_PlotTextOther != aPcbPlotParams.m_PlotTextOther )
|
|
|
|
return false;
|
|
|
|
if( m_PlotInvisibleTexts != aPcbPlotParams.m_PlotInvisibleTexts )
|
|
|
|
return false;
|
|
|
|
if( m_PlotPadsOnSilkLayer != aPcbPlotParams.m_PlotPadsOnSilkLayer )
|
|
|
|
return false;
|
|
|
|
if( subtractMaskFromSilk != aPcbPlotParams.subtractMaskFromSilk )
|
|
|
|
return false;
|
|
|
|
if( m_PlotFormat != aPcbPlotParams.m_PlotFormat )
|
|
|
|
return false;
|
|
|
|
if( m_PlotMirror != aPcbPlotParams.m_PlotMirror )
|
|
|
|
return false;
|
|
|
|
if( m_DrillShapeOpt != aPcbPlotParams.m_DrillShapeOpt )
|
|
|
|
return false;
|
|
|
|
if( scaleSelection != aPcbPlotParams.scaleSelection )
|
|
|
|
return false;
|
|
|
|
if( !outputDirectory.IsSameAs( aPcbPlotParams.outputDirectory ) )
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool PCB_PLOT_PARAMS::operator!=( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
|
|
|
|
{
|
|
|
|
return !( *this == aPcbPlotParams );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-03 22:26:30 +00:00
|
|
|
bool PCB_PLOT_PARAMS::SetHpglPenDiameter( int aValue )
|
|
|
|
{
|
|
|
|
return setInt( &m_HPGLPenDiam, aValue, HPGL_PEN_DIAMETER_MIN, HPGL_PEN_DIAMETER_MAX );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool PCB_PLOT_PARAMS::SetHpglPenSpeed( int aValue )
|
|
|
|
{
|
|
|
|
return setInt( &m_HPGLPenSpeed, aValue, HPGL_PEN_SPEED_MIN, HPGL_PEN_SPEED_MAX );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool PCB_PLOT_PARAMS::SetHpglPenOverlay( int aValue )
|
|
|
|
{
|
|
|
|
return setInt( &m_HPGLPenOvr, aValue, HPGL_PEN_OVERLAY_MIN, HPGL_PEN_OVERLAY_MAX );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool PCB_PLOT_PARAMS::SetPlotLineWidth( int aValue )
|
|
|
|
{
|
|
|
|
return setInt( &m_PlotLineWidth, aValue, PLOT_LINEWIDTH_MIN, PLOT_LINEWIDTH_MAX );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-28 22:54:16 +00:00
|
|
|
// PCB_PLOT_PARAMS_PARSER
|
|
|
|
|
|
|
|
PCB_PLOT_PARAMS_PARSER::PCB_PLOT_PARAMS_PARSER( LINE_READER* aReader ) :
|
|
|
|
PCB_PLOT_PARAMS_LEXER( aReader )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PCB_PLOT_PARAMS_PARSER::PCB_PLOT_PARAMS_PARSER( char* aLine, wxString aSource ) :
|
|
|
|
PCB_PLOT_PARAMS_LEXER( aLine, aSource )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_ERROR, PARSE_ERROR )
|
|
|
|
{
|
|
|
|
T token;
|
|
|
|
while( ( token = NextTok() ) != T_RIGHT )
|
|
|
|
{
|
|
|
|
if( token == T_EOF)
|
|
|
|
Unexpected( T_EOF );
|
|
|
|
|
|
|
|
if( token == T_LEFT )
|
|
|
|
token = NextTok();
|
|
|
|
|
|
|
|
if( token == T_pcbplotparams )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
switch( token )
|
|
|
|
{
|
|
|
|
case T_layerselection:
|
|
|
|
token = NextTok();
|
|
|
|
if( token != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
|
|
|
aPcbPlotParams->layerSelection = atol( CurText() );
|
|
|
|
break;
|
|
|
|
case T_usegerberextensions:
|
|
|
|
aPcbPlotParams->useGerberExtensions = ParseBool();
|
|
|
|
break;
|
2011-02-17 17:11:20 +00:00
|
|
|
case T_psa4output:
|
|
|
|
aPcbPlotParams->psA4Output = ParseBool();
|
|
|
|
break;
|
2011-01-28 22:54:16 +00:00
|
|
|
case T_excludeedgelayer:
|
|
|
|
aPcbPlotParams->m_ExcludeEdgeLayer = ParseBool();
|
|
|
|
break;
|
|
|
|
case T_linewidth:
|
2011-02-03 22:26:30 +00:00
|
|
|
aPcbPlotParams->m_PlotLineWidth = ParseInt( PLOT_LINEWIDTH_MIN,
|
|
|
|
PLOT_LINEWIDTH_MAX );
|
2011-01-28 22:54:16 +00:00
|
|
|
break;
|
|
|
|
case T_plotframeref:
|
|
|
|
aPcbPlotParams->m_PlotFrameRef = ParseBool();
|
|
|
|
break;
|
|
|
|
case T_viasonmask:
|
|
|
|
aPcbPlotParams->m_PlotViaOnMaskLayer = ParseBool();
|
|
|
|
break;
|
|
|
|
case T_mode:
|
|
|
|
aPcbPlotParams->m_PlotMode = (GRTraceMode)ParseInt( 0, 2 );
|
|
|
|
break;
|
|
|
|
case T_useauxorigin:
|
|
|
|
aPcbPlotParams->useAuxOrigin = ParseBool();
|
|
|
|
break;
|
|
|
|
case T_hpglpennumber:
|
2011-02-03 22:26:30 +00:00
|
|
|
aPcbPlotParams->m_HPGLPenNum = ParseInt( HPGL_PEN_NUMBER_MIN,
|
|
|
|
HPGL_PEN_NUMBER_MAX );
|
2011-01-28 22:54:16 +00:00
|
|
|
break;
|
|
|
|
case T_hpglpenspeed:
|
2011-02-03 22:26:30 +00:00
|
|
|
aPcbPlotParams->m_HPGLPenSpeed = ParseInt( HPGL_PEN_SPEED_MIN,
|
|
|
|
HPGL_PEN_SPEED_MAX );
|
2011-01-28 22:54:16 +00:00
|
|
|
break;
|
|
|
|
case T_hpglpendiameter:
|
2011-02-03 22:26:30 +00:00
|
|
|
aPcbPlotParams->m_HPGLPenDiam = ParseInt( HPGL_PEN_DIAMETER_MIN,
|
|
|
|
HPGL_PEN_DIAMETER_MAX );
|
2011-01-28 22:54:16 +00:00
|
|
|
break;
|
|
|
|
case T_hpglpenoverlay:
|
2011-02-03 22:26:30 +00:00
|
|
|
aPcbPlotParams->m_HPGLPenOvr = ParseInt( HPGL_PEN_OVERLAY_MIN,
|
|
|
|
HPGL_PEN_OVERLAY_MIN );
|
2011-01-28 22:54:16 +00:00
|
|
|
break;
|
|
|
|
case T_pscolor:
|
|
|
|
aPcbPlotParams->m_PlotPSColorOpt = ParseBool();
|
|
|
|
break;
|
|
|
|
case T_psnegative:
|
|
|
|
aPcbPlotParams->m_PlotPSNegative = ParseBool();
|
|
|
|
break;
|
|
|
|
case T_plotreference:
|
|
|
|
aPcbPlotParams->m_PlotReference = ParseBool();
|
|
|
|
break;
|
|
|
|
case T_plotvalue:
|
|
|
|
aPcbPlotParams->m_PlotValue = ParseBool();
|
|
|
|
break;
|
|
|
|
case T_plotothertext:
|
|
|
|
aPcbPlotParams->m_PlotTextOther = ParseBool();
|
|
|
|
break;
|
|
|
|
case T_plotinvisibletext:
|
|
|
|
aPcbPlotParams->m_PlotInvisibleTexts = ParseBool();
|
|
|
|
break;
|
|
|
|
case T_padsonsilk:
|
|
|
|
aPcbPlotParams->m_PlotPadsOnSilkLayer= ParseBool();
|
|
|
|
break;
|
|
|
|
case T_subtractmaskfromsilk:
|
|
|
|
aPcbPlotParams->subtractMaskFromSilk = ParseBool();
|
|
|
|
break;
|
|
|
|
case T_outputformat:
|
2011-02-16 22:54:44 +00:00
|
|
|
aPcbPlotParams->m_PlotFormat = ParseInt( 0, 3 );
|
2011-01-28 22:54:16 +00:00
|
|
|
break;
|
|
|
|
case T_mirror:
|
|
|
|
aPcbPlotParams->m_PlotMirror = ParseBool();
|
|
|
|
break;
|
|
|
|
case T_drillshape:
|
|
|
|
aPcbPlotParams->m_DrillShapeOpt = (PCB_PLOT_PARAMS::DrillShapeOptT) ParseInt( 0, 2 );
|
|
|
|
break;
|
|
|
|
case T_scaleselection:
|
|
|
|
aPcbPlotParams->scaleSelection = ParseInt( 0, 4 );
|
|
|
|
break;
|
|
|
|
case T_outputdirectory:
|
|
|
|
NeedSYMBOL();
|
2011-02-28 18:36:19 +00:00
|
|
|
aPcbPlotParams->outputDirectory = FROM_UTF8( CurText() );
|
2011-01-28 22:54:16 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Unexpected( CurText() );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
NeedRIGHT();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool PCB_PLOT_PARAMS_PARSER::ParseBool() throw( IO_ERROR )
|
|
|
|
{
|
|
|
|
T token;
|
|
|
|
token = NeedSYMBOL();
|
|
|
|
if( token != T_false && token != T_true )
|
|
|
|
Expecting( "true|false" );
|
|
|
|
return (token == T_true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PCB_PLOT_PARAMS_PARSER::ParseInt( int aMin, int aMax ) throw( IO_ERROR )
|
|
|
|
{
|
|
|
|
T token;
|
|
|
|
int i;
|
|
|
|
token = NextTok();
|
|
|
|
if( token != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
|
|
|
i = atoi( CurText() );
|
|
|
|
|
|
|
|
if( i < aMin )
|
|
|
|
i = aMin;
|
|
|
|
else if( i > aMax )
|
|
|
|
i = aMax;
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|