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 
33 
35 {
36  auto& displ_opts = m_DisplayOptions;
38 
39  // Update everything
40  m_configParams.clear(); // boost::ptr_vector destroys the pointers inside
41 
42  // Display options:
43  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ),
44  &m_PolarCoords, false ) );
45  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ),
46  &displ_opts.m_DisplayPadFill, true ) );
47  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorGraphicLinesDisplayMode" ),
48  &displ_opts.m_DisplayModEdgeFill, FILLED ) );
49  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
50  &displ_opts.m_DisplayModTextFill, FILLED ) );
51  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
52  &displ_opts.m_DisplayModTextFill, FILLED ) );
53  m_configParams.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorTextsRefDefaultText" ),
54  &settings.m_RefDefaultText, wxT( "REF**" ) ) );
55 
56  // design settings
57  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorSilkLineWidth" ),
58  &settings.m_LineThickness[ LAYER_CLASS_SILK ],
59  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
60  nullptr, 1/IU_PER_MM, wxT( "FpEditorGrlineWidth" ) ) );
61 
62  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorSilkTextSizeH" ),
63  &settings.m_TextSize[ LAYER_CLASS_SILK ].x,
65  nullptr, 1/IU_PER_MM, wxT( "FpEditorTextsDefaultSizeH" ) ) );
66 
67  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorSilkTextSizeV" ),
68  &settings.m_TextSize[ LAYER_CLASS_SILK ].y,
70  nullptr, 1/IU_PER_MM, wxT( "FpEditorTextsDefaultSizeV" ) ) );
71 
72  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorSilkTextThickness" ),
73  &settings.m_TextThickness[ LAYER_CLASS_SILK ],
74  Millimeter2iu( DEFAULT_SILK_TEXT_WIDTH ), 1, TEXTS_MAX_WIDTH,
75  nullptr, 1/IU_PER_MM, wxT( "FpEditorTextsDefaultThickness" ) ) );
76 
77  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorSilkTextItalic" ),
78  &settings.m_TextItalic[ LAYER_CLASS_SILK ] ) );
79 
80  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCopperLineWidth" ),
82  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
83  nullptr, MM_PER_IU ) );
84 
85  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCopperTextSizeV" ),
86  &settings.m_TextSize[ LAYER_CLASS_COPPER ].y,
88  nullptr, MM_PER_IU ) );
89 
90  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCopperTextSizeH" ),
91  &settings.m_TextSize[ LAYER_CLASS_COPPER ].x,
93  nullptr, MM_PER_IU ) );
94 
95  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCopperTextThickness" ),
97  Millimeter2iu( DEFAULT_COPPER_TEXT_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
98  nullptr, MM_PER_IU ) );
99 
100  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorCopperTextItalic" ),
101  &settings.m_TextItalic[ LAYER_CLASS_COPPER ] ) );
102 
103  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorEdgeCutLineWidth" ),
104  &settings.m_LineThickness[ LAYER_CLASS_EDGES ],
105  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
106  nullptr, MM_PER_IU ) );
107 
108  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCourtyardLineWidth" ),
110  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
111  nullptr, MM_PER_IU ) );
112 
113  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorOthersLineWidth" ),
114  &settings.m_LineThickness[ LAYER_CLASS_OTHERS ],
115  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
116  nullptr, MM_PER_IU ) );
117 
118  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorOthersTextSizeV" ),
119  &settings.m_TextSize[ LAYER_CLASS_OTHERS ].x,
121  nullptr, MM_PER_IU ) );
122 
123  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorOthersTextSizeH" ),
124  &settings.m_TextSize[ LAYER_CLASS_OTHERS ].y,
126  nullptr, MM_PER_IU ) );
127 
128  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorOthersTextSizeThickness" ),
129  &settings.m_TextThickness[ LAYER_CLASS_OTHERS ],
130  Millimeter2iu( DEFAULT_TEXT_WIDTH ), 1, TEXTS_MAX_WIDTH,
131  nullptr, MM_PER_IU ) );
132 
133  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorOthersTextItalic" ),
134  &settings.m_TextItalic[ LAYER_CLASS_OTHERS ] ) );
135 
136  m_configParams.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorRefDefaultText" ),
137  &settings.m_RefDefaultText, wxT( "REF**" ) ) );
138 
139  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorRefDefaultVisibility" ),
140  &settings.m_RefDefaultVisibility, true ) );
141 
142  m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorRefDefaultLayer" ),
143  &settings.m_RefDefaultlayer,
144  int( F_SilkS ), int( F_SilkS ), int( F_Fab ) ) );
145 
146  m_configParams.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorValueDefaultText" ),
147  &settings.m_ValueDefaultText, wxT( "" ) ) );
148 
149  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorValueDefaultVisibility" ),
150  &settings.m_ValueDefaultVisibility, true ) );
151 
152  m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorValueDefaultLayer" ),
153  &settings.m_ValueDefaultlayer,
154  int( F_Fab ), int( F_SilkS ), int( F_Fab ) ) );
155 
156  return m_configParams;
157 }
#define DEFAULT_SILK_TEXT_WIDTH
wxString m_RefDefaultText
Default ref text on fp creation.
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.
std::vector< PARAM_CFG * > m_configParams
#define DEFAULT_TEXT_WIDTH
wxSize m_TextSize[LAYER_CLASS_COUNT]
#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.
PCB_DISPLAY_OPTIONS m_DisplayOptions
#define TEXTS_MIN_SIZE
Minimum text size in internal units (1 mil)
Definition: pcbnew.h:38
Board layer functions and definitions.
std::vector< PARAM_CFG * > & 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.
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.