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.

1311 lines
47 KiB

16 years ago
15 years ago
16 years ago
16 years ago
16 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
  1. /**
  2. * @file wxPcbStruct.h
  3. */
  4. #ifndef WXPCB_STRUCT_H
  5. #define WXPCB_STRUCT_H
  6. #include "wxBasePcbFrame.h"
  7. #include "param_config.h"
  8. #include "class_layer_box_selector.h"
  9. #include "class_macros_record.h"
  10. #include "class_undoredo_container.h"
  11. #ifndef PCB_INTERNAL_UNIT
  12. #define PCB_INTERNAL_UNIT 10000
  13. #endif
  14. /* Forward declarations of classes. */
  15. class PCB_SCREEN;
  16. class BOARD;
  17. class TEXTE_PCB;
  18. class MODULE;
  19. class TRACK;
  20. class SEGZONE;
  21. class SEGVIA;
  22. class D_PAD;
  23. class TEXTE_MODULE;
  24. class PCB_TARGET;
  25. class DIMENSION;
  26. class EDGE_MODULE;
  27. class DRC;
  28. class ZONE_CONTAINER;
  29. class DRAWSEGMENT;
  30. class GENERAL_COLLECTOR;
  31. class GENERAL_COLLECTORS_GUIDE;
  32. class PCB_LAYER_WIDGET;
  33. class MARKER_PCB;
  34. class BOARD_ITEM;
  35. /**
  36. * See also class PCB_BASE_FRAME(): Basic class for pcbnew and gerbview.
  37. */
  38. /*****************************************************/
  39. /* class PCB_EDIT_FRAME: the main frame for Pcbnew */
  40. /*****************************************************/
  41. class PCB_EDIT_FRAME : public PCB_BASE_FRAME
  42. {
  43. friend class PCB_LAYER_WIDGET;
  44. void updateTraceWidthSelectBox();
  45. void updateViaSizeSelectBox();
  46. int m_RecordingMacros;
  47. MACROS_RECORDED m_Macros[10];
  48. protected:
  49. PCB_LAYER_WIDGET* m_Layers;
  50. DRC* m_drc; ///< the DRC controller, see drc.cpp
  51. PARAM_CFG_ARRAY m_projectFileParams; ///< List of PCBNew project file settings.
  52. PARAM_CFG_ARRAY m_configSettings; ///< List of PCBNew configuration settings.
  53. wxString m_lastNetListRead; ///< Last net list read with relative path.
  54. // we'll use lower case function names for private member functions.
  55. void createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* aPopMenu );
  56. void createPopUpMenuForFootprints( MODULE* aModule, wxMenu* aPopMenu );
  57. void createPopUpMenuForFpTexts( TEXTE_MODULE* aText, wxMenu* aPopMenu );
  58. void createPopUpMenuForFpPads( D_PAD* aPad, wxMenu* aPopMenu );
  59. void createPopupMenuForTracks( TRACK* aTrack, wxMenu* aPopMenu );
  60. void createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu );
  61. void createPopUpBlockMenu( wxMenu* menu );
  62. void createPopUpMenuForMarkers( MARKER_PCB* aMarker, wxMenu* aPopMenu );
  63. /**
  64. * Function setActiveLayer
  65. * will change the currently active layer to \a aLayer and also
  66. * update the PCB_LAYER_WIDGET.
  67. */
  68. void setActiveLayer( int aLayer, bool doLayerWidgetUpdate = true )
  69. {
  70. ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
  71. if( doLayerWidgetUpdate )
  72. syncLayerWidget();
  73. }
  74. /**
  75. * Function getActiveLayer
  76. * returns the active layer
  77. */
  78. int getActiveLayer()
  79. {
  80. return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
  81. }
  82. /**
  83. * Function syncLayerWidget
  84. * updates the currently "selected" layer within the PCB_LAYER_WIDGET.
  85. * The currently active layer is defined by the return value of getActiveLayer().
  86. * <p>
  87. * This function cannot be inline without including layer_widget.h in
  88. * here and we do not want to do that.
  89. * </p>
  90. */
  91. void syncLayerWidget();
  92. virtual void unitsChangeRefresh();
  93. public:
  94. LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
  95. wxComboBox* m_SelTrackWidthBox; // a combo box to display and select current track width
  96. wxComboBox* m_SelViaSizeBox; // a combo box to display and select current via diameter
  97. bool m_show_microwave_tools;
  98. bool m_show_layer_manager_tools;
  99. public:
  100. PCB_EDIT_FRAME( wxWindow* father, const wxString& title,
  101. const wxPoint& pos, const wxSize& size,
  102. long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
  103. ~PCB_EDIT_FRAME();
  104. void OnQuit( wxCommandEvent& event );
  105. /**
  106. * Function ToPlotter
  107. * Open a dialog frame to create plot and drill files
  108. * relative to the current board
  109. */
  110. void ToPlotter( wxCommandEvent& event );
  111. /**
  112. * Function ToPrinter
  113. * Install the print dialog
  114. */
  115. void ToPrinter( wxCommandEvent& event );
  116. /**
  117. * Function SVG_Print
  118. * shows the print SVG file dialog.
  119. */
  120. void SVG_Print( wxCommandEvent& event );
  121. // User interface update command event handlers.
  122. void OnUpdateSave( wxUpdateUIEvent& aEvent );
  123. void OnUpdateLayerPair( wxUpdateUIEvent& aEvent );
  124. void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
  125. void OnUpdateDrcEnable( wxUpdateUIEvent& aEvent );
  126. void OnUpdateShowBoardRatsnest( wxUpdateUIEvent& aEvent );
  127. void OnUpdateShowModuleRatsnest( wxUpdateUIEvent& aEvent );
  128. void OnUpdateAutoDeleteTrack( wxUpdateUIEvent& aEvent );
  129. void OnUpdateViaDrawMode( wxUpdateUIEvent& aEvent );
  130. void OnUpdateTraceDrawMode( wxUpdateUIEvent& aEvent );
  131. void OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent );
  132. void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent );
  133. void OnUpdateShowMicrowaveToolbar( wxUpdateUIEvent& aEvent );
  134. void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
  135. void OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent );
  136. void OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent );
  137. void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent );
  138. void OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent );
  139. /**
  140. * Function RecordMacros
  141. * record sequence hotkeys and cursor position to macros.
  142. */
  143. void RecordMacros(wxDC* aDC, int aNumber);
  144. /**
  145. * Function CallMacros
  146. * play hotkeys and cursor position from recorded macros.
  147. */
  148. void CallMacros(wxDC* aDC, const wxPoint& aPosition, int aNumber);
  149. void SaveMacros();
  150. void ReadMacros();
  151. /**
  152. * Function PrintPage , virtual
  153. * used to print a page
  154. * Print the page pointed by the current screen, set by the calling print function
  155. * @param aDC = wxDC given by the calling print function
  156. * @param aPrintMaskLayer = a 32 bits mask: bit n = 1 -> layer n is printed
  157. * @param aPrintMirrorMode = true to plot mirrored
  158. * @param aData = a pointer on an auxiliary data (NULL if not used)
  159. */
  160. virtual void PrintPage( wxDC* aDC, int aPrintMaskLayer, bool aPrintMirrorMode,
  161. void * aData = NULL );
  162. void GetKicadAbout( wxCommandEvent& event );
  163. /**
  164. * Function IsGridVisible() , virtual
  165. * @return true if the grid must be shown
  166. */
  167. virtual bool IsGridVisible();
  168. /**
  169. * Function SetGridVisibility() , virtual
  170. * It may be overloaded by derived classes
  171. * if you want to store/retrieve the grid visibility in configuration.
  172. * @param aVisible = true if the grid must be shown
  173. */
  174. virtual void SetGridVisibility( bool aVisible );
  175. /**
  176. * Function GetGridColor() , virtual
  177. * @return the color of the grid
  178. */
  179. virtual int GetGridColor();
  180. /**
  181. * Function SetGridColor() , virtual
  182. * @param aColor = the new color of the grid
  183. */
  184. virtual void SetGridColor(int aColor);
  185. // Configurations:
  186. void InstallConfigFrame();
  187. void Process_Config( wxCommandEvent& event );
  188. PARAM_CFG_ARRAY& GetProjectFileParameters();
  189. void SaveProjectSettings();
  190. /**
  191. * Load the project file configuration settings.
  192. *
  193. * @param aProjectFileName = The project filename.
  194. * if not found use kicad.pro and initialize default values
  195. * @return always returns true.
  196. */
  197. bool LoadProjectSettings( const wxString& aProjectFileName );
  198. /**
  199. * Get the list of application specific settings.
  200. *
  201. * @return - Reference to the list of applications settings.
  202. */
  203. PARAM_CFG_ARRAY& GetConfigurationSettings();
  204. /**
  205. * Load applications settings specific to PCBNew.
  206. *
  207. * This overrides the base class PCB_BASE_FRAME::LoadSettings() to
  208. * handle settings specific common to the PCB layout application. It
  209. * calls down to the base class to load settings common to all PCB type
  210. * drawing frames. Please put your application settings for PCBNew here
  211. * to avoid having application settings loaded all over the place.
  212. */
  213. virtual void LoadSettings();
  214. /**
  215. * Save applications settings common to PCBNew.
  216. *
  217. * This overrides the base class PCB_BASE_FRAME::SaveSettings() to
  218. * save settings specific to the PCB layout application main window. It
  219. * calls down to the base class to save settings common to all PCB type
  220. * drawing frames. Please put your application settings for PCBNew here
  221. * to avoid having application settings saved all over the place.
  222. */
  223. virtual void SaveSettings();
  224. /**
  225. * Get the last net list read with the net list dialog box.
  226. *
  227. * @return - Absolute path and file name of the last net list file successfully read.
  228. */
  229. wxString GetLastNetListRead();
  230. /**
  231. * Set the last net list successfully read by the net list dialog box.
  232. *
  233. * Note: the file path is converted to a path relative to the project file path. If
  234. * the path cannot be made relative, than m_lastNetListRead is set to and empty
  235. * string. This could happen when the net list file is on a different drive than
  236. * the project file. The advantage of relative paths is that is more likely to
  237. * work when opening the same project from both Windows and Linux.
  238. *
  239. * @param aNetListFile - The last net list file with full path successfully read.
  240. */
  241. void SetLastNetListRead( const wxString& aNetListFile );
  242. /**
  243. * Function Test_Duplicate_Missing_And_Extra_Footprints
  244. * Build a list of duplicate, missing and extra footprints
  245. * from the current board and a netlist netlist :
  246. * Shows 3 lists:
  247. * 1 - duplicate footprints on board
  248. * 2 - missing footprints (found in netlist but not on board)
  249. * 3 - footprints not in netlist but on board
  250. * @param aNetlistFullFilename = the full filename netlist
  251. */
  252. void Test_Duplicate_Missing_And_Extra_Footprints( const wxString& aNetlistFullFilename );
  253. /**
  254. * Function OnHotKey.
  255. * ** Commands are case insensitive **
  256. * Some commands are relatives to the item under the mouse cursor
  257. * @param aDC = current device context
  258. * @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
  259. * @param aPosition The cursor position in logical (drawing) units.
  260. * @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
  261. */
  262. void OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
  263. /**
  264. * Function OnHotkeyDeleteItem
  265. * Delete the item found under the mouse cursor
  266. * Depending on the current active tool::
  267. * Tool track
  268. * if a track is in progress: Delete the last segment
  269. * else delete the entire track
  270. * Tool module (footprint):
  271. * Delete the module.
  272. * @param aDC = current device context
  273. * @return true if an item was deleted
  274. */
  275. bool OnHotkeyDeleteItem( wxDC* aDC );
  276. /**
  277. * Function OnHotkeyPlaceItem
  278. * Place the item (footprint, track, text .. ) found under the mouse cursor
  279. * An item can be placed only if there is this item currently edited
  280. * Only a footprint, a pad or a track can be placed
  281. * @param aDC = current device context
  282. * @return true if an item was placedd
  283. */
  284. bool OnHotkeyPlaceItem( wxDC* aDC );
  285. bool OnHotkeyEditItem( int aIdCommand );
  286. /**
  287. * Function OnHotkeyMoveItem
  288. * Moves or drag the item (footprint, track, text .. ) found under the mouse cursor
  289. * Only a footprint or a track can be dragged
  290. * @param aIdCommand = the hotkey command id
  291. * @return true if an item was moved
  292. */
  293. bool OnHotkeyMoveItem( int aIdCommand );
  294. /**
  295. * Function OnHotkeyRotateItem
  296. * Rotate the item (text or footprint) found under the mouse cursor
  297. * @note This command can be used with an item currently in edit.
  298. * Only some items can be rotated (footprints and texts).
  299. * @param aIdCommand = the hotkey command id
  300. * @return true if an item was moved
  301. */
  302. bool OnHotkeyRotateItem( int aIdCommand );
  303. void OnCloseWindow( wxCloseEvent& Event );
  304. void Process_Special_Functions( wxCommandEvent& event );
  305. void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
  306. void OnSelectTool( wxCommandEvent& aEvent );
  307. void ProcessMuWaveFunctions( wxCommandEvent& event );
  308. void MuWaveCommand( wxDC* DC, const wxPoint& MousePos );
  309. void RedrawActiveWindow( wxDC* DC, bool EraseBg );
  310. void ReCreateHToolbar();
  311. void ReCreateAuxiliaryToolbar();
  312. void ReCreateVToolbar();
  313. void ReCreateMicrowaveVToolbar();
  314. void ReCreateOptToolbar();
  315. void ReCreateMenuBar();
  316. LAYER_BOX_SELECTOR* ReCreateLayerBox( EDA_TOOLBAR* parent );
  317. /**
  318. * Function OnModify
  319. * must be called after a board change to set the modified flag.
  320. * <p>
  321. * Reloads the 3D view if required and calls the base PCB_BASE_FRAME::OnModify function
  322. * to update auxiliary information.
  323. * </p>
  324. */
  325. virtual void OnModify();
  326. /**
  327. * Function IsElementVisible
  328. * tests whether a given element category is visible. Keep this as an
  329. * inline function.
  330. * @param aElement is from the enum by the same name
  331. * @return bool - true if the element is visible.
  332. * @see enum PCB_VISIBLE
  333. */
  334. bool IsElementVisible( int aElement );
  335. /**
  336. * Function SetElementVisibility
  337. * changes the visibility of an element category
  338. * @param aElement is from the enum by the same name
  339. * @param aNewState = The new visibility state of the element category
  340. * @see enum PCB_VISIBLE
  341. */
  342. void SetElementVisibility( int aElement, bool aNewState );
  343. /**
  344. * Function SetVisibleAlls
  345. * Set the status of all visible element categories and layers to VISIBLE
  346. */
  347. void SetVisibleAlls();
  348. /**
  349. * Function ReFillLayerWidget
  350. * changes out all the layers in m_Layers and may be called upon
  351. * loading a new BOARD.
  352. */
  353. void ReFillLayerWidget();
  354. /**
  355. * Function Show3D_Frame
  356. * displays the 3D view of current printed circuit board.
  357. */
  358. void Show3D_Frame( wxCommandEvent& event );
  359. void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
  360. /**
  361. * Function ShowDesignRulesEditor
  362. * displays the Design Rules Editor.
  363. */
  364. void ShowDesignRulesEditor( wxCommandEvent& event );
  365. /* toolbars update UI functions: */
  366. void PrepareLayerIndicator();
  367. /* mouse functions events: */
  368. void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
  369. void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
  370. /**
  371. * Function OnRightClick
  372. * populates a popup menu with the choices appropriate for the current context.
  373. * The caller will add the ZOOM menu choices afterward.
  374. * @param aMousePos The current mouse position
  375. * @param aPopMenu The menu to add to.
  376. */
  377. bool OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu );
  378. void OnSelectOptionToolbar( wxCommandEvent& event );
  379. void ToolOnRightClick( wxCommandEvent& event );
  380. /**
  381. * Function SaveCopyInUndoList.
  382. * Creates a new entry in undo list of commands.
  383. * add a picker to handle aItemToCopy
  384. * @param aItemToCopy = the board item modified by the command to undo
  385. * @param aTypeCommand = command type (see enum UNDO_REDO_T)
  386. * @param aTransformPoint = the reference point of the transformation, for
  387. * commands like move
  388. */
  389. virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy,
  390. UNDO_REDO_T aTypeCommand,
  391. const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
  392. /**
  393. * Function SaveCopyInUndoList (overloaded).
  394. * Creates a new entry in undo list of commands.
  395. * add a list of pickers to handle a list of items
  396. * @param aItemsList = the list of items modified by the command to undo
  397. * @param aTypeCommand = command type (see enum UNDO_REDO_T)
  398. * @param aTransformPoint = the reference point of the transformation, for
  399. * commands like move
  400. */
  401. virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
  402. UNDO_REDO_T aTypeCommand,
  403. const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
  404. /**
  405. * Function PutDataInPreviousState
  406. * Used in undo or redo command.
  407. * Put data pointed by List in the previous state, i.e. the state memorized by List
  408. * @param aList = a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
  409. * @param aRedoCommand = a bool: true for redo, false for undo
  410. * @param aRebuildRatsnet = a bool: true to rebuild ratsnest (normal use), false
  411. * to just retrieve last state (used in abort commands that do not need to
  412. * rebuild ratsnest)
  413. */
  414. void PutDataInPreviousState( PICKED_ITEMS_LIST* aList,
  415. bool aRedoCommand,
  416. bool aRebuildRatsnet = true );
  417. /**
  418. * Function GetBoardFromRedoList
  419. * Redo the last edition:
  420. * - Save the current board in Undo list
  421. * - Get an old version of the board from Redo list
  422. * @return none
  423. */
  424. void GetBoardFromRedoList( wxCommandEvent& event );
  425. /**
  426. * Function GetBoardFromUndoList
  427. * Undo the last edition:
  428. * - Save the current board in Redo list
  429. * - Get an old version of the board from Undo list
  430. * @return none
  431. */
  432. void GetBoardFromUndoList( wxCommandEvent& event );
  433. /* Block operations: */
  434. /**
  435. * Function ReturnBlockCommand
  436. * Returns the block command internat code (BLOCK_MOVE, BLOCK_COPY...)
  437. * corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when
  438. * block command is started by dragging the mouse.
  439. * @param aKey = the key modifiers (Alt, Shift ...)
  440. * @return the block command id (BLOCK_MOVE, BLOCK_COPY...)
  441. */
  442. virtual int ReturnBlockCommand( int aKey );
  443. /**
  444. * Function HandleBlockPlace()
  445. * Called after HandleBlockEnd, when a block command needs to be
  446. * executed after the block is moved to its new place
  447. * (bloc move, drag, copy .. )
  448. * Parameters must be initialized in GetScreen()->m_BlockLocate
  449. */
  450. virtual void HandleBlockPlace( wxDC* DC );
  451. /**
  452. * Function HandleBlockEnd()
  453. * Handle the "end" of a block command,
  454. * i.e. is called at the end of the definition of the area of a block.
  455. * depending on the current block command, this command is executed
  456. * or parameters are initialized to prepare a call to HandleBlockPlace
  457. * in GetScreen()->m_BlockLocate
  458. * @return false if no item selected, or command finished,
  459. * true if some items found and HandleBlockPlace must be called later
  460. */
  461. virtual bool HandleBlockEnd( wxDC* DC );
  462. /**
  463. * Function Block_SelectItems
  464. * Uses GetScreen()->m_BlockLocate
  465. * select items within the selected block.
  466. * selected items are put in the pick list
  467. */
  468. void Block_SelectItems();
  469. /**
  470. * Function Block_Delete
  471. * deletes all items within the selected block.
  472. */
  473. void Block_Delete();
  474. /**
  475. * Function Block_Rotate
  476. * Rotate all items within the selected block.
  477. * The rotation center is the center of the block
  478. */
  479. void Block_Rotate();
  480. /**
  481. * Function Block_Flip
  482. * Flip items within the selected block.
  483. * The flip center is the center of the block
  484. */
  485. void Block_Flip();
  486. /**
  487. * Function Block_Move
  488. * move all items within the selected block.
  489. * New location is determined by the current offset from the selected
  490. * block's original location.
  491. */
  492. void Block_Move();
  493. /**
  494. * Function Block_Mirror_X
  495. * mirrors all items within the currently selected block in the X axis.
  496. */
  497. void Block_Mirror_X();
  498. /**
  499. * Function Block_Duplicate
  500. * Duplicate all items within the selected block.
  501. * New location is determined by the current offset from the selected
  502. * block's original location.
  503. */
  504. void Block_Duplicate();
  505. void Process_Settings( wxCommandEvent& event );
  506. void OnConfigurePcbOptions( wxCommandEvent& aEvent );
  507. void InstallDisplayOptionsDialog( wxCommandEvent& aEvent );
  508. void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
  509. bool InstallDialogNonCopperZonesEditor( ZONE_CONTAINER* aZone );
  510. void InstallDialogLayerSetup();
  511. void GenModulesPosition( wxCommandEvent& event );
  512. void GenModuleReport( wxCommandEvent& event );
  513. void InstallDrillFrame( wxCommandEvent& event );
  514. void ToPostProcess( wxCommandEvent& event );
  515. void OnFileHistory( wxCommandEvent& event );
  516. /**
  517. * Function Files_io
  518. * is the command event handler for read and write file commands.
  519. */
  520. void Files_io( wxCommandEvent& event );
  521. /**
  522. * Function LoadOnePcbFile
  523. * loads a Kicad board (.brd) from \a aFileName.
  524. *
  525. * @param aFileName - File name including path. If empty, a file dialog will
  526. * be displayed.
  527. * @param aAppend - Append board file aFileName to the currently loaded file if true.
  528. * Default = false.
  529. * @param aForceFileDialog - Display the file open dialog even if aFullFileName is
  530. * valid if true; Default = false.
  531. *
  532. * @return False if file load fails or is canceled by the user, otherwise true.
  533. */
  534. bool LoadOnePcbFile( const wxString& aFileName, bool aAppend = false,
  535. bool aForceFileDialog = false );
  536. /**
  537. * Function ReadPcbFile
  538. * reads a board file &ltfile&gt.brd
  539. * @param aReader The line reader object to read from.
  540. * @param Append if 0: a previously loaded board is deleted before loading
  541. * the file else all items of the board file are added to the
  542. * existing board
  543. */
  544. int ReadPcbFile( LINE_READER* aReader, bool Append );
  545. /**
  546. * Function SavePcbFile
  547. * writes the board data structures to \a a aFileName
  548. *
  549. * @param aFileName The file name to write or wxEmptyString to prompt user for
  550. * file name.
  551. * @return True if file was saved successfully.
  552. */
  553. bool SavePcbFile( const wxString& aFileName );
  554. int SavePcbFormatAscii( FILE* File );
  555. bool WriteGeneralDescrPcb( FILE* File );
  556. // BOARD handling
  557. /**
  558. * Function Clear_Pcb
  559. * delete all and reinitialize the current board
  560. * @param aQuery = true to prompt user for confirmation, false to initialize silently
  561. */
  562. bool Clear_Pcb( bool aQuery );
  563. // Drc control
  564. /* function GetDrcController
  565. * @return the DRC controller
  566. */
  567. DRC* GetDrcController() { return m_drc; }
  568. /**
  569. * Function RecreateBOMFileFromBoard
  570. * Recreates a .cmp file from the current loaded board
  571. * this is the same as created by cvpcb.
  572. * can be used if this file is lost
  573. */
  574. void RecreateCmpFileFromBoard( wxCommandEvent& aEvent );
  575. /**
  576. * Function RecreateBOMFileFromBoard
  577. * Creates a BOM file from the current loaded board
  578. */
  579. void RecreateBOMFileFromBoard( wxCommandEvent& aEvent );
  580. void ExportToGenCAD( wxCommandEvent& event );
  581. /**
  582. * Function OnExportVRML
  583. * will export the current BOARD to a VRML file.
  584. */
  585. void OnExportVRML( wxCommandEvent& event );
  586. /**
  587. * Function ExportVRML_File
  588. * Creates the file(s) exporting current BOARD to a VRML file.
  589. * @param aFullFileName = the full filename of the file to create
  590. * @param aScale = the general scaling factor. 1.0 to export in inches
  591. * @param aExport3DFiles = true to copy 3D shapes in the subir a3D_Subdir
  592. * @param a3D_Subdir = sub directory where 3D shapes files are copied
  593. * used only when aExport3DFiles == true
  594. * @return true if Ok.
  595. */
  596. bool ExportVRML_File( const wxString & aFullFileName, double aScale,
  597. bool aExport3DFiles, const wxString & a3D_Subdir );
  598. /**
  599. * Function ExporttoSPECCTRA
  600. * will export the current BOARD to a specctra dsn file. See
  601. * See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
  602. * specification.
  603. */
  604. void ExportToSpecctra( wxCommandEvent& event );
  605. /**
  606. * Function ImportSpecctraSession
  607. * will import a specctra *.ses file and use it to relocate MODULEs and
  608. * to replace all vias and tracks in an existing and loaded BOARD.
  609. * See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
  610. * specification.
  611. */
  612. void ImportSpecctraSession( wxCommandEvent& event );
  613. /**
  614. * Function ImportSpecctraDesign
  615. * will import a specctra *.dsn file and use it to replace an entire BOARD.
  616. * The new board will not have any graphics, only components, tracks and
  617. * vias.
  618. * See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
  619. * specification.
  620. */
  621. void ImportSpecctraDesign( wxCommandEvent& event );
  622. /**
  623. * Function Access_to_External_Tool
  624. * Run an external tool (like freeroute )
  625. */
  626. void Access_to_External_Tool( wxCommandEvent& event );
  627. MODULE* ListAndSelectModuleName();
  628. /**
  629. * Function ListNetsAndSelect
  630. * called by a command event
  631. * displays the sorted list of nets in a dialog frame
  632. * If a net is selected, it is highlighted
  633. */
  634. void ListNetsAndSelect( wxCommandEvent& event );
  635. void Swap_Layers( wxCommandEvent& event );
  636. // Handling texts on the board
  637. void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
  638. TEXTE_PCB* Create_Texte_Pcb( wxDC* DC );
  639. void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
  640. void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC );
  641. void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
  642. void InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC );
  643. // Graphic Segments type DRAWSEGMENT
  644. void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
  645. void Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
  646. void InstallGraphicItemPropertiesDialog( DRAWSEGMENT* aItem, wxDC* aDC );
  647. // Footprint edition (see also PCB_BASE_FRAME)
  648. void InstallModuleOptionsFrame( MODULE* Module, wxDC* DC );
  649. void StartMove_Module( MODULE* module, wxDC* DC );
  650. /**
  651. * Function Delete Module
  652. * Remove a footprint from m_Modules linked list and put it in undelete buffer
  653. * The ratsnest and pad list are recalculated
  654. * @param aModule = footprint to delete
  655. * @param aDC = currentDevice Context. if NULL: do not redraw new ratsnest
  656. * @param aAskBeforeDeleting : if true: ask for confirmation before deleting
  657. */
  658. bool Delete_Module( MODULE* aModule, wxDC* aDC, bool aAskBeforeDeleting );
  659. /**
  660. * Function Change_Side_Module
  661. * Flip a footprint (switch layer from component or component to copper)
  662. * The mirroring is made from X axis
  663. * if a footprint is not on copper or component layer it is not flipped
  664. * (it could be on an adhesive layer, not supported at this time)
  665. * @param Module the footprint to flip
  666. * @param DC Current Device Context. if NULL, no redraw
  667. */
  668. void Change_Side_Module( MODULE* Module, wxDC* DC );
  669. void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule );
  670. /**
  671. * Function Exchange_Module
  672. * Replaces OldModule by NewModule, using OldModule settings:
  673. * position, orientation, pad netnames ...)
  674. * OldModule is deleted or put in undo list.
  675. * @param aOldModule = footprint to replace
  676. * @param aNewModule = footprint to put
  677. * @param aUndoPickList = the undo list used to save OldModule. If null,
  678. * OldModule is deleted
  679. */
  680. void Exchange_Module( MODULE* aOldModule, MODULE* aNewModule,
  681. PICKED_ITEMS_LIST* aUndoPickList );
  682. // loading modules: see PCB_BASE_FRAME
  683. // Board handling
  684. void RemoveStruct( BOARD_ITEM* Item, wxDC* DC );
  685. /**
  686. * Function OnEditItemRequest
  687. * Install the corresponding dialog editor for the given item
  688. * @param aDC = the current device context
  689. * @param aItem = a pointer to the BOARD_ITEM to edit
  690. */
  691. void OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem );
  692. // Highlight functions:
  693. int Select_High_Light( wxDC* DC );
  694. void High_Light( wxDC* DC );
  695. // Track and via edition:
  696. void Via_Edit_Control( wxCommandEvent& event );
  697. /**
  698. * Function IsMicroViaAcceptable
  699. * return true if a microvia can be placed on the board.
  700. * <p>
  701. * A microvia is a small via restricted to 2 near neighbor layers
  702. * because its is hole is made by laser which can penetrate only one layer
  703. * It is mainly used to connect BGA to the first inner layer
  704. * And it is allowed from an external layer to the first inner layer
  705. * </p>
  706. */
  707. bool IsMicroViaAcceptable( void );
  708. /**
  709. * Function Other_Layer_Route
  710. * operates in one of two ways. If argument track is NULL, then swap the
  711. * active layer between m_Route_Layer_TOP and m_Route_Layer_BOTTOM. If a
  712. * track is in progress (track is not NULL), and if DRC allows it, place
  713. * a via on the end of the current track, and then swap the current active
  714. * layer and start a new segment on the new layer.
  715. * @param track A TRACK* to append the via to or NULL.
  716. * @param DC A device context to draw on.
  717. * @return bool - true if the operation was successful, else false such as
  718. * the case where DRC would not allow a via.
  719. */
  720. bool Other_Layer_Route( TRACK* track, wxDC* DC );
  721. void HighlightUnconnectedPads( wxDC* DC );
  722. /**
  723. * Function DisplayNetStatus
  724. * shows the status of the net at the current mouse position or the
  725. * PCB status if no segment selected.
  726. */
  727. void DisplayNetStatus( wxDC* DC );
  728. TRACK* Delete_Segment( wxDC* DC, TRACK* Track );
  729. void Delete_Track( wxDC* DC, TRACK* Track );
  730. void Delete_net( wxDC* DC, TRACK* Track );
  731. void Remove_One_Track( wxDC* DC, TRACK* pt_segm );
  732. /**
  733. * Function Reset_All_Tracks_And_Vias_To_Netclass_Values
  734. * Reset all tracks width and/or vias diameters and drill
  735. * to their default Netclass value
  736. * @param aTrack : bool true to modify tracks
  737. * @param aVia : bool true to modify vias
  738. */
  739. bool Reset_All_Tracks_And_Vias_To_Netclass_Values( bool aTrack, bool aVia );
  740. /**
  741. * Function Change_Net_Tracks_And_Vias_Sizes
  742. * Reset all tracks width and vias diameters and drill
  743. * to their default Netclass value or current values
  744. * @param aNetcode : the netcode of the net to edit
  745. * @param aUseNetclassValue : bool. True to use netclass values, false to
  746. * use current values
  747. */
  748. bool Change_Net_Tracks_And_Vias_Sizes( int aNetcode, bool aUseNetclassValue );
  749. /**
  750. * Function Edit_Track_Width
  751. * Modify a full track width (using DRC control).
  752. * a full track is the set of track segments between 2 ends: pads or a
  753. * point that has more than 2 segments ends connected
  754. * @param aDC = the curred device context (can be NULL)
  755. * @param aTrackSegment = a segment or via on the track to change
  756. */
  757. void Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment );
  758. /**
  759. * Function Edit_TrackSegm_Width
  760. * Modify one track segment width or one via diameter (using DRC control).
  761. * @param aDC = the current device context (can be NULL)
  762. * @param aTrackItem = the track segment or via to modify
  763. */
  764. void Edit_TrackSegm_Width( wxDC* aDC, TRACK* aTrackItem );
  765. /**
  766. * Function Begin_Route
  767. * Starts a new track and/or establish of a new track point.
  768. *
  769. * For a new track:
  770. * - Search the netname of the new track from the starting point
  771. * if it is on a pad or an existing track
  772. * - Highlight all this net
  773. * If a track is in progress:
  774. * - Call DRC
  775. * - If DRC is OK: finish the track segment and starts a new one.
  776. * @param aTrack = the current track segment, or NULL to start a new track
  777. * @param aDC = the current device context
  778. * @return a pointer to the new track segment or null if not created (DRC error)
  779. */
  780. TRACK* Begin_Route( TRACK* aTrack, wxDC* aDC );
  781. /**
  782. * Function End_Route
  783. * Terminates a track currently being created
  784. * @param aTrack = the current track segment in progress
  785. * @param aDC = the current device context
  786. * @return true if the track was created, false if not (due to a DRC error)
  787. */
  788. bool End_Route( TRACK* aTrack, wxDC* aDC );
  789. void Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On );
  790. void Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On );
  791. void Attribut_net( wxDC* DC, int net_code, bool Flag_On );
  792. /**
  793. * Function StartMoveOneNodeOrSegment
  794. * initializes the parameters to move one via or/and a terminal point of a track segment
  795. * The terminal point of other connected segments (if any) are moved too.
  796. */
  797. void StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aCommand );
  798. bool PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC );
  799. /**
  800. * @todo This function is broken, because it merge segments having different
  801. * widths or without any connectivity test.
  802. * 2 collinear segments can be merged only if no other segment or via is
  803. * connected to the common point and if they have the same width. See
  804. * cleanup.cpp for merge functions and consider MarkTrace() to locate segments
  805. * that can be merged
  806. */
  807. bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end );
  808. void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
  809. void SwitchLayer( wxDC* DC, int layer );
  810. /**
  811. * Function Add45DegreeSegment
  812. * adds a track segment between 2 tracks segments if these 2 segments
  813. * make a 90 deg angle, in order to have 45 deg track segments
  814. * Its only works on horizontal or vertical segments.
  815. *
  816. * @param aDC The wxDC device context to draw on.
  817. * @return A bool value true if ok or false if not.
  818. */
  819. bool Add45DegreeSegment( wxDC* aDC );
  820. /**
  821. * Function EraseRedundantTrack
  822. * Called after creating a track
  823. * Remove (if exists) the old track that have the same starting and the
  824. * same ending point as the new created track
  825. * (this is the redunding track)
  826. * @param aDC = the current device context (can be NULL)
  827. * @param aNewTrack = the new created track (a pointer to a segment of the
  828. * track list)
  829. * @param aNewTrackSegmentsCount = number of segments in this new track
  830. * @param aItemsListPicker = the list picker to use for an undo command
  831. * (can be NULL)
  832. */
  833. int EraseRedundantTrack( wxDC* aDC,
  834. TRACK* aNewTrack,
  835. int aNewTrackSegmentsCount,
  836. PICKED_ITEMS_LIST* aItemsListPicker );
  837. /**
  838. * Function SetTrackSegmentWidth
  839. * Modify one track segment width or one via diameter (using DRC control).
  840. * Basic routine used by other routines when editing tracks or vias
  841. * @param aTrackItem = the track segment or via to modify
  842. * @param aItemsListPicker = the list picker to use for an undo command
  843. * (can be NULL)
  844. * @param aUseNetclassValue = true to use NetClass value, false to use
  845. * current designSettings value
  846. * @return true if done, false if no not change (because DRC error)
  847. */
  848. bool SetTrackSegmentWidth( TRACK* aTrackItem,
  849. PICKED_ITEMS_LIST* aItemsListPicker,
  850. bool aUseNetclassValue );
  851. // zone handling
  852. /**
  853. * Function Delete_OldZone_Fill (obsolete)
  854. * Used for compatibility with old boards
  855. * Remove the zone filling which include the segment aZone, or the zone
  856. * which have the given time stamp.
  857. * For old boards, a zone is a group of SEGZONE segments which have the same TimeStamp
  858. * @param aZone = zone segment within the zone to delete. Can be NULL
  859. * @param aTimestamp = Timestamp for the zone to delete, used if aZone ==
  860. * NULL
  861. */
  862. void Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp = 0 );
  863. /**
  864. * Function Delete_LastCreatedCorner
  865. * Used only while creating a new zone outline
  866. * Remove and delete the current outline segment in progress
  867. * @return 0 if no corner in list, or corner number
  868. */
  869. int Delete_LastCreatedCorner( wxDC* DC );
  870. /**
  871. * Function Begin_Zone
  872. * initiates a zone edge creation process,
  873. * or terminates the current zone edge and creates a new zone edge stub
  874. */
  875. int Begin_Zone( wxDC* DC );
  876. /**
  877. * Function End_Zone
  878. * terminates (if no DRC error ) the zone edge creation process
  879. * @param DC = current Device Context
  880. * @return true if Ok, false if DRC error
  881. */
  882. bool End_Zone( wxDC* DC );
  883. /**
  884. * Function Fill_Zone
  885. * Calculate the zone filling for the outline zone_container
  886. * The zone outline is a frontier, and can be complex (with holes)
  887. * The filling starts from starting points like pads, tracks.
  888. * If exists the old filling is removed
  889. * @param zone_container = zone to fill
  890. * @param verbose = true to show error messages
  891. * @return error level (0 = no error)
  892. */
  893. int Fill_Zone( ZONE_CONTAINER* zone_container, bool verbose = TRUE );
  894. /**
  895. * Function Fill_All_Zones
  896. * Fill all zones on the board
  897. * The old fillings are removed
  898. * @param verbose = true to show error messages
  899. * @return error level (0 = no error)
  900. */
  901. int Fill_All_Zones( bool verbose = TRUE );
  902. /**
  903. * Function Add_Zone_Cutout
  904. * Add a cutout zone to a given zone outline
  905. * @param DC = current Device Context
  906. * @param zone_container = parent zone outline
  907. */
  908. void Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container );
  909. /**
  910. * Function Add_Similar_Zone
  911. * Add a zone to a given zone outline.
  912. * if the zones are overlapping they will be merged
  913. * @param DC = current Device Context
  914. * @param zone_container = parent zone outline
  915. */
  916. void Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* zone_container );
  917. /**
  918. * Function Edit_Zone_Params
  919. * Edit params (layer, clearance, ...) for a zone outline
  920. */
  921. void Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container );
  922. /**
  923. * Function Start_Move_Zone_Corner
  924. * Prepares a move corner in a zone outline,
  925. * called from a move corner command (IsNewCorner = false),
  926. * or a create new cornet command (IsNewCorner = true )
  927. */
  928. void Start_Move_Zone_Corner( wxDC* DC,
  929. ZONE_CONTAINER* zone_container,
  930. int corner_id,
  931. bool IsNewCorner );
  932. /**
  933. * Function Start_Move_Zone_Corner
  934. * Prepares a drag edge in an existing zone outline,
  935. */
  936. void Start_Move_Zone_Drag_Outline_Edge( wxDC* DC,
  937. ZONE_CONTAINER* zone_container,
  938. int corner_id );
  939. /**
  940. * Function End_Move_Zone_Corner_Or_Outlines
  941. * Terminates a move corner in a zone outline, or a move zone outlines
  942. * @param DC = current Device Context (can be NULL)
  943. * @param zone_container: the given zone
  944. */
  945. void End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container );
  946. /**
  947. * Function End_Move_Zone_Corner_Or_Outlines
  948. * Remove the currently selected corner in a zone outline
  949. * the .m_CornerSelection is used as corner selection
  950. */
  951. void Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container );
  952. /**
  953. * Function Delete_Zone
  954. * Remove the zone which include the segment aZone, or the zone which have
  955. * the given time stamp. A zone is a group of segments which have the
  956. * same TimeStamp
  957. * @param DC = current Device Context (can be NULL)
  958. * @param zone_container = zone to modify
  959. * the member .m_CornerSelection is used to find the outline to remove.
  960. * if the outline is the main outline, all the zone is removed
  961. * otherwise, the hole is deleted
  962. */
  963. void Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container );
  964. /**
  965. * Function Start_Move_Zone_Outlines
  966. * Initialize parameters to move an existing zone outlines.
  967. * @param DC = current Device Context (can be NULL)
  968. * @param zone_container: the given zone to move
  969. */
  970. void Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container );
  971. // Target handling
  972. PCB_TARGET* CreateTarget( wxDC* DC );
  973. void DeleteTarget( PCB_TARGET* aTarget, wxDC* DC );
  974. void BeginMoveTarget( PCB_TARGET* aTarget, wxDC* DC );
  975. void PlaceTarget( PCB_TARGET* aTarget, wxDC* DC );
  976. void ShowTargetOptionsDialog( PCB_TARGET* aTarget, wxDC* DC );
  977. // Graphic segments type DRAWSEGMENT handling:
  978. DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, wxDC* DC );
  979. void End_Edge( DRAWSEGMENT* Segment, wxDC* DC );
  980. void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
  981. void Delete_Drawings_All_Layer( int aLayer );
  982. // Dimension handling:
  983. void Install_Edit_Dimension( DIMENSION* Dimension, wxDC* DC );
  984. DIMENSION* Begin_Dimension( DIMENSION* Dimension, wxDC* DC );
  985. void Delete_Dimension( DIMENSION* Dimension, wxDC* DC );
  986. // netlist handling:
  987. void InstallNetlistFrame( wxDC* DC );
  988. /**
  989. * Function ReadPcbNetlist
  990. * Update footprints (load missing footprints and delete on demand extra
  991. * footprints)
  992. * Update connectivity info, references, values and "TIME STAMP"
  993. * @param aNetlistFullFilename = netlist file name (*.net)
  994. * @param aCmpFullFileName = cmp/footprint link file name (*.cmp).
  995. * if not found, only the netlist will be used
  996. * @param aMessageWindow = a reference to a wxTextCtrl where to display messages.
  997. * can be NULL
  998. * @param aChangeFootprint if true, footprints that have changed in netlist will be changed
  999. * @param aDeleteBadTracks if true, erroneous tracks will be deleted
  1000. * @param aDeleteExtraFootprints if true, remove unlocked footprints that are not in netlist
  1001. * @param aSelect_By_Timestamp if true, use timestamp instead of reference to identify
  1002. * footprints from components (use after reannotation of the
  1003. * schematic)
  1004. * @return true if Ok
  1005. */
  1006. bool ReadPcbNetlist( const wxString& aNetlistFullFilename,
  1007. const wxString& aCmpFullFileName,
  1008. wxTextCtrl* aMessageWindow,
  1009. bool aChangeFootprint,
  1010. bool aDeleteBadTracks,
  1011. bool aDeleteExtraFootprints,
  1012. bool aSelect_By_Timestamp );
  1013. /**
  1014. * Function RemoveMisConnectedTracks
  1015. * finds all track segments which are mis-connected (to more than one net).
  1016. * When such a bad segment is found, mark it as needing to be removed.
  1017. * and remove all tracks having at least one flagged segment.
  1018. * @param aDC = the current device context (can be NULL)
  1019. * @return true if any change is made
  1020. */
  1021. bool RemoveMisConnectedTracks( wxDC* aDC );
  1022. // Autoplacement:
  1023. void AutoPlace( wxCommandEvent& event );
  1024. /**
  1025. * Function OnOrientFootprints
  1026. * install the dialog box for the common Orient Footprints
  1027. */
  1028. void OnOrientFootprints( wxCommandEvent& event );
  1029. /**
  1030. * Function ReOrientModules
  1031. * Set the orientation of footprints
  1032. * @param ModuleMask = mask (wildcard allowed) selection
  1033. * @param Orient = new orientation
  1034. * @param include_fixe = true to orient locked footprints
  1035. * @return true if some footprints modified, false if no change
  1036. */
  1037. bool ReOrientModules( const wxString& ModuleMask, int Orient,
  1038. bool include_fixe );
  1039. void LockModule( MODULE* aModule, bool aLocked );
  1040. void AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb );
  1041. void AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC );
  1042. /**
  1043. * Function GetOptimalModulePlacement
  1044. * searches for the optimal position of the \a aModule.
  1045. *
  1046. * @param aModule A pointer to the MODULE object to get the optimal placement.
  1047. * @param aDC The device context to draw on.
  1048. * @return 1 if placement impossible or 0 if OK.
  1049. */
  1050. int GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC );
  1051. void GenModuleOnBoard( MODULE* Module );
  1052. float Compute_Ratsnest_PlaceModule( wxDC* DC );
  1053. /**
  1054. * Function GenPlaceBoard
  1055. * generates board board (component side copper + rating):
  1056. * Allocate the memory needed to represent in "bitmap" on the grid
  1057. * Current:
  1058. * - The size of clearance area of component (the board)
  1059. * - The bitmap PENALTIES
  1060. * And initialize the cells of the board has
  1061. * - Hole in the cells occupied by a segment EDGE
  1062. * - CELL_is_ZONE for cell internal contour EDGE (if closed)
  1063. *
  1064. * Placement surface (board) gives the cells internal to the contour
  1065. * PCB, and among the latter the free cells and cells already occupied
  1066. *
  1067. * The bitmap PENALTIES give cells occupied by the modules,
  1068. * Plus a surface penalty related to the number of pads of the module
  1069. *
  1070. * Bitmap of the penalty is set to 0
  1071. * Occupation cell is a 0 leaves
  1072. */
  1073. int GenPlaceBoard();
  1074. void DrawInfoPlace( wxDC* DC );
  1075. // Autorouting:
  1076. int Solve( wxDC* DC, int two_sides );
  1077. void Reset_Noroutable( wxDC* DC );
  1078. void Autoroute( wxDC* DC, int mode );
  1079. void ReadAutoroutedTracks( wxDC* DC );
  1080. void GlobalRoute( wxDC* DC );
  1081. /**
  1082. * Function Show_1_Ratsnest
  1083. * draw ratsnest.
  1084. *
  1085. * The net edge pad with mouse or module locates the mouse.
  1086. * Delete the ratsnest if no module or pad is selected.
  1087. */
  1088. void Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC );
  1089. void Clean_Pcb( wxDC* DC );
  1090. void InstallFindFrame( const wxPoint& pos, wxDC* DC );
  1091. /**
  1092. * Function SendMessageToEESCHEMA
  1093. * sends a message to the schematic editor so that it may move its cursor
  1094. * to a part with the same reference as the objectToSync
  1095. * @param objectToSync The object whose reference is used to synchronize
  1096. * eeschema.
  1097. */
  1098. void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync );
  1099. /* Micro waves functions */
  1100. void Edit_Gap( wxDC* DC, MODULE* Module );
  1101. MODULE* Create_MuWaveBasicShape( const wxString& name, int pad_count );
  1102. MODULE* Create_MuWaveComponent( int shape_type );
  1103. MODULE* Create_MuWavePolygonShape();
  1104. void Begin_Self( wxDC* DC );
  1105. MODULE* Genere_Self( wxDC* DC );
  1106. /**
  1107. * Function SetLanguage
  1108. * called on a language menu selection
  1109. */
  1110. virtual void SetLanguage( wxCommandEvent& event );
  1111. /**
  1112. * Function UpdateTitle
  1113. * sets the main window title bar text.
  1114. * <p>
  1115. * If file name defined by PCB_SCREEN::m_FileName is not set, the title is set to the
  1116. * application name appended with no file. Otherwise, the title is set to the full path
  1117. * and file name and read only is appended to the title if the user does not have write
  1118. * access to the file.
  1119. * </p>
  1120. */
  1121. void UpdateTitle();
  1122. DECLARE_EVENT_TABLE()
  1123. };
  1124. #endif /* WXPCB_STRUCT_H */