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...
 
bool m_forceThickOutlinesInZones
 Force filled polygons with outlines in zone – To be removed after testing default = true (legacy mode) 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)
 

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

◆ ADVANCED_CFG()

ADVANCED_CFG::ADVANCED_CFG ( )
private

Definition at line 169 of file advanced_config.cpp.

170 {
171  wxLogTrace( AdvancedConfigMask, "Init advanced config" );
172 
173  // Init defaults - this is done in case the config doesn't exist,
174  // then the values will remain as set here.
175  m_enableSvgImport = false;
177  m_realTimeConnectivity = true;
180 
182 }
bool m_allowLegacyCanvasInGtk3
bool m_forceThickOutlinesInZones
Force filled polygons with outlines in zone – To be removed after testing default = true (legacy mode...
void loadFromConfigFile()
Load the config from the normal config file.
int m_coroutineStackSize
Set the stack size for coroutines.
bool m_realTimeConnectivity
Do real-time connectivity.
static constexpr int default_stack
bool m_enableSvgImport
Enable SVG import.
static const wxChar AdvancedConfigMask[]

References AdvancedConfigMask, AC_STACK::default_stack, loadFromConfigFile(), m_allowLegacyCanvasInGtk3, m_coroutineStackSize, m_enableSvgImport, m_forceThickOutlinesInZones, 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)

Returns
true if legacy canvas should be shown

Definition at line 235 of file advanced_config.cpp.

236 {
237  // default is to allow
238  bool allow = true;
239 
240  // on GTK3, check the config
241 #ifdef __WXGTK3__
243 #endif
244 
245  return allow;
246 }
bool m_allowLegacyCanvasInGtk3

References m_allowLegacyCanvasInGtk3.

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

186 {
187  static ADVANCED_CFG instance;
188  return instance;
189 }
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(), ZONE_FILLER::Fill(), SCH_EDITOR_CONTROL::HighlightNetCursor(), SCH_EDIT_FRAME::OnModify(), PANEL_SETUP_FEATURE_CONSTRAINTS::PANEL_SETUP_FEATURE_CONSTRAINTS(), 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 192 of file advanced_config.cpp.

193 {
194  const auto k_advanced = getAdvancedCfgFilename();
195 
196  if( !k_advanced.FileExists() )
197  {
198  wxLogTrace( AdvancedConfigMask, "File does not exist %s", k_advanced.GetFullPath() );
199  return;
200  }
201 
202  wxLogTrace( AdvancedConfigMask, "Loading advanced config from: %s", k_advanced.GetFullPath() );
203 
204  wxFileConfig file_cfg( "", "", k_advanced.GetFullPath() );
205  loadSettings( file_cfg );
206 }
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 209 of file advanced_config.cpp.

210 {
211  PARAM_CFG_ARRAY configParams;
212 
213  configParams.push_back(
215 
216  configParams.push_back( new PARAM_CFG_BOOL(
218 
219  configParams.push_back(
221 
222  configParams.push_back(
225 
226  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ForceThickZones,
227  &m_forceThickOutlinesInZones, true ) );
228 
229  wxConfigLoadSetups( &aCfg, configParams );
230 
231  dumpCfg( configParams );
232 }
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.
bool m_forceThickOutlinesInZones
Force filled polygons with outlines in zone – To be removed after testing default = true (legacy mode...
static const wxChar EnableSvgImport[]
SVG needs some enhancements.
static const wxChar ForceThickZones[]
Draw zones in pcbnew with the stroked outline.
Configuration parameter - Integer Class.
Configuration parameter - Boolean Class.
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 void dumpCfg(const PARAM_CFG_ARRAY &aArray)
Dump the configs in the given array to trace.
static constexpr int max_stack
void wxConfigLoadSetups(wxConfigBase *aCfg, const PARAM_CFG_ARRAY &aList)
Function wxConfigLoadSetups uses aList of PARAM_CFG_ARRAY elements to load configuration values from ...
static constexpr int min_stack
bool m_enableSvgImport
Enable SVG import.

References AC_KEYS::AllowLegacyCanvasInGtk3, AC_KEYS::CoroutineStackSize, AC_STACK::default_stack, dumpCfg(), AC_KEYS::EnableSvgImport, AC_KEYS::ForceThickZones, m_allowLegacyCanvasInGtk3, m_coroutineStackSize, m_enableSvgImport, m_forceThickOutlinesInZones, m_realTimeConnectivity, AC_STACK::max_stack, AC_STACK::min_stack, AC_KEYS::RealtimeConnectivity, and wxConfigLoadSetups().

Referenced by loadFromConfigFile().

Member Data Documentation

◆ m_allowLegacyCanvasInGtk3

bool ADVANCED_CFG::m_allowLegacyCanvasInGtk3
private

Definition at line 105 of file advanced_config.h.

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

◆ m_coroutineStackSize

int ADVANCED_CFG::m_coroutineStackSize

Set the stack size for coroutines.

Definition at line 90 of file advanced_config.h.

Referenced by ADVANCED_CFG(), COROUTINE< int, const TOOL_EVENT & >::COROUTINE(), 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_forceThickOutlinesInZones

bool ADVANCED_CFG::m_forceThickOutlinesInZones

Force filled polygons with outlines in zone – To be removed after testing default = true (legacy mode)

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