KiCad PCB EDA Suite
PARAM_CFG_LAYERS Class Reference
Inheritance diagram for PARAM_CFG_LAYERS:
PARAM_CFG

Public Member Functions

 PARAM_CFG_LAYERS (BOARD *ptparam, const wxChar *group=nullptr)
 
void ReadParam (wxConfigBase *aConfig) const override
 Function ReadParam reads the value of the parameter stored in aConfig. More...
 
void SaveParam (wxConfigBase *aConfig) const override
 Function SaveParam saves the value of the parameter stored in aConfig. More...
 

Public Attributes

wxString m_Ident
 Keyword in config data. More...
 
paramcfg_id m_Type
 Type of parameter. More...
 
wxString m_Group
 Group name (this is like a path in the config data) More...
 
bool m_Setup
 Install or Project based parameter, true == install. More...
 
wxString m_Ident_legacy
 

Protected Attributes

BOARDm_Pt_param
 Pointer to the parameter value. More...
 

Detailed Description

Definition at line 167 of file board_design_settings.cpp.

Constructor & Destructor Documentation

◆ PARAM_CFG_LAYERS()

PARAM_CFG_LAYERS::PARAM_CFG_LAYERS ( BOARD ptparam,
const wxChar *  group = nullptr 
)
inline

Definition at line 173 of file board_design_settings.cpp.

173  :
174  PARAM_CFG( wxEmptyString, PARAM_LAYERS, group )
175  {
176  m_Pt_param = ptparam;
177  }
BOARD * m_Pt_param
Pointer to the parameter value.
PARAM_CFG(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL, const wxString &legacy_ident=wxEmptyString)

References m_Pt_param.

Member Function Documentation

◆ ReadParam()

void PARAM_CFG_LAYERS::ReadParam ( wxConfigBase *  aConfig) const
inlineoverridevirtual

Function ReadParam reads the value of the parameter stored in aConfig.

Parameters
aConfig= the wxConfigBase that holds the parameter

Reimplemented from PARAM_CFG.

Definition at line 179 of file board_design_settings.cpp.

180  {
181  if( !m_Pt_param || !aConfig )
182  return;
183 
184  BOARD* board = m_Pt_param;
186  LSET enabledLayers = bds.GetEnabledLayers();
187  wxString oldPath = aConfig->GetPath();
188  wxString layerKeyPrefix = LayerKeyPrefix;
189 
190  bds.SetCopperLayerCount( aConfig->Read( CopperLayerCountKey, 2 ) );
191 
192  double thickness = aConfig->ReadDouble( BoardThicknessKey, DEFAULT_BOARD_THICKNESS_MM );
193  bds.SetBoardThickness( Millimeter2iu( thickness ) );
194 
195  for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
196  {
197  PCB_LAYER_ID layer = *seq;
198  wxString path = layerKeyPrefix + wxT( "." ) + board->GetStandardLayerName( layer );
199  wxString layerName;
200  int layerType;
201  bool layerEnabled;
202 
203  aConfig->SetPath( oldPath );
204  aConfig->SetPath( path );
205 
206  if( aConfig->Read( LayerNameKey, &layerName ) )
207  board->SetLayerName( layer, layerName );
208 
209  if( aConfig->Read( LayerTypeKey, &layerType ) )
210  board->SetLayerType( layer, (LAYER_T) layerType );
211 
212  if( aConfig->Read( LayerEnabledKey, &layerEnabled ) )
213  enabledLayers.set( layer, layerEnabled );
214  }
215 
216  board->SetEnabledLayers( enabledLayers );
217 
218  aConfig->SetPath( oldPath );
219  }
void SetCopperLayerCount(int aNewLayerCount)
Function SetCopperLayerCount do what its name says...
#define LayerTypeKey
#define DEFAULT_BOARD_THICKNESS_MM
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:542
#define CopperLayerCountKey
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Function SetLayerType changes the type of the layer given by aLayer.
void SetBoardThickness(int aThickness)
PCB_LAYER_ID
A quick note on layer IDs:
BOARD * m_Pt_param
Pointer to the parameter value.
LSET is a set of PCB_LAYER_IDs.
LAYER_T
Enum LAYER_T gives the allowed types of layers, same as Specctra DSN spec.
Definition: class_board.h:67
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Function SetLayerName changes the name of the layer given by aLayer.
#define LayerKeyPrefix
static LSET AllLayersMask()
Definition: lset.cpp:749
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
#define LayerNameKey
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:181
LSET GetEnabledLayers() const
Function GetEnabledLayers returns a bit-mask of all the layers that are enabled.
void SetEnabledLayers(LSET aLayerMask)
Function SetEnabledLayers is a proxy function that calls the correspondent function in m_BoardSetting...
#define LayerEnabledKey
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Function GetStandardLayerName returns an "English Standard" name of a PCB layer when given aLayerNumb...
Definition: class_board.h:640
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
#define BoardThicknessKey

