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. More...
 

Public Attributes

double m_DrawArcAccuracy
 Distance from an arc end point and the estimated end point, when rotating from the start point to the end point. More...
 
double m_DrawArcCenterMaxAngle
 When drawing an arc, the angle ( center - start ) - ( start - end ) can be limited to avoid extremely high radii. More...
 
double m_ExtraClearance
 Extra fill clearance for zone fills. More...
 
double m_DRCEpsilon
 Epsilon for DRC tests. More...
 
double m_HoleWallThickness
 Hole wall plating thickness. More...
 
bool m_RealTimeConnectivity
 Do real-time connectivity. More...
 
int m_CoroutineStackSize
 Set the stack size for coroutines. More...
 
bool m_ShowRouterDebugGraphics
 Show PNS router debug graphics. More...
 
bool m_CompactSave
 Save files in compact display mode When is is not specified, points are written one per line. More...
 
bool m_DrawTriangulationOutlines
 When true, strokes the triangulations with visible color. More...
 
bool m_PluginAltiumSch
 When true, enable Altium Schematic import (*.SchDoc) the current implementation is highly incomplete. More...
 
double m_MinPlotPenWidth
 Sets an absolute minimum pen width for plotting. More...
 
bool m_DebugZoneFiller
 A mode that dumps the various stages of a F_Cu fill into In1_Cu through In9_Cu. More...
 
bool m_DebugPDFWriter
 A mode that writes PDFs without compression. More...
 
double m_SmallDrillMarkSize
 The diameter of the drill marks on print and plot outputs (in mm), when the "Drill marks" option is set to "Small mark". More...
 
bool m_HotkeysDumper
 Enable the hotkeys dumper feature, used for generating documentation. More...
 
bool m_DrawBoundingBoxes
 Draw GAL bounding boxes in painters. 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 226 of file advanced_config.cpp.

227 {
228  wxLogTrace( AdvancedConfigMask, "Init advanced config" );
229 
230  // Init defaults - this is done in case the config doesn't exist,
231  // then the values will remain as set here.
232  m_RealTimeConnectivity = true;
235  m_DrawArcAccuracy = 10.0;
238  m_PluginAltiumSch = false;
239 
240  m_ExtraClearance = 0.0001;
241  m_DRCEpsilon = 0.0001; // 0.1um is small enough not to materially violate
242  // any constraints.
243 
244  m_HoleWallThickness = 0.020; // IPC-6012 says 15-18um; Cadence says at least
245  // 0.020 for a Class 2 board and at least 0.025
246  // for Class 3.
247 
248  m_MinPlotPenWidth = 0.0212; // 1 pixel at 1200dpi.
249 
250  m_DebugZoneFiller = false;
251  m_DebugPDFWriter = false;
252  m_SmallDrillMarkSize = 0.35;
253  m_HotkeysDumper = false;
254  m_DrawBoundingBoxes = false;
255 
257 }
bool m_PluginAltiumSch
When true, enable Altium Schematic import (*.SchDoc) the current implementation is highly incomplete.
bool m_DrawTriangulationOutlines
When true, strokes the triangulations with visible color.
double m_DrawArcCenterMaxAngle
When drawing an arc, the angle ( center - start ) - ( start - end ) can be limited to avoid extremely...
double m_DrawArcAccuracy
Distance from an arc end point and the estimated end point, when rotating from the start point to the...
bool m_ShowRouterDebugGraphics
Show PNS router debug graphics.
double m_SmallDrillMarkSize
The diameter of the drill marks on print and plot outputs (in mm), when the "Drill marks" option is s...
void loadFromConfigFile()
Load the config from the normal config file.
double m_ExtraClearance
Extra fill clearance for zone fills.
double m_DRCEpsilon
Epsilon for DRC tests.
bool m_HotkeysDumper
Enable the hotkeys dumper feature, used for generating documentation.
double m_MinPlotPenWidth
Sets an absolute minimum pen width for plotting.
bool m_DrawBoundingBoxes
Draw GAL bounding boxes in painters.
int m_CoroutineStackSize
Set the stack size for coroutines.
bool m_DebugPDFWriter
A mode that writes PDFs without compression.
static constexpr int default_stack
bool m_RealTimeConnectivity
Do real-time connectivity.
bool m_DebugZoneFiller
A mode that dumps the various stages of a F_Cu fill into In1_Cu through In9_Cu.
static const wxChar AdvancedConfigMask[]
double m_HoleWallThickness
Hole wall plating thickness.

References AdvancedConfigMask, AC_STACK::default_stack, loadFromConfigFile(), m_CoroutineStackSize, m_DebugPDFWriter, m_DebugZoneFiller, m_DrawArcAccuracy, m_DrawArcCenterMaxAngle, m_DrawBoundingBoxes, m_DrawTriangulationOutlines, m_DRCEpsilon, m_ExtraClearance, m_HoleWallThickness, m_HotkeysDumper, m_MinPlotPenWidth, m_PluginAltiumSch, m_RealTimeConnectivity, m_ShowRouterDebugGraphics, and m_SmallDrillMarkSize.

Member Function Documentation

◆ GetCfg()

const ADVANCED_CFG & ADVANCED_CFG::GetCfg ( )
static

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

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

261 {
262  static ADVANCED_CFG instance;
263  return instance;
264 }
Class containing "advanced" configuration options.

Referenced by SCH_CONNECTION::AppendInfoToMsgPanel(), SCH_EDITOR_CONTROL::AssignNetclass(), ZONE_FILLER::buildCopperItemClearances(), PDF_PLOTTER::closePdfStream(), COROUTINE< int, const TOOL_EVENT & >::COROUTINE(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS(), KIGFX::SCH_PAINTER::Draw(), KIGFX::OPENGL_GAL::drawTriangulatedPolyset(), PCB_POINT_EDITOR::editArcEndpointKeepTangent(), PCB_IO::format(), BOARD_DESIGN_SETTINGS::GetDRCEpsilon(), ZONE::GetFilledPolysUseThickness(), BOARD_DESIGN_SETTINGS::GetHolePlatingThickness(), ROUTER_TOOL::handleCommonEvents(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PANEL_HOTKEYS_EDITOR::installButtons(), SCH_EDIT_FRAME::KiwayMailIn(), SCH_EDIT_FRAME::OnImportProject(), SCH_EDIT_FRAME::OnModify(), BRDITEMS_PLOTTER::PlotDrillMarks(), PlotLayerOutlines(), CONNECTION_GRAPH::Recalculate(), SCH_SEXPR_PLUGIN_CACHE::savePolyLine(), KIGFX::SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS(), PCBNEW_PRINTOUT::setupPainter(), PNS_KICAD_IFACE::SetView(), PDF_PLOTTER::startPdfStream(), BUS_UNFOLD_MENU::update(), and ZONE_FILLER::ZONE_FILLER().

◆ loadFromConfigFile()

void ADVANCED_CFG::loadFromConfigFile ( )
private

Load the config from the normal config file.

Definition at line 267 of file advanced_config.cpp.

268 {
269  const wxFileName k_advanced = getAdvancedCfgFilename();
270 
271  if( !k_advanced.FileExists() )
272  {
273  wxLogTrace( AdvancedConfigMask, "File does not exist %s", k_advanced.GetFullPath() );
274 
275  // load the defaults
276  wxConfig emptyConfig;
277  loadSettings( emptyConfig );
278 
279  return;
280  }
281 
282  wxLogTrace( AdvancedConfigMask, "Loading advanced config from: %s", k_advanced.GetFullPath() );
283 
284  wxFileConfig file_cfg( "", "", k_advanced.GetFullPath() );
285  loadSettings( file_cfg );
286 }
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 289 of file advanced_config.cpp.

290 {
291  std::vector<PARAM_CFG*> configParams;
292 
293  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::RealtimeConnectivity,
294  &m_RealTimeConnectivity, true ) );
295 
296  configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::ExtraFillMargin,
297  &m_ExtraClearance, 0.0005, 0.0, 1.0 ) );
298 
299  configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DRCEpsilon,
300  &m_DRCEpsilon, 0.0005, 0.0, 1.0 ) );
301 
302  configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::HoleWallThickness,
303  &m_HoleWallThickness, 0.020, 0.0, 1.0 ) );
304 
305  configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::CoroutineStackSize,
308 
309  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ShowRouterDebugGraphics,
310  &m_ShowRouterDebugGraphics, false ) );
311 
312  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::CompactFileSave,
313  &m_CompactSave, false ) );
314 
315  configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DrawArcAccuracy,
316  &m_DrawArcAccuracy, 10.0, 0.0, 100000.0 ) );
317 
318  configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DrawArcCenterStartEndMaxAngle,
319  &m_DrawArcCenterMaxAngle, 50.0, 0.0, 100000.0 ) );
320 
321  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::StrokeTriangulation,
322  &m_DrawTriangulationOutlines, false ) );
323 
324  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::PluginAltiumSch,
325  &m_PluginAltiumSch, false ) );
326 
327  configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::MinPlotPenWidth,
328  &m_MinPlotPenWidth, 0.0212, 0.0, 1.0 ) );
329 
330  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::DebugZoneFiller,
331  &m_DebugZoneFiller, false ) );
332 
333  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::DebugPDFWriter,
334  &m_DebugPDFWriter, false ) );
335 
336  configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::SmallDrillMarkSize,
337  &m_SmallDrillMarkSize, 0.35, 0.0, 3.0 ) );
338 
339  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::HotkeysDumper,
340  &m_HotkeysDumper, false ) );
341 
342  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::DrawBoundingBoxes,
343  &m_DrawBoundingBoxes, false ) );
344 
345  wxConfigLoadSetups( &aCfg, configParams );
346 
347  for( PARAM_CFG* param : configParams )
348  delete param;
349 
350  dumpCfg( configParams );
351 }
bool m_CompactSave
Save files in compact display mode When is is not specified, points are written one per line.
bool m_PluginAltiumSch
When true, enable Altium Schematic import (*.SchDoc) the current implementation is highly incomplete.
void wxConfigLoadSetups(wxConfigBase *aCfg, const std::vector< PARAM_CFG * > &aList)
Use aList of PARAM_CFG object to load configuration values from aCfg.
static const wxChar DrawArcAccuracy[]
For drawsegments - arcs.
static const wxChar HoleWallThickness[]
Used to calculate the actual hole size from the finish hole size.
Configuration object for double precision floating point numbers.
bool m_DrawTriangulationOutlines
When true, strokes the triangulations with visible color.
double m_DrawArcCenterMaxAngle
When drawing an arc, the angle ( center - start ) - ( start - end ) can be limited to avoid extremely...
static const wxChar DrawArcCenterStartEndMaxAngle[]
For drawsegments - arcs.
double m_DrawArcAccuracy
Distance from an arc end point and the estimated end point, when rotating from the start point to the...
bool m_ShowRouterDebugGraphics
Show PNS router debug graphics.
double m_SmallDrillMarkSize
The diameter of the drill marks on print and plot outputs (in mm), when the "Drill marks" option is s...
static const wxChar RealtimeConnectivity[]
Testing mode for new connectivity algorithm.
static const wxChar DRCEpsilon[]
A fudge factor for DRC.
static const wxChar DebugPDFWriter[]
static void dumpCfg(const std::vector< PARAM_CFG * > &aArray)
Dump the configs in the given array to trace.
Configuration object for integers.
Configuration object for booleans.
static const wxChar SmallDrillMarkSize[]
The diameter of the drill marks on print and plot outputs (in mm), when the "Drill marks" option is s...
static const wxChar DrawBoundingBoxes[]
double m_ExtraClearance
Extra fill clearance for zone fills.
double m_DRCEpsilon
Epsilon for DRC tests.
bool m_HotkeysDumper
Enable the hotkeys dumper feature, used for generating documentation.
double m_MinPlotPenWidth
Sets an absolute minimum pen width for plotting.
static const wxChar MinPlotPenWidth[]
Absolute minimum pen width to send to the plotter.
bool m_DrawBoundingBoxes
Draw GAL bounding boxes in painters.
int m_CoroutineStackSize
Set the stack size for coroutines.
bool m_DebugPDFWriter
A mode that writes PDFs without compression.
A base class which establishes the interface functions ReadParam and SaveParam, which are implemented...
Definition: config_params.h:81
static const wxChar CoroutineStackSize[]
Configure the coroutine stack size in bytes.
static const wxChar HotkeysDumper[]
static constexpr int default_stack
static const wxChar StrokeTriangulation[]
When true, GAL will stroke the triangulations (only used in OpenGL) with a visible color.
static const wxChar DebugZoneFiller[]
static const wxChar PluginAltiumSch[]
When true, enable Altium Schematic import (*.SchDoc)
static constexpr int max_stack
static const wxChar ShowRouterDebugGraphics[]
Show PNS router debug graphics while routing.
bool m_RealTimeConnectivity
Do real-time connectivity.
bool m_DebugZoneFiller
A mode that dumps the various stages of a F_Cu fill into In1_Cu through In9_Cu.
static const wxChar CompactFileSave[]
When set to true, this will wrap polygon point sets at 4 points per line rather than a single point p...
static constexpr int min_stack
static const wxChar ExtraFillMargin[]
When filling zones, we add an extra amount of clearance to each zone to ensure that rounding errors d...
double m_HoleWallThickness
Hole wall plating thickness.

References AC_KEYS::CompactFileSave, AC_KEYS::CoroutineStackSize, AC_KEYS::DebugPDFWriter, AC_KEYS::DebugZoneFiller, AC_STACK::default_stack, AC_KEYS::DrawArcAccuracy, AC_KEYS::DrawArcCenterStartEndMaxAngle, AC_KEYS::DrawBoundingBoxes, AC_KEYS::DRCEpsilon, dumpCfg(), AC_KEYS::ExtraFillMargin, AC_KEYS::HoleWallThickness, AC_KEYS::HotkeysDumper, m_CompactSave, m_CoroutineStackSize, m_DebugPDFWriter, m_DebugZoneFiller, m_DrawArcAccuracy, m_DrawArcCenterMaxAngle, m_DrawBoundingBoxes, m_DrawTriangulationOutlines, m_DRCEpsilon, m_ExtraClearance, m_HoleWallThickness, m_HotkeysDumper, m_MinPlotPenWidth, m_PluginAltiumSch, m_RealTimeConnectivity, m_ShowRouterDebugGraphics, m_SmallDrillMarkSize, AC_STACK::max_stack, AC_STACK::min_stack, AC_KEYS::MinPlotPenWidth, AC_KEYS::PluginAltiumSch, AC_KEYS::RealtimeConnectivity, AC_KEYS::ShowRouterDebugGraphics, AC_KEYS::SmallDrillMarkSize, AC_KEYS::StrokeTriangulation, and wxConfigLoadSetups().

Referenced by loadFromConfigFile().

Member Data Documentation

◆ m_CompactSave

bool ADVANCED_CFG::m_CompactSave

Save files in compact display mode When is is not specified, points are written one per line.

Definition at line 118 of file advanced_config.h.

Referenced by PCB_IO::format(), loadSettings(), and SCH_SEXPR_PLUGIN_CACHE::savePolyLine().

◆ m_CoroutineStackSize

int ADVANCED_CFG::m_CoroutineStackSize

Set the stack size for coroutines.

Definition at line 107 of file advanced_config.h.

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

◆ m_DebugPDFWriter

bool ADVANCED_CFG::m_DebugPDFWriter

A mode that writes PDFs without compression.

Definition at line 145 of file advanced_config.h.

Referenced by ADVANCED_CFG(), and loadSettings().

◆ m_DebugZoneFiller

bool ADVANCED_CFG::m_DebugZoneFiller

A mode that dumps the various stages of a F_Cu fill into In1_Cu through In9_Cu.

Definition at line 140 of file advanced_config.h.

Referenced by ADVANCED_CFG(), loadSettings(), and ZONE_FILLER::ZONE_FILLER().

◆ m_DrawArcAccuracy

double ADVANCED_CFG::m_DrawArcAccuracy

Distance from an arc end point and the estimated end point, when rotating from the start point to the end point.

Definition at line 73 of file advanced_config.h.

Referenced by ADVANCED_CFG(), and loadSettings().

◆ m_DrawArcCenterMaxAngle

double ADVANCED_CFG::m_DrawArcCenterMaxAngle

When drawing an arc, the angle ( center - start ) - ( start - end ) can be limited to avoid extremely high radii.

Definition at line 79 of file advanced_config.h.

Referenced by ADVANCED_CFG(), PCB_POINT_EDITOR::editArcEndpointKeepTangent(), and loadSettings().

◆ m_DrawBoundingBoxes

bool ADVANCED_CFG::m_DrawBoundingBoxes

Draw GAL bounding boxes in painters.

Definition at line 161 of file advanced_config.h.

Referenced by ADVANCED_CFG(), KIGFX::SCH_PAINTER::Draw(), and loadSettings().

◆ m_DrawTriangulationOutlines

bool ADVANCED_CFG::m_DrawTriangulationOutlines

When true, strokes the triangulations with visible color.

Definition at line 123 of file advanced_config.h.

Referenced by ADVANCED_CFG(), and loadSettings().

◆ m_DRCEpsilon

double ADVANCED_CFG::m_DRCEpsilon

Epsilon for DRC tests.

Note that for zone tests this is essentially additive with m_extraClearance. Units are mm.

Definition at line 91 of file advanced_config.h.

Referenced by ADVANCED_CFG(), and loadSettings().

◆ m_ExtraClearance

double ADVANCED_CFG::m_ExtraClearance

Extra fill clearance for zone fills.

Note that for zone tests this is essentially additive with m_DRCEpsilon. Units are mm.

Definition at line 85 of file advanced_config.h.

Referenced by ADVANCED_CFG(), and loadSettings().

◆ m_HoleWallThickness

double ADVANCED_CFG::m_HoleWallThickness

Hole wall plating thickness.

Used to determine actual hole size from finish hole size. Units are mm.

Definition at line 97 of file advanced_config.h.

Referenced by ADVANCED_CFG(), and loadSettings().

◆ m_HotkeysDumper

bool ADVANCED_CFG::m_HotkeysDumper

Enable the hotkeys dumper feature, used for generating documentation.

Definition at line 156 of file advanced_config.h.

Referenced by ADVANCED_CFG(), and loadSettings().

◆ m_MinPlotPenWidth

double ADVANCED_CFG::m_MinPlotPenWidth

Sets an absolute minimum pen width for plotting.

Some formats (PDF, for example) don't like ultra-thin lines. Units are mm.

Definition at line 135 of file advanced_config.h.

Referenced by ADVANCED_CFG(), loadSettings(), and KIGFX::SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS().

◆ m_PluginAltiumSch

bool ADVANCED_CFG::m_PluginAltiumSch

When true, enable Altium Schematic import (*.SchDoc) the current implementation is highly incomplete.

Definition at line 129 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 102 of file advanced_config.h.

Referenced by ADVANCED_CFG(), SCH_EDITOR_CONTROL::AssignNetclass(), and loadSettings().

◆ m_ShowRouterDebugGraphics

bool ADVANCED_CFG::m_ShowRouterDebugGraphics

Show PNS router debug graphics.

Definition at line 112 of file advanced_config.h.

Referenced by ADVANCED_CFG(), ROUTER_TOOL::handleCommonEvents(), and loadSettings().

◆ m_SmallDrillMarkSize

double ADVANCED_CFG::m_SmallDrillMarkSize

The diameter of the drill marks on print and plot outputs (in mm), when the "Drill marks" option is set to "Small mark".

Definition at line 151 of file advanced_config.h.

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


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