← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Saving plot dialog settings

 

On Wed, Jan 5, 2011 at 10:00 PM, Dick Hollenbeck <dick@xxxxxxxxxxx> wrote:

> If you were to write a Parse() and Format() function for your PLOT settings
> object, similar to those in new/sch_lib_table.cpp or class
> TEMPLATE_FIELD_NAMES, then you could stuff or retrieve the data almost
> anywhere, and it would be re-usable moving forward.  This includes the
> ability to:

I've attached a patch I might consider committing later. It moves
PCB_PLOT_PARAMS (and its parser) into a separate set of files. The
object/parser structure adheres to what Dick wrote here some time ago.
I have not included the x and y scale adjustments in the s-expression,
since I think that they will get in the way when making the plot
options object non-global (vs. g_PcbPlotOptions). I think that a
suitable place for the non-global version is the BOARD class. The
scale adjustments are saved now in the config system. If they are
needed in other objects, they can load/save the adjustments by
themselves.

In addition to what is included in the attached patch, I'd also change
the "Save Plot Settings" button in the plot dialog to read "Apply
Settings", since no settings are actually saved in the dialog (apart
from the scale adjustments). Only when saving the board file. If
necessary, OnModify() is called. The dialog layout would probably need
some work, too...

marco
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2011-01-11 20:34:29 +0000
+++ CMakeLists.txt	2011-01-26 20:21:16 +0000
@@ -206,9 +206,9 @@
 add_subdirectory(common)
 add_subdirectory(cvpcb)
 add_subdirectory(eeschema)
-add_subdirectory(gerbview)
 add_subdirectory(kicad)
 add_subdirectory(pcbnew)
+add_subdirectory(gerbview)
 add_subdirectory(polygon)
 add_subdirectory(polygon/kbool/src)
 add_subdirectory(potrace)

=== modified file 'pcbnew/CMakeLists.txt'
--- pcbnew/CMakeLists.txt	2011-01-19 20:46:07 +0000
+++ pcbnew/CMakeLists.txt	2011-01-26 20:21:16 +0000
@@ -154,6 +154,8 @@
     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 @@
    )
 
 
+# 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
 ###

=== modified file 'pcbnew/ioascii.cpp'
--- pcbnew/ioascii.cpp	2011-01-27 14:33:48 +0000
+++ pcbnew/ioascii.cpp	2011-01-27 14:34:22 +0000
@@ -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,24 @@
     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 )
+            {
+                D( printf( "pcbplotparams parsing error: '%s'\n",
+                           CONV_TO_UTF8( e.errorText ) ); );
+            }
+
+            continue;
+        }
+
         strtok( Line, " =\n\r" );
         data = strtok( NULL, " =\n\r" );
 
@@ -576,7 +596,6 @@
 
             continue;
         }
-
 #endif
     }
 
@@ -728,6 +747,15 @@
              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;
 }

