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
7.2 KiB

  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 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 <settings/app_settings.h>
  23. #include <pcb_display_options.h>
  24. namespace PNS
  25. {
  26. class ROUTING_SETTINGS;
  27. }
  28. enum class MAGNETIC_OPTIONS
  29. {
  30. NO_EFFECT,
  31. CAPTURE_CURSOR_IN_TRACK_TOOL,
  32. CAPTURE_ALWAYS
  33. };
  34. struct MAGNETIC_SETTINGS
  35. {
  36. MAGNETIC_OPTIONS pads;
  37. MAGNETIC_OPTIONS tracks;
  38. bool graphics;
  39. MAGNETIC_SETTINGS()
  40. : pads( MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ),
  41. tracks( MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ),
  42. graphics( false )
  43. {
  44. }
  45. };
  46. enum class TRACK_DRAG_ACTION
  47. {
  48. MOVE,
  49. DRAG,
  50. DRAG_FREE_ANGLE
  51. };
  52. #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
  53. typedef std::vector<std::pair<wxString, bool>> ACTION_PLUGIN_SETTINGS_LIST;
  54. #endif
  55. class PCBNEW_SETTINGS : public APP_SETTINGS_BASE
  56. {
  57. public:
  58. struct AUI_PANELS
  59. {
  60. int appearance_panel_tab;
  61. int right_panel_width;
  62. bool show_layer_manager;
  63. };
  64. struct DIALOG_CLEANUP
  65. {
  66. bool cleanup_vias;
  67. bool delete_dangling_vias;
  68. bool cleanup_tracks_in_pad;
  69. bool cleanup_unconnected;
  70. bool cleanup_short_circuits;
  71. bool merge_segments;
  72. };
  73. struct DIALOG_DRC
  74. {
  75. bool refill_zones;
  76. bool test_all_track_errors;
  77. bool test_footprints;
  78. int severities;
  79. };
  80. struct DIALOG_EXPORT_IDF
  81. {
  82. bool auto_adjust;
  83. int ref_units;
  84. double ref_x;
  85. double ref_y;
  86. bool units_mils;
  87. };
  88. struct DIALOG_EXPORT_STEP
  89. {
  90. int origin_mode;
  91. int origin_units;
  92. double origin_x;
  93. double origin_y;
  94. bool no_virtual;
  95. };
  96. struct DIALOG_EXPORT_SVG
  97. {
  98. bool black_and_white;
  99. bool mirror;
  100. bool one_file;
  101. bool plot_board_edges;
  102. int page_size;
  103. wxString output_dir;
  104. std::vector<int> layers;
  105. };
  106. struct DIALOG_EXPORT_VRML
  107. {
  108. int units;
  109. bool copy_3d_models;
  110. bool use_relative_paths;
  111. bool use_plain_pcb;
  112. int ref_units;
  113. double ref_x;
  114. double ref_y;
  115. };
  116. struct DIALOG_FOOTPRINT_WIZARD_LIST
  117. {
  118. int width;
  119. int height;
  120. };
  121. struct DIALOG_GENERATE_DRILL
  122. {
  123. bool merge_pth_npth;
  124. bool minimal_header;
  125. bool mirror;
  126. bool unit_drill_is_inch;
  127. bool use_route_for_oval_holes;
  128. int drill_file_type;
  129. int map_file_type;
  130. int zeros_format;
  131. };
  132. struct DIALOG_IMPORT_GRAPHICS
  133. {
  134. int layer;
  135. bool interactive_placement;
  136. wxString last_file;
  137. double line_width;
  138. int line_width_units;
  139. int origin_units;
  140. double origin_x;
  141. double origin_y;
  142. int dxf_units;
  143. };
  144. struct DIALOG_NETLIST
  145. {
  146. int report_filter;
  147. bool update_footprints;
  148. bool delete_shorting_tracks;
  149. bool delete_extra_footprints;
  150. bool delete_single_pad_nets;
  151. bool associate_by_ref_sch;
  152. };
  153. struct DIALOG_PLACE_FILE
  154. {
  155. int units;
  156. int file_options;
  157. int file_format;
  158. bool include_board_edge;
  159. };
  160. struct DIALOG_PLOT
  161. {
  162. int all_layers_on_one_page;
  163. int pads_drill_mode;
  164. double fine_scale_x;
  165. double fine_scale_y;
  166. double ps_fine_width_adjust;
  167. bool check_zones_before_plotting;
  168. bool mirror;
  169. };
  170. struct DIALOG_REANNOTATE
  171. {
  172. bool sort_on_fp_location;
  173. bool remove_front_prefix;
  174. bool remove_back_prefix;
  175. bool update_schematic;
  176. bool exclude_locked;
  177. int grid_index;
  178. int sort_code;
  179. int annotation_choice;
  180. int report_severity;
  181. wxString front_refdes_start;
  182. wxString back_refdes_start;
  183. wxString front_prefix;
  184. wxString back_prefix;
  185. wxString exclude_list;
  186. wxString report_file_name;
  187. };
  188. struct FOOTPRINT_CHOOSER
  189. {
  190. int width;
  191. int height;
  192. int sash_h;
  193. int sash_v;
  194. };
  195. struct ZONES
  196. {
  197. int hatching_style;
  198. wxString net_filter;
  199. int net_sort_mode;
  200. double clearance;
  201. double min_thickness;
  202. double thermal_relief_gap;
  203. double thermal_relief_copper_width;
  204. };
  205. PCBNEW_SETTINGS();
  206. virtual ~PCBNEW_SETTINGS();
  207. virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
  208. AUI_PANELS m_AuiPanels;
  209. DIALOG_CLEANUP m_Cleanup;
  210. DIALOG_DRC m_DrcDialog;
  211. DIALOG_EXPORT_IDF m_ExportIdf;
  212. DIALOG_EXPORT_STEP m_ExportStep;
  213. DIALOG_EXPORT_SVG m_ExportSvg;
  214. DIALOG_EXPORT_VRML m_ExportVrml;
  215. DIALOG_FOOTPRINT_WIZARD_LIST m_FootprintWizardList;
  216. DIALOG_GENERATE_DRILL m_GenDrill;
  217. DIALOG_IMPORT_GRAPHICS m_ImportGraphics;
  218. DIALOG_NETLIST m_NetlistDialog;
  219. DIALOG_PLACE_FILE m_PlaceFile;
  220. DIALOG_PLOT m_Plot;
  221. DIALOG_REANNOTATE m_Reannotate;
  222. FOOTPRINT_CHOOSER m_FootprintChooser;
  223. ZONES m_Zones;
  224. WINDOW_SETTINGS m_FootprintViewer;
  225. WINDOW_SETTINGS m_FootprintWizard;
  226. PCB_DISPLAY_OPTIONS m_Display;
  227. MAGNETIC_SETTINGS m_MagneticItems;
  228. TRACK_DRAG_ACTION m_TrackDragAction;
  229. bool m_Use45DegreeGraphicSegments; // True to constraint graphic lines to horizontal,
  230. // vertical and 45º
  231. bool m_FlipLeftRight; // True: Flip footprints across Y axis
  232. // False: Flip footprints across X axis
  233. bool m_PolarCoords;
  234. int m_RotationAngle;
  235. double m_PlotLineWidth;
  236. bool m_ShowPageLimits;
  237. wxString m_FootprintTextShownColumns;
  238. std::unique_ptr<PNS::ROUTING_SETTINGS> m_PnsSettings;
  239. bool m_FootprintViewerAutoZoom; ///< Should the footprint viewer auto zoom on select
  240. double m_FootprintViewerZoom; ///< The last zoom level in the footprint viewer
  241. wxString m_lastFootprintLibDir;
  242. wxString m_lastFootprint3dDir;
  243. #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
  244. ACTION_PLUGIN_SETTINGS_LIST m_VisibleActionPlugins;
  245. #endif
  246. protected:
  247. virtual std::string getLegacyFrameName() const override { return "PcbFrame"; }
  248. };
  249. #endif