see todays change_log.txt

This commit is contained in:
dickelbeck 2007-09-21 04:40:12 +00:00
parent eb660b7c13
commit 0a2ed094e0
7 changed files with 1441 additions and 1229 deletions

View File

@ -9,7 +9,7 @@
/* fonctions exportees */ /* fonctions exportees */
int ListeComposants( CmpListStruct* BaseListeCmp, SCH_SCREEN* screen, int NumSheet ); int ListeComposants( CmpListStruct* BaseListeCmp, SCH_SCREEN* screen, int NumSheet );
int AnnotTriComposant( CmpListStruct* Objet1, CmpListStruct* Objet2 ); int AnnotTriComposant( const void* o1, const void* o2 );
void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp ); void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp );
/* fonctions locales */ /* fonctions locales */
@ -236,8 +236,7 @@ int ListeComposants( CmpListStruct* BaseListeCmp, SCH_SCREEN* screen, int NumShe
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
DrawList = screen->EEDrawList; DrawList = screen->EEDrawList;
for( ; DrawList; DrawList = DrawList->Pnext )
while( DrawList )
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
@ -253,20 +252,25 @@ int ListeComposants( CmpListStruct* BaseListeCmp, SCH_SCREEN* screen, int NumShe
Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry == NULL ) if( Entry == NULL )
break; break;
if( BaseListeCmp == NULL ) /* Items counting only */ if( BaseListeCmp == NULL ) /* Items counting only */
{ {
NbrCmp++; break; NbrCmp++;
break;
} }
BaseListeCmp[NbrCmp].m_Cmp = DrawLibItem; BaseListeCmp[NbrCmp].m_Cmp = DrawLibItem;
BaseListeCmp[NbrCmp].m_NbParts = Entry->m_UnitCount; BaseListeCmp[NbrCmp].m_NbParts = Entry->m_UnitCount;
BaseListeCmp[NbrCmp].m_Unit = DrawLibItem->m_Multi; BaseListeCmp[NbrCmp].m_Unit = DrawLibItem->m_Multi;
BaseListeCmp[NbrCmp].m_PartsLocked = Entry->m_UnitSelectionLocked; BaseListeCmp[NbrCmp].m_PartsLocked = Entry->m_UnitSelectionLocked;
BaseListeCmp[NbrCmp].m_Sheet = NumSheet; BaseListeCmp[NbrCmp].m_Sheet = NumSheet;
BaseListeCmp[NbrCmp].m_IsNew = FALSE; BaseListeCmp[NbrCmp].m_IsNew = FALSE;
BaseListeCmp[NbrCmp].m_Pos = DrawLibItem->m_Pos; BaseListeCmp[NbrCmp].m_Pos = DrawLibItem->m_Pos;
BaseListeCmp[NbrCmp].m_TimeStamp = DrawLibItem->m_TimeStamp; BaseListeCmp[NbrCmp].m_TimeStamp = DrawLibItem->m_TimeStamp;
if( DrawLibItem->m_Field[REFERENCE].m_Text.IsEmpty() ) if( DrawLibItem->m_Field[REFERENCE].m_Text.IsEmpty() )
DrawLibItem->m_Field[REFERENCE].m_Text = wxT( "DefRef?" ); DrawLibItem->m_Field[REFERENCE].m_Text = wxT( "DefRef?" );
strncpy( BaseListeCmp[NbrCmp].m_TextRef, strncpy( BaseListeCmp[NbrCmp].m_TextRef,
CONV_TO_UTF8( DrawLibItem->m_Field[REFERENCE].m_Text ), 32 ); CONV_TO_UTF8( DrawLibItem->m_Field[REFERENCE].m_Text ), 32 );
@ -274,6 +278,7 @@ int ListeComposants( CmpListStruct* BaseListeCmp, SCH_SCREEN* screen, int NumShe
if( DrawLibItem->m_Field[VALUE].m_Text.IsEmpty() ) if( DrawLibItem->m_Field[VALUE].m_Text.IsEmpty() )
DrawLibItem->m_Field[VALUE].m_Text = wxT( "~" ); DrawLibItem->m_Field[VALUE].m_Text = wxT( "~" );
strncpy( BaseListeCmp[NbrCmp].m_TextValue, strncpy( BaseListeCmp[NbrCmp].m_TextValue,
CONV_TO_UTF8( DrawLibItem->m_Field[VALUE].m_Text ), 32 ); CONV_TO_UTF8( DrawLibItem->m_Field[VALUE].m_Text ), 32 );
NbrCmp++; NbrCmp++;
@ -291,8 +296,6 @@ int ListeComposants( CmpListStruct* BaseListeCmp, SCH_SCREEN* screen, int NumShe
default: default:
break; break;
} }
DrawList = DrawList->Pnext;
} }
return NbrCmp; return NbrCmp;
@ -300,7 +303,7 @@ int ListeComposants( CmpListStruct* BaseListeCmp, SCH_SCREEN* screen, int NumShe
/*****************************************************************/ /*****************************************************************/
int AnnotTriComposant( CmpListStruct* Objet1, CmpListStruct* Objet2 ) int AnnotTriComposant( const void* o1, const void* o2 )
/****************************************************************/ /****************************************************************/
/* function used par qsort() for sorting the list /* function used par qsort() for sorting the list
@ -312,9 +315,11 @@ int AnnotTriComposant( CmpListStruct* Objet1, CmpListStruct* Objet2 )
* if same sheet, by time stamp * if same sheet, by time stamp
**/ **/
{ {
int ii; CmpListStruct* Objet1 = (CmpListStruct*) o1;
CmpListStruct* Objet2 = (CmpListStruct*) o2;
ii = strnicmp( Objet1->m_TextRef, Objet2->m_TextRef, 32 ); int ii = strnicmp( Objet1->m_TextRef, Objet2->m_TextRef, 32 );
if( SortByPosition == TRUE ) if( SortByPosition == TRUE )
{ {
if( ii == 0 ) if( ii == 0 )
@ -401,7 +406,8 @@ void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp )
BaseListeCmp[ii].m_IsNew = TRUE; BaseListeCmp[ii].m_IsNew = TRUE;
if( !BaseListeCmp[ii].m_PartsLocked ) if( !BaseListeCmp[ii].m_PartsLocked )
BaseListeCmp[ii].m_Unit = 0x7FFFFFFF; BaseListeCmp[ii].m_Unit = 0x7FFFFFFF;
Text[ll] = 0; continue; Text[ll] = 0;
continue;
} }
if( isdigit( Text[ll] ) == 0 ) if( isdigit( Text[ll] ) == 0 )
@ -646,7 +652,8 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly )
/* 2eme passe : Remplissage du tableau des caracteristiques */ /* 2eme passe : Remplissage du tableau des caracteristiques */
if( OneSheetOnly == 0 ) if( OneSheetOnly == 0 )
{ {
ii = 0; screen = ScreenSch; ii = 0;
screen = ScreenSch;
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{ {
ii += ListeComposants( ListeCmp + ii, screen, NumSheet ); ii += ListeComposants( ListeCmp + ii, screen, NumSheet );
@ -658,9 +665,7 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly )
ListeComposants( ListeCmp, screen, NumSheet ); ListeComposants( ListeCmp, screen, NumSheet );
} }
qsort( ListeCmp, NbOfCmp, sizeof(CmpListStruct), qsort( ListeCmp, NbOfCmp, sizeof(CmpListStruct), AnnotTriComposant );
( int( * ) ( const void*, const void* ) )AnnotTriComposant );
/* Separation des Numeros de la reference: IC1 -> IC, et 1 dans .m_NumRef */ /* Separation des Numeros de la reference: IC1 -> IC, et 1 dans .m_NumRef */
BreakReference( ListeCmp, NbOfCmp ); BreakReference( ListeCmp, NbOfCmp );
@ -669,13 +674,16 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly )
error = 0; error = 0;
for( ii = 0; ii < NbOfCmp - 1; ii++ ) for( ii = 0; ii < NbOfCmp - 1; ii++ )
{ {
msg.Empty(); Buff.Empty(); msg.Empty();
Buff.Empty();
if( ListeCmp[ii].m_IsNew ) if( ListeCmp[ii].m_IsNew )
{ {
if( ListeCmp[ii].m_NumRef >= 0 ) if( ListeCmp[ii].m_NumRef >= 0 )
Buff << ListeCmp[ii].m_NumRef; Buff << ListeCmp[ii].m_NumRef;
else else
Buff = wxT( "?" ); Buff = wxT( "?" );
cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef ); cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef );
msg.Printf( _( "item not annotated: %s%s" ), cmpref.GetData(), Buff.GetData() ); msg.Printf( _( "item not annotated: %s%s" ), cmpref.GetData(), Buff.GetData() );
@ -685,7 +693,8 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly )
msg << Buff; msg << Buff;
} }
DisplayError( NULL, msg ); DisplayError( NULL, msg );
error++; break; error++;
break;
} }
if( MAX( ListeCmp[ii].m_NbParts, 1 ) < ListeCmp[ii].m_Unit ) // Annotate error if( MAX( ListeCmp[ii].m_NbParts, 1 ) < ListeCmp[ii].m_Unit ) // Annotate error
@ -702,24 +711,27 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly )
ListeCmp[ii].m_Unit, ListeCmp[ii].m_NbParts ); ListeCmp[ii].m_Unit, ListeCmp[ii].m_NbParts );
msg << Buff; msg << Buff;
DisplayError( frame, msg ); DisplayError( frame, msg );
error++; break; error++;
break;
} }
} }
if( error ) if( error )
return error; return error;
/* comptage des elements doublés (si tous sont annotés) */ // count the duplicated elements (if all are annotated)
for( ii = 0; (ii < NbOfCmp - 1) && (error < 4); ii++ ) for( ii = 0; (ii < NbOfCmp - 1) && (error < 4); ii++ )
{ {
msg.Empty(); Buff.Empty(); msg.Empty();
Buff.Empty();
if( (stricmp( ListeCmp[ii].m_TextRef, ListeCmp[ii + 1].m_TextRef ) != 0) if( (stricmp( ListeCmp[ii].m_TextRef, ListeCmp[ii + 1].m_TextRef ) != 0)
|| ( ListeCmp[ii].m_NumRef != ListeCmp[ii + 1].m_NumRef ) ) || ( ListeCmp[ii].m_NumRef != ListeCmp[ii + 1].m_NumRef ) )
continue; continue;
/* Meme reference trouvée */ /* Meme reference trouvée */
/* Il y a erreur si meme unite */ /* Il y a erreur si meme unite */
if( ListeCmp[ii].m_Unit == ListeCmp[ii + 1].m_Unit ) if( ListeCmp[ii].m_Unit == ListeCmp[ii+1].m_Unit )
{ {
if( ListeCmp[ii].m_NumRef >= 0 ) if( ListeCmp[ii].m_NumRef >= 0 )
Buff << ListeCmp[ii].m_NumRef; Buff << ListeCmp[ii].m_NumRef;
@ -736,7 +748,8 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly )
msg << Buff; msg << Buff;
} }
DisplayError( frame, msg ); DisplayError( frame, msg );
error++; continue; error++;
continue;
} }
/* Il y a erreur si unites differentes mais nombre de parts differentes /* Il y a erreur si unites differentes mais nombre de parts differentes
@ -771,9 +784,9 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly )
nextcmpvalue = CONV_FROM_UTF8( ListeCmp[ii + 1].m_TextValue ); nextcmpvalue = CONV_FROM_UTF8( ListeCmp[ii + 1].m_TextValue );
msg.Printf( _( "Diff values for %s%d%c (%s) and %s%d%c (%s)" ), msg.Printf( _( "Diff values for %s%d%c (%s) and %s%d%c (%s)" ),
cmpref.GetData(), ListeCmp[ii].m_NumRef, ListeCmp[ii].m_Unit + 'A' - 1, cmpref.GetData(), ListeCmp[ii].m_NumRef, ListeCmp[ii].m_Unit + 'A' - 1,
cmpvalue.GetData(), cmpvalue.GetData(), nextcmpref.GetData(),
nextcmpref.GetData( ListeCmp[ii + 1].m_NumRef,
), ListeCmp[ii + 1].m_NumRef, ListeCmp[ii + 1].m_Unit + 'A' - 1, ListeCmp[ii + 1].m_Unit + 'A' - 1,
nextcmpvalue.GetData() ); nextcmpvalue.GetData() );
DisplayError( frame, msg ); DisplayError( frame, msg );

View File

@ -49,21 +49,21 @@ const wxString& ReturnDefaultFieldName( int aFieldNdx )
* for I18n * for I18n
*/ */
{ {
// avoid unnecessarily copying wxStrings. // avoid unnecessarily copying wxStrings at runtime.
static const wxString FieldDefaultNameList[] = { static const wxString FieldDefaultNameList[] = {
_( "Ref" ), /* Reference of part, i.e. "IC21" */ _( "Ref" ), /* Reference of part, i.e. "IC21" */
_( "Value" ), /* Value of part, i.e. "3.3K" */ _( "Value" ), /* Value of part, i.e. "3.3K" */
_( "Footprint" ), /* Footprint, used by cvpcb or pcbnew, i.e. "16DIP300" */ _( "Footprint" ), /* Footprint, used by cvpcb or pcbnew, i.e. "16DIP300" */
_( "Sheet" ), /* for components which are a schematic file, schematic file name, i.e. "cnt16.sch" */ _( "Sheet" ), /* for components which are a schematic file, schematic file name, i.e. "cnt16.sch" */
_( "Field1" ), /* User fields (1 to n) have an editable name*/ wxString(_( "Field" ))+wxT("1"),
_( "Field2" ), wxString(_( "Field" ))+wxT("2"),
_( "Field3" ), wxString(_( "Field" ))+wxT("3"),
_( "Field4" ), wxString(_( "Field" ))+wxT("4"),
_( "Field5" ), wxString(_( "Field" ))+wxT("5"),
_( "Field6" ), wxString(_( "Field" ))+wxT("6"),
_( "Field7" ), wxString(_( "Field" ))+wxT("7"),
_( "Field8" ), wxString(_( "Field" ))+wxT("8"),
wxT( "badFieldNdx!" ) // error, and "sentinel" value wxT( "badFieldNdx!" ) // error, and "sentinel" value
}; };
if( (unsigned) aFieldNdx > FIELD8 ) // catches < 0 also if( (unsigned) aFieldNdx > FIELD8 ) // catches < 0 also

View File

@ -348,7 +348,7 @@ EDA_LibComponentStruct* FindLibPart( const wxChar* Name, const wxString& LibName
{ {
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
static EDA_LibComponentStruct DummyEntry( wxEmptyString );/* Used only to call PQFind. */ static EDA_LibComponentStruct DummyEntry( wxEmptyString ); /* Used only to call PQFind. */
LibraryStruct* Lib = g_LibraryList; LibraryStruct* Lib = g_LibraryList;
@ -357,24 +357,30 @@ EDA_LibComponentStruct* FindLibPart( const wxChar* Name, const wxString& LibName
PQCompFunc( (PQCompFuncType) LibraryEntryCompare ); PQCompFunc( (PQCompFuncType) LibraryEntryCompare );
Entry = NULL; FindLibName.Empty(); Entry = NULL;
FindLibName.Empty();
while( Lib ) while( Lib )
{ {
if( !LibName.IsEmpty() ) if( !LibName.IsEmpty() )
{ {
if( Lib->m_Name != LibName ) if( Lib->m_Name != LibName )
{ {
Lib = Lib->m_Pnext; continue; Lib = Lib->m_Pnext;
continue;
} }
} }
if( Lib == NULL ) if( Lib == NULL )
break; break;
Entry = (EDA_LibComponentStruct*) PQFind( Lib->m_Entries, &DummyEntry ); Entry = (EDA_LibComponentStruct*) PQFind( Lib->m_Entries, &DummyEntry );
if( Entry != NULL ) if( Entry != NULL )
{ {
FindLibName = Lib->m_Name; FindLibName = Lib->m_Name;
break; break;
} }
Lib = Lib->m_Pnext; Lib = Lib->m_Pnext;
} }
@ -425,11 +431,13 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
/* Elimination des elements non relatifs a l'unite */ /* Elimination des elements non relatifs a l'unite */
if( Multi && DEntry->m_Unit && (DEntry->m_Unit != Multi) ) if( Multi && DEntry->m_Unit && (DEntry->m_Unit != Multi) )
continue; continue;
if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) ) if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) )
continue; continue;
if( DEntry->m_Flags & IS_MOVED ) if( DEntry->m_Flags & IS_MOVED )
continue; // Element en deplacement non trace continue; // Element en deplacement non trace
SetHightColor = (DEntry->m_Selected & IS_SELECTED) ? HIGHT_LIGHT_FLAG : 0; SetHightColor = (DEntry->m_Selected & IS_SELECTED) ? HIGHT_LIGHT_FLAG : 0;
LineWidth = MAX( DEntry->m_Width, g_DrawMinimunLineWidth ); LineWidth = MAX( DEntry->m_Width, g_DrawMinimunLineWidth );
@ -494,10 +502,12 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
LibDrawCircle* Circle = (LibDrawCircle*) DEntry; LibDrawCircle* Circle = (LibDrawCircle*) DEntry;
CharColor = GETCOLOR( LAYER_DEVICE ); CharColor = GETCOLOR( LAYER_DEVICE );
x1 = Pos.x + TransMat[0][0] * Circle->m_Pos.x + x1 = Pos.x + TransMat[0][0] * Circle->m_Pos.x +
TransMat[0][1] * Circle->m_Pos.y; TransMat[0][1] * Circle->m_Pos.y;
y1 = Pos.y + TransMat[1][0] * Circle->m_Pos.x + y1 = Pos.y + TransMat[1][0] * Circle->m_Pos.x +
TransMat[1][1] * Circle->m_Pos.y; TransMat[1][1] * Circle->m_Pos.y;
fill_option = Circle->m_Fill & (~g_PrintFillMask); fill_option = Circle->m_Fill & (~g_PrintFillMask);
if( Color < 0 ) if( Color < 0 )
{ {
@ -526,10 +536,12 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
/* The text orientation may need to be flipped if the /* The text orientation may need to be flipped if the
* transformation matrix cuases xy axes to be flipped. */ * transformation matrix cuases xy axes to be flipped. */
t1 = (TransMat[0][0] != 0) ^ (Text->m_Horiz != 0); t1 = (TransMat[0][0] != 0) ^ (Text->m_Horiz != 0);
x1 = Pos.x + TransMat[0][0] * Text->m_Pos.x x1 = Pos.x + TransMat[0][0] * Text->m_Pos.x
+ TransMat[0][1] * Text->m_Pos.y; + TransMat[0][1] * Text->m_Pos.y;
y1 = Pos.y + TransMat[1][0] * Text->m_Pos.x y1 = Pos.y + TransMat[1][0] * Text->m_Pos.x
+ TransMat[1][1] * Text->m_Pos.y; + TransMat[1][1] * Text->m_Pos.y;
DrawGraphicText( panel, DC, wxPoint( x1, y1 ), CharColor, Text->m_Text, DrawGraphicText( panel, DC, wxPoint( x1, y1 ), CharColor, Text->m_Text,
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT, t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
Text->m_Size, Text->m_Size,
@ -579,6 +591,7 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
&& !g_ShowAllPins ) && !g_ShowAllPins )
break; break;
} }
/* Calcul de l'orientation reelle de la Pin */ /* Calcul de l'orientation reelle de la Pin */
orient = Pin->ReturnPinDrawOrient( TransMat ); orient = Pin->ReturnPinDrawOrient( TransMat );

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -36,6 +36,61 @@ static int LastNetCode, LastBusNetCode;
static int s_PassNumber; static int s_PassNumber;
#if defined(DEBUG)
const char* ShowType( NetObjetType aType )
{
const char* ret;
switch( aType )
{
case NET_SEGMENT: ret = "segment"; break;
case NET_BUS: ret = "bus"; break;
case NET_JONCTION: ret = "junction"; break;
case NET_LABEL: ret = "label"; break;
case NET_GLOBLABEL: ret = "glabel"; break;
case NET_BUSLABELMEMBER: ret = "buslblmember"; break;
case NET_GLOBBUSLABELMEMBER: ret = "gbuslblmember"; break;
case NET_SHEETBUSLABELMEMBER: ret = "sbuslblmember"; break;
case NET_SHEETLABEL: ret = "sheetlabel"; break;
case NET_PINLABEL: ret = "pinlabel"; break;
case NET_PIN: ret = "pin"; break;
case NET_NOCONNECT: ret = "noconnect"; break;
default: ret = "??"; break;
}
return ret;
}
void ObjetNetListStruct::Show( std::ostream& out, int ndx )
{
out << "<netItem ndx=\"" << ndx << '"' <<
" type=\"" << ShowType(m_Type) << '"' <<
" netCode=\"" << m_NetCode << '"' <<
" sheet=\"" << m_SheetNumber << '"' <<
">\n";
out << " <start " << m_Start << "/> <end " << m_End << "/>\n";
if( m_Label )
out << " <label>" << m_Label->mb_str() << "</label>\n";
if( m_Comp )
m_Comp->Show( 1, out );
out << "</netItem>\n";
}
void dumpNetTable()
{
for( int i=0; i<g_NbrObjNet; ++i )
{
g_TabObjNet[i].Show( std::cout, i );
}
}
#endif
/***********************************************************************/ /***********************************************************************/
void FreeTabNetList( ObjetNetListStruct* TabNetItems, int NbrNetItems ) void FreeTabNetList( ObjetNetListStruct* TabNetItems, int NbrNetItems )
/***********************************************************************/ /***********************************************************************/
@ -134,10 +189,10 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
Affiche_1_Parametre( this, 1, _( "List" ), wxEmptyString, RED ); Affiche_1_Parametre( this, 1, _( "List" ), wxEmptyString, RED );
screen = ScreenList.GetFirst(); screen = ScreenList.GetFirst();
for( ObjetNetListStruct* baseTabObjNet = g_TabObjNet; for( ObjetNetListStruct* tabObjNet = g_TabObjNet;
screen != NULL; screen = ScreenList.GetNext() ) screen != NULL; screen = ScreenList.GetNext() )
{ {
baseTabObjNet += ListeObjetConnection( this, screen, baseTabObjNet ); tabObjNet += ListeObjetConnection( this, screen, tabObjNet );
} }
Affiche_1_Parametre( this, -1, wxEmptyString, _( "Done" ), RED ); Affiche_1_Parametre( this, -1, wxEmptyString, _( "Done" ), RED );
@ -155,11 +210,12 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
SheetNumber = g_TabObjNet[0].m_SheetNumber; SheetNumber = g_TabObjNet[0].m_SheetNumber;
LastNetCode = LastBusNetCode = 1; LastNetCode = LastBusNetCode = 1;
for( i = istart = 0; i < g_NbrObjNet; i++ ) for( i = istart = 0; i<g_NbrObjNet; i++ )
{ {
if( g_TabObjNet[i].m_SheetNumber != SheetNumber ) if( g_TabObjNet[i].m_SheetNumber != SheetNumber )
{ {
SheetNumber = g_TabObjNet[i].m_SheetNumber; istart = i; SheetNumber = g_TabObjNet[i].m_SheetNumber;
istart = i;
} }
switch( g_TabObjNet[i].m_Type ) switch( g_TabObjNet[i].m_Type )
@ -237,6 +293,13 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
} }
} }
#if defined(DEBUG)
std::cout << "after sheet local\n";
dumpNetTable();
#endif
Affiche_1_Parametre( this, -1, wxEmptyString, _( "Done" ), CYAN ); Affiche_1_Parametre( this, -1, wxEmptyString, _( "Done" ), CYAN );
/* Mise a jour des NetCodes des Bus Labels connectes par les Bus */ /* Mise a jour des NetCodes des Bus Labels connectes par les Bus */
@ -245,7 +308,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
Affiche_1_Parametre( this, 26, _( "Labels" ), wxEmptyString, CYAN ); Affiche_1_Parametre( this, 26, _( "Labels" ), wxEmptyString, CYAN );
/* Connections des groupes d'objets par labels identiques */ /* Connections des groupes d'objets par labels identiques */
for( i = 0; i < g_NbrObjNet; i++ ) for( i = 0; i<g_NbrObjNet; i++ )
{ {
switch( g_TabObjNet[i].m_Type ) switch( g_TabObjNet[i].m_Type )
{ {
@ -270,22 +333,32 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
} }
} }
#if defined(DEBUG)
std::cout << "after sheet global\n";
dumpNetTable();
#endif
Affiche_1_Parametre( this, -1, wxEmptyString, _( "Done" ), CYAN ); Affiche_1_Parametre( this, -1, wxEmptyString, _( "Done" ), CYAN );
/* Connexion des hierarchies */ /* Connexion des hierarchies */
Affiche_1_Parametre( this, 36, _( "Hierar." ), wxEmptyString, LIGHTRED ); Affiche_1_Parametre( this, 36, _( "Hierar." ), wxEmptyString, LIGHTRED );
for( i = 0; i < g_NbrObjNet; i++ ) for( i = 0; i<g_NbrObjNet; i++ )
{ {
if( (g_TabObjNet[i].m_Type == NET_SHEETLABEL ) if( g_TabObjNet[i].m_Type == NET_SHEETLABEL
|| ( g_TabObjNet[i].m_Type == NET_SHEETBUSLABELMEMBER ) ) || g_TabObjNet[i].m_Type == NET_SHEETBUSLABELMEMBER )
SheetLabelConnection( g_TabObjNet + i ); SheetLabelConnection( g_TabObjNet + i );
} }
/* Tri du Tableau des objets de Net par NetCode */ /* Tri du Tableau des objets de Net par NetCode */
qsort( g_TabObjNet, g_NbrObjNet, sizeof(ObjetNetListStruct), TriNetCode ); qsort( g_TabObjNet, g_NbrObjNet, sizeof(ObjetNetListStruct), TriNetCode );
#if defined(DEBUG)
std::cout << "after qsort()\n";
dumpNetTable();
#endif
Affiche_1_Parametre( this, -1, wxEmptyString, _( "Done" ), RED ); Affiche_1_Parametre( this, -1, wxEmptyString, _( "Done" ), RED );
/* Compression des numeros de NetCode a des valeurs consecutives */ /* Compression des numeros de NetCode a des valeurs consecutives */
@ -295,7 +368,8 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
{ {
if( g_TabObjNet[i].m_NetCode != LastNetCode ) if( g_TabObjNet[i].m_NetCode != LastNetCode )
{ {
NetCode++; LastNetCode = g_TabObjNet[i].m_NetCode; NetCode++;
LastNetCode = g_TabObjNet[i].m_NetCode;
} }
g_TabObjNet[i].m_NetCode = NetCode; g_TabObjNet[i].m_NetCode = NetCode;
} }
@ -502,7 +576,7 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
DEntry = Entry->m_Drawings; DEntry = Entry->m_Drawings;
for( ; DEntry != NULL; DEntry = DEntry->Next() ) for( ; DEntry; DEntry = DEntry->Next() )
{ {
LibDrawPin* Pin = (LibDrawPin*) DEntry; LibDrawPin* Pin = (LibDrawPin*) DEntry;
if( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE ) if( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE )
@ -534,7 +608,7 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
ObjNet[NbrItem].m_SheetNumber = NumSheet; ObjNet[NbrItem].m_SheetNumber = NumSheet;
ObjNet[NbrItem].m_Start.x = x2; ObjNet[NbrItem].m_Start.x = x2;
ObjNet[NbrItem].m_Start.y = y2; ObjNet[NbrItem].m_Start.y = y2;
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start; ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
} }
NbrItem++; NbrItem++;
@ -551,7 +625,7 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
ObjNet[NbrItem].m_Label = &Pin->m_PinName; ObjNet[NbrItem].m_Label = &Pin->m_PinName;
ObjNet[NbrItem].m_Start.x = x2; ObjNet[NbrItem].m_Start.x = x2;
ObjNet[NbrItem].m_Start.y = y2; ObjNet[NbrItem].m_Start.y = y2;
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start; ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
} }
NbrItem++; NbrItem++;
} }
@ -763,6 +837,7 @@ static int ConvertBusToMembers( ObjetNetListStruct* BusLabel )
/* Convertion du BusLabel en la racine du Label + le numero du fil */ /* Convertion du BusLabel en la racine du Label + le numero du fil */
BufLine = BusLabel->m_Label->Left( RootBusNameLength ); BufLine = BusLabel->m_Label->Left( RootBusNameLength );
BusMember = FirstNumWireBus; BusMember = FirstNumWireBus;
BufLine << BusMember; BufLine << BusMember;
BusLabel->m_Label = new wxString( BufLine ); BusLabel->m_Label = new wxString( BufLine );
@ -772,7 +847,9 @@ static int ConvertBusToMembers( ObjetNetListStruct* BusLabel )
for( BusMember++; BusMember <= LastNumWireBus; BusMember++ ) for( BusMember++; BusMember <= LastNumWireBus; BusMember++ )
{ {
*(BusLabel + 1) = *BusLabel; BusLabel++; NumItem++; *(BusLabel + 1) = *BusLabel;
BusLabel++;
NumItem++;
/* Convertion du BusLabel en la racine du Label + le numero du fil */ /* Convertion du BusLabel en la racine du Label + le numero du fil */
BufLine = BusLabel->m_Label->Left( RootBusNameLength ); BufLine = BusLabel->m_Label->Left( RootBusNameLength );
@ -849,18 +926,18 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
* ( il ne peut y avoir connexion physique entre elements de differentes sheets) * ( il ne peut y avoir connexion physique entre elements de differentes sheets)
*/ */
{ {
int i, NetCode; int i, netCode;
ObjetNetListStruct* Point = g_TabObjNet; ObjetNetListStruct* netTable = g_TabObjNet;
if( IsBus == 0 ) /* Objets autres que BUS et BUSLABELS */ if( IsBus == 0 ) /* Objets autres que BUS et BUSLABELS */
{ {
NetCode = Ref->m_NetCode; netCode = Ref->m_NetCode;
for( i = start; i < g_NbrObjNet; i++ ) for( i = start; i < g_NbrObjNet; i++ )
{ {
if( Point[i].m_SheetNumber > Ref->m_SheetNumber ) if( netTable[i].m_SheetNumber > Ref->m_SheetNumber )
break; break;
switch( Point[i].m_Type ) switch( netTable[i].m_Type )
{ {
case NET_SEGMENT: case NET_SEGMENT:
case NET_PIN: case NET_PIN:
@ -870,18 +947,15 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
case NET_PINLABEL: case NET_PINLABEL:
case NET_JONCTION: case NET_JONCTION:
case NET_NOCONNECT: case NET_NOCONNECT:
if( ( ( (Ref->m_Start.x == Point[i].m_Start.x) && if( Ref->m_Start == netTable[i].m_Start
(Ref->m_Start.y == Point[i].m_Start.y) ) ) || Ref->m_Start == netTable[i].m_End
|| ( ( (Ref->m_Start.x == Point[i].m_End.x) && || Ref->m_End == netTable[i].m_Start
(Ref->m_Start.y == Point[i].m_End.y) ) ) || Ref->m_End == netTable[i].m_End )
|| ( ( (Ref->m_End.x == Point[i].m_Start.x) &&
(Ref->m_End.y == Point[i].m_Start.y) ) )
|| ( ( (Ref->m_End.x == Point[i].m_End.x) && (Ref->m_End.y == Point[i].m_End.y) ) ) )
{ {
if( Point[i].m_NetCode == 0 ) if( netTable[i].m_NetCode == 0 )
Point[i].m_NetCode = NetCode; netTable[i].m_NetCode = netCode;
else else
PropageNetCode( Point[i].m_NetCode, NetCode, 0 ); PropageNetCode( netTable[i].m_NetCode, netCode, 0 );
} }
break; break;
@ -893,15 +967,16 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
} }
} }
} }
else /* Objets type BUS et BUSLABELS ( et JONCTIONS )*/ else /* Objets type BUS et BUSLABELS ( et JONCTIONS )*/
{ {
NetCode = Ref->m_BusNetCode; netCode = Ref->m_BusNetCode;
for( i = start; i < g_NbrObjNet; i++ ) for( i = start; i<g_NbrObjNet; i++ )
{ {
if( Point[i].m_SheetNumber > Ref->m_SheetNumber ) if( netTable[i].m_SheetNumber > Ref->m_SheetNumber )
break; break;
switch( Point[i].m_Type ) switch( netTable[i].m_Type )
{ {
case NET_SEGMENT: case NET_SEGMENT:
case NET_PIN: case NET_PIN:
@ -917,18 +992,15 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
case NET_SHEETBUSLABELMEMBER: case NET_SHEETBUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER: case NET_GLOBBUSLABELMEMBER:
case NET_JONCTION: case NET_JONCTION:
if( ( ( (Ref->m_Start.x == Point[i].m_Start.x) && if( Ref->m_Start == netTable[i].m_Start
(Ref->m_Start.y == Point[i].m_Start.y) ) ) || Ref->m_Start == netTable[i].m_End
|| ( ( (Ref->m_Start.x == Point[i].m_End.x) && || Ref->m_End == netTable[i].m_Start
(Ref->m_Start.y == Point[i].m_End.y) ) ) || Ref->m_End == netTable[i].m_End )
|| ( ( (Ref->m_End.x == Point[i].m_Start.x) &&
(Ref->m_End.y == Point[i].m_Start.y) ) )
|| ( ( (Ref->m_End.x == Point[i].m_End.x) && (Ref->m_End.y == Point[i].m_End.y) ) ) )
{ {
if( Point[i].m_BusNetCode == 0 ) if( netTable[i].m_BusNetCode == 0 )
Point[i].m_BusNetCode = NetCode; netTable[i].m_BusNetCode = netCode;
else else
PropageNetCode( Point[i].m_BusNetCode, NetCode, 1 ); PropageNetCode( netTable[i].m_BusNetCode, netCode, 1 );
} }
break; break;
} }
@ -998,46 +1070,42 @@ static void SegmentToPointConnect( ObjetNetListStruct* Jonction,
/***************************************************************** /*****************************************************************
* Routine qui connecte les groupes d'objets si labels identiques * * Function which connects the groups of object which have the same label
*******************************************************************/ *******************************************************************/
static void LabelConnection( ObjetNetListStruct* LabelRef ) static void LabelConnection( ObjetNetListStruct* LabelRef )
{ {
int i, NetCode;
ObjetNetListStruct* ObjetNet;
if( LabelRef->m_NetCode == 0 ) if( LabelRef->m_NetCode == 0 )
return; return;
ObjetNet = g_TabObjNet; ObjetNetListStruct* netTable = g_TabObjNet;
for( i = 0; i < g_NbrObjNet; i++ ) for( int i=0; i<g_NbrObjNet; i++ )
{ {
NetCode = ObjetNet[i].m_NetCode; if( netTable[i].m_NetCode == LabelRef->m_NetCode )
if( NetCode == LabelRef->m_NetCode )
continue; continue;
if( ObjetNet[i].m_SheetNumber != LabelRef->m_SheetNumber ) if( netTable[i].m_SheetNumber != LabelRef->m_SheetNumber )
{ {
if( ObjetNet[i].m_Type != NET_PINLABEL ) if( netTable[i].m_Type != NET_PINLABEL )
continue; continue;
} }
if( (ObjetNet[i].m_Type == NET_LABEL ) if( netTable[i].m_Type == NET_LABEL
|| (ObjetNet[i].m_Type == NET_GLOBLABEL ) || netTable[i].m_Type == NET_GLOBLABEL
|| (ObjetNet[i].m_Type == NET_BUSLABELMEMBER ) || netTable[i].m_Type == NET_BUSLABELMEMBER
|| (ObjetNet[i].m_Type == NET_GLOBBUSLABELMEMBER ) || netTable[i].m_Type == NET_GLOBBUSLABELMEMBER
|| (ObjetNet[i].m_Type == NET_PINLABEL ) ) || netTable[i].m_Type == NET_PINLABEL )
{ {
if( ObjetNet[i].m_Label->CmpNoCase( *LabelRef->m_Label ) != 0 ) if( netTable[i].m_Label->CmpNoCase( *LabelRef->m_Label ) != 0 )
continue; continue;
/* Ici 2 labels identiques */ /* Ici 2 labels identiques */
/* Propagation du Netcode a tous les Objets de meme NetCode */ /* Propagation du Netcode a tous les Objets de meme NetCode */
if( ObjetNet[i].m_NetCode ) if( netTable[i].m_NetCode )
PropageNetCode( ObjetNet[i].m_NetCode, LabelRef->m_NetCode, 0 ); PropageNetCode( netTable[i].m_NetCode, LabelRef->m_NetCode, 0 );
else else
ObjetNet[i].m_NetCode = LabelRef->m_NetCode; netTable[i].m_NetCode = LabelRef->m_NetCode;
} }
} }
} }

View File

@ -36,7 +36,7 @@ typedef enum {
/* Max pin number per component and footprint */ /* Max pin number per component and footprint */
#define MAXPIN 5000 #define MAXPIN 5000
typedef enum { /* Type des objets de Net */ enum NetObjetType { /* Type des objets de Net */
NET_SEGMENT, NET_SEGMENT,
NET_BUS, NET_BUS,
NET_JONCTION, NET_JONCTION,
@ -49,20 +49,21 @@ typedef enum { /* Type des objets de Net */
NET_PINLABEL, NET_PINLABEL,
NET_PIN, NET_PIN,
NET_NOCONNECT NET_NOCONNECT
} NetObjetType; };
typedef enum { /* Valeur du Flag de connection */
enum IsConnectType { /* Valeur du Flag de connection */
UNCONNECT, /* Pin ou Label non connecte */ UNCONNECT, /* Pin ou Label non connecte */
NOCONNECT, /* Pin volontairement non connectee (Symb. NoConnect utilise) */ NOCONNECT, /* Pin volontairement non connectee (Symb. NoConnect utilise) */
CONNECT /* connexion normale */ CONNECT /* connexion normale */
} IsConnectType; };
/* Structure decrivant 1 element de connexion (pour netlist ) */ /* Structure decrivant 1 element de connexion (pour netlist ) */
class ObjetNetListStruct class ObjetNetListStruct
{ {
public: public:
void* m_Comp; /* Pointeur sur la definition de l'objet */ EDA_BaseStruct* m_Comp; /* Pointeur sur la definition de l'objet */
void* m_Link; /* Pour SheetLabelStruct: Pointeur sur la feuille de hierarchie void* m_Link; /* Pour SheetLabelStruct: Pointeur sur la feuille de hierarchie
* Pour les Pins: pointeur sur le composant */ * Pour les Pins: pointeur sur le composant */
int m_Flag; /* flag pour calculs internes */ int m_Flag; /* flag pour calculs internes */
@ -79,6 +80,11 @@ public:
long m_PinNum; /* numero de pin( 4 octets -> 4 codes ascii) */ long m_PinNum; /* numero de pin( 4 octets -> 4 codes ascii) */
const wxString* m_Label; /* Tous types Labels:pointeur sur la wxString definissant le label */ const wxString* m_Label; /* Tous types Labels:pointeur sur la wxString definissant le label */
wxPoint m_Start, m_End; wxPoint m_Start, m_End;
#if defined(DEBUG)
void Show( std::ostream& out, int ndx );
#endif
}; };