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

249  :
250  PARAM_CFG( ident, PARAM_SETCOLOR, group )
251 {
252  m_Pt_param = ptparam;
253  m_Default = default_val;
254 }
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 257 of file config_params.cpp.

261  :
262  PARAM_CFG( ident, PARAM_SETCOLOR, group )
263 {
264  m_Pt_param = ptparam;
265  m_Default = default_val;
266  m_Setup = Insetup;
267 }
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 270 of file config_params.cpp.

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

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

306 {
307  if( !m_Pt_param || !aConfig )
308  return;
309 
310  aConfig->Write( m_Ident, m_Pt_param->ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
311 }
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

bool PARAM_CFG::m_Setup
inherited

◆ 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: