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" )
 Currently (Version 5.1) SVG import is disabled by default, to avoid issues SVG needs some enhancements. More...
 
static const wxChar AC_KEYS::AllowLegacyCanvasInGtk3 [] = wxT( "AllowLegacyCanvasInGtk3" )
 Allow legacy canvas to be shown in GTK3. More...
 

Function Documentation

static void dumpCfg ( const PARAM_CFG_ARRAY aArray)
static

Dump the configs in the given array to trace.

Definition at line 117 of file advanced_config.cpp.

References AdvancedConfigMask, and dumpParamCfg().

Referenced by ADVANCED_CFG::loadSettings().

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

Definition at line 80 of file advanced_config.cpp.

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().

81 {
82  wxString s = aParam.m_Ident + ": ";
83 
84  /*
85  * This implementation is rather simplistic, but it is
86  * effective enough for simple uses. A better implementation would be
87  * some kind of visitor, but that's somewhat more work.
88  */
89  switch( aParam.m_Type )
90  {
93  s << *static_cast<const PARAM_CFG_INT&>( aParam ).m_Pt_param;
94  break;
96  s << *static_cast<const PARAM_CFG_DOUBLE&>( aParam ).m_Pt_param;
97  break;
99  s << *static_cast<const PARAM_CFG_WXSTRING&>( aParam ).m_Pt_param;
100  break;
102  s << *static_cast<const PARAM_CFG_FILENAME&>( aParam ).m_Pt_param;
103  break;
105  s << ( *static_cast<const PARAM_CFG_BOOL&>( aParam ).m_Pt_param ? "true" : "false" );
106  break;
107  default: s << "Unsupported PARAM_CFG variant: " << aParam.m_Type;
108  }
109 
110  return s;
111 }
paramcfg_id m_Type
Type of parameter.
wxString m_Ident
Keyword in config data.
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 135 of file advanced_config.cpp.

References GetKicadConfigPath().

Referenced by ADVANCED_CFG::loadFromConfigFile().

136 {
137  const static wxString cfg_filename{ "kicad_advanced" };
138  return wxFileName( GetKicadConfigPath(), cfg_filename );
139 }
wxString GetKicadConfigPath()
Return the user configuration path used to store KiCad&#39;s configuration files.
Definition: common.cpp:262

Variable Documentation

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