References LSET::AllLayersMask(), BoardThicknessKey, CopperLayerCountKey, DEFAULT_BOARD_THICKNESS_MM, BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetEnabledLayers(), BOARD::GetStandardLayerName(), LayerEnabledKey, LayerKeyPrefix, LayerNameKey, LayerTypeKey, m_Pt_param, BOARD_DESIGN_SETTINGS::SetBoardThickness(), BOARD_DESIGN_SETTINGS::SetCopperLayerCount(), BOARD::SetEnabledLayers(), BOARD::SetLayerName(), and BOARD::SetLayerType().

◆ SaveParam()

void PARAM_CFG_LAYERS::SaveParam ( wxConfigBase *  aConfig) const
inlineoverridevirtual

Function SaveParam saves the value of the parameter stored in aConfig.

Parameters
aConfig= the wxConfigBase that can store the parameter

Reimplemented from PARAM_CFG.

Definition at line 221 of file board_design_settings.cpp.

222  {
223  if( !m_Pt_param || !aConfig )
224  return;
225 
226  BOARD* board = m_Pt_param;
228  wxString oldPath = aConfig->GetPath();
229  wxString layerKeyPrefix = LayerKeyPrefix;
230 
231  aConfig->Write( CopperLayerCountKey, board->GetCopperLayerCount() );
232  aConfig->Write( BoardThicknessKey, Iu2Millimeter( bds.GetBoardThickness() ) );
233 
234  for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
235  {
236  PCB_LAYER_ID layer = *seq;
237  wxString path = layerKeyPrefix + wxT( "." ) + board->GetStandardLayerName( layer );
238  wxString layerName = board->GetLayerName( layer );
239  LAYER_T layerType = board->GetLayerType( layer );
240 
241  aConfig->SetPath( oldPath );
242  aConfig->SetPath( path );
243 
244  if( IsCopperLayer( layer ) )
245  {
246  aConfig->Write( LayerNameKey, layerName );
247  aConfig->Write( LayerTypeKey, (int) layerType );
248  }
249 
250  aConfig->Write( LayerEnabledKey, board->IsLayerEnabled( layer ) );
251  }
252 
253  aConfig->SetPath( oldPath );
254  }
#define LayerTypeKey
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:542
#define CopperLayerCountKey
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
Function IsLayerEnabled is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:449
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Function Seq returns an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:377
PCB_LAYER_ID
A quick note on layer IDs:
BOARD * m_Pt_param
Pointer to the parameter value.
LAYER_T
Enum LAYER_T gives the allowed types of layers, same as Specctra DSN spec.
Definition: class_board.h:67
#define LayerKeyPrefix
static LSET AllLayersMask()
Definition: lset.cpp:749
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
#define LayerNameKey
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Function GetLayerType returns the type of the copper layer given by aLayer.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:181
int GetCopperLayerCount() const
Function GetCopperLayerCount.
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
#define LayerEnabledKey
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Function GetStandardLayerName returns an "English Standard" name of a PCB layer when given aLayerNumb...
Definition: class_board.h:640
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
#define BoardThicknessKey

References LSET::AllLayersMask(), BoardThicknessKey, CopperLayerCountKey, BOARD_DESIGN_SETTINGS::GetBoardThickness(), BOARD::GetCopperLayerCount(), BOARD::GetDesignSettings(), BOARD::GetLayerName(), BOARD::GetLayerType(), BOARD::GetStandardLayerName(), IsCopperLayer(), BOARD::IsLayerEnabled(), LayerEnabledKey, LayerKeyPrefix, LayerNameKey, LayerTypeKey, m_Pt_param, and LSET::Seq().

Member Data Documentation

◆ m_Group

wxString PARAM_CFG::m_Group
inherited

Group name (this is like a path in the config data)

Definition at line 104 of file config_params.h.

Referenced by PARAM_CFG::PARAM_CFG().

◆ m_Ident

◆ m_Ident_legacy

wxString PARAM_CFG::m_Ident_legacy
inherited

◆ m_Pt_param

BOARD* PARAM_CFG_LAYERS::m_Pt_param
protected

Pointer to the parameter value.

Definition at line 170 of file board_design_settings.cpp.

Referenced by PARAM_CFG_LAYERS(), ReadParam(), and SaveParam().

◆ m_Setup

◆ m_Type

paramcfg_id PARAM_CFG::m_Type
inherited

Type of parameter.

Definition at line 103 of file config_params.h.

Referenced by dumpParamCfg(), PARAM_CFG::PARAM_CFG(), and PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE().


The documentation for this class was generated from the following file: