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.

1687 lines
62 KiB

14 years ago
17 years ago
14 years ago
14 years ago
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
14 years ago
15 years ago
17 years ago
17 years ago
17 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
  5. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. /**
  25. * @file wxPcbStruct.h
  26. */
  27. #ifndef WXPCB_STRUCT_H_
  28. #define WXPCB_STRUCT_H_
  29. #include <wxBasePcbFrame.h>
  30. #include <param_config.h>
  31. #include <class_macros_record.h>
  32. #include <class_undoredo_container.h>
  33. #include <zones.h>
  34. /* Forward declarations of classes. */
  35. class PCB_SCREEN;
  36. class BOARD;
  37. class TEXTE_PCB;
  38. class MODULE;
  39. class TRACK;
  40. class SEGZONE;
  41. class SEGVIA;
  42. class D_PAD;
  43. class TEXTE_MODULE;
  44. class PCB_TARGET;
  45. class DIMENSION;
  46. class EDGE_MODULE;
  47. class DRC;
  48. class ZONE_CONTAINER;
  49. class DRAWSEGMENT;
  50. class GENERAL_COLLECTOR;
  51. class GENERAL_COLLECTORS_GUIDE;
  52. class PCB_LAYER_WIDGET;
  53. class MARKER_PCB;
  54. class BOARD_ITEM;
  55. class PCB_LAYER_BOX_SELECTOR;
  56. class NETLIST;
  57. class REPORTER;
  58. class PARSE_ERROR;
  59. class IO_ERROR;
  60. class FP_LIB_TABLE;
  61. /**
  62. * class PCB_EDIT_FRAME
  63. * the main frame for Pcbnew
  64. *
  65. * See also class PCB_BASE_FRAME(): Basic class for Pcbnew and GerbView.
  66. */
  67. class PCB_EDIT_FRAME : public PCB_BASE_FRAME
  68. {
  69. friend class PCB_LAYER_WIDGET;
  70. void updateTraceWidthSelectBox();
  71. void updateViaSizeSelectBox();
  72. int m_RecordingMacros;
  73. MACROS_RECORDED m_Macros[10];
  74. /// The auxiliary right vertical tool bar used to access the microwave tools.
  75. wxAuiToolBar* m_microWaveToolBar;
  76. /// The global footprint library table.
  77. FP_LIB_TABLE* m_globalFootprintTable;
  78. /**
  79. * Function loadFootprints
  80. * loads the footprints for each #COMPONENT in \a aNetlist from the list of libraries.
  81. *
  82. * @param aNetlist is the netlist of components to load the footprints into.
  83. * @param aReporter is the #REPORTER object to report to.
  84. * @throw IO_ERROR if an I/O error occurs or a #PARSE_ERROR if a file parsing error
  85. * occurs while reading footprint library files.
  86. */
  87. void loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
  88. throw( IO_ERROR, PARSE_ERROR );
  89. protected:
  90. #ifdef KICAD_SCRIPTING_WXPYTHON
  91. // Panel used to let user talk with internal scripting
  92. wxWindow* m_pythonPanel;
  93. bool m_pythonPanelHidden;
  94. #endif
  95. PCB_LAYER_WIDGET* m_Layers;
  96. DRC* m_drc; ///< the DRC controller, see drc.cpp
  97. PARAM_CFG_ARRAY m_configSettings; ///< List of Pcbnew configuration settings.
  98. wxString m_lastNetListRead; ///< Last net list read with relative path.
  99. bool m_useCmpFileForFpNames; ///< is true, use the .cmp file from CvPcb, else use the netlist
  100. // to know the footprint name of components.
  101. // we'll use lower case function names for private member functions.
  102. void createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* aPopMenu );
  103. void createPopUpMenuForFootprints( MODULE* aModule, wxMenu* aPopMenu );
  104. void createPopUpMenuForFpTexts( TEXTE_MODULE* aText, wxMenu* aPopMenu );
  105. void createPopUpMenuForFpPads( D_PAD* aPad, wxMenu* aPopMenu );
  106. void createPopupMenuForTracks( TRACK* aTrack, wxMenu* aPopMenu );
  107. void createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu );
  108. void createPopUpBlockMenu( wxMenu* menu );
  109. void createPopUpMenuForMarkers( MARKER_PCB* aMarker, wxMenu* aPopMenu );
  110. /**
  111. * Function setActiveLayer
  112. * will change the currently active layer to \a aLayer and also
  113. * update the PCB_LAYER_WIDGET.
  114. */
  115. void setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true )
  116. {
  117. ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
  118. if( doLayerWidgetUpdate )
  119. syncLayerWidgetLayer();
  120. }
  121. /**
  122. * Function getActiveLayer
  123. * returns the active layer
  124. */
  125. LAYER_NUM getActiveLayer()
  126. {
  127. return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
  128. }
  129. /**
  130. * Function syncLayerWidgetLayer
  131. * updates the currently layer "selection" within the PCB_LAYER_WIDGET.
  132. * The currently selected layer is defined by the return value of getActiveLayer().
  133. * <p>
  134. * This function cannot be inline without including layer_widget.h in
  135. * here and we do not want to do that.
  136. * </p>
  137. */
  138. void syncLayerWidgetLayer();
  139. /**
  140. * Function syncRenderStates
  141. * updates the "Render" checkboxes in the layer widget according
  142. * to current toggle values determined by IsElementVisible(), and is helpful
  143. * immediately after loading a BOARD which may have state information in it.
  144. */
  145. void syncRenderStates();
  146. /**
  147. * Function syncLayerVisibilities
  148. * updates each "Layer" checkbox in the layer widget according
  149. * to each layer's current visibility determined by IsLayerVisible(), and is
  150. * helpful immediately after loading a BOARD which may have state information in it.
  151. */
  152. void syncLayerVisibilities();
  153. virtual void unitsChangeRefresh();
  154. /**
  155. * Function doAutoSave
  156. * performs auto save when the board has been modified and not saved within the
  157. * auto save interval.
  158. *
  159. * @return true if the auto save was successful.
  160. */
  161. virtual bool doAutoSave();
  162. /**
  163. * Function isautoSaveRequired
  164. * returns true if the board has been modified.
  165. */
  166. virtual bool isAutoSaveRequired() const;
  167. /**
  168. * Function duplicateZone
  169. * duplicates the given zone.
  170. * @param aDC is the current Device Context.
  171. * @param aZone is the zone to duplicate
  172. */
  173. void duplicateZone( wxDC* aDC, ZONE_CONTAINER* aZone );
  174. /**
  175. * Function loadFootprintLibTable
  176. * deletes the existing #FP_LIB_TABLE and creates a new one when a new project is loaded.
  177. */
  178. void loadFootprintLibTable();
  179. public:
  180. PCB_LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
  181. wxComboBox* m_SelTrackWidthBox; // a combo box to display and select current track width
  182. wxComboBox* m_SelViaSizeBox; // a combo box to display and select current via diameter
  183. bool m_show_microwave_tools;
  184. bool m_show_layer_manager_tools;
  185. public:
  186. PCB_EDIT_FRAME( wxWindow* father, const wxString& title,
  187. const wxPoint& pos, const wxSize& size,
  188. long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
  189. ~PCB_EDIT_FRAME();
  190. void OnQuit( wxCommandEvent& event );
  191. /**
  192. * Function ToPlotter
  193. * Open a dialog frame to create plot and drill files
  194. * relative to the current board
  195. */
  196. void ToPlotter( wxCommandEvent& event );
  197. /**
  198. * Function ToPrinter
  199. * Install the print dialog
  200. */
  201. void ToPrinter( wxCommandEvent& event );
  202. /**
  203. * Function SVG_Print
  204. * shows the print SVG file dialog.
  205. */
  206. void SVG_Print( wxCommandEvent& event );
  207. // User interface update command event handlers.
  208. void OnUpdateSave( wxUpdateUIEvent& aEvent );
  209. void OnUpdateLayerPair( wxUpdateUIEvent& aEvent );
  210. void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
  211. void OnUpdateDrcEnable( wxUpdateUIEvent& aEvent );
  212. void OnUpdateShowBoardRatsnest( wxUpdateUIEvent& aEvent );
  213. void OnUpdateShowModuleRatsnest( wxUpdateUIEvent& aEvent );
  214. void OnUpdateAutoDeleteTrack( wxUpdateUIEvent& aEvent );
  215. void OnUpdateViaDrawMode( wxUpdateUIEvent& aEvent );
  216. void OnUpdateTraceDrawMode( wxUpdateUIEvent& aEvent );
  217. void OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent );
  218. void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent );
  219. void OnUpdateShowMicrowaveToolbar( wxUpdateUIEvent& aEvent );
  220. void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
  221. void OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent );
  222. void OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent );
  223. void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent );
  224. void OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent );
  225. void OnUpdateAutoPlaceModulesMode( wxUpdateUIEvent& aEvent );
  226. void OnUpdateAutoPlaceTracksMode( wxUpdateUIEvent& aEvent );
  227. /**
  228. * Function RecordMacros.
  229. * records sequence of hotkeys and cursor positions to a macro.
  230. * @param aDC = current device context
  231. * @param aNumber The current number macros.
  232. */
  233. void RecordMacros( wxDC* aDC, int aNumber );
  234. /**
  235. * Function CallMacros
  236. * play hotkeys and cursor position from a recorded macro.
  237. * @param aDC = current device context
  238. * @param aPosition The current cursor position in logical (drawing) units.
  239. * @param aNumber The current number macros.
  240. */
  241. void CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumber );
  242. void SaveMacros();
  243. void ReadMacros();
  244. /**
  245. * Function PrintPage , virtual
  246. * used to print a page
  247. * Print the page pointed by the current screen, set by the calling print function
  248. * @param aDC = wxDC given by the calling print function
  249. * @param aPrintMaskLayer = a 32 bits mask: bit n = 1 -> layer n is printed
  250. * @param aPrintMirrorMode = true to plot mirrored
  251. * @param aData = a pointer on an auxiliary data (NULL if not used)
  252. */
  253. virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMaskLayer, bool aPrintMirrorMode,
  254. void * aData = NULL );
  255. void GetKicadAbout( wxCommandEvent& event );
  256. /**
  257. * Function IsGridVisible() , virtual
  258. * @return true if the grid must be shown
  259. */
  260. virtual bool IsGridVisible() const;
  261. /**
  262. * Function SetGridVisibility() , virtual
  263. * It may be overloaded by derived classes
  264. * if you want to store/retrieve the grid visibility in configuration.
  265. * @param aVisible = true if the grid must be shown
  266. */
  267. virtual void SetGridVisibility( bool aVisible );
  268. /**
  269. * Function GetGridColor() , virtual
  270. * @return the color of the grid
  271. */
  272. virtual EDA_COLOR_T GetGridColor() const;
  273. /**
  274. * Function SetGridColor() , virtual
  275. * @param aColor = the new color of the grid
  276. */
  277. virtual void SetGridColor(EDA_COLOR_T aColor);
  278. // Configurations:
  279. void InstallConfigFrame();
  280. void Process_Config( wxCommandEvent& event );
  281. /**
  282. * Function GetProjectFileParameters
  283. * returns a project file parameter list for Pcbnew.
  284. * <p>
  285. * Populate a project file parameter array specific to Pcbnew.
  286. * Creating the parameter list at run time has the advantage of being able
  287. * to define local variables. The old method of statically building the array
  288. * at compile time requiring global variable definitions by design.
  289. * </p>
  290. * @return PARAM_CFG_ARRAY - it is only good until SetBoard() is called, so
  291. * don't keep it around past that event.
  292. */
  293. PARAM_CFG_ARRAY GetProjectFileParameters();
  294. void SaveProjectSettings();
  295. /**
  296. * Load the project file configuration settings.
  297. *
  298. * @param aProjectFileName = The project filename.
  299. * if not found use kicad.pro and initialize default values
  300. * @return always returns true.
  301. */
  302. bool LoadProjectSettings( const wxString& aProjectFileName );
  303. /**
  304. * Function GetConfigurationSettings
  305. * returns the Pcbnew applications settings list.
  306. *
  307. * This replaces the old statically defined list that had the project
  308. * file settings and the application settings mixed together. This
  309. * was confusing and caused some settings to get saved and loaded
  310. * incorrectly. Currently, only the settings that are needed at start
  311. * up by the main window are defined here. There are other locally used
  312. * settings that are scattered throughout the Pcbnew source code. If you need
  313. * to define a configuration setting that needs to be loaded at run time,
  314. * this is the place to define it.
  315. *
  316. * @todo: Define the configuration variables as member variables instead of
  317. * global variables or move them to the object class where they are
  318. * used.
  319. * @return - Reference to the list of applications settings.
  320. */
  321. PARAM_CFG_ARRAY& GetConfigurationSettings();
  322. /**
  323. * Function LoadSettings
  324. * loads applications settings specific to Pcbnew.
  325. *
  326. * This overrides the base class PCB_BASE_FRAME::LoadSettings() to
  327. * handle settings specific common to the PCB layout application. It
  328. * calls down to the base class to load settings common to all PCB type
  329. * drawing frames. Please put your application settings for Pcbnew here
  330. * to avoid having application settings loaded all over the place.
  331. */
  332. virtual void LoadSettings();
  333. /**
  334. * Function SaveSettings
  335. * saves applications settings common to Pcbnew.
  336. *
  337. * This overrides the base class PCB_BASE_FRAME::SaveSettings() to
  338. * save settings specific to the PCB layout application main window. It
  339. * calls down to the base class to save settings common to all PCB type
  340. * drawing frames. Please put your application settings for Pcbnew here
  341. * to avoid having application settings saved all over the place.
  342. */
  343. virtual void SaveSettings();
  344. /**
  345. * Get the last net list read with the net list dialog box.
  346. *
  347. * @return - Absolute path and file name of the last net list file successfully read.
  348. */
  349. wxString GetLastNetListRead();
  350. /**
  351. * Set the last net list successfully read by the net list dialog box.
  352. *
  353. * Note: the file path is converted to a path relative to the project file path. If
  354. * the path cannot be made relative, than m_lastNetListRead is set to and empty
  355. * string. This could happen when the net list file is on a different drive than
  356. * the project file. The advantage of relative paths is that is more likely to
  357. * work when opening the same project from both Windows and Linux.
  358. *
  359. * @param aNetListFile - The last net list file with full path successfully read.
  360. */
  361. void SetLastNetListRead( const wxString& aNetListFile );
  362. /**
  363. * @return true if the .cmp file created by CvPcb should be used to know the
  364. * footprint associated to components, false to use the netlist file only
  365. */
  366. bool GetUseCmpFileForFpNames() { return m_useCmpFileForFpNames; }
  367. /**
  368. * Set the default option to use or not the .cmp file craeted by CvPcb
  369. * should be used to know the footprints associated to components when
  370. * reading a netlist
  371. * When the .cmp netlist is not used, footprint names are read from the netlist.
  372. * This imply the user has filled the footprint fields in schematic
  373. * @param aUseCmpfile = true to use the .cmp file,
  374. * false to use the netlist file only
  375. */
  376. void SetUseCmpFileForFpNames( bool aUseCmpfile)
  377. {
  378. m_useCmpFileForFpNames = aUseCmpfile;
  379. }
  380. /**
  381. * Function OnHotKey.
  382. * ** Commands are case insensitive **
  383. * Some commands are relatives to the item under the mouse cursor
  384. * @param aDC = current device context
  385. * @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
  386. * @param aPosition The cursor position in logical (drawing) units.
  387. * @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
  388. */
  389. void OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
  390. /**
  391. * Function OnHotkeyDeleteItem
  392. * Delete the item found under the mouse cursor
  393. * Depending on the current active tool::
  394. * Tool track
  395. * if a track is in progress: Delete the last segment
  396. * else delete the entire track
  397. * Tool module (footprint):
  398. * Delete the module.
  399. * @param aDC = current device context
  400. * @return true if an item was deleted
  401. */
  402. bool OnHotkeyDeleteItem( wxDC* aDC );
  403. /**
  404. * Function OnHotkeyPlaceItem
  405. * Place the item (footprint, track, text .. ) found under the mouse cursor
  406. * An item can be placed only if there is this item currently edited
  407. * Only a footprint, a pad or a track can be placed
  408. * @param aDC = current device context
  409. * @return true if an item was placed
  410. */
  411. bool OnHotkeyPlaceItem( wxDC* aDC );
  412. bool OnHotkeyEditItem( int aIdCommand );
  413. /**
  414. * Function OnHotkeyCopyItem
  415. * returns the copy event id for copyable items.
  416. * @return Event id of a suitable copy event, zero when no copyable item found.
  417. */
  418. int OnHotkeyCopyItem();
  419. /**
  420. * Function OnHotkeyMoveItem
  421. * Moves or drag the item (footprint, track, text .. ) found under the mouse cursor
  422. * Only a footprint or a track can be dragged
  423. * @param aIdCommand = the hotkey command id
  424. * @return true if an item was moved
  425. */
  426. bool OnHotkeyMoveItem( int aIdCommand );
  427. /**
  428. * Function OnHotkeyRotateItem
  429. * Rotate the item (text or footprint) found under the mouse cursor
  430. * @note This command can be used with an item currently in edit.
  431. * Only some items can be rotated (footprints and texts).
  432. * @param aIdCommand = the hotkey command id
  433. * @return true if an item was moved
  434. */
  435. bool OnHotkeyRotateItem( int aIdCommand );
  436. /**
  437. * Function OnHotkeyBeginRoute
  438. * If the current active layer is a copper layer,
  439. * and if no item currently edited, start a new track segmenton
  440. * the current copper layer.
  441. * If a new track is in progress, terminate the current segment and
  442. * start a new one.
  443. * @param aDC = current device context
  444. * @return a reference to the track if a track is created, or NULL
  445. */
  446. TRACK * OnHotkeyBeginRoute( wxDC* aDC );
  447. void OnCloseWindow( wxCloseEvent& Event );
  448. void Process_Special_Functions( wxCommandEvent& event );
  449. void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
  450. void OnSelectTool( wxCommandEvent& aEvent );
  451. /**
  452. * Function OnResetModuleTextSizes
  453. * resets text size and width of all module text fields of given field
  454. * type to current settings in Preferences
  455. */
  456. void OnResetModuleTextSizes( wxCommandEvent& event );
  457. void ProcessMuWaveFunctions( wxCommandEvent& event );
  458. void MuWaveCommand( wxDC* DC, const wxPoint& MousePos );
  459. void RedrawActiveWindow( wxDC* DC, bool EraseBg );
  460. void ReCreateHToolbar();
  461. void ReCreateAuxiliaryToolbar();
  462. void ReCreateVToolbar();
  463. void ReCreateMicrowaveVToolbar();
  464. void ReCreateOptToolbar();
  465. void ReCreateMenuBar();
  466. PCB_LAYER_BOX_SELECTOR* ReCreateLayerBox( wxAuiToolBar* parent );
  467. /**
  468. * Function OnModify
  469. * must be called after a board change to set the modified flag.
  470. * <p>
  471. * Reloads the 3D view if required and calls the base PCB_BASE_FRAME::OnModify function
  472. * to update auxiliary information.
  473. * </p>
  474. */
  475. virtual void OnModify();
  476. /**
  477. * Function IsElementVisible
  478. * tests whether a given element category is visible. Keep this as an
  479. * inline function.
  480. * @param aElement is from the enum by the same name
  481. * @return bool - true if the element is visible.
  482. * @see enum PCB_VISIBLE
  483. */
  484. bool IsElementVisible( int aElement ) const;
  485. /**
  486. * Function SetElementVisibility
  487. * changes the visibility of an element category
  488. * @param aElement is from the enum by the same name
  489. * @param aNewState = The new visibility state of the element category
  490. * @see enum PCB_VISIBLE
  491. */
  492. void SetElementVisibility( int aElement, bool aNewState );
  493. /**
  494. * Function SetVisibleAlls
  495. * Set the status of all visible element categories and layers to VISIBLE
  496. */
  497. void SetVisibleAlls();
  498. /**
  499. * Function ReFillLayerWidget
  500. * changes out all the layers in m_Layers and may be called upon
  501. * loading a new BOARD.
  502. */
  503. void ReFillLayerWidget();
  504. /**
  505. * Function Show3D_Frame
  506. * displays the 3D view of current printed circuit board.
  507. */
  508. void Show3D_Frame( wxCommandEvent& event );
  509. void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
  510. /**
  511. * Function ShowDesignRulesEditor
  512. * displays the Design Rules Editor.
  513. */
  514. void ShowDesignRulesEditor( wxCommandEvent& event );
  515. /* toolbars update UI functions: */
  516. void PrepareLayerIndicator();
  517. /* mouse functions events: */
  518. void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
  519. void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
  520. /**
  521. * Function OnRightClick
  522. * populates a popup menu with the choices appropriate for the current context.
  523. * The caller will add the ZOOM menu choices afterward.
  524. * @param aMousePos The current mouse position
  525. * @param aPopMenu The menu to add to.
  526. */
  527. bool OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu );
  528. void OnSelectOptionToolbar( wxCommandEvent& event );
  529. void ToolOnRightClick( wxCommandEvent& event );
  530. /**
  531. * Function SaveCopyInUndoList.
  532. * Creates a new entry in undo list of commands.
  533. * add a picker to handle aItemToCopy
  534. * @param aItemToCopy = the board item modified by the command to undo
  535. * @param aTypeCommand = command type (see enum UNDO_REDO_T)
  536. * @param aTransformPoint = the reference point of the transformation, for
  537. * commands like move
  538. */
  539. virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy,
  540. UNDO_REDO_T aTypeCommand,
  541. const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
  542. /**
  543. * Function SaveCopyInUndoList (overloaded).
  544. * Creates a new entry in undo list of commands.
  545. * add a list of pickers to handle a list of items
  546. * @param aItemsList = the list of items modified by the command to undo
  547. * @param aTypeCommand = command type (see enum UNDO_REDO_T)
  548. * @param aTransformPoint = the reference point of the transformation, for
  549. * commands like move
  550. */
  551. virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
  552. UNDO_REDO_T aTypeCommand,
  553. const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
  554. /**
  555. * Function PutDataInPreviousState
  556. * Used in undo or redo command.
  557. * Put data pointed by List in the previous state, i.e. the state memorized by List
  558. * @param aList = a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
  559. * @param aRedoCommand = a bool: true for redo, false for undo
  560. * @param aRebuildRatsnet = a bool: true to rebuild ratsnest (normal use), false
  561. * to just retrieve last state (used in abort commands that do not need to
  562. * rebuild ratsnest)
  563. */
  564. void PutDataInPreviousState( PICKED_ITEMS_LIST* aList,
  565. bool aRedoCommand,
  566. bool aRebuildRatsnet = true );
  567. /**
  568. * Function GetBoardFromRedoList
  569. * Redo the last edition:
  570. * - Save the current board in Undo list
  571. * - Get an old version of the board from Redo list
  572. * @return none
  573. */
  574. void GetBoardFromRedoList( wxCommandEvent& event );
  575. /**
  576. * Function GetBoardFromUndoList
  577. * Undo the last edition:
  578. * - Save the current board in Redo list
  579. * - Get an old version of the board from Undo list
  580. * @return none
  581. */
  582. void GetBoardFromUndoList( wxCommandEvent& event );
  583. /* Block operations: */
  584. /**
  585. * Function ReturnBlockCommand
  586. * Returns the block command internat code (BLOCK_MOVE, BLOCK_COPY...)
  587. * corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when
  588. * block command is started by dragging the mouse.
  589. * @param aKey = the key modifiers (Alt, Shift ...)
  590. * @return the block command id (BLOCK_MOVE, BLOCK_COPY...)
  591. */
  592. virtual int ReturnBlockCommand( int aKey );
  593. /**
  594. * Function HandleBlockPlace()
  595. * Called after HandleBlockEnd, when a block command needs to be
  596. * executed after the block is moved to its new place
  597. * (bloc move, drag, copy .. )
  598. * Parameters must be initialized in GetScreen()->m_BlockLocate
  599. */
  600. virtual void HandleBlockPlace( wxDC* DC );
  601. /**
  602. * Function HandleBlockEnd()
  603. * Handle the "end" of a block command,
  604. * i.e. is called at the end of the definition of the area of a block.
  605. * depending on the current block command, this command is executed
  606. * or parameters are initialized to prepare a call to HandleBlockPlace
  607. * in GetScreen()->m_BlockLocate
  608. * @return false if no item selected, or command finished,
  609. * true if some items found and HandleBlockPlace must be called later
  610. */
  611. virtual bool HandleBlockEnd( wxDC* DC );
  612. /**
  613. * Function Block_SelectItems
  614. * Uses GetScreen()->m_BlockLocate
  615. * select items within the selected block.
  616. * selected items are put in the pick list
  617. */
  618. void Block_SelectItems();
  619. /**
  620. * Function Block_Delete
  621. * deletes all items within the selected block.
  622. */
  623. void Block_Delete();
  624. /**
  625. * Function Block_Rotate
  626. * Rotate all items within the selected block.
  627. * The rotation center is the center of the block
  628. */
  629. void Block_Rotate();
  630. /**
  631. * Function Block_Flip
  632. * Flip items within the selected block.
  633. * The flip center is the center of the block
  634. */
  635. void Block_Flip();
  636. /**
  637. * Function Block_Move
  638. * move all items within the selected block.
  639. * New location is determined by the current offset from the selected
  640. * block's original location.
  641. */
  642. void Block_Move();
  643. /**
  644. * Function Block_Mirror_X
  645. * mirrors all items within the currently selected block in the X axis.
  646. */
  647. void Block_Mirror_X();
  648. /**
  649. * Function Block_Duplicate
  650. * Duplicate all items within the selected block.
  651. * New location is determined by the current offset from the selected
  652. * block's original location.
  653. */
  654. void Block_Duplicate();
  655. void Process_Settings( wxCommandEvent& event );
  656. void OnConfigurePcbOptions( wxCommandEvent& aEvent );
  657. void InstallDisplayOptionsDialog( wxCommandEvent& aEvent );
  658. void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
  659. void InstallDialogLayerSetup();
  660. /**
  661. * Function GenFootprintsPositionFile
  662. * Calls DoGenFootprintsPositionFile to create a footprint position file
  663. * See DoGenFootprintsPositionFile for options and file format
  664. */
  665. void GenFootprintsPositionFile( wxCommandEvent& event );
  666. /**
  667. * Function DoGenFootprintsPositionFile
  668. * Creates an ascii footprint position file
  669. * @param aFullFileName = the full file name of the file to create
  670. * @param aUnitsMM = false to use inches, true to use mm in coordinates
  671. * @param aForceSmdItems = true to force all footprints with smd pads in list
  672. * = false to put only footprints with option "INSERT" in list
  673. * @param aSide = 0 to list footprints on BACK side,
  674. * 1 to list footprints on FRONT side
  675. * 2 to list footprints on both sides
  676. * @return the number of footprints found on aSide side,
  677. * or -1 if the file could not be created
  678. */
  679. int DoGenFootprintsPositionFile( const wxString& aFullFileName, bool aUnitsMM,
  680. bool aForceSmdItems, int aSide );
  681. /**
  682. * Function GenFootprintsReport
  683. * Calls DoGenFootprintsReport to create a footprint reprot file
  684. * See DoGenFootprintsReport for file format
  685. */
  686. void GenFootprintsReport( wxCommandEvent& event );
  687. /**
  688. * Function DoGenFootprintsReport
  689. * Creates an ascii footprint report file giving some infos on footprints
  690. * and board outlines
  691. * @param aFullFilename = the full file name of the file to create
  692. * @param aUnitsMM = false to use inches, true to use mm in coordinates
  693. * @return true if OK, false if error
  694. */
  695. bool DoGenFootprintsReport( const wxString& aFullFilename, bool aUnitsMM );
  696. void InstallDrillFrame( wxCommandEvent& event );
  697. void ToPostProcess( wxCommandEvent& event );
  698. void OnFileHistory( wxCommandEvent& event );
  699. /**
  700. * Function Files_io
  701. * is the command event handler for read and write file commands.
  702. */
  703. void Files_io( wxCommandEvent& event );
  704. /**
  705. * Function LoadOnePcbFile
  706. * loads a KiCad board (.brd) from \a aFileName.
  707. *
  708. * @param aFileName - File name including path. If empty, a file dialog will
  709. * be displayed.
  710. * @param aAppend - Append board file aFileName to the currently loaded file if true.
  711. * Default = false.
  712. * @param aForceFileDialog - Display the file open dialog even if aFullFileName is
  713. * valid if true; Default = false.
  714. *
  715. * @return False if file load fails or is canceled by the user, otherwise true.
  716. */
  717. bool LoadOnePcbFile( const wxString& aFileName, bool aAppend = false,
  718. bool aForceFileDialog = false );
  719. /**
  720. * Function ReadPcbFile
  721. * reads a board file &ltfile&gt.brd
  722. * @param aReader The line reader object to read from.
  723. * @param Append if 0: a previously loaded board is deleted before loading
  724. * the file else all items of the board file are added to the
  725. * existing board
  726. */
  727. int ReadPcbFile( LINE_READER* aReader, bool Append );
  728. /**
  729. * Function SavePcbFile
  730. * writes the board data structures to \a a aFileName
  731. *
  732. * @param aFileName The file name to write or wxEmptyString to prompt user for
  733. * file name.
  734. * @param aCreateBackupFile Creates a back of \a aFileName if true. Helper
  735. * definitions #CREATE_BACKUP_FILE and #NO_BACKUP_FILE
  736. * are defined for improved code readability.
  737. * @return True if file was saved successfully.
  738. */
  739. bool SavePcbFile( const wxString& aFileName, bool aCreateBackupFile = CREATE_BACKUP_FILE );
  740. int SavePcbFormatAscii( FILE* File );
  741. bool WriteGeneralDescrPcb( FILE* File );
  742. // BOARD handling
  743. /**
  744. * Function Clear_Pcb
  745. * delete all and reinitialize the current board
  746. * @param aQuery = true to prompt user for confirmation, false to initialize silently
  747. */
  748. bool Clear_Pcb( bool aQuery );
  749. // Drc control
  750. /* function GetDrcController
  751. * @return the DRC controller
  752. */
  753. DRC* GetDrcController() { return m_drc; }
  754. /**
  755. * Function RecreateBOMFileFromBoard
  756. * Recreates a .cmp file from the current loaded board
  757. * this is the same as created by CvPcb.
  758. * can be used if this file is lost
  759. */
  760. void RecreateCmpFileFromBoard( wxCommandEvent& aEvent );
  761. /**
  762. * Function ArchiveModulesOnBoard
  763. * Save modules in a library:
  764. * @param aLibName: the full filename of the library to create or modify
  765. * @param aNewModulesOnly:
  766. * true : save modules not already existing in this lib
  767. * false: save all modules
  768. */
  769. void ArchiveModulesOnBoard( const wxString& aLibName, bool aNewModulesOnly );
  770. /**
  771. * Function RecreateBOMFileFromBoard
  772. * Creates a BOM file from the current loaded board
  773. */
  774. void RecreateBOMFileFromBoard( wxCommandEvent& aEvent );
  775. /**
  776. * Function ExportToGenCAD
  777. * creates a file in GenCAD 1.4 format from the current board.
  778. */
  779. void ExportToGenCAD( wxCommandEvent& event );
  780. /**
  781. * Function OnExportVRML
  782. * will export the current BOARD to a VRML file.
  783. */
  784. void OnExportVRML( wxCommandEvent& event );
  785. /**
  786. * Function ExportVRML_File
  787. * Creates the file(s) exporting current BOARD to a VRML file.
  788. *
  789. * @note When copying 3D shapes files, the new filename is build from the full path
  790. * name, changing the separators by underscore. This is needed because files
  791. * with the same shortname can exist in different directories
  792. * @note ExportVRML_File generates coordinates in board units (BIU) inside the file.
  793. * @todo Use mm inside the file. A general scale transform is applied to the whole
  794. * file (1.0 to have the actual WRML unit im mm, 0.001 to have the actual WRML
  795. * unit in meters.
  796. * @note For 3D models built by a 3D modeler, the unit is 0,1 inches. A specfic scale
  797. * is applied to 3D models to convert them to internal units.
  798. *
  799. * @param aFullFileName = the full filename of the file to create
  800. * @param aMMtoWRMLunit = the VRML scaling factor:
  801. * 1.0 to export in mm. 0.001 for meters
  802. * @param aExport3DFiles = true to copy 3D shapes in the subir a3D_Subdir
  803. * @param a3D_Subdir = sub directory where 3D shapes files are copied
  804. * used only when aExport3DFiles == true
  805. * @return true if Ok.
  806. */
  807. bool ExportVRML_File( const wxString & aFullFileName, double aMMtoWRMLunit,
  808. bool aExport3DFiles, const wxString & a3D_Subdir );
  809. /**
  810. * Function ExporttoSPECCTRA
  811. * will export the current BOARD to a specctra dsn file. See
  812. * See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
  813. * specification.
  814. */
  815. void ExportToSpecctra( wxCommandEvent& event );
  816. /**
  817. * Function ImportSpecctraSession
  818. * will import a specctra *.ses file and use it to relocate MODULEs and
  819. * to replace all vias and tracks in an existing and loaded BOARD.
  820. * See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
  821. * specification.
  822. */
  823. void ImportSpecctraSession( wxCommandEvent& event );
  824. /**
  825. * Function ImportSpecctraDesign
  826. * will import a specctra *.dsn file and use it to replace an entire BOARD.
  827. * The new board will not have any graphics, only components, tracks and
  828. * vias.
  829. * See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
  830. * specification.
  831. */
  832. void ImportSpecctraDesign( wxCommandEvent& event );
  833. /**
  834. * Function Access_to_External_Tool
  835. * Run an external tool (like freeroute )
  836. */
  837. void Access_to_External_Tool( wxCommandEvent& event );
  838. /**
  839. * Function ListAndSelectModuleName
  840. * builds and shows a list of existing modules on board that the user can select.
  841. * @return a pointer to the selected module or NULL.
  842. */
  843. MODULE* ListAndSelectModuleName();
  844. /**
  845. * Function ListNetsAndSelect
  846. * called by a command event
  847. * displays the sorted list of nets in a dialog frame
  848. * If a net is selected, it is highlighted
  849. */
  850. void ListNetsAndSelect( wxCommandEvent& event );
  851. void Swap_Layers( wxCommandEvent& event );
  852. // Handling texts on the board
  853. void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
  854. void FlipTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC );
  855. TEXTE_PCB* CreateTextePcb( wxDC* aDC, TEXTE_PCB* aText = NULL );
  856. void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
  857. void StartMoveTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC, bool aErase = true );
  858. void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
  859. void InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC );
  860. // Graphic Segments type DRAWSEGMENT
  861. void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
  862. void Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
  863. void InstallGraphicItemPropertiesDialog( DRAWSEGMENT* aItem, wxDC* aDC );
  864. // Footprint edition (see also PCB_BASE_FRAME)
  865. void InstallModuleOptionsFrame( MODULE* Module, wxDC* DC );
  866. /**
  867. * Function StartMoveModule
  868. * Initialize a drag or move pad command
  869. * @param aModule = the module to move or drag
  870. * @param aDC = the current device context
  871. * @param aDragConnectedTracks = true to drag connected tracks,
  872. * false to just move the module
  873. */
  874. void StartMoveModule( MODULE* aModule, wxDC* aDC, bool aDragConnectedTracks );
  875. /**
  876. * Function DlgGlobalChange_PadSettings
  877. * Function to change pad caracteristics for the given footprint
  878. * or all footprints which look like the given footprint
  879. * Options are set by the opened dialog.
  880. * @param aPad is the pattern. The given footprint is the parent of this pad
  881. * @param aRedraw: if true: redraws the footprint
  882. */
  883. void DlgGlobalChange_PadSettings( D_PAD* aPad, bool aRedraw );
  884. /**
  885. * Function Delete Module
  886. * Remove a footprint from m_Modules linked list and put it in undelete buffer
  887. * The ratsnest and pad list are recalculated
  888. * @param aModule = footprint to delete
  889. * @param aDC = currentDevice Context. if NULL: do not redraw new ratsnest
  890. * @param aAskBeforeDeleting : if true: ask for confirmation before deleting
  891. */
  892. bool Delete_Module( MODULE* aModule, wxDC* aDC, bool aAskBeforeDeleting );
  893. /**
  894. * Function Change_Side_Module
  895. * Flip a footprint (switch layer from component or component to copper)
  896. * The mirroring is made from X axis
  897. * if a footprint is not on copper or component layer it is not flipped
  898. * (it could be on an adhesive layer, not supported at this time)
  899. * @param Module the footprint to flip
  900. * @param DC Current Device Context. if NULL, no redraw
  901. */
  902. void Change_Side_Module( MODULE* Module, wxDC* DC );
  903. void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule );
  904. /**
  905. * Function Exchange_Module
  906. * Replaces OldModule by NewModule, using OldModule settings:
  907. * position, orientation, pad netnames ...)
  908. * OldModule is deleted or put in undo list.
  909. * @param aOldModule = footprint to replace
  910. * @param aNewModule = footprint to put
  911. * @param aUndoPickList = the undo list used to save OldModule. If null,
  912. * OldModule is deleted
  913. */
  914. void Exchange_Module( MODULE* aOldModule, MODULE* aNewModule,
  915. PICKED_ITEMS_LIST* aUndoPickList );
  916. // loading modules: see PCB_BASE_FRAME
  917. // Board handling
  918. void RemoveStruct( BOARD_ITEM* Item, wxDC* DC );
  919. /**
  920. * Function OnEditItemRequest
  921. * Install the corresponding dialog editor for the given item
  922. * @param aDC = the current device context
  923. * @param aItem = a pointer to the BOARD_ITEM to edit
  924. */
  925. void OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem );
  926. /**
  927. * Locate track or pad and highlight the corresponding net.
  928. * @return The Netcode, or -1 if no net located.
  929. */
  930. int SelectHighLight( wxDC* DC );
  931. /**
  932. * Function HighLight.
  933. * highlights the net at the current cursor position.
  934. */
  935. void HighLight( wxDC* DC );
  936. // Track and via edition:
  937. void Via_Edit_Control( wxCommandEvent& event );
  938. /**
  939. * Function IsMicroViaAcceptable
  940. * return true if a microvia can be placed on the board.
  941. * <p>
  942. * A microvia is a small via restricted to 2 near neighbor layers
  943. * because its is hole is made by laser which can penetrate only one layer
  944. * It is mainly used to connect BGA to the first inner layer
  945. * And it is allowed from an external layer to the first inner layer
  946. * </p>
  947. */
  948. bool IsMicroViaAcceptable( void );
  949. /**
  950. * Function Other_Layer_Route
  951. * operates in one of two ways. If argument track is NULL, then swap the
  952. * active layer between m_Route_Layer_TOP and m_Route_Layer_BOTTOM. If a
  953. * track is in progress (track is not NULL), and if DRC allows it, place
  954. * a via on the end of the current track, and then swap the current active
  955. * layer and start a new segment on the new layer.
  956. * @param track A TRACK* to append the via to or NULL.
  957. * @param DC A device context to draw on.
  958. * @return bool - true if the operation was successful, else false such as
  959. * the case where DRC would not allow a via.
  960. */
  961. bool Other_Layer_Route( TRACK* track, wxDC* DC );
  962. void HighlightUnconnectedPads( wxDC* DC );
  963. /**
  964. * Function Delete_Segment
  965. * removes a track segment.
  966. * If a new track is in progress: delete the current new segment.
  967. * Otherwise, delete segment under the mouse cursor.
  968. */
  969. TRACK* Delete_Segment( wxDC* DC, TRACK* Track );
  970. void Delete_Track( wxDC* DC, TRACK* Track );
  971. void Delete_net( wxDC* DC, TRACK* Track );
  972. /**
  973. * Function Remove_One_Track
  974. * removes 1 track/
  975. * The leading segment is removed and all adjacent segments
  976. * until a pad or a junction point of more than 2 segments is found
  977. */
  978. void Remove_One_Track( wxDC* DC, TRACK* pt_segm );
  979. /**
  980. * Function Reset_All_Tracks_And_Vias_To_Netclass_Values
  981. * Reset all tracks width and/or vias diameters and drill
  982. * to their default Netclass value
  983. * @param aTrack : bool true to modify tracks
  984. * @param aVia : bool true to modify vias
  985. */
  986. bool Reset_All_Tracks_And_Vias_To_Netclass_Values( bool aTrack, bool aVia );
  987. /**
  988. * Function Change_Net_Tracks_And_Vias_Sizes
  989. * Reset all tracks width and vias diameters and drill
  990. * to their default Netclass value or current values
  991. * @param aNetcode : the netcode of the net to edit
  992. * @param aUseNetclassValue : bool. True to use netclass values, false to
  993. * use current values
  994. */
  995. bool Change_Net_Tracks_And_Vias_Sizes( int aNetcode, bool aUseNetclassValue );
  996. /**
  997. * Function Edit_Track_Width
  998. * Modify a full track width (using DRC control).
  999. * a full track is the set of track segments between 2 ends: pads or a
  1000. * point that has more than 2 segments ends connected
  1001. * @param aDC = the curred device context (can be NULL)
  1002. * @param aTrackSegment = a segment or via on the track to change
  1003. */
  1004. void Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment );
  1005. /**
  1006. * Function Edit_TrackSegm_Width
  1007. * Modify one track segment width or one via diameter (using DRC control).
  1008. * @param aDC = the current device context (can be NULL)
  1009. * @param aTrackItem = the track segment or via to modify
  1010. */
  1011. void Edit_TrackSegm_Width( wxDC* aDC, TRACK* aTrackItem );
  1012. /**
  1013. * Function Begin_Route
  1014. * Starts a new track and/or establish of a new track point.
  1015. *
  1016. * For a new track:
  1017. * - Search the netname of the new track from the starting point
  1018. * if it is on a pad or an existing track
  1019. * - Highlight all this net
  1020. * If a track is in progress:
  1021. * - Call DRC
  1022. * - If DRC is OK: finish the track segment and starts a new one.
  1023. * @param aTrack = the current track segment, or NULL to start a new track
  1024. * @param aDC = the current device context
  1025. * @return a pointer to the new track segment or null if not created (DRC error)
  1026. */
  1027. TRACK* Begin_Route( TRACK* aTrack, wxDC* aDC );
  1028. /**
  1029. * Function End_Route
  1030. * Terminates a track currently being created
  1031. * @param aTrack = the current track segment in progress
  1032. * @param aDC = the current device context
  1033. * @return true if the track was created, false if not (due to a DRC error)
  1034. */
  1035. bool End_Route( TRACK* aTrack, wxDC* aDC );
  1036. void Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On );
  1037. void Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On );
  1038. void Attribut_net( wxDC* DC, int net_code, bool Flag_On );
  1039. /**
  1040. * Function StartMoveOneNodeOrSegment
  1041. * initializes the parameters to move one via or/and a terminal point of a track segment
  1042. * The terminal point of other connected segments (if any) are moved too.
  1043. */
  1044. void StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aCommand );
  1045. bool PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC );
  1046. /**
  1047. * @todo This function is broken, because it merge segments having different
  1048. * widths or without any connectivity test.
  1049. * 2 collinear segments can be merged only if no other segment or via is
  1050. * connected to the common point and if they have the same width. See
  1051. * cleanup.cpp for merge functions and consider MarkTrace() to locate segments
  1052. * that can be merged
  1053. */
  1054. bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end );
  1055. void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
  1056. void SwitchLayer( wxDC* DC, LAYER_NUM layer );
  1057. /**
  1058. * Function Add45DegreeSegment
  1059. * adds a track segment between 2 tracks segments if these 2 segments
  1060. * make a 90 deg angle, in order to have 45 deg track segments
  1061. * Its only works on horizontal or vertical segments.
  1062. *
  1063. * @param aDC The wxDC device context to draw on.
  1064. * @return A bool value true if ok or false if not.
  1065. */
  1066. bool Add45DegreeSegment( wxDC* aDC );
  1067. /**
  1068. * Function EraseRedundantTrack
  1069. * Called after creating a track
  1070. * Remove (if exists) the old track that have the same starting and the
  1071. * same ending point as the new created track
  1072. * (this is the redunding track)
  1073. * @param aDC = the current device context (can be NULL)
  1074. * @param aNewTrack = the new created track (a pointer to a segment of the
  1075. * track list)
  1076. * @param aNewTrackSegmentsCount = number of segments in this new track
  1077. * @param aItemsListPicker = the list picker to use for an undo command
  1078. * (can be NULL)
  1079. */
  1080. int EraseRedundantTrack( wxDC* aDC,
  1081. TRACK* aNewTrack,
  1082. int aNewTrackSegmentsCount,
  1083. PICKED_ITEMS_LIST* aItemsListPicker );
  1084. /**
  1085. * Function SetTrackSegmentWidth
  1086. * Modify one track segment width or one via diameter (using DRC control).
  1087. * Basic routine used by other routines when editing tracks or vias
  1088. * @param aTrackItem = the track segment or via to modify
  1089. * @param aItemsListPicker = the list picker to use for an undo command
  1090. * (can be NULL)
  1091. * @param aUseNetclassValue = true to use NetClass value, false to use
  1092. * current designSettings value
  1093. * @return true if done, false if no not change (because DRC error)
  1094. */
  1095. bool SetTrackSegmentWidth( TRACK* aTrackItem,
  1096. PICKED_ITEMS_LIST* aItemsListPicker,
  1097. bool aUseNetclassValue );
  1098. // zone handling
  1099. /**
  1100. * Function Delete_OldZone_Fill (obsolete)
  1101. * Used for compatibility with old boards
  1102. * Remove the zone filling which include the segment aZone, or the zone
  1103. * which have the given time stamp.
  1104. * For old boards, a zone is a group of SEGZONE segments which have the same TimeStamp
  1105. * @param aZone = zone segment within the zone to delete. Can be NULL
  1106. * @param aTimestamp = Timestamp for the zone to delete, used if aZone ==
  1107. * NULL
  1108. */
  1109. void Delete_OldZone_Fill( SEGZONE* aZone, time_t aTimestamp = 0 );
  1110. /**
  1111. * Function Delete_LastCreatedCorner
  1112. * Used only while creating a new zone outline
  1113. * Remove and delete the current outline segment in progress
  1114. * @return 0 if no corner in list, or corner number
  1115. */
  1116. int Delete_LastCreatedCorner( wxDC* DC );
  1117. /**
  1118. * Function Begin_Zone
  1119. * either initializes the first segment of a new zone, or adds an
  1120. * intermediate segment.
  1121. * A new zone can be:
  1122. * created from scratch: the user will be prompted to define parameters (layer, clearence ...)
  1123. * created from a similar zone (s_CurrentZone is used): parameters are copied from
  1124. * s_CurrentZone
  1125. * created as a cutout (an hole) inside s_CurrentZone
  1126. */
  1127. int Begin_Zone( wxDC* DC );
  1128. /**
  1129. * Function End_Zone
  1130. * terminates (if no DRC error ) the zone edge creation process
  1131. * @param DC = current Device Context
  1132. * @return true if Ok, false if DRC error
  1133. */
  1134. bool End_Zone( wxDC* DC );
  1135. /**
  1136. * Function Fill_Zone
  1137. * Calculate the zone filling for the outline zone_container
  1138. * The zone outline is a frontier, and can be complex (with holes)
  1139. * The filling starts from starting points like pads, tracks.
  1140. * If exists the old filling is removed
  1141. * @param aZone = zone to fill
  1142. * @return error level (0 = no error)
  1143. */
  1144. int Fill_Zone( ZONE_CONTAINER* aZone );
  1145. /**
  1146. * Function Fill_All_Zones
  1147. * Fill all zones on the board
  1148. * The old fillings are removed
  1149. * @param aActiveWindow = the current active window, if a progress bar is shown
  1150. * = NULL to do not display a progress bar
  1151. * @param aVerbose = true to show error messages
  1152. */
  1153. int Fill_All_Zones( wxWindow * aActiveWindow, bool aVerbose = true );
  1154. /**
  1155. * Function Add_Zone_Cutout
  1156. * Add a cutout zone to a given zone outline
  1157. * @param DC = current Device Context
  1158. * @param zone_container = parent zone outline
  1159. */
  1160. void Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container );
  1161. /**
  1162. * Function Add_Similar_Zone
  1163. * Add a zone to a given zone outline.
  1164. * if the zones are overlapping they will be merged
  1165. * @param DC = current Device Context
  1166. * @param zone_container = parent zone outline
  1167. */
  1168. void Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* zone_container );
  1169. /**
  1170. * Function Edit_Zone_Params
  1171. * Edit params (layer, clearance, ...) for a zone outline
  1172. */
  1173. void Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container );
  1174. /**
  1175. * Function Start_Move_Zone_Corner
  1176. * Prepares a move corner in a zone outline,
  1177. * called from a move corner command (IsNewCorner = false),
  1178. * or a create new cornet command (IsNewCorner = true )
  1179. */
  1180. void Start_Move_Zone_Corner( wxDC* DC,
  1181. ZONE_CONTAINER* zone_container,
  1182. int corner_id,
  1183. bool IsNewCorner );
  1184. /**
  1185. * Function Start_Move_Zone_Corner
  1186. * Prepares a drag edge in an existing zone outline,
  1187. */
  1188. void Start_Move_Zone_Drag_Outline_Edge( wxDC* DC,
  1189. ZONE_CONTAINER* zone_container,
  1190. int corner_id );
  1191. /**
  1192. * Function End_Move_Zone_Corner_Or_Outlines
  1193. * Terminates a move corner in a zone outline, or a move zone outlines
  1194. * @param DC = current Device Context (can be NULL)
  1195. * @param zone_container: the given zone
  1196. */
  1197. void End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container );
  1198. /**
  1199. * Function End_Move_Zone_Corner_Or_Outlines
  1200. * Remove the currently selected corner in a zone outline
  1201. * the .m_CornerSelection is used as corner selection
  1202. */
  1203. void Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container );
  1204. /**
  1205. * Function Delete_Zone
  1206. * Remove the zone which include the segment aZone, or the zone which have
  1207. * the given time stamp. A zone is a group of segments which have the
  1208. * same TimeStamp
  1209. * @param DC = current Device Context (can be NULL)
  1210. * @param zone_container = zone to modify
  1211. * the member .m_CornerSelection is used to find the outline to remove.
  1212. * if the outline is the main outline, all the zone is removed
  1213. * otherwise, the hole is deleted
  1214. */
  1215. void Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container );
  1216. /**
  1217. * Function Start_Move_Zone_Outlines
  1218. * Initialize parameters to move an existing zone outlines.
  1219. * @param DC = current Device Context (can be NULL)
  1220. * @param zone_container: the given zone to move
  1221. */
  1222. void Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container );
  1223. // Target handling
  1224. PCB_TARGET* CreateTarget( wxDC* DC );
  1225. void DeleteTarget( PCB_TARGET* aTarget, wxDC* DC );
  1226. void BeginMoveTarget( PCB_TARGET* aTarget, wxDC* DC );
  1227. void PlaceTarget( PCB_TARGET* aTarget, wxDC* DC );
  1228. void ShowTargetOptionsDialog( PCB_TARGET* aTarget, wxDC* DC );
  1229. // Graphic segments type DRAWSEGMENT handling:
  1230. DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC );
  1231. void End_Edge( DRAWSEGMENT* Segment, wxDC* DC );
  1232. void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
  1233. void Delete_Drawings_All_Layer( LAYER_NUM aLayer );
  1234. // Dimension handling:
  1235. void ShowDimensionPropertyDialog( DIMENSION* aDimension, wxDC* aDC );
  1236. DIMENSION* EditDimension( DIMENSION* aDimension, wxDC* aDC );
  1237. void DeleteDimension( DIMENSION* aDimension, wxDC* aDC );
  1238. void BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC );
  1239. void PlaceDimensionText( DIMENSION* aItem, wxDC* DC );
  1240. // netlist handling:
  1241. void InstallNetlistFrame( wxDC* DC );
  1242. /**
  1243. * Function ReadPcbNetlist
  1244. * reads \a aNetlistFileName and ppdates the footprints (load missing footprints and
  1245. * delete on demand extra footprints) on the board.
  1246. * Update connectivity info, references, values and "TIME STAMP"
  1247. *
  1248. * @param aNetlistFileName = netlist file name (*.net)
  1249. * @param aCmpFileName = cmp/footprint link file name (*.cmp).
  1250. * if not found or empty, only the netlist will be used
  1251. * @param aReporter is a pointer to a #REPORTER object to write display messages.
  1252. * can be NULL.
  1253. * @param aChangeFootprint if true, footprints that have changed in netlist will be changed
  1254. * @param aDeleteBadTracks if true, erroneous tracks will be deleted
  1255. * @param aDeleteExtraFootprints if true, remove unlocked footprints that are not in netlist
  1256. * @param aSelectByTimestamp if true, use timestamp instead of reference to identify
  1257. * footprints from components (use after reannotation of the
  1258. * schematic)
  1259. * @param aIsDryRun performs a dry run without making any changes if true.
  1260. */
  1261. void ReadPcbNetlist( const wxString& aNetlistFileName,
  1262. const wxString& aCmpFileName,
  1263. REPORTER* aReporter,
  1264. bool aChangeFootprint,
  1265. bool aDeleteBadTracks,
  1266. bool aDeleteExtraFootprints,
  1267. bool aSelectByTimestamp,
  1268. bool aIsDryRun );
  1269. /**
  1270. * Function RemoveMisConnectedTracks
  1271. * finds all track segments which are mis-connected (to more than one net).
  1272. * When such a bad segment is found, it is flagged to be removed.
  1273. * All tracks having at least one flagged segment are removed.
  1274. * @return true if any change is made
  1275. */
  1276. bool RemoveMisConnectedTracks();
  1277. // Autoplacement:
  1278. void AutoPlace( wxCommandEvent& event );
  1279. /**
  1280. * Function ScriptingConsoleEnableDisable
  1281. * enables or disabled the scripting console
  1282. */
  1283. void ScriptingConsoleEnableDisable( wxCommandEvent& event );
  1284. void OnSelectAutoPlaceMode( wxCommandEvent& aEvent );
  1285. /**
  1286. * Function OnOrientFootprints
  1287. * install the dialog box for the common Orient Footprints
  1288. */
  1289. void OnOrientFootprints( wxCommandEvent& event );
  1290. /**
  1291. * Function ReOrientModules
  1292. * Set the orientation of footprints
  1293. * @param ModuleMask = mask (wildcard allowed) selection
  1294. * @param Orient = new orientation
  1295. * @param include_fixe = true to orient locked footprints
  1296. * @return true if some footprints modified, false if no change
  1297. */
  1298. bool ReOrientModules( const wxString& ModuleMask, double Orient, bool include_fixe );
  1299. void LockModule( MODULE* aModule, bool aLocked );
  1300. void AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb );
  1301. /**
  1302. * Function AutoPlaceModule
  1303. * automatically places footprints within the confines of the PCB edges.
  1304. * The components with the FIXED status are not moved. If the menu is
  1305. * calling the placement of 1 module, it will be replaced.
  1306. */
  1307. void AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC );
  1308. /**
  1309. * Function GetOptimalModulePlacement
  1310. * searches for the optimal position of the \a aModule.
  1311. *
  1312. * @param aModule A pointer to the MODULE object to get the optimal placement.
  1313. * @param aDC The device context to draw on.
  1314. * @return 1 if placement impossible or 0 if OK.
  1315. */
  1316. int GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC );
  1317. void GenModuleOnBoard( MODULE* Module );
  1318. /**
  1319. * Function Compute_Ratsnest_PlaceModule
  1320. * displays the module's ratsnest during displacement, and assess the "cost"
  1321. * of the position.
  1322. *
  1323. * The cost is the longest ratsnest distance with penalty for connections
  1324. * approaching 45 degrees.
  1325. */
  1326. double Compute_Ratsnest_PlaceModule( wxDC* DC );
  1327. /**
  1328. * Function GenPlaceBoard
  1329. * generates board board (component side copper + rating):
  1330. * Allocate the memory needed to represent in "bitmap" on the grid
  1331. * Current:
  1332. * - The size of clearance area of component (the board)
  1333. * - The bitmap PENALTIES
  1334. * And initialize the cells of the board has
  1335. * - Hole in the cells occupied by a segment EDGE
  1336. * - CELL_is_ZONE for cell internal contour EDGE (if closed)
  1337. *
  1338. * Placement surface (board) gives the cells internal to the contour
  1339. * PCB, and among the latter the free cells and cells already occupied
  1340. *
  1341. * The bitmap PENALTIES give cells occupied by the modules,
  1342. * Plus a surface penalty related to the number of pads of the module
  1343. *
  1344. * Bitmap of the penalty is set to 0
  1345. * Occupation cell is a 0 leaves
  1346. */
  1347. int GenPlaceBoard();
  1348. void DrawInfoPlace( wxDC* DC );
  1349. // Autorouting:
  1350. int Solve( wxDC* DC, int two_sides );
  1351. void Reset_Noroutable( wxDC* DC );
  1352. void Autoroute( wxDC* DC, int mode );
  1353. void ReadAutoroutedTracks( wxDC* DC );
  1354. void GlobalRoute( wxDC* DC );
  1355. /**
  1356. * Function Show_1_Ratsnest
  1357. * draw ratsnest.
  1358. *
  1359. * The net edge pad with mouse or module locates the mouse.
  1360. * Delete the ratsnest if no module or pad is selected.
  1361. */
  1362. void Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC );
  1363. /**
  1364. * Function Clean_Pcb
  1365. * Clean up the board (remove redundant vias, not connected tracks
  1366. * and merges collinear track segments)
  1367. * Install the cleanup dialog frame to know what should be cleaned
  1368. * and run the cleanup function
  1369. */
  1370. void Clean_Pcb();
  1371. void InstallFindFrame();
  1372. /**
  1373. * Function SendMessageToEESCHEMA
  1374. * sends a message to the schematic editor so that it may move its cursor
  1375. * to a part with the same reference as the objectToSync
  1376. * @param objectToSync The object whose reference is used to synchronize Eeschema.
  1377. */
  1378. void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync );
  1379. /**
  1380. * Function Edit_Gap
  1381. * edits the GAP module if it has changed the position and/or size of the pads that
  1382. * form the gap get a new value.
  1383. */
  1384. void Edit_Gap( wxDC* DC, MODULE* Module );
  1385. /**
  1386. * Function Create_MuWaveBasicShape
  1387. * create a footprint with pad_count pads for micro wave applications.
  1388. * This footprint has pad_count pads:
  1389. * PAD_SMD, rectangular, H size = V size = current track width.
  1390. */
  1391. MODULE* Create_MuWaveBasicShape( const wxString& name, int pad_count );
  1392. /**
  1393. * Create_MuWaveComponent
  1394. * creates a module "GAP" or "STUB" used in micro wave designs.
  1395. * This module has 2 pads:
  1396. * PAD_SMD, rectangular, H size = V size = current track width.
  1397. * the "gap" is isolation created between this 2 pads
  1398. */
  1399. MODULE* Create_MuWaveComponent( int shape_type );
  1400. MODULE* Create_MuWavePolygonShape();
  1401. void Begin_Self( wxDC* DC );
  1402. /**
  1403. * Function Genre_Self
  1404. * creates a self-shaped coil for microwave applications.
  1405. * - Length Mself.lng
  1406. * - Extremities Mself.m_Start and Mself.m_End
  1407. *
  1408. * We must determine:
  1409. * Mself.nbrin = number of segments perpendicular to the direction
  1410. * (The coil nbrin will demicercles + 1 + 2 1 / 4 circle)
  1411. * Mself.lbrin = length of a strand
  1412. * Mself.radius = radius of rounded parts of the coil
  1413. * Mself.delta = segments extremities connection between him and the coil even
  1414. *
  1415. * The equations are
  1416. * Mself.m_Size.x = 2 * Mself.radius + Mself.lbrin
  1417. * Mself.m_Size.y * Mself.delta = 2 + 2 * Mself.nbrin * Mself.radius
  1418. * Mself.lng = 2 * Mself.delta / / connections to the coil
  1419. + (Mself.nbrin-2) * Mself.lbrin / / length of the strands except 1st and last
  1420. + (Mself.nbrin 1) * (PI * Mself.radius) / / length of rounded
  1421. * Mself.lbrin + / 2 - Melf.radius * 2) / / length of 1st and last bit
  1422. *
  1423. * The constraints are:
  1424. * Nbrin >= 2
  1425. * Mself.radius < Mself.m_Size.x
  1426. * Mself.m_Size.y = Mself.radius * 4 + 2 * Mself.raccord
  1427. * Mself.lbrin> Mself.radius * 2
  1428. *
  1429. * The calculation is conducted in the following way:
  1430. * Initially:
  1431. * Nbrin = 2
  1432. * Radius = 4 * m_Size.x (arbitrarily fixed value)
  1433. * Then:
  1434. * Increasing the number of segments to the desired length
  1435. * (Radius decreases if necessary)
  1436. *
  1437. */
  1438. MODULE* Genere_Self( wxDC* DC );
  1439. /**
  1440. * Function SetLanguage
  1441. * called on a language menu selection
  1442. */
  1443. virtual void SetLanguage( wxCommandEvent& event );
  1444. /**
  1445. * Function UpdateTitle
  1446. * sets the main window title bar text.
  1447. * <p>
  1448. * If file name defined by PCB_SCREEN::m_FileName is not set, the title is set to the
  1449. * application name appended with no file. Otherwise, the title is set to the full path
  1450. * and file name and read only is appended to the title if the user does not have write
  1451. * access to the file.
  1452. * </p>
  1453. */
  1454. void UpdateTitle();
  1455. DECLARE_EVENT_TABLE()
  1456. };
  1457. /**
  1458. * Function InvokePcbLibTableEditor
  1459. * shows the modal DIALOG_FP_LIB_TABLE for purposes of editing two lib tables.
  1460. *
  1461. * @return int - bits 0 and 1 tell whether a change was made to the @a aGlobal
  1462. * and/or the @a aProject table, respectively. If set, table was modified.
  1463. */
  1464. int InvokePcbLibTableEditor( wxFrame* aParent, FP_LIB_TABLE* aGlobal, FP_LIB_TABLE* aProject );
  1465. #endif // WXPCB_STRUCT_H_