KiCad PCB EDA Suite
PARAM_CFG_SETCOLOR Class Reference

Configuration parameter - SetColor Class. More...

#include <config_params.h>

Inheritance diagram for PARAM_CFG_SETCOLOR:
PARAM_CFG_BASE

Public Member Functions

 PARAM_CFG_SETCOLOR (const wxString &ident, COLOR4D *ptparam, COLOR4D default_val, const wxChar *group=NULL)
 
 PARAM_CFG_SETCOLOR (bool Insetup, const wxString &ident, COLOR4D *ptparam, COLOR4D default_val, const wxChar *group=NULL)
 
virtual void ReadParam (wxConfigBase *aConfig) const override
 Function ReadParam reads the value of the parameter stored in aConfig. More...
 
virtual void SaveParam (wxConfigBase *aConfig) const override
 Function SaveParam saves the value of the parameter stored in aConfig. More...
 

Public Attributes

COLOR4Dm_Pt_param
 Pointer to the parameter value. More...
 
COLOR4D m_Default
 The default value of the parameter. More...
 
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...
 

Detailed Description

Configuration parameter - SetColor Class.

Definition at line 185 of file config_params.h.

Constructor & Destructor Documentation

PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR ( const wxString &  ident,
COLOR4D ptparam,
COLOR4D  default_val,
const wxChar *  group = NULL 
)

Definition at line 246 of file config_params.cpp.

References m_Default, and m_Pt_param.

248  :
249  PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group )
250 {
251  m_Pt_param = ptparam;
252  m_Default = default_val;
253 }
COLOR4D * m_Pt_param
Pointer to the parameter value.
COLOR4D m_Default
The default value of the parameter.
PARAM_CFG_BASE(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL)
PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR ( bool  Insetup,
const wxString &  ident,
COLOR4D ptparam,
COLOR4D  default_val,
const wxChar *  group = NULL 
)

Definition at line 256 of file config_params.cpp.

References m_Default, m_Pt_param, and PARAM_CFG_BASE::m_Setup.

260  :
261  PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group )
262 {
263  m_Pt_param = ptparam;
264  m_Default = default_val;
265  m_Setup = Insetup;
266 }
COLOR4D * m_Pt_param
Pointer to the parameter value.
bool m_Setup
Install or Project based parameter, true == install.
COLOR4D m_Default
The default value of the parameter.
PARAM_CFG_BASE(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL)

Member Function Documentation

void PARAM_CFG_SETCOLOR::ReadParam ( wxConfigBase *  aConfig) const
overridevirtual

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 269 of file config_params.cpp.

References ColorByName(), m_Default, PARAM_CFG_BASE::m_Ident, m_Pt_param, and UNSPECIFIED_COLOR.

270 {
271  if( !m_Pt_param || !aConfig )
272  return;
273 
274  // First try reading old format
275  EDA_COLOR_T itmp = ColorByName( aConfig->Read( m_Ident, wxT( "NONE" ) ) );
276  COLOR4D wtmp = COLOR4D::UNSPECIFIED;
277 
278  if( itmp == UNSPECIFIED_COLOR )
279  {
280  // Next try reading new format
281  if( !wtmp.SetFromWxString( aConfig->Read( m_Ident, wxT( "NONE" ) ) ) )
282  wtmp = m_Default;
283  }
284  else
285  {
286  wtmp = COLOR4D( itmp );
287  }
288 
289  *m_Pt_param = wtmp;
290 }
EDA_COLOR_T
NOTE: EDA_COLOR_T is deprecated and is kept around for compatibility with legacy canvas.
Definition: colors.h:42
EDA_COLOR_T ColorByName(const wxString &aName)
Find a color by name.
Definition: colors.cpp:72
COLOR4D * m_Pt_param
Pointer to the parameter value.
COLOR4D m_Default
The default value of the parameter.
wxString m_Ident
Keyword in config data.
Definition: config_params.h:97
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void PARAM_CFG_SETCOLOR::SaveParam ( wxConfigBase *  aConfig) const
overridevirtual

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 293 of file config_params.cpp.

References PARAM_CFG_BASE::m_Ident, and m_Pt_param.

294 {
295  if( !m_Pt_param || !aConfig )
296  return;
297 
298  aConfig->Write( m_Ident, m_Pt_param->ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
299 }
COLOR4D * m_Pt_param
Pointer to the parameter value.
wxString m_Ident
Keyword in config data.
Definition: config_params.h:97

Member Data Documentation

COLOR4D PARAM_CFG_SETCOLOR::m_Default

The default value of the parameter.

Definition at line 189 of file config_params.h.

Referenced by PARAM_CFG_SETCOLOR(), and ReadParam().

wxString PARAM_CFG_BASE::m_Group
inherited

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

Definition at line 99 of file config_params.h.

Referenced by PARAM_CFG_BASE::PARAM_CFG_BASE().

COLOR4D* PARAM_CFG_SETCOLOR::m_Pt_param

Pointer to the parameter value.

Definition at line 188 of file config_params.h.

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

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

Type of parameter.

Definition at line 98 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 files: