38#include <wx/tokenzr.h>
64#if defined( __WXGTK__ ) || defined( __WXMSW__ )
126 [&]() -> nlohmann::json
128 nlohmann::json ret = {};
130 for(
const std::pair<wxString, ENV_VAR_ITEM> entry :
m_Env.
vars )
132 const ENV_VAR_ITEM& var = entry.second;
134 wxASSERT( entry.first == var.GetKey() );
137 if( var.IsDefault() )
139 wxLogTrace( traceEnvVars,
140 wxS(
"COMMON_SETTINGS: Env var %s skipping save (default)" ),
145 wxString value = var.GetValue();
147 value.Trim(
true ).Trim(
false );
151 if( var.GetDefinedExternally() )
153 if( var.GetDefinedInSettings() )
155 wxLogTrace( traceEnvVars,
156 wxS(
"COMMON_SETTINGS: Env var %s was overridden "
157 "externally, saving previously-loaded value %s" ),
158 var.GetKey(), var.GetSettingsValue() );
159 value = var.GetSettingsValue();
163 wxLogTrace( traceEnvVars,
164 wxS(
"COMMON_SETTINGS: Env var %s skipping save "
172 wxS(
"COMMON_SETTINGS: Saving env var %s = %s" ),
173 var.GetKey(), value);
175 std::string key( var.GetKey().Trim(
true ).Trim(
false ).ToUTF8() );
176 ret[ std::move( key ) ] = value;
181 [&](
const nlohmann::json& aJson )
183 if( !aJson.is_object() )
186 for(
const auto& entry : aJson.items() )
188 wxString key = wxString( entry.key().c_str(), wxConvUTF8 ).Trim(
true ).Trim(
false );
189 wxString val = entry.value().get<wxString>().Trim(
true ).Trim(
false );
191 if( m_Env.vars.count( key ) )
193 if( m_Env.vars[key].GetDefinedExternally() )
196 wxS(
"COMMON_SETTINGS: %s is defined externally" ),
198 m_Env.vars[key].SetDefinedInSettings();
199 m_Env.vars[key].SetSettingsValue( val );
205 wxS(
"COMMON_SETTINGS: Updating %s: %s -> %s"),
206 key, m_Env.vars[key].GetValue(), val );
207 m_Env.vars[key].SetValue( val );
213 wxS(
"COMMON_SETTINGS: Loaded new var: %s = %s" ),
218 m_Env.vars[key].SetDefinedInSettings();
219 m_Env.vars[key].SetSettingsValue( val );
223 envVarsParam->SetClearUnknownKeys();
225 m_params.emplace_back(
new PARAM<bool>(
"input.focus_follow_sch_pcb",
226 &m_Input.focus_follow_sch_pcb,
false ) );
228 m_params.emplace_back(
new PARAM<bool>(
"input.auto_pan", &m_Input.auto_pan,
false ) );
230 m_params.emplace_back(
new PARAM<int>(
"input.auto_pan_acceleration",
231 &m_Input.auto_pan_acceleration, 5 ) );
233 m_params.emplace_back(
new PARAM<bool>(
"input.center_on_zoom",
234 &m_Input.center_on_zoom,
true ) );
236 m_params.emplace_back(
new PARAM<bool>(
"input.immediate_actions",
237 &m_Input.immediate_actions,
true ) );
239 m_params.emplace_back(
new PARAM<bool>(
"input.warp_mouse_on_move",
240 &m_Input.warp_mouse_on_move,
true ) );
242 m_params.emplace_back(
new PARAM<bool>(
"input.horizontal_pan",
243 &m_Input.horizontal_pan,
false ) );
245 m_params.emplace_back(
new PARAM<bool>(
"input.hotkey_feedback",
246 &m_Input.hotkey_feedback,
true ) );
248 m_params.emplace_back(
new PARAM<bool>(
"input.zoom_acceleration",
249 &m_Input.zoom_acceleration,
false ) );
252 int default_zoom_speed = 5;
254 int default_zoom_speed = 1;
257 m_params.emplace_back(
new PARAM<int>(
"input.zoom_speed",
258 &m_Input.zoom_speed, default_zoom_speed ) );
260 m_params.emplace_back(
new PARAM<bool>(
"input.zoom_speed_auto",
261 &m_Input.zoom_speed_auto,
true ) );
263 m_params.emplace_back(
new PARAM<int>(
"input.scroll_modifier_zoom",
264 &m_Input.scroll_modifier_zoom, 0 ) );
266 m_params.emplace_back(
new PARAM<int>(
"input.scroll_modifier_pan_h",
267 &m_Input.scroll_modifier_pan_h, WXK_CONTROL ) );
269 m_params.emplace_back(
new PARAM<int>(
"input.scroll_modifier_pan_v",
270 &m_Input.scroll_modifier_pan_v, WXK_SHIFT ) );
272 m_params.emplace_back(
new PARAM<int>(
"input.motion_pan_modifier",
273 &m_Input.motion_pan_modifier, 0 ) );
275 m_params.emplace_back(
new PARAM<bool>(
"input.reverse_scroll_zoom",
276 &m_Input.reverse_scroll_zoom,
false ) );
278 m_params.emplace_back(
new PARAM<bool>(
"input.reverse_scroll_pan_h",
279 &m_Input.reverse_scroll_pan_h,
false ) );
293 m_params.emplace_back(
new PARAM<int>(
"graphics.canvas_type",
296 m_params.emplace_back(
new PARAM<int>(
"graphics.antialiasing_mode",
297 &m_Graphics.aa_mode, 2, 0, 2 ) );
299 m_params.emplace_back(
new PARAM<int>(
"system.autosave_interval",
300 &m_System.autosave_interval, 600 ) );
304 &m_System.text_editor, wxS(
"/usr/bin/open -e" ) ) );
307 &m_System.text_editor, wxS(
"" ) ) );
310#if defined( __WINDOWS__ )
312 &m_System.file_explorer, wxS(
"explorer.exe /n,/select,%F" ) ) );
315 &m_System.file_explorer, wxS(
"" ) ) );
318 m_params.emplace_back(
new PARAM<int>(
"system.file_history_size",
319 &m_System.file_history_size, 9 ) );
322 &m_System.language, wxS(
"Default" ) ) );
325 &m_System.pdf_viewer_name, wxS(
"" ) ) );
327 m_params.emplace_back(
new PARAM<bool>(
"system.use_system_pdf_viewer",
328 &m_System.use_system_pdf_viewer,
true ) );
331 &m_System.working_dir, wxS(
"" ) ) );
333 m_params.emplace_back(
new PARAM<int>(
"system.clear_3d_cache_interval",
334 &m_System.clear_3d_cache_interval, 30 ) );
336 m_params.emplace_back(
new PARAM<bool>(
"do_not_show_again.zone_fill_warning",
337 &m_DoNotShowAgain.zone_fill_warning,
false ) );
339 m_params.emplace_back(
new PARAM<bool>(
"do_not_show_again.env_var_overwrite_warning",
340 &m_DoNotShowAgain.env_var_overwrite_warning,
false ) );
342 m_params.emplace_back(
new PARAM<bool>(
"do_not_show_again.scaled_3d_models_warning",
343 &m_DoNotShowAgain.scaled_3d_models_warning,
false ) );
345 m_params.emplace_back(
new PARAM<bool>(
"do_not_show_again.data_collection_prompt",
346 &m_DoNotShowAgain.data_collection_prompt,
false ) );
348 m_params.emplace_back(
new PARAM<bool>(
"do_not_show_again.update_check_prompt",
349 &m_DoNotShowAgain.update_check_prompt,
false ) );
351 m_params.emplace_back(
new PARAM<bool>(
"session.remember_open_files",
352 &m_Session.remember_open_files,
false ) );
355 &m_Session.pinned_symbol_libs, {} ) );
358 &m_Session.pinned_fp_libs, {} ) );
361 &m_Session.pinned_design_block_libs, {} ) );
363 m_params.emplace_back(
new PARAM<int>(
"netclass_panel.sash_pos",
364 &m_NetclassPanel.sash_pos, 160 ) );
366 m_params.emplace_back(
new PARAM<wxString>(
"netclass_panel.eeschema_shown_columns",
367 &m_NetclassPanel.eeschema_visible_columns,
"0 11 12 13 14" ) );
369 m_params.emplace_back(
new PARAM<wxString>(
"netclass_panel.pcbnew_shown_columns",
370 &m_NetclassPanel.pcbnew_visible_columns,
"0 1 2 3 4 5 6 7 8 9 10" ) );
372 m_params.emplace_back(
new PARAM<int>(
"package_manager.sash_pos",
373 &m_PackageManager.sash_pos, 380 ) );
376 [&]() -> nlohmann::json
378 nlohmann::json ret = {};
380 for(
const GIT_REPOSITORY& repo : m_Git.repositories )
382 nlohmann::json repoJson = {};
384 repoJson[
"name"] = repo.name;
385 repoJson[
"path"] = repo.path;
386 repoJson[
"authType"] = repo.authType;
387 repoJson[
"username"] = repo.username;
388 repoJson[
"ssh_path"] = repo.ssh_path;
389 repoJson[
"active"] = repo.active;
391 ret.push_back( repoJson );
396 [&](
const nlohmann::json& aJson )
398 if( !aJson.is_array() )
401 m_Git.repositories.clear();
403 for(
const auto& repoJson : aJson )
407 repo.name = repoJson[
"name"].get<wxString>();
408 repo.path = repoJson[
"path"].get<wxString>();
409 repo.authType = repoJson[
"authType"].get<wxString>();
410 repo.username = repoJson[
"username"].get<wxString>();
411 repo.ssh_path = repoJson[
"ssh_path"].get<wxString>();
412 repo.active = repoJson[
"active"].get<
bool>();
413 repo.checkValid =
true;
415 m_Git.repositories.push_back( repo );
421 &m_Git.authorName, wxS(
"" ) ) );
424 &m_Git.authorEmail, wxS(
"" ) ) );
426 m_params.emplace_back(
new PARAM<bool>(
"git.useDefaultAuthor",
427 &m_Git.useDefaultAuthor,
true ) );
429 m_params.emplace_back(
new PARAM<bool>(
"git.enableGit",
430 &m_Git.enableGit,
true ) );
432 m_params.emplace_back(
new PARAM<int>(
"git.updatInterval",
433 &m_Git.updatInterval, 5 ) );
436 &m_Api.python_interpreter, wxS(
"" ) ) );
438 m_params.emplace_back(
new PARAM<bool>(
"api.enable_server",
439 &m_Api.enable_server,
false ) );
442 [&]() -> nlohmann::json
444 nlohmann::json ret = nlohmann::json::object();
446 for(
const auto& dlg : m_dialogControlValues )
447 ret[ dlg.first ] = dlg.second;
451 [&](
const nlohmann::json& aVal )
453 m_dialogControlValues.clear();
455 if( !aVal.is_object() )
458 for(
auto& [dlgKey, dlgVal] : aVal.items() )
460 if( !dlgVal.is_object() )
463 for(
auto& [ctrlKey, ctrlVal] : dlgVal.items() )
464 m_dialogControlValues[ dlgKey ][ ctrlKey ] = ctrlVal;
467 nlohmann::json::object() ) );
485 nlohmann::json::json_pointer mwp_pointer(
"/input/mousewheel_pan"_json_pointer );
492 m_internals->At(
"input" ).erase(
"mousewheel_pan" );
497 wxT(
"COMMON_SETTINGS::Migrate 0->1: mousewheel_pan not found" ) );
502 ( *m_internals )[nlohmann::json::json_pointer(
"/input/horizontal_pan" )] =
true;
504 ( *m_internals )[nlohmann::json::json_pointer(
"/input/scroll_modifier_pan_h" )] =
506 ( *m_internals )[nlohmann::json::json_pointer(
"/input/scroll_modifier_pan_v" )] = 0;
507 ( *m_internals )[nlohmann::json::json_pointer(
"/input/scroll_modifier_zoom" )] =
512 ( *m_internals )[nlohmann::json::json_pointer(
"/input/horizontal_pan" )] =
false;
514 ( *m_internals )[nlohmann::json::json_pointer(
"/input/scroll_modifier_pan_h" )] =
516 ( *m_internals )[nlohmann::json::json_pointer(
"/input/scroll_modifier_pan_v" )] =
518 ( *m_internals )[nlohmann::json::json_pointer(
"/input/scroll_modifier_zoom" )] = 0;
527 nlohmann::json::json_pointer v1_pointer(
"/input/prefer_select_to_drag"_json_pointer );
529 bool prefer_selection =
false;
534 m_internals->at( nlohmann::json::json_pointer(
"/input"_json_pointer ) )
535 .erase(
"prefer_select_to_drag" );
540 wxT(
"COMMON_SETTINGS::Migrate 1->2: prefer_select_to_drag not found" ) );
543 if( prefer_selection )
544 ( *m_internals )[nlohmann::json::json_pointer(
"/input/mouse_left" )] =
545 MOUSE_DRAG_ACTION::SELECT;
547 ( *
m_internals )[nlohmann::json::json_pointer(
"/input/mouse_left" )] =
548 MOUSE_DRAG_ACTION::DRAG_ANY;
558 cfgpath.AppendDir( wxT(
"3d" ) );
559 cfgpath.SetFullName( wxS(
"3Dresolver.cfg" ) );
560 cfgpath.MakeAbsolute();
562 std::vector<LEGACY_3D_SEARCH_PATH> legacyPaths;
566 wxRegEx nonValidCharsRegex( wxS(
"[^A-Z0-9_]+" ), wxRE_ADVANCED );
570 wxString key =
path.m_Alias;
571 const wxString& val =
path.m_Pathvar;
580 key.Replace( wxS(
"-" ), wxS(
"_" ) );
583 nonValidCharsRegex.Replace( &key, wxEmptyString );
587 wxLogTrace(
traceEnvVars, wxS(
"COMMON_SETTINGS: Loaded new var: %s = %s" ), key, val );
592 if( cfgpath.FileExists() )
594 wxRemoveFile( cfgpath.GetFullPath() );
607 const nlohmann::json::json_pointer v3_pointer_eeschema(
"/netclass_panel/eeschema_shown_columns"_json_pointer );
608 wxString eeSchemaColumnList_old =
m_internals->at( v3_pointer_eeschema );
610 wxStringTokenizer eeSchemaShownTokens( eeSchemaColumnList_old );
611 wxString eeSchemaColumnList_new;
613 while( eeSchemaShownTokens.HasMoreTokens() )
616 eeSchemaShownTokens.GetNextToken().ToLong( &colNumber );
618 if( colNumber >= 10 )
621 eeSchemaColumnList_new += wxString::Format( wxT(
"%ld " ), colNumber );
624 eeSchemaColumnList_new.Trim(
true );
625 eeSchemaColumnList_new.Trim(
false );
627 m_internals->at( v3_pointer_eeschema ) = eeSchemaColumnList_new.ToUTF8();
630 const nlohmann::json::json_pointer v3_pointer_pcbnew(
"/netclass_panel/pcbnew_shown_columns"_json_pointer );
631 wxString pcbnewColumnList_old =
m_internals->at( v3_pointer_pcbnew );
633 wxStringTokenizer pcbnewShownTokens( pcbnewColumnList_old );
634 wxString pcbnewColumnList_new;
636 while( pcbnewShownTokens.HasMoreTokens() )
639 pcbnewShownTokens.GetNextToken().ToLong( &colNumber );
641 if( colNumber >= 10 )
644 pcbnewColumnList_new += wxString::Format( wxT(
"%ld " ), colNumber );
647 pcbnewColumnList_new.Trim(
true );
648 pcbnewColumnList_new.Trim(
false );
650 m_internals->at( v3_pointer_pcbnew ) = pcbnewColumnList_new.ToUTF8();
654 wxLogTrace(
traceSettings, wxT(
"COMMON_SETTINGS::Migrate 3->4: /netclass_panel/shown_columns not found" ) );
665 ret &= fromLegacy<double>( aCfg,
"CanvasScale",
"appearance.canvas_scale" );
666 ret &= fromLegacy<int>( aCfg,
"IconScale",
"appearance.icon_scale" );
667 ret &= fromLegacy<bool>( aCfg,
"UseIconsInMenus",
"appearance.use_icons_in_menus" );
668 ret &= fromLegacy<bool>( aCfg,
"ShowEnvVarWarningDialog",
"environment.show_warning_dialog" );
675 nlohmann::json::json_pointer ptr =
676 m_internals->PointerFromString(
"environment.vars" );
678 aCfg->SetPath(
"EnvironmentVariables" );
679 ( *m_internals )[ptr] = nlohmann::json( {} );
681 while( aCfg->GetNextEntry( key, index ) )
686 wxT(
"Migrate Env: %s is blacklisted; skipping." ), key );
690 value = aCfg->Read( key, wxEmptyString );
692 if( !value.IsEmpty() )
694 ptr.push_back( key.ToStdString() );
697 ptr.to_string(), value );
698 ( *m_internals )[ptr] = value.ToUTF8();
704 aCfg->SetPath(
".." );
709 bool mousewheel_pan =
false;
711 if( aCfg->Read(
"MousewheelPAN", &mousewheel_pan ) && mousewheel_pan )
713 Set(
"input.horizontal_pan",
true );
714 Set(
"input.scroll_modifier_pan_h",
static_cast<int>( WXK_SHIFT ) );
715 Set(
"input.scroll_modifier_pan_v", 0 );
716 Set(
"input.scroll_modifier_zoom",
static_cast<int>( WXK_CONTROL ) );
719 ret &= fromLegacy<bool>( aCfg,
"AutoPAN",
"input.auto_pan" );
720 ret &= fromLegacy<bool>( aCfg,
"ImmediateActions",
"input.immediate_actions" );
721 ret &= fromLegacy<bool>( aCfg,
"PreferSelectionToDragging",
"input.prefer_select_to_drag" );
722 ret &= fromLegacy<bool>( aCfg,
"MoveWarpsCursor",
"input.warp_mouse_on_move" );
723 ret &= fromLegacy<bool>( aCfg,
"ZoomNoCenter",
"input.center_on_zoom" );
726 if( std::optional<bool> value = Get<bool>(
"input.center_on_zoom" ) )
727 Set(
"input.center_on_zoom", !( *value ) );
729 ret &= fromLegacy<int>( aCfg,
"OpenGLAntialiasingMode",
"graphics.opengl_antialiasing_mode" );
730 ret &= fromLegacy<int>( aCfg,
"CairoAntialiasingMode",
"graphics.cairo_antialiasing_mode" );
732 ret &= fromLegacy<int>( aCfg,
"AutoSaveInterval",
"system.autosave_interval" );
734 ret &= fromLegacy<int>( aCfg,
"FileHistorySize",
"system.file_history_size" );
736 ret &=
fromLegacyString( aCfg,
"PdfBrowserName",
"system.pdf_viewer_name" );
737 ret &= fromLegacy<bool>( aCfg,
"UseSystemBrowser",
"system.use_system_pdf_viewer" );
747 [&](
const wxString& aKey,
const wxString& aDefault )
753 if( wxGetEnv( aKey, &envValue ) ==
true && !envValue.IsEmpty() )
758 wxS(
"InitializeEnvironment: Entry %s defined externally as %s" ), aKey,
763 wxLogTrace(
traceEnvVars, wxS(
"InitializeEnvironment: Setting entry %s to "
771 wxFileName
path( basePath );
772 path.AppendDir( wxT(
"footprints" ) );
776 path.AppendDir( wxT(
"3dmodels" ) );
788 path.AppendDir( wxT(
"symbols" ) );
792 path.AppendDir( wxT(
"blocks" ) );
798 std::vector<LEGACY_3D_SEARCH_PATH>& aSearchPaths )
800 wxFileName cfgpath(
path );
806 wxString cfgname = cfgpath.GetFullPath();
808 std::ifstream cfgFile;
811 if( !wxFileName::Exists( cfgname ) )
813 std::ostringstream ostr;
814 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
815 wxString errmsg =
"no 3D configuration file";
816 ostr <<
" * " << errmsg.ToUTF8() <<
" '";
817 ostr << cfgname.ToUTF8() <<
"'";
822 cfgFile.open( cfgname.ToUTF8() );
824 if( !cfgFile.is_open() )
826 std::ostringstream ostr;
827 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
828 wxString errmsg = wxS(
"Could not open configuration file" );
829 ostr <<
" * " << errmsg.ToUTF8() <<
" '" << cfgname.ToUTF8() <<
"'";
830 wxLogTrace(
traceSettings, wxS(
"%s\n" ), ostr.str().c_str() );
839 while( cfgFile.good() )
842 std::getline( cfgFile, cfgLine );
845 if( cfgLine.empty() )
853 if( 1 == lineno && cfgLine.compare( 0, 2,
"#V" ) == 0 )
856 if( cfgLine.size() > 2 )
858 std::istringstream istr;
859 istr.str( cfgLine.substr( 2 ) );
873 wxString versionedPath = wxString::Format( wxS(
"${%s}" ),
876 if( al.
m_Alias == versionedPath || al.
m_Alias == wxS(
"${KIPRJMOD}" )
877 || al.
m_Alias == wxS(
"$(KIPRJMOD)" ) || al.
m_Alias == wxS(
"${KISYS3DMOD}" )
878 || al.
m_Alias == wxS(
"$(KISYS3DMOD)" ) )
889 aSearchPaths.push_back( al );
903 if( aIndex >= aString.size() )
905 std::ostringstream ostr;
906 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
907 wxString errmsg = wxS(
"bad Hollerith string on line" );
908 ostr <<
" * " << errmsg.ToUTF8() <<
"\n'" << aString <<
"'";
909 wxLogTrace(
traceSettings, wxS(
"%s\n" ), ostr.str().c_str() );
914 size_t i2 = aString.find(
'"', aIndex );
916 if( std::string::npos == i2 )
918 std::ostringstream ostr;
919 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
920 wxString errmsg = wxS(
"missing opening quote mark in config file" );
921 ostr <<
" * " << errmsg.ToUTF8() <<
"\n'" << aString <<
"'";
922 wxLogTrace(
traceSettings, wxS(
"%s\n" ), ostr.str().c_str() );
929 if( i2 >= aString.size() )
931 std::ostringstream ostr;
932 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
933 wxString errmsg = wxS(
"invalid entry (unexpected end of line)" );
934 ostr <<
" * " << errmsg.ToUTF8() <<
"\n'" << aString <<
"'";
935 wxLogTrace(
traceSettings, wxS(
"%s\n" ), ostr.str().c_str() );
942 while( aString[i2] >=
'0' && aString[i2] <=
'9' )
943 tnum.append( 1, aString[i2++] );
945 if( tnum.empty() || aString[i2++] !=
':' )
947 std::ostringstream ostr;
948 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
949 wxString errmsg = wxS(
"bad Hollerith string on line" );
950 ostr <<
" * " << errmsg.ToUTF8() <<
"\n'" << aString <<
"'";
951 wxLogTrace(
traceSettings, wxS(
"%s\n" ), ostr.str().c_str() );
956 std::istringstream istr;
961 if( ( i2 + nchars ) >= aString.size() )
963 std::ostringstream ostr;
964 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
965 wxString errmsg = wxS(
"invalid entry (unexpected end of line)" );
966 ostr <<
" * " << errmsg.ToUTF8() <<
"\n'" << aString <<
"'";
967 wxLogTrace(
traceSettings, wxS(
"%s\n" ), ostr.str().c_str() );
974 aResult = wxString::FromUTF8( aString.substr( i2, nchars ).c_str() );
978 if( i2 >= aString.size() || aString[i2] !=
'"' )
980 std::ostringstream ostr;
981 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
982 wxString errmsg = wxS(
"missing closing quote mark in config file" );
983 ostr <<
" * " << errmsg.ToUTF8() <<
"\n'" << aString <<
"'";
984 wxLogTrace(
traceSettings, wxS(
"%s\n" ), ostr.str().c_str() );
static bool getLegacy3DHollerith(const std::string &aString, size_t &aIndex, wxString &aResult)
bool readLegacy3DResolverCfg(const wxString &aPath, std::vector< LEGACY_3D_SEARCH_PATH > &aSearchPaths)
void InitializeEnvironment()
Creates the built-in environment variables and sets their default values.
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
@ GAL_TYPE_OPENGL
OpenGL implementation.
KiCad uses environment variables internally for determining the base paths for libraries,...
bool fromLegacyString(wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
Translates a legacy wxConfig string value to a given JSON pointer value.
void Set(const std::string &aPath, ValueType aVal)
Stores a value into the JSON document Will throw an exception if ValueType isn't something that the l...
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
std::unique_ptr< JSON_SETTINGS_INTERNALS > m_internals
Stores an enum as an integer.
Like a normal param, but with custom getter and setter functions.
static wxString GetUserTemplatesPath()
Gets the user path for custom templates.
static wxString GetStockEDALibraryPath()
Gets the stock (install) EDA library data path, which is the base path for templates,...
static wxString GetDefault3rdPartyPath()
Gets the default path for PCM packages.
static wxString GetStockTemplatesPath()
Gets the stock (install) templates path.
static wxString GetUserSettingsPath()
Return the user configuration path used to store KiCad's configuration files.
const int commonSchemaVersion
! Update the schema version whenever a migration is required
const wxRegEx versionedEnvVarRegex(wxS("KICAD[0-9]+_[A-Z0-9_]+(_DIR)?"))
! The following environment variables will never be migrated from a previous version
Functions related to environment variables, including help functions.
const wxChar *const traceEnvVars
Flag to enable debug output of environment variable operations.
@ USER
The main config directory (e.g. ~/.config/kicad/)
KICOMMON_API wxString GetVersionedEnvVarName(const wxString &aBaseName)
Construct a versioned environment variable based on this KiCad major version.
bool apply_icon_scale_to_fonts
double hicontrast_dimming_factor
int min_interval
Minimum time, in seconds, between subsequent backups.
bool backup_on_autosave
Trigger a backup on autosave.
unsigned long long limit_total_size
Maximum total size of backups (bytes), 0 for unlimited.
int limit_total_files
Maximum number of backup archives to retain.
int limit_daily_files
Maximum files to keep per day, 0 for unlimited.
bool enabled
Automatically back up the project when files are saved.
System directories search utilities.
wxLogTrace helper definitions.
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().