=== added file 'pcbnew/pcb_plot_params.cpp'
--- pcbnew/pcb_plot_params.cpp	1970-01-01 00:00:00 +0000
+++ pcbnew/pcb_plot_params.cpp	2011-01-27 14:23:38 +0000
@@ -0,0 +1,383 @@
+
+/*
+ * 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
+ */
+
+#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"
+
+extern int g_DrawDefaultLineThickness;
+
+PCB_PLOT_PARAMS g_PcbPlotOptions;
+
+using namespace PCBPLOTPARAMS_T;
+
+const char* GetTokenName( T aTok )
+{
+    return PCB_PLOT_PARAMS_LEXER::TokenName( aTok );
+}
+
+
+// PCB_PLOT_PARAMS
+
+PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
+{
+    layerSelection         = LAYER_BACK | LAYER_FRONT
+        | SILKSCREEN_LAYER_FRONT | SILKSCREEN_LAYER_BACK;
+    useGerberExtensions    = true;
+    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;
+    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 )
+{
+    const char* falseStr = GetTokenName( T_false );
+    const char* trueStr = GetTokenName( T_true );
+
+    aFormatter->Print( aNestLevel, "(%s", GetTokenName( T_pcbplotparams ) );
+    aFormatter->Print( aNestLevel+1, "(%s %ld)\n", GetTokenName( T_layerselection ),
+                       layerSelection );
+    aFormatter->Print( aNestLevel+1, "(%s %s)\n", GetTokenName( T_usegerberextensions ),
+                       useGerberExtensions ? trueStr : falseStr );
+    aFormatter->Print( aNestLevel+1, "(%s %s)\n", GetTokenName( T_excludeedgelayer ),
+                       m_ExcludeEdgeLayer ? trueStr : falseStr );
+    aFormatter->Print( aNestLevel+1, "(%s %d)\n", GetTokenName( T_linewidth ),
+                       m_PlotLineWidth );
+    aFormatter->Print( aNestLevel+1, "(%s %s)\n", GetTokenName( T_plotframeref ),
+                       m_PlotFrameRef ? trueStr : falseStr );
+    aFormatter->Print( aNestLevel+1, "(%s %s)\n", GetTokenName( T_viasonmask ),
+                       m_PlotViaOnMaskLayer ? trueStr : falseStr );
+    aFormatter->Print( aNestLevel+1, "(%s %d)\n", GetTokenName( T_mode ),
+                       m_PlotMode );
+    aFormatter->Print( aNestLevel+1, "(%s %s)\n", GetTokenName( T_useauxorigin ),
+                       useAuxOrigin ? trueStr : falseStr );
+    aFormatter->Print( aNestLevel+1, "(%s %d)\n", GetTokenName( T_hpglpennumber ),
+                       m_HPGLPenNum );
+    aFormatter->Print( aNestLevel+1, "(%s %d)\n", GetTokenName( T_hpglpenspeed ),
+                       m_HPGLPenSpeed );
+    aFormatter->Print( aNestLevel+1, "(%s %d)\n", GetTokenName( T_hpglpendiameter ),
+                       m_HPGLPenDiam );
+    aFormatter->Print( aNestLevel+1, "(%s %d)\n", GetTokenName( T_hpglpenoverlay ),
+                       m_HPGLPenOvr );
+    aFormatter->Print( aNestLevel+1, "(%s %s)\n", GetTokenName( T_pscolor ),
+                       m_PlotPSColorOpt ? trueStr : falseStr );
+    aFormatter->Print( aNestLevel+1, "(%s %s)\n", GetTokenName( T_psnegative ),
+                       m_PlotPSNegative ? trueStr : falseStr );
+    aFormatter->Print( aNestLevel+1, "(%s %s)\n", GetTokenName( T_plotreference ),
+                       m_PlotReference ? trueStr : falseStr );
+    aFormatter->Print( aNestLevel+1, "(%s %s)\n", GetTokenName( T_plotvalue ),
+                       m_PlotValue ? trueStr : falseStr );
+    aFormatter->Print( aNestLevel+1, "(%s %s)\n", GetTokenName( T_plotothertext ),
+                       m_PlotTextOther ? trueStr : falseStr );
+    aFormatter->Print( aNestLevel+1, "(%s %s)\n", GetTokenName( T_plotinvisibletext ),
+                       m_PlotInvisibleTexts ? trueStr : falseStr );
+    aFormatter->Print( aNestLevel+1, "(%s %s)\n", GetTokenName( T_padsonsilk ),
+                       m_PlotPadsOnSilkLayer ? trueStr : falseStr );
+    aFormatter->Print( aNestLevel+1, "(%s %s)\n", GetTokenName( T_subtractmaskfromsilk ),
+                       subtractMaskFromSilk ? trueStr : falseStr );
+    aFormatter->Print( aNestLevel+1, "(%s %d)\n", GetTokenName( T_outputformat ),
+                       m_PlotFormat );
+    aFormatter->Print( aNestLevel+1, "(%s %s)\n", GetTokenName( T_mirror ),
+                       m_PlotMirror ? trueStr : falseStr );
+    aFormatter->Print( aNestLevel+1, "(%s %d)\n", GetTokenName( T_drillshape ),
+                       m_DrillShapeOpt );
+    aFormatter->Print( aNestLevel+1, "(%s %d)\n", GetTokenName( T_scaleselection ),
+                       scaleSelection );
+    aFormatter->Print( aNestLevel+1, "(%s \"%s\")\n", GetTokenName( T_outputdirectory ),
+                       CONV_TO_UTF8( outputDirectory ) );
+    aFormatter->Print( 0, ")\n" );
+}
+
+
+void PCB_PLOT_PARAMS::Parse( PCB_PLOT_PARAMS_PARSER* aParser ) throw( IO_ERROR, PARSE_ERROR )
+{
+    aParser->Parse( this );
+}
+
+
+PCB_PLOT_PARAMS& PCB_PLOT_PARAMS::operator=( const PCB_PLOT_PARAMS &aPcbPlotParams )
+{
+    layerSelection = aPcbPlotParams.layerSelection;
+    useGerberExtensions = aPcbPlotParams.useGerberExtensions;
+    m_ExcludeEdgeLayer = aPcbPlotParams.m_ExcludeEdgeLayer;
+    m_PlotLineWidth = aPcbPlotParams.m_PlotLineWidth;
+    m_PlotFrameRef = aPcbPlotParams.m_PlotFrameRef;
+    m_PlotViaOnMaskLayer = aPcbPlotParams.m_PlotViaOnMaskLayer;
+    m_PlotMode = aPcbPlotParams.m_PlotMode;
+    useAuxOrigin = aPcbPlotParams.useAuxOrigin;
+    m_HPGLPenNum = aPcbPlotParams.m_HPGLPenNum;
+    m_HPGLPenSpeed = aPcbPlotParams.m_HPGLPenSpeed;
+    m_HPGLPenDiam = aPcbPlotParams.m_HPGLPenDiam;
+    m_HPGLPenOvr = aPcbPlotParams.m_HPGLPenOvr;
+    m_PlotPSColorOpt = aPcbPlotParams.m_PlotPSColorOpt;
+    m_PlotPSNegative = aPcbPlotParams.m_PlotPSNegative;
+    m_PlotReference = aPcbPlotParams.m_PlotReference;
+    m_PlotValue = aPcbPlotParams.m_PlotValue;
+    m_PlotTextOther = aPcbPlotParams.m_PlotTextOther;
+    m_PlotInvisibleTexts = aPcbPlotParams.m_PlotInvisibleTexts;
+    m_PlotPadsOnSilkLayer = aPcbPlotParams.m_PlotPadsOnSilkLayer;
+    subtractMaskFromSilk = aPcbPlotParams.subtractMaskFromSilk;
+    m_PlotFormat = aPcbPlotParams.m_PlotFormat;
+    m_PlotMirror = aPcbPlotParams.m_PlotMirror;
+    m_DrillShapeOpt = aPcbPlotParams.m_DrillShapeOpt;
+    scaleSelection = aPcbPlotParams.scaleSelection;
+    outputDirectory = aPcbPlotParams.outputDirectory;
+    return *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;
+    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 );
+}
+
+
+// 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 && token != 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;
+        case T_excludeedgelayer:
+            aPcbPlotParams->m_ExcludeEdgeLayer = ParseBool();
+            break;
+        case T_linewidth:
+            aPcbPlotParams->m_PlotLineWidth = ParseInt( 40, 200 );
+            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:
+            aPcbPlotParams->m_HPGLPenNum = ParseInt( 1, 16 );
+            break;
+        case T_hpglpenspeed:
+            aPcbPlotParams->m_HPGLPenSpeed = ParseInt( 0, 1000 );
+            break;
+        case T_hpglpendiameter:
+            aPcbPlotParams->m_HPGLPenDiam = ParseInt( 0, 100 );
+            break;
+        case T_hpglpenoverlay:
+            aPcbPlotParams->m_HPGLPenOvr = ParseInt( 0, 0x100 );
+            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:
+            aPcbPlotParams->m_PlotFormat = ParseInt( 0, 4 );
+            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:
+            token = NextTok();
+            if( token != T_STRING )
+                Expecting( T_STRING );
+            aPcbPlotParams->outputDirectory = CONV_FROM_UTF8( CurText() );
+            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;
+}

