KiCad PCB EDA Suite
SETTINGS Class Reference

Class TOOL_SETTINGS. More...

#include <settings.h>

Inheritance diagram for SETTINGS:
COLORS_DESIGN_SETTINGS PCB_GENERAL_SETTINGS TOOL_SETTINGS

Public Member Functions

 SETTINGS ()
 
virtual ~SETTINGS ()
 
void SetConfigPrefix (const wxString &aPrefix)
 Set a prefix that will be prepent to the keywords when adding a setting in list. More...
 
const wxString & GetConfigPrefix ()
 
virtual void Load (wxConfigBase *aConfig)
 
virtual void Save (wxConfigBase *aConfig)
 
void Add (const wxString &name, int *aPtr, int aDefaultValue)
 
void Add (const wxString &name, bool *aPtr, bool aDefaultValue)
 
void Add (const wxString &name, KIGFX::COLOR4D *aPtr, KIGFX::COLOR4D aDefaultValue)
 
void Add (const wxString &name, KIGFX::COLOR4D *aPtr, EDA_COLOR_T aDefaultValue)
 

Protected Member Functions

virtual wxString getKeyName (const wxString &aEntryName) const
 

Protected Attributes

wxString m_prefix
 
PARAM_CFG_ARRAY m_params
 

Detailed Description

Class TOOL_SETTINGS.

Manages persistent settings for a tool (just a simple wrapper to wxConfigBase)

Definition at line 38 of file settings.h.

Constructor & Destructor Documentation

◆ SETTINGS()

SETTINGS::SETTINGS ( )
inline

Definition at line 41 of file settings.h.

42  {}

◆ ~SETTINGS()

virtual SETTINGS::~SETTINGS ( )
inlinevirtual

Definition at line 44 of file settings.h.

45  {}

Member Function Documentation

◆ Add() [1/4]

void SETTINGS::Add ( const wxString &  name,
int *  aPtr,
int  aDefaultValue 
)
inline

Definition at line 93 of file settings.h.

94  {
95  m_params.push_back( new PARAM_CFG_INT ( m_prefix+name, aPtr, aDefaultValue ) );
96  }
PARAM_CFG_ARRAY m_params
Definition: settings.h:122
wxString m_prefix
Definition: settings.h:121
Configuration parameter - Integer Class.
const char * name
Definition: DXF_plotter.cpp:61

References m_params, m_prefix, and name.

Referenced by PCB_GENERAL_SETTINGS::PCB_GENERAL_SETTINGS(), and COLORS_DESIGN_SETTINGS::setupConfigParams().

◆ Add() [2/4]

void SETTINGS::Add ( const wxString &  name,
bool *  aPtr,
bool  aDefaultValue 
)
inline

Definition at line 98 of file settings.h.

99  {
100  m_params.push_back( new PARAM_CFG_BOOL ( m_prefix+name, aPtr, aDefaultValue ) );
101  }
PARAM_CFG_ARRAY m_params
Definition: settings.h:122
wxString m_prefix
Definition: settings.h:121
Configuration parameter - Boolean Class.
const char * name
Definition: DXF_plotter.cpp:61

References m_params, m_prefix, and name.

◆ Add() [3/4]

void SETTINGS::Add ( const wxString &  name,
KIGFX::COLOR4D aPtr,
KIGFX::COLOR4D  aDefaultValue 
)
inline

Definition at line 103 of file settings.h.

104  {
105  m_params.push_back( new PARAM_CFG_SETCOLOR ( m_prefix+name, aPtr, aDefaultValue ) );
106  }
PARAM_CFG_ARRAY m_params
Definition: settings.h:122
Configuration parameter - SetColor Class.
wxString m_prefix
Definition: settings.h:121
const char * name
Definition: DXF_plotter.cpp:61

References m_params, m_prefix, and name.

◆ Add() [4/4]

void SETTINGS::Add ( const wxString &  name,
KIGFX::COLOR4D aPtr,
EDA_COLOR_T  aDefaultValue 
)
inline

Definition at line 108 of file settings.h.

109  {
110  m_params.push_back( new PARAM_CFG_SETCOLOR ( m_prefix+name, aPtr, aDefaultValue ) );
111  }
PARAM_CFG_ARRAY m_params
Definition: settings.h:122
Configuration parameter - SetColor Class.
wxString m_prefix
Definition: settings.h:121
const char * name
Definition: DXF_plotter.cpp:61

References m_params, m_prefix, and name.

◆ GetConfigPrefix()

const wxString& SETTINGS::GetConfigPrefix ( )
inline
Returns
the current prefix

Definition at line 57 of file settings.h.

58  {
59  return m_prefix;
60  }
wxString m_prefix
Definition: settings.h:121

References m_prefix.

Referenced by COLORS_DESIGN_SETTINGS::setupConfigParams().

◆ getKeyName()

virtual wxString SETTINGS::getKeyName ( const wxString &  aEntryName) const
inlineprotectedvirtual

Reimplemented in TOOL_SETTINGS.

Definition at line 116 of file settings.h.

117  {
118  return aEntryName;
119  }

◆ Load()

void SETTINGS::Load ( wxConfigBase *  aConfig)
virtual

Reimplemented in COLORS_DESIGN_SETTINGS, and PCB_GENERAL_SETTINGS.

Definition at line 26 of file settings.cpp.

27 {
28  for( const PARAM_CFG_BASE& param : m_params )
29  {
30  if( !!param.m_Group )
31  aConfig->SetPath( param.m_Group );
32  else
33  aConfig->SetPath( wxT("") );
34 
35  param.ReadParam( aConfig );
36  }
37 }
PARAM_CFG_ARRAY m_params
Definition: settings.h:122
Class PARAM_CFG_BASE is a base class which establishes the interface functions ReadParam and SavePara...
Definition: config_params.h:99

References m_params.

Referenced by PCB_GENERAL_SETTINGS::Load(), and COLORS_DESIGN_SETTINGS::Load().

◆ Save()

void SETTINGS::Save ( wxConfigBase *  aConfig)
virtual

Reimplemented in COLORS_DESIGN_SETTINGS, and PCB_GENERAL_SETTINGS.

Definition at line 39 of file settings.cpp.

40 {
41  for( PARAM_CFG_BASE& param : m_params )
42  {
43  if( !!param.m_Group )
44  aConfig->SetPath( param.m_Group );
45  else
46  aConfig->SetPath( wxT("") );
47 
48  param.SaveParam( aConfig );
49  }
50 }
PARAM_CFG_ARRAY m_params
Definition: settings.h:122
Class PARAM_CFG_BASE is a base class which establishes the interface functions ReadParam and SavePara...
Definition: config_params.h:99

References m_params.

Referenced by PCB_GENERAL_SETTINGS::Save(), and COLORS_DESIGN_SETTINGS::Save().

◆ SetConfigPrefix()

void SETTINGS::SetConfigPrefix ( const wxString &  aPrefix)
inline

Set a prefix that will be prepent to the keywords when adding a setting in list.

Parameters
aPrefixis the string to prepend to the keywords

Definition at line 50 of file settings.h.

51  {
52  m_prefix = aPrefix;
53  }
wxString m_prefix
Definition: settings.h:121

References m_prefix.

Referenced by COLORS_DESIGN_SETTINGS::setupConfigParams().

Member Data Documentation

◆ m_params

PARAM_CFG_ARRAY SETTINGS::m_params
protected

Definition at line 122 of file settings.h.

Referenced by Add(), Load(), PCB_GENERAL_SETTINGS::PCB_GENERAL_SETTINGS(), and Save().

◆ m_prefix

wxString SETTINGS::m_prefix
protected

Definition at line 121 of file settings.h.

Referenced by Add(), GetConfigPrefix(), and SetConfigPrefix().


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