KiCad PCB EDA Suite
ADVANCED_CFG Class Reference

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

#include <advanced_config.h>

Public Member Functions

bool AllowLegacyCanvas () const
 Helper to determine if legacy canvas is allowed (according to platform and config) More...

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_enableSvgImport
 Enable SVG import. More...
bool m_realTimeConnectivity
 Do real-time connectivity. More...

Private Member Functions

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

Private Attributes

bool m_allowLegacyCanvasInGtk3

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



Definition at line 146 of file advanced_config.cpp.

147 {
148  wxLogTrace( AdvancedConfigMask, "Init advanced config" );
150  // Init defaults - this is done in case the config doesn't exist,
151  // then the values will remain as set here.
152  m_enableSvgImport = false;
154  m_realTimeConnectivity = true;
157 }
bool m_allowLegacyCanvasInGtk3
void loadFromConfigFile()
Load the config from the normal config file.
bool m_realTimeConnectivity
Do real-time connectivity.
bool m_enableSvgImport
Enable SVG import.
static const wxChar AdvancedConfigMask[]

References AdvancedConfigMask, loadFromConfigFile(), m_allowLegacyCanvasInGtk3, m_enableSvgImport, and m_realTimeConnectivity.

Member Function Documentation

◆ AllowLegacyCanvas()

bool ADVANCED_CFG::AllowLegacyCanvas ( ) const

Helper to determine if legacy canvas is allowed (according to platform and config)

true if legacy canvas should be shown

Definition at line 203 of file advanced_config.cpp.

204 {
205  // default is to allow
206  bool allow = true;
208  // on GTK3, check the config
209 #ifdef __WXGTK3__
211 #endif
213  return allow;
214 }
bool m_allowLegacyCanvasInGtk3

References m_allowLegacyCanvasInGtk3.

◆ GetCfg()


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 160 of file advanced_config.cpp.

161 {
162  static ADVANCED_CFG instance;
163  return instance;
164 }
Class containing "advanced" configuration options.

Referenced by SCH_CONNECTION::AppendDebugInfoToMsgPanel(), SCH_CONNECTION::AppendInfoToMsgPanel(), SCH_EDITOR_CONTROL::HighlightNetCursor(), EDA_DRAW_FRAME::LoadCanvasTypeSetting(), SCH_EDIT_FRAME::OnModify(), preparePreferencesMenu(), CONNECTION_GRAPH::Recalculate(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateMenuBar(), and BUS_UNFOLD_MENU::update().

◆ loadFromConfigFile()

void ADVANCED_CFG::loadFromConfigFile ( )

Load the config from the normal config file.

Definition at line 167 of file advanced_config.cpp.

168 {
169  const auto k_advanced = getAdvancedCfgFilename();
171  if( !k_advanced.FileExists() )
172  {
173  wxLogTrace( AdvancedConfigMask, "File does not exist %s", k_advanced.GetFullPath() );
174  return;
175  }
177  wxLogTrace( AdvancedConfigMask, "Loading advanced config from: %s", k_advanced.GetFullPath() );
179  wxFileConfig file_cfg( "", "", k_advanced.GetFullPath() );
180  loadSettings( file_cfg );
181 }
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)

Definition at line 184 of file advanced_config.cpp.

185 {
186  PARAM_CFG_ARRAY configParams;
188  configParams.push_back(
191  configParams.push_back( new PARAM_CFG_BOOL(
194  configParams.push_back(
197  wxConfigLoadSetups( &aCfg, configParams );
199  dumpCfg( configParams );
200 }
A list of parameters type.
bool m_allowLegacyCanvasInGtk3
static const wxChar AllowLegacyCanvasInGtk3[]
Allow legacy canvas to be shown in GTK3.
static const wxChar RealtimeConnectivity[]
Testing mode for new connectivity algorithm.
static const wxChar EnableSvgImport[]
SVG needs some enhancements.
Configuration parameter - Boolean Class.
bool m_realTimeConnectivity
Do real-time connectivity.
static void dumpCfg(const PARAM_CFG_ARRAY &aArray)
Dump the configs in the given array to trace.
void wxConfigLoadSetups(wxConfigBase *aCfg, const PARAM_CFG_ARRAY &aList)
Function wxConfigLoadSetups uses aList of PARAM_CFG_ARRAY elements to load configuration values from ...
bool m_enableSvgImport
Enable SVG import.

References AC_KEYS::AllowLegacyCanvasInGtk3, dumpCfg(), AC_KEYS::EnableSvgImport, m_allowLegacyCanvasInGtk3, m_enableSvgImport, m_realTimeConnectivity, AC_KEYS::RealtimeConnectivity, and wxConfigLoadSetups().

Referenced by loadFromConfigFile().

Member Data Documentation

◆ m_allowLegacyCanvasInGtk3

bool ADVANCED_CFG::m_allowLegacyCanvasInGtk3

Definition at line 94 of file advanced_config.h.

Referenced by ADVANCED_CFG(), AllowLegacyCanvas(), and loadSettings().

◆ m_enableSvgImport

bool ADVANCED_CFG::m_enableSvgImport

Enable SVG import.

Definition at line 74 of file advanced_config.h.

Referenced by ADVANCED_CFG(), and loadSettings().

◆ m_realTimeConnectivity

bool ADVANCED_CFG::m_realTimeConnectivity

Do real-time connectivity.

Definition at line 79 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: