2018-12-10 10:56:28 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2023-06-20 13:15:56 +00:00
|
|
|
* Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2018-12-10 10:56:28 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <advanced_config.h>
|
2024-02-02 11:00:08 +00:00
|
|
|
#include <trace_helpers.h>
|
2018-12-10 10:56:28 +00:00
|
|
|
#include <config_params.h>
|
2023-09-23 23:53:22 +00:00
|
|
|
#include <paths.h>
|
2018-12-10 10:56:28 +00:00
|
|
|
|
2021-06-03 19:30:31 +00:00
|
|
|
#include <wx/app.h>
|
2018-12-10 10:56:28 +00:00
|
|
|
#include <wx/config.h>
|
|
|
|
#include <wx/filename.h>
|
|
|
|
#include <wx/log.h>
|
2021-10-08 01:04:51 +00:00
|
|
|
#include <wx/tokenzr.h>
|
2018-12-10 10:56:28 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Flag to enable advanced config debugging
|
|
|
|
*
|
|
|
|
* Use "KICAD_ADVANCED_CONFIG" to enable.
|
|
|
|
*
|
|
|
|
* @ingroup trace_env_vars
|
|
|
|
*/
|
|
|
|
static const wxChar AdvancedConfigMask[] = wxT( "KICAD_ADVANCED_CONFIG" );
|
|
|
|
|
2019-08-15 04:25:05 +00:00
|
|
|
/**
|
|
|
|
* Limits and default settings for the coroutine stack size allowed.
|
|
|
|
* Warning! Setting the stack size below the default may lead to unexplained crashes
|
|
|
|
* This configuration setting is intended for developers only.
|
|
|
|
*/
|
|
|
|
namespace AC_STACK
|
|
|
|
{
|
|
|
|
static constexpr int min_stack = 32 * 4096;
|
|
|
|
static constexpr int default_stack = 256 * 4096;
|
|
|
|
static constexpr int max_stack = 4096 * 4096;
|
|
|
|
}
|
|
|
|
|
2018-12-10 10:56:28 +00:00
|
|
|
/**
|
|
|
|
* List of known keys for advanced configuration options.
|
|
|
|
*
|
2023-12-18 13:32:41 +00:00
|
|
|
* Set these options in the file `kicad_advanced` in the KiCad configuration directory.
|
2018-12-10 10:56:28 +00:00
|
|
|
*/
|
|
|
|
namespace AC_KEYS
|
|
|
|
{
|
2020-07-26 14:20:24 +00:00
|
|
|
|
2023-04-08 15:22:34 +00:00
|
|
|
static const wxChar IncrementalConnectivity[] = wxT( "IncrementalConnectivity" );
|
2023-04-07 17:08:43 +00:00
|
|
|
static const wxChar Use3DConnexionDriver[] = wxT( "3DConnexionDriver" );
|
2020-07-26 14:20:24 +00:00
|
|
|
static const wxChar ExtraFillMargin[] = wxT( "ExtraFillMargin" );
|
2020-09-02 22:15:30 +00:00
|
|
|
static const wxChar DRCEpsilon[] = wxT( "DRCEpsilon" );
|
2021-08-11 13:01:30 +00:00
|
|
|
static const wxChar DRCSliverWidthTolerance[] = wxT( "DRCSliverWidthTolerance" );
|
2022-12-04 00:02:07 +00:00
|
|
|
static const wxChar DRCSliverMinimumLength[] = wxT( "DRCSliverMinimumLength" );
|
2021-08-11 13:01:30 +00:00
|
|
|
static const wxChar DRCSliverAngleTolerance[] = wxT( "DRCSliverAngleTolerance" );
|
2020-09-03 14:58:49 +00:00
|
|
|
static const wxChar HoleWallThickness[] = wxT( "HoleWallPlatingThickness" );
|
2019-08-15 04:25:05 +00:00
|
|
|
static const wxChar CoroutineStackSize[] = wxT( "CoroutineStackSize" );
|
2020-07-03 23:33:36 +00:00
|
|
|
static const wxChar ShowRouterDebugGraphics[] = wxT( "ShowRouterDebugGraphics" );
|
2023-08-07 15:44:33 +00:00
|
|
|
static const wxChar EnableRouterDump[] = wxT( "EnableRouterDump" );
|
2023-06-20 13:15:56 +00:00
|
|
|
static const wxChar HyperZoom[] = wxT( "HyperZoom" );
|
2020-07-25 21:53:58 +00:00
|
|
|
static const wxChar CompactFileSave[] = wxT( "CompactSave" );
|
2020-08-09 23:03:31 +00:00
|
|
|
static const wxChar DrawArcAccuracy[] = wxT( "DrawArcAccuracy" );
|
|
|
|
static const wxChar DrawArcCenterStartEndMaxAngle[] = wxT( "DrawArcCenterStartEndMaxAngle" );
|
2021-03-31 20:13:08 +00:00
|
|
|
static const wxChar MaxTangentTrackAngleDeviation[] = wxT( "MaxTangentTrackAngleDeviation" );
|
|
|
|
static const wxChar MaxTrackLengthToKeep[] = wxT( "MaxTrackLengthToKeep" );
|
2020-08-12 13:16:57 +00:00
|
|
|
static const wxChar StrokeTriangulation[] = wxT( "StrokeTriangulation" );
|
2021-07-26 17:56:11 +00:00
|
|
|
static const wxChar ExtraZoneDisplayModes[] = wxT( "ExtraZoneDisplayModes" );
|
2020-09-08 19:18:50 +00:00
|
|
|
static const wxChar MinPlotPenWidth[] = wxT( "MinPlotPenWidth" );
|
2020-09-23 09:35:13 +00:00
|
|
|
static const wxChar DebugZoneFiller[] = wxT( "DebugZoneFiller" );
|
2020-11-06 10:32:14 +00:00
|
|
|
static const wxChar DebugPDFWriter[] = wxT( "DebugPDFWriter" );
|
2021-01-04 22:26:23 +00:00
|
|
|
static const wxChar SmallDrillMarkSize[] = wxT( "SmallDrillMarkSize" );
|
2021-02-20 18:41:42 +00:00
|
|
|
static const wxChar HotkeysDumper[] = wxT( "HotkeysDumper" );
|
2021-02-24 22:14:39 +00:00
|
|
|
static const wxChar DrawBoundingBoxes[] = wxT( "DrawBoundingBoxes" );
|
2021-03-28 12:37:54 +00:00
|
|
|
static const wxChar ShowPcbnewExportNetlist[] = wxT( "ShowPcbnewExportNetlist" );
|
2021-07-11 04:35:38 +00:00
|
|
|
static const wxChar Skip3DModelFileCache[] = wxT( "Skip3DModelFileCache" );
|
|
|
|
static const wxChar Skip3DModelMemoryCache[] = wxT( "Skip3DModelMemoryCache" );
|
2021-07-14 22:24:21 +00:00
|
|
|
static const wxChar HideVersionFromTitle[] = wxT( "HideVersionFromTitle" );
|
2021-10-08 01:04:51 +00:00
|
|
|
static const wxChar TraceMasks[] = wxT( "TraceMasks" );
|
2021-11-25 12:16:42 +00:00
|
|
|
static const wxChar ShowRepairSchematic[] = wxT( "ShowRepairSchematic" );
|
2021-12-05 20:15:18 +00:00
|
|
|
static const wxChar ShowEventCounters[] = wxT( "ShowEventCounters" );
|
2021-12-09 23:36:44 +00:00
|
|
|
static const wxChar AllowManualCanvasScale[] = wxT( "AllowManualCanvasScale" );
|
2021-12-28 23:17:53 +00:00
|
|
|
static const wxChar UpdateUIEventInterval[] = wxT( "UpdateUIEventInterval" );
|
2022-05-15 08:38:46 +00:00
|
|
|
static const wxChar V3DRT_BevelHeight_um[] = wxT( "V3DRT_BevelHeight_um" );
|
|
|
|
static const wxChar V3DRT_BevelExtentFactor[] = wxT( "V3DRT_BevelExtentFactor" );
|
2022-10-19 23:25:45 +00:00
|
|
|
static const wxChar UseClipper2[] = wxT( "UseClipper2" );
|
2023-10-07 16:18:21 +00:00
|
|
|
static const wxChar EnableGenerators[] = wxT( "EnableGenerators" );
|
2023-09-14 21:39:42 +00:00
|
|
|
static const wxChar EnableGit[] = wxT( "EnableGit" );
|
2024-02-29 19:01:59 +00:00
|
|
|
static const wxChar EnableLibWithText[] = wxT( "EnableLibWithText" );
|
2023-11-23 13:29:07 +00:00
|
|
|
static const wxChar EnableEeschemaPrintCairo[] = wxT( "EnableEeschemaPrintCairo" );
|
2023-09-24 23:33:05 +00:00
|
|
|
static const wxChar DisambiguationTime[] = wxT( "DisambiguationTime" );
|
2023-12-17 21:43:35 +00:00
|
|
|
static const wxChar PcbSelectionVisibilityRatio[] = wxT( "PcbSelectionVisibilityRatio" );
|
2024-06-18 04:47:06 +00:00
|
|
|
static const wxChar FontErrorSize[] = wxT( "FontErrorSize" );
|
2024-02-29 19:04:39 +00:00
|
|
|
static const wxChar OcePluginLinearDeflection[] = wxT( "OcePluginLinearDeflection" );
|
|
|
|
static const wxChar OcePluginAngularDeflection[] = wxT( "OcePluginAngularDeflection" );
|
2024-03-20 22:47:44 +00:00
|
|
|
static const wxChar TriangulateSimplificationLevel[] = wxT( "TriangulateSimplificationLevel" );
|
2024-03-21 01:00:42 +00:00
|
|
|
static const wxChar TriangulateMinimumArea[] = wxT( "TriangulateMinimumArea" );
|
2024-03-25 23:50:26 +00:00
|
|
|
static const wxChar EnableCacheFriendlyFracture[] = wxT( "EnableCacheFriendlyFracture" );
|
2023-01-29 18:06:05 +00:00
|
|
|
static const wxChar EnableAPILogging[] = wxT( "EnableAPILogging" );
|
2024-05-09 22:28:38 +00:00
|
|
|
static const wxChar MaxFileSystemWatchers[] = wxT( "MaxFileSystemWatchers" );
|
2024-06-03 18:56:37 +00:00
|
|
|
static const wxChar MinorSchematicGraphSize[] = wxT( "MinorSchematicGraphSize" );
|
2018-12-10 10:56:28 +00:00
|
|
|
} // namespace KEYS
|
|
|
|
|
|
|
|
|
2022-05-15 08:38:46 +00:00
|
|
|
/**
|
|
|
|
* List of known groups for advanced configuration options.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
namespace AC_GROUPS
|
|
|
|
{
|
|
|
|
static const wxChar V3D_RayTracing[] = wxT( "G_3DV_RayTracing" );
|
|
|
|
}
|
|
|
|
|
2018-12-10 10:56:28 +00:00
|
|
|
/*
|
|
|
|
* Get a simple string for common parameters.
|
|
|
|
*
|
|
|
|
* This isn't exhaustive, but it covers most common types that might be
|
|
|
|
* used in the advance config
|
|
|
|
*/
|
2020-01-12 18:40:50 +00:00
|
|
|
wxString dumpParamCfg( const PARAM_CFG& aParam )
|
2018-12-10 10:56:28 +00:00
|
|
|
{
|
2023-01-22 14:41:33 +00:00
|
|
|
wxString s = aParam.m_Ident + wxS( ": " );
|
2018-12-10 10:56:28 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This implementation is rather simplistic, but it is
|
|
|
|
* effective enough for simple uses. A better implementation would be
|
|
|
|
* some kind of visitor, but that's somewhat more work.
|
|
|
|
*/
|
|
|
|
switch( aParam.m_Type )
|
|
|
|
{
|
|
|
|
case paramcfg_id::PARAM_INT:
|
|
|
|
case paramcfg_id::PARAM_INT_WITH_SCALE:
|
|
|
|
s << *static_cast<const PARAM_CFG_INT&>( aParam ).m_Pt_param;
|
|
|
|
break;
|
|
|
|
case paramcfg_id::PARAM_DOUBLE:
|
|
|
|
s << *static_cast<const PARAM_CFG_DOUBLE&>( aParam ).m_Pt_param;
|
|
|
|
break;
|
|
|
|
case paramcfg_id::PARAM_WXSTRING:
|
|
|
|
s << *static_cast<const PARAM_CFG_WXSTRING&>( aParam ).m_Pt_param;
|
|
|
|
break;
|
|
|
|
case paramcfg_id::PARAM_FILENAME:
|
|
|
|
s << *static_cast<const PARAM_CFG_FILENAME&>( aParam ).m_Pt_param;
|
|
|
|
break;
|
|
|
|
case paramcfg_id::PARAM_BOOL:
|
2023-01-22 14:41:33 +00:00
|
|
|
s << ( *static_cast<const PARAM_CFG_BOOL&>( aParam ).m_Pt_param ? wxS( "true" ) : wxS( "false" ) );
|
2018-12-10 10:56:28 +00:00
|
|
|
break;
|
2023-01-22 14:41:33 +00:00
|
|
|
default: s << wxS( "Unsupported PARAM_CFG variant: " ) << aParam.m_Type;
|
2018-12-10 10:56:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dump the configs in the given array to trace.
|
|
|
|
*/
|
2020-01-12 18:40:50 +00:00
|
|
|
static void dumpCfg( const std::vector<PARAM_CFG*>& aArray )
|
2018-12-10 10:56:28 +00:00
|
|
|
{
|
|
|
|
// only dump if we need to
|
|
|
|
if( !wxLog::IsAllowedTraceMask( AdvancedConfigMask ) )
|
|
|
|
return;
|
|
|
|
|
2020-01-12 18:40:50 +00:00
|
|
|
for( const PARAM_CFG* param : aArray )
|
2018-12-10 10:56:28 +00:00
|
|
|
{
|
2020-01-12 18:40:50 +00:00
|
|
|
wxLogTrace( AdvancedConfigMask, dumpParamCfg( *param ) );
|
2018-12-10 10:56:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the filename for the advanced config file
|
|
|
|
*
|
|
|
|
* The user must check the file exists if they care.
|
|
|
|
*/
|
|
|
|
static wxFileName getAdvancedCfgFilename()
|
|
|
|
{
|
2023-01-22 14:41:33 +00:00
|
|
|
const static wxString cfg_filename{ wxS( "kicad_advanced" ) };
|
2023-09-23 23:53:22 +00:00
|
|
|
return wxFileName( PATHS::GetUserSettingsPath(), cfg_filename );
|
2018-12-10 10:56:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ADVANCED_CFG::ADVANCED_CFG()
|
|
|
|
{
|
2023-01-22 14:41:33 +00:00
|
|
|
wxLogTrace( AdvancedConfigMask, wxS( "Init advanced config" ) );
|
2018-12-12 12:26:03 +00:00
|
|
|
|
|
|
|
// Init defaults - this is done in case the config doesn't exist,
|
|
|
|
// then the values will remain as set here.
|
2020-11-16 11:16:44 +00:00
|
|
|
m_CoroutineStackSize = AC_STACK::default_stack;
|
2020-08-12 13:16:57 +00:00
|
|
|
m_ShowRouterDebugGraphics = false;
|
2023-08-07 15:44:33 +00:00
|
|
|
m_EnableRouterDump = false;
|
2023-06-20 13:15:56 +00:00
|
|
|
m_HyperZoom = false;
|
2020-11-16 11:16:44 +00:00
|
|
|
m_DrawArcAccuracy = 10.0;
|
|
|
|
m_DrawArcCenterMaxAngle = 50.0;
|
2021-03-31 20:13:08 +00:00
|
|
|
m_MaxTangentAngleDeviation = 1.0;
|
2022-01-28 21:31:16 +00:00
|
|
|
m_MaxTrackLengthToKeep = 0.0005;
|
2021-07-26 17:56:11 +00:00
|
|
|
m_ExtraZoneDisplayModes = false;
|
2020-08-12 13:16:57 +00:00
|
|
|
m_DrawTriangulationOutlines = false;
|
2018-12-12 12:26:03 +00:00
|
|
|
|
2022-01-28 21:31:16 +00:00
|
|
|
m_ExtraClearance = 0.0005;
|
|
|
|
m_DRCEpsilon = 0.0005; // 0.5um is small enough not to materially violate
|
2020-09-02 22:15:30 +00:00
|
|
|
// any constraints.
|
2021-08-11 13:01:30 +00:00
|
|
|
m_SliverWidthTolerance = 0.08;
|
2023-04-02 15:42:57 +00:00
|
|
|
m_SliverMinimumLength = 0.0008;
|
2021-08-11 13:01:30 +00:00
|
|
|
m_SliverAngleTolerance = 20.0;
|
2020-09-03 14:58:49 +00:00
|
|
|
|
2020-09-08 19:18:50 +00:00
|
|
|
m_HoleWallThickness = 0.020; // IPC-6012 says 15-18um; Cadence says at least
|
2020-09-03 14:58:49 +00:00
|
|
|
// 0.020 for a Class 2 board and at least 0.025
|
|
|
|
// for Class 3.
|
2020-09-08 19:18:50 +00:00
|
|
|
|
|
|
|
m_MinPlotPenWidth = 0.0212; // 1 pixel at 1200dpi.
|
|
|
|
|
2020-09-23 09:35:13 +00:00
|
|
|
m_DebugZoneFiller = false;
|
2020-11-06 10:32:14 +00:00
|
|
|
m_DebugPDFWriter = false;
|
2021-02-20 18:41:42 +00:00
|
|
|
m_SmallDrillMarkSize = 0.35;
|
|
|
|
m_HotkeysDumper = false;
|
2021-02-24 22:14:39 +00:00
|
|
|
m_DrawBoundingBoxes = false;
|
2021-03-28 12:37:54 +00:00
|
|
|
m_ShowPcbnewExportNetlist = false;
|
2021-07-11 04:35:38 +00:00
|
|
|
m_Skip3DModelFileCache = false;
|
|
|
|
m_Skip3DModelMemoryCache = false;
|
2021-07-14 22:24:21 +00:00
|
|
|
m_HideVersionFromTitle = false;
|
2021-12-05 20:15:18 +00:00
|
|
|
m_ShowEventCounters = false;
|
2021-12-09 23:36:44 +00:00
|
|
|
m_AllowManualCanvasScale = false;
|
2022-01-28 21:31:16 +00:00
|
|
|
m_CompactSave = false;
|
2021-12-28 23:17:53 +00:00
|
|
|
m_UpdateUIEventInterval = 0;
|
2022-01-28 21:31:16 +00:00
|
|
|
m_ShowRepairSchematic = false;
|
2023-10-07 16:18:21 +00:00
|
|
|
m_EnableGenerators = false;
|
2023-09-14 21:39:42 +00:00
|
|
|
m_EnableGit = false;
|
2024-02-29 19:01:59 +00:00
|
|
|
m_EnableLibWithText = false;
|
2024-01-04 14:10:08 +00:00
|
|
|
|
|
|
|
m_EnableEeschemaPrintCairo = true;
|
2022-01-08 15:56:41 +00:00
|
|
|
|
2022-05-15 08:38:46 +00:00
|
|
|
m_3DRT_BevelHeight_um = 30;
|
|
|
|
m_3DRT_BevelExtentFactor = 1.0 / 16.0;
|
|
|
|
|
2022-12-04 00:04:36 +00:00
|
|
|
m_UseClipper2 = true;
|
2023-01-29 18:06:05 +00:00
|
|
|
m_EnableAPILogging = false;
|
2023-05-07 16:12:20 +00:00
|
|
|
|
2023-06-13 16:44:22 +00:00
|
|
|
m_Use3DConnexionDriver = true;
|
2023-05-07 16:12:20 +00:00
|
|
|
|
2024-01-21 16:53:05 +00:00
|
|
|
m_IncrementalConnectivity = true;
|
2022-10-19 23:25:45 +00:00
|
|
|
|
2024-02-15 17:17:43 +00:00
|
|
|
m_DisambiguationMenuDelay = 500;
|
2023-09-24 23:33:05 +00:00
|
|
|
|
2023-12-17 21:43:35 +00:00
|
|
|
m_PcbSelectionVisibilityRatio = 1.0;
|
|
|
|
|
2024-06-28 19:09:49 +00:00
|
|
|
m_FontErrorSize = 2;
|
2024-01-12 02:26:42 +00:00
|
|
|
|
2024-02-29 19:04:39 +00:00
|
|
|
m_OcePluginLinearDeflection = 0.14;
|
|
|
|
m_OcePluginAngularDeflection = 30;
|
|
|
|
|
2024-03-20 22:47:44 +00:00
|
|
|
m_TriangulateSimplificationLevel = 50;
|
2024-03-21 01:00:42 +00:00
|
|
|
m_TriangulateMinimumArea = 1000;
|
2024-03-20 22:47:44 +00:00
|
|
|
|
2024-03-25 23:50:26 +00:00
|
|
|
m_EnableCacheFriendlyFracture = true;
|
|
|
|
|
2024-05-09 22:28:38 +00:00
|
|
|
m_MaxFilesystemWatchers = 16384;
|
|
|
|
|
2024-06-03 18:56:37 +00:00
|
|
|
m_MinorSchematicGraphSize = 10000;
|
|
|
|
|
2018-12-10 10:56:28 +00:00
|
|
|
loadFromConfigFile();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const ADVANCED_CFG& ADVANCED_CFG::GetCfg()
|
|
|
|
{
|
|
|
|
static ADVANCED_CFG instance;
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ADVANCED_CFG::loadFromConfigFile()
|
|
|
|
{
|
2020-08-25 18:03:21 +00:00
|
|
|
const wxFileName k_advanced = getAdvancedCfgFilename();
|
2018-12-10 10:56:28 +00:00
|
|
|
|
2021-06-03 19:30:31 +00:00
|
|
|
// If we are running headless, use the class defaults because we cannot instantiate wxConfig
|
|
|
|
if( !wxTheApp )
|
|
|
|
return;
|
|
|
|
|
2018-12-10 10:56:28 +00:00
|
|
|
if( !k_advanced.FileExists() )
|
|
|
|
{
|
2023-01-22 14:41:33 +00:00
|
|
|
wxLogTrace( AdvancedConfigMask, wxS( "File does not exist %s" ), k_advanced.GetFullPath() );
|
2020-08-25 18:03:21 +00:00
|
|
|
|
|
|
|
// load the defaults
|
|
|
|
wxConfig emptyConfig;
|
|
|
|
loadSettings( emptyConfig );
|
|
|
|
|
2018-12-10 10:56:28 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-12-18 13:32:41 +00:00
|
|
|
wxLogTrace( AdvancedConfigMask, wxS( "Loading advanced config from: %s" ),
|
|
|
|
k_advanced.GetFullPath() );
|
2018-12-10 10:56:28 +00:00
|
|
|
|
2023-01-22 14:41:33 +00:00
|
|
|
wxFileConfig file_cfg( wxS( "" ), wxS( "" ), k_advanced.GetFullPath() );
|
2018-12-10 10:56:28 +00:00
|
|
|
loadSettings( file_cfg );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
|
|
|
{
|
2020-01-12 18:40:50 +00:00
|
|
|
std::vector<PARAM_CFG*> configParams;
|
2018-12-10 10:56:28 +00:00
|
|
|
|
2020-07-26 14:20:24 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::ExtraFillMargin,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_ExtraClearance,
|
|
|
|
m_ExtraClearance, 0.0, 1.0 ) );
|
2020-09-02 22:15:30 +00:00
|
|
|
|
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DRCEpsilon,
|
2022-01-28 21:31:16 +00:00
|
|
|
&m_DRCEpsilon, m_DRCEpsilon, 0.0, 1.0 ) );
|
2020-07-26 14:20:24 +00:00
|
|
|
|
2021-08-11 13:01:30 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DRCSliverWidthTolerance,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_SliverWidthTolerance, m_SliverWidthTolerance,
|
|
|
|
0.01, 0.25 ) );
|
2021-08-11 13:01:30 +00:00
|
|
|
|
2022-12-04 00:02:07 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DRCSliverMinimumLength,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_SliverMinimumLength, m_SliverMinimumLength,
|
|
|
|
1e-9, 10 ) );
|
2022-12-04 00:02:07 +00:00
|
|
|
|
2021-08-11 13:01:30 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DRCSliverAngleTolerance,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_SliverAngleTolerance, m_SliverAngleTolerance,
|
|
|
|
1.0, 90.0 ) );
|
2021-08-11 13:01:30 +00:00
|
|
|
|
2020-09-03 14:58:49 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::HoleWallThickness,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_HoleWallThickness, m_HoleWallThickness,
|
|
|
|
0.0, 1.0 ) );
|
2020-09-03 14:58:49 +00:00
|
|
|
|
2020-01-12 18:40:50 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::CoroutineStackSize,
|
2020-11-16 11:16:44 +00:00
|
|
|
&m_CoroutineStackSize, AC_STACK::default_stack,
|
2020-01-12 18:40:50 +00:00
|
|
|
AC_STACK::min_stack, AC_STACK::max_stack ) );
|
2019-08-15 04:25:05 +00:00
|
|
|
|
2021-12-28 23:17:53 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::UpdateUIEventInterval,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_UpdateUIEventInterval, m_UpdateUIEventInterval,
|
|
|
|
-1, 100000 ) );
|
2021-12-28 23:17:53 +00:00
|
|
|
|
2020-07-03 23:33:36 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ShowRouterDebugGraphics,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_ShowRouterDebugGraphics,
|
|
|
|
m_ShowRouterDebugGraphics ) );
|
2020-07-03 23:33:36 +00:00
|
|
|
|
2023-08-07 15:44:33 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableRouterDump,
|
|
|
|
&m_EnableRouterDump, m_EnableRouterDump ) );
|
|
|
|
|
2023-06-20 13:15:56 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::HyperZoom,
|
|
|
|
&m_HyperZoom, m_HyperZoom ) );
|
|
|
|
|
2020-07-25 21:53:58 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::CompactFileSave,
|
2022-01-28 21:31:16 +00:00
|
|
|
&m_CompactSave, m_CompactSave ) );
|
2020-07-25 21:53:58 +00:00
|
|
|
|
2020-08-12 13:16:57 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DrawArcAccuracy,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_DrawArcAccuracy, m_DrawArcAccuracy,
|
|
|
|
0.0, 100000.0 ) );
|
2020-08-09 23:03:31 +00:00
|
|
|
|
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DrawArcCenterStartEndMaxAngle,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_DrawArcCenterMaxAngle,
|
|
|
|
m_DrawArcCenterMaxAngle, 0.0, 100000.0 ) );
|
2020-08-12 13:16:57 +00:00
|
|
|
|
2021-03-31 20:13:08 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::MaxTangentTrackAngleDeviation,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_MaxTangentAngleDeviation,
|
|
|
|
m_MaxTangentAngleDeviation, 0.0, 90.0 ) );
|
2021-03-31 20:13:08 +00:00
|
|
|
|
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::MaxTrackLengthToKeep,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_MaxTrackLengthToKeep, m_MaxTrackLengthToKeep,
|
|
|
|
0.0, 1.0 ) );
|
2021-03-31 20:13:08 +00:00
|
|
|
|
2021-07-26 17:56:11 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ExtraZoneDisplayModes,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_ExtraZoneDisplayModes,
|
|
|
|
m_ExtraZoneDisplayModes ) );
|
2021-07-26 17:56:11 +00:00
|
|
|
|
2020-08-12 13:16:57 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::StrokeTriangulation,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_DrawTriangulationOutlines,
|
|
|
|
m_DrawTriangulationOutlines ) );
|
2020-08-09 23:03:31 +00:00
|
|
|
|
2020-09-08 19:18:50 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::MinPlotPenWidth,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_MinPlotPenWidth, m_MinPlotPenWidth,
|
|
|
|
0.0, 1.0 ) );
|
2020-09-08 19:18:50 +00:00
|
|
|
|
2020-09-23 09:35:13 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::DebugZoneFiller,
|
2022-01-28 21:31:16 +00:00
|
|
|
&m_DebugZoneFiller, m_DebugZoneFiller ) );
|
2020-09-23 09:35:13 +00:00
|
|
|
|
2020-11-06 10:32:14 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::DebugPDFWriter,
|
2022-01-28 21:31:16 +00:00
|
|
|
&m_DebugPDFWriter, m_DebugPDFWriter ) );
|
2020-11-06 10:32:14 +00:00
|
|
|
|
2021-01-04 22:26:23 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::SmallDrillMarkSize,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_SmallDrillMarkSize, m_SmallDrillMarkSize,
|
|
|
|
0.0, 3.0 ) );
|
2020-10-03 01:58:24 +00:00
|
|
|
|
2021-02-20 18:41:42 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::HotkeysDumper,
|
2022-01-28 21:31:16 +00:00
|
|
|
&m_HotkeysDumper, m_HotkeysDumper ) );
|
2021-02-20 18:41:42 +00:00
|
|
|
|
2021-02-24 22:14:39 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::DrawBoundingBoxes,
|
2022-01-28 21:31:16 +00:00
|
|
|
&m_DrawBoundingBoxes, m_DrawBoundingBoxes ) );
|
2021-02-24 22:14:39 +00:00
|
|
|
|
2021-03-28 12:37:54 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ShowPcbnewExportNetlist,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_ShowPcbnewExportNetlist,
|
|
|
|
m_ShowPcbnewExportNetlist ) );
|
2021-03-28 12:37:54 +00:00
|
|
|
|
2021-07-11 04:35:38 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::Skip3DModelFileCache,
|
2022-01-28 21:31:16 +00:00
|
|
|
&m_Skip3DModelFileCache, m_Skip3DModelFileCache ) );
|
2021-07-11 03:59:54 +00:00
|
|
|
|
2021-07-11 04:35:38 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::Skip3DModelMemoryCache,
|
2022-01-28 21:31:16 +00:00
|
|
|
&m_Skip3DModelMemoryCache, m_Skip3DModelMemoryCache ) );
|
2021-07-11 04:31:06 +00:00
|
|
|
|
2021-07-14 22:24:21 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::HideVersionFromTitle,
|
2022-01-28 21:31:16 +00:00
|
|
|
&m_HideVersionFromTitle, m_HideVersionFromTitle ) );
|
2021-07-14 22:24:21 +00:00
|
|
|
|
2021-11-25 12:16:42 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ShowRepairSchematic,
|
2022-01-28 21:31:16 +00:00
|
|
|
&m_ShowRepairSchematic, m_ShowRepairSchematic ) );
|
2021-11-25 12:16:42 +00:00
|
|
|
|
2021-12-05 20:15:18 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ShowEventCounters,
|
2022-01-28 21:31:16 +00:00
|
|
|
&m_ShowEventCounters, m_ShowEventCounters ) );
|
2021-12-05 20:15:18 +00:00
|
|
|
|
2021-12-09 23:36:44 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::AllowManualCanvasScale,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_AllowManualCanvasScale,
|
|
|
|
m_AllowManualCanvasScale ) );
|
2021-12-09 23:36:44 +00:00
|
|
|
|
2022-05-15 08:38:46 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::V3DRT_BevelHeight_um,
|
|
|
|
&m_3DRT_BevelHeight_um, m_3DRT_BevelHeight_um,
|
|
|
|
0, std::numeric_limits<int>::max(),
|
|
|
|
AC_GROUPS::V3D_RayTracing ) );
|
|
|
|
|
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::V3DRT_BevelExtentFactor,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_3DRT_BevelExtentFactor,
|
|
|
|
m_3DRT_BevelExtentFactor, 0.0, 100.0,
|
2022-05-15 08:38:46 +00:00
|
|
|
AC_GROUPS::V3D_RayTracing ) );
|
|
|
|
|
2022-10-19 23:25:45 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::UseClipper2,
|
|
|
|
&m_UseClipper2, m_UseClipper2 ) );
|
|
|
|
|
2023-04-07 17:08:43 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::Use3DConnexionDriver,
|
|
|
|
&m_Use3DConnexionDriver, m_Use3DConnexionDriver ) );
|
|
|
|
|
2023-04-08 15:22:34 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::IncrementalConnectivity,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_IncrementalConnectivity,
|
|
|
|
m_IncrementalConnectivity ) );
|
2023-04-08 15:22:34 +00:00
|
|
|
|
2023-09-24 23:33:05 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::DisambiguationTime,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_DisambiguationMenuDelay,
|
|
|
|
m_DisambiguationMenuDelay,
|
|
|
|
50, 10000 ) );
|
2023-09-24 23:33:05 +00:00
|
|
|
|
2023-10-07 16:18:21 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableGenerators,
|
|
|
|
&m_EnableGenerators, m_EnableGenerators ) );
|
|
|
|
|
2023-01-29 18:06:05 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableAPILogging,
|
|
|
|
&m_EnableAPILogging, m_EnableAPILogging ) );
|
|
|
|
|
2023-09-14 21:39:42 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableGit,
|
|
|
|
&m_EnableGit, m_EnableGit ) );
|
|
|
|
|
2024-02-29 19:01:59 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableLibWithText,
|
|
|
|
&m_EnableLibWithText, m_EnableLibWithText ) );
|
|
|
|
|
2023-11-23 13:29:07 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableEeschemaPrintCairo,
|
2023-12-18 13:32:41 +00:00
|
|
|
&m_EnableEeschemaPrintCairo,
|
|
|
|
m_EnableEeschemaPrintCairo ) );
|
2023-06-12 18:12:39 +00:00
|
|
|
|
2023-12-17 21:43:35 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::PcbSelectionVisibilityRatio,
|
|
|
|
&m_PcbSelectionVisibilityRatio,
|
|
|
|
m_PcbSelectionVisibilityRatio, 0.0, 1.0 ) );
|
|
|
|
|
2024-06-18 04:47:06 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::FontErrorSize,
|
|
|
|
&m_FontErrorSize,
|
|
|
|
m_FontErrorSize, 0.01, 100 ) );
|
2024-01-12 02:26:42 +00:00
|
|
|
|
2024-02-29 19:04:39 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::OcePluginLinearDeflection,
|
|
|
|
&m_OcePluginLinearDeflection,
|
|
|
|
m_OcePluginLinearDeflection, 0.01, 1.0 ) );
|
|
|
|
|
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::OcePluginAngularDeflection,
|
|
|
|
&m_OcePluginAngularDeflection,
|
|
|
|
m_OcePluginAngularDeflection, 0.01, 360.0 ) );
|
|
|
|
|
2024-03-20 22:47:44 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::TriangulateSimplificationLevel,
|
|
|
|
&m_TriangulateSimplificationLevel,
|
|
|
|
m_TriangulateSimplificationLevel, 0, 1000 ) );
|
|
|
|
|
2024-03-21 01:00:42 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::TriangulateMinimumArea,
|
|
|
|
&m_TriangulateMinimumArea,
|
|
|
|
m_TriangulateMinimumArea, 0, 100000 ) );
|
|
|
|
|
2024-03-25 23:50:26 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableCacheFriendlyFracture,
|
|
|
|
&m_EnableCacheFriendlyFracture,
|
|
|
|
m_EnableCacheFriendlyFracture ) );
|
|
|
|
|
2024-05-09 22:28:38 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::MaxFileSystemWatchers,
|
|
|
|
&m_MaxFilesystemWatchers, m_MaxFilesystemWatchers,
|
|
|
|
0, 2147483647 ) );
|
|
|
|
|
2024-06-03 18:56:37 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::MinorSchematicGraphSize,
|
|
|
|
&m_MinorSchematicGraphSize, m_MinorSchematicGraphSize,
|
|
|
|
0, 2147483647 ) );
|
|
|
|
|
2021-10-08 01:04:51 +00:00
|
|
|
// Special case for trace mask setting...we just grab them and set them immediately
|
|
|
|
// Because we even use wxLogTrace inside of advanced config
|
2023-01-22 14:41:33 +00:00
|
|
|
wxString traceMasks;
|
2023-12-18 13:32:41 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_WXSTRING( true, AC_KEYS::TraceMasks, &traceMasks,
|
|
|
|
wxS( "" ) ) );
|
2021-10-08 01:04:51 +00:00
|
|
|
|
|
|
|
// Load the config from file
|
2018-12-10 10:56:28 +00:00
|
|
|
wxConfigLoadSetups( &aCfg, configParams );
|
|
|
|
|
2021-10-08 01:04:51 +00:00
|
|
|
// Now actually set the trace masks
|
2023-01-22 14:41:33 +00:00
|
|
|
wxStringTokenizer traceMaskTokenizer( traceMasks, wxS( "," ) );
|
2021-12-09 23:36:44 +00:00
|
|
|
|
2021-10-08 01:04:51 +00:00
|
|
|
while( traceMaskTokenizer.HasMoreTokens() )
|
|
|
|
{
|
|
|
|
wxString mask = traceMaskTokenizer.GetNextToken();
|
|
|
|
wxLog::AddTraceMask( mask );
|
|
|
|
}
|
|
|
|
|
2021-03-28 12:37:54 +00:00
|
|
|
dumpCfg( configParams );
|
|
|
|
|
2020-09-03 14:58:49 +00:00
|
|
|
for( PARAM_CFG* param : configParams )
|
2020-02-28 03:58:33 +00:00
|
|
|
delete param;
|
2024-02-02 11:00:08 +00:00
|
|
|
|
|
|
|
wxLogTrace( kicadTraceCoroutineStack, wxT( "Using coroutine stack size %d" ), m_CoroutineStackSize );
|
2018-12-12 14:16:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|