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

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...
 
wxString m_Ident_legacy
 

Detailed Description

Configuration parameter - SetColor Class.

Definition at line 193 of file config_params.h.

Constructor & Destructor Documentation

◆ PARAM_CFG_SETCOLOR() [1/2]

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.

248  :
249  PARAM_CFG( 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.
PARAM_CFG(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL, const wxString &legacy_ident=wxEmptyString)
COLOR4D m_Default
The default value of the parameter.

References m_Default, and m_Pt_param.

◆ PARAM_CFG_SETCOLOR() [2/2]

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.

260  :
261  PARAM_CFG( ident, PARAM_SETCOLOR, group )
262 {
263  m_Pt_param = ptparam;
264  m_Default = default_val;
265  m_Setup = Insetup;
266 }
bool m_Setup
Install or Project based parameter, true == install.
COLOR4D * 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)
COLOR4D m_Default
The default value of the parameter.

References m_Default, m_Pt_param, and PARAM_CFG::m_Setup.

Member Function Documentation

◆ ReadParam()

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.

Definition at line 269 of file config_params.cpp.

270 {
271  if( !m_Pt_param || !aConfig )
272  return;
273 
274  COLOR4D temp;
275 
276  if( aConfig->HasEntry( m_Ident ) )
277  {
278  if( temp.SetFromWxString( aConfig->Read( m_Ident, wxT( "NONE" ) ) ) )
279  {
280  *m_Pt_param = temp;
281  return;
282  }
283  }
284 
285  // If no luck, try reading legacy format
286  wxString legacy_Ident = m_Ident;
287  legacy_Ident.Replace( wxT( "4D" ), wxEmptyString );
288 
289  EDA_COLOR_T old = ColorByName( aConfig->Read( legacy_Ident, wxT( "NONE" ) ) );
290 
291  if( old != UNSPECIFIED_COLOR )
292  {
293  if( m_Ident == wxT( "Color4DErcWEx" ) || m_Ident == wxT( "Color4DErcEEx" ) )
294  *m_Pt_param = COLOR4D( old ).WithAlpha( 0.8 );
295  else
296  *m_Pt_param = COLOR4D( old );
297  return;
298  }
299 
301 }
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.
wxString m_Ident
Keyword in config data.
COLOR4D WithAlpha(double aAlpha) const
Function WithAlpha Returns a colour with the same colour, but the given alpha.
Definition: color4d.h:248
COLOR4D m_Default
The default value of the parameter.
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:40

References ColorByName(), m_Default, PARAM_CFG::m_Ident, m_Pt_param, UNSPECIFIED_COLOR, and KIGFX::COLOR4D::WithAlpha().

◆ SaveParam()

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.

Definition at line 304 of file config_params.cpp.

305 {
306  if( !m_Pt_param || !aConfig )
307  return;
308 
309  aConfig->Write( m_Ident, m_Pt_param->ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
310 }
COLOR4D * m_Pt_param
Pointer to the parameter value.
wxString m_Ident
Keyword in config data.

References PARAM_CFG::m_Ident, and m_Pt_param.

Member Data Documentation

◆ m_Default

COLOR4D PARAM_CFG_SETCOLOR::m_Default

The default value of the parameter.

Definition at line 197 of file config_params.h.

Referenced by PARAM_CFG_SETCOLOR(), and ReadParam().

◆ 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

COLOR4D* PARAM_CFG_SETCOLOR::m_Pt_param

Pointer to the parameter value.

Definition at line 196 of file config_params.h.

Referenced by PARAM_CFG_SETCOLOR(), 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 files: