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

Go to the source code of this file.

Namespaces

 AC_KEYS
 List of known keys for advanced configuration options.
 

Functions

wxString dumpParamCfg (const PARAM_CFG_BASE &aParam)
 
static void dumpCfg (const PARAM_CFG_ARRAY &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 const wxChar AC_KEYS::EnableSvgImport [] = wxT( "EnableSvgImport" )
 SVG needs some enhancements. More...
 
static const wxChar AC_KEYS::RealtimeConnectivity [] = wxT( "RealtimeConnectivity" )
 Testing mode for new connectivity algorithm. More...
 
static const wxChar AC_KEYS::AllowLegacyCanvasInGtk3 [] = wxT( "AllowLegacyCanvasInGtk3" )
 Allow legacy canvas to be shown in GTK3. More...
 

Function Documentation

◆ dumpCfg()

static void dumpCfg ( const PARAM_CFG_ARRAY aArray)
static

Dump the configs in the given array to trace.

Definition at line 121 of file advanced_config.cpp.

122 {
123  // only dump if we need to
124  if( !wxLog::IsAllowedTraceMask( AdvancedConfigMask ) )
125  return;
126 
127  for( const auto& param : aArray )
128  {
129  wxLogTrace( AdvancedConfigMask, dumpParamCfg( param ) );
130  }
131 }
wxString dumpParamCfg(const PARAM_CFG_BASE &aParam)
static const wxChar AdvancedConfigMask[]

References AdvancedConfigMask, and dumpParamCfg().

Referenced by ADVANCED_CFG::loadSettings().

◆ dumpParamCfg()

wxString dumpParamCfg ( const PARAM_CFG_BASE aParam)

Definition at line 84 of file advanced_config.cpp.

85 {
86  wxString s = aParam.m_Ident + ": ";
87 
88  /*
89  * This implementation is rather simplistic, but it is
90  * effective enough for simple uses. A better implementation would be
91  * some kind of visitor, but that's somewhat more work.
92  */
93  switch( aParam.m_Type )
94  {
97  s << *static_cast<const PARAM_CFG_INT&>( aParam ).m_Pt_param;
98  break;
100  s << *static_cast<const PARAM_CFG_DOUBLE&>( aParam ).m_Pt_param;
101  break;
103  s << *static_cast<const PARAM_CFG_WXSTRING&>( aParam ).m_Pt_param;
104  break;
106  s << *static_cast<const PARAM_CFG_FILENAME&>( aParam ).m_Pt_param;
107  break;
109  s << ( *static_cast<const PARAM_CFG_BOOL&>( aParam ).m_Pt_param ? "true" : "false" );
110  break;
111  default: s << "Unsupported PARAM_CFG variant: " << aParam.m_Type;
112  }
113 
114  return s;
115 }
paramcfg_id m_Type
Type of parameter.
wxString m_Ident
Keyword in config data.

References PARAM_CFG_BASE::m_Ident, PARAM_CFG_BASE::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 139 of file advanced_config.cpp.

140 {
141  const static wxString cfg_filename{ "kicad_advanced" };
142  return wxFileName( GetKicadConfigPath(), cfg_filename );
143 }
wxString GetKicadConfigPath()
Return the user configuration path used to store KiCad's configuration files.
Definition: common.cpp:267

References GetKicadConfigPath().

Referenced by ADVANCED_CFG::loadFromConfigFile().

Variable Documentation

◆ AdvancedConfigMask

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