=== added file 'pcbnew/pcb_plot_params.h'
--- pcbnew/pcb_plot_params.h	1970-01-01 00:00:00 +0000
+++ pcbnew/pcb_plot_params.h	2011-01-27 14:23:09 +0000
@@ -0,0 +1,144 @@
+
+/*
+ * 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_

=== added file 'pcbnew/pcb_plot_params.keywords'
--- pcbnew/pcb_plot_params.keywords	1970-01-01 00:00:00 +0000
+++ pcbnew/pcb_plot_params.keywords	2011-01-26 20:21:16 +0000
@@ -0,0 +1,28 @@
+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

=== modified file 'pcbnew/pcbnew_config.cpp'
--- pcbnew/pcbnew_config.cpp	2011-01-20 16:34:57 +0000
+++ pcbnew/pcbnew_config.cpp	2011-01-26 20:21:16 +0000
@@ -398,34 +398,5 @@
                                                     &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;
 }

=== modified file 'pcbnew/pcbplot.cpp'
--- pcbnew/pcbplot.cpp	2011-01-20 16:34:57 +0000
+++ pcbnew/pcbplot.cpp	2011-01-26 22:54:26 +0000
@@ -17,11 +17,11 @@
 #include "pcbstruct.h"
 #include "class_board_design_settings.h"
 #include "dialog_plot_base.h"
+#include "pcb_plot_params.h"
 
 #define PLOT_DEFAULT_MARGE 300      // mils
 
 /* Keywords to r/w options in m_Config */
-#define OPTKEY_GERBER_EXTENSIONS wxT( "GerberOptUseLayersExt" )
 #define OPTKEY_XFINESCALE_ADJ    wxT( "PlotXFineScaleAdj" )
 #define OPTKEY_YFINESCALE_ADJ    wxT( "PlotYFineScaleAdj" )
 
@@ -29,32 +29,7 @@
 #define MIN_SCALE 0.01
 #define MAX_SCALE 100.0
 
-// PCB_PLOT_PARAMS constructor: set the default values for plot options:
-PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
-{
-    m_SubtractMaskFromSilk = false;
-    m_PlotReference = true;
-    m_PlotValue     = true;
-    m_PlotTextOther = true;
-    m_DrillShapeOpt = PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE;
-    m_PlotMode  = FILLED;
-    m_PlotScale = 1.0;
-    m_AutoScale = false;
-    m_FineScaleAdjustX = 1.0;
-    m_FineScaleAdjustY = 1.0;
-    outputDirectory    = wxT( "" );
-}
-
-
-static long s_SelectedLayers = LAYER_BACK | LAYER_FRONT |
-                               SILKSCREEN_LAYER_FRONT | SILKSCREEN_LAYER_BACK;
-
-static bool s_PlotOriginIsAuxAxis = FALSE;
-
-
-/* The group of plot options - sadly global XXX */
-PCB_PLOT_PARAMS g_PcbPlotOptions;
-extern int       g_DrawDefaultLineThickness;
+extern int      g_DrawDefaultLineThickness;
 
 
 /*******************************/
@@ -69,8 +44,6 @@
     wxCheckBox*      m_BoxSelectLayer[LAYER_COUNT];     // wxCheckBox list to select/deselec layers to plot
     double           m_XScaleAdjust;
     double           m_YScaleAdjust;
-    static           int m_dlgPlotScaleOpt;         // Static to remember last selection
-
 
     bool useA4()
     {
@@ -117,8 +90,6 @@
     void CreateDrillFile( wxCommandEvent& event );
 };
 
-int DIALOG_PLOT::m_dlgPlotScaleOpt = 1;
-
 const int UNITS_MILS = 1000;
 
 
@@ -149,7 +120,6 @@
     m_plotFormatOpt->SetSelection( g_PcbPlotOptions.m_PlotFormat );
     g_PcbPlotOptions.m_PlotLineWidth = g_DrawDefaultLineThickness;
 
-
     // Set units and value for HPGL pen speed.
     AddUnitSymbol( *m_textPenSize, g_UserUnit );
     msg = ReturnStringFromValue( g_UserUnit, g_PcbPlotOptions.m_HPGLPenDiam, UNITS_MILS );
@@ -171,12 +141,9 @@
                                  PCB_INTERNAL_UNIT );
     m_linesWidth->AppendText( msg );
 
-    if( s_PlotOriginIsAuxAxis )
+    if( g_PcbPlotOptions.GetUseAuxOrigin() )
         m_choicePlotOffset->SetSelection( 1 );
 
-    // Create scale adjust option
-    m_XScaleAdjust = m_YScaleAdjust = 1.0;
-
     // Test for a reasonable scale value. Set to 1 if problem
     if( m_XScaleAdjust < MIN_SCALE || m_YScaleAdjust < MIN_SCALE
         || m_XScaleAdjust > MAX_SCALE || m_YScaleAdjust > MAX_SCALE )
@@ -193,7 +160,6 @@
 
     // Create layer list.
     int      layer;
-    wxString layerKey;
     for( layer = 0; layer < NB_LAYERS; ++layer )
     {
         if( !board->IsLayerEnabled( layer ) )
@@ -223,24 +189,14 @@
             m_TechnicalLayersBoxSizer->Add( m_BoxSelectLayer[layer],
                                             0, wxGROW | wxALL, 1 );
 
-
-        layerKey.Printf( OPTKEY_LAYERBASE, layer );
-        bool option;
-        if( m_Config->Read( layerKey, &option ) )
-            m_BoxSelectLayer[layer]->SetValue( option );
-        else
-        {
-            long mask = 1 << layer;
-            if( mask & s_SelectedLayers )
-                m_BoxSelectLayer[layer]->SetValue( true );
-        }
+        long mask = 1 << layer;
+        if( g_PcbPlotOptions.GetLayerSelection() & mask )
+            m_BoxSelectLayer[layer]->SetValue( true );
     }
 
 
     // Option for using proper Gerber extensions
-    long ltmp;
-    m_Config->Read( OPTKEY_GERBER_EXTENSIONS, &ltmp );
-    m_useGerberExtensions->SetValue( ltmp );
+    m_useGerberExtensions->SetValue( g_PcbPlotOptions.GetUseGerberExtensions() );
 
     // Option for excluding contents of "Edges Pcb" layer
     m_excludeEdgeLayerOpt->SetValue( g_PcbPlotOptions.m_ExcludeEdgeLayer );
@@ -271,7 +227,7 @@
     m_drillShapeOpt->SetSelection( g_PcbPlotOptions.m_DrillShapeOpt );
 
     // Scale option
-    m_scaleOpt->SetSelection( m_dlgPlotScaleOpt );
+    m_scaleOpt->SetSelection( g_PcbPlotOptions.GetScaleSelection() );
 
     // Plot mode
     m_plotModeOpt->SetSelection( g_PcbPlotOptions.m_PlotMode );
