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.

314 lines
9.0 KiB

  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. #ifndef ADVANCED_CFG__H
  24. #define ADVANCED_CFG__H
  25. #include <kicommon.h>
  26. class wxConfigBase;
  27. /**
  28. * @defgroup advanced_config Advanced Configuration Variables
  29. *
  30. * Class containing "advanced" configuration options.
  31. *
  32. * Options set here are for developer or advanced users only. If a general user
  33. * needs to set one of these for normal KiCad use, either:
  34. * * They are working around some bug that should be fixed, or
  35. * * The parameter they are setting is of general interest and should be in the
  36. * main application config, with UI provided.
  37. *
  38. * Options in this class are, in general, preferable to #defines, as they
  39. * allow more flexible configuration by developers, and don't hide code from
  40. * the compiler on other configurations, which can result in broken builds.
  41. *
  42. * Never use advanced configs in an untestable way. If a function depends on
  43. * advanced config such that you cannot test it without changing the config,
  44. * "lift" the config to a higher level and make pass it as parameter of the code
  45. * under test. The tests can pass their own values as needed.
  46. *
  47. * This also applies to code that does not depend on "common" - it cannot
  48. * use this class, so you must pass configuration in as proper parameters.
  49. *
  50. * Sometimes you can just use values directly, and sometimes helper functions
  51. * might be provided to allow extra logic (for example when a advanced config
  52. * applies only on certain platforms).
  53. *
  54. * For more information on what config keys set these parameters in the
  55. * config files, and why you might want to set them, see #AC_KEYS
  56. *
  57. */
  58. class KICOMMON_API ADVANCED_CFG
  59. {
  60. public:
  61. /**
  62. * Get the singleton instance's config, which is shared by all consumers.
  63. *
  64. * This configuration is read-only - to set options, users should add the parameters to
  65. * their config files at ~/.config/kicad/advanced, or the platform equivalent.
  66. */
  67. static const ADVANCED_CFG& GetCfg();
  68. ///@{
  69. /// \ingroup advanced_config
  70. /**
  71. * Distance from an arc end point and the estimated end point, when rotating from the
  72. * start point to the end point.
  73. */
  74. double m_DrawArcAccuracy;
  75. /**
  76. * When drawing an arc, the angle ( center - start ) - ( start - end ) can be limited to
  77. * avoid extremely high radii.
  78. */
  79. double m_DrawArcCenterMaxAngle;
  80. /**
  81. * Maximum angle between the tangent line of an arc track and a connected straight track
  82. * in order to commence arc dragging. Units are degrees.
  83. */
  84. double m_MaxTangentAngleDeviation;
  85. /**
  86. * Maximum track length to keep after doing an arc track resizing operation. Units are mm.
  87. */
  88. double m_MaxTrackLengthToKeep;
  89. /**
  90. * Extra fill clearance for zone fills. Note that for zone tests this is essentially
  91. * additive with m_DRCEpsilon. Units are mm.
  92. */
  93. double m_ExtraClearance;
  94. /**
  95. * Epsilon for DRC tests. Note that for zone tests this is essentially additive with
  96. * m_ExtraClearance. Units are mm.
  97. */
  98. double m_DRCEpsilon;
  99. /**
  100. * Sliver tolerances for DRC. Units are mm and deg.
  101. */
  102. double m_SliverWidthTolerance;
  103. double m_SliverMinimumLength;
  104. double m_SliverAngleTolerance;
  105. /**
  106. * Hole wall plating thickness. Used to determine actual hole size from finish hole size.
  107. * Units are mm.
  108. */
  109. double m_HoleWallThickness;
  110. /**
  111. * Set the stack size for coroutines
  112. */
  113. int m_CoroutineStackSize;
  114. /**
  115. * The update interval the wxWidgets sends wxUpdateUIEvents to windows.
  116. *
  117. * The default is 0. Setting this to -1 will disable all automatic UI events. Any other
  118. * value is the number of milliseconds between events.
  119. *
  120. * @see https://docs.wxwidgets.org/3.0/classwx_update_u_i_event.html#a24daac56f682b866baac592e761ccede.
  121. */
  122. int m_UpdateUIEventInterval;
  123. /**
  124. * Show PNS router debug graphics
  125. */
  126. bool m_ShowRouterDebugGraphics;
  127. /**
  128. * Enable PNS router to dump state information for debug purpose (press `0` while routing)
  129. */
  130. bool m_EnableRouterDump;
  131. /**
  132. * Slide the zoom steps over for debugging things "up close".
  133. */
  134. bool m_HyperZoom;
  135. /**
  136. * Save files in compact display mode
  137. * When is is not specified, points are written one per line
  138. */
  139. bool m_CompactSave;
  140. /**
  141. * When true, strokes the triangulations with visible color
  142. */
  143. bool m_DrawTriangulationOutlines;
  144. /**
  145. * When true, adds zone-display-modes for stroking the zone fracture boundaries and the zone
  146. * triangulation.
  147. */
  148. bool m_ExtraZoneDisplayModes;
  149. /**
  150. * Sets an absolute minimum pen width for plotting. Some formats (PDF, for example) don't
  151. * like ultra-thin lines. Units are mm.
  152. */
  153. double m_MinPlotPenWidth;
  154. /**
  155. * A mode that dumps the various stages of a F_Cu fill into In1_Cu through In9_Cu.
  156. */
  157. bool m_DebugZoneFiller;
  158. /**
  159. * A mode that writes PDFs without compression.
  160. */
  161. bool m_DebugPDFWriter;
  162. /**
  163. * The diameter of the drill marks on print and plot outputs (in mm),
  164. * when the "Drill marks" option is set to "Small mark"
  165. */
  166. double m_SmallDrillMarkSize;
  167. /**
  168. * Enable the hotkeys dumper feature, used for generating documentation
  169. */
  170. bool m_HotkeysDumper;
  171. /**
  172. * Draw GAL bounding boxes in painters
  173. */
  174. bool m_DrawBoundingBoxes;
  175. /**
  176. * Enable exporting board editor netlist to a file for troubleshooting purposes.
  177. */
  178. bool m_ShowPcbnewExportNetlist;
  179. /**
  180. * Skip reading/writing 3d model file caches
  181. * This does not prevent the models from being cached in memory meaning reopening the 3d viewer
  182. * in the same project session will not reload model data from disk again.
  183. */
  184. bool m_Skip3DModelFileCache;
  185. /**
  186. * Skip reading/writing 3d model memory caches
  187. * This ensures 3d models are always reloaded from disk even if we previously opened the 3d
  188. * viewer.
  189. */
  190. bool m_Skip3DModelMemoryCache;
  191. /**
  192. * Hides the build version from the KiCad manager frame title.
  193. * Useful for making screenshots/videos of KiCad without pinning to a specific version.
  194. */
  195. bool m_HideVersionFromTitle;
  196. bool m_ShowRepairSchematic;
  197. /**
  198. * Shows debugging event counters in various places.
  199. */
  200. bool m_ShowEventCounters;
  201. bool m_AllowManualCanvasScale;
  202. /**
  203. * Show the properties panel in applications that it hasn't been fully released for
  204. */
  205. bool m_ShowPropertiesPanel;
  206. /**
  207. * 3D-Viewer, Raytracing
  208. * Bevel height of layer items. Controls the start of curvature normal on the edge.
  209. * Value is in micrometer. Good values should be around or less than the copper thickness.
  210. */
  211. int m_3DRT_BevelHeight_um;
  212. /**
  213. * 3D-Viewer raytracing factor applied to Extent.z of the item layer.
  214. *
  215. * This is used on calculation of the bevel's height.
  216. */
  217. double m_3DRT_BevelExtentFactor;
  218. /**
  219. * Use Clipper2 instead of Clipper1
  220. */
  221. bool m_UseClipper2;
  222. /**
  223. * Use the 3DConnexion Driver
  224. */
  225. bool m_Use3DConnexionDriver;
  226. /**
  227. * Use the new incremental netlister for realtime jobs
  228. */
  229. bool m_IncrementalConnectivity;
  230. /**
  231. * The number of milliseconds to wait in a click before showing a disambiguation menu.
  232. */
  233. int m_DisambiguationMenuDelay;
  234. /**
  235. * When true, enable support for generators
  236. */
  237. bool m_EnableGenerators;
  238. /**
  239. * When true, enable git integration
  240. */
  241. bool m_EnableGit;
  242. /**
  243. * When true, enable Eeschema printing using Cairo
  244. */
  245. bool m_EnableEeschemaPrintCairo;
  246. /**
  247. * When true, enable output to 2581
  248. */
  249. bool m_Enable2581;
  250. ///@}
  251. private:
  252. ADVANCED_CFG();
  253. /**
  254. * Load the config from the normal config file
  255. */
  256. void loadFromConfigFile();
  257. /*
  258. * Load config from the given config base
  259. */
  260. void loadSettings( wxConfigBase& aCfg );
  261. };
  262. #endif // ADVANCED_CFG__H