2007-08-06 02:02:39 +00:00
|
|
|
/*******************************************************/
|
|
|
|
/* class_module.h : module description (excepted pads) */
|
|
|
|
/*******************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Pcb3D_GLCanvas;
|
|
|
|
class Struct3D_Master;
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
/************************************/
|
|
|
|
/* Modules (footprints) description */
|
|
|
|
/* pad are in class_pad.xx */
|
|
|
|
/************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/* Format des modules:
|
2007-08-06 02:02:39 +00:00
|
|
|
* Description generale
|
|
|
|
* Description segments contour
|
|
|
|
* Description textes
|
|
|
|
* Description pastilles
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/* Flags :*/
|
|
|
|
|
2007-06-15 16:08:55 +00:00
|
|
|
enum Mod_Attribut /* Attributs d'un module */
|
|
|
|
{
|
|
|
|
MOD_DEFAULT = 0, /* Type default */
|
|
|
|
MOD_CMS = 1, /* Pour module apparaissant dans les
|
2007-08-06 02:02:39 +00:00
|
|
|
* fichiers de placement automatique (principalement modules CMS */
|
2007-06-15 16:08:55 +00:00
|
|
|
MOD_VIRTUAL = 2 /* Module virtuel constitue par un dessin sur circuit
|
2007-08-06 02:02:39 +00:00
|
|
|
* (connecteur, trou de percage..) */
|
2007-06-15 16:08:55 +00:00
|
|
|
};
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-07 06:21:19 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* flags for autoplace and autoroute (.m_ModuleStatus member) */
|
2007-06-15 16:08:55 +00:00
|
|
|
#define MODULE_is_LOCKED 0x01 /* module LOCKED: no autoplace allowed */
|
|
|
|
#define MODULE_is_PLACED 0x02 /* In autoplace: module automatically placed */
|
|
|
|
#define MODULE_to_PLACE 0x04 /* In autoplace: module waiting for autoplace */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
class MODULE : public BOARD_ITEM
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-08-06 02:02:39 +00:00
|
|
|
wxPoint m_Pos; // Real coord on board
|
|
|
|
D_PAD* m_Pads; /* Pad list (linked list) */
|
2007-08-23 04:28:46 +00:00
|
|
|
BOARD_ITEM* m_Drawings; /* Graphic items list (linked list) */
|
2007-08-06 02:02:39 +00:00
|
|
|
Struct3D_Master* m_3D_Drawings; /* Pointeur sur la liste des elements de trace 3D*/
|
|
|
|
TEXTE_MODULE* m_Reference; // texte reference du composant (U34, R18..)
|
|
|
|
TEXTE_MODULE* m_Value; // texte valeur du composant (74LS00, 22K..)
|
|
|
|
wxString m_LibRef; /* nom du module en librairie */
|
2008-01-20 19:55:22 +00:00
|
|
|
wxString m_AlternateReference; /* Used when m_Reference cannot be used to
|
|
|
|
* identify the footprint ( after a full reannotation of the schematic */
|
|
|
|
|
|
|
|
int m_Attributs; /* Flags bits a bit ( voir enum Mod_Attribut ) */
|
|
|
|
int m_Orient; /* orientation en 1/10 degres */
|
|
|
|
int flag; /* flag utilise en trace rastnest et routage auto */
|
|
|
|
int m_ModuleStatus; /* For autoplace: flags (LOCKED, AUTOPLACED) */
|
|
|
|
EDA_Rect m_BoundaryBox; /* position/taille du cadre de reperage (coord locales)*/
|
|
|
|
EDA_Rect m_RealBoundaryBox; /* position/taille du module (coord relles) */
|
|
|
|
int m_PadNum; // Nombre total de pads
|
|
|
|
int m_AltPadNum; // en placement auto Nombre de pads actifs pour
|
2007-08-07 06:21:19 +00:00
|
|
|
// les calculs
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2008-01-20 19:55:22 +00:00
|
|
|
int m_CntRot90; // Placement auto: cout ( 0..10 ) de la rotation 90 degre
|
|
|
|
int m_CntRot180; // Placement auto: cout ( 0..10 ) de la rotation 180 degre
|
|
|
|
wxSize m_Ext; // marges de "garde": utilise en placement auto.
|
|
|
|
float m_Surface; // surface du rectangle d'encadrement
|
|
|
|
|
|
|
|
unsigned long m_Link; // variable temporaire ( pour editions, ...)
|
|
|
|
long m_LastEdit_Time; // Date de la derniere modification du module (gestion de librairies)
|
2008-03-31 13:43:54 +00:00
|
|
|
wxString m_Path;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2008-01-20 19:55:22 +00:00
|
|
|
wxString m_Doc; // Texte de description du module
|
|
|
|
wxString m_KeyWord; // Liste des mots cles relatifs au module
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
2007-08-06 02:02:39 +00:00
|
|
|
MODULE( BOARD* parent );
|
|
|
|
MODULE( MODULE* module );
|
2007-09-01 12:00:30 +00:00
|
|
|
~MODULE();
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
void Copy( MODULE* Module ); // Copy structure
|
2007-06-15 16:08:55 +00:00
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
MODULE* Next() { return (MODULE*) Pnext; }
|
2007-06-15 16:08:55 +00:00
|
|
|
|
2008-01-20 19:55:22 +00:00
|
|
|
void Set_Rectangle_Encadrement(); /* mise a jour du rect d'encadrement
|
|
|
|
* en coord locales (orient 0 et origine = pos module) */
|
2007-06-15 16:08:55 +00:00
|
|
|
|
2008-01-20 19:55:22 +00:00
|
|
|
void SetRectangleExinscrit(); /* mise a jour du rect d'encadrement
|
|
|
|
* et de la surface en coord reelles */
|
2008-03-13 10:08:42 +00:00
|
|
|
/**
|
|
|
|
* Function GetBoundingBox
|
|
|
|
* returns the bounding box of this Footprint
|
2008-03-31 13:43:54 +00:00
|
|
|
* Mainly used to redraw the screen area occuped by the footprint
|
2008-03-13 10:08:42 +00:00
|
|
|
*/
|
|
|
|
EDA_Rect GetBoundingBox();
|
2007-06-15 16:08:55 +00:00
|
|
|
|
2007-12-01 03:42:52 +00:00
|
|
|
/**
|
|
|
|
* Function GetPosition
|
|
|
|
* returns the position of this object.
|
|
|
|
* Required by pure virtual BOARD_ITEM::GetPosition()
|
|
|
|
* @return const wxPoint& - The position of this object.
|
|
|
|
*/
|
|
|
|
wxPoint& GetPosition()
|
|
|
|
{
|
|
|
|
return m_Pos;
|
|
|
|
}
|
|
|
|
|
2008-01-20 19:55:22 +00:00
|
|
|
|
2007-06-15 16:08:55 +00:00
|
|
|
// deplacements
|
2007-08-06 02:02:39 +00:00
|
|
|
void SetPosition( const wxPoint& newpos );
|
|
|
|
void SetOrientation( int newangle );
|
2007-06-15 16:08:55 +00:00
|
|
|
|
|
|
|
/* supprime du chainage la structure Struct */
|
2007-09-01 12:00:30 +00:00
|
|
|
void UnLink();
|
2007-06-15 16:08:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function IsLocked
|
2008-01-20 19:55:22 +00:00
|
|
|
* (virtual from BOARD_ITEM )
|
2007-06-15 16:08:55 +00:00
|
|
|
* @returns bool - true if the MODULE is locked, else false
|
|
|
|
*/
|
2007-08-24 03:40:04 +00:00
|
|
|
bool IsLocked() const
|
2007-06-15 16:08:55 +00:00
|
|
|
{
|
|
|
|
return (m_ModuleStatus & MODULE_is_LOCKED) != 0;
|
|
|
|
}
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2007-06-15 16:08:55 +00:00
|
|
|
/**
|
|
|
|
* Function SetLocked
|
|
|
|
* sets the MODULE_is_LOCKED bit in the m_ModuleStatus
|
2007-08-06 02:02:39 +00:00
|
|
|
* @param setLocked When true means turn on locked status, else unlock
|
2007-06-15 16:08:55 +00:00
|
|
|
*/
|
|
|
|
void SetLocked( bool setLocked )
|
|
|
|
{
|
|
|
|
if( setLocked )
|
|
|
|
m_ModuleStatus |= MODULE_is_LOCKED;
|
|
|
|
else
|
|
|
|
m_ModuleStatus &= ~MODULE_is_LOCKED;
|
|
|
|
}
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2007-08-24 03:40:04 +00:00
|
|
|
/* Reading and writing data on files */
|
2008-01-20 19:55:22 +00:00
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
/**
|
|
|
|
* Function Save
|
2007-10-31 14:14:21 +00:00
|
|
|
* writes the data structures for this object out to a FILE in "*.brd" format.
|
2007-10-30 21:30:58 +00:00
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
2008-01-20 19:55:22 +00:00
|
|
|
*/
|
|
|
|
bool Save( FILE* aFile ) const;
|
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
int Write_3D_Descr( FILE* File ) const;
|
2007-08-06 02:02:39 +00:00
|
|
|
int ReadDescr( FILE* File, int* LineNum = NULL );
|
2008-03-31 13:43:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Read_GPCB_Descr
|
|
|
|
* Read a footprint description in GPCB format
|
|
|
|
* @param CmpFullFileName = Full file name (there is one footprint per file.
|
|
|
|
* this is also the footprint name
|
2008-03-10 08:14:20 +00:00
|
|
|
* @return bool - true if success reading else false.
|
2008-03-31 13:43:54 +00:00
|
|
|
*/
|
|
|
|
bool Read_GPCB_Descr(const wxString & CmpFullFileName);
|
2007-08-06 02:02:39 +00:00
|
|
|
int Read_3D_Descr( FILE* File, int* LineNum = NULL );
|
2007-06-15 16:08:55 +00:00
|
|
|
|
|
|
|
/* drawing functions */
|
2008-03-31 13:43:54 +00:00
|
|
|
/** Function Draw
|
|
|
|
* Draw the text accordint to the footprint pos and orient
|
|
|
|
* @param panel = draw panel, Used to know the clip box
|
|
|
|
* @param DC = Current Device Context
|
|
|
|
* @param offset = draw offset (usually wxPoint(0,0)
|
2008-04-01 05:21:50 +00:00
|
|
|
* @param aDrawMode = GR_OR, GR_XOR..
|
2008-03-31 13:43:54 +00:00
|
|
|
*/
|
2008-04-01 05:21:50 +00:00
|
|
|
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset = ZeroOffset );
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
void Draw3D( Pcb3D_GLCanvas* glcanvas );
|
|
|
|
void DrawEdgesOnly( WinEDA_DrawPanel* panel, wxDC* DC,
|
|
|
|
const wxPoint& offset, int draw_mode );
|
|
|
|
void DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC,
|
|
|
|
const wxPoint& offset, int dim_ancre, int draw_mode );
|
2007-06-15 16:08:55 +00:00
|
|
|
|
2007-08-20 19:33:15 +00:00
|
|
|
/**
|
|
|
|
* Function Display_Infos
|
|
|
|
* has knowledge about the frame and how and where to put status information
|
|
|
|
* about this object into the frame's message panel.
|
2007-08-30 22:20:52 +00:00
|
|
|
* @param frame A WinEDA_DrawFrame in which to print status information.
|
2008-01-20 19:55:22 +00:00
|
|
|
*/
|
2007-08-30 22:20:52 +00:00
|
|
|
void Display_Infos( WinEDA_DrawFrame* frame );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-01-20 19:55:22 +00:00
|
|
|
|
2007-08-08 03:50:44 +00:00
|
|
|
/**
|
|
|
|
* Function HitTest
|
|
|
|
* tests if the given wxPoint is within the bounds of this object.
|
|
|
|
* @param refPos A wxPoint to test
|
|
|
|
* @return bool - true if a hit, else false
|
|
|
|
*/
|
|
|
|
bool HitTest( const wxPoint& refPos );
|
|
|
|
|
2008-01-20 19:55:22 +00:00
|
|
|
|
2007-08-24 03:40:04 +00:00
|
|
|
/**
|
2008-01-06 12:43:57 +00:00
|
|
|
* Function HitTest (overlayed)
|
|
|
|
* tests if the given EDA_Rect intersect the bounds of this object.
|
|
|
|
* @param refArea : the given EDA_Rect
|
|
|
|
* @return bool - true if a hit, else false
|
|
|
|
*/
|
|
|
|
bool HitTest( EDA_Rect& refArea );
|
|
|
|
|
2008-01-20 19:55:22 +00:00
|
|
|
/**
|
2007-08-24 03:40:04 +00:00
|
|
|
* Function GetReference
|
2008-01-29 22:09:09 +00:00
|
|
|
* @return const wxString& - the reference designator text.
|
2007-08-24 03:40:04 +00:00
|
|
|
*/
|
|
|
|
const wxString& GetReference()
|
|
|
|
{
|
|
|
|
return m_Reference->m_Text;
|
|
|
|
}
|
2008-01-20 19:55:22 +00:00
|
|
|
|
2008-01-29 22:09:09 +00:00
|
|
|
/**
|
|
|
|
* Function GetValue
|
|
|
|
* @return const wxString& - the value text.
|
|
|
|
*/
|
|
|
|
const wxString& GetValue()
|
|
|
|
{
|
|
|
|
return m_Value->m_Text;
|
|
|
|
}
|
2008-01-20 19:55:22 +00:00
|
|
|
|
2008-03-04 04:22:27 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function FindPadByName
|
|
|
|
* returns a D_PAD* with a matching name. Note that names may not be
|
|
|
|
* unique, depending on how the foot print was created.
|
|
|
|
* @param
|
|
|
|
* @return D_PAD* - The first matching name is returned, or NULL if not found.
|
|
|
|
*/
|
|
|
|
D_PAD* FindPadByName( const wxString& aPadName ) const;
|
|
|
|
|
|
|
|
|
2007-08-09 21:15:08 +00:00
|
|
|
/**
|
|
|
|
* Function Visit
|
|
|
|
* should be re-implemented for each derived class in order to handle
|
|
|
|
* all the types given by its member data. Implementations should call
|
|
|
|
* inspector->Inspect() on types in scanTypes[], and may use IterateForward()
|
|
|
|
* to do so on lists of such data.
|
|
|
|
* @param inspector An INSPECTOR instance to use in the inspection.
|
|
|
|
* @param testData Arbitrary data used by the inspector.
|
2008-01-20 19:55:22 +00:00
|
|
|
* @param scanTypes Which KICAD_T types are of interest and the order
|
2007-08-09 21:15:08 +00:00
|
|
|
* is significant too, terminated by EOT.
|
|
|
|
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
|
|
|
|
* else SCAN_CONTINUE;
|
|
|
|
*/
|
2008-01-20 19:55:22 +00:00
|
|
|
SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
|
|
|
|
const KICAD_T scanTypes[] );
|
|
|
|
|
|
|
|
|
2007-08-07 06:21:19 +00:00
|
|
|
/**
|
|
|
|
* Function GetClass
|
|
|
|
* returns the class name.
|
|
|
|
* @return wxString
|
|
|
|
*/
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
|
|
|
return wxT( "MODULE" );
|
|
|
|
}
|
|
|
|
|
2008-01-20 19:55:22 +00:00
|
|
|
|
|
|
|
#if defined (DEBUG)
|
|
|
|
|
|
|
|
/**
|
2007-08-06 02:02:39 +00:00
|
|
|
* Function Show
|
|
|
|
* is used to output the object tree, currently for debugging only.
|
2008-01-20 19:55:22 +00:00
|
|
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
2007-08-06 02:02:39 +00:00
|
|
|
* of nesting of this object within the overall tree.
|
|
|
|
* @param os The ostream& to output to.
|
|
|
|
*/
|
|
|
|
virtual void Show( int nestLevel, std::ostream& os );
|
2007-08-06 20:26:59 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
#endif
|
|
|
|
};
|