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.

365 lines
8.8 KiB

5 years ago
4 years ago
4 years ago
4 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
  5. * Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software: you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation, either version 3 of the License, or (at your
  10. * option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef PCBNEW_SETTINGS_H_
  21. #define PCBNEW_SETTINGS_H_
  22. #include <geometry/eda_angle.h>
  23. #include <settings/app_settings.h>
  24. #include <pcb_display_options.h>
  25. namespace PNS
  26. {
  27. class ROUTING_SETTINGS;
  28. }
  29. enum class MAGNETIC_OPTIONS
  30. {
  31. NO_EFFECT = 0,
  32. CAPTURE_CURSOR_IN_TRACK_TOOL,
  33. CAPTURE_ALWAYS
  34. };
  35. struct MAGNETIC_SETTINGS
  36. {
  37. MAGNETIC_OPTIONS pads;
  38. MAGNETIC_OPTIONS tracks;
  39. bool graphics;
  40. MAGNETIC_SETTINGS() :
  41. pads( MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ),
  42. tracks( MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ),
  43. graphics( false )
  44. { }
  45. };
  46. enum class TRACK_DRAG_ACTION
  47. {
  48. MOVE,
  49. DRAG,
  50. DRAG_FREE_ANGLE
  51. };
  52. enum TRACK_CLEARANCE_MODE
  53. {
  54. DO_NOT_SHOW_CLEARANCE = 0,
  55. SHOW_WHILE_ROUTING,
  56. SHOW_WITH_VIA_WHILE_ROUTING,
  57. SHOW_WITH_VIA_WHILE_ROUTING_OR_DRAGGING,
  58. SHOW_WITH_VIA_ALWAYS
  59. };
  60. enum PCB_DISPLAY_ORIGIN
  61. {
  62. PCB_ORIGIN_PAGE = 0,
  63. PCB_ORIGIN_AUX,
  64. PCB_ORIGIN_GRID,
  65. };
  66. typedef std::vector<std::pair<wxString, bool>> ACTION_PLUGIN_SETTINGS_LIST;
  67. class PCBNEW_SETTINGS : public APP_SETTINGS_BASE
  68. {
  69. public:
  70. struct AUI_PANELS
  71. {
  72. int appearance_panel_tab;
  73. int right_panel_width;
  74. bool show_layer_manager;
  75. };
  76. struct DIALOG_CLEANUP
  77. {
  78. bool cleanup_vias;
  79. bool delete_dangling_vias;
  80. bool cleanup_tracks_in_pad;
  81. bool cleanup_unconnected;
  82. bool cleanup_short_circuits;
  83. bool merge_segments;
  84. };
  85. struct DIALOG_DRC
  86. {
  87. bool refill_zones;
  88. bool test_all_track_errors;
  89. bool test_footprints;
  90. int severities;
  91. };
  92. struct DIALOG_EXPORT_IDF
  93. {
  94. bool auto_adjust;
  95. int ref_units;
  96. double ref_x;
  97. double ref_y;
  98. bool units_mils;
  99. };
  100. struct DIALOG_EXPORT_STEP
  101. {
  102. int origin_mode;
  103. int origin_units;
  104. double origin_x;
  105. double origin_y;
  106. bool no_virtual;
  107. bool replace_models;
  108. bool overwrite_file;
  109. };
  110. struct DIALOG_EXPORT_SVG
  111. {
  112. bool black_and_white;
  113. bool mirror;
  114. bool one_file;
  115. bool plot_board_edges;
  116. int page_size;
  117. wxString output_dir;
  118. std::vector<int> layers;
  119. };
  120. struct DIALOG_EXPORT_VRML
  121. {
  122. int units;
  123. bool copy_3d_models;
  124. bool use_relative_paths;
  125. int ref_units;
  126. double ref_x;
  127. double ref_y;
  128. int origin_mode;
  129. };
  130. struct DIALOG_FOOTPRINT_WIZARD_LIST
  131. {
  132. int width;
  133. int height;
  134. };
  135. struct DIALOG_GENERATE_DRILL
  136. {
  137. bool merge_pth_npth;
  138. bool minimal_header;
  139. bool mirror;
  140. bool unit_drill_is_inch;
  141. bool use_route_for_oval_holes;
  142. int drill_file_type;
  143. int map_file_type;
  144. int zeros_format;
  145. };
  146. struct DIALOG_IMPORT_GRAPHICS
  147. {
  148. int layer;
  149. bool interactive_placement;
  150. wxString last_file;
  151. double line_width;
  152. int line_width_units;
  153. int origin_units;
  154. double origin_x;
  155. double origin_y;
  156. int dxf_units;
  157. };
  158. struct DIALOG_NETLIST
  159. {
  160. int report_filter;
  161. bool update_footprints;
  162. bool delete_shorting_tracks;
  163. bool delete_extra_footprints;
  164. bool associate_by_ref_sch;
  165. };
  166. struct DIALOG_PLACE_FILE
  167. {
  168. int units;
  169. int file_options;
  170. int file_format;
  171. bool include_board_edge;
  172. bool use_aux_origin;
  173. };
  174. struct DIALOG_PLOT
  175. {
  176. int all_layers_on_one_page;
  177. bool edgecut_on_all_layers;
  178. int pads_drill_mode;
  179. double fine_scale_x;
  180. double fine_scale_y;
  181. double ps_fine_width_adjust;
  182. bool check_zones_before_plotting;
  183. bool mirror;
  184. };
  185. struct DIALOG_REANNOTATE
  186. {
  187. bool sort_on_fp_location;
  188. bool remove_front_prefix;
  189. bool remove_back_prefix;
  190. bool exclude_locked;
  191. int grid_index;
  192. int sort_code;
  193. int annotation_choice;
  194. int report_severity;
  195. wxString front_refdes_start;
  196. wxString back_refdes_start;
  197. wxString front_prefix;
  198. wxString back_prefix;
  199. wxString exclude_list;
  200. wxString report_file_name;
  201. };
  202. struct FOOTPRINT_CHOOSER
  203. {
  204. int width;
  205. int height;
  206. int sash_h;
  207. int sash_v;
  208. };
  209. struct ZONES
  210. {
  211. int hatching_style;
  212. int net_sort_mode;
  213. double clearance;
  214. double min_thickness;
  215. double thermal_relief_gap;
  216. double thermal_relief_copper_width;
  217. };
  218. struct DISPLAY_OPTIONS
  219. {
  220. bool m_DisplayPadFill;
  221. bool m_DisplayViaFill;
  222. bool m_DisplayGraphicsFill;
  223. bool m_DisplayTextFill;
  224. bool m_DisplayPcbTrackFill;
  225. TRACK_CLEARANCE_MODE m_TrackClearance;
  226. bool m_PadClearance;
  227. int m_NetNames;
  228. bool m_PadNumbers;
  229. bool m_PadNoConnects;
  230. RATSNEST_MODE m_RatsnestMode;
  231. int m_MaxLinksShowed;
  232. bool m_ShowModuleRatsnest;
  233. bool m_ShowGlobalRatsnest;
  234. bool m_DisplayRatsnestLinesCurved;
  235. PCB_DISPLAY_ORIGIN m_DisplayOrigin;
  236. bool m_DisplayInvertXAxis;
  237. bool m_DisplayInvertYAxis;
  238. bool m_Live3DRefresh;
  239. };
  240. PCBNEW_SETTINGS();
  241. virtual ~PCBNEW_SETTINGS();
  242. virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
  243. AUI_PANELS m_AuiPanels;
  244. DIALOG_CLEANUP m_Cleanup;
  245. DIALOG_DRC m_DrcDialog;
  246. DIALOG_EXPORT_IDF m_ExportIdf;
  247. DIALOG_EXPORT_STEP m_ExportStep;
  248. DIALOG_EXPORT_SVG m_ExportSvg;
  249. DIALOG_EXPORT_VRML m_ExportVrml;
  250. DIALOG_FOOTPRINT_WIZARD_LIST m_FootprintWizardList;
  251. DIALOG_GENERATE_DRILL m_GenDrill;
  252. DIALOG_IMPORT_GRAPHICS m_ImportGraphics;
  253. DIALOG_NETLIST m_NetlistDialog;
  254. DIALOG_PLACE_FILE m_PlaceFile;
  255. DIALOG_PLOT m_Plot;
  256. DIALOG_REANNOTATE m_Reannotate;
  257. FOOTPRINT_CHOOSER m_FootprintChooser;
  258. ZONES m_Zones;
  259. WINDOW_SETTINGS m_FootprintViewer;
  260. WINDOW_SETTINGS m_FootprintWizard;
  261. DISPLAY_OPTIONS m_Display;
  262. MAGNETIC_SETTINGS m_MagneticItems;
  263. TRACK_DRAG_ACTION m_TrackDragAction;
  264. bool m_Use45DegreeLimit; // True to constrain tool actions to horizontal,
  265. // vertical and 45deg
  266. bool m_FlipLeftRight; // True: Flip footprints across Y axis
  267. bool m_PolarCoords;
  268. EDA_ANGLE m_RotationAngle;
  269. bool m_ShowPageLimits;
  270. ///<@todo Implement real auto zone filling (not just after zone properties are edited)
  271. bool m_AutoRefillZones; // Fill zones after editing the zone using the Zone Properties dialog
  272. bool m_AllowFreePads; // True: unlocked pads can be moved freely with respect to the footprint.
  273. // False (default): all pads are treated as locked for the purposes of
  274. // movement and any attempt to move them will move the footprint instead.
  275. wxString m_FootprintTextShownColumns;
  276. std::unique_ptr<PNS::ROUTING_SETTINGS> m_PnsSettings;
  277. double m_FootprintViewerZoom; ///< The last zoom level used (0 for auto)
  278. bool m_FootprintViewerAutoZoomOnSelect; ///< true to use automatic zoom on fp selection
  279. wxString m_lastFootprintLibDir;
  280. wxString m_lastFootprint3dDir;
  281. ACTION_PLUGIN_SETTINGS_LIST m_VisibleActionPlugins;
  282. protected:
  283. virtual std::string getLegacyFrameName() const override { return "PcbFrame"; }
  284. };
  285. #endif