EDA_BaseStruct::m_StructType is now type KICAD_T
This commit is contained in:
parent
908f6d936b
commit
f3c324d535
|
@ -25,8 +25,8 @@ S3D_Vertex::S3D_Vertex(void)
|
|||
|
||||
|
||||
/**************************************************************************/
|
||||
S3D_Material::S3D_Material(Struct3D_Master * father, const wxString & name):
|
||||
EDA_BaseStruct( father, -1)
|
||||
S3D_Material::S3D_Material( Struct3D_Master * father, const wxString & name ):
|
||||
EDA_BaseStruct( father, NOT_USED )
|
||||
/**************************************************************************/
|
||||
{
|
||||
m_DiffuseColor.x = m_DiffuseColor.y = m_DiffuseColor.z = 1.0;
|
||||
|
@ -67,7 +67,7 @@ void Struct3D_Master::Copy(Struct3D_Master * pattern)
|
|||
|
||||
/***************************************************************/
|
||||
Struct3D_Master::Struct3D_Master(EDA_BaseStruct * StructFather):
|
||||
EDA_BaseStruct( StructFather, -1)
|
||||
EDA_BaseStruct( StructFather, NOT_USED )
|
||||
/***************************************************************/
|
||||
{
|
||||
m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0;
|
||||
|
@ -100,7 +100,7 @@ S3D_Material * nextmat;
|
|||
|
||||
/***************************************************************/
|
||||
Struct3D_Shape::Struct3D_Shape(EDA_BaseStruct * StructFather):
|
||||
EDA_BaseStruct( StructFather, -1)
|
||||
EDA_BaseStruct( StructFather, NOT_USED )
|
||||
/***************************************************************/
|
||||
{
|
||||
m_3D_Coord = NULL;
|
||||
|
|
|
@ -5,6 +5,18 @@ Please add newer entries at the top, list the date and your name with
|
|||
email address.
|
||||
|
||||
|
||||
2007-Aug-23 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||
================================================================================
|
||||
+ eeschema & pcbnew
|
||||
* Removed class EDA_BaseLineStruct, which brought no behavioral advantage, only data.
|
||||
Classes which were based on got its data members added and their initializers.
|
||||
* Changed type of EDA_BaseStruct::m_StructType from int to KICAD_T which is an
|
||||
enum. This makes debugging easier since gdb will show the name of the
|
||||
KICAD_T rather than simply a number. Added NOT_USED = -1 to KICAD_T enum for
|
||||
3d which was using -1.
|
||||
* More beautification using latest uncrustify and the committed uncrustify.cfg
|
||||
|
||||
|
||||
2007-Aug-24 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
|
||||
================================================================================
|
||||
+ pcbnew
|
||||
|
@ -27,9 +39,6 @@ email address.
|
|||
tomorrow I will add a new class COLLECTORS_GUIDE which can be used by a
|
||||
COLLECTOR to control its operation. It adds the concept of layer
|
||||
locking, even though PCBNEW does not support that in the UI yet.
|
||||
@todo:
|
||||
add constructor initializers for classes that were derived from
|
||||
EDA_BaseLineStruct but are now not. Its late, will do tomorrow.
|
||||
|
||||
|
||||
2007-Aug-22 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
#include "macros.h"
|
||||
|
||||
|
||||
// DrawStructureType names for error messages only:
|
||||
static wxString DrawStructureTypeName[MAX_STRUCT_TYPE_ID + 1] = {
|
||||
// KICAD_T names for error messages only:
|
||||
static wxString KICAD_TName[MAX_STRUCT_TYPE_ID + 1] = {
|
||||
wxT( "Not init" ),
|
||||
|
||||
wxT( "Pcb" ),
|
||||
|
@ -74,7 +74,7 @@ enum textbox {
|
|||
|
||||
|
||||
/******************************************************************************/
|
||||
EDA_BaseStruct::EDA_BaseStruct( EDA_BaseStruct* parent, int idType )
|
||||
EDA_BaseStruct::EDA_BaseStruct( EDA_BaseStruct* parent, KICAD_T idType )
|
||||
/******************************************************************************/
|
||||
{
|
||||
InitVars();
|
||||
|
@ -84,7 +84,7 @@ EDA_BaseStruct::EDA_BaseStruct( EDA_BaseStruct* parent, int idType )
|
|||
|
||||
|
||||
/********************************************/
|
||||
EDA_BaseStruct::EDA_BaseStruct( int idType )
|
||||
EDA_BaseStruct::EDA_BaseStruct( KICAD_T idType )
|
||||
/********************************************/
|
||||
{
|
||||
InitVars();
|
||||
|
@ -183,7 +183,7 @@ wxString EDA_BaseStruct::ReturnClassName() const
|
|||
|
||||
if( (ii < 0) || (ii > MAX_STRUCT_TYPE_ID) )
|
||||
ii = MAX_STRUCT_TYPE_ID;
|
||||
classname = DrawStructureTypeName[ii];
|
||||
classname = KICAD_TName[ii];
|
||||
|
||||
return classname;
|
||||
}
|
||||
|
@ -287,16 +287,6 @@ std::ostream& EDA_BaseStruct::NestedSpace( int nestLevel, std::ostream& os )
|
|||
|
||||
|
||||
|
||||
/**********************************************************************************************/
|
||||
EDA_BaseLineStruct::EDA_BaseLineStruct( EDA_BaseStruct* StructFather, DrawStructureType idtype ) :
|
||||
EDA_BaseStruct( StructFather, idtype )
|
||||
/**********************************************************************************************/
|
||||
{
|
||||
m_Layer = 0;
|
||||
m_Width = 0; // 0 = line, > 0 = tracks, bus ...
|
||||
};
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
/* EDA_TextStruct (classe de base, non utilis<69> seule */
|
||||
/*********************************************************/
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**********************************************************/
|
||||
/* Routines d'affichage de parametres et caracteristiques */
|
||||
/**********************************************************/
|
||||
/**********************************************************/
|
||||
/* Routines d'affichage de parametres et caracteristiques */
|
||||
/**********************************************************/
|
||||
|
||||
/* Fichier AFFICHE.CPP */
|
||||
/* Fichier AFFICHE.CPP */
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
@ -15,136 +15,175 @@
|
|||
|
||||
|
||||
/***********************************************************/
|
||||
void DrawSheetStruct::Display_Infos(WinEDA_DrawFrame * frame)
|
||||
void DrawSheetStruct::Display_Infos( WinEDA_DrawFrame* frame )
|
||||
/************************************************************/
|
||||
{
|
||||
frame->MsgPanel->EraseMsgBox();
|
||||
Affiche_1_Parametre(frame, 1, _("Name"), m_SheetName, CYAN);
|
||||
Affiche_1_Parametre(frame, 30, _("FileName"), m_FileName, BROWN);
|
||||
frame->MsgPanel->EraseMsgBox();
|
||||
Affiche_1_Parametre( frame, 1, _( "Name" ), m_SheetName, CYAN );
|
||||
Affiche_1_Parametre( frame, 30, _( "FileName" ), m_FileName, BROWN );
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
void EDA_SchComponentStruct::Display_Infos(WinEDA_DrawFrame * frame)
|
||||
void EDA_SchComponentStruct::Display_Infos( WinEDA_DrawFrame* frame )
|
||||
/***************************************************************/
|
||||
{
|
||||
EDA_LibComponentStruct * Entry = FindLibPart(m_ChipName.GetData(),wxEmptyString,FIND_ROOT);;
|
||||
wxString msg;
|
||||
|
||||
frame->MsgPanel->EraseMsgBox();
|
||||
EDA_LibComponentStruct* Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT );;
|
||||
|
||||
Affiche_1_Parametre(frame, 1, _("Ref"),
|
||||
m_Field[REFERENCE].m_Text, DARKCYAN);
|
||||
wxString msg;
|
||||
|
||||
if (Entry && Entry->m_Options == ENTRY_POWER)
|
||||
msg = _("Pwr Symb");
|
||||
else msg = _("Val");
|
||||
Affiche_1_Parametre(frame, 10, msg, m_Field[VALUE].m_Text, DARKCYAN);
|
||||
frame->MsgPanel->EraseMsgBox();
|
||||
|
||||
Affiche_1_Parametre(frame, 28, _("RefLib"), m_ChipName.GetData(), BROWN);
|
||||
Affiche_1_Parametre( frame, 1, _( "Ref" ),
|
||||
m_Field[REFERENCE].m_Text, DARKCYAN );
|
||||
|
||||
msg = FindLibName;
|
||||
Affiche_1_Parametre(frame, 40, _("Lib"), msg, DARKRED);
|
||||
if( Entry && Entry->m_Options == ENTRY_POWER )
|
||||
msg = _( "Pwr Symb" );
|
||||
else
|
||||
msg = _( "Val" );
|
||||
Affiche_1_Parametre( frame, 10, msg, m_Field[VALUE].m_Text, DARKCYAN );
|
||||
|
||||
if( Entry )
|
||||
{
|
||||
Affiche_1_Parametre(frame, 52, Entry->m_Doc, wxEmptyString, DARKCYAN);
|
||||
Affiche_1_Parametre(frame, 52, wxEmptyString, Entry->m_KeyWord, DARKGREEN);
|
||||
}
|
||||
Affiche_1_Parametre( frame, 28, _( "RefLib" ), m_ChipName.GetData(), BROWN );
|
||||
|
||||
msg = FindLibName;
|
||||
Affiche_1_Parametre( frame, 40, _( "Lib" ), msg, DARKRED );
|
||||
|
||||
if( Entry )
|
||||
{
|
||||
Affiche_1_Parametre( frame, 52, Entry->m_Doc, wxEmptyString, DARKCYAN );
|
||||
Affiche_1_Parametre( frame, 52, wxEmptyString, Entry->m_KeyWord, DARKGREEN );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************/
|
||||
void LibDrawPin::Display_Infos( WinEDA_DrawFrame* frame )
|
||||
/*******************************************************/
|
||||
|
||||
/*******************************************************/
|
||||
void LibDrawPin::Display_Infos(WinEDA_DrawFrame * frame)
|
||||
/*******************************************************/
|
||||
/* Affiche en bas d'ecran les caracteristiques de la pin
|
||||
*/
|
||||
*/
|
||||
{
|
||||
wxString Text;
|
||||
int ii;
|
||||
wxString Text;
|
||||
int ii;
|
||||
|
||||
frame->MsgPanel->EraseMsgBox();
|
||||
frame->MsgPanel->EraseMsgBox();
|
||||
|
||||
/* Affichage du nom */
|
||||
Affiche_1_Parametre(frame, 24, _("PinName"), m_PinName, DARKCYAN);
|
||||
/* Affichage du nom */
|
||||
Affiche_1_Parametre( frame, 24, _( "PinName" ), m_PinName, DARKCYAN );
|
||||
|
||||
/* Affichage du numero */
|
||||
if(m_PinNum == 0) Text = wxT("?" );
|
||||
else ReturnPinStringNum(Text);
|
||||
/* Affichage du numero */
|
||||
if( m_PinNum == 0 )
|
||||
Text = wxT( "?" );
|
||||
else
|
||||
ReturnPinStringNum( Text );
|
||||
|
||||
Affiche_1_Parametre(frame, 40, _("PinNum"), Text, DARKCYAN);
|
||||
Affiche_1_Parametre( frame, 40, _( "PinNum" ), Text, DARKCYAN );
|
||||
|
||||
/* Affichage du type */
|
||||
ii = m_PinType;
|
||||
Affiche_1_Parametre(frame, 48, _("PinType"), MsgPinElectricType[ii], RED);
|
||||
/* Affichage du type */
|
||||
ii = m_PinType;
|
||||
Affiche_1_Parametre( frame, 48, _( "PinType" ), MsgPinElectricType[ii], RED );
|
||||
|
||||
/* Affichage de la visiblite */
|
||||
ii = m_Attributs;
|
||||
if( ii & 1 ) Text = _("no");
|
||||
else Text = _("yes");
|
||||
Affiche_1_Parametre(frame, 58, _("Display"), Text, DARKGREEN);
|
||||
/* Affichage de la visiblite */
|
||||
ii = m_Attributs;
|
||||
if( ii & 1 )
|
||||
Text = _( "no" );
|
||||
else
|
||||
Text = _( "yes" );
|
||||
Affiche_1_Parametre( frame, 58, _( "Display" ), Text, DARKGREEN );
|
||||
|
||||
/* Affichage de la longueur */
|
||||
Text.Printf( wxT("%d"), m_PinLen);
|
||||
Affiche_1_Parametre(frame, 66, _("Lengh"), Text, MAGENTA);
|
||||
/* Affichage de la longueur */
|
||||
Text.Printf( wxT( "%d" ), m_PinLen );
|
||||
Affiche_1_Parametre( frame, 66, _( "Lengh" ), Text, MAGENTA );
|
||||
|
||||
/* Affichage de l'orientation */
|
||||
switch(m_Orient)
|
||||
{
|
||||
case PIN_UP: Text = _("Up"); break;
|
||||
case PIN_DOWN: Text = _("Down"); break;
|
||||
case PIN_LEFT: Text = _("Left"); break;
|
||||
case PIN_RIGHT: Text = _("Right"); break;
|
||||
default: Text = wxT("??"); break;
|
||||
}
|
||||
/* Affichage de l'orientation */
|
||||
switch( m_Orient )
|
||||
{
|
||||
case PIN_UP:
|
||||
Text = _( "Up" ); break;
|
||||
|
||||
Affiche_1_Parametre(frame, 72, _("Orient"), Text, MAGENTA);
|
||||
case PIN_DOWN:
|
||||
Text = _( "Down" ); break;
|
||||
|
||||
case PIN_LEFT:
|
||||
Text = _( "Left" ); break;
|
||||
|
||||
case PIN_RIGHT:
|
||||
Text = _( "Right" ); break;
|
||||
|
||||
default:
|
||||
Text = wxT( "??" ); break;
|
||||
}
|
||||
|
||||
Affiche_1_Parametre( frame, 72, _( "Orient" ), Text, MAGENTA );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
void LibEDA_BaseStruct::Display_Infos_DrawEntry(WinEDA_DrawFrame * frame)
|
||||
void LibEDA_BaseStruct::Display_Infos_DrawEntry( WinEDA_DrawFrame* frame )
|
||||
/***********************************************************************/
|
||||
|
||||
/* Affiche en bas d'ecran les caracteristiques de l'element
|
||||
*/
|
||||
*/
|
||||
{
|
||||
wxString msg;
|
||||
wxString msg;
|
||||
|
||||
frame->MsgPanel->EraseMsgBox();
|
||||
frame->MsgPanel->EraseMsgBox();
|
||||
|
||||
/* affichage du type */
|
||||
msg = wxT("??");
|
||||
switch( m_StructType )
|
||||
{
|
||||
case COMPONENT_ARC_DRAW_TYPE: msg = wxT("Arc"); break;
|
||||
case COMPONENT_CIRCLE_DRAW_TYPE: msg = wxT("Circle"); break;
|
||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: msg = wxT("Text"); break;
|
||||
case COMPONENT_RECT_DRAW_TYPE: msg = wxT("Rect"); break;
|
||||
case COMPONENT_POLYLINE_DRAW_TYPE: msg = wxT("PolyLine"); break;
|
||||
case COMPONENT_LINE_DRAW_TYPE: msg = wxT("Segment"); break;
|
||||
case COMPONENT_PIN_DRAW_TYPE:
|
||||
((LibDrawPin*) this)->Display_Infos(frame);
|
||||
msg = wxT("Pin");
|
||||
break;
|
||||
}
|
||||
/* affichage du type */
|
||||
msg = wxT( "??" );
|
||||
|
||||
Affiche_1_Parametre(frame, 1, wxT("Type"), msg, CYAN);
|
||||
switch( m_StructType )
|
||||
{
|
||||
case COMPONENT_ARC_DRAW_TYPE:
|
||||
msg = wxT( "Arc" ); break;
|
||||
|
||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
||||
msg = wxT( "Circle" ); break;
|
||||
|
||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
||||
msg = wxT( "Text" ); break;
|
||||
|
||||
case COMPONENT_RECT_DRAW_TYPE:
|
||||
msg = wxT( "Rect" ); break;
|
||||
|
||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
||||
msg = wxT( "PolyLine" ); break;
|
||||
|
||||
case COMPONENT_LINE_DRAW_TYPE:
|
||||
msg = wxT( "Segment" ); break;
|
||||
|
||||
case COMPONENT_PIN_DRAW_TYPE:
|
||||
( (LibDrawPin*) this )->Display_Infos( frame );
|
||||
msg = wxT( "Pin" );
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
Affiche_1_Parametre( frame, 1, wxT( "Type" ), msg, CYAN );
|
||||
|
||||
|
||||
/* Affichage de l'appartenance */
|
||||
if( m_Unit == 0 ) msg = _("All");
|
||||
else msg.Printf( wxT("%d"), m_Unit );
|
||||
Affiche_1_Parametre(frame, 10, _("Unit"), msg, BROWN);
|
||||
/* Affichage de l'appartenance */
|
||||
if( m_Unit == 0 )
|
||||
msg = _( "All" );
|
||||
else
|
||||
msg.Printf( wxT( "%d" ), m_Unit );
|
||||
Affiche_1_Parametre( frame, 10, _( "Unit" ), msg, BROWN );
|
||||
|
||||
if( m_Convert == 0 ) msg = _("All" );
|
||||
else if( m_Convert == 1 ) msg = _("no");
|
||||
else if( m_Convert == 2 ) msg = _("yes");
|
||||
else msg = wxT("?");
|
||||
Affiche_1_Parametre(frame, 16, _("Convert"), msg, BROWN);
|
||||
if( m_Convert == 0 )
|
||||
msg = _( "All" );
|
||||
else if( m_Convert == 1 )
|
||||
msg = _( "no" );
|
||||
else if( m_Convert == 2 )
|
||||
msg = _( "yes" );
|
||||
else
|
||||
msg = wxT( "?" );
|
||||
Affiche_1_Parametre( frame, 16, _( "Convert" ), msg, BROWN );
|
||||
|
||||
if ( m_Width ) valeur_param(m_Width, msg);
|
||||
else msg = _("default");
|
||||
Affiche_1_Parametre(frame, 24, _("Width"), msg, BLUE);
|
||||
if( m_Width )
|
||||
valeur_param( m_Width, msg );
|
||||
else
|
||||
msg = _( "default" );
|
||||
Affiche_1_Parametre( frame, 24, _( "Width" ), msg, BLUE );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -841,6 +841,9 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
|
|||
sheet->m_FileName = sheet->m_SheetName + wxT( ".sch" );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
SetStructFather( Struct, screen );
|
||||
|
|
|
@ -594,6 +594,9 @@ void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
|
|||
( (LibDrawText*) item )->m_Pos.x += offset.x;
|
||||
( (LibDrawText*) item )->m_Pos.y += offset.y;
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
item->m_Flags = item->m_Selected = 0;
|
||||
|
@ -701,6 +704,9 @@ void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
|
|||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
||||
SETMIRROR( ( (LibDrawText*) item )->m_Pos.x );
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
item->m_Flags = item->m_Selected = 0;
|
||||
|
|
|
@ -148,7 +148,7 @@ wxString DrawMarkerStruct::GetComment( void )
|
|||
/***************************/
|
||||
|
||||
EDA_DrawLineStruct::EDA_DrawLineStruct( const wxPoint& pos, int layer ) :
|
||||
EDA_BaseLineStruct( NULL, DRAW_SEGMENT_STRUCT_TYPE )
|
||||
EDA_BaseStruct( NULL, DRAW_SEGMENT_STRUCT_TYPE )
|
||||
{
|
||||
m_Start = pos;
|
||||
m_End = pos;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
/***************************/
|
||||
|
||||
/***********************************************************************************/
|
||||
DrawPartStruct::DrawPartStruct( DrawStructureType struct_type, const wxPoint & pos):
|
||||
DrawPartStruct::DrawPartStruct( KICAD_T struct_type, const wxPoint & pos):
|
||||
EDA_BaseStruct(struct_type)
|
||||
/***********************************************************************************/
|
||||
{
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
wxPoint m_Pos; /* Exact position of part. */
|
||||
|
||||
public:
|
||||
DrawPartStruct( DrawStructureType struct_type, const wxPoint & pos);
|
||||
DrawPartStruct( KICAD_T struct_type, const wxPoint & pos);
|
||||
~DrawPartStruct(void);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*********************/
|
||||
/* dangling_ends.cpp */
|
||||
/*********************/
|
||||
/*********************/
|
||||
/* dangling_ends.cpp */
|
||||
/*********************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
@ -9,401 +9,452 @@
|
|||
#include "libcmp.h"
|
||||
#include "general.h"
|
||||
|
||||
#include "netlist.h" /* Definitions generales liees au calcul de netliste */
|
||||
#include "netlist.h" /* Definitions generales liees au calcul de netliste */
|
||||
#include "protos.h"
|
||||
|
||||
enum End_Type
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
WIRE_START_END,
|
||||
WIRE_END_END,
|
||||
BUS_START_END,
|
||||
BUS_END_END,
|
||||
JUNCTION_END,
|
||||
PIN_END,
|
||||
LABEL_END,
|
||||
ENTRY_END,
|
||||
SHEET_LABEL_END
|
||||
enum End_Type {
|
||||
UNKNOWN = 0,
|
||||
WIRE_START_END,
|
||||
WIRE_END_END,
|
||||
BUS_START_END,
|
||||
BUS_END_END,
|
||||
JUNCTION_END,
|
||||
PIN_END,
|
||||
LABEL_END,
|
||||
ENTRY_END,
|
||||
SHEET_LABEL_END
|
||||
};
|
||||
|
||||
class DanglingEndHandle
|
||||
{
|
||||
public:
|
||||
const void * m_Item;
|
||||
wxPoint m_Pos;
|
||||
int m_Type;
|
||||
DanglingEndHandle * m_Pnext;
|
||||
|
||||
DanglingEndHandle(int type)
|
||||
{
|
||||
m_Item = NULL;
|
||||
m_Type = type;
|
||||
m_Pnext = NULL;
|
||||
}
|
||||
const void* m_Item;
|
||||
wxPoint m_Pos;
|
||||
int m_Type;
|
||||
DanglingEndHandle* m_Pnext;
|
||||
|
||||
DanglingEndHandle( int type ) {
|
||||
m_Item = NULL;
|
||||
m_Type = type;
|
||||
m_Pnext = NULL;
|
||||
}
|
||||
};
|
||||
|
||||
DanglingEndHandle * ItemList;
|
||||
DanglingEndHandle* ItemList;
|
||||
|
||||
static void TestWireForDangling(EDA_DrawLineStruct * DrawRef,
|
||||
WinEDA_SchematicFrame * frame, wxDC * DC);
|
||||
void TestLabelForDangling(DrawTextStruct * label,
|
||||
WinEDA_SchematicFrame * frame, wxDC * DC);
|
||||
DanglingEndHandle * RebuildEndList(EDA_BaseStruct *DrawList);
|
||||
static void TestWireForDangling( EDA_DrawLineStruct* DrawRef,
|
||||
WinEDA_SchematicFrame* frame, wxDC* DC );
|
||||
void TestLabelForDangling( DrawTextStruct* label,
|
||||
WinEDA_SchematicFrame* frame, wxDC* DC );
|
||||
DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList );
|
||||
|
||||
/**********************************************************/
|
||||
bool SegmentIntersect(int Sx1, int Sy1, int Sx2, int Sy2,
|
||||
int Px1, int Py1)
|
||||
bool SegmentIntersect( int Sx1, int Sy1, int Sx2, int Sy2,
|
||||
int Px1, int Py1 )
|
||||
/**********************************************************/
|
||||
|
||||
/* Retourne TRUE si le point P est sur le segment S.
|
||||
Le segment est suppose horizontal ou vertical.
|
||||
*/
|
||||
* Le segment est suppose horizontal ou vertical.
|
||||
*/
|
||||
{
|
||||
int Sxmin, Sxmax, Symin, Symax;
|
||||
int Sxmin, Sxmax, Symin, Symax;
|
||||
|
||||
if (Sx1 == Sx2) /* Line S is vertical. */
|
||||
{
|
||||
Symin = MIN(Sy1, Sy2); Symax = MAX(Sy1, Sy2);
|
||||
if (Px1 != Sx1) return FALSE;
|
||||
if (Py1 >= Symin && Py1 <= Symax) return TRUE;
|
||||
else return FALSE;
|
||||
}
|
||||
|
||||
else if (Sy1 == Sy2) /* Line S is horizontal. */
|
||||
{
|
||||
Sxmin = MIN(Sx1, Sx2); Sxmax = MAX(Sx1, Sx2);
|
||||
if (Py1 != Sy1) return FALSE;
|
||||
if (Px1 >= Sxmin && Px1 <= Sxmax) return TRUE;
|
||||
else return FALSE;
|
||||
}
|
||||
else return FALSE; // Segments quelconques
|
||||
if( Sx1 == Sx2 ) /* Line S is vertical. */
|
||||
{
|
||||
Symin = MIN( Sy1, Sy2 ); Symax = MAX( Sy1, Sy2 );
|
||||
if( Px1 != Sx1 )
|
||||
return FALSE;
|
||||
if( Py1 >= Symin && Py1 <= Symax )
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
else if( Sy1 == Sy2 ) /* Line S is horizontal. */
|
||||
{
|
||||
Sxmin = MIN( Sx1, Sx2 ); Sxmax = MAX( Sx1, Sx2 );
|
||||
if( Py1 != Sy1 )
|
||||
return FALSE;
|
||||
if( Px1 >= Sxmin && Px1 <= Sxmax )
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
return FALSE; // Segments quelconques
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC )
|
||||
/******************************************************************************/
|
||||
|
||||
/******************************************************************************/
|
||||
void WinEDA_SchematicFrame::TestDanglingEnds(EDA_BaseStruct *DrawList, wxDC *DC)
|
||||
/******************************************************************************/
|
||||
/* Met a jour les membres m_Dangling des wires, bus, labels
|
||||
*/
|
||||
*/
|
||||
{
|
||||
EDA_BaseStruct * DrawItem;
|
||||
const DanglingEndHandle * DanglingItem, * nextitem;
|
||||
|
||||
if ( ItemList )
|
||||
for ( DanglingItem = ItemList; DanglingItem != NULL; DanglingItem = nextitem)
|
||||
{
|
||||
nextitem = DanglingItem->m_Pnext;
|
||||
delete DanglingItem;
|
||||
}
|
||||
|
||||
ItemList = RebuildEndList(DrawList);
|
||||
// Controle des elements
|
||||
for ( DrawItem = DrawList; DrawItem != NULL; DrawItem= DrawItem->Pnext)
|
||||
{
|
||||
switch( DrawItem->m_StructType )
|
||||
{
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ((DrawLabelStruct*)DrawItem)
|
||||
TestLabelForDangling(STRUCT, this, DC);
|
||||
break;
|
||||
break;
|
||||
|
||||
case DRAW_SEGMENT_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ((EDA_DrawLineStruct*)DrawItem)
|
||||
if( STRUCT->m_Layer == LAYER_WIRE)
|
||||
{
|
||||
TestWireForDangling(STRUCT, this, DC);
|
||||
break;
|
||||
}
|
||||
if( STRUCT->m_Layer == LAYER_NOTES) break;
|
||||
if( STRUCT->m_Layer == LAYER_BUS)
|
||||
{
|
||||
STRUCT->m_StartIsDangling =
|
||||
STRUCT->m_EndIsDangling = FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
EDA_BaseStruct* DrawItem;
|
||||
const DanglingEndHandle* DanglingItem, * nextitem;
|
||||
|
||||
if( ItemList )
|
||||
for( DanglingItem = ItemList; DanglingItem != NULL; DanglingItem = nextitem )
|
||||
{
|
||||
nextitem = DanglingItem->m_Pnext;
|
||||
delete DanglingItem;
|
||||
}
|
||||
|
||||
ItemList = RebuildEndList( DrawList );
|
||||
|
||||
// Controle des elements
|
||||
for( DrawItem = DrawList; DrawItem != NULL; DrawItem = DrawItem->Pnext )
|
||||
{
|
||||
switch( DrawItem->m_StructType )
|
||||
{
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (DrawLabelStruct*) DrawItem )
|
||||
TestLabelForDangling( STRUCT, this, DC );
|
||||
break;
|
||||
break;
|
||||
|
||||
case DRAW_SEGMENT_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (EDA_DrawLineStruct*) DrawItem )
|
||||
if( STRUCT->m_Layer == LAYER_WIRE )
|
||||
{
|
||||
TestWireForDangling( STRUCT, this, DC );
|
||||
break;
|
||||
}
|
||||
if( STRUCT->m_Layer == LAYER_NOTES )
|
||||
break;
|
||||
if( STRUCT->m_Layer == LAYER_BUS )
|
||||
{
|
||||
STRUCT->m_StartIsDangling =
|
||||
STRUCT->m_EndIsDangling = FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
LibDrawPin * WinEDA_SchematicFrame::LocatePinEnd(EDA_BaseStruct *DrawList,
|
||||
const wxPoint & pos)
|
||||
LibDrawPin* WinEDA_SchematicFrame::LocatePinEnd( EDA_BaseStruct* DrawList,
|
||||
const wxPoint& pos )
|
||||
/********************************************************************/
|
||||
|
||||
/* Teste si le point de coordonnées pos est sur l'extrémité d'une PIN
|
||||
retourne un pointeur sur la pin
|
||||
NULL sinon
|
||||
*/
|
||||
* retourne un pointeur sur la pin
|
||||
* NULL sinon
|
||||
*/
|
||||
{
|
||||
EDA_SchComponentStruct * DrawLibItem;
|
||||
LibDrawPin * Pin;
|
||||
wxPoint pinpos;
|
||||
|
||||
Pin = LocateAnyPin(DrawList,pos, &DrawLibItem);
|
||||
if( ! Pin ) return NULL;
|
||||
|
||||
pinpos = Pin->m_Pos;
|
||||
EDA_SchComponentStruct* DrawLibItem;
|
||||
LibDrawPin* Pin;
|
||||
wxPoint pinpos;
|
||||
|
||||
if(DrawLibItem == NULL ) pinpos.y = -pinpos.y;
|
||||
Pin = LocateAnyPin( DrawList, pos, &DrawLibItem );
|
||||
if( !Pin )
|
||||
return NULL;
|
||||
|
||||
else
|
||||
{
|
||||
int x1 = pinpos.x, y1 = pinpos.y;
|
||||
pinpos.x = DrawLibItem->m_Pos.x + DrawLibItem->m_Transform[0][0] * x1
|
||||
+ DrawLibItem->m_Transform[0][1] * y1;
|
||||
pinpos.y = DrawLibItem->m_Pos.y + DrawLibItem->m_Transform[1][0] * x1
|
||||
+ DrawLibItem->m_Transform[1][1] * y1;
|
||||
}
|
||||
pinpos = Pin->m_Pos;
|
||||
|
||||
if( (pos.x == pinpos.x) && (pos.y == pinpos.y) ) return Pin;
|
||||
return NULL;
|
||||
if( DrawLibItem == NULL )
|
||||
pinpos.y = -pinpos.y;
|
||||
|
||||
else
|
||||
{
|
||||
int x1 = pinpos.x, y1 = pinpos.y;
|
||||
pinpos.x = DrawLibItem->m_Pos.x + DrawLibItem->m_Transform[0][0] * x1
|
||||
+ DrawLibItem->m_Transform[0][1] * y1;
|
||||
pinpos.y = DrawLibItem->m_Pos.y + DrawLibItem->m_Transform[1][0] * x1
|
||||
+ DrawLibItem->m_Transform[1][1] * y1;
|
||||
}
|
||||
|
||||
if( (pos.x == pinpos.x) && (pos.y == pinpos.y) )
|
||||
return Pin;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
void TestWireForDangling(EDA_DrawLineStruct * DrawRef,
|
||||
WinEDA_SchematicFrame * frame, wxDC * DC)
|
||||
void TestWireForDangling( EDA_DrawLineStruct* DrawRef,
|
||||
WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||
/****************************************************************************/
|
||||
{
|
||||
DanglingEndHandle * terminal_item;
|
||||
bool Sdangstate = TRUE, Edangstate = TRUE;
|
||||
|
||||
for ( terminal_item = ItemList; terminal_item != NULL;
|
||||
terminal_item = terminal_item->m_Pnext)
|
||||
{
|
||||
if ( terminal_item->m_Item == DrawRef ) continue;
|
||||
|
||||
if ( (DrawRef->m_Start.x == terminal_item->m_Pos.x) &&
|
||||
(DrawRef->m_Start.y == terminal_item->m_Pos.y) )
|
||||
Sdangstate = FALSE;
|
||||
DanglingEndHandle* terminal_item;
|
||||
bool Sdangstate = TRUE, Edangstate = TRUE;
|
||||
|
||||
if ( (DrawRef->m_End.x == terminal_item->m_Pos.x) &&
|
||||
(DrawRef->m_End.y == terminal_item->m_Pos.y) )
|
||||
Edangstate = FALSE;
|
||||
for( terminal_item = ItemList; terminal_item != NULL;
|
||||
terminal_item = terminal_item->m_Pnext )
|
||||
{
|
||||
if( terminal_item->m_Item == DrawRef )
|
||||
continue;
|
||||
|
||||
if ( (Sdangstate == FALSE) && (Edangstate == FALSE) )
|
||||
break;
|
||||
}
|
||||
if( (DrawRef->m_Start.x == terminal_item->m_Pos.x)
|
||||
&& (DrawRef->m_Start.y == terminal_item->m_Pos.y) )
|
||||
Sdangstate = FALSE;
|
||||
|
||||
if ( (Sdangstate != DrawRef->m_StartIsDangling) ||
|
||||
(Edangstate != DrawRef->m_EndIsDangling) )
|
||||
{
|
||||
if ( DC )
|
||||
RedrawOneStruct(frame->DrawPanel,DC, DrawRef, g_XorMode);
|
||||
DrawRef->m_StartIsDangling = Sdangstate;
|
||||
DrawRef->m_EndIsDangling = Edangstate;
|
||||
if ( DC )
|
||||
RedrawOneStruct(frame->DrawPanel,DC, DrawRef, GR_DEFAULT_DRAWMODE);
|
||||
}
|
||||
if( (DrawRef->m_End.x == terminal_item->m_Pos.x)
|
||||
&& (DrawRef->m_End.y == terminal_item->m_Pos.y) )
|
||||
Edangstate = FALSE;
|
||||
|
||||
if( (Sdangstate == FALSE) && (Edangstate == FALSE) )
|
||||
break;
|
||||
}
|
||||
|
||||
if( (Sdangstate != DrawRef->m_StartIsDangling)
|
||||
|| (Edangstate != DrawRef->m_EndIsDangling) )
|
||||
{
|
||||
if( DC )
|
||||
RedrawOneStruct( frame->DrawPanel, DC, DrawRef, g_XorMode );
|
||||
DrawRef->m_StartIsDangling = Sdangstate;
|
||||
DrawRef->m_EndIsDangling = Edangstate;
|
||||
if( DC )
|
||||
RedrawOneStruct( frame->DrawPanel, DC, DrawRef, GR_DEFAULT_DRAWMODE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/********************************************************/
|
||||
void TestLabelForDangling(DrawTextStruct * label,
|
||||
WinEDA_SchematicFrame * frame, wxDC * DC)
|
||||
void TestLabelForDangling( DrawTextStruct* label,
|
||||
WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||
/********************************************************/
|
||||
{
|
||||
DanglingEndHandle * terminal_item;
|
||||
bool dangstate = TRUE;
|
||||
|
||||
for ( terminal_item = ItemList; terminal_item != NULL;
|
||||
terminal_item = terminal_item->m_Pnext)
|
||||
{
|
||||
if ( terminal_item->m_Item == label ) continue;
|
||||
switch( terminal_item->m_Type )
|
||||
{
|
||||
case PIN_END:
|
||||
case LABEL_END:
|
||||
case SHEET_LABEL_END:
|
||||
if ( (label->m_Pos.x == terminal_item->m_Pos.x) &&
|
||||
(label->m_Pos.y == terminal_item->m_Pos.y) )
|
||||
dangstate = FALSE;
|
||||
break;
|
||||
DanglingEndHandle* terminal_item;
|
||||
bool dangstate = TRUE;
|
||||
|
||||
case WIRE_START_END:
|
||||
case BUS_START_END:
|
||||
dangstate = ! SegmentIntersect(terminal_item->m_Pos.x,
|
||||
terminal_item->m_Pos.y,
|
||||
terminal_item->m_Pnext->m_Pos.x,
|
||||
terminal_item->m_Pnext->m_Pos.y,
|
||||
label->m_Pos.x, label->m_Pos.y);
|
||||
terminal_item = terminal_item->m_Pnext;
|
||||
break;
|
||||
for( terminal_item = ItemList; terminal_item != NULL;
|
||||
terminal_item = terminal_item->m_Pnext )
|
||||
{
|
||||
if( terminal_item->m_Item == label )
|
||||
continue;
|
||||
|
||||
case UNKNOWN:
|
||||
case JUNCTION_END:
|
||||
case ENTRY_END:
|
||||
case WIRE_END_END:
|
||||
case BUS_END_END:
|
||||
break;
|
||||
}
|
||||
switch( terminal_item->m_Type )
|
||||
{
|
||||
case PIN_END:
|
||||
case LABEL_END:
|
||||
case SHEET_LABEL_END:
|
||||
if( (label->m_Pos.x == terminal_item->m_Pos.x)
|
||||
&& (label->m_Pos.y == terminal_item->m_Pos.y) )
|
||||
dangstate = FALSE;
|
||||
break;
|
||||
|
||||
if (dangstate == FALSE) break;
|
||||
}
|
||||
case WIRE_START_END:
|
||||
case BUS_START_END:
|
||||
dangstate = !SegmentIntersect( terminal_item->m_Pos.x,
|
||||
terminal_item->m_Pos.y,
|
||||
terminal_item->m_Pnext->m_Pos.x,
|
||||
terminal_item->m_Pnext->m_Pos.y,
|
||||
label->m_Pos.x, label->m_Pos.y );
|
||||
terminal_item = terminal_item->m_Pnext;
|
||||
break;
|
||||
|
||||
if ( dangstate != label->m_IsDangling )
|
||||
{
|
||||
if ( DC )
|
||||
RedrawOneStruct(frame->DrawPanel,DC, label, g_XorMode);
|
||||
label->m_IsDangling = dangstate;
|
||||
if ( DC )
|
||||
RedrawOneStruct(frame->DrawPanel,DC, label, GR_DEFAULT_DRAWMODE);
|
||||
}
|
||||
case UNKNOWN:
|
||||
case JUNCTION_END:
|
||||
case ENTRY_END:
|
||||
case WIRE_END_END:
|
||||
case BUS_END_END:
|
||||
break;
|
||||
}
|
||||
|
||||
if( dangstate == FALSE )
|
||||
break;
|
||||
}
|
||||
|
||||
if( dangstate != label->m_IsDangling )
|
||||
{
|
||||
if( DC )
|
||||
RedrawOneStruct( frame->DrawPanel, DC, label, g_XorMode );
|
||||
label->m_IsDangling = dangstate;
|
||||
if( DC )
|
||||
RedrawOneStruct( frame->DrawPanel, DC, label, GR_DEFAULT_DRAWMODE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************/
|
||||
wxPoint ReturnPinPhysicalPosition( LibDrawPin * Pin,
|
||||
EDA_SchComponentStruct * DrawLibItem)
|
||||
wxPoint ReturnPinPhysicalPosition( LibDrawPin* Pin,
|
||||
EDA_SchComponentStruct* DrawLibItem )
|
||||
/****************************************************/
|
||||
|
||||
/* Retourne la position physique de la pin, qui dépend de l'orientation
|
||||
du composant */
|
||||
* du composant */
|
||||
{
|
||||
wxPoint PinPos = Pin->m_Pos;
|
||||
|
||||
if(DrawLibItem == NULL ) PinPos.y = -PinPos.y;
|
||||
wxPoint PinPos = Pin->m_Pos;
|
||||
|
||||
else
|
||||
{
|
||||
int x = Pin->m_Pos.x, y = Pin->m_Pos.y;
|
||||
PinPos.x = DrawLibItem->m_Pos.x + DrawLibItem->m_Transform[0][0] * x
|
||||
+ DrawLibItem->m_Transform[0][1] * y;
|
||||
PinPos.y = DrawLibItem->m_Pos.y + DrawLibItem->m_Transform[1][0] * x
|
||||
+ DrawLibItem->m_Transform[1][1] * y;
|
||||
}
|
||||
if( DrawLibItem == NULL )
|
||||
PinPos.y = -PinPos.y;
|
||||
|
||||
return PinPos;
|
||||
else
|
||||
{
|
||||
int x = Pin->m_Pos.x, y = Pin->m_Pos.y;
|
||||
PinPos.x = DrawLibItem->m_Pos.x + DrawLibItem->m_Transform[0][0] * x
|
||||
+ DrawLibItem->m_Transform[0][1] * y;
|
||||
PinPos.y = DrawLibItem->m_Pos.y + DrawLibItem->m_Transform[1][0] * x
|
||||
+ DrawLibItem->m_Transform[1][1] * y;
|
||||
}
|
||||
|
||||
return PinPos;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************/
|
||||
DanglingEndHandle * RebuildEndList(EDA_BaseStruct *DrawList)
|
||||
DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
|
||||
/***********************************************************/
|
||||
{
|
||||
DanglingEndHandle * StartList = NULL, *item, *lastitem = NULL;
|
||||
EDA_BaseStruct * DrawItem;
|
||||
|
||||
for ( DrawItem = DrawList; DrawItem != NULL; DrawItem = DrawItem->Pnext)
|
||||
{
|
||||
switch( DrawItem->m_StructType )
|
||||
{
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
break;
|
||||
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ((DrawGlobalLabelStruct*)DrawItem)
|
||||
item = new DanglingEndHandle(LABEL_END);
|
||||
item->m_Item = DrawItem;
|
||||
item->m_Pos = STRUCT->m_Pos;
|
||||
if ( lastitem ) lastitem->m_Pnext = item;
|
||||
else StartList = item;
|
||||
lastitem = item;
|
||||
break;
|
||||
|
||||
case DRAW_SEGMENT_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ((EDA_DrawLineStruct*)DrawItem)
|
||||
if( STRUCT->m_Layer == LAYER_NOTES ) break;
|
||||
if( (STRUCT->m_Layer == LAYER_BUS) || (STRUCT->m_Layer == LAYER_WIRE) )
|
||||
{
|
||||
item = new DanglingEndHandle((STRUCT->m_Layer == LAYER_BUS) ?
|
||||
BUS_START_END : WIRE_START_END);
|
||||
item->m_Item = DrawItem;
|
||||
item->m_Pos = STRUCT->m_Start;
|
||||
if ( lastitem ) lastitem->m_Pnext = item;
|
||||
else StartList = item;
|
||||
lastitem = item;
|
||||
item = new DanglingEndHandle((STRUCT->m_Layer == LAYER_BUS) ?
|
||||
BUS_END_END : WIRE_END_END);
|
||||
item->m_Item = DrawItem;
|
||||
item->m_Pos = STRUCT->m_End;
|
||||
lastitem->m_Pnext = item;
|
||||
lastitem = item;
|
||||
}
|
||||
break;
|
||||
|
||||
case DRAW_JUNCTION_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ((DrawJunctionStruct*)DrawItem)
|
||||
item = new DanglingEndHandle(JUNCTION_END);
|
||||
item->m_Item = DrawItem;
|
||||
item->m_Pos = STRUCT->m_Pos;
|
||||
if ( lastitem ) lastitem->m_Pnext = item;
|
||||
else StartList = item;
|
||||
lastitem = item;
|
||||
break;
|
||||
|
||||
case DRAW_BUSENTRY_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ((DrawBusEntryStruct*)DrawItem)
|
||||
item = new DanglingEndHandle(ENTRY_END);
|
||||
item->m_Item = DrawItem;
|
||||
item->m_Pos = STRUCT->m_Pos;
|
||||
if ( lastitem ) lastitem->m_Pnext = item;
|
||||
else StartList = item;
|
||||
lastitem = item;
|
||||
item = new DanglingEndHandle(ENTRY_END);
|
||||
item->m_Item = DrawItem;
|
||||
item->m_Pos = STRUCT->m_End();
|
||||
lastitem->m_Pnext = item;
|
||||
lastitem = item;
|
||||
break;
|
||||
|
||||
case DRAW_LIB_ITEM_STRUCT_TYPE:
|
||||
{
|
||||
#undef STRUCT
|
||||
#define STRUCT ((EDA_SchComponentStruct*)DrawItem)
|
||||
EDA_LibComponentStruct * Entry;
|
||||
Entry = FindLibPart( STRUCT->m_ChipName, wxEmptyString, FIND_ROOT);
|
||||
if( Entry == NULL ) break;
|
||||
LibEDA_BaseStruct * DrawLibItem = Entry->m_Drawings;
|
||||
for ( ; DrawLibItem != NULL; DrawLibItem = DrawLibItem->Next())
|
||||
{
|
||||
if(DrawLibItem->m_StructType != COMPONENT_PIN_DRAW_TYPE) continue;
|
||||
DanglingEndHandle* StartList = NULL, * item, * lastitem = NULL;
|
||||
EDA_BaseStruct* DrawItem;
|
||||
|
||||
LibDrawPin * Pin = (LibDrawPin *) DrawLibItem;
|
||||
for( DrawItem = DrawList; DrawItem != NULL; DrawItem = DrawItem->Pnext )
|
||||
{
|
||||
switch( DrawItem->m_StructType )
|
||||
{
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
break;
|
||||
|
||||
if( Pin->m_Unit && DrawLibItem->m_Unit &&
|
||||
(DrawLibItem->m_Unit != Pin->m_Unit) )
|
||||
continue;
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (DrawGlobalLabelStruct*) DrawItem )
|
||||
item = new DanglingEndHandle( LABEL_END );
|
||||
|
||||
if( Pin->m_Convert && DrawLibItem->m_Convert &&
|
||||
(DrawLibItem->m_Convert != Pin->m_Convert) )
|
||||
continue;
|
||||
item->m_Item = DrawItem;
|
||||
item->m_Pos = STRUCT->m_Pos;
|
||||
if( lastitem )
|
||||
lastitem->m_Pnext = item;
|
||||
else
|
||||
StartList = item;
|
||||
lastitem = item;
|
||||
break;
|
||||
|
||||
item = new DanglingEndHandle(PIN_END);
|
||||
item->m_Item = Pin;
|
||||
item->m_Pos = ReturnPinPhysicalPosition( Pin,STRUCT);
|
||||
if ( lastitem ) lastitem->m_Pnext = item;
|
||||
else StartList = item;
|
||||
lastitem = item;
|
||||
}
|
||||
break;
|
||||
case DRAW_SEGMENT_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (EDA_DrawLineStruct*) DrawItem )
|
||||
if( STRUCT->m_Layer == LAYER_NOTES )
|
||||
break;
|
||||
if( (STRUCT->m_Layer == LAYER_BUS) || (STRUCT->m_Layer == LAYER_WIRE) )
|
||||
{
|
||||
item = new DanglingEndHandle( (STRUCT->m_Layer == LAYER_BUS) ?
|
||||
BUS_START_END : WIRE_START_END );
|
||||
|
||||
}
|
||||
item->m_Item = DrawItem;
|
||||
item->m_Pos = STRUCT->m_Start;
|
||||
if( lastitem )
|
||||
lastitem->m_Pnext = item;
|
||||
else
|
||||
StartList = item;
|
||||
lastitem = item;
|
||||
item = new DanglingEndHandle( (STRUCT->m_Layer == LAYER_BUS) ?
|
||||
BUS_END_END : WIRE_END_END );
|
||||
|
||||
case DRAW_SHEET_STRUCT_TYPE:
|
||||
{
|
||||
#undef STRUCT
|
||||
#define STRUCT ((DrawSheetStruct*)DrawItem)
|
||||
DrawSheetLabelStruct * pinsheet = STRUCT->m_Label;
|
||||
while(pinsheet)
|
||||
{
|
||||
item = new DanglingEndHandle(SHEET_LABEL_END);
|
||||
item->m_Item = pinsheet;
|
||||
item->m_Pos = pinsheet->m_Pos;
|
||||
if ( lastitem ) lastitem->m_Pnext = item;
|
||||
else StartList = item;
|
||||
lastitem = item;
|
||||
pinsheet = (DrawSheetLabelStruct*)pinsheet->Pnext;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return StartList;
|
||||
item->m_Item = DrawItem;
|
||||
item->m_Pos = STRUCT->m_End;
|
||||
lastitem->m_Pnext = item;
|
||||
lastitem = item;
|
||||
}
|
||||
break;
|
||||
|
||||
case DRAW_JUNCTION_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (DrawJunctionStruct*) DrawItem )
|
||||
item = new DanglingEndHandle( JUNCTION_END );
|
||||
|
||||
item->m_Item = DrawItem;
|
||||
item->m_Pos = STRUCT->m_Pos;
|
||||
if( lastitem )
|
||||
lastitem->m_Pnext = item;
|
||||
else
|
||||
StartList = item;
|
||||
lastitem = item;
|
||||
break;
|
||||
|
||||
case DRAW_BUSENTRY_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (DrawBusEntryStruct*) DrawItem )
|
||||
item = new DanglingEndHandle( ENTRY_END );
|
||||
|
||||
item->m_Item = DrawItem;
|
||||
item->m_Pos = STRUCT->m_Pos;
|
||||
if( lastitem )
|
||||
lastitem->m_Pnext = item;
|
||||
else
|
||||
StartList = item;
|
||||
lastitem = item;
|
||||
item = new DanglingEndHandle( ENTRY_END );
|
||||
|
||||
item->m_Item = DrawItem;
|
||||
item->m_Pos = STRUCT->m_End();
|
||||
lastitem->m_Pnext = item;
|
||||
lastitem = item;
|
||||
break;
|
||||
|
||||
case DRAW_LIB_ITEM_STRUCT_TYPE:
|
||||
{
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (EDA_SchComponentStruct*) DrawItem )
|
||||
EDA_LibComponentStruct* Entry;
|
||||
Entry = FindLibPart( STRUCT->m_ChipName, wxEmptyString, FIND_ROOT );
|
||||
if( Entry == NULL )
|
||||
break;
|
||||
|
||||
LibEDA_BaseStruct* DrawLibItem = Entry->m_Drawings;
|
||||
for( ; DrawLibItem != NULL; DrawLibItem = DrawLibItem->Next() )
|
||||
{
|
||||
if( DrawLibItem->m_StructType != COMPONENT_PIN_DRAW_TYPE )
|
||||
continue;
|
||||
|
||||
LibDrawPin* Pin = (LibDrawPin*) DrawLibItem;
|
||||
|
||||
if( Pin->m_Unit && DrawLibItem->m_Unit
|
||||
&& (DrawLibItem->m_Unit != Pin->m_Unit) )
|
||||
continue;
|
||||
|
||||
if( Pin->m_Convert && DrawLibItem->m_Convert
|
||||
&& (DrawLibItem->m_Convert != Pin->m_Convert) )
|
||||
continue;
|
||||
|
||||
item = new DanglingEndHandle( PIN_END );
|
||||
|
||||
item->m_Item = Pin;
|
||||
item->m_Pos = ReturnPinPhysicalPosition( Pin, STRUCT );
|
||||
if( lastitem )
|
||||
lastitem->m_Pnext = item;
|
||||
else
|
||||
StartList = item;
|
||||
lastitem = item;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case DRAW_SHEET_STRUCT_TYPE:
|
||||
{
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (DrawSheetStruct*) DrawItem )
|
||||
DrawSheetLabelStruct* pinsheet = STRUCT->m_Label;
|
||||
while( pinsheet )
|
||||
{
|
||||
item = new DanglingEndHandle( SHEET_LABEL_END );
|
||||
|
||||
item->m_Item = pinsheet;
|
||||
item->m_Pos = pinsheet->m_Pos;
|
||||
if( lastitem )
|
||||
lastitem->m_Pnext = item;
|
||||
else
|
||||
StartList = item;
|
||||
lastitem = item;
|
||||
pinsheet = (DrawSheetLabelStruct*) pinsheet->Pnext;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
return StartList;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -212,6 +212,8 @@ wxPoint MousePos = m_CurrentScreen->m_MousePosition;
|
|||
}
|
||||
ChangeTextOrient( (DrawTextStruct*)DrawStruct, DC);
|
||||
break;
|
||||
|
||||
default:;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -13,118 +13,120 @@
|
|||
|
||||
#define LIB_VERSION_MAJOR 2
|
||||
#define LIB_VERSION_MINOR 3
|
||||
#define LIBFILE_IDENT "EESchema-LIBRARY Version" /* Must be at the lib file start. */
|
||||
#define DOCFILE_IDENT "EESchema-DOCLIB Version 2.0" /* Must be at the doc file start. */
|
||||
#define DOC_EXT wxT(".dcm") /* extension des fichiers de documentation */
|
||||
#define LIBFILE_IDENT "EESchema-LIBRARY Version" /* Must be at the lib file start. */
|
||||
#define DOCFILE_IDENT "EESchema-DOCLIB Version 2.0" /* Must be at the doc file start. */
|
||||
#define DOC_EXT wxT( ".dcm" ) /* extension des fichiers de documentation */
|
||||
|
||||
#define TARGET_PIN_DIAM 12 /* Diam cercle des extremites des pins */
|
||||
#define TARGET_PIN_DIAM 12 /* Diam cercle des extremites des pins */
|
||||
|
||||
#define DEFAULT_TEXT_SIZE 50 /* Default size for field texts */
|
||||
#define PART_NAME_LEN 15 /* Maximum length of part name. */
|
||||
#define PREFIX_NAME_LEN 5 /* Maximum length of prefix (IC, R, SW etc.). */
|
||||
#define PIN_WIDTH 100 /* Width between 2 pins in internal units. */
|
||||
#define PIN_LENGTH 300 /* Default Length of each pin to be drawn. */
|
||||
#define DEFAULT_TEXT_SIZE 50 /* Default size for field texts */
|
||||
#define PART_NAME_LEN 15 /* Maximum length of part name. */
|
||||
#define PREFIX_NAME_LEN 5 /* Maximum length of prefix (IC, R, SW etc.). */
|
||||
#define PIN_WIDTH 100 /* Width between 2 pins in internal units. */
|
||||
#define PIN_LENGTH 300 /* Default Length of each pin to be drawn. */
|
||||
|
||||
#define INVERT_PIN_RADIUS 35 /* Radius of inverted pin circle. */
|
||||
#define CLOCK_PIN_DIM 40 /* Dim of clock pin symbol. */
|
||||
#define IEEE_SYMBOL_PIN_DIM 40 /* Dim of special pin symbol. */
|
||||
#define INVERT_PIN_RADIUS 35 /* Radius of inverted pin circle. */
|
||||
#define CLOCK_PIN_DIM 40 /* Dim of clock pin symbol. */
|
||||
#define IEEE_SYMBOL_PIN_DIM 40 /* Dim of special pin symbol. */
|
||||
|
||||
#define NO_FILL 0 // Poly, Squar, Circle, Arc = option No Fill
|
||||
#define FILLED_SHAPE 1 // Poly, Squar, Circle, Arc = option Fill with current color
|
||||
#define FILLED_WITH_BG_BODYCOLOR 2 // Poly, Squar, Circle, Arc = option Fill
|
||||
// with background body color
|
||||
#define NO_FILL 0 // Poly, Squar, Circle, Arc = option No Fill
|
||||
#define FILLED_SHAPE 1 // Poly, Squar, Circle, Arc = option Fill with current color
|
||||
#define FILLED_WITH_BG_BODYCOLOR 2 // Poly, Squar, Circle, Arc = option Fill
|
||||
// with background body color
|
||||
|
||||
//Offsets used in editing library component, for handle aliad dats
|
||||
#define ALIAS_NAME 0
|
||||
#define ALIAS_DOC 1
|
||||
#define ALIAS_KEYWORD 2
|
||||
#define ALIAS_NAME 0
|
||||
#define ALIAS_DOC 1
|
||||
#define ALIAS_KEYWORD 2
|
||||
#define ALIAS_DOC_FILENAME 3
|
||||
#define ALIAS_NEXT 4
|
||||
#define ALIAS_NEXT 4
|
||||
|
||||
|
||||
typedef enum {
|
||||
LOCATE_COMPONENT_ARC_DRAW_TYPE = 1,
|
||||
LOCATE_COMPONENT_CIRCLE_DRAW_TYPE = 2,
|
||||
LOCATE_COMPONENT_GRAPHIC_TEXT_DRAW_TYPE = 4,
|
||||
LOCATE_COMPONENT_RECT_DRAW_TYPE = 8,
|
||||
LOCATE_LINE_DRAW_TYPE = 0x10,
|
||||
LOCATE_COMPONENT_POLYLINE_DRAW_TYPE = 0x20,
|
||||
LOCATE_COMPONENT_LINE_DRAW_TYPE = 0x40
|
||||
LOCATE_COMPONENT_ARC_DRAW_TYPE = 1,
|
||||
LOCATE_COMPONENT_CIRCLE_DRAW_TYPE = 2,
|
||||
LOCATE_COMPONENT_GRAPHIC_TEXT_DRAW_TYPE = 4,
|
||||
LOCATE_COMPONENT_RECT_DRAW_TYPE = 8,
|
||||
LOCATE_LINE_DRAW_TYPE = 0x10,
|
||||
LOCATE_COMPONENT_POLYLINE_DRAW_TYPE = 0x20,
|
||||
LOCATE_COMPONENT_LINE_DRAW_TYPE = 0x40
|
||||
} LocateDrawStructType;
|
||||
|
||||
#define LOCATE_ALL_DRAW_ITEM 0xFFFFFFFF
|
||||
|
||||
/* flags utilises dans FindLibPart() : */
|
||||
#define FIND_ROOT 0 /* indique la recherche du composant racine si
|
||||
meme si le composant specifie est un alias */
|
||||
#define FIND_ALIAS 1 /* indique la recherche du composant specifie
|
||||
(alias ou racine) */
|
||||
#define FIND_ROOT 0 /* indique la recherche du composant racine si
|
||||
* meme si le composant specifie est un alias */
|
||||
#define FIND_ALIAS 1 /* indique la recherche du composant specifie
|
||||
* (alias ou racine) */
|
||||
|
||||
/* definition des types des structures d'elements de librairie */
|
||||
typedef enum {
|
||||
ROOT, /* Structure est a standard EDA_LibComponentStruct */
|
||||
ALIAS /* Structure is an alias */
|
||||
ROOT, /* Structure est a standard EDA_LibComponentStruct */
|
||||
ALIAS /* Structure is an alias */
|
||||
} LibrEntryType;
|
||||
|
||||
/* valeur du membre .m_Options */
|
||||
typedef enum {
|
||||
ENTRY_NORMAL, // Libentry is standard
|
||||
ENTRY_POWER // Libentry is a power symbol
|
||||
ENTRY_NORMAL, // Libentry is standard
|
||||
ENTRY_POWER // Libentry is a power symbol
|
||||
} LibrEntryOptions;
|
||||
|
||||
/* Definitions des Pins */
|
||||
|
||||
typedef enum { /* Type des Pins. si modif: modifier tableau des mgs suivant */
|
||||
PIN_INPUT,
|
||||
PIN_OUTPUT,
|
||||
PIN_BIDI,
|
||||
PIN_TRISTATE,
|
||||
PIN_PASSIVE,
|
||||
PIN_UNSPECIFIED,
|
||||
PIN_POWER_IN,
|
||||
PIN_POWER_OUT,
|
||||
PIN_OPENCOLLECTOR,
|
||||
PIN_OPENEMITTER,
|
||||
PIN_NC, /* No connect */
|
||||
PIN_NMAX /* Valeur limite ( utilisee comme limite de tableaux) */
|
||||
typedef enum { /* Type des Pins. si modif: modifier tableau des mgs suivant */
|
||||
PIN_INPUT,
|
||||
PIN_OUTPUT,
|
||||
PIN_BIDI,
|
||||
PIN_TRISTATE,
|
||||
PIN_PASSIVE,
|
||||
PIN_UNSPECIFIED,
|
||||
PIN_POWER_IN,
|
||||
PIN_POWER_OUT,
|
||||
PIN_OPENCOLLECTOR,
|
||||
PIN_OPENEMITTER,
|
||||
PIN_NC, /* No connect */
|
||||
PIN_NMAX /* Valeur limite ( utilisee comme limite de tableaux) */
|
||||
} ElectricPinType;
|
||||
|
||||
/* Messages d'affichage du type electrique */
|
||||
eda_global wxChar * MsgPinElectricType[]
|
||||
eda_global wxChar* MsgPinElectricType[]
|
||||
#ifdef MAIN
|
||||
= {
|
||||
wxT("input"),
|
||||
wxT("output"),
|
||||
wxT("BiDi"),
|
||||
wxT("3state"),
|
||||
wxT("passive"),
|
||||
wxT("unspc"),
|
||||
wxT("power_in"),
|
||||
wxT("power_out"),
|
||||
wxT("openCol"),
|
||||
wxT("openEm"),
|
||||
wxT("?????")
|
||||
}
|
||||
= {
|
||||
wxT( "input" ),
|
||||
wxT( "output" ),
|
||||
wxT( "BiDi" ),
|
||||
wxT( "3state" ),
|
||||
wxT( "passive" ),
|
||||
wxT( "unspc" ),
|
||||
wxT( "power_in" ),
|
||||
wxT( "power_out" ),
|
||||
wxT( "openCol" ),
|
||||
wxT( "openEm" ),
|
||||
wxT( "?????" )
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
;
|
||||
;
|
||||
|
||||
/* Autres bits: bits du membre .Flag des Pins */
|
||||
#define PINNOTDRAW 1 /* si 1: pin invisible */
|
||||
#define PINNOTDRAW 1 /* si 1: pin invisible */
|
||||
|
||||
typedef enum { /* Forme des Pins */
|
||||
NONE = 0,
|
||||
INVERT = 1,
|
||||
CLOCK = 2,
|
||||
LOWLEVEL_IN = 4,
|
||||
LOWLEVEL_OUT = 8
|
||||
} DrawPinShape;
|
||||
typedef enum { /* Forme des Pins */
|
||||
NONE = 0,
|
||||
INVERT = 1,
|
||||
CLOCK = 2,
|
||||
LOWLEVEL_IN = 4,
|
||||
LOWLEVEL_OUT = 8
|
||||
} DrawPinShape;
|
||||
|
||||
typedef enum { /* Orientation des Pins */
|
||||
PIN_RIGHT = 'R',
|
||||
PIN_LEFT = 'L',
|
||||
PIN_UP = 'U',
|
||||
PIN_DOWN = 'D',
|
||||
} DrawPinOrient;
|
||||
typedef enum { /* Orientation des Pins */
|
||||
PIN_RIGHT = 'R',
|
||||
PIN_LEFT = 'L',
|
||||
PIN_UP = 'U',
|
||||
PIN_DOWN = 'D',
|
||||
} DrawPinOrient;
|
||||
|
||||
/*************************************/
|
||||
/* Classe representant une librairie */
|
||||
|
@ -133,25 +135,25 @@ typedef enum { /* Orientation des Pins */
|
|||
class LibraryStruct
|
||||
{
|
||||
public:
|
||||
int m_Type; /* type indicator */
|
||||
wxString m_Name; /* Name of library loaded. */
|
||||
wxString m_FullFileName; /* Full File Name (with path) of library loaded. */
|
||||
wxString m_Header; /* first line of library loaded. */
|
||||
int m_NumOfParts; /* Number of parts this library has. */
|
||||
PriorQue * m_Entries; /* Parts themselves are saved here. */
|
||||
LibraryStruct * m_Pnext; /* Point on next lib in chain. */
|
||||
int m_Modified; /* flag indicateur d'edition */
|
||||
int m_Size; // Size in bytes (for statistics)
|
||||
unsigned long m_TimeStamp; // Signature temporelle
|
||||
int m_Flags; // variable used in some functions
|
||||
bool m_IsLibCache; // False for the "standard" libraries,
|
||||
// True for the library cache
|
||||
int m_Type; /* type indicator */
|
||||
wxString m_Name; /* Name of library loaded. */
|
||||
wxString m_FullFileName; /* Full File Name (with path) of library loaded. */
|
||||
wxString m_Header; /* first line of library loaded. */
|
||||
int m_NumOfParts; /* Number of parts this library has. */
|
||||
PriorQue* m_Entries; /* Parts themselves are saved here. */
|
||||
LibraryStruct* m_Pnext; /* Point on next lib in chain. */
|
||||
int m_Modified; /* flag indicateur d'edition */
|
||||
int m_Size; // Size in bytes (for statistics)
|
||||
unsigned long m_TimeStamp; // Signature temporelle
|
||||
int m_Flags; // variable used in some functions
|
||||
bool m_IsLibCache; // False for the "standard" libraries,
|
||||
// True for the library cache
|
||||
|
||||
public:
|
||||
LibraryStruct(int type, const wxString & name, const wxString & fullname);
|
||||
~LibraryStruct();
|
||||
bool WriteHeader(FILE * file);
|
||||
bool ReadHeader(FILE * file, int * LineNum);
|
||||
LibraryStruct( int type, const wxString &name, const wxString &fullname );
|
||||
~LibraryStruct();
|
||||
bool WriteHeader( FILE* file );
|
||||
bool ReadHeader( FILE* file, int* LineNum );
|
||||
};
|
||||
|
||||
|
||||
|
@ -161,252 +163,260 @@ public:
|
|||
|
||||
|
||||
/* class LibEDA_BaseStruct : Basic class for items used in a library component
|
||||
(graphic shapes, texts, fields, pins)
|
||||
*/
|
||||
* (graphic shapes, texts, fields, pins)
|
||||
*/
|
||||
|
||||
class LibEDA_BaseStruct : public EDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
int m_Unit; /* Unit identification (for multi part per parkage)
|
||||
0 if the item is common to all units */
|
||||
int m_Convert; /* Shape identification (for parts which have a convert shape)
|
||||
0 if the item is common to all shapes */
|
||||
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */
|
||||
int m_Width; /* Width of draw lines */
|
||||
int m_Unit; /* Unit identification (for multi part per parkage)
|
||||
* 0 if the item is common to all units */
|
||||
int m_Convert; /* Shape identification (for parts which have a convert shape)
|
||||
* 0 if the item is common to all shapes */
|
||||
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */
|
||||
int m_Width; /* Width of draw lines */
|
||||
|
||||
public:
|
||||
LibEDA_BaseStruct * Next(void) {return (LibEDA_BaseStruct *) Pnext;}
|
||||
LibEDA_BaseStruct(int struct_type);
|
||||
virtual ~LibEDA_BaseStruct(void){}
|
||||
void Display_Infos_DrawEntry(WinEDA_DrawFrame * frame);
|
||||
LibEDA_BaseStruct* Next( void )
|
||||
{
|
||||
return (LibEDA_BaseStruct*) Pnext;
|
||||
}
|
||||
LibEDA_BaseStruct( KICAD_T struct_type );
|
||||
virtual ~LibEDA_BaseStruct( void ) { }
|
||||
void Display_Infos_DrawEntry( WinEDA_DrawFrame* frame );
|
||||
};
|
||||
|
||||
|
||||
class LibDrawPin : public LibEDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
int m_PinLen; /* Pin lenght */
|
||||
int m_Orient; /* Pin orientation (Up, Down, Left, Right) */
|
||||
int m_PinShape; /* Bitwise ORed: Pin shape (see enum DrawPinShape) */
|
||||
int m_PinType; /* Electrical pin properties */
|
||||
int m_Attributs; /* bit 0 != 0: pin invisible */
|
||||
long m_PinNum; /* Pin number: 4 Ascii code like "12" or "anod" or "G6"
|
||||
"12" is really "12\0\0"*/
|
||||
wxString m_PinName;
|
||||
int m_PinNumSize, m_PinNameSize; /* Pin num and Pin name sizes */
|
||||
int m_PinLen; /* Pin lenght */
|
||||
int m_Orient; /* Pin orientation (Up, Down, Left, Right) */
|
||||
int m_PinShape; /* Bitwise ORed: Pin shape (see enum DrawPinShape) */
|
||||
int m_PinType; /* Electrical pin properties */
|
||||
int m_Attributs; /* bit 0 != 0: pin invisible */
|
||||
long m_PinNum; /* Pin number: 4 Ascii code like "12" or "anod" or "G6"
|
||||
* "12" is really "12\0\0"*/
|
||||
wxString m_PinName;
|
||||
int m_PinNumSize, m_PinNameSize;/* Pin num and Pin name sizes */
|
||||
|
||||
// short m_PinNumWidth, m_PinNameWidth; /* (Unused) Pin num and Pin name text width */
|
||||
|
||||
public:
|
||||
LibDrawPin(void);
|
||||
~LibDrawPin(void) {}
|
||||
LibDrawPin * GenCopy(void);
|
||||
bool WriteDescr( FILE * File );
|
||||
void Display_Infos(WinEDA_DrawFrame * frame);
|
||||
wxPoint ReturnPinEndPoint(void);
|
||||
int ReturnPinDrawOrient(int TransMat[2][2]);
|
||||
void ReturnPinStringNum(wxString & buffer);
|
||||
void SetPinNumFromString(wxString & buffer);
|
||||
void DrawPinSymbol(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & pin_pos, int orient,
|
||||
int DrawMode, int Color = -1);
|
||||
LibDrawPin( void );
|
||||
~LibDrawPin( void ) { }
|
||||
LibDrawPin* GenCopy( void );
|
||||
bool WriteDescr( FILE* File );
|
||||
void Display_Infos( WinEDA_DrawFrame* frame );
|
||||
wxPoint ReturnPinEndPoint( void );
|
||||
int ReturnPinDrawOrient( int TransMat[2][2] );
|
||||
void ReturnPinStringNum( wxString& buffer );
|
||||
void SetPinNumFromString( wxString& buffer );
|
||||
void DrawPinSymbol( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& pin_pos,
|
||||
int orient,
|
||||
int DrawMode, int Color = -1 );
|
||||
|
||||
void DrawPinTexts(WinEDA_DrawPanel * panel, wxDC * DC,
|
||||
wxPoint & pin_pos, int orient,
|
||||
int TextInside, bool DrawPinNum, bool DrawPinName,
|
||||
int Color, int DrawMode);
|
||||
void PlotPinTexts(wxPoint & pin_pos, int orient,
|
||||
int TextInside, bool DrawPinNum, bool DrawPinName);
|
||||
void DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
wxPoint& pin_pos, int orient,
|
||||
int TextInside, bool DrawPinNum, bool DrawPinName,
|
||||
int Color, int DrawMode );
|
||||
void PlotPinTexts( wxPoint& pin_pos, int orient,
|
||||
int TextInside, bool DrawPinNum, bool DrawPinName );
|
||||
};
|
||||
|
||||
|
||||
class LibDrawArc : public LibEDA_BaseStruct
|
||||
class LibDrawArc : public LibEDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
int m_Rayon;
|
||||
int m_Fill;
|
||||
int t1, t2; /* position des 2 extremites de l'arc en 0,1 degres */
|
||||
wxPoint m_ArcStart, m_ArcEnd; /* position des 2 extremites de l'arc en coord reelles*/
|
||||
int m_Rayon;
|
||||
int m_Fill;
|
||||
int t1, t2; /* position des 2 extremites de l'arc en 0,1 degres */
|
||||
wxPoint m_ArcStart, m_ArcEnd; /* position des 2 extremites de l'arc en coord reelles*/
|
||||
|
||||
public:
|
||||
LibDrawArc(void);
|
||||
~LibDrawArc(void){}
|
||||
LibDrawArc * GenCopy(void);
|
||||
bool WriteDescr( FILE * File );
|
||||
LibDrawArc( void );
|
||||
~LibDrawArc( void ) { }
|
||||
LibDrawArc* GenCopy( void );
|
||||
bool WriteDescr( FILE* File );
|
||||
};
|
||||
|
||||
class LibDrawCircle : public LibEDA_BaseStruct
|
||||
class LibDrawCircle : public LibEDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
int m_Rayon;
|
||||
int m_Fill;
|
||||
int m_Rayon;
|
||||
int m_Fill;
|
||||
|
||||
public:
|
||||
LibDrawCircle(void);
|
||||
~LibDrawCircle(void){}
|
||||
LibDrawCircle * GenCopy(void);
|
||||
bool WriteDescr( FILE * File );
|
||||
LibDrawCircle( void );
|
||||
~LibDrawCircle( void ) { }
|
||||
LibDrawCircle* GenCopy( void );
|
||||
bool WriteDescr( FILE* File );
|
||||
};
|
||||
|
||||
class LibDrawText : public LibEDA_BaseStruct
|
||||
class LibDrawText : public LibEDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
int m_Horiz;
|
||||
wxSize m_Size;
|
||||
int m_Type;
|
||||
wxString m_Text;
|
||||
int m_Horiz;
|
||||
wxSize m_Size;
|
||||
int m_Type;
|
||||
wxString m_Text;
|
||||
|
||||
public:
|
||||
LibDrawText(void);
|
||||
~LibDrawText(void){}
|
||||
LibDrawText * GenCopy(void);
|
||||
bool WriteDescr( FILE * File );
|
||||
LibDrawText( void );
|
||||
~LibDrawText( void ) { }
|
||||
LibDrawText* GenCopy( void );
|
||||
bool WriteDescr( FILE* File );
|
||||
};
|
||||
|
||||
class LibDrawSquare : public LibEDA_BaseStruct
|
||||
class LibDrawSquare : public LibEDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
wxPoint m_End;
|
||||
int m_Fill;
|
||||
wxPoint m_End;
|
||||
int m_Fill;
|
||||
|
||||
public:
|
||||
LibDrawSquare(void);
|
||||
~LibDrawSquare(void){}
|
||||
LibDrawSquare * GenCopy(void);
|
||||
bool WriteDescr( FILE * File );
|
||||
LibDrawSquare( void );
|
||||
~LibDrawSquare( void ) { }
|
||||
LibDrawSquare* GenCopy( void );
|
||||
bool WriteDescr( FILE* File );
|
||||
};
|
||||
|
||||
class LibDrawSegment : public LibEDA_BaseStruct
|
||||
class LibDrawSegment : public LibEDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
wxPoint m_End;
|
||||
wxPoint m_End;
|
||||
|
||||
public:
|
||||
LibDrawSegment(void);
|
||||
~LibDrawSegment(void){}
|
||||
LibDrawSegment * GenCopy(void);
|
||||
bool WriteDescr( FILE * File );
|
||||
LibDrawSegment( void );
|
||||
~LibDrawSegment( void ) { }
|
||||
LibDrawSegment* GenCopy( void );
|
||||
bool WriteDescr( FILE* File );
|
||||
};
|
||||
|
||||
class LibDrawPolyline : public LibEDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
int n, *PolyList;
|
||||
int m_Fill;
|
||||
int n, * PolyList;
|
||||
int m_Fill;
|
||||
|
||||
public:
|
||||
LibDrawPolyline(void);
|
||||
~LibDrawPolyline(void){ if ( PolyList ) free(PolyList);}
|
||||
LibDrawPolyline * GenCopy(void);
|
||||
void AddPoint(const wxPoint & point);
|
||||
bool WriteDescr( FILE * File );
|
||||
LibDrawPolyline( void );
|
||||
~LibDrawPolyline( void ) {
|
||||
if( PolyList )
|
||||
free( PolyList );
|
||||
}
|
||||
LibDrawPolyline* GenCopy( void );
|
||||
void AddPoint( const wxPoint& point );
|
||||
bool WriteDescr( FILE* File );
|
||||
};
|
||||
|
||||
/* Fields identiques aux fields des composants, pouvant etre predefinis en lib
|
||||
2 Fields sont toujours presents : Prefix (U, IC..) et Name (74LS00..)*/
|
||||
* 2 Fields sont toujours presents : Prefix (U, IC..) et Name (74LS00..)*/
|
||||
class LibDrawField : public LibEDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
int m_FieldId; // 0 a 11
|
||||
// 0 = Name 1 = Valeur 2 .. 11 autres fields
|
||||
wxPoint m_Pos;
|
||||
wxSize m_Size;
|
||||
int m_Orient; /* Orientation */
|
||||
int m_Attributs; /* Attributs (Non visible ...) */
|
||||
int m_HJustify, m_VJustify; /* Justifications Horiz et Vert du texte */
|
||||
wxString m_Text; /* Field Data */
|
||||
wxString m_Name; /* Field Name */
|
||||
int m_FieldId; // 0 a 11
|
||||
// 0 = Name 1 = Valeur 2 .. 11 autres fields
|
||||
wxPoint m_Pos;
|
||||
wxSize m_Size;
|
||||
int m_Orient; /* Orientation */
|
||||
int m_Attributs; /* Attributs (Non visible ...) */
|
||||
int m_HJustify, m_VJustify; /* Justifications Horiz et Vert du texte */
|
||||
wxString m_Text; /* Field Data */
|
||||
wxString m_Name; /* Field Name */
|
||||
|
||||
public:
|
||||
LibDrawField(int idfield = 2);
|
||||
~LibDrawField(void);
|
||||
LibDrawField( int idfield = 2 );
|
||||
~LibDrawField( void );
|
||||
|
||||
LibDrawField * GenCopy(void);
|
||||
void Copy(LibDrawField * Target);
|
||||
bool WriteDescr( FILE * File );
|
||||
LibDrawField* GenCopy( void );
|
||||
void Copy( LibDrawField* Target );
|
||||
bool WriteDescr( FILE* File );
|
||||
};
|
||||
|
||||
|
||||
/* classe de base de description des composants en librairie */
|
||||
class LibCmpEntry : public EDA_BaseStruct
|
||||
class LibCmpEntry : public EDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
LibrEntryType Type; /* Type = ROOT;
|
||||
= ALIAS pour struct LibraryAliasType */
|
||||
LibDrawField m_Name; // name (74LS00 ..) in lib ( = VALUE )
|
||||
wxString m_Doc; /* ligne de documentation */
|
||||
wxString m_KeyWord; /* liste des mots cles */
|
||||
wxString m_DocFile; /* nom du fichier Doc Associe */
|
||||
LibrEntryOptions m_Options; // special features (i.e. Entry is a POWER)
|
||||
LibrEntryType Type; /* Type = ROOT;
|
||||
* = ALIAS pour struct LibraryAliasType */
|
||||
LibDrawField m_Name; // name (74LS00 ..) in lib ( = VALUE )
|
||||
wxString m_Doc; /* ligne de documentation */
|
||||
wxString m_KeyWord; /* liste des mots cles */
|
||||
wxString m_DocFile; /* nom du fichier Doc Associe */
|
||||
LibrEntryOptions m_Options; // special features (i.e. Entry is a POWER)
|
||||
|
||||
public:
|
||||
LibCmpEntry(LibrEntryType CmpType, const wxChar * CmpName);
|
||||
virtual ~LibCmpEntry(void);
|
||||
bool WriteDescr( FILE * File );
|
||||
LibCmpEntry( LibrEntryType CmpType, const wxChar * CmpName );
|
||||
virtual ~LibCmpEntry( void );
|
||||
bool WriteDescr( FILE* File );
|
||||
};
|
||||
|
||||
class EDA_LibComponentStruct: public LibCmpEntry /* composant "racine" */
|
||||
class EDA_LibComponentStruct : public LibCmpEntry /* composant "racine" */
|
||||
{
|
||||
public:
|
||||
LibDrawField m_Prefix; /* Prefix ( U, IC ... ) = REFERENCE */
|
||||
wxArrayString m_AliasList; /* ALIAS list for the component */
|
||||
wxArrayString m_FootprintList; /* list of suitable footprint names for the component (wildcard names accepted)*/
|
||||
int m_UnitCount; /* Units (or sections) per package */
|
||||
bool m_UnitSelectionLocked; // True if units are differents and their selection is locked
|
||||
// (i.e. if part A cannot be automatically changed in part B
|
||||
int m_TextInside; /* if 0: pin name drawn on the pin itself
|
||||
if > 0 pin name drawn inside the component,
|
||||
with a distance of m_TextInside in mils */
|
||||
bool m_DrawPinNum;
|
||||
bool m_DrawPinName;
|
||||
LibDrawField *Fields; /* Auxiliairy Field list (id = 2 a 11*/
|
||||
LibEDA_BaseStruct * m_Drawings; /* How to draw this part */
|
||||
long m_LastDate; // Last change Date
|
||||
LibDrawField m_Prefix; /* Prefix ( U, IC ... ) = REFERENCE */
|
||||
wxArrayString m_AliasList; /* ALIAS list for the component */
|
||||
wxArrayString m_FootprintList; /* list of suitable footprint names for the component (wildcard names accepted)*/
|
||||
int m_UnitCount; /* Units (or sections) per package */
|
||||
bool m_UnitSelectionLocked; // True if units are differents and their selection is locked
|
||||
// (i.e. if part A cannot be automatically changed in part B
|
||||
int m_TextInside;/* if 0: pin name drawn on the pin itself
|
||||
* if > 0 pin name drawn inside the component,
|
||||
* with a distance of m_TextInside in mils */
|
||||
bool m_DrawPinNum;
|
||||
bool m_DrawPinName;
|
||||
LibDrawField* Fields; /* Auxiliairy Field list (id = 2 a 11*/
|
||||
LibEDA_BaseStruct* m_Drawings; /* How to draw this part */
|
||||
long m_LastDate; // Last change Date
|
||||
|
||||
public:
|
||||
EDA_LibComponentStruct( const wxChar * CmpName);
|
||||
EDA_Rect GetBoundaryBox( int Unit, int Convert); /* return Box around the part. */
|
||||
~EDA_LibComponentStruct( void );
|
||||
void SortDrawItems(void);
|
||||
EDA_LibComponentStruct( const wxChar * CmpName );
|
||||
EDA_Rect GetBoundaryBox( int Unit, int Convert );/* return Box around the part. */
|
||||
|
||||
~EDA_LibComponentStruct( void );
|
||||
void SortDrawItems( void );
|
||||
};
|
||||
|
||||
class EDA_LibCmpAliasStruct: public LibCmpEntry
|
||||
class EDA_LibCmpAliasStruct : public LibCmpEntry
|
||||
{
|
||||
public:
|
||||
wxString m_RootName; /* Part name pour le composant de reference */
|
||||
wxString m_RootName; /* Part name pour le composant de reference */
|
||||
|
||||
public:
|
||||
EDA_LibCmpAliasStruct( const wxChar * CmpName, const wxChar * CmpRootName);
|
||||
~EDA_LibCmpAliasStruct(void);
|
||||
EDA_LibCmpAliasStruct( const wxChar * CmpName, const wxChar * CmpRootName );
|
||||
~EDA_LibCmpAliasStruct( void );
|
||||
};
|
||||
|
||||
/* Variables */
|
||||
extern LibraryStruct *LibraryList; /* All part libs are saved here. */
|
||||
extern LibraryStruct* LibraryList; /* All part libs are saved here. */
|
||||
|
||||
/* Variables Utiles pour les editions de composants en librairie */
|
||||
eda_global LibEDA_BaseStruct * LibItemToRepeat; /* pointeur sur l'élément que l'on
|
||||
peut répéter (Pin..;) */
|
||||
eda_global LibraryStruct *CurrentLib; /* Pointeur sur la librairie du
|
||||
composant en cours d'edition */
|
||||
eda_global EDA_LibComponentStruct *CurrentLibEntry; /* pointeur sur le composant en
|
||||
cours d'edition */
|
||||
eda_global LibEDA_BaseStruct * CurrentDrawItem; /* pointeur sur les
|
||||
elements de dessin du comp. en edition */
|
||||
eda_global LibEDA_BaseStruct* LibItemToRepeat;/* pointeur sur l'élément que l'on
|
||||
* peut répéter (Pin..;) */
|
||||
eda_global LibraryStruct* CurrentLib; /* Pointeur sur la librairie du
|
||||
* composant en cours d'edition */
|
||||
eda_global EDA_LibComponentStruct* CurrentLibEntry; /* pointeur sur le composant en
|
||||
* cours d'edition */
|
||||
eda_global LibEDA_BaseStruct* CurrentDrawItem;/* pointeur sur les
|
||||
* elements de dessin du comp. en edition */
|
||||
|
||||
eda_global wxString CurrentAliasName; // Nom de l'alias selectionné
|
||||
eda_global bool g_AsDeMorgan; // Pour libedit:
|
||||
eda_global int CurrentUnit
|
||||
eda_global wxString CurrentAliasName; // Nom de l'alias selectionné
|
||||
eda_global bool g_AsDeMorgan; // Pour libedit:
|
||||
eda_global int CurrentUnit
|
||||
#ifdef MAIN
|
||||
= 1
|
||||
= 1
|
||||
#endif
|
||||
;
|
||||
eda_global int CurrentConvert /* Convert = 1 .. 255 */
|
||||
eda_global int CurrentConvert /* Convert = 1 .. 255 */
|
||||
#ifdef MAIN
|
||||
= 1
|
||||
= 1
|
||||
#endif
|
||||
;
|
||||
|
||||
|
||||
eda_global wxString FindLibName; /* nom de la librairie ou a ete trouve le
|
||||
dernier composant recherche par FindLibPart() */
|
||||
eda_global wxString FindLibName; /* nom de la librairie ou a ete trouve le
|
||||
* dernier composant recherche par FindLibPart() */
|
||||
|
||||
#endif // LIBCMP_H
|
||||
|
||||
|
|
|
@ -543,6 +543,7 @@ wxClientDC dc(DrawPanel);
|
|||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
||||
EditSymbolText(&dc, CurrentDrawItem);
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
DrawPanel->CursorOn(&dc);
|
||||
}
|
||||
|
|
|
@ -839,6 +839,9 @@ int seuil;
|
|||
return(DrawItem); /* Texte trouve */
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
return(NULL);
|
||||
|
|
|
@ -290,6 +290,9 @@ wxPoint pos;
|
|||
MyFree(Poly);
|
||||
}
|
||||
break;
|
||||
|
||||
default:;
|
||||
|
||||
} /* Fin Switch */
|
||||
Plume('U');
|
||||
} /* Fin Boucle de dessin */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/********************************************/
|
||||
/* Definitions for the EESchema program: */
|
||||
/********************************************/
|
||||
/********************************************/
|
||||
/* Definitions for the EESchema program: */
|
||||
/********************************************/
|
||||
|
||||
#ifndef PROGRAM_H
|
||||
#define PROGRAM_H
|
||||
|
@ -15,9 +15,9 @@
|
|||
#include "component_class.h"
|
||||
#include "class_screen.h"
|
||||
|
||||
#define DRAWJUNCTION_SIZE 16 /* Rayon du symbole connexion */
|
||||
#define DRAWMARKER_SIZE 16 /* Rayon du symbole marqueur */
|
||||
#define DRAWNOCONNECT_SIZE 48 /* Rayon du symbole No Connexion */
|
||||
#define DRAWJUNCTION_SIZE 16 /* Rayon du symbole connexion */
|
||||
#define DRAWMARKER_SIZE 16 /* Rayon du symbole marqueur */
|
||||
#define DRAWNOCONNECT_SIZE 48 /* Rayon du symbole No Connexion */
|
||||
|
||||
#define HIGHLIGHT_COLOR WHITE
|
||||
|
||||
|
@ -26,161 +26,191 @@
|
|||
|
||||
/* flags pour BUS ENTRY (bus to bus ou wire to bus */
|
||||
#define WIRE_TO_BUS 0
|
||||
#define BUS_TO_BUS 1
|
||||
#define BUS_TO_BUS 1
|
||||
|
||||
|
||||
typedef enum { /* Type des Marqueurs */
|
||||
MARQ_UNSPEC,
|
||||
MARQ_ERC,
|
||||
MARQ_PCB,
|
||||
MARQ_SIMUL,
|
||||
MARQ_NMAX /* Derniere valeur: fin de tableau */
|
||||
typedef enum { /* Type des Marqueurs */
|
||||
MARQ_UNSPEC,
|
||||
MARQ_ERC,
|
||||
MARQ_PCB,
|
||||
MARQ_SIMUL,
|
||||
MARQ_NMAX /* Derniere valeur: fin de tableau */
|
||||
} TypeMarker;
|
||||
|
||||
/* Messages correspondants aux types des marqueurs */
|
||||
#ifdef MAIN
|
||||
const wxChar * NameMarqueurType[] =
|
||||
{
|
||||
wxT(""),
|
||||
wxT("ERC"),
|
||||
wxT("PCB"),
|
||||
wxT("SIMUL"),
|
||||
wxT("?????")
|
||||
};
|
||||
const wxChar* NameMarqueurType[] =
|
||||
{
|
||||
wxT( "" ),
|
||||
wxT( "ERC" ),
|
||||
wxT( "PCB" ),
|
||||
wxT( "SIMUL" ),
|
||||
wxT( "?????" )
|
||||
};
|
||||
#else
|
||||
extern const wxChar * NameMarqueurType[];
|
||||
extern const wxChar* NameMarqueurType[];
|
||||
#endif
|
||||
|
||||
|
||||
/* Forward declarations */
|
||||
class DrawSheetStruct;
|
||||
|
||||
class EDA_DrawLineStruct: public EDA_BaseLineStruct /* Segment decription
|
||||
base class to describe items which have 2 end points (track, wire, draw line ...) */
|
||||
|
||||
/**
|
||||
* Class EDA_DrawLineStruct
|
||||
* is a segment decription base class to describe items which have 2 end
|
||||
* points (track, wire, draw line ...)
|
||||
*/
|
||||
class EDA_DrawLineStruct : public EDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
bool m_StartIsDangling, m_EndIsDangling; // TRUE si Start ou End not connected (wires, tracks...)
|
||||
int m_Layer; // Layer number
|
||||
int m_Width; // 0 = line, > 0 = tracks, bus ...
|
||||
wxPoint m_Start; // Line start point
|
||||
wxPoint m_End; // Line end point
|
||||
|
||||
bool m_StartIsDangling;
|
||||
bool m_EndIsDangling; // TRUE si Start ou End not connected (wires, tracks...)
|
||||
|
||||
public:
|
||||
EDA_DrawLineStruct(const wxPoint & pos, int layer );
|
||||
~EDA_DrawLineStruct(void) {}
|
||||
bool IsOneEndPointAt(const wxPoint & pos);
|
||||
EDA_DrawLineStruct * GenCopy(void);
|
||||
bool IsNull(void)
|
||||
{
|
||||
return (m_Start == m_End);
|
||||
}
|
||||
virtual void Draw(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int draw_mode, int Color = -1);
|
||||
EDA_DrawLineStruct( const wxPoint &pos, int layer );
|
||||
~EDA_DrawLineStruct( void ) { }
|
||||
bool IsOneEndPointAt( const wxPoint& pos );
|
||||
EDA_DrawLineStruct* GenCopy( void );
|
||||
|
||||
bool IsNull( void )
|
||||
{
|
||||
return m_Start == m_End;
|
||||
}
|
||||
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
|
||||
int Color = -1 );
|
||||
};
|
||||
|
||||
|
||||
class DrawMarkerStruct: public EDA_BaseStruct /* marqueurs */
|
||||
class DrawMarkerStruct : public EDA_BaseStruct /* marqueurs */
|
||||
{
|
||||
public:
|
||||
wxPoint m_Pos; /* XY coordinates of marker. */
|
||||
TypeMarker m_Type;
|
||||
int m_MarkFlags; // complements d'information
|
||||
wxString m_Comment; /* Texte (commentaireassocie eventuel */
|
||||
wxPoint m_Pos; /* XY coordinates of marker. */
|
||||
TypeMarker m_Type;
|
||||
int m_MarkFlags; // complements d'information
|
||||
wxString m_Comment; /* Texte (commentaireassocie eventuel */
|
||||
|
||||
public:
|
||||
DrawMarkerStruct(const wxPoint & pos, const wxString & text);
|
||||
~DrawMarkerStruct(void);
|
||||
DrawMarkerStruct * GenCopy(void);
|
||||
wxString GetComment(void);
|
||||
virtual void Draw(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int draw_mode, int Color = -1);
|
||||
DrawMarkerStruct( const wxPoint &pos, const wxString &text );
|
||||
~DrawMarkerStruct( void );
|
||||
DrawMarkerStruct* GenCopy( void );
|
||||
wxString GetComment( void );
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int draw_mode, int Color = -1 );
|
||||
};
|
||||
|
||||
class DrawNoConnectStruct: public EDA_BaseStruct /* Symboles de non connexion */
|
||||
|
||||
class DrawNoConnectStruct : public EDA_BaseStruct /* Symboles de non connexion */
|
||||
{
|
||||
public:
|
||||
wxPoint m_Pos; /* XY coordinates of NoConnect. */
|
||||
wxPoint m_Pos; /* XY coordinates of NoConnect. */
|
||||
|
||||
public:
|
||||
DrawNoConnectStruct(const wxPoint & pos);
|
||||
~DrawNoConnectStruct(void) {}
|
||||
DrawNoConnectStruct * GenCopy(void);
|
||||
virtual void Draw(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int draw_mode, int Color = -1);
|
||||
DrawNoConnectStruct( const wxPoint &pos );
|
||||
~DrawNoConnectStruct( void ) { }
|
||||
DrawNoConnectStruct* GenCopy( void );
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int draw_mode, int Color = -1 );
|
||||
};
|
||||
|
||||
class DrawBusEntryStruct: public EDA_BaseStruct /* Struct de descr 1 raccord
|
||||
a 45 degres de BUS ou WIRE */
|
||||
|
||||
/**
|
||||
* Class DrawBusEntryStruct
|
||||
* Struct de descr 1 raccord a 45 degres de BUS ou WIRE
|
||||
*/
|
||||
class DrawBusEntryStruct : public EDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
int m_Layer;
|
||||
int m_Width;
|
||||
wxPoint m_Pos;
|
||||
wxSize m_Size;
|
||||
int m_Layer;
|
||||
int m_Width;
|
||||
wxPoint m_Pos;
|
||||
wxSize m_Size;
|
||||
|
||||
public:
|
||||
DrawBusEntryStruct(const wxPoint & pos, int shape, int id );
|
||||
~DrawBusEntryStruct(void) {}
|
||||
DrawBusEntryStruct * GenCopy(void);
|
||||
wxPoint m_End(void); // retourne la coord de fin du raccord
|
||||
virtual void Draw(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int draw_mode, int Color = -1);
|
||||
DrawBusEntryStruct( const wxPoint &pos, int shape, int id );
|
||||
~DrawBusEntryStruct( void ) { }
|
||||
DrawBusEntryStruct* GenCopy( void );
|
||||
wxPoint m_End( void ); // retourne la coord de fin du raccord
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int draw_mode, int Color = -1 );
|
||||
};
|
||||
|
||||
class DrawPolylineStruct: public EDA_BaseStruct /* Polyligne (serie de segments) */
|
||||
class DrawPolylineStruct : public EDA_BaseStruct/* Polyligne (serie de segments) */
|
||||
{
|
||||
public:
|
||||
int m_Layer;
|
||||
int m_Width;
|
||||
int m_NumOfPoints; /* Number of XY pairs in Points array. */
|
||||
int *m_Points; /* XY pairs that forms the polyline. */
|
||||
int m_Layer;
|
||||
int m_Width;
|
||||
int m_NumOfPoints; /* Number of XY pairs in Points array. */
|
||||
int* m_Points; /* XY pairs that forms the polyline. */
|
||||
|
||||
public:
|
||||
DrawPolylineStruct(int layer);
|
||||
~DrawPolylineStruct(void);
|
||||
DrawPolylineStruct * GenCopy(void);
|
||||
virtual void Draw(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int draw_mode, int Color = -1);
|
||||
DrawPolylineStruct( int layer );
|
||||
~DrawPolylineStruct( void );
|
||||
DrawPolylineStruct* GenCopy( void );
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int draw_mode, int Color = -1 );
|
||||
};
|
||||
|
||||
class DrawJunctionStruct: public EDA_BaseStruct
|
||||
class DrawJunctionStruct : public EDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
int m_Layer;
|
||||
wxPoint m_Pos; /* XY coordinates of connection. */
|
||||
int m_Layer;
|
||||
wxPoint m_Pos; /* XY coordinates of connection. */
|
||||
|
||||
public:
|
||||
DrawJunctionStruct(const wxPoint & pos);
|
||||
~DrawJunctionStruct(void){}
|
||||
DrawJunctionStruct * GenCopy(void);
|
||||
virtual void Draw(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int draw_mode, int Color = -1);
|
||||
DrawJunctionStruct( const wxPoint &pos );
|
||||
~DrawJunctionStruct( void ) { }
|
||||
DrawJunctionStruct* GenCopy( void );
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int draw_mode, int Color = -1 );
|
||||
};
|
||||
|
||||
class DrawTextStruct: public EDA_BaseStruct, public EDA_TextStruct
|
||||
class DrawTextStruct : public EDA_BaseStruct, public EDA_TextStruct
|
||||
{
|
||||
public:
|
||||
int m_Layer;
|
||||
int m_Shape;
|
||||
bool m_IsDangling; // TRUE si non connecté
|
||||
int m_Layer;
|
||||
int m_Shape;
|
||||
bool m_IsDangling; // TRUE si non connecté
|
||||
|
||||
public:
|
||||
DrawTextStruct(const wxPoint & pos = wxPoint(0,0), const wxString & text = wxEmptyString);
|
||||
~DrawTextStruct(void) {}
|
||||
DrawTextStruct * GenCopy(void);
|
||||
virtual void Draw(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int draw_mode, int Color = -1);
|
||||
void SwapData(DrawTextStruct * copyitem);
|
||||
virtual void Place(WinEDA_DrawFrame * frame, wxDC * DC);
|
||||
DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
|
||||
~DrawTextStruct( void ) { }
|
||||
DrawTextStruct* GenCopy( void );
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
|
||||
int Color = -1 );
|
||||
void SwapData( DrawTextStruct* copyitem );
|
||||
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
|
||||
|
||||
private:
|
||||
void DrawAsText(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int draw_mode, int Color);
|
||||
void DrawAsLabel(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int draw_mode, int Color);
|
||||
void DrawAsGlobalLabel(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int draw_mode, int Color);
|
||||
void DrawAsText( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int draw_mode, int Color );
|
||||
void DrawAsLabel( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int draw_mode, int Color );
|
||||
void DrawAsGlobalLabel( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int draw_mode, int Color );
|
||||
};
|
||||
|
||||
|
||||
class DrawLabelStruct: public DrawTextStruct
|
||||
class DrawLabelStruct : public DrawTextStruct
|
||||
{
|
||||
public:
|
||||
DrawLabelStruct(const wxPoint & pos = wxPoint(0,0), const wxString & text = wxEmptyString);
|
||||
~DrawLabelStruct(void) {}
|
||||
DrawLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
|
||||
~DrawLabelStruct( void ) { }
|
||||
};
|
||||
|
||||
|
||||
class DrawGlobalLabelStruct: public DrawTextStruct
|
||||
class DrawGlobalLabelStruct : public DrawTextStruct
|
||||
{
|
||||
public:
|
||||
DrawGlobalLabelStruct(const wxPoint & pos = wxPoint(0,0), const wxString & text = wxEmptyString);
|
||||
~DrawGlobalLabelStruct(void) {}
|
||||
DrawGlobalLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ),
|
||||
const wxString& text = wxEmptyString );
|
||||
~DrawGlobalLabelStruct( void ) { }
|
||||
};
|
||||
|
||||
|
||||
|
@ -188,16 +218,15 @@ public:
|
|||
class LayerStruct
|
||||
{
|
||||
public:
|
||||
char LayerNames[MAX_LAYERS+1][8];
|
||||
int LayerColor[MAX_LAYERS+1];
|
||||
char LayerStatus[MAX_LAYERS+1];
|
||||
int NumberOfLayers;
|
||||
int CurrentLayer;
|
||||
int CurrentWidth;
|
||||
int CommonColor;
|
||||
int Flags;
|
||||
char LayerNames[MAX_LAYERS + 1][8];
|
||||
int LayerColor[MAX_LAYERS + 1];
|
||||
char LayerStatus[MAX_LAYERS + 1];
|
||||
int NumberOfLayers;
|
||||
int CurrentLayer;
|
||||
int CurrentWidth;
|
||||
int CommonColor;
|
||||
int Flags;
|
||||
};
|
||||
|
||||
|
||||
#endif /* PROGRAM_H */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,11 +1,11 @@
|
|||
/*************************************************/
|
||||
/* Functions to Load from file and save to file */
|
||||
/* the graphic shapes used to draw a component */
|
||||
/* When using the import/export symbol options */
|
||||
/* files are the *.sym files */
|
||||
/*************************************************/
|
||||
/*************************************************/
|
||||
/* Functions to Load from file and save to file */
|
||||
/* the graphic shapes used to draw a component */
|
||||
/* When using the import/export symbol options */
|
||||
/* files are the *.sym files */
|
||||
/*************************************************/
|
||||
|
||||
/* fichier symbedit.cpp */
|
||||
/* fichier symbedit.cpp */
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
@ -19,362 +19,406 @@
|
|||
|
||||
|
||||
/* Routines locales */
|
||||
static bool CompareSymbols(LibEDA_BaseStruct *DEntryRef,
|
||||
LibEDA_BaseStruct *DEntryCompare);
|
||||
static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
|
||||
LibEDA_BaseStruct* DEntryCompare );
|
||||
|
||||
/* Variables locales */
|
||||
|
||||
|
||||
|
||||
|
||||
/***************************************************/
|
||||
void WinEDA_LibeditFrame::LoadOneSymbol(wxDC * DC)
|
||||
void WinEDA_LibeditFrame::LoadOneSymbol( wxDC* DC )
|
||||
/***************************************************/
|
||||
|
||||
/* Read a component shape file and add data (graphic items) to the current
|
||||
component.
|
||||
*/
|
||||
* component.
|
||||
*/
|
||||
{
|
||||
int NumOfParts;
|
||||
PriorQue *Entries;
|
||||
EDA_LibComponentStruct *LibEntry = NULL;
|
||||
LibEDA_BaseStruct *DrawEntry;
|
||||
wxString FullFileName, mask;
|
||||
FILE * ImportFile;
|
||||
wxString msg;
|
||||
int NumOfParts;
|
||||
PriorQue* Entries;
|
||||
EDA_LibComponentStruct* LibEntry = NULL;
|
||||
LibEDA_BaseStruct* DrawEntry;
|
||||
wxString FullFileName, mask;
|
||||
FILE* ImportFile;
|
||||
wxString msg;
|
||||
|
||||
if(CurrentDrawItem) return;
|
||||
if( CurrentLibEntry == NULL) return;
|
||||
if( CurrentDrawItem )
|
||||
return;
|
||||
if( CurrentLibEntry == NULL )
|
||||
return;
|
||||
|
||||
DrawPanel->m_IgnoreMouseEvents = TRUE;
|
||||
DrawPanel->m_IgnoreMouseEvents = TRUE;
|
||||
|
||||
mask = wxT("*") + g_SymbolExtBuffer;
|
||||
FullFileName = EDA_FileSelector( _("Import symbol drawings:"),
|
||||
g_RealLibDirBuffer, /* Chemin par defaut */
|
||||
wxEmptyString, /* nom fichier par defaut */
|
||||
g_SymbolExtBuffer, /* extension par defaut */
|
||||
mask, /* Masque d'affichage */
|
||||
this,
|
||||
0,
|
||||
TRUE
|
||||
);
|
||||
mask = wxT( "*" ) + g_SymbolExtBuffer;
|
||||
FullFileName = EDA_FileSelector( _( "Import symbol drawings:" ),
|
||||
g_RealLibDirBuffer, /* Chemin par defaut */
|
||||
wxEmptyString, /* nom fichier par defaut */
|
||||
g_SymbolExtBuffer, /* extension par defaut */
|
||||
mask, /* Masque d'affichage */
|
||||
this,
|
||||
0,
|
||||
TRUE
|
||||
);
|
||||
|
||||
GetScreen()->m_Curseur = wxPoint(0,0);
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
||||
GetScreen()->m_Curseur = wxPoint( 0, 0 );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
||||
|
||||
if ( FullFileName.IsEmpty() ) return;
|
||||
if( FullFileName.IsEmpty() )
|
||||
return;
|
||||
|
||||
|
||||
/* Load data */
|
||||
ImportFile = wxFopen(FullFileName, wxT("rt"));
|
||||
if (ImportFile == NULL)
|
||||
{
|
||||
msg.Printf( _("Failed to open Symbol File <%s>"), FullFileName.GetData());
|
||||
DisplayError(this, msg, 20);
|
||||
return;
|
||||
}
|
||||
/* Load data */
|
||||
ImportFile = wxFopen( FullFileName, wxT( "rt" ) );
|
||||
if( ImportFile == NULL )
|
||||
{
|
||||
msg.Printf( _( "Failed to open Symbol File <%s>" ), FullFileName.GetData() );
|
||||
DisplayError( this, msg, 20 );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Entries = LoadLibraryAux(this, NULL, ImportFile, &NumOfParts);
|
||||
fclose(ImportFile);
|
||||
Entries = LoadLibraryAux( this, NULL, ImportFile, &NumOfParts );
|
||||
fclose( ImportFile );
|
||||
|
||||
if( Entries == NULL) return;
|
||||
if( Entries == NULL )
|
||||
return;
|
||||
|
||||
if(NumOfParts > 1 )
|
||||
DisplayError(this, _("Warning: more than 1 part in Symbol File"), 20);
|
||||
if( NumOfParts > 1 )
|
||||
DisplayError( this, _( "Warning: more than 1 part in Symbol File" ), 20 );
|
||||
|
||||
LibEntry = (EDA_LibComponentStruct *)PQFirst(&Entries,FALSE);
|
||||
LibEntry = (EDA_LibComponentStruct*) PQFirst( &Entries, FALSE );
|
||||
|
||||
if(LibEntry == NULL )
|
||||
DisplayError(this, _("Symbol File is void"), 20);
|
||||
if( LibEntry == NULL )
|
||||
DisplayError( this, _( "Symbol File is void" ), 20 );
|
||||
|
||||
else /* add data to the current symbol */
|
||||
{
|
||||
DrawEntry = LibEntry->m_Drawings;
|
||||
while(DrawEntry)
|
||||
{
|
||||
if(DrawEntry->m_Unit) DrawEntry->m_Unit = CurrentUnit;
|
||||
if(DrawEntry->m_Convert) DrawEntry->m_Convert = CurrentConvert;
|
||||
DrawEntry->m_Flags = IS_NEW;
|
||||
DrawEntry->m_Selected = IS_SELECTED;
|
||||
else /* add data to the current symbol */
|
||||
{
|
||||
DrawEntry = LibEntry->m_Drawings;
|
||||
while( DrawEntry )
|
||||
{
|
||||
if( DrawEntry->m_Unit )
|
||||
DrawEntry->m_Unit = CurrentUnit;
|
||||
if( DrawEntry->m_Convert )
|
||||
DrawEntry->m_Convert = CurrentConvert;
|
||||
DrawEntry->m_Flags = IS_NEW;
|
||||
DrawEntry->m_Selected = IS_SELECTED;
|
||||
|
||||
if(DrawEntry->Pnext == NULL)
|
||||
{ /* Fin de liste trouvee */
|
||||
DrawEntry->Pnext = CurrentLibEntry->m_Drawings;
|
||||
CurrentLibEntry->m_Drawings = LibEntry->m_Drawings;
|
||||
LibEntry->m_Drawings = NULL;
|
||||
break;
|
||||
}
|
||||
DrawEntry = DrawEntry->Next();
|
||||
}
|
||||
SuppressDuplicateDrawItem(CurrentLibEntry);
|
||||
m_CurrentScreen->SetModify();
|
||||
// Move (and place ) the new draw items:
|
||||
HandleBlockBegin(DC, -1, GetScreen()->m_Curseur);
|
||||
HandleBlockEnd(DC);
|
||||
RedrawActiveWindow( DC,TRUE);
|
||||
}
|
||||
if( DrawEntry->Pnext == NULL )
|
||||
{ /* Fin de liste trouvee */
|
||||
DrawEntry->Pnext = CurrentLibEntry->m_Drawings;
|
||||
CurrentLibEntry->m_Drawings = LibEntry->m_Drawings;
|
||||
LibEntry->m_Drawings = NULL;
|
||||
break;
|
||||
}
|
||||
DrawEntry = DrawEntry->Next();
|
||||
}
|
||||
|
||||
PQFreeFunc(Entries, (void(*)(void*))FreeLibraryEntry);
|
||||
SuppressDuplicateDrawItem( CurrentLibEntry );
|
||||
m_CurrentScreen->SetModify();
|
||||
|
||||
// Move (and place ) the new draw items:
|
||||
HandleBlockBegin( DC, -1, GetScreen()->m_Curseur );
|
||||
HandleBlockEnd( DC );
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
}
|
||||
|
||||
PQFreeFunc( Entries, ( void( * ) ( void* ) )FreeLibraryEntry );
|
||||
}
|
||||
|
||||
|
||||
/********************************************/
|
||||
void WinEDA_LibeditFrame::SaveOneSymbol(void)
|
||||
void WinEDA_LibeditFrame::SaveOneSymbol( void )
|
||||
/********************************************/
|
||||
|
||||
/* Save in file the current symbol
|
||||
file format is like the standard libraries, but there is only one symbol
|
||||
Invisible pins are not saved
|
||||
*/
|
||||
* file format is like the standard libraries, but there is only one symbol
|
||||
* Invisible pins are not saved
|
||||
*/
|
||||
{
|
||||
EDA_LibComponentStruct *LibEntry = CurrentLibEntry;
|
||||
int Unit = CurrentUnit, convert = CurrentConvert;
|
||||
int SymbUnit, SymbConvert;
|
||||
LibEDA_BaseStruct *DrawEntry;
|
||||
wxString FullFileName, mask;
|
||||
wxString msg;
|
||||
FILE * ExportFile;
|
||||
EDA_LibComponentStruct* LibEntry = CurrentLibEntry;
|
||||
int Unit = CurrentUnit, convert = CurrentConvert;
|
||||
int SymbUnit, SymbConvert;
|
||||
LibEDA_BaseStruct* DrawEntry;
|
||||
wxString FullFileName, mask;
|
||||
wxString msg;
|
||||
FILE* ExportFile;
|
||||
|
||||
if( LibEntry->m_Drawings == NULL ) return;
|
||||
if( LibEntry->m_Drawings == NULL )
|
||||
return;
|
||||
|
||||
/* Creation du fichier symbole */
|
||||
mask = wxT("*") + g_SymbolExtBuffer;
|
||||
FullFileName = EDA_FileSelector( _("Export symbol drawings:"),
|
||||
g_RealLibDirBuffer, /* Chemin par defaut */
|
||||
wxEmptyString, /* nom fichier par defaut */
|
||||
g_SymbolExtBuffer, /* extension par defaut */
|
||||
mask, /* Masque d'affichage */
|
||||
this,
|
||||
wxFD_SAVE,
|
||||
TRUE
|
||||
);
|
||||
if ( FullFileName.IsEmpty() ) return;
|
||||
/* Creation du fichier symbole */
|
||||
mask = wxT( "*" ) + g_SymbolExtBuffer;
|
||||
FullFileName = EDA_FileSelector( _( "Export symbol drawings:" ),
|
||||
g_RealLibDirBuffer, /* Chemin par defaut */
|
||||
wxEmptyString, /* nom fichier par defaut */
|
||||
g_SymbolExtBuffer, /* extension par defaut */
|
||||
mask, /* Masque d'affichage */
|
||||
this,
|
||||
wxFD_SAVE,
|
||||
TRUE
|
||||
);
|
||||
if( FullFileName.IsEmpty() )
|
||||
return;
|
||||
|
||||
ExportFile = wxFopen(FullFileName, wxT("wt") );
|
||||
if ( ExportFile == NULL )
|
||||
{
|
||||
msg.Printf(_("Unable to create <%s>"), FullFileName.GetData());
|
||||
DisplayError(this, msg);
|
||||
return;
|
||||
}
|
||||
ExportFile = wxFopen( FullFileName, wxT( "wt" ) );
|
||||
if( ExportFile == NULL )
|
||||
{
|
||||
msg.Printf( _( "Unable to create <%s>" ), FullFileName.GetData() );
|
||||
DisplayError( this, msg );
|
||||
return;
|
||||
}
|
||||
|
||||
msg.Printf(_("Save Symbol in [%s]"), FullFileName.GetData());
|
||||
Affiche_Message(msg);
|
||||
msg.Printf( _( "Save Symbol in [%s]" ), FullFileName.GetData() );
|
||||
Affiche_Message( msg );
|
||||
|
||||
/* Creation de l'entete de la librairie */
|
||||
char Line[256];
|
||||
fprintf(ExportFile,"%s %d.%d %s Date: %s\n",LIBFILE_IDENT,
|
||||
LIB_VERSION_MAJOR, LIB_VERSION_MINOR,
|
||||
"SYMBOL",DateAndTime(Line));
|
||||
/* Creation de l'entete de la librairie */
|
||||
char Line[256];
|
||||
fprintf( ExportFile, "%s %d.%d %s Date: %s\n", LIBFILE_IDENT,
|
||||
LIB_VERSION_MAJOR, LIB_VERSION_MINOR,
|
||||
"SYMBOL", DateAndTime( Line ) );
|
||||
|
||||
/* Creation du commentaire donnant le nom du composant */
|
||||
fprintf(ExportFile,"# SYMBOL %s\n#\n",
|
||||
(const char*) LibEntry->m_Name.m_Text.GetData());
|
||||
/* Creation du commentaire donnant le nom du composant */
|
||||
fprintf( ExportFile, "# SYMBOL %s\n#\n",
|
||||
(const char*) LibEntry->m_Name.m_Text.GetData() );
|
||||
|
||||
/* Generation des lignes utiles */
|
||||
fprintf(ExportFile,"DEF %s", (const char*)LibEntry->m_Name.m_Text.GetData());
|
||||
if( ! LibEntry->m_Prefix.m_Text.IsEmpty())
|
||||
fprintf(ExportFile," %s", (const char*)LibEntry->m_Prefix.m_Text.GetData());
|
||||
else fprintf(ExportFile," ~");
|
||||
/* Generation des lignes utiles */
|
||||
fprintf( ExportFile, "DEF %s", (const char*) LibEntry->m_Name.m_Text.GetData() );
|
||||
if( !LibEntry->m_Prefix.m_Text.IsEmpty() )
|
||||
fprintf( ExportFile, " %s", (const char*) LibEntry->m_Prefix.m_Text.GetData() );
|
||||
else
|
||||
fprintf( ExportFile, " ~" );
|
||||
|
||||
fprintf(ExportFile," %d %d %c %c %d %d %c\n",
|
||||
0, /* unused */
|
||||
LibEntry->m_TextInside,
|
||||
LibEntry->m_DrawPinNum ? 'Y' : 'N',
|
||||
LibEntry->m_DrawPinName ? 'Y' : 'N',
|
||||
1, 0 /* unused */, 'N');
|
||||
fprintf( ExportFile, " %d %d %c %c %d %d %c\n",
|
||||
0, /* unused */
|
||||
LibEntry->m_TextInside,
|
||||
LibEntry->m_DrawPinNum ? 'Y' : 'N',
|
||||
LibEntry->m_DrawPinName ? 'Y' : 'N',
|
||||
1, 0 /* unused */, 'N' );
|
||||
|
||||
/* Position / orientation / visibilite des champs */
|
||||
/* Position / orientation / visibilite des champs */
|
||||
LibEntry->m_Prefix.WriteDescr( ExportFile );
|
||||
LibEntry->m_Name.WriteDescr( ExportFile );
|
||||
|
||||
DrawEntry = LibEntry->m_Drawings;
|
||||
if(DrawEntry)
|
||||
{
|
||||
fprintf(ExportFile,"DRAW\n");
|
||||
for( ; DrawEntry != NULL ; DrawEntry = DrawEntry->Next())
|
||||
{
|
||||
/* Elimination des elements non relatifs a l'unite */
|
||||
if( Unit && DrawEntry->m_Unit && (DrawEntry->m_Unit != Unit) )
|
||||
continue;
|
||||
if( convert && DrawEntry->m_Convert && (DrawEntry->m_Convert != convert) )
|
||||
continue;
|
||||
DrawEntry = LibEntry->m_Drawings;
|
||||
if( DrawEntry )
|
||||
{
|
||||
fprintf( ExportFile, "DRAW\n" );
|
||||
for( ; DrawEntry != NULL; DrawEntry = DrawEntry->Next() )
|
||||
{
|
||||
/* Elimination des elements non relatifs a l'unite */
|
||||
if( Unit && DrawEntry->m_Unit && (DrawEntry->m_Unit != Unit) )
|
||||
continue;
|
||||
if( convert && DrawEntry->m_Convert && (DrawEntry->m_Convert != convert) )
|
||||
continue;
|
||||
|
||||
/* .Unit , . Convert est laisse a 0 ou mis a 1 */
|
||||
SymbUnit = DrawEntry->m_Unit; if ( SymbUnit > 1) SymbUnit = 1;
|
||||
SymbConvert = DrawEntry->m_Convert;
|
||||
if ( SymbConvert > 1) SymbConvert = 1;
|
||||
switch( DrawEntry->m_StructType)
|
||||
{
|
||||
case COMPONENT_ARC_DRAW_TYPE:
|
||||
#define DRAWSTRUCT ((LibDrawArc *) DrawEntry)
|
||||
DRAWSTRUCT->WriteDescr( ExportFile );
|
||||
break;
|
||||
/* .Unit , . Convert est laisse a 0 ou mis a 1 */
|
||||
SymbUnit = DrawEntry->m_Unit; if( SymbUnit > 1 )
|
||||
SymbUnit = 1;
|
||||
SymbConvert = DrawEntry->m_Convert;
|
||||
if( SymbConvert > 1 )
|
||||
SymbConvert = 1;
|
||||
|
||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
||||
#undef DRAWSTRUCT
|
||||
#define DRAWSTRUCT ((LibDrawCircle *) DrawEntry)
|
||||
DRAWSTRUCT->WriteDescr( ExportFile );
|
||||
break;
|
||||
switch( DrawEntry->m_StructType )
|
||||
{
|
||||
case COMPONENT_ARC_DRAW_TYPE:
|
||||
#define DRAWSTRUCT ( (LibDrawArc*) DrawEntry )
|
||||
DRAWSTRUCT->WriteDescr( ExportFile );
|
||||
break;
|
||||
|
||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
||||
#undef DRAWSTRUCT
|
||||
#define DRAWSTRUCT ((LibDrawText *) DrawEntry)
|
||||
DRAWSTRUCT->WriteDescr( ExportFile );
|
||||
break;
|
||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
||||
#undef DRAWSTRUCT
|
||||
#define DRAWSTRUCT ( (LibDrawCircle*) DrawEntry )
|
||||
DRAWSTRUCT->WriteDescr( ExportFile );
|
||||
break;
|
||||
|
||||
case COMPONENT_RECT_DRAW_TYPE:
|
||||
#undef DRAWSTRUCT
|
||||
#define DRAWSTRUCT ((LibDrawSquare *) DrawEntry)
|
||||
DRAWSTRUCT->WriteDescr( ExportFile );
|
||||
break;
|
||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
||||
#undef DRAWSTRUCT
|
||||
#define DRAWSTRUCT ( (LibDrawText*) DrawEntry )
|
||||
DRAWSTRUCT->WriteDescr( ExportFile );
|
||||
break;
|
||||
|
||||
case COMPONENT_PIN_DRAW_TYPE:
|
||||
#undef DRAWSTRUCT
|
||||
#define DRAWSTRUCT ((LibDrawPin *) DrawEntry)
|
||||
if(DRAWSTRUCT->m_Attributs & PINNOTDRAW) break;
|
||||
DRAWSTRUCT->WriteDescr( ExportFile );
|
||||
break;
|
||||
case COMPONENT_RECT_DRAW_TYPE:
|
||||
#undef DRAWSTRUCT
|
||||
#define DRAWSTRUCT ( (LibDrawSquare*) DrawEntry )
|
||||
DRAWSTRUCT->WriteDescr( ExportFile );
|
||||
break;
|
||||
|
||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
||||
#undef DRAWSTRUCT
|
||||
#define DRAWSTRUCT ((LibDrawPolyline *) DrawEntry)
|
||||
DRAWSTRUCT->WriteDescr( ExportFile );
|
||||
break;
|
||||
}
|
||||
}
|
||||
fprintf(ExportFile,"ENDDRAW\n");
|
||||
}
|
||||
fprintf(ExportFile,"ENDDEF\n");
|
||||
fclose(ExportFile);
|
||||
case COMPONENT_PIN_DRAW_TYPE:
|
||||
#undef DRAWSTRUCT
|
||||
#define DRAWSTRUCT ( (LibDrawPin*) DrawEntry )
|
||||
if( DRAWSTRUCT->m_Attributs & PINNOTDRAW )
|
||||
break;
|
||||
DRAWSTRUCT->WriteDescr( ExportFile );
|
||||
break;
|
||||
|
||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
||||
#undef DRAWSTRUCT
|
||||
#define DRAWSTRUCT ( (LibDrawPolyline*) DrawEntry )
|
||||
DRAWSTRUCT->WriteDescr( ExportFile );
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
fprintf( ExportFile, "ENDDRAW\n" );
|
||||
}
|
||||
fprintf( ExportFile, "ENDDEF\n" );
|
||||
fclose( ExportFile );
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
void SuppressDuplicateDrawItem( EDA_LibComponentStruct* LibEntry )
|
||||
/*****************************************************************/
|
||||
|
||||
/*****************************************************************/
|
||||
void SuppressDuplicateDrawItem(EDA_LibComponentStruct * LibEntry)
|
||||
/*****************************************************************/
|
||||
/* Delete redundant graphic items.
|
||||
Useful after loading asymbole from a file symbol, because some graphic items
|
||||
can be duplicated.
|
||||
*/
|
||||
* Useful after loading asymbole from a file symbol, because some graphic items
|
||||
* can be duplicated.
|
||||
*/
|
||||
{
|
||||
LibEDA_BaseStruct *DEntryRef, *DEntryCompare;
|
||||
bool deleted;
|
||||
wxDC * DC = NULL;
|
||||
LibEDA_BaseStruct* DEntryRef, * DEntryCompare;
|
||||
bool deleted;
|
||||
wxDC* DC = NULL;
|
||||
|
||||
DEntryRef = LibEntry->m_Drawings;
|
||||
while( DEntryRef)
|
||||
{
|
||||
if( DEntryRef->Pnext == NULL ) return;
|
||||
DEntryCompare = DEntryRef->Next();
|
||||
if( DEntryCompare == NULL ) return;
|
||||
deleted = 0;
|
||||
while( DEntryCompare )
|
||||
{
|
||||
if( CompareSymbols(DEntryRef,DEntryCompare) == TRUE)
|
||||
{
|
||||
DeleteOneLibraryDrawStruct(NULL, DC, LibEntry,DEntryRef, 1);
|
||||
deleted = TRUE;
|
||||
break;
|
||||
}
|
||||
DEntryCompare = DEntryCompare->Next();
|
||||
}
|
||||
if ( ! deleted ) DEntryRef = DEntryRef->Next();
|
||||
else DEntryRef = LibEntry->m_Drawings;
|
||||
}
|
||||
DEntryRef = LibEntry->m_Drawings;
|
||||
while( DEntryRef )
|
||||
{
|
||||
if( DEntryRef->Pnext == NULL )
|
||||
return;
|
||||
DEntryCompare = DEntryRef->Next();
|
||||
if( DEntryCompare == NULL )
|
||||
return;
|
||||
deleted = 0;
|
||||
while( DEntryCompare )
|
||||
{
|
||||
if( CompareSymbols( DEntryRef, DEntryCompare ) == TRUE )
|
||||
{
|
||||
DeleteOneLibraryDrawStruct( NULL, DC, LibEntry, DEntryRef, 1 );
|
||||
deleted = TRUE;
|
||||
break;
|
||||
}
|
||||
DEntryCompare = DEntryCompare->Next();
|
||||
}
|
||||
|
||||
if( !deleted )
|
||||
DEntryRef = DEntryRef->Next();
|
||||
else
|
||||
DEntryRef = LibEntry->m_Drawings;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
static bool CompareSymbols(LibEDA_BaseStruct *DEntryRef,
|
||||
LibEDA_BaseStruct *DEntryCompare)
|
||||
/********************************************************************/
|
||||
static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
|
||||
LibEDA_BaseStruct* DEntryCompare )
|
||||
/********************************************************************/
|
||||
|
||||
/* Compare 2 graphic items (arc, lines ...).
|
||||
return FALSE si different
|
||||
TRUE si they are identical, and therefore redundant
|
||||
*/
|
||||
* return FALSE si different
|
||||
* TRUE si they are identical, and therefore redundant
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
int * ptref, *ptcomp;
|
||||
int ii;
|
||||
int* ptref, * ptcomp;
|
||||
|
||||
/* Comparaison des proprietes generales */
|
||||
if( DEntryRef->m_StructType != DEntryCompare->m_StructType) return(FALSE);
|
||||
if( DEntryRef->m_Unit != DEntryCompare->m_Unit) return(FALSE);
|
||||
if( DEntryRef->m_Convert != DEntryCompare->m_Convert) return(FALSE);
|
||||
/* Comparaison des proprietes generales */
|
||||
if( DEntryRef->m_StructType != DEntryCompare->m_StructType )
|
||||
return FALSE;
|
||||
if( DEntryRef->m_Unit != DEntryCompare->m_Unit )
|
||||
return FALSE;
|
||||
if( DEntryRef->m_Convert != DEntryCompare->m_Convert )
|
||||
return FALSE;
|
||||
|
||||
switch( DEntryRef->m_StructType)
|
||||
{
|
||||
case COMPONENT_ARC_DRAW_TYPE:
|
||||
#undef REFSTRUCT
|
||||
#undef CMPSTRUCT
|
||||
#define REFSTRUCT ((LibDrawArc *) DEntryRef)
|
||||
#define CMPSTRUCT ((LibDrawArc *) DEntryCompare)
|
||||
if( REFSTRUCT->m_Pos.x != CMPSTRUCT->m_Pos.x) return(FALSE);
|
||||
if( REFSTRUCT->m_Pos.y != CMPSTRUCT->m_Pos.y) return(FALSE);
|
||||
if( REFSTRUCT->t1 != CMPSTRUCT->t1) return(FALSE);
|
||||
if( REFSTRUCT->t2 != CMPSTRUCT->t2) return(FALSE);
|
||||
break;
|
||||
switch( DEntryRef->m_StructType )
|
||||
{
|
||||
case COMPONENT_ARC_DRAW_TYPE:
|
||||
#undef REFSTRUCT
|
||||
#undef CMPSTRUCT
|
||||
#define REFSTRUCT ( (LibDrawArc*) DEntryRef )
|
||||
#define CMPSTRUCT ( (LibDrawArc*) DEntryCompare )
|
||||
if( REFSTRUCT->m_Pos.x != CMPSTRUCT->m_Pos.x )
|
||||
return FALSE;
|
||||
if( REFSTRUCT->m_Pos.y != CMPSTRUCT->m_Pos.y )
|
||||
return FALSE;
|
||||
if( REFSTRUCT->t1 != CMPSTRUCT->t1 )
|
||||
return FALSE;
|
||||
if( REFSTRUCT->t2 != CMPSTRUCT->t2 )
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
||||
#undef REFSTRUCT
|
||||
#undef CMPSTRUCT
|
||||
#define REFSTRUCT ((LibDrawCircle *) DEntryRef)
|
||||
#define CMPSTRUCT ((LibDrawCircle *) DEntryCompare)
|
||||
if( REFSTRUCT->m_Pos.x != CMPSTRUCT->m_Pos.x) return(FALSE);
|
||||
if( REFSTRUCT->m_Pos.y != CMPSTRUCT->m_Pos.y) return(FALSE);
|
||||
if( REFSTRUCT->m_Rayon != CMPSTRUCT->m_Rayon) return(FALSE);
|
||||
break;
|
||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
||||
#undef REFSTRUCT
|
||||
#undef CMPSTRUCT
|
||||
#define REFSTRUCT ( (LibDrawCircle*) DEntryRef )
|
||||
#define CMPSTRUCT ( (LibDrawCircle*) DEntryCompare )
|
||||
if( REFSTRUCT->m_Pos.x != CMPSTRUCT->m_Pos.x )
|
||||
return FALSE;
|
||||
if( REFSTRUCT->m_Pos.y != CMPSTRUCT->m_Pos.y )
|
||||
return FALSE;
|
||||
if( REFSTRUCT->m_Rayon != CMPSTRUCT->m_Rayon )
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
||||
#undef REFSTRUCT
|
||||
#undef CMPSTRUCT
|
||||
#define REFSTRUCT ((LibDrawText *) DEntryRef)
|
||||
#define CMPSTRUCT ((LibDrawText *) DEntryCompare)
|
||||
if( REFSTRUCT->m_Pos != CMPSTRUCT->m_Pos) return(FALSE);
|
||||
if( REFSTRUCT->m_Size != CMPSTRUCT->m_Size) return(FALSE);
|
||||
if( REFSTRUCT->m_Text != CMPSTRUCT->m_Text )
|
||||
return(FALSE);
|
||||
break;
|
||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
||||
#undef REFSTRUCT
|
||||
#undef CMPSTRUCT
|
||||
#define REFSTRUCT ( (LibDrawText*) DEntryRef )
|
||||
#define CMPSTRUCT ( (LibDrawText*) DEntryCompare )
|
||||
if( REFSTRUCT->m_Pos != CMPSTRUCT->m_Pos )
|
||||
return FALSE;
|
||||
if( REFSTRUCT->m_Size != CMPSTRUCT->m_Size )
|
||||
return FALSE;
|
||||
if( REFSTRUCT->m_Text != CMPSTRUCT->m_Text )
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
case COMPONENT_RECT_DRAW_TYPE:
|
||||
#undef REFSTRUCT
|
||||
#undef CMPSTRUCT
|
||||
#define REFSTRUCT ((LibDrawSquare *) DEntryRef)
|
||||
#define CMPSTRUCT ((LibDrawSquare *) DEntryCompare)
|
||||
if( REFSTRUCT->m_Pos != CMPSTRUCT->m_Pos) return(FALSE);
|
||||
if( REFSTRUCT->m_End != CMPSTRUCT->m_End) return(FALSE);
|
||||
break;
|
||||
case COMPONENT_RECT_DRAW_TYPE:
|
||||
#undef REFSTRUCT
|
||||
#undef CMPSTRUCT
|
||||
#define REFSTRUCT ( (LibDrawSquare*) DEntryRef )
|
||||
#define CMPSTRUCT ( (LibDrawSquare*) DEntryCompare )
|
||||
if( REFSTRUCT->m_Pos != CMPSTRUCT->m_Pos )
|
||||
return FALSE;
|
||||
if( REFSTRUCT->m_End != CMPSTRUCT->m_End )
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
case COMPONENT_PIN_DRAW_TYPE:
|
||||
#undef REFSTRUCT
|
||||
#undef CMPSTRUCT
|
||||
#define REFSTRUCT ((LibDrawPin *) DEntryRef)
|
||||
#define CMPSTRUCT ((LibDrawPin *) DEntryCompare)
|
||||
if( REFSTRUCT->m_Pos != CMPSTRUCT->m_Pos) return(FALSE);
|
||||
break;
|
||||
case COMPONENT_PIN_DRAW_TYPE:
|
||||
#undef REFSTRUCT
|
||||
#undef CMPSTRUCT
|
||||
#define REFSTRUCT ( (LibDrawPin*) DEntryRef )
|
||||
#define CMPSTRUCT ( (LibDrawPin*) DEntryCompare )
|
||||
if( REFSTRUCT->m_Pos != CMPSTRUCT->m_Pos )
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
||||
#undef REFSTRUCT
|
||||
#undef CMPSTRUCT
|
||||
#define REFSTRUCT ((LibDrawPolyline *) DEntryRef)
|
||||
#define CMPSTRUCT ((LibDrawPolyline *) DEntryCompare)
|
||||
if( REFSTRUCT->n != CMPSTRUCT->n) return(FALSE);
|
||||
ptref = REFSTRUCT->PolyList;
|
||||
ptcomp = CMPSTRUCT->PolyList;
|
||||
for( ii = 2 * REFSTRUCT->n ; ii > 0; ii-- )
|
||||
{
|
||||
if( *ptref != *ptcomp) return(FALSE);
|
||||
ptref++; ptcomp++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return(TRUE);
|
||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
||||
#undef REFSTRUCT
|
||||
#undef CMPSTRUCT
|
||||
#define REFSTRUCT ( (LibDrawPolyline*) DEntryRef )
|
||||
#define CMPSTRUCT ( (LibDrawPolyline*) DEntryCompare )
|
||||
if( REFSTRUCT->n != CMPSTRUCT->n )
|
||||
return FALSE;
|
||||
ptref = REFSTRUCT->PolyList;
|
||||
ptcomp = CMPSTRUCT->PolyList;
|
||||
for( ii = 2 * REFSTRUCT->n; ii > 0; ii-- )
|
||||
{
|
||||
if( *ptref != *ptcomp )
|
||||
return FALSE;
|
||||
ptref++; ptcomp++;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* Routine de placement du point d'ancrage ( reference des coordonnes pour */
|
||||
/* le trace) du composant courant */
|
||||
|
@ -383,86 +427,90 @@ int * ptref, *ptcomp;
|
|||
/* d'ancrage ( coord 0,0 ). */
|
||||
/***************************************************************************/
|
||||
|
||||
void WinEDA_LibeditFrame::PlaceAncre(void)
|
||||
void WinEDA_LibeditFrame::PlaceAncre( void )
|
||||
{
|
||||
int ii, *ptsegm;
|
||||
int dx, dy; /* Offsets de deplacement */
|
||||
EDA_LibComponentStruct * LibEntry;
|
||||
LibEDA_BaseStruct * DrawEntry;
|
||||
int ii, * ptsegm;
|
||||
int dx, dy; /* Offsets de deplacement */
|
||||
EDA_LibComponentStruct* LibEntry;
|
||||
LibEDA_BaseStruct* DrawEntry;
|
||||
|
||||
dx = - m_CurrentScreen->m_Curseur.x;
|
||||
dy = m_CurrentScreen->m_Curseur.y;
|
||||
dx = -m_CurrentScreen->m_Curseur.x;
|
||||
dy = m_CurrentScreen->m_Curseur.y;
|
||||
|
||||
LibEntry = CurrentLibEntry;
|
||||
if( LibEntry == NULL ) return;
|
||||
LibEntry = CurrentLibEntry;
|
||||
if( LibEntry == NULL )
|
||||
return;
|
||||
|
||||
m_CurrentScreen->SetModify();
|
||||
m_CurrentScreen->SetModify();
|
||||
|
||||
LibEntry->m_Name.m_Pos.x += dx; LibEntry->m_Name.m_Pos.y += dy;
|
||||
LibEntry->m_Prefix.m_Pos.x += dx; LibEntry->m_Prefix.m_Pos.y += dy;
|
||||
LibEntry->m_Name.m_Pos.x += dx; LibEntry->m_Name.m_Pos.y += dy;
|
||||
LibEntry->m_Prefix.m_Pos.x += dx; LibEntry->m_Prefix.m_Pos.y += dy;
|
||||
|
||||
DrawEntry = LibEntry->m_Drawings;
|
||||
while(DrawEntry)
|
||||
{
|
||||
switch(DrawEntry->m_StructType)
|
||||
{
|
||||
case COMPONENT_ARC_DRAW_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ((LibDrawArc *) DrawEntry)
|
||||
STRUCT->m_Pos.x += dx;
|
||||
STRUCT->m_Pos.y += dy;
|
||||
STRUCT->m_ArcStart.x += dx;
|
||||
STRUCT->m_ArcStart.y += dy;
|
||||
STRUCT->m_ArcEnd.x += dx;
|
||||
STRUCT->m_ArcEnd.y += dy;
|
||||
break;
|
||||
DrawEntry = LibEntry->m_Drawings;
|
||||
while( DrawEntry )
|
||||
{
|
||||
switch( DrawEntry->m_StructType )
|
||||
{
|
||||
case COMPONENT_ARC_DRAW_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (LibDrawArc*) DrawEntry )
|
||||
STRUCT->m_Pos.x += dx;
|
||||
STRUCT->m_Pos.y += dy;
|
||||
STRUCT->m_ArcStart.x += dx;
|
||||
STRUCT->m_ArcStart.y += dy;
|
||||
STRUCT->m_ArcEnd.x += dx;
|
||||
STRUCT->m_ArcEnd.y += dy;
|
||||
break;
|
||||
|
||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ((LibDrawCircle *) DrawEntry)
|
||||
STRUCT->m_Pos.x += dx;
|
||||
STRUCT->m_Pos.y += dy;
|
||||
break;
|
||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (LibDrawCircle*) DrawEntry )
|
||||
STRUCT->m_Pos.x += dx;
|
||||
STRUCT->m_Pos.y += dy;
|
||||
break;
|
||||
|
||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ((LibDrawText *) DrawEntry)
|
||||
STRUCT->m_Pos.x += dx;
|
||||
STRUCT->m_Pos.y += dy;
|
||||
break;
|
||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (LibDrawText*) DrawEntry )
|
||||
STRUCT->m_Pos.x += dx;
|
||||
STRUCT->m_Pos.y += dy;
|
||||
break;
|
||||
|
||||
case COMPONENT_RECT_DRAW_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ((LibDrawSquare *) DrawEntry)
|
||||
STRUCT->m_Pos.x += dx;
|
||||
STRUCT->m_Pos.y += dy;
|
||||
STRUCT->m_End.x += dx;
|
||||
STRUCT->m_End.y += dy;
|
||||
break;
|
||||
case COMPONENT_RECT_DRAW_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (LibDrawSquare*) DrawEntry )
|
||||
STRUCT->m_Pos.x += dx;
|
||||
STRUCT->m_Pos.y += dy;
|
||||
STRUCT->m_End.x += dx;
|
||||
STRUCT->m_End.y += dy;
|
||||
break;
|
||||
|
||||
case COMPONENT_PIN_DRAW_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ((LibDrawPin *) DrawEntry)
|
||||
STRUCT->m_Pos.x += dx;
|
||||
STRUCT->m_Pos.y += dy;
|
||||
break;
|
||||
case COMPONENT_PIN_DRAW_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (LibDrawPin*) DrawEntry )
|
||||
STRUCT->m_Pos.x += dx;
|
||||
STRUCT->m_Pos.y += dy;
|
||||
break;
|
||||
|
||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ((LibDrawPolyline *) DrawEntry)
|
||||
ptsegm = STRUCT->PolyList;
|
||||
for( ii = STRUCT->n ; ii > 0; ii-- )
|
||||
{
|
||||
*ptsegm += dx; ptsegm++;
|
||||
*ptsegm += dy;ptsegm++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
DrawEntry = DrawEntry->Next();
|
||||
}
|
||||
/* Redraw the symbol */
|
||||
m_CurrentScreen->m_Curseur.x = m_CurrentScreen->m_Curseur.y = 0;
|
||||
Recadre_Trace(TRUE);
|
||||
m_CurrentScreen->SetRefreshReq();
|
||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (LibDrawPolyline*) DrawEntry )
|
||||
ptsegm = STRUCT->PolyList;
|
||||
for( ii = STRUCT->n; ii > 0; ii-- )
|
||||
{
|
||||
*ptsegm += dx; ptsegm++;
|
||||
*ptsegm += dy; ptsegm++;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
DrawEntry = DrawEntry->Next();
|
||||
}
|
||||
|
||||
/* Redraw the symbol */
|
||||
m_CurrentScreen->m_Curseur.x = m_CurrentScreen->m_Curseur.y = 0;
|
||||
Recadre_Trace( TRUE );
|
||||
m_CurrentScreen->SetRefreshReq();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,10 @@ extern std::ostream& operator<<( std::ostream& out, const wxPoint& pt );
|
|||
|
||||
|
||||
/* Id for class identification, at run time */
|
||||
enum DrawStructureType {
|
||||
|
||||
enum KICAD_T {
|
||||
|
||||
NOT_USED = -1, // the 3d code uses this value
|
||||
|
||||
EOT = 0, // search types array terminator (End Of Types)
|
||||
|
||||
TYPE_NOT_INIT = 0,
|
||||
|
@ -80,7 +82,6 @@ enum SEARCH_RESULT {
|
|||
SEARCH_CONTINUE
|
||||
};
|
||||
|
||||
typedef DrawStructureType KICAD_T; // shorter name
|
||||
|
||||
class EDA_BaseStruct;
|
||||
class WinEDA_DrawFrame;
|
||||
|
@ -126,7 +127,7 @@ public:
|
|||
class EDA_BaseStruct /* Basic class, not directly used */
|
||||
{
|
||||
public:
|
||||
int m_StructType; /* Struct ident for run time identification */
|
||||
KICAD_T m_StructType; /* Struct ident for run time identification */
|
||||
EDA_BaseStruct* Pnext; /* Linked list: Link (next struct) */
|
||||
EDA_BaseStruct* Pback; /* Linked list: Link (previous struct) */
|
||||
EDA_BaseStruct* m_Parent; /* Linked list: Link (parent struct) */
|
||||
|
@ -163,11 +164,11 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
EDA_BaseStruct( EDA_BaseStruct* parent, int idType );
|
||||
EDA_BaseStruct( int struct_type );
|
||||
EDA_BaseStruct( EDA_BaseStruct* parent, KICAD_T idType );
|
||||
EDA_BaseStruct( KICAD_T struct_type );
|
||||
virtual ~EDA_BaseStruct() { };
|
||||
|
||||
EDA_BaseStruct* Next( void ) { return Pnext; }
|
||||
EDA_BaseStruct* Next() { return Pnext; }
|
||||
|
||||
/* Gestion de l'etat (status) de la structure (active, deleted..) */
|
||||
int GetState( int type );
|
||||
|
@ -381,7 +382,7 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
BOARD_ITEM( BOARD_ITEM* StructFather, DrawStructureType idtype ) :
|
||||
BOARD_ITEM( BOARD_ITEM* StructFather, KICAD_T idtype ) :
|
||||
EDA_BaseStruct( StructFather, idtype ),
|
||||
m_Layer(0)
|
||||
{
|
||||
|
@ -450,22 +451,6 @@ public:
|
|||
};
|
||||
|
||||
|
||||
/* Base class for building items like lines, which have 1 start point and 1 end point.
|
||||
* Arc and circles can use this class.
|
||||
*/
|
||||
class EDA_BaseLineStruct : public EDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
int m_Layer; // Layer number
|
||||
int m_Width; // 0 = line, > 0 = tracks, bus ...
|
||||
wxPoint m_Start; // Line start point
|
||||
wxPoint m_End; // Line end point
|
||||
|
||||
public:
|
||||
EDA_BaseLineStruct( EDA_BaseStruct* StructFather, DrawStructureType idtype );
|
||||
};
|
||||
|
||||
|
||||
/**************************/
|
||||
/* class DrawPickedStruct */
|
||||
/**************************/
|
||||
|
|
|
@ -358,7 +358,7 @@ public:
|
|||
int m_Angle; // pour les arcs: "longueur" de l'arc en 1/10 deg
|
||||
|
||||
public:
|
||||
DRAWSEGMENT( BOARD_ITEM* StructFather, DrawStructureType idtype = TYPEDRAWSEGMENT );
|
||||
DRAWSEGMENT( BOARD_ITEM* StructFather, KICAD_T idtype = TYPEDRAWSEGMENT );
|
||||
~DRAWSEGMENT( void );
|
||||
|
||||
// Read/write data
|
||||
|
|
|
@ -501,7 +501,7 @@ public:
|
|||
virtual void SwitchLayer( wxDC* DC, int layer );
|
||||
|
||||
// divers
|
||||
void AddHistory( int value, DrawStructureType type ); // Add value in data list history
|
||||
void AddHistory( int value, KICAD_T type ); // Add value in data list history
|
||||
void InstallGridFrame( const wxPoint& pos );
|
||||
};
|
||||
|
||||
|
|
|
@ -502,6 +502,9 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
|
|||
( (EDGE_MODULE*) item )->m_End0.x += offset.x;
|
||||
( (EDGE_MODULE*) item )->m_End0.y += offset.y;
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
item->m_Flags = item->m_Selected = 0;
|
||||
|
@ -588,6 +591,9 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
|
|||
SETMIRROR( ( (TEXTE_MODULE*) item )->m_Pos.x );
|
||||
( (TEXTE_MODULE*) item )->m_Pos0.x = ( (TEXTE_MODULE*) item )->m_Pos.x;
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
item->m_Flags = item->m_Selected = 0;
|
||||
|
@ -639,6 +645,9 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
|
|||
( (TEXTE_MODULE*) item )->m_Pos0 = ( (TEXTE_MODULE*) item )->m_Pos;
|
||||
( (TEXTE_MODULE*) item )->m_Orient += 900;
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
item->m_Flags = item->m_Selected = 0;
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
EDGE_MODULE::EDGE_MODULE( MODULE* parent ) :
|
||||
BOARD_ITEM( parent, TYPEEDGEMODULE )
|
||||
{
|
||||
m_Width = 0;
|
||||
m_Shape = S_SEGMENT;
|
||||
m_Angle = 0;
|
||||
m_Width = 120;
|
||||
|
|
|
@ -22,9 +22,10 @@
|
|||
|
||||
/* Constructeur des classes type pistes, vias et zones */
|
||||
|
||||
TRACK::TRACK( BOARD_ITEM* StructFather, DrawStructureType idtype ) :
|
||||
TRACK::TRACK( BOARD_ITEM* StructFather, KICAD_T idtype ) :
|
||||
BOARD_ITEM( StructFather, idtype )
|
||||
{
|
||||
m_Width = 0;
|
||||
m_Shape = S_SEGMENT;
|
||||
start = end = NULL;
|
||||
m_NetCode = 0;
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
int m_Param; // Auxiliary variable ( used in some computations )
|
||||
|
||||
public:
|
||||
TRACK( BOARD_ITEM* StructFather, DrawStructureType idtype = TYPETRACK );
|
||||
TRACK( BOARD_ITEM* StructFather, KICAD_T idtype = TYPETRACK );
|
||||
TRACK( const TRACK& track );
|
||||
|
||||
TRACK* Next() { return (TRACK*) Pnext; }
|
||||
|
|
|
@ -52,10 +52,10 @@ EDGE_ZONE:: ~EDGE_ZONE( void )
|
|||
/**********************/
|
||||
|
||||
/* Classe DRAWSEGMENT: constructeur */
|
||||
DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* StructFather, DrawStructureType idtype ) :
|
||||
DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* StructFather, KICAD_T idtype ) :
|
||||
BOARD_ITEM( StructFather, idtype )
|
||||
{
|
||||
m_Flags = m_Shape = m_Type = m_Angle = 0;
|
||||
m_Width = m_Flags = m_Shape = m_Type = m_Angle = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
/* Constructeur des classes type pistes, vias et zones */
|
||||
|
||||
TRACK::TRACK( EDA_BaseStruct* StructFather, DrawStructureType idtype ) :
|
||||
TRACK::TRACK( EDA_BaseStruct* StructFather, KICAD_T idtype ) :
|
||||
SEGDRAW_Struct( StructFather, idtype )
|
||||
{
|
||||
m_Shape = S_SEGMENT;
|
||||
|
|
|
@ -281,7 +281,7 @@ void WinEDA_PcbTracksDialog::AcceptPcbOptions(wxCommandEvent& event)
|
|||
|
||||
|
||||
/*********************************************************************/
|
||||
void WinEDA_BasePcbFrame::AddHistory(int value, DrawStructureType type)
|
||||
void WinEDA_BasePcbFrame::AddHistory(int value, KICAD_T type)
|
||||
/**********************************************************************/
|
||||
// Mise a jour des listes des dernieres epaisseurs de via et track utilisées
|
||||
{
|
||||
|
|
|
@ -1254,6 +1254,9 @@ int* WinEDA_BasePcbFrame::build_ratsnest_pad( EDA_BaseStruct* ref,
|
|||
conn_number = track_ref->m_Sous_Netcode;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
if( current_net_code <= 0 )
|
||||
|
|
Loading…
Reference in New Issue