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

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 61 of file board_design_settings.cpp.

Constructor & Destructor Documentation

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

Definition at line 67 of file board_design_settings.cpp.

67  :
68  PARAM_CFG_BASE( wxEmptyString, PARAM_LAYERS, group )
69  {
70  m_Pt_param = ptparam;
71  }
PARAM_CFG_BASE(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL, const wxString &legacy_ident=wxEmptyString)
BOARD * m_Pt_param
Pointer to the parameter value.

Member Function Documentation

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_BASE.

Definition at line 73 of file board_design_settings.cpp.

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

74  {
75  if( !m_Pt_param || !aConfig )
76  return;
77 
78  BOARD* board = m_Pt_param;
80  wxString oldPath = aConfig->GetPath();
81 
82  bds.SetCopperLayerCount( aConfig->Read( CopperLayerCountKey, 2 ) );
83 
84  double thickness = aConfig->ReadDouble( BoardThicknessKey, DEFAULT_BOARD_THICKNESS_MM );
85  bds.SetBoardThickness( Millimeter2iu( thickness ) );
86 
87  for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
88  {
89  PCB_LAYER_ID layer = *seq;
90  wxString layerName;
91  int layerType;
92 
93  aConfig->SetPath( oldPath );
94  aConfig->SetPath( LayerKeyPrefix + board->GetStandardLayerName( layer ) );
95 
96  if( aConfig->Read( LayerNameKey, &layerName ) )
97  board->SetLayerName( layer, layerName );
98 
99  if( aConfig->Read( LayerTypeKey, &layerType ) )
100  board->SetLayerType( layer, (LAYER_T) layerType );
101  }
102 
103  aConfig->SetPath( oldPath );
104  }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:673
void SetCopperLayerCount(int aNewLayerCount)
Function SetCopperLayerCount do what its name says...
#define LayerTypeKey
#define DEFAULT_BOARD_THICKNESS_MM
#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.
LAYER_T
Enum LAYER_T gives the allowed types of layers, same as Specctra DSN spec.
Definition: class_board.h:72
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Function SetLayerName changes the name of the layer given by aLayer.
#define LayerKeyPrefix
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:538
Class LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
#define LayerNameKey
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
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:653
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
#define BoardThicknessKey
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_BASE.

Definition at line 106 of file board_design_settings.cpp.

References LSET::AllCuMask(), BoardThicknessKey, CopperLayerCountKey, BOARD_DESIGN_SETTINGS::GetBoardThickness(), BOARD::GetCopperLayerCount(), BOARD::GetDesignSettings(), BOARD::GetLayerName(), BOARD::GetLayerType(), BOARD::GetStandardLayerName(), LayerKeyPrefix, LayerNameKey, LayerTypeKey, LT_SIGNAL, m_Pt_param, and LSET::Seq().

107  {
108  if( !m_Pt_param || !aConfig )
109  return;
110 
111  BOARD* board = m_Pt_param;
113  wxString oldPath = aConfig->GetPath();
114  wxString layerKeyPrefix = LayerKeyPrefix;
115 
116  aConfig->Write( CopperLayerCountKey, board->GetCopperLayerCount() );
117  aConfig->Write( BoardThicknessKey, Iu2Millimeter( bds.GetBoardThickness() ) );
118 
119  for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
120  {
121  PCB_LAYER_ID layer = *seq;
122  wxString stdName = board->GetStandardLayerName( layer );
123  wxString layerName = board->GetLayerName( layer );
124  LAYER_T layerType = board->GetLayerType( layer );
125 
126  aConfig->SetPath( oldPath );
127  aConfig->SetPath( layerKeyPrefix + wxT( "." ) + stdName );
128 
129  if( layerName == stdName && layerType == LT_SIGNAL )
130  {
131  aConfig->DeleteGroup( aConfig->GetPath() );
132  }
133  else
134  {
135  aConfig->Write( LayerNameKey, layerName );
136  aConfig->Write( LayerTypeKey, (int) layerType );
137  }
138  }
139 
140  aConfig->SetPath( oldPath );
141  }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:673
#define LayerTypeKey
int GetCopperLayerCount() const
Function GetCopperLayerCount.
#define CopperLayerCountKey
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:364
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:72
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
#define LayerKeyPrefix
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:538
Class LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
#define LayerNameKey
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Function GetLayerType returns the type of the copper layer given by aLayer.
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:653
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
#define BoardThicknessKey

Member Data Documentation

wxString PARAM_CFG_BASE::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_BASE::PARAM_CFG_BASE().

wxString PARAM_CFG_BASE::m_Ident_legacy
inherited
BOARD* PARAM_CFG_LAYERS::m_Pt_param
protected

Pointer to the parameter value.

Definition at line 64 of file board_design_settings.cpp.

Referenced by ReadParam(), and SaveParam().

bool PARAM_CFG_BASE::m_Setup
inherited
paramcfg_id PARAM_CFG_BASE::m_Type
inherited

Type of parameter.

Definition at line 103 of file config_params.h.

Referenced by PARAM_CFG_BASE::PARAM_CFG_BASE(), and PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE().


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