KiCad PCB EDA Suite
footprint_editor_options.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
7  * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
8 *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
27 #include <fctsys.h>
28 #include <pcbnew.h>
29 #include <footprint_edit_frame.h>
30 #include <board_design_settings.h>
32 #include <pcbnew_id.h>
33 
34 
36 {
37  auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
39 
40  // Update everything
41  m_configParams.clear(); // boost::ptr_vector destroys the pointers inside
42 
43  // Display options:
44  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ),
45  &m_PolarCoords, false ) );
46  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ),
47  &displ_opts->m_DisplayPadFill, true ) );
48  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorGraphicLinesDisplayMode" ),
49  &displ_opts->m_DisplayModEdgeFill, FILLED ) );
50  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
51  &displ_opts->m_DisplayModTextFill, FILLED ) );
52  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
53  &displ_opts->m_DisplayModTextFill, FILLED ) );
54  m_configParams.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorTextsRefDefaultText" ),
55  &settings.m_RefDefaultText, wxT( "REF**" ) ) );
56 
57  // design settings
58  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorSilkLineWidth" ),
59  &settings.m_LineThickness[ LAYER_CLASS_SILK ],
60  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
61  nullptr, 1/IU_PER_MM, wxT( "FpEditorGrlineWidth" ) ) );
62 
63  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorSilkTextSizeH" ),
64  &settings.m_TextSize[ LAYER_CLASS_SILK ].x,
66  nullptr, 1/IU_PER_MM, wxT( "FpEditorTextsDefaultSizeH" ) ) );
67 
68  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorSilkTextSizeV" ),
69  &settings.m_TextSize[ LAYER_CLASS_SILK ].y,
71  nullptr, 1/IU_PER_MM, wxT( "FpEditorTextsDefaultSizeV" ) ) );
72 
73  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorSilkTextThickness" ),
74  &settings.m_TextThickness[ LAYER_CLASS_SILK ],
75  Millimeter2iu( DEFAULT_SILK_TEXT_WIDTH ), 1, TEXTS_MAX_WIDTH,
76  nullptr, 1/IU_PER_MM, wxT( "FpEditorTextsDefaultThickness" ) ) );
77 
78  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorSilkTextItalic" ),
79  &settings.m_TextItalic[ LAYER_CLASS_SILK ] ) );
80 
81  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCopperLineWidth" ),
83  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
84  nullptr, MM_PER_IU ) );
85 
86  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCopperTextSizeV" ),
87  &settings.m_TextSize[ LAYER_CLASS_COPPER ].y,
89  nullptr, MM_PER_IU ) );
90 
91  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCopperTextSizeH" ),
92  &settings.m_TextSize[ LAYER_CLASS_COPPER ].x,
94  nullptr, MM_PER_IU ) );
95 
96  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCopperTextThickness" ),
98  Millimeter2iu( DEFAULT_COPPER_TEXT_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
99  nullptr, MM_PER_IU ) );
100 
101  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorCopperTextItalic" ),
102  &settings.m_TextItalic[ LAYER_CLASS_COPPER ] ) );
103 
104  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorEdgeCutLineWidth" ),
105  &settings.m_LineThickness[ LAYER_CLASS_EDGES ],
106  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
107  nullptr, MM_PER_IU ) );
108 
109  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCourtyardLineWidth" ),
111  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
112  nullptr, MM_PER_IU ) );
113 
114  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorOthersLineWidth" ),
115  &settings.m_LineThickness[ LAYER_CLASS_OTHERS ],
116  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
117  nullptr, MM_PER_IU ) );
118 
119  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorOthersTextSizeV" ),
120  &settings.m_TextSize[ LAYER_CLASS_OTHERS ].x,
122  nullptr, MM_PER_IU ) );
123 
124  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorOthersTextSizeH" ),
125  &settings.m_TextSize[ LAYER_CLASS_OTHERS ].y,
127  nullptr, MM_PER_IU ) );
128 
129  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorOthersTextSizeThickness" ),
130  &settings.m_TextThickness[ LAYER_CLASS_OTHERS ],
131  Millimeter2iu( DEFAULT_TEXT_WIDTH ), 1, TEXTS_MAX_WIDTH,
132  nullptr, MM_PER_IU ) );
133 
134  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorOthersTextItalic" ),
135  &settings.m_TextItalic[ LAYER_CLASS_OTHERS ] ) );
136 
137  m_configParams.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorRefDefaultText" ),
138  &settings.m_RefDefaultText, wxT( "REF**" ) ) );
139 
140  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorRefDefaultVisibility" ),
141  &settings.m_RefDefaultVisibility, true ) );
142 
143  m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorRefDefaultLayer" ),
144  &settings.m_RefDefaultlayer,
145  int( F_SilkS ), int( F_SilkS ), int( F_Fab ) ) );
146 
147  m_configParams.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorValueDefaultText" ),
148  &settings.m_ValueDefaultText, wxT( "" ) ) );
149 
150  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorValueDefaultVisibility" ),
151  &settings.m_ValueDefaultVisibility, true ) );
152 
153  m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorValueDefaultLayer" ),
154  &settings.m_ValueDefaultlayer,
155  int( F_Fab ), int( F_SilkS ), int( F_Fab ) ) );
156 
157  return m_configParams;
158 }
#define DEFAULT_SILK_TEXT_WIDTH
wxString m_RefDefaultText
Default ref text on fp creation.
PARAM_CFG_ARRAY m_configParams
List of footprint editor configuration parameters.
A list of parameters type.
bool m_ValueDefaultVisibility
Default value text visibility on fp creation.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const override
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame.
#define TEXTS_MAX_WIDTH
Maximum text width in internal units (10 inches)
Definition: pcbnew.h:40
int m_ValueDefaultlayer
Default value text layer on fp creation.
Configuration parameter - Integer Class with unit conversion.
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
#define DEFAULT_TEXT_WIDTH
wxSize m_TextSize[LAYER_CLASS_COUNT]
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
#define DEFAULT_SILK_TEXT_SIZE
int m_TextThickness[LAYER_CLASS_COUNT]
#define DEFAULT_SILK_LINE_WIDTH
Configuration parameter - Integer Class.
bool m_TextItalic[LAYER_CLASS_COUNT]
Configuration parameter - Boolean Class.
#define TEXTS_MAX_SIZE
Maximum text size in internal units (10 inches)
Definition: pcbnew.h:39
wxString m_ValueDefaultText
Default value text on fp creation.
int m_LineThickness[LAYER_CLASS_COUNT]
Configuration parameter - wxString Class.
#define TEXTS_MIN_SIZE
Minimum text size in internal units (1 mil)
Definition: pcbnew.h:38
Board layer functions and definitions.
PARAM_CFG_ARRAY & GetConfigurationSettings()
Return the footprint editor settings list.
int m_RefDefaultlayer
Default ref text layer on fp creation.
#define DEFAULT_COPPER_TEXT_WIDTH
#define DEFAULT_COPPER_TEXT_SIZE
#define DEFAULT_TEXT_SIZE
bool m_RefDefaultVisibility
Default ref text visibility on fp creation.
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.