@@ -442,71 +398,84 @@
 
 void DIALOG_PLOT::savePlotOptions( wxCommandEvent& event )
 {
-    g_PcbPlotOptions.m_ExcludeEdgeLayer = m_excludeEdgeLayerOpt->GetValue();
-
-    g_PcbPlotOptions.SetSubtractMaskFromSilk( m_subtractMaskFromSilk->GetValue() );
+    PCB_PLOT_PARAMS tempOptions;
+
+    tempOptions.m_ExcludeEdgeLayer = m_excludeEdgeLayerOpt->GetValue();
+
+    tempOptions.SetSubtractMaskFromSilk( m_subtractMaskFromSilk->GetValue() );
 
     if( m_plotSheetRef )
-        g_PcbPlotOptions.m_PlotFrameRef = m_plotSheetRef->GetValue();
-
-    g_PcbPlotOptions.m_PlotPadsOnSilkLayer = m_plotPads_on_Silkscreen->GetValue();
-
-    s_PlotOriginIsAuxAxis =
-        (m_choicePlotOffset->GetSelection() == 0) ? FALSE : TRUE;
-
-    g_PcbPlotOptions.m_PlotValue     = m_plotModuleValueOpt->GetValue();
-    g_PcbPlotOptions.m_PlotReference = m_plotModuleRefOpt->GetValue();
-    g_PcbPlotOptions.m_PlotTextOther = m_plotTextOther->GetValue();
-    g_PcbPlotOptions.m_PlotInvisibleTexts = m_plotInvisibleText->GetValue();
-
-    m_dlgPlotScaleOpt  = m_scaleOpt->GetSelection();
-    g_PcbPlotOptions.m_DrillShapeOpt =
+        tempOptions.m_PlotFrameRef = m_plotSheetRef->GetValue();
+
+    tempOptions.m_PlotPadsOnSilkLayer = m_plotPads_on_Silkscreen->GetValue();
+
+    if( m_choicePlotOffset->GetSelection() == 0 )
+        tempOptions.SetUseAuxOrigin( false );
+    else
+        tempOptions.SetUseAuxOrigin( true );
+
+    tempOptions.m_PlotValue     = m_plotModuleValueOpt->GetValue();
+    tempOptions.m_PlotReference = m_plotModuleRefOpt->GetValue();
+    tempOptions.m_PlotTextOther = m_plotTextOther->GetValue();
+    tempOptions.m_PlotInvisibleTexts = m_plotInvisibleText->GetValue();
+
+    tempOptions.SetScaleSelection( m_scaleOpt->GetSelection() );
+
+    tempOptions.m_DrillShapeOpt =
         (PCB_PLOT_PARAMS::DrillShapeOptT) m_drillShapeOpt->GetSelection();
-    g_PcbPlotOptions.m_PlotMirror = m_plotMirrorOpt->GetValue();
-    g_PcbPlotOptions.m_PlotMode   = (GRTraceMode) m_plotModeOpt->GetSelection();
-    g_PcbPlotOptions.m_PlotViaOnMaskLayer = m_plotNoViaOnMaskOpt->GetValue();
+    tempOptions.m_PlotMirror = m_plotMirrorOpt->GetValue();
+    tempOptions.m_PlotMode   = (GRTraceMode) m_plotModeOpt->GetSelection();
+    tempOptions.m_PlotViaOnMaskLayer = m_plotNoViaOnMaskOpt->GetValue();
 
     wxString msg = m_HPGLPenSizeOpt->GetValue();
     int      tmp = ReturnValueFromString( g_UserUnit, msg, UNITS_MILS );
-    g_PcbPlotOptions.m_HPGLPenDiam = tmp;
+    tempOptions.m_HPGLPenDiam = tmp;
 
     msg = m_HPGLPenSpeedOpt->GetValue();
-    tmp = ReturnValueFromString( MILLIMETRES, msg, 1 );
-    g_PcbPlotOptions.m_HPGLPenSpeed = tmp;
+    tmp = ReturnValueFromString( UNSCALED_UNITS, msg, 1 );
+    tempOptions.m_HPGLPenSpeed = tmp;
 
     msg = m_HPGLPenOverlayOpt->GetValue();
     tmp = ReturnValueFromString( g_UserUnit, msg, UNITS_MILS );
-    g_PcbPlotOptions.m_HPGLPenOvr = tmp;
+    tempOptions.m_HPGLPenOvr = tmp;
 
     msg = m_linesWidth->GetValue();
     tmp = ReturnValueFromString( g_UserUnit, msg, PCB_INTERNAL_UNIT );
-    g_PcbPlotOptions.m_PlotLineWidth = tmp;
-    g_DrawDefaultLineThickness = g_PcbPlotOptions.m_PlotLineWidth;
+    tempOptions.m_PlotLineWidth = tmp;
+    g_DrawDefaultLineThickness = tempOptions.m_PlotLineWidth;
 
     msg = m_fineAdjustXscaleOpt->GetValue();
     msg.ToDouble( &m_XScaleAdjust );
     msg = m_fineAdjustYscaleOpt->GetValue();
     msg.ToDouble( &m_YScaleAdjust );
 
-    m_Config->Write( OPTKEY_GERBER_EXTENSIONS,
-                    m_useGerberExtensions->GetValue() );
+    tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() );
     m_Config->Write( OPTKEY_XFINESCALE_ADJ, m_XScaleAdjust );
     m_Config->Write( OPTKEY_YFINESCALE_ADJ, m_YScaleAdjust );
 
-    g_PcbPlotOptions.m_PlotFormat = m_plotFormatOpt->GetSelection();
+    tempOptions.m_PlotFormat = m_plotFormatOpt->GetSelection();
 
-    wxString layerKey;
-    for( int layer = 0; layer<NB_LAYERS; ++layer )
+    long selectedLayers = 0;
+    long mask = 1;
+    int layer;
+    for( layer = 0; layer < NB_LAYERS; layer++, mask <<= 1 )
     {
         if( m_BoxSelectLayer[layer] == NULL )
             continue;
-        layerKey.Printf( OPTKEY_LAYERBASE, layer );
-        m_Config->Write( layerKey, m_BoxSelectLayer[layer]->IsChecked() );
-    }
-
-    g_PcbPlotOptions.m_PlotPSNegative = m_plotPSNegativeOpt->GetValue();
-
-    g_PcbPlotOptions.SetOutputDirectory( m_outputDirectoryName->GetValue() );
+        if( m_BoxSelectLayer[layer]->GetValue() )
+            selectedLayers |= mask;
+    }
+    tempOptions.SetLayerSelection( selectedLayers );
+
+    tempOptions.m_PlotPSNegative = m_plotPSNegativeOpt->GetValue();
+
+    tempOptions.SetOutputDirectory( m_outputDirectoryName->GetValue() );
+
+    if( g_PcbPlotOptions != tempOptions )
+    {
+        g_PcbPlotOptions = tempOptions;
+        m_Parent->OnModify();
+    }
 }
 
 
@@ -538,7 +507,7 @@
 
     g_PcbPlotOptions.m_AutoScale = false;
     g_PcbPlotOptions.m_PlotScale = 1;
-    switch( m_dlgPlotScaleOpt )
+    switch( g_PcbPlotOptions.GetScaleSelection() )
     {
     default:
         break;
@@ -601,8 +570,7 @@
         DisplayInfoMessage( this,
                            _( "Warning: Scale option set to a very large value" ) );
 
-    int mask = 1;
-    s_SelectedLayers = 0;
+    long mask = 1;
     for( layer = 0; layer < NB_LAYERS; layer++, mask <<= 1 )
     {
         if( m_BoxSelectLayer[layer] == NULL )
@@ -610,8 +578,6 @@
         bool success = false;
         if( m_BoxSelectLayer[layer]->GetValue() )
         {
-            s_SelectedLayers |= mask;
-
             fn = m_Parent->GetScreen()->GetFileName();
             fn.SetPath( m_outputDirectoryName->GetValue() );
 
@@ -711,7 +677,7 @@
 
             case PLOT_FORMAT_GERBER:
                 success = m_Parent->Genere_GERBER( fn.GetFullPath(), layer,
-                                                   s_PlotOriginIsAuxAxis,
+                                                   g_PcbPlotOptions.GetUseAuxOrigin(),
                                                    g_PcbPlotOptions.m_PlotMode );
                 break;
 
@@ -740,7 +706,7 @@
     // If no layer selected, we have nothing plotted.
     // Prompt user if it happens
     // because he could think there is a bug in pcbnew:
-    if( s_SelectedLayers == 0 )
+    if( !g_PcbPlotOptions.GetLayerSelection() )
         DisplayError( this, _( "No layer selected" ) );
 }
 

=== modified file 'pcbnew/pcbplot.h'
--- pcbnew/pcbplot.h	2010-12-12 11:41:18 +0000
+++ pcbnew/pcbplot.h	2011-01-26 20:21:16 +0000
@@ -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 );


Follow ups

References