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>
|
|
|
|
|
|
|
|
#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.
|
|
|
|
*
|
|
|
|
* Set these options in the file `kicad_advanced` in the
|
|
|
|
* KiCad config directory.
|
|
|
|
*/
|
|
|
|
namespace AC_KEYS
|
|
|
|
{
|
2020-07-26 14:20:24 +00:00
|
|
|
|
2023-04-08 15:22:34 +00:00
|
|
|
/**
|
|
|
|
* Should the schematic use the new incremental connectivity algorithm
|
|
|
|
*/
|
|
|
|
static const wxChar IncrementalConnectivity[] = wxT( "IncrementalConnectivity" );
|
|
|
|
|
2023-04-07 17:08:43 +00:00
|
|
|
/**
|
|
|
|
* Decide whether to attempt usage of the 3DConnexion mouse
|
|
|
|
*/
|
|
|
|
static const wxChar Use3DConnexionDriver[] = wxT( "3DConnexionDriver" );
|
|
|
|
|
2020-01-06 17:11:01 +00:00
|
|
|
/**
|
2020-07-26 14:20:24 +00:00
|
|
|
* When filling zones, we add an extra amount of clearance to each zone to ensure that rounding
|
|
|
|
* errors do not overrun minimum clearance distances. This is the extra in mm.
|
2020-01-06 17:11:01 +00:00
|
|
|
*/
|
2020-07-26 14:20:24 +00:00
|
|
|
static const wxChar ExtraFillMargin[] = wxT( "ExtraFillMargin" );
|
2018-12-12 12:26:03 +00:00
|
|
|
|
2020-09-02 22:15:30 +00:00
|
|
|
/**
|
|
|
|
* A fudge factor for DRC. Required to prevent false positives due to rounding errors, errors
|
|
|
|
* in polygonalization, etc.
|
|
|
|
* Previous versions hard-coded various values from 0.000005mm to 0.002mm.
|
|
|
|
*/
|
|
|
|
static const wxChar DRCEpsilon[] = wxT( "DRCEpsilon" );
|
|
|
|
|
2021-08-11 13:01:30 +00:00
|
|
|
/**
|
|
|
|
* Angle and width tolerances for copper and solder mask sliver detection.
|
|
|
|
*/
|
|
|
|
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
|
|
|
/**
|
|
|
|
* Used to calculate the actual hole size from the finish hole size.
|
2020-09-08 19:18:50 +00:00
|
|
|
* IPC-6012 says 0.015-0.018mm; Cadence says at least 0.020mm for a Class 2 board and at least
|
|
|
|
* 0.025mm for Class 3.
|
2020-09-03 14:58:49 +00:00
|
|
|
*/
|
|
|
|
static const wxChar HoleWallThickness[] = wxT( "HoleWallPlatingThickness" );
|
|
|
|
|
2019-08-15 04:25:05 +00:00
|
|
|
/**
|
|
|
|
* Configure the coroutine stack size in bytes. This should be allocated in multiples of
|
|
|
|
* the system page size (n*4096 is generally safe)
|
|
|
|
*/
|
|
|
|
static const wxChar CoroutineStackSize[] = wxT( "CoroutineStackSize" );
|
|
|
|
|
2020-07-03 23:33:36 +00:00
|
|
|
/**
|
|
|
|
* Show PNS router debug graphics while routing
|
|
|
|
*/
|
|
|
|
static const wxChar ShowRouterDebugGraphics[] = wxT( "ShowRouterDebugGraphics" );
|
|
|
|
|
2023-08-07 15:44:33 +00:00
|
|
|
/**
|
|
|
|
* Enable PNS router to dump state information for debug purpose (press `0` while routing)
|
|
|
|
*/
|
|
|
|
static const wxChar EnableRouterDump[] = wxT( "EnableRouterDump" );
|
|
|
|
|
2023-06-20 13:15:56 +00:00
|
|
|
/**
|
|
|
|
* Slide the zoom steps over for debugging things "up close".
|
|
|
|
*/
|
|
|
|
static const wxChar HyperZoom[] = wxT( "HyperZoom" );
|
|
|
|
|
2020-07-25 21:53:58 +00:00
|
|
|
/**
|
|
|
|
* When set to true, this will wrap polygon point sets at 4 points per line rather
|
|
|
|
* than a single point per line. Single point per line helps with version control systems
|
|
|
|
*/
|
|
|
|
static const wxChar CompactFileSave[] = wxT( "CompactSave" );
|
|
|
|
|
2020-08-09 23:03:31 +00:00
|
|
|
/**
|
|
|
|
* For drawsegments - arcs.
|
|
|
|
* Distance from an arc end point and the estimated end point,
|
|
|
|
* when rotating from the start point to the end point.
|
|
|
|
* 0 will not allow any approximate result, and the arc will not show.
|
|
|
|
* Squared value for performances, in system unit.
|
|
|
|
*/
|
|
|
|
static const wxChar DrawArcAccuracy[] = wxT( "DrawArcAccuracy" );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* For drawsegments - arcs.
|
|
|
|
* When drawing an arc, the angle ( center - start ) - ( start - end ),
|
|
|
|
* can be limited to avoid extremely high radii.
|
|
|
|
* The value is the tan( angle )
|
|
|
|
*/
|
|
|
|
static const wxChar DrawArcCenterStartEndMaxAngle[] = wxT( "DrawArcCenterStartEndMaxAngle" );
|
|
|
|
|
2021-03-31 20:13:08 +00:00
|
|
|
/**
|
|
|
|
* For arc track interactive drag-resizing
|
|
|
|
* Maximum angle between the tangent line of an arc track and a connected straight track
|
|
|
|
* in order to commence arc dragging. Units are degrees.
|
|
|
|
*/
|
|
|
|
static const wxChar MaxTangentTrackAngleDeviation[] = wxT( "MaxTangentTrackAngleDeviation" );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* For arc track interactive drag-resizing
|
|
|
|
* Maximum track length to keep after doing an arc track resizing operation. Units are mm.
|
|
|
|
*/
|
|
|
|
static const wxChar MaxTrackLengthToKeep[] = wxT( "MaxTrackLengthToKeep" );
|
|
|
|
|
2020-08-12 13:16:57 +00:00
|
|
|
/**
|
|
|
|
* When true, GAL will stroke the triangulations (only used in OpenGL) with a visible color
|
|
|
|
*/
|
|
|
|
static const wxChar StrokeTriangulation[] = wxT( "StrokeTriangulation" );
|
|
|
|
|
2021-07-26 17:56:11 +00:00
|
|
|
/**
|
|
|
|
* When true, a third zone-display-mode is included which strokes the filled areas and fracture
|
|
|
|
* boundaries.
|
|
|
|
*/
|
|
|
|
static const wxChar ExtraZoneDisplayModes[] = wxT( "ExtraZoneDisplayModes" );
|
|
|
|
|
2020-09-08 19:18:50 +00:00
|
|
|
/**
|
|
|
|
* Absolute minimum pen width to send to the plotter. PDF seems happy enough with 0.0212mm
|
|
|
|
* (which equates to 1px @ 1200dpi).
|
|
|
|
*/
|
|
|
|
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
|
|
|
/**
|
|
|
|
* The diameter of the drill marks on print and plot outputs (in mm),
|
|
|
|
* when the "Drill marks" option is set to "Small mark"
|
|
|
|
*/
|
|
|
|
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-01-04 22:26:23 +00:00
|
|
|
|
2021-07-11 04:35:38 +00:00
|
|
|
static const wxChar Skip3DModelFileCache[] = wxT( "Skip3DModelFileCache" );
|
2021-07-11 03:59:54 +00:00
|
|
|
|
2021-07-11 04:35:38 +00:00
|
|
|
static const wxChar Skip3DModelMemoryCache[] = wxT( "Skip3DModelMemoryCache" );
|
2021-07-11 04:31:06 +00:00
|
|
|
|
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-01-08 15:56:41 +00:00
|
|
|
|
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-09-24 23:33:05 +00:00
|
|
|
|
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" );
|
|
|
|
|
2023-11-23 13:29:07 +00:00
|
|
|
static const wxChar EnableEeschemaPrintCairo[] = wxT( "EnableEeschemaPrintCairo" );
|
|
|
|
|
2023-06-12 18:12:39 +00:00
|
|
|
static const wxChar Enable2581[] = wxT( "Enable2581" );
|
|
|
|
|
2023-09-24 23:33:05 +00:00
|
|
|
/**
|
|
|
|
* The time in milliseconds to wait before displaying a disambiguation menu.
|
|
|
|
*/
|
|
|
|
static const wxChar DisambiguationTime[] = wxT( "DisambiguationTime" );
|
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;
|
2023-11-23 13:29:07 +00:00
|
|
|
m_EnableEeschemaPrintCairo = false;
|
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-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
|
|
|
|
2023-04-08 15:22:34 +00:00
|
|
|
m_IncrementalConnectivity = false;
|
2022-10-19 23:25:45 +00:00
|
|
|
|
2023-09-24 23:33:05 +00:00
|
|
|
m_DisambiguationMenuDelay = 500;
|
|
|
|
|
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-01-22 14:41:33 +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,
|
2022-01-28 21:31:16 +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,
|
2022-01-28 21:31:16 +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,
|
|
|
|
&m_SliverMinimumLength, m_SliverMinimumLength, 1e-9, 10 ) );
|
|
|
|
|
2021-08-11 13:01:30 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DRCSliverAngleTolerance,
|
2022-01-28 21:31:16 +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,
|
2022-01-28 21:31:16 +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,
|
2022-01-28 21:31:16 +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,
|
2022-01-28 21:31:16 +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,
|
2022-01-28 21:31:16 +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,
|
2022-01-28 21:31:16 +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,
|
2022-01-28 21:31:16 +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,
|
2022-01-28 21:31:16 +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,
|
2022-01-28 21:31:16 +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,
|
2022-01-28 21:31:16 +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,
|
2022-01-28 21:31:16 +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,
|
2022-01-28 21:31:16 +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,
|
2022-01-28 21:31:16 +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,
|
2022-01-28 21:31:16 +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,
|
|
|
|
&m_3DRT_BevelExtentFactor, m_3DRT_BevelExtentFactor,
|
|
|
|
0.0, 100.0,
|
|
|
|
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,
|
|
|
|
&m_IncrementalConnectivity, m_IncrementalConnectivity ) );
|
|
|
|
|
2023-09-24 23:33:05 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::DisambiguationTime,
|
|
|
|
&m_DisambiguationMenuDelay, m_DisambiguationMenuDelay,
|
|
|
|
50, 10000 ) );
|
|
|
|
|
2023-10-07 16:18:21 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableGenerators,
|
|
|
|
&m_EnableGenerators, m_EnableGenerators ) );
|
|
|
|
|
2023-09-14 21:39:42 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableGit,
|
|
|
|
&m_EnableGit, m_EnableGit ) );
|
|
|
|
|
2023-11-23 13:29:07 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableEeschemaPrintCairo,
|
|
|
|
&m_EnableEeschemaPrintCairo, m_EnableEeschemaPrintCairo ) );
|
2022-05-15 08:38:46 +00:00
|
|
|
|
2023-06-12 18:12:39 +00:00
|
|
|
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::Enable2581,
|
|
|
|
&m_Enable2581, m_Enable2581 ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
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;
|
2018-12-12 14:16:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|