2007-09-13 11:55:46 +00:00
|
|
|
/*****************************************************/
|
|
|
|
/* Definitions for the Component classes for EESchema */
|
|
|
|
/*****************************************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#ifndef COMPONENT_CLASS_H
|
|
|
|
#define COMPONENT_CLASS_H
|
|
|
|
|
|
|
|
#ifndef eda_global
|
|
|
|
#define eda_global extern
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "macros.h"
|
|
|
|
#include "base_struct.h"
|
2008-02-12 21:12:46 +00:00
|
|
|
#include <wx/arrstr.h>
|
|
|
|
#include "class_screen.h"
|
|
|
|
#include <wx/dynarray.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
/* Definition de la representation du composant */
|
2007-09-20 21:06:49 +00:00
|
|
|
enum NumFieldType {
|
2007-09-13 11:55:46 +00:00
|
|
|
REFERENCE = 0, /* Champ Reference of part, i.e. "IC21" */
|
|
|
|
VALUE, /* Champ Value of part, i.e. "3.3K" */
|
|
|
|
FOOTPRINT, /* Champ Name Module PCB, i.e. "16DIP300" */
|
|
|
|
SHEET_FILENAME, /* Champ Name Schema component, i.e. "cnt16.sch" */
|
|
|
|
FIELD1,
|
|
|
|
FIELD2,
|
|
|
|
FIELD3,
|
|
|
|
FIELD4,
|
|
|
|
FIELD5,
|
|
|
|
FIELD6,
|
|
|
|
FIELD7,
|
2008-02-26 19:19:54 +00:00
|
|
|
FIELD8,
|
|
|
|
NUMBER_OF_FIELDS /* Nombre de champs de texte affectes au composant */
|
2007-09-20 21:06:49 +00:00
|
|
|
};
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Class to manage component fields.
|
2007-09-13 11:55:46 +00:00
|
|
|
* component fields are texts attached to the component (not the graphic texts)
|
|
|
|
* There are 2 major fields : Reference and Value
|
|
|
|
*/
|
2008-02-26 19:19:54 +00:00
|
|
|
class PartTextStruct : public EDA_BaseStruct
|
|
|
|
, public EDA_TextStruct
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-08-23 04:28:46 +00:00
|
|
|
int m_Layer;
|
2007-09-13 11:55:46 +00:00
|
|
|
int m_FieldId;
|
|
|
|
wxString m_Name; /* Field name (ref, value,pcb, sheet, filed 1..
|
|
|
|
* and for fields 1 to 8 the name is editable */
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
public:
|
2007-09-13 11:55:46 +00:00
|
|
|
PartTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
|
|
|
|
~PartTextStruct();
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2007-09-13 11:28:58 +00:00
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
return wxT( "PartText" );
|
2007-09-13 11:28:58 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
|
|
|
|
void PartTextCopy( PartTextStruct* target );
|
|
|
|
void Place( WinEDA_DrawFrame* frame, wxDC* DC );
|
|
|
|
|
|
|
|
EDA_Rect GetBoundaryBox();
|
|
|
|
bool IsVoid();
|
|
|
|
void SwapData( PartTextStruct* copyitem );
|
2007-05-06 16:03:28 +00:00
|
|
|
};
|
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/* the class DrawPartStruct describes a basic virtual component
|
2007-09-13 11:55:46 +00:00
|
|
|
* Not used directly:
|
2008-02-12 21:12:46 +00:00
|
|
|
* used classes are EDA_SchComponentStruct (the "classic" schematic component, below)
|
2007-09-13 11:55:46 +00:00
|
|
|
* and the Pseudo component DrawSheetStruct
|
|
|
|
*/
|
|
|
|
class DrawPartStruct : public EDA_BaseStruct
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-09-13 11:55:46 +00:00
|
|
|
int m_Layer;
|
|
|
|
wxString m_ChipName; /* Key to look for in the library, i.e. "74LS00". */
|
|
|
|
PartTextStruct m_Field[NUMBER_OF_FIELDS];
|
|
|
|
wxPoint m_Pos; /* Exact position of part. */
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
public:
|
2008-02-26 19:19:54 +00:00
|
|
|
DrawPartStruct( KICAD_T struct_type, const wxPoint& pos );
|
2007-09-13 11:55:46 +00:00
|
|
|
~DrawPartStruct();
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2007-09-13 11:28:58 +00:00
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
return wxT( "DrawPart" );
|
2007-09-13 11:28:58 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
};
|
|
|
|
|
2008-02-28 19:27:25 +00:00
|
|
|
WX_DECLARE_OBJARRAY( DrawSheetPath, ArrayOfSheetLists );
|
2007-05-06 16:03:28 +00:00
|
|
|
/* the class EDA_SchComponentStruct describes a real component */
|
2007-09-13 11:55:46 +00:00
|
|
|
class EDA_SchComponentStruct : public DrawPartStruct
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-02-26 19:19:54 +00:00
|
|
|
int m_Multi; /* In multi unit chip - which unit to draw. */
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
//int m_FlagControlMulti;
|
2008-02-26 19:19:54 +00:00
|
|
|
ArrayOfSheetLists m_UsedOnSheets;
|
|
|
|
int m_Convert; /* Gestion (management) des mutiples representations (ex: conversion De Morgan) */
|
|
|
|
int m_Transform[2][2]; /* The rotation/mirror transformation matrix. */
|
|
|
|
bool* m_PinIsDangling; // liste des indicateurs de pin non connectee
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
wxArrayString m_Paths; // /sheet1/C102, /sh2/sh1/U32 etc.
|
|
|
|
wxArrayString m_References; // C102, U32 etc.
|
|
|
|
wxString m_PrefixString; /*C, R, U, Q etc - the first character which typically indicates what the component is.
|
|
|
|
* determined, upon placement, from the library component.
|
|
|
|
* determined, upon file load, by the first non-digits in the reference fields. */
|
2008-02-12 21:12:46 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
public:
|
2007-09-13 11:55:46 +00:00
|
|
|
EDA_SchComponentStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
|
|
|
|
~EDA_SchComponentStruct( void ) { }
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2007-09-13 11:28:58 +00:00
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
return wxT( "EDA_SchComponent" );
|
2007-09-13 11:28:58 +00:00
|
|
|
}
|
2007-09-13 11:55:46 +00:00
|
|
|
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
EDA_SchComponentStruct* GenCopy();
|
2007-09-13 11:55:46 +00:00
|
|
|
void SetRotationMiroir( int type );
|
|
|
|
int GetRotationMiroir();
|
|
|
|
wxPoint GetScreenCoord( const wxPoint& coord );
|
|
|
|
void Display_Infos( WinEDA_DrawFrame* frame );
|
|
|
|
void ClearAnnotation();
|
|
|
|
EDA_Rect GetBoundaryBox();
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
const wxString& ReturnFieldName( int aFieldNdx ) const;
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetFieldValue
|
|
|
|
* returns a reference to the field value.
|
|
|
|
* @param aFieldNdx An index into the array of fields, 0 - FIELD8
|
|
|
|
* @return const wxString& - the field value or wxEmptyString
|
|
|
|
*/
|
|
|
|
const wxString& GetFieldValue( int aFieldNdx ) const;
|
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
virtual void Draw( WinEDA_DrawPanel* panel,
|
2008-02-26 19:19:54 +00:00
|
|
|
wxDC* DC,
|
|
|
|
const wxPoint& offset,
|
|
|
|
int draw_mode,
|
|
|
|
int Color = -1 );
|
2007-09-13 11:55:46 +00:00
|
|
|
void SwapData( EDA_SchComponentStruct* copyitem );
|
|
|
|
|
|
|
|
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
|
2008-02-12 21:12:46 +00:00
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
|
|
|
|
//returns a unique ID, in the form of a path.
|
2008-02-28 19:27:25 +00:00
|
|
|
wxString GetPath( DrawSheetPath* sheet );
|
|
|
|
const wxString GetRef( DrawSheetPath* sheet );
|
|
|
|
void SetRef( DrawSheetPath* sheet, wxString ref );
|
2008-02-26 19:19:54 +00:00
|
|
|
void ClearRefs();
|
|
|
|
|
|
|
|
#if defined (DEBUG)
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
/**
|
|
|
|
* Function Show
|
|
|
|
* is used to output the object tree, currently for debugging only.
|
2008-02-26 19:19:54 +00:00
|
|
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
2007-09-20 21:06:49 +00:00
|
|
|
* of nesting of this object within the overall tree.
|
|
|
|
* @param os The ostream& to output to.
|
|
|
|
*/
|
2008-02-26 19:19:54 +00:00
|
|
|
void Show( int nestLevel, std::ostream& os );
|
|
|
|
|
|
|
|
#endif
|
2007-05-06 16:03:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* COMPONENT_CLASS_H */
|