2011-09-15 17:58:35 +00:00
|
|
|
/**
|
2011-09-16 14:13:02 +00:00
|
|
|
* @file wxBasePcbFrame.h
|
2011-09-30 18:15:37 +00:00
|
|
|
* @brief Classes used in Pcbnew, CvPcb and GerbView.
|
2011-09-15 17:58:35 +00:00
|
|
|
*/
|
2009-07-30 11:04:07 +00:00
|
|
|
|
|
|
|
#ifndef WX_BASE_PCB_FRAME_H
|
|
|
|
#define WX_BASE_PCB_FRAME_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "wxstruct.h"
|
|
|
|
#include "base_struct.h"
|
2011-01-14 17:43:30 +00:00
|
|
|
#include "richio.h"
|
2011-02-05 02:21:11 +00:00
|
|
|
#include "class_pcb_screen.h"
|
2009-07-30 11:04:07 +00:00
|
|
|
|
|
|
|
#ifndef PCB_INTERNAL_UNIT
|
|
|
|
#define PCB_INTERNAL_UNIT 10000
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2011-09-26 20:32:56 +00:00
|
|
|
/* Forward declarations of classes. */
|
2011-08-26 17:01:17 +00:00
|
|
|
class FOOTPRINT_EDIT_FRAME;
|
2009-07-30 11:04:07 +00:00
|
|
|
class BOARD;
|
|
|
|
class MODULE;
|
|
|
|
class TRACK;
|
|
|
|
class D_PAD;
|
|
|
|
class TEXTE_MODULE;
|
2011-08-03 15:09:39 +00:00
|
|
|
class EDA_3D_FRAME;
|
2009-07-30 11:04:07 +00:00
|
|
|
class GENERAL_COLLECTOR;
|
|
|
|
class GENERAL_COLLECTORS_GUIDE;
|
|
|
|
|
|
|
|
|
2011-09-26 20:32:56 +00:00
|
|
|
/**
|
|
|
|
* class PCB_BASE_FRAME
|
2011-09-30 18:15:37 +00:00
|
|
|
* basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
|
2011-09-26 20:32:56 +00:00
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
class PCB_BASE_FRAME : public EDA_DRAW_FRAME
|
2009-07-30 11:04:07 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool m_DisplayPadFill; // How show pads
|
2009-09-29 04:44:35 +00:00
|
|
|
bool m_DisplayViaFill; // How show vias
|
2009-07-30 11:04:07 +00:00
|
|
|
bool m_DisplayPadNum; // show pads numbers
|
|
|
|
|
2010-01-27 20:07:50 +00:00
|
|
|
int m_DisplayModEdge; // How to display module drawings (line/ filled / sketch)
|
|
|
|
int m_DisplayModText; // How to display module texts (line/ filled / sketch)
|
2011-09-29 16:49:40 +00:00
|
|
|
bool m_DisplayPcbTrackFill; // FALSE : tracks are show in sketch mode, TRUE = filled.
|
2011-09-15 17:58:35 +00:00
|
|
|
EDA_UNITS_T m_UserGridUnit;
|
|
|
|
wxRealPoint m_UserGridSize;
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
int m_FastGrid1;
|
|
|
|
int m_FastGrid2;
|
2011-09-09 11:02:03 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
EDA_3D_FRAME* m_Draw3DFrame;
|
|
|
|
FOOTPRINT_EDIT_FRAME* m_ModuleEditFrame;
|
2009-07-30 11:04:07 +00:00
|
|
|
|
|
|
|
protected:
|
2011-09-15 17:58:35 +00:00
|
|
|
BOARD* m_Pcb;
|
|
|
|
GENERAL_COLLECTOR* m_Collector;
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
void updateGridSelectBox();
|
|
|
|
void updateZoomSelectBox();
|
2011-03-01 19:26:17 +00:00
|
|
|
virtual void unitsChangeRefresh();
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2009-07-30 11:04:07 +00:00
|
|
|
public:
|
2011-03-01 19:26:17 +00:00
|
|
|
PCB_BASE_FRAME( wxWindow* father, int idtype, const wxString& title,
|
|
|
|
const wxPoint& pos, const wxSize& size,
|
|
|
|
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
~PCB_BASE_FRAME();
|
2009-07-30 11:04:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetBoard
|
|
|
|
* sets the m_Pcb member in such as way as to ensure deleting any previous
|
|
|
|
* BOARD.
|
|
|
|
* @param aBoard The BOARD to put into the frame.
|
|
|
|
*/
|
|
|
|
void SetBoard( BOARD* aBoard );
|
|
|
|
|
|
|
|
BOARD* GetBoard()
|
|
|
|
{
|
2011-09-30 18:15:37 +00:00
|
|
|
wxASSERT( m_Pcb ); // phasing out m_Pcb for GerbView
|
2009-07-30 11:04:07 +00:00
|
|
|
return m_Pcb;
|
|
|
|
}
|
|
|
|
|
|
|
|
// General
|
2011-09-15 17:58:35 +00:00
|
|
|
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
|
|
|
|
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { }
|
|
|
|
virtual void ReCreateHToolbar() = 0;
|
|
|
|
virtual void ReCreateVToolbar() = 0;
|
|
|
|
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
|
|
|
|
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) = 0;
|
|
|
|
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
|
|
|
|
virtual void ReCreateMenuBar();
|
|
|
|
virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg );
|
|
|
|
virtual void UpdateStatusBar();
|
2009-11-23 20:18:47 +00:00
|
|
|
|
2011-02-05 02:21:11 +00:00
|
|
|
virtual PCB_SCREEN* GetScreen() const
|
2009-11-23 20:18:47 +00:00
|
|
|
{
|
2011-02-05 02:21:11 +00:00
|
|
|
return (PCB_SCREEN*) EDA_DRAW_FRAME::GetScreen();
|
2009-11-23 20:18:47 +00:00
|
|
|
}
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
virtual double BestZoom();
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
virtual void Show3D_Frame( wxCommandEvent& event );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2009-11-23 20:18:47 +00:00
|
|
|
// Read/write functions:
|
2011-01-14 17:43:30 +00:00
|
|
|
EDA_ITEM* ReadDrawSegmentDescr( LINE_READER* aReader );
|
2011-09-15 17:58:35 +00:00
|
|
|
int ReadListeSegmentDescr( LINE_READER* aReader,
|
|
|
|
TRACK* PtSegm,
|
|
|
|
int StructType,
|
|
|
|
int NumSegm );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
int ReadSetup( LINE_READER* aReader );
|
|
|
|
int ReadGeneralDescrPcb( LINE_READER* aReader );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function PcbGeneralLocateAndDisplay
|
|
|
|
* searches for an item under the mouse cursor.
|
|
|
|
* Items are searched first on the current working layer.
|
2009-11-23 20:18:47 +00:00
|
|
|
* If nothing found, an item will be searched without layer restriction.
|
|
|
|
* If more than one item is found meeting the current working layer
|
|
|
|
* criterion, then a popup menu is shown which allows the user to pick
|
|
|
|
* which item he/she is interested in. Once an item is chosen, then it
|
|
|
|
* is make the "current item" and the status window is updated to reflect
|
|
|
|
* this.
|
2009-07-30 11:04:07 +00:00
|
|
|
*
|
2009-11-23 20:18:47 +00:00
|
|
|
* @param aHotKeyCode The hotkey which relates to the caller and determines
|
|
|
|
* the type of search to be performed. If zero, then
|
|
|
|
* the mouse tools will be tested instead.
|
2009-07-30 11:04:07 +00:00
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
BOARD_ITEM* PcbGeneralLocateAndDisplay( int aHotKeyCode = 0 );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
void ProcessItemSelection( wxCommandEvent& event );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetCurItem
|
|
|
|
* sets the currently selected item and displays it in the MsgPanel.
|
|
|
|
* If the given item is NULL then the MsgPanel is erased and there is no
|
|
|
|
* currently selected item. This function is intended to make the process
|
|
|
|
* of "selecting" an item more formal, and to indivisibly tie the operation
|
|
|
|
* of selecting an item to displaying it using BOARD_ITEM::Display_Infos().
|
|
|
|
* @param aItem The BOARD_ITEM to make the selected item or NULL if none.
|
2011-09-15 17:58:35 +00:00
|
|
|
* @param aDisplayInfo = true to display item info, false if not (default = true)
|
2009-07-30 11:04:07 +00:00
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
void SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo = true );
|
|
|
|
|
|
|
|
BOARD_ITEM* GetCurItem();
|
2009-07-30 11:04:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCollectorsGuide
|
2009-11-23 20:18:47 +00:00
|
|
|
* @return GENERAL_COLLECTORS_GUIDE - that considers the global
|
|
|
|
*configuration options.
|
2009-07-30 11:04:07 +00:00
|
|
|
*/
|
|
|
|
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function CursorGoto
|
2011-09-29 16:49:40 +00:00
|
|
|
* positions the cursor at a given coordinate and reframes the drawing if the
|
2009-07-30 11:04:07 +00:00
|
|
|
* requested point is out of view.
|
|
|
|
* @param aPos The point to go to.
|
|
|
|
*/
|
2011-09-29 16:49:40 +00:00
|
|
|
void CursorGoto( const wxPoint& aPos );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function Save_Module_In_Library
|
2009-07-30 11:04:07 +00:00
|
|
|
* Save in an existing library a given footprint
|
|
|
|
* @param aLibName = name of the library to use
|
|
|
|
* @param aModule = the given footprint
|
2009-11-23 20:18:47 +00:00
|
|
|
* @param aOverwrite = true to overwrite an existing footprint, false to
|
|
|
|
* abort an existing footprint is found
|
|
|
|
* @param aDisplayDialog = true to display a dialog to enter or confirm the
|
|
|
|
* footprint name
|
2011-02-22 20:59:16 +00:00
|
|
|
* @return : true if OK, false if abort
|
2009-07-30 11:04:07 +00:00
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
bool Save_Module_In_Library( const wxString& aLibName,
|
|
|
|
MODULE* aModule,
|
|
|
|
bool aOverwrite,
|
|
|
|
bool aDisplayDialog );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
/**
|
|
|
|
* Function Archive_Modules
|
|
|
|
* Save in the library:
|
|
|
|
* All new modules (ie modules not found in this lib) (if NewModulesOnly == true)
|
|
|
|
* all modules (if NewModulesOnly == false)
|
|
|
|
*/
|
|
|
|
void Archive_Modules( const wxString& LibName, bool NewModulesOnly );
|
|
|
|
|
2009-11-23 20:18:47 +00:00
|
|
|
MODULE* GetModuleByName();
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2010-11-12 16:59:16 +00:00
|
|
|
* Function OnModify
|
2010-02-19 13:23:58 +00:00
|
|
|
* Virtual
|
2010-05-01 12:46:33 +00:00
|
|
|
* Must be called after a change
|
2010-02-19 13:23:58 +00:00
|
|
|
* in order to set the "modify" flag of the current screen
|
|
|
|
* and update the date in frame reference
|
2010-05-01 12:46:33 +00:00
|
|
|
* do not forget to call this basic OnModify function to update info
|
|
|
|
* in derived OnModify functions
|
2010-02-19 13:23:58 +00:00
|
|
|
*/
|
2011-09-29 16:49:40 +00:00
|
|
|
virtual void OnModify();
|
2010-02-19 13:23:58 +00:00
|
|
|
|
2009-07-30 11:04:07 +00:00
|
|
|
// Modules (footprints)
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function Create_1_Module
|
2010-07-20 18:11:34 +00:00
|
|
|
* Creates a new module or footprint : A new module contains 2 texts :
|
|
|
|
* First = REFERENCE
|
|
|
|
* Second = VALUE: "VAL**"
|
|
|
|
* the new module is added to the board module list
|
|
|
|
* @param aModuleName = name of the new footprint
|
2010-12-28 11:24:42 +00:00
|
|
|
* (will be the component reference in board)
|
2010-07-20 18:11:34 +00:00
|
|
|
* @return a pointer to the new module
|
|
|
|
*/
|
2010-12-28 11:24:42 +00:00
|
|
|
MODULE* Create_1_Module( const wxString& aModuleName );
|
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
void Edit_Module( MODULE* module, wxDC* DC );
|
2011-09-16 14:13:02 +00:00
|
|
|
void Rotate_Module( wxDC* DC, MODULE* module, int angle, bool incremental );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function PlaceModule
|
|
|
|
* places \a aModule at the current cursor position and updates module coordinates
|
|
|
|
* with the new position.
|
|
|
|
*
|
|
|
|
* @param aModule A MODULE object point of the module to be placed.
|
|
|
|
* @param aDC A wxDC object point of the device context to draw \a aModule on
|
|
|
|
* or NULL if no display screen need updated.
|
|
|
|
* @param aDoNotRecreateRatsnest A bool true redraws the module rats nest.
|
|
|
|
*/
|
|
|
|
void PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreateRatsnest = false );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
|
|
|
// module texts
|
2011-09-15 17:58:35 +00:00
|
|
|
void RotateTextModule( TEXTE_MODULE* Text, wxDC* DC );
|
|
|
|
void DeleteTextModule( TEXTE_MODULE* Text );
|
|
|
|
void PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC );
|
|
|
|
void StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC );
|
2009-11-23 20:18:47 +00:00
|
|
|
TEXTE_MODULE* CreateTextModule( MODULE* Module, wxDC* DC );
|
|
|
|
|
2011-01-09 11:17:28 +00:00
|
|
|
/**
|
|
|
|
* Function ResetTextSize
|
|
|
|
* resets given field text size and width to current settings in
|
|
|
|
* Preferences->Dimensions->Texts and Drawings.
|
|
|
|
* @param aItem is the item to be reset, either TEXTE_PCB or TEXTE_MODULE.
|
|
|
|
* @param aDC is the drawing context.
|
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
void ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC );
|
2011-01-09 11:17:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ResetModuleTextSizes
|
|
|
|
* resets text size and width of all module text fields of given field
|
|
|
|
* type to current settings in Preferences->Dimensions->Texts and Drawings.
|
|
|
|
* @param aType is the field type (TEXT_is_REFERENCE, TEXT_is_VALUE, or TEXT_is_DIVERS).
|
|
|
|
* @param aDC is the drawing context.
|
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
void ResetModuleTextSizes( int aType, wxDC* aDC );
|
2011-01-09 11:17:28 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
void InstallPadOptionsFrame( D_PAD* pad );
|
|
|
|
void InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, wxDC* DC );
|
2009-11-23 20:18:47 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
void AddPad( MODULE* Module, bool draw );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function DeletePad
|
2010-08-11 13:15:30 +00:00
|
|
|
* Delete the pad aPad.
|
|
|
|
* Refresh the modified screen area
|
|
|
|
* Refresh modified parameters of the parent module (bounding box, last date)
|
|
|
|
* @param aPad = the pad to delete
|
2011-08-26 17:01:17 +00:00
|
|
|
* @param aQuery = true to prompt for confirmation, false to delete silently
|
2010-08-11 13:15:30 +00:00
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
void DeletePad( D_PAD* aPad, bool aQuery = true );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
void StartMovePad( D_PAD* Pad, wxDC* DC );
|
|
|
|
void RotatePad( D_PAD* Pad, wxDC* DC );
|
|
|
|
void PlacePad( D_PAD* Pad, wxDC* DC );
|
|
|
|
void Export_Pad_Settings( D_PAD* aPad );
|
|
|
|
void Import_Pad_Settings( D_PAD* aPad, bool aDraw );
|
|
|
|
void Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
|
|
|
// loading footprints
|
2009-08-29 10:20:48 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2011-09-16 14:13:02 +00:00
|
|
|
* Function GetModuleLibrary
|
2009-07-30 11:04:07 +00:00
|
|
|
*
|
|
|
|
* Read active libraries or one library to find and load a given module
|
2009-11-23 20:18:47 +00:00
|
|
|
* If found the module is linked to the tail of linked list of modules
|
2010-12-28 11:24:42 +00:00
|
|
|
* @param aLibraryFullFilename - the full filename of the library to read. If empty,
|
2009-11-23 20:18:47 +00:00
|
|
|
* all active libraries are read
|
2009-07-30 11:04:07 +00:00
|
|
|
* @param aModuleName = module name to load
|
|
|
|
* @param aDisplayMessageError = true to display an error message if any.
|
2010-12-28 11:24:42 +00:00
|
|
|
* @return a pointer to the new module, or NULL
|
2009-07-30 11:04:07 +00:00
|
|
|
*
|
|
|
|
*/
|
2011-09-16 14:13:02 +00:00
|
|
|
MODULE* GetModuleLibrary( const wxString& aLibraryFullFilename,
|
|
|
|
const wxString& aModuleName,
|
|
|
|
bool aDisplayMessageError );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function Select_1_Module_From_List
|
2009-07-30 11:04:07 +00:00
|
|
|
* Display a list of modules found in active libraries or a given library
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aWindow = the current window ( parent window )
|
2009-11-23 20:18:47 +00:00
|
|
|
* @param aLibraryFullFilename = library to list (if aLibraryFullFilename
|
|
|
|
* == void, list all modules)
|
|
|
|
* @param aMask = Display filter (wildcart)( Mask = wxEmptyString if not
|
|
|
|
* used )
|
|
|
|
* @param aKeyWord = keyword list, to display a filtered list of module
|
|
|
|
* having one (or more) of these keywords in their
|
|
|
|
* keyword list ( aKeyWord = wxEmptyString if not used )
|
2009-07-30 11:04:07 +00:00
|
|
|
*
|
2011-09-15 17:58:35 +00:00
|
|
|
* @return wxEmptyString if abort or fails, or the selected module name if Ok
|
2009-07-30 11:04:07 +00:00
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
wxString Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow,
|
|
|
|
const wxString& aLibraryFullFilename,
|
|
|
|
const wxString& aMask,
|
|
|
|
const wxString& aKeyWord );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
|
|
|
// ratsnest functions
|
2010-12-29 17:47:32 +00:00
|
|
|
/**
|
|
|
|
* Function Compile_Ratsnest
|
|
|
|
* Create the entire board ratsnest.
|
|
|
|
* Must be called after a board change (changes for
|
|
|
|
* pads, footprints or a read netlist ).
|
|
|
|
* @param aDC = the current device context (can be NULL)
|
|
|
|
* @param aDisplayStatus : if true, display the computation results
|
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
void Compile_Ratsnest( wxDC* aDC, bool aDisplayStatus );
|
2010-12-29 17:47:32 +00:00
|
|
|
|
|
|
|
/**
|
2011-09-16 14:13:02 +00:00
|
|
|
* Function TestOneRatsNest
|
2010-12-29 17:47:32 +00:00
|
|
|
* Compute the ratsnest relative to the net "net_code"
|
|
|
|
* @param aDC - Device context to draw on.
|
2011-09-16 14:13:02 +00:00
|
|
|
* @param aNetCode = netcode used to compute the ratsnest.
|
2010-12-29 17:47:32 +00:00
|
|
|
*/
|
2011-09-16 14:13:02 +00:00
|
|
|
int TestOneRatsNest( wxDC* aDC, int aNetCode );
|
2010-12-29 17:47:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function build_ratsnest_module
|
|
|
|
* Build a ratsnest relative to one footprint. This is a simplified computation
|
|
|
|
* used only in move footprint. It is not optimal, but it is fast and sufficient
|
|
|
|
* to help a footprint placement
|
|
|
|
* It shows the connections from a pad to the nearest connected pad
|
|
|
|
* @param aModule = module to consider.
|
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
void build_ratsnest_module( MODULE* aModule );
|
2010-12-29 17:47:32 +00:00
|
|
|
|
2011-09-16 14:13:02 +00:00
|
|
|
/**
|
|
|
|
* Function TraceModuleRatsNest
|
|
|
|
* display the rats nest of a moving footprint, computed by
|
|
|
|
* build_ratsnest_module()
|
|
|
|
*/
|
|
|
|
void TraceModuleRatsNest( wxDC* aDC );
|
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
void Build_Board_Ratsnest( wxDC* DC );
|
2010-12-29 17:47:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* function Displays the general ratsnest
|
|
|
|
* Only ratsnest with the status bit CH_VISIBLE is set are displayed
|
|
|
|
* @param aDC = the current device context (can be NULL)
|
|
|
|
* @param aNetcode if > 0, Display only the ratsnest relative to the
|
2011-09-15 17:58:35 +00:00
|
|
|
* corresponding net_code
|
|
|
|
*/
|
|
|
|
void DrawGeneralRatsnest( wxDC* aDC, int aNetcode = 0 );
|
|
|
|
|
|
|
|
void trace_ratsnest_pad( wxDC* DC );
|
|
|
|
void build_ratsnest_pad( BOARD_ITEM* ref, const wxPoint& refpos, bool init );
|
|
|
|
|
2011-09-16 14:13:02 +00:00
|
|
|
/**
|
|
|
|
* Fucntion TestRatsNest
|
|
|
|
* computes the active rats nest
|
|
|
|
* The general rats nest list must exist.
|
|
|
|
* Compute the ACTIVE rats nest in the general rats nest list
|
|
|
|
* if aNetCode == 0, test all nets, else test only aNetCode
|
|
|
|
*/
|
|
|
|
void TestRatsNest( wxDC* aDC, int aNetCode );
|
2011-09-15 17:58:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function TestConnections
|
|
|
|
* tests the connections relative to all nets.
|
|
|
|
* <p>
|
|
|
|
* This function update the status of the ratsnest ( flag CH_ACTIF = 0 if a connection
|
|
|
|
* is found, = 1 else) track segments are assumed to be sorted by net codes.
|
|
|
|
* This is the case because when a new track is added, it is inserted in the linked list
|
|
|
|
* according to its net code. and when nets are changed (when a new netlist is read)
|
|
|
|
* tracks are sorted before using this function.
|
|
|
|
* </p>
|
|
|
|
* @param aDC = current Device Context
|
2010-12-29 17:47:32 +00:00
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
void TestConnections( wxDC* aDC );
|
2010-12-29 17:47:32 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
/**
|
|
|
|
* Function TestNetConnection
|
|
|
|
* tests the connections relative to \a aNetCode. Track segments are assumed to be
|
|
|
|
* sorted by net codes.
|
|
|
|
* @param aDC Cyrrent Device Context
|
|
|
|
* @param aNetCode The net code to test
|
|
|
|
*/
|
|
|
|
void TestNetConnection( wxDC* aDC, int aNetCode );
|
2009-11-23 20:18:47 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
/**
|
|
|
|
* Function RecalculateAllTracksNetcode
|
|
|
|
* search connections between tracks and pads and propagate pad net codes to the track
|
|
|
|
* segments.
|
|
|
|
* <p>
|
|
|
|
* This is a 2 pass computation. First we search a connection between a track segment
|
|
|
|
* and a pad. If the connection is found, the segment netcode is set to the pad netcode.
|
2011-09-16 14:13:02 +00:00
|
|
|
* </p>
|
2011-09-15 17:58:35 +00:00
|
|
|
*/
|
|
|
|
void RecalculateAllTracksNetcode();
|
2009-08-29 10:20:48 +00:00
|
|
|
|
|
|
|
/* Plotting functions:
|
2010-01-01 13:30:39 +00:00
|
|
|
* Return true if OK, false if the file is not created (or has a problem)
|
2009-08-29 10:20:48 +00:00
|
|
|
*/
|
2010-01-01 13:30:39 +00:00
|
|
|
|
2011-09-29 16:49:40 +00:00
|
|
|
/**
|
|
|
|
* Function ExportToGerberFile
|
|
|
|
* create one output files one per board layer in the RS274X format.
|
|
|
|
* <p>
|
|
|
|
* The units are in inches and in the format 3.4 with the leading zeros omitted.
|
2011-09-30 18:15:37 +00:00
|
|
|
* Coordinates are absolute value. The 3.4 format is used because the native Pcbnew
|
2011-09-29 16:49:40 +00:00
|
|
|
* units are 1/10000 inch.
|
|
|
|
* </p>
|
|
|
|
*/
|
|
|
|
bool ExportToGerberFile( const wxString& aFullFileName,
|
|
|
|
int aLayer,
|
|
|
|
bool aPlotOriginIsAuxAxis,
|
|
|
|
GRTraceMode aTraceMode );
|
|
|
|
|
|
|
|
bool ExportToHpglFile( const wxString& aFullFileName,
|
|
|
|
int aLayer,
|
|
|
|
GRTraceMode aTraceMode );
|
|
|
|
|
|
|
|
bool ExportToPostScriptFile( const wxString& aFullFileName,
|
|
|
|
int aLayer,
|
|
|
|
bool aUseA4,
|
|
|
|
GRTraceMode aTraceMode );
|
|
|
|
|
|
|
|
bool ExportToDxfFile( const wxString& aFullFileName,
|
|
|
|
int aLayer,
|
|
|
|
GRTraceMode aTraceMode );
|
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
void Plot_Layer( PLOTTER* plotter,
|
|
|
|
int Layer,
|
|
|
|
GRTraceMode trace_mode );
|
|
|
|
|
2011-08-19 13:08:24 +00:00
|
|
|
/**
|
|
|
|
* Function Plot_Standard_Layer
|
|
|
|
* plot copper or technical layers.
|
|
|
|
* not used for silk screen layers, because these layers have specific
|
|
|
|
* requirements, mainly for pads
|
|
|
|
* @param aPlotter = the plotter to use
|
|
|
|
* @param aLayerMask = the mask to define the layers to plot
|
|
|
|
* @param aPlotVia = true to plot vias, false to skip vias (has meaning
|
|
|
|
* only for solder mask layers).
|
|
|
|
* @param aPlotMode = the plot mode (files, sketch). Has meaning for some formats only
|
|
|
|
* @param aSkipNPTH_Pads = true to skip NPTH Pads, when the pad size and the pad hole
|
|
|
|
* have the same size. Used in GERBER format only.
|
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
void Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask,
|
|
|
|
bool aPlotVia, GRTraceMode aPlotMode,
|
|
|
|
bool aSkipNPTH_Pads = false );
|
2011-08-19 13:08:24 +00:00
|
|
|
|
2011-09-20 15:07:52 +00:00
|
|
|
void PlotSilkScreen( PLOTTER* plotter, int masque_layer, GRTraceMode trace_mode );
|
2009-08-29 10:20:48 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function PlotDrillMark
|
2009-08-29 10:20:48 +00:00
|
|
|
* Draw a drill mark for pads and vias.
|
|
|
|
* Must be called after all drawings, because it
|
2009-11-23 20:18:47 +00:00
|
|
|
* redraw the drill mark on a pad or via, as a negative (i.e. white) shape
|
|
|
|
* in FILLED plot mode
|
2009-08-29 10:20:48 +00:00
|
|
|
* @param aPlotter = the PLOTTER
|
|
|
|
* @param aTraceMode = the mode of plot (FILLED, SKETCH)
|
2009-11-23 20:18:47 +00:00
|
|
|
* @param aSmallDrillShape = true to plot a small drill shape, false to
|
|
|
|
* plot the actual drill shape
|
2009-08-29 10:20:48 +00:00
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
void PlotDrillMark( PLOTTER* aPlotter, GRTraceMode aTraceMode, bool aSmallDrillShape );
|
2009-08-29 10:20:48 +00:00
|
|
|
|
|
|
|
/* Functions relative to Undo/redo commands:
|
|
|
|
*/
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SaveCopyInUndoList (virtual pure)
|
2009-07-30 11:04:07 +00:00
|
|
|
* Creates a new entry in undo list of commands.
|
|
|
|
* add a picker to handle aItemToCopy
|
|
|
|
* @param aItemToCopy = the board item modified by the command to undo
|
2011-04-05 14:46:51 +00:00
|
|
|
* @param aTypeCommand = command type (see enum UNDO_REDO_T)
|
2009-10-14 19:43:31 +00:00
|
|
|
* @param aTransformPoint = the reference point of the transformation, for
|
|
|
|
* commands like move
|
2009-07-30 11:04:07 +00:00
|
|
|
*/
|
2009-10-14 19:43:31 +00:00
|
|
|
virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy,
|
2011-04-05 14:46:51 +00:00
|
|
|
UNDO_REDO_T aTypeCommand,
|
|
|
|
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0;
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SaveCopyInUndoList (virtual pure, overloaded).
|
2009-08-03 18:54:48 +00:00
|
|
|
* Creates a new entry in undo list of commands.
|
|
|
|
* add a list of pickers to handle a list of items
|
|
|
|
* @param aItemsList = the list of items modified by the command to undo
|
2011-04-05 14:46:51 +00:00
|
|
|
* @param aTypeCommand = command type (see enum UNDO_REDO_T)
|
2009-10-14 19:43:31 +00:00
|
|
|
* @param aTransformPoint = the reference point of the transformation,
|
|
|
|
* for commands like move
|
2009-08-03 18:54:48 +00:00
|
|
|
*/
|
2009-10-14 19:43:31 +00:00
|
|
|
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
|
2011-04-05 14:46:51 +00:00
|
|
|
UNDO_REDO_T aTypeCommand,
|
|
|
|
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0;
|
2009-08-03 18:54:48 +00:00
|
|
|
|
2009-07-30 11:04:07 +00:00
|
|
|
|
|
|
|
// layerhandling:
|
2009-10-14 19:43:31 +00:00
|
|
|
// (See pcbnew/sel_layer.cpp for description of why null_layer parameter
|
|
|
|
// is provided)
|
2011-09-15 17:58:35 +00:00
|
|
|
int SelectLayer( int default_layer, int min_layer, int max_layer, bool null_layer = false );
|
|
|
|
void SelectLayerPair();
|
2009-08-29 10:20:48 +00:00
|
|
|
virtual void SwitchLayer( wxDC* DC, int layer );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
void InstallGridFrame( const wxPoint& pos );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
/**
|
|
|
|
* Load applications settings common to PCB draw frame objects.
|
|
|
|
*
|
2011-01-21 19:30:59 +00:00
|
|
|
* This overrides the base class EDA_DRAW_FRAME::LoadSettings() to
|
2009-10-14 19:43:31 +00:00
|
|
|
* handle settings common to the PCB layout application and footprint
|
|
|
|
* editor main windows. It calls down to the base class to load
|
|
|
|
* settings common to all drawing frames. Please put your application
|
|
|
|
* settings common to all pcb drawing frames here to avoid having
|
|
|
|
* application settings loaded all over the place.
|
|
|
|
*/
|
2009-08-29 10:20:48 +00:00
|
|
|
virtual void LoadSettings();
|
2009-10-14 19:43:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Save applications settings common to PCB draw frame objects.
|
|
|
|
*
|
2011-01-21 19:30:59 +00:00
|
|
|
* This overrides the base class EDA_DRAW_FRAME::SaveSettings() to
|
2009-10-14 19:43:31 +00:00
|
|
|
* save settings common to the PCB layout application and footprint
|
|
|
|
* editor main windows. It calls down to the base class to save
|
|
|
|
* settings common to all drawing frames. Please put your application
|
|
|
|
* settings common to all pcb drawing frames here to avoid having
|
|
|
|
* application settings saved all over the place.
|
|
|
|
*/
|
2009-08-29 10:20:48 +00:00
|
|
|
virtual void SaveSettings();
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
void OnTogglePolarCoords( wxCommandEvent& aEvent );
|
|
|
|
void OnTogglePadDrawMode( wxCommandEvent& aEvent );
|
|
|
|
|
|
|
|
/* User interface update event handlers. */
|
|
|
|
void OnUpdateCoordType( wxUpdateUIEvent& aEvent );
|
|
|
|
void OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent );
|
|
|
|
void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
|
|
|
|
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
|
|
|
|
|
2009-07-30 11:04:07 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* WX_BASE_PCB_FRAME_H */
|