KiCad PCB EDA Suite
advanced_config.cpp File Reference
#include <advanced_config.h>
#include <common.h>
#include <config_params.h>
#include <settings/settings_manager.h>
#include <wx/config.h>
#include <wx/filename.h>
#include <wx/log.h>

Go to the source code of this file.

Namespaces

 AC_STACK
 Limits and default settings for the coroutine stack size allowed.
 
 AC_KEYS
 List of known keys for advanced configuration options.
 

Functions

wxString dumpParamCfg (const PARAM_CFG &aParam)
 
static void dumpCfg (const std::vector< PARAM_CFG * > &aArray)
 Dump the configs in the given array to trace. More...
 
static wxFileName getAdvancedCfgFilename ()
 Get the filename for the advanced config file. More...
 

Variables

static const wxChar AdvancedConfigMask [] = wxT( "KICAD_ADVANCED_CONFIG" )
 
static constexpr int AC_STACK::min_stack = 32 * 4096
 
static constexpr int AC_STACK::default_stack = 256 * 4096
 
static constexpr int AC_STACK::max_stack = 4096 * 4096
 
static const wxChar AC_KEYS::UsePadProperty [] = wxT( "UsePadProperty" )
 In Pcbnew, pads can have a fabrication property Because this feature adds a new keyword in *.kicad_pcb and *.kicad_modfiles, this is an advanced feature until it is fully finalized. More...
 
static const wxChar AC_KEYS::RealtimeConnectivity [] = wxT( "RealtimeConnectivity" )
 Testing mode for new connectivity algorithm. More...
 
static const wxChar AC_KEYS::CoroutineStackSize [] = wxT( "CoroutineStackSize" )
 Configure the coroutine stack size in bytes. More...
 

Function Documentation

◆ dumpCfg()

static void dumpCfg ( const std::vector< PARAM_CFG * > &  aArray)
static

Dump the configs in the given array to trace.

Definition at line 129 of file advanced_config.cpp.

130 {
131  // only dump if we need to
132  if( !wxLog::IsAllowedTraceMask( AdvancedConfigMask ) )
133  return;
134 
135  for( const PARAM_CFG* param : aArray )
136  {
137  wxLogTrace( AdvancedConfigMask, dumpParamCfg( *param ) );
138  }
139 }
wxString dumpParamCfg(const PARAM_CFG &aParam)
PARAM_CFG is a base class which establishes the interface functions ReadParam and SaveParam,...
Definition: config_params.h:99
static const wxChar AdvancedConfigMask[]

References AdvancedConfigMask, and dumpParamCfg().

Referenced by ADVANCED_CFG::loadSettings().

◆ dumpParamCfg()

wxString dumpParamCfg ( const PARAM_CFG aParam)

Definition at line 92 of file advanced_config.cpp.

93 {
94  wxString s = aParam.m_Ident + ": ";
95 
96  /*
97  * This implementation is rather simplistic, but it is
98  * effective enough for simple uses. A better implementation would be
99  * some kind of visitor, but that's somewhat more work.
100  */
101  switch( aParam.m_Type )
102  {
105  s << *static_cast<const PARAM_CFG_INT&>( aParam ).m_Pt_param;
106  break;
108  s << *static_cast<const PARAM_CFG_DOUBLE&>( aParam ).m_Pt_param;
109  break;
111  s << *static_cast<const PARAM_CFG_WXSTRING&>( aParam ).m_Pt_param;
112  break;
114  s << *static_cast<const PARAM_CFG_FILENAME&>( aParam ).m_Pt_param;
115  break;
117  s << ( *static_cast<const PARAM_CFG_BOOL&>( aParam ).m_Pt_param ? "true" : "false" );
118  break;
119  default: s << "Unsupported PARAM_CFG variant: " << aParam.m_Type;
120  }
121 
122  return s;
123 }
wxString m_Ident
Keyword in config data.
paramcfg_id m_Type
Type of parameter.

References PARAM_CFG::m_Ident, PARAM_CFG::m_Type, PARAM_BOOL, PARAM_DOUBLE, PARAM_FILENAME, PARAM_INT, PARAM_INT_WITH_SCALE, and PARAM_WXSTRING.

Referenced by dumpCfg().

◆ getAdvancedCfgFilename()

static wxFileName getAdvancedCfgFilename ( )
static

Get the filename for the advanced config file.

The user must check the file exists if they care.

Definition at line 147 of file advanced_config.cpp.

148 {
149  const static wxString cfg_filename{ "kicad_advanced" };
150  return wxFileName( SETTINGS_MANAGER::GetUserSettingsPath(), cfg_filename );
151 }
static std::string GetUserSettingsPath()
Return the user configuration path used to store KiCad's configuration files.

References SETTINGS_MANAGER::GetUserSettingsPath().

Referenced by ADVANCED_CFG::loadFromConfigFile().

Variable Documentation

◆ AdvancedConfigMask

const wxChar AdvancedConfigMask[] = wxT( "KICAD_ADVANCED_CONFIG" )
static