You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

586 lines
27 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, you may find one here:
  18. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  19. * or you may search the http://www.gnu.org website for the version 2 license,
  20. * or you may write to the Free Software Foundation, Inc.,
  21. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  22. */
  23. #include <advanced_config.h>
  24. #include <trace_helpers.h>
  25. #include <config_params.h>
  26. #include <paths.h>
  27. #include <wx/app.h>
  28. #include <wx/config.h>
  29. #include <wx/filename.h>
  30. #include <wx/log.h>
  31. #include <wx/tokenzr.h>
  32. /*
  33. * Flag to enable advanced config debugging
  34. *
  35. * Use "KICAD_ADVANCED_CONFIG" to enable.
  36. *
  37. * @ingroup trace_env_vars
  38. */
  39. static const wxChar AdvancedConfigMask[] = wxT( "KICAD_ADVANCED_CONFIG" );
  40. /**
  41. * Limits and default settings for the coroutine stack size allowed.
  42. * Warning! Setting the stack size below the default may lead to unexplained crashes
  43. * This configuration setting is intended for developers only.
  44. */
  45. namespace AC_STACK
  46. {
  47. static constexpr int min_stack = 32 * 4096;
  48. static constexpr int default_stack = 256 * 4096;
  49. static constexpr int max_stack = 4096 * 4096;
  50. }
  51. /**
  52. * List of known keys for advanced configuration options.
  53. *
  54. * Set these options in the file `kicad_advanced` in the KiCad configuration directory.
  55. */
  56. namespace AC_KEYS
  57. {
  58. static const wxChar IncrementalConnectivity[] = wxT( "IncrementalConnectivity" );
  59. static const wxChar Use3DConnexionDriver[] = wxT( "3DConnexionDriver" );
  60. static const wxChar ExtraFillMargin[] = wxT( "ExtraFillMargin" );
  61. static const wxChar DRCEpsilon[] = wxT( "DRCEpsilon" );
  62. static const wxChar DRCSliverWidthTolerance[] = wxT( "DRCSliverWidthTolerance" );
  63. static const wxChar DRCSliverMinimumLength[] = wxT( "DRCSliverMinimumLength" );
  64. static const wxChar DRCSliverAngleTolerance[] = wxT( "DRCSliverAngleTolerance" );
  65. static const wxChar HoleWallThickness[] = wxT( "HoleWallPlatingThickness" );
  66. static const wxChar CoroutineStackSize[] = wxT( "CoroutineStackSize" );
  67. static const wxChar ShowRouterDebugGraphics[] = wxT( "ShowRouterDebugGraphics" );
  68. static const wxChar EnableRouterDump[] = wxT( "EnableRouterDump" );
  69. static const wxChar EnableMultichannelTool[] = wxT( "EnableMultichannelTool" );
  70. static const wxChar HyperZoom[] = wxT( "HyperZoom" );
  71. static const wxChar CompactFileSave[] = wxT( "CompactSave" );
  72. static const wxChar DrawArcAccuracy[] = wxT( "DrawArcAccuracy" );
  73. static const wxChar DrawArcCenterStartEndMaxAngle[] = wxT( "DrawArcCenterStartEndMaxAngle" );
  74. static const wxChar MaxTangentTrackAngleDeviation[] = wxT( "MaxTangentTrackAngleDeviation" );
  75. static const wxChar MaxTrackLengthToKeep[] = wxT( "MaxTrackLengthToKeep" );
  76. static const wxChar StrokeTriangulation[] = wxT( "StrokeTriangulation" );
  77. static const wxChar ExtraZoneDisplayModes[] = wxT( "ExtraZoneDisplayModes" );
  78. static const wxChar MinPlotPenWidth[] = wxT( "MinPlotPenWidth" );
  79. static const wxChar DebugZoneFiller[] = wxT( "DebugZoneFiller" );
  80. static const wxChar DebugPDFWriter[] = wxT( "DebugPDFWriter" );
  81. static const wxChar SmallDrillMarkSize[] = wxT( "SmallDrillMarkSize" );
  82. static const wxChar HotkeysDumper[] = wxT( "HotkeysDumper" );
  83. static const wxChar DrawBoundingBoxes[] = wxT( "DrawBoundingBoxes" );
  84. static const wxChar ShowPcbnewExportNetlist[] = wxT( "ShowPcbnewExportNetlist" );
  85. static const wxChar Skip3DModelFileCache[] = wxT( "Skip3DModelFileCache" );
  86. static const wxChar Skip3DModelMemoryCache[] = wxT( "Skip3DModelMemoryCache" );
  87. static const wxChar HideVersionFromTitle[] = wxT( "HideVersionFromTitle" );
  88. static const wxChar TraceMasks[] = wxT( "TraceMasks" );
  89. static const wxChar ShowRepairSchematic[] = wxT( "ShowRepairSchematic" );
  90. static const wxChar ShowEventCounters[] = wxT( "ShowEventCounters" );
  91. static const wxChar AllowManualCanvasScale[] = wxT( "AllowManualCanvasScale" );
  92. static const wxChar UpdateUIEventInterval[] = wxT( "UpdateUIEventInterval" );
  93. static const wxChar V3DRT_BevelHeight_um[] = wxT( "V3DRT_BevelHeight_um" );
  94. static const wxChar V3DRT_BevelExtentFactor[] = wxT( "V3DRT_BevelExtentFactor" );
  95. static const wxChar UseClipper2[] = wxT( "UseClipper2" );
  96. static const wxChar EnableDesignBlocks[] = wxT( "EnableDesignBlocks" );
  97. static const wxChar EnableGenerators[] = wxT( "EnableGenerators" );
  98. static const wxChar EnableGit[] = wxT( "EnableGit" );
  99. static const wxChar EnableLibWithText[] = wxT( "EnableLibWithText" );
  100. static const wxChar EnableLibDir[] = wxT( "EnableLibDir" );
  101. static const wxChar EnableEeschemaPrintCairo[] = wxT( "EnableEeschemaPrintCairo" );
  102. static const wxChar DisambiguationTime[] = wxT( "DisambiguationTime" );
  103. static const wxChar PcbSelectionVisibilityRatio[] = wxT( "PcbSelectionVisibilityRatio" );
  104. static const wxChar FontErrorSize[] = wxT( "FontErrorSize" );
  105. static const wxChar OcePluginLinearDeflection[] = wxT( "OcePluginLinearDeflection" );
  106. static const wxChar OcePluginAngularDeflection[] = wxT( "OcePluginAngularDeflection" );
  107. static const wxChar TriangulateSimplificationLevel[] = wxT( "TriangulateSimplificationLevel" );
  108. static const wxChar TriangulateMinimumArea[] = wxT( "TriangulateMinimumArea" );
  109. static const wxChar EnableCacheFriendlyFracture[] = wxT( "EnableCacheFriendlyFracture" );
  110. static const wxChar EnableAPILogging[] = wxT( "EnableAPILogging" );
  111. static const wxChar MaxFileSystemWatchers[] = wxT( "MaxFileSystemWatchers" );
  112. static const wxChar MinorSchematicGraphSize[] = wxT( "MinorSchematicGraphSize" );
  113. static const wxChar ResolveTextRecursionDepth[] = wxT( "ResolveTextRecursionDepth" );
  114. static const wxChar EnableExtensionSnaps[] = wxT( "EnableExtensionSnaps" );
  115. static const wxChar ExtensionSnapTimeoutMs[] = wxT( "ExtensionSnapTimeoutMs" );
  116. static const wxChar ExtensionSnapActivateOnHover[] = wxT( "ExtensionSnapActivateOnHover" );
  117. static const wxChar EnableSnapAnchorsDebug[] = wxT( "EnableSnapAnchorsDebug" );
  118. static const wxChar EnableODB[] = wxT( "EnableODB" );
  119. static const wxChar EnableJobset[] = wxT( "EnableJobset" );
  120. } // namespace KEYS
  121. /**
  122. * List of known groups for advanced configuration options.
  123. *
  124. */
  125. namespace AC_GROUPS
  126. {
  127. static const wxChar V3D_RayTracing[] = wxT( "G_3DV_RayTracing" );
  128. }
  129. /*
  130. * Get a simple string for common parameters.
  131. *
  132. * This isn't exhaustive, but it covers most common types that might be
  133. * used in the advance config
  134. */
  135. wxString dumpParamCfg( const PARAM_CFG& aParam )
  136. {
  137. wxString s = aParam.m_Ident + wxS( ": " );
  138. /*
  139. * This implementation is rather simplistic, but it is
  140. * effective enough for simple uses. A better implementation would be
  141. * some kind of visitor, but that's somewhat more work.
  142. */
  143. switch( aParam.m_Type )
  144. {
  145. case paramcfg_id::PARAM_INT:
  146. case paramcfg_id::PARAM_INT_WITH_SCALE:
  147. s << *static_cast<const PARAM_CFG_INT&>( aParam ).m_Pt_param;
  148. break;
  149. case paramcfg_id::PARAM_DOUBLE:
  150. s << *static_cast<const PARAM_CFG_DOUBLE&>( aParam ).m_Pt_param;
  151. break;
  152. case paramcfg_id::PARAM_WXSTRING:
  153. s << *static_cast<const PARAM_CFG_WXSTRING&>( aParam ).m_Pt_param;
  154. break;
  155. case paramcfg_id::PARAM_FILENAME:
  156. s << *static_cast<const PARAM_CFG_FILENAME&>( aParam ).m_Pt_param;
  157. break;
  158. case paramcfg_id::PARAM_BOOL:
  159. s << ( *static_cast<const PARAM_CFG_BOOL&>( aParam ).m_Pt_param ? wxS( "true" ) : wxS( "false" ) );
  160. break;
  161. default: s << wxS( "Unsupported PARAM_CFG variant: " ) << aParam.m_Type;
  162. }
  163. return s;
  164. }
  165. /**
  166. * Dump the configs in the given array to trace.
  167. */
  168. static void dumpCfg( const std::vector<PARAM_CFG*>& aArray )
  169. {
  170. // only dump if we need to
  171. if( !wxLog::IsAllowedTraceMask( AdvancedConfigMask ) )
  172. return;
  173. for( const PARAM_CFG* param : aArray )
  174. {
  175. wxLogTrace( AdvancedConfigMask, dumpParamCfg( *param ) );
  176. }
  177. }
  178. /**
  179. * Get the filename for the advanced config file
  180. *
  181. * The user must check the file exists if they care.
  182. */
  183. static wxFileName getAdvancedCfgFilename()
  184. {
  185. const static wxString cfg_filename{ wxS( "kicad_advanced" ) };
  186. return wxFileName( PATHS::GetUserSettingsPath(), cfg_filename );
  187. }
  188. ADVANCED_CFG::ADVANCED_CFG()
  189. {
  190. wxLogTrace( AdvancedConfigMask, wxS( "Init advanced config" ) );
  191. // Init defaults - this is done in case the config doesn't exist,
  192. // then the values will remain as set here.
  193. m_CoroutineStackSize = AC_STACK::default_stack;
  194. m_ShowRouterDebugGraphics = false;
  195. m_EnableRouterDump = false;
  196. m_EnableMultichannelTool = false;
  197. m_HyperZoom = false;
  198. m_DrawArcAccuracy = 10.0;
  199. m_DrawArcCenterMaxAngle = 50.0;
  200. m_MaxTangentAngleDeviation = 1.0;
  201. m_MaxTrackLengthToKeep = 0.0005;
  202. m_ExtraZoneDisplayModes = false;
  203. m_DrawTriangulationOutlines = false;
  204. m_ExtraClearance = 0.0005;
  205. m_DRCEpsilon = 0.0005; // 0.5um is small enough not to materially violate
  206. // any constraints.
  207. m_SliverWidthTolerance = 0.08;
  208. m_SliverMinimumLength = 0.0008;
  209. m_SliverAngleTolerance = 20.0;
  210. m_HoleWallThickness = 0.020; // IPC-6012 says 15-18um; Cadence says at least
  211. // 0.020 for a Class 2 board and at least 0.025
  212. // for Class 3.
  213. m_MinPlotPenWidth = 0.0212; // 1 pixel at 1200dpi.
  214. m_DebugZoneFiller = false;
  215. m_DebugPDFWriter = false;
  216. m_SmallDrillMarkSize = 0.35;
  217. m_HotkeysDumper = false;
  218. m_DrawBoundingBoxes = false;
  219. m_ShowPcbnewExportNetlist = false;
  220. m_Skip3DModelFileCache = false;
  221. m_Skip3DModelMemoryCache = false;
  222. m_HideVersionFromTitle = false;
  223. m_ShowEventCounters = false;
  224. m_AllowManualCanvasScale = false;
  225. m_CompactSave = false;
  226. m_UpdateUIEventInterval = 0;
  227. m_ShowRepairSchematic = false;
  228. m_EnableDesignBlocks = false;
  229. m_EnableGenerators = false;
  230. m_EnableGit = false;
  231. m_EnableJobset = false;
  232. m_EnableLibWithText = false;
  233. m_EnableLibDir = false;
  234. m_EnableEeschemaPrintCairo = true;
  235. m_3DRT_BevelHeight_um = 30;
  236. m_3DRT_BevelExtentFactor = 1.0 / 16.0;
  237. m_UseClipper2 = true;
  238. m_EnableAPILogging = false;
  239. m_Use3DConnexionDriver = true;
  240. m_IncrementalConnectivity = true;
  241. m_DisambiguationMenuDelay = 500;
  242. m_PcbSelectionVisibilityRatio = 1.0;
  243. m_FontErrorSize = 2;
  244. m_OcePluginLinearDeflection = 0.14;
  245. m_OcePluginAngularDeflection = 30;
  246. m_TriangulateSimplificationLevel = 50;
  247. m_TriangulateMinimumArea = 1000;
  248. m_EnableCacheFriendlyFracture = true;
  249. m_MaxFilesystemWatchers = 16384;
  250. m_MinorSchematicGraphSize = 10000;
  251. m_ResolveTextRecursionDepth = 3;
  252. m_EnableExtensionSnaps = true;
  253. m_ExtensionSnapTimeoutMs = 500;
  254. m_ExtensionSnapActivateOnHover = true;
  255. m_EnableSnapAnchorsDebug = false;
  256. loadFromConfigFile();
  257. }
  258. const ADVANCED_CFG& ADVANCED_CFG::GetCfg()
  259. {
  260. static ADVANCED_CFG instance;
  261. return instance;
  262. }
  263. void ADVANCED_CFG::loadFromConfigFile()
  264. {
  265. const wxFileName k_advanced = getAdvancedCfgFilename();
  266. // If we are running headless, use the class defaults because we cannot instantiate wxConfig
  267. if( !wxTheApp )
  268. return;
  269. if( !k_advanced.FileExists() )
  270. {
  271. wxLogTrace( AdvancedConfigMask, wxS( "File does not exist %s" ), k_advanced.GetFullPath() );
  272. // load the defaults
  273. wxConfig emptyConfig;
  274. loadSettings( emptyConfig );
  275. return;
  276. }
  277. wxLogTrace( AdvancedConfigMask, wxS( "Loading advanced config from: %s" ),
  278. k_advanced.GetFullPath() );
  279. wxFileConfig file_cfg( wxS( "" ), wxS( "" ), k_advanced.GetFullPath() );
  280. loadSettings( file_cfg );
  281. }
  282. void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
  283. {
  284. std::vector<PARAM_CFG*> configParams;
  285. configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::ExtraFillMargin,
  286. &m_ExtraClearance,
  287. m_ExtraClearance, 0.0, 1.0 ) );
  288. configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DRCEpsilon,
  289. &m_DRCEpsilon, m_DRCEpsilon, 0.0, 1.0 ) );
  290. configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DRCSliverWidthTolerance,
  291. &m_SliverWidthTolerance, m_SliverWidthTolerance,
  292. 0.01, 0.25 ) );
  293. configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DRCSliverMinimumLength,
  294. &m_SliverMinimumLength, m_SliverMinimumLength,
  295. 1e-9, 10 ) );
  296. configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DRCSliverAngleTolerance,
  297. &m_SliverAngleTolerance, m_SliverAngleTolerance,
  298. 1.0, 90.0 ) );
  299. configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::HoleWallThickness,
  300. &m_HoleWallThickness, m_HoleWallThickness,
  301. 0.0, 1.0 ) );
  302. configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::CoroutineStackSize,
  303. &m_CoroutineStackSize, AC_STACK::default_stack,
  304. AC_STACK::min_stack, AC_STACK::max_stack ) );
  305. configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::UpdateUIEventInterval,
  306. &m_UpdateUIEventInterval, m_UpdateUIEventInterval,
  307. -1, 100000 ) );
  308. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ShowRouterDebugGraphics,
  309. &m_ShowRouterDebugGraphics,
  310. m_ShowRouterDebugGraphics ) );
  311. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableMultichannelTool,
  312. &m_EnableMultichannelTool, m_EnableMultichannelTool ) );
  313. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableRouterDump,
  314. &m_EnableRouterDump, m_EnableRouterDump ) );
  315. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::HyperZoom,
  316. &m_HyperZoom, m_HyperZoom ) );
  317. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::CompactFileSave,
  318. &m_CompactSave, m_CompactSave ) );
  319. configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DrawArcAccuracy,
  320. &m_DrawArcAccuracy, m_DrawArcAccuracy,
  321. 0.0, 100000.0 ) );
  322. configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DrawArcCenterStartEndMaxAngle,
  323. &m_DrawArcCenterMaxAngle,
  324. m_DrawArcCenterMaxAngle, 0.0, 100000.0 ) );
  325. configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::MaxTangentTrackAngleDeviation,
  326. &m_MaxTangentAngleDeviation,
  327. m_MaxTangentAngleDeviation, 0.0, 90.0 ) );
  328. configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::MaxTrackLengthToKeep,
  329. &m_MaxTrackLengthToKeep, m_MaxTrackLengthToKeep,
  330. 0.0, 1.0 ) );
  331. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ExtraZoneDisplayModes,
  332. &m_ExtraZoneDisplayModes,
  333. m_ExtraZoneDisplayModes ) );
  334. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::StrokeTriangulation,
  335. &m_DrawTriangulationOutlines,
  336. m_DrawTriangulationOutlines ) );
  337. configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::MinPlotPenWidth,
  338. &m_MinPlotPenWidth, m_MinPlotPenWidth,
  339. 0.0, 1.0 ) );
  340. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::DebugZoneFiller,
  341. &m_DebugZoneFiller, m_DebugZoneFiller ) );
  342. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::DebugPDFWriter,
  343. &m_DebugPDFWriter, m_DebugPDFWriter ) );
  344. configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::SmallDrillMarkSize,
  345. &m_SmallDrillMarkSize, m_SmallDrillMarkSize,
  346. 0.0, 3.0 ) );
  347. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::HotkeysDumper,
  348. &m_HotkeysDumper, m_HotkeysDumper ) );
  349. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::DrawBoundingBoxes,
  350. &m_DrawBoundingBoxes, m_DrawBoundingBoxes ) );
  351. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ShowPcbnewExportNetlist,
  352. &m_ShowPcbnewExportNetlist,
  353. m_ShowPcbnewExportNetlist ) );
  354. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::Skip3DModelFileCache,
  355. &m_Skip3DModelFileCache, m_Skip3DModelFileCache ) );
  356. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::Skip3DModelMemoryCache,
  357. &m_Skip3DModelMemoryCache, m_Skip3DModelMemoryCache ) );
  358. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::HideVersionFromTitle,
  359. &m_HideVersionFromTitle, m_HideVersionFromTitle ) );
  360. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ShowRepairSchematic,
  361. &m_ShowRepairSchematic, m_ShowRepairSchematic ) );
  362. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ShowEventCounters,
  363. &m_ShowEventCounters, m_ShowEventCounters ) );
  364. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::AllowManualCanvasScale,
  365. &m_AllowManualCanvasScale,
  366. m_AllowManualCanvasScale ) );
  367. configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::V3DRT_BevelHeight_um,
  368. &m_3DRT_BevelHeight_um, m_3DRT_BevelHeight_um,
  369. 0, std::numeric_limits<int>::max(),
  370. AC_GROUPS::V3D_RayTracing ) );
  371. configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::V3DRT_BevelExtentFactor,
  372. &m_3DRT_BevelExtentFactor,
  373. m_3DRT_BevelExtentFactor, 0.0, 100.0,
  374. AC_GROUPS::V3D_RayTracing ) );
  375. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::UseClipper2,
  376. &m_UseClipper2, m_UseClipper2 ) );
  377. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::Use3DConnexionDriver,
  378. &m_Use3DConnexionDriver, m_Use3DConnexionDriver ) );
  379. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::IncrementalConnectivity,
  380. &m_IncrementalConnectivity,
  381. m_IncrementalConnectivity ) );
  382. configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::DisambiguationTime,
  383. &m_DisambiguationMenuDelay,
  384. m_DisambiguationMenuDelay,
  385. 50, 10000 ) );
  386. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableDesignBlocks,
  387. &m_EnableDesignBlocks, m_EnableDesignBlocks ) );
  388. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableGenerators,
  389. &m_EnableGenerators, m_EnableGenerators ) );
  390. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableAPILogging,
  391. &m_EnableAPILogging, m_EnableAPILogging ) );
  392. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableGit,
  393. &m_EnableGit, m_EnableGit ) );
  394. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableJobset,
  395. &m_EnableJobset, m_EnableJobset ) );
  396. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableLibWithText,
  397. &m_EnableLibWithText, m_EnableLibWithText ) );
  398. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableLibDir,
  399. &m_EnableLibDir, m_EnableLibDir ) );
  400. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableEeschemaPrintCairo,
  401. &m_EnableEeschemaPrintCairo,
  402. m_EnableEeschemaPrintCairo ) );
  403. configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::PcbSelectionVisibilityRatio,
  404. &m_PcbSelectionVisibilityRatio,
  405. m_PcbSelectionVisibilityRatio, 0.0, 1.0 ) );
  406. configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::FontErrorSize,
  407. &m_FontErrorSize,
  408. m_FontErrorSize, 0.01, 100 ) );
  409. configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::OcePluginLinearDeflection,
  410. &m_OcePluginLinearDeflection,
  411. m_OcePluginLinearDeflection, 0.01, 1.0 ) );
  412. configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::OcePluginAngularDeflection,
  413. &m_OcePluginAngularDeflection,
  414. m_OcePluginAngularDeflection, 0.01, 360.0 ) );
  415. configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::TriangulateSimplificationLevel,
  416. &m_TriangulateSimplificationLevel,
  417. m_TriangulateSimplificationLevel, 0, 1000 ) );
  418. configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::TriangulateMinimumArea,
  419. &m_TriangulateMinimumArea,
  420. m_TriangulateMinimumArea, 0, 100000 ) );
  421. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableCacheFriendlyFracture,
  422. &m_EnableCacheFriendlyFracture,
  423. m_EnableCacheFriendlyFracture ) );
  424. configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::MaxFileSystemWatchers,
  425. &m_MaxFilesystemWatchers, m_MaxFilesystemWatchers,
  426. 0, 2147483647 ) );
  427. configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::MinorSchematicGraphSize,
  428. &m_MinorSchematicGraphSize, m_MinorSchematicGraphSize,
  429. 0, 2147483647 ) );
  430. configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::ResolveTextRecursionDepth,
  431. &m_ResolveTextRecursionDepth,
  432. m_ResolveTextRecursionDepth, 0, 10 ) );
  433. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableODB,
  434. &m_EnableODB, m_EnableODB ) );
  435. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableExtensionSnaps,
  436. &m_EnableExtensionSnaps,
  437. m_EnableExtensionSnaps ) );
  438. configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::ExtensionSnapTimeoutMs,
  439. &m_ExtensionSnapTimeoutMs,
  440. m_ExtensionSnapTimeoutMs, 0 ) );
  441. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ExtensionSnapActivateOnHover,
  442. &m_ExtensionSnapActivateOnHover,
  443. m_ExtensionSnapActivateOnHover ) );
  444. configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableSnapAnchorsDebug,
  445. &m_EnableSnapAnchorsDebug,
  446. m_EnableSnapAnchorsDebug ) );
  447. // Special case for trace mask setting...we just grab them and set them immediately
  448. // Because we even use wxLogTrace inside of advanced config
  449. wxString traceMasks;
  450. configParams.push_back( new PARAM_CFG_WXSTRING( true, AC_KEYS::TraceMasks, &traceMasks,
  451. wxS( "" ) ) );
  452. // Load the config from file
  453. wxConfigLoadSetups( &aCfg, configParams );
  454. // Now actually set the trace masks
  455. wxStringTokenizer traceMaskTokenizer( traceMasks, wxS( "," ) );
  456. while( traceMaskTokenizer.HasMoreTokens() )
  457. {
  458. wxString mask = traceMaskTokenizer.GetNextToken();
  459. wxLog::AddTraceMask( mask );
  460. }
  461. dumpCfg( configParams );
  462. for( PARAM_CFG* param : configParams )
  463. delete param;
  464. wxLogTrace( kicadTraceCoroutineStack, wxT( "Using coroutine stack size %d" ), m_CoroutineStackSize );
  465. }