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 
32 #include <fctsys.h>
33 #include <class_drawpanel.h>
34 
35 #include <pcbnew.h>
36 #include <footprint_edit_frame.h>
37 #include <board_design_settings.h>
39 
40 #include <pcbnew_id.h>
41 
42 
43 void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
44 {
45  int id = event.GetId();
46  auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
47  bool state = m_optionsToolBar->GetToolToggled( id );
48 
49  switch( id )
50  {
52  displ_opts->m_DisplayPadFill = !state;
53  m_canvas->Refresh( );
54  break;
55 
57  displ_opts->m_DisplayViaFill = !state;
58  m_canvas->Refresh( );
59  break;
60 
62  displ_opts->m_DisplayModTextFill = state ? SKETCH : FILLED;
63  m_canvas->Refresh( );
64  break;
65 
67  displ_opts->m_DisplayModEdgeFill = state ? SKETCH : FILLED;
68  m_canvas->Refresh( );
69  break;
70 
72  displ_opts->m_ContrastModeDisplay = state;
73  m_canvas->Refresh( );
74  break;
75 
76  default:
77  wxMessageBox( wxT( "FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar error" ) );
78  break;
79  }
80 }
81 
82 
84 {
85  auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
87 
88  // Update everything
89  m_configParams.clear(); // boost::ptr_vector destroys the pointers inside
90 
91  // Display options:
92  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ),
93  &displ_opts->m_DisplayPolarCood, false ) );
94  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ),
95  &displ_opts->m_DisplayPadFill, true ) );
96  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorGraphicLinesDisplayMode" ),
97  &displ_opts->m_DisplayModEdgeFill, FILLED ) );
98  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
99  &displ_opts->m_DisplayModTextFill, FILLED ) );
100  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
101  &displ_opts->m_DisplayModTextFill, FILLED ) );
102  m_configParams.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorTextsRefDefaultText" ),
103  &settings.m_RefDefaultText, wxT( "REF**" ) ) );
104 
105  // design settings
106  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorSilkLineWidth" ),
107  &settings.m_LineThickness[ LAYER_CLASS_SILK ],
108  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
109  nullptr, 1/IU_PER_MM, wxT( "FpEditorGrlineWidth" ) ) );
110 
111  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorSilkTextSizeH" ),
112  &settings.m_TextSize[ LAYER_CLASS_SILK ].x,
114  nullptr, 1/IU_PER_MM, wxT( "FpEditorTextsDefaultSizeH" ) ) );
115 
116  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorSilkTextSizeV" ),
117  &settings.m_TextSize[ LAYER_CLASS_SILK ].y,
119  nullptr, 1/IU_PER_MM, wxT( "FpEditorTextsDefaultSizeV" ) ) );
120 
121  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorSilkTextThickness" ),
122  &settings.m_TextThickness[ LAYER_CLASS_SILK ],
123  Millimeter2iu( DEFAULT_SILK_TEXT_WIDTH ), 1, TEXTS_MAX_WIDTH,
124  nullptr, 1/IU_PER_MM, wxT( "FpEditorTextsDefaultThickness" ) ) );
125 
126  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorSilkTextItalic" ),
127  &settings.m_TextItalic[ LAYER_CLASS_SILK ] ) );
128 
129  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCopperLineWidth" ),
130  &settings.m_LineThickness[ LAYER_CLASS_COPPER ],
131  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
132  nullptr, MM_PER_IU ) );
133 
134  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCopperTextSizeV" ),
135  &settings.m_TextSize[ LAYER_CLASS_COPPER ].y,
137  nullptr, MM_PER_IU ) );
138 
139  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCopperTextSizeH" ),
140  &settings.m_TextSize[ LAYER_CLASS_COPPER ].x,
142  nullptr, MM_PER_IU ) );
143 
144  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCopperTextThickness" ),
145  &settings.m_TextThickness[ LAYER_CLASS_COPPER ],
146  Millimeter2iu( DEFAULT_COPPER_TEXT_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
147  nullptr, MM_PER_IU ) );
148 
149  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorCopperTextItalic" ),
150  &settings.m_TextItalic[ LAYER_CLASS_COPPER ] ) );
151 
152  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorEdgeCutLineWidth" ),
153  &settings.m_LineThickness[ LAYER_CLASS_EDGES ],
154  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
155  nullptr, MM_PER_IU ) );
156 
157  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorCourtyardLineWidth" ),
159  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
160  nullptr, MM_PER_IU ) );
161 
162  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorOthersLineWidth" ),
163  &settings.m_LineThickness[ LAYER_CLASS_OTHERS ],
164  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
165  nullptr, MM_PER_IU ) );
166 
167  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorOthersTextSizeV" ),
168  &settings.m_TextSize[ LAYER_CLASS_OTHERS ].x,
170  nullptr, MM_PER_IU ) );
171 
172  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorOthersTextSizeH" ),
173  &settings.m_TextSize[ LAYER_CLASS_OTHERS ].y,
175  nullptr, MM_PER_IU ) );
176 
177  m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorOthersTextSizeThickness" ),
178  &settings.m_TextThickness[ LAYER_CLASS_OTHERS ],
179  Millimeter2iu( DEFAULT_TEXT_WIDTH ), 1, TEXTS_MAX_WIDTH,
180  nullptr, MM_PER_IU ) );
181 
182  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorOthersTextItalic" ),
183  &settings.m_TextItalic[ LAYER_CLASS_OTHERS ] ) );
184 
185  m_configParams.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorRefDefaultText" ),
186  &settings.m_RefDefaultText, wxT( "REF**" ) ) );
187 
188  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorRefDefaultVisibility" ),
189  &settings.m_RefDefaultVisibility, true ) );
190 
191  m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorRefDefaultLayer" ),
192  &settings.m_RefDefaultlayer,
193  int( F_SilkS ), int( F_SilkS ), int( F_Fab ) ) );
194 
195  m_configParams.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorValueDefaultText" ),
196  &settings.m_ValueDefaultText, wxT( "" ) ) );
197 
198  m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorValueDefaultVisibility" ),
199  &settings.m_ValueDefaultVisibility, true ) );
200 
201  m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorValueDefaultLayer" ),
202  &settings.m_ValueDefaultlayer,
203  int( F_Fab ), int( F_SilkS ), int( F_Fab ) ) );
204 
205  return m_configParams;
206 }
#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:69
int m_ValueDefaultlayer
Default value text layer on fp creation.
Definition of class FOOTPRINT_EDIT_FRAME.
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
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:160
void OnSelectOptionToolbar(wxCommandEvent &event)
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:68
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:67
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
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
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
#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.