2007-08-24 15:10:46 +00:00
|
|
|
/*********************/
|
|
|
|
/* dangling_ends.cpp */
|
|
|
|
/*********************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
|
|
|
#include "common.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "program.h"
|
|
|
|
#include "general.h"
|
2009-11-03 13:26:31 +00:00
|
|
|
#include "netlist.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "protos.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
#include "class_library.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
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
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DanglingEndHandle
|
|
|
|
{
|
|
|
|
public:
|
2007-08-24 15:10:46 +00:00
|
|
|
const void* m_Item;
|
|
|
|
wxPoint m_Pos;
|
|
|
|
int m_Type;
|
|
|
|
DanglingEndHandle* m_Pnext;
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
DanglingEndHandle( int type )
|
|
|
|
{
|
2007-08-24 15:10:46 +00:00
|
|
|
m_Item = NULL;
|
|
|
|
m_Type = type;
|
|
|
|
m_Pnext = NULL;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
DanglingEndHandle* ItemList;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
static void TestWireForDangling( EDA_DrawLineStruct* DrawRef,
|
|
|
|
WinEDA_SchematicFrame* frame, wxDC* DC );
|
|
|
|
void TestLabelForDangling( SCH_TEXT* label,
|
|
|
|
WinEDA_SchematicFrame* frame,
|
|
|
|
wxDC* DC );
|
|
|
|
DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/**********************************************************/
|
2007-08-24 15:10:46 +00:00
|
|
|
bool SegmentIntersect( int Sx1, int Sy1, int Sx2, int Sy2,
|
|
|
|
int Px1, int Py1 )
|
2009-11-03 13:26:31 +00:00
|
|
|
{
|
2007-06-05 12:10:51 +00:00
|
|
|
/**********************************************************/
|
2009-11-03 13:26:31 +00:00
|
|
|
/* Returns TRUE if the point P is on the segment S.
|
|
|
|
* The segment is assumed horizontal or vertical.
|
2007-08-24 15:10:46 +00:00
|
|
|
*/
|
|
|
|
int Sxmin, Sxmax, Symin, Symax;
|
|
|
|
|
|
|
|
if( Sx1 == Sx2 ) /* Line S is vertical. */
|
|
|
|
{
|
2008-04-22 16:38:23 +00:00
|
|
|
Symin = MIN( Sy1, Sy2 );
|
|
|
|
Symax = MAX( Sy1, Sy2 );
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
if( Px1 != Sx1 )
|
|
|
|
return FALSE;
|
2008-04-22 16:38:23 +00:00
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
if( Py1 >= Symin && Py1 <= Symax )
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else if( Sy1 == Sy2 ) /* Line S is horizontal. */
|
|
|
|
{
|
2008-04-22 16:38:23 +00:00
|
|
|
Sxmin = MIN( Sx1, Sx2 );
|
|
|
|
Sxmax = MAX( Sx1, Sx2 );
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
if( Py1 != Sy1 )
|
|
|
|
return FALSE;
|
2008-04-22 16:38:23 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
if( Px1 >= Sxmin && Px1 <= Sxmax )
|
2007-08-24 15:10:46 +00:00
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
2009-11-03 13:26:31 +00:00
|
|
|
return FALSE;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
void WinEDA_SchematicFrame::TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-24 15:10:46 +00:00
|
|
|
if( ItemList )
|
2008-04-22 16:38:23 +00:00
|
|
|
{
|
|
|
|
const DanglingEndHandle* DanglingItem;
|
|
|
|
const DanglingEndHandle* nextitem;
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
for( DanglingItem = ItemList;
|
|
|
|
DanglingItem != NULL;
|
|
|
|
DanglingItem = nextitem )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
|
|
|
nextitem = DanglingItem->m_Pnext;
|
2008-02-12 21:12:46 +00:00
|
|
|
SAFE_DELETE( DanglingItem );
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
2008-04-22 16:38:23 +00:00
|
|
|
}
|
2007-08-24 15:10:46 +00:00
|
|
|
|
|
|
|
ItemList = RebuildEndList( DrawList );
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
for( SCH_ITEM* item = DrawList; item; item = item->Next() )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2008-04-22 16:38:23 +00:00
|
|
|
switch( item->Type() )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
case TYPE_SCH_GLOBALLABEL:
|
|
|
|
case TYPE_SCH_HIERLABEL:
|
|
|
|
case TYPE_SCH_LABEL:
|
2008-04-22 16:38:23 +00:00
|
|
|
TestLabelForDangling( (SCH_LABEL*) item, this, DC );
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
2008-04-22 16:38:23 +00:00
|
|
|
#undef STRUCT
|
|
|
|
#define STRUCT ( (EDA_DrawLineStruct*) item )
|
2008-04-14 19:22:48 +00:00
|
|
|
if( STRUCT->GetLayer() == LAYER_WIRE )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
|
|
|
TestWireForDangling( STRUCT, this, DC );
|
|
|
|
break;
|
|
|
|
}
|
2008-04-14 19:22:48 +00:00
|
|
|
if( STRUCT->GetLayer() == LAYER_NOTES )
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
2008-04-14 19:22:48 +00:00
|
|
|
if( STRUCT->GetLayer() == LAYER_BUS )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2009-11-03 13:26:31 +00:00
|
|
|
STRUCT->m_StartIsDangling = STRUCT->m_EndIsDangling = FALSE;
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-10-08 13:19:28 +00:00
|
|
|
/**
|
|
|
|
* Test if point pos is on a pin end.
|
|
|
|
*
|
|
|
|
* @param DrawList = List of SCH_ITEMs to check.
|
|
|
|
*
|
|
|
|
* @return LIB_PIN - Pointer to the located pin or NULL if no pin was found.
|
2007-08-24 15:10:46 +00:00
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
LIB_PIN* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList,
|
|
|
|
const wxPoint& pos )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
SCH_COMPONENT* DrawLibItem;
|
2009-10-08 13:19:28 +00:00
|
|
|
LIB_PIN* Pin;
|
2007-08-24 15:10:46 +00:00
|
|
|
wxPoint pinpos;
|
|
|
|
|
|
|
|
Pin = LocateAnyPin( DrawList, pos, &DrawLibItem );
|
|
|
|
if( !Pin )
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
pinpos = Pin->m_Pos;
|
|
|
|
|
|
|
|
if( DrawLibItem == NULL )
|
2009-01-02 13:19:34 +00:00
|
|
|
NEGATE( pinpos.y );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
|
|
|
else
|
2009-11-03 13:26:31 +00:00
|
|
|
pinpos = TransformCoordinate( DrawLibItem->m_Transform, pinpos );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-01-02 13:19:34 +00:00
|
|
|
if( pos == pinpos )
|
2007-08-24 15:10:46 +00:00
|
|
|
return Pin;
|
|
|
|
return NULL;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-08-24 15:10:46 +00:00
|
|
|
void TestWireForDangling( EDA_DrawLineStruct* DrawRef,
|
|
|
|
WinEDA_SchematicFrame* frame, wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-03 13:26:31 +00:00
|
|
|
/****************************************************************************/
|
2007-08-24 15:10:46 +00:00
|
|
|
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;
|
|
|
|
|
|
|
|
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 )
|
2009-11-03 13:26:31 +00:00
|
|
|
RedrawOneStruct( frame->DrawPanel, DC, DrawRef,
|
|
|
|
GR_DEFAULT_DRAWMODE );
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/********************************************************/
|
2009-11-03 13:26:31 +00:00
|
|
|
void TestLabelForDangling( SCH_TEXT* label, WinEDA_SchematicFrame* frame,
|
|
|
|
wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-03 13:26:31 +00:00
|
|
|
/********************************************************/
|
2007-08-24 15:10:46 +00:00
|
|
|
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:
|
2009-11-03 13:26:31 +00:00
|
|
|
if( ( label->m_Pos.x == terminal_item->m_Pos.x )
|
|
|
|
&& ( label->m_Pos.y == terminal_item->m_Pos.y ) )
|
2007-08-24 15:10:46 +00:00
|
|
|
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;
|
|
|
|
|
|
|
|
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 );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
/* Returns the physical position of the pin relative to the component
|
|
|
|
* orientation. */
|
2009-10-08 13:19:28 +00:00
|
|
|
wxPoint ReturnPinPhysicalPosition( LIB_PIN* Pin, SCH_COMPONENT* DrawLibItem )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-24 15:10:46 +00:00
|
|
|
wxPoint PinPos = Pin->m_Pos;
|
|
|
|
|
|
|
|
if( DrawLibItem == NULL )
|
2009-01-02 13:19:34 +00:00
|
|
|
NEGATE( PinPos.y );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
|
|
|
else
|
2009-10-08 13:19:28 +00:00
|
|
|
PinPos = TransformCoordinate( DrawLibItem->m_Transform,
|
|
|
|
Pin->m_Pos ) + DrawLibItem->m_Pos;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
|
|
|
return PinPos;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************/
|
2007-08-24 15:10:46 +00:00
|
|
|
DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-03 13:26:31 +00:00
|
|
|
/***********************************************************/
|
2007-08-24 15:10:46 +00:00
|
|
|
DanglingEndHandle* StartList = NULL, * item, * lastitem = NULL;
|
|
|
|
EDA_BaseStruct* DrawItem;
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
for( DrawItem = DrawList; DrawItem != NULL; DrawItem = DrawItem->Next() )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( DrawItem->Type() )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
case TYPE_SCH_LABEL:
|
|
|
|
case TYPE_SCH_GLOBALLABEL:
|
|
|
|
case TYPE_SCH_HIERLABEL:
|
2007-08-24 15:10:46 +00:00
|
|
|
#undef STRUCT
|
2008-03-20 01:50:21 +00:00
|
|
|
#define STRUCT ( (SCH_LABEL*) DrawItem )
|
2007-08-24 15:10:46 +00:00
|
|
|
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 )
|
2008-04-14 19:22:48 +00:00
|
|
|
if( STRUCT->GetLayer() == LAYER_NOTES )
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
2009-11-03 13:26:31 +00:00
|
|
|
if( ( STRUCT->GetLayer() == LAYER_BUS )
|
|
|
|
|| (STRUCT->GetLayer() == LAYER_WIRE ) )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2009-11-03 13:26:31 +00:00
|
|
|
item = new DanglingEndHandle(
|
|
|
|
(STRUCT->GetLayer() == LAYER_BUS) ?
|
|
|
|
BUS_START_END : WIRE_START_END );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
|
|
|
item->m_Item = DrawItem;
|
|
|
|
item->m_Pos = STRUCT->m_Start;
|
|
|
|
if( lastitem )
|
|
|
|
lastitem->m_Pnext = item;
|
|
|
|
else
|
|
|
|
StartList = item;
|
|
|
|
lastitem = item;
|
2009-11-03 13:26:31 +00:00
|
|
|
item =
|
|
|
|
new DanglingEndHandle( (STRUCT->GetLayer() == LAYER_BUS) ?
|
|
|
|
BUS_END_END : WIRE_END_END );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
item->m_Item = DrawItem;
|
|
|
|
item->m_Pos = STRUCT->m_End;
|
2007-08-24 15:10:46 +00:00
|
|
|
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;
|
2009-11-03 13:26:31 +00:00
|
|
|
item = new DanglingEndHandle( ENTRY_END );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
item->m_Item = DrawItem;
|
|
|
|
item->m_Pos = STRUCT->m_End();
|
2007-08-24 15:10:46 +00:00
|
|
|
lastitem->m_Pnext = item;
|
|
|
|
lastitem = item;
|
|
|
|
break;
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
case TYPE_SCH_COMPONENT:
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
|
|
|
#undef STRUCT
|
2008-03-20 01:50:21 +00:00
|
|
|
#define STRUCT ( (SCH_COMPONENT*) DrawItem )
|
2009-09-18 14:56:05 +00:00
|
|
|
LIB_COMPONENT* Entry;
|
|
|
|
Entry = CMP_LIBRARY::FindLibraryComponent( STRUCT->m_ChipName );
|
2007-08-24 15:10:46 +00:00
|
|
|
if( Entry == NULL )
|
|
|
|
break;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2009-10-08 13:19:28 +00:00
|
|
|
for( LIB_PIN* Pin = Entry->GetNextPin(); Pin != NULL;
|
2009-09-29 18:38:21 +00:00
|
|
|
Pin = Entry->GetNextPin( Pin ) )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2009-09-29 18:38:21 +00:00
|
|
|
wxASSERT( Pin->Type() == COMPONENT_PIN_DRAW_TYPE );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
if( Pin->m_Unit && STRUCT->m_Multi
|
|
|
|
&& ( STRUCT->m_Multi != Pin->m_Unit ) )
|
2007-08-24 15:10:46 +00:00
|
|
|
continue;
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
if( Pin->m_Convert && STRUCT->m_Convert
|
2009-11-03 13:26:31 +00:00
|
|
|
&& ( STRUCT->m_Convert != Pin->m_Convert ) )
|
2007-08-24 15:10:46 +00:00
|
|
|
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:
|
2009-11-03 13:26:31 +00:00
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET_PIN* pinsheet;
|
|
|
|
for( pinsheet = ( (SCH_SHEET*) DrawItem )->m_Label;
|
2009-11-03 13:26:31 +00:00
|
|
|
pinsheet;
|
|
|
|
pinsheet = pinsheet->Next() )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2009-11-03 13:26:31 +00:00
|
|
|
wxASSERT( pinsheet->Type() ==
|
|
|
|
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
item = new DanglingEndHandle( SHEET_LABEL_END );
|
2008-04-22 16:38:23 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
item->m_Item = pinsheet;
|
|
|
|
item->m_Pos = pinsheet->m_Pos;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
if( lastitem )
|
|
|
|
lastitem->m_Pnext = item;
|
|
|
|
else
|
|
|
|
StartList = item;
|
2008-04-22 16:38:23 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
lastitem = item;
|
2008-04-22 16:38:23 +00:00
|
|
|
}
|
2009-11-03 13:26:31 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
default:
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return StartList;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|