KiCad PCB EDA Suite
ADVANCED_CFG Class Reference

Class containing "advanced" configuration options. More...

#include <advanced_config.h>

Static Public Member Functions

static const ADVANCED_CFGGetCfg ()
 Get the singleton instance's config, which is shared by all consumers of advanced config. More...
 

Public Attributes

bool m_EnableUsePinFunction
 Enable pad pin function handling in pcbnew. More...
 
bool m_EnableUsePadProperty
 Enable pad property handling in pcbnew. More...
 
bool m_realTimeConnectivity
 Do real-time connectivity. More...
 
int m_coroutineStackSize
 Set the stack size for coroutines. More...
 

Private Member Functions

 ADVANCED_CFG ()
 
void loadFromConfigFile ()
 Load the config from the normal config file. More...
 
void loadSettings (wxConfigBase &aCfg)
 

Detailed Description

Class containing "advanced" configuration options.

Options set here are for developer or advanced users only. If a general user needs to set one of these for normal KiCad use, either:

  • They are working around some bug that should be fixed, or
  • The parameter they are setting is of general interest and should be in the main application config, with UI provided.

Options in this class are, in general, preferable to #defines, as they allow more flexible configuration by developers, and don't hide code from the compiler on other configurations, which can result in broken builds.

Never use advanced configs in an untestable way. If a function depends on advanced config such that you cannot test it without changing the config, "lift" the config to a higher level and make pass it as parameter of the code under test. The tests can pass their own values as needed.

This also applies to code that does not depend on "common" - it cannot use this class, so you must pass configuration in as proper parameters.

Sometimes you can just use values directly, and sometimes helper functions might be provided to allow extra logic (for example when a advanced config applies only on certain platforms).

For more information on what config keys set these parameters in the config files, and why you might want to set them, see AC_KEYS

Definition at line 58 of file advanced_config.h.

Constructor & Destructor Documentation

◆ ADVANCED_CFG()

ADVANCED_CFG::ADVANCED_CFG ( )
private

Definition at line 161 of file advanced_config.cpp.

162 {
163  wxLogTrace( AdvancedConfigMask, "Init advanced config" );
164 
165  // Init defaults - this is done in case the config doesn't exist,
166  // then the values will remain as set here.
167  m_EnableUsePadProperty = false;
168  m_EnableUsePinFunction = false;
169  m_realTimeConnectivity = true;
171 
173 }
bool m_EnableUsePadProperty
Enable pad property handling in pcbnew.
void loadFromConfigFile()
Load the config from the normal config file.
bool m_EnableUsePinFunction
Enable pad pin function handling in pcbnew.
int m_coroutineStackSize
Set the stack size for coroutines.
bool m_realTimeConnectivity
Do real-time connectivity.
static constexpr int default_stack
static const wxChar AdvancedConfigMask[]

References AdvancedConfigMask, AC_STACK::default_stack, loadFromConfigFile(), m_coroutineStackSize, m_EnableUsePadProperty, m_EnableUsePinFunction, and m_realTimeConnectivity.

Member Function Documentation

◆ GetCfg()

const ADVANCED_CFG & ADVANCED_CFG::GetCfg ( )
static

Get the singleton instance's config, which is shared by all consumers of advanced config.

This configuration is read-only - to set options, users should add the parameters to their config files at ~/.config/kicad/advanced, or the platform equivalent.

Definition at line 176 of file advanced_config.cpp.

177 {
178  static ADVANCED_CFG instance;
179  return instance;
180 }
Class containing "advanced" configuration options.

Referenced by SCH_CONNECTION::AppendDebugInfoToMsgPanel(), SCH_CONNECTION::AppendInfoToMsgPanel(), COROUTINE< int, const TOOL_EVENT & >::COROUTINE(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), PCB_IO::format(), SCH_EDITOR_CONTROL::HighlightNetCursor(), SCH_EDIT_FRAME::OnModify(), CONNECTION_GRAPH::Recalculate(), and BUS_UNFOLD_MENU::update().

◆ loadFromConfigFile()

void ADVANCED_CFG::loadFromConfigFile ( )
private

Load the config from the normal config file.

Definition at line 183 of file advanced_config.cpp.

184 {
185  const auto k_advanced = getAdvancedCfgFilename();
186 
187  if( !k_advanced.FileExists() )
188  {
189  wxLogTrace( AdvancedConfigMask, "File does not exist %s", k_advanced.GetFullPath() );
190  return;
191  }
192 
193  wxLogTrace( AdvancedConfigMask, "Loading advanced config from: %s", k_advanced.GetFullPath() );
194 
195  wxFileConfig file_cfg( "", "", k_advanced.GetFullPath() );
196  loadSettings( file_cfg );
197 }
void loadSettings(wxConfigBase &aCfg)
static wxFileName getAdvancedCfgFilename()
Get the filename for the advanced config file.
static const wxChar AdvancedConfigMask[]

References AdvancedConfigMask, getAdvancedCfgFilename(), and loadSettings().

Referenced by ADVANCED_CFG().

◆ loadSettings()

void ADVANCED_CFG::loadSettings ( wxConfigBase &  aCfg)
private

Definition at line 200 of file advanced_config.cpp.

201 {
202  std::vector<PARAM_CFG*> configParams;
203 
204  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::UsePadProperty,
205  &m_EnableUsePadProperty, false ) );
206 
207  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::UsePinFunction,
208  &m_EnableUsePinFunction, false ) );
209 
210  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::RealtimeConnectivity,
211  &m_realTimeConnectivity, false ) );
212 
213  configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::CoroutineStackSize,
216 
217  wxConfigLoadSetups( &aCfg, configParams );
218 
219  for( auto param : configParams )
220  delete param;
221 
222  dumpCfg( configParams );
223 }
void wxConfigLoadSetups(wxConfigBase *aCfg, const std::vector< PARAM_CFG * > &aList)
Function wxConfigLoadSetups uses aList of PARAM_CFG to load configuration values from aCfg.
static const wxChar UsePadProperty[]
In Pcbnew, pads can have a fabrication property Because this feature adds a new keyword in *....
bool m_EnableUsePadProperty
Enable pad property handling in pcbnew.
static const wxChar RealtimeConnectivity[]
Testing mode for new connectivity algorithm.
static void dumpCfg(const std::vector< PARAM_CFG * > &aArray)
Dump the configs in the given array to trace.
Configuration parameter - Integer Class.
Configuration parameter - Boolean Class.
bool m_EnableUsePinFunction
Enable pad pin function handling in pcbnew.
int m_coroutineStackSize
Set the stack size for coroutines.
bool m_realTimeConnectivity
Do real-time connectivity.
static const wxChar CoroutineStackSize[]
Configure the coroutine stack size in bytes.
static constexpr int default_stack
static const wxChar UsePinFunction[]
In Pcbnew, pads can handle a pin function info (this is the schematic pin name) Because this feature ...
static constexpr int max_stack
static constexpr int min_stack

References AC_KEYS::CoroutineStackSize, AC_STACK::default_stack, dumpCfg(), m_coroutineStackSize, m_EnableUsePadProperty, m_EnableUsePinFunction, m_realTimeConnectivity, AC_STACK::max_stack, AC_STACK::min_stack, AC_KEYS::RealtimeConnectivity, AC_KEYS::UsePadProperty, AC_KEYS::UsePinFunction, and wxConfigLoadSetups().

Referenced by loadFromConfigFile().

Member Data Documentation

◆ m_coroutineStackSize

int ADVANCED_CFG::m_coroutineStackSize

Set the stack size for coroutines.

Definition at line 89 of file advanced_config.h.

Referenced by ADVANCED_CFG(), COROUTINE< int, const TOOL_EVENT & >::COROUTINE(), and loadSettings().

◆ m_EnableUsePadProperty

bool ADVANCED_CFG::m_EnableUsePadProperty

Enable pad property handling in pcbnew.

Definition at line 79 of file advanced_config.h.

Referenced by ADVANCED_CFG(), and loadSettings().

◆ m_EnableUsePinFunction

bool ADVANCED_CFG::m_EnableUsePinFunction

Enable pad pin function handling in pcbnew.

Definition at line 74 of file advanced_config.h.

Referenced by ADVANCED_CFG(), PCB_IO::format(), and loadSettings().

◆ m_realTimeConnectivity

bool ADVANCED_CFG::m_realTimeConnectivity

Do real-time connectivity.

Definition at line 84 of file advanced_config.h.

Referenced by ADVANCED_CFG(), loadSettings(), and CONNECTION_GRAPH::Recalculate().


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