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.

261 lines
7.9 KiB

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