|
|
|
@ -2,135 +2,207 @@ |
|
|
|
/* annotate.cpp: component annotation */ |
|
|
|
/**************************************/ |
|
|
|
|
|
|
|
/* Local Variable */ |
|
|
|
static bool AnnotProject = true; |
|
|
|
static bool SortByPosition = true; |
|
|
|
|
|
|
|
#include "annotate_dialog.cpp"
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "program.h"
|
|
|
|
#include "libcmp.h"
|
|
|
|
#include "netlist.h"
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
/* Local Functions*/ |
|
|
|
static int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetList* sheet ); |
|
|
|
static int AnnotTriComposant( const void* o1, const void* o2 ); |
|
|
|
static void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp ); |
|
|
|
static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp ); |
|
|
|
static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ); |
|
|
|
static int GetLastReferenceNumber( CmpListStruct* Objet, CmpListStruct* BaseListeCmp, |
|
|
|
int NbOfCmp ); |
|
|
|
int GetLastReferenceNumber( CmpListStruct* Objet, |
|
|
|
CmpListStruct* BaseListeCmp, |
|
|
|
int NbOfCmp ); |
|
|
|
static int ExistUnit( CmpListStruct* Objet, int Unit, |
|
|
|
CmpListStruct* BaseListeCmp, int NbOfCmp ); |
|
|
|
|
|
|
|
|
|
|
|
/**************************************/ |
|
|
|
void ReAnnotatePowerSymbolsOnly( void ) |
|
|
|
/**************************************/ |
|
|
|
|
|
|
|
/* Used to reannotate the power symbols, before testing erc or computing netlist
|
|
|
|
* when a true component reannotation is not necessary |
|
|
|
/*****************************************************************************
|
|
|
|
* Used to annotate the power symbols, before testing erc or computing |
|
|
|
* netlist when a component reannotation is not necessary |
|
|
|
* |
|
|
|
* In order to avoid conflicts the ref number starts with a 0: |
|
|
|
* PWR with id 12 is named PWR12 in global annotation and PWR012 by the Power annotation |
|
|
|
*/ |
|
|
|
* In order to avoid conflicts the reference number starts with a 0. A |
|
|
|
* PWR with id 12 is named PWR12 in global annotation and PWR012 by the |
|
|
|
* Power annotation. |
|
|
|
****************************************************************************/ |
|
|
|
void ReAnnotatePowerSymbolsOnly( void ) |
|
|
|
{ |
|
|
|
/* Build the screen list (screen, not sheet) */ |
|
|
|
EDA_SheetList SheetList( NULL ); |
|
|
|
|
|
|
|
/* Update the screen number, sheet count and date */ |
|
|
|
|
|
|
|
//ScreenList.UpdateScreenNumberAndDate();
|
|
|
|
|
|
|
|
DrawSheetList* sheet; |
|
|
|
int CmpNumber = 1; |
|
|
|
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext()) |
|
|
|
int CmpNumber = 1; |
|
|
|
|
|
|
|
for( sheet = SheetList.GetFirst(); |
|
|
|
sheet != NULL; |
|
|
|
sheet = SheetList.GetNext() ) |
|
|
|
{ |
|
|
|
EDA_BaseStruct* DrawList = sheet->LastDrawList(); |
|
|
|
for( ; DrawList != NULL; DrawList = DrawList->Pnext ) |
|
|
|
{ |
|
|
|
if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) |
|
|
|
continue; |
|
|
|
EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*) DrawList; |
|
|
|
EDA_SchComponentStruct* DrawLibItem = |
|
|
|
(EDA_SchComponentStruct*) DrawList; |
|
|
|
EDA_LibComponentStruct* Entry = |
|
|
|
FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); |
|
|
|
FindLibPart( |
|
|
|
DrawLibItem->m_ChipName.GetData(), wxEmptyString, |
|
|
|
FIND_ROOT ); |
|
|
|
if( (Entry == NULL) || (Entry->m_Options != ENTRY_POWER) ) |
|
|
|
continue; |
|
|
|
|
|
|
|
//DrawLibItem->ClearAnnotation(sheet); this clears all annotation :(
|
|
|
|
wxString refstr = DrawLibItem->m_PrefixString; |
|
|
|
//str will be "C?" or so after the ClearAnnotation call.
|
|
|
|
while(refstr.Last() == '?') |
|
|
|
refstr.RemoveLast(); |
|
|
|
if(!refstr.StartsWith(wxT("#"))) |
|
|
|
refstr = wxT("#") + refstr; |
|
|
|
refstr << wxT( "0" ) << CmpNumber; |
|
|
|
DrawLibItem->SetRef(sheet, refstr); |
|
|
|
wxString refstr = DrawLibItem->m_PrefixString; |
|
|
|
|
|
|
|
//str will be "C?" or so after the ClearAnnotation call.
|
|
|
|
while( refstr.Last() == '?' ) |
|
|
|
refstr.RemoveLast(); |
|
|
|
|
|
|
|
if( !refstr.StartsWith( wxT( "#" ) ) ) |
|
|
|
refstr = wxT( "#" ) + refstr; |
|
|
|
refstr << wxT( "0" ) << CmpNumber; |
|
|
|
DrawLibItem->SetRef( sheet, refstr ); |
|
|
|
CmpNumber++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
/***********************************************************************/ |
|
|
|
CmpListStruct* AllocateCmpListStrct(int numcomponents ) |
|
|
|
/***********************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
CmpListStruct* AllocateCmpListStrct( int numcomponents ) |
|
|
|
{ |
|
|
|
int ii = numcomponents * sizeof(CmpListStruct); |
|
|
|
CmpListStruct* list = (CmpListStruct*) MyZMalloc( ii ); |
|
|
|
|
|
|
|
//fill this memory with zeros.
|
|
|
|
char* cptr = (char*) list; |
|
|
|
|
|
|
|
for( int i = 0; i<ii; i++ ) |
|
|
|
*cptr++ = 0; |
|
|
|
|
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* qsort function to annotate items by their position. */ |
|
|
|
int AnnotateByPosition( const void* o1, const void* o2 ) |
|
|
|
{ |
|
|
|
int ii = numcomponents * sizeof(CmpListStruct); |
|
|
|
CmpListStruct* list = (CmpListStruct*) MyZMalloc( ii ); |
|
|
|
//fill this memory with zeros.
|
|
|
|
char* cptr = (char*)list; |
|
|
|
for(int i=0; i<ii; i++) |
|
|
|
*cptr++ = 0; |
|
|
|
return list; |
|
|
|
CmpListStruct* item1 = (CmpListStruct*) o1; |
|
|
|
CmpListStruct* item2 = (CmpListStruct*) o2; |
|
|
|
|
|
|
|
int ii = strnicmp( item1->m_TextRef, item2->m_TextRef, 32 ); |
|
|
|
|
|
|
|
if( ii == 0 ) |
|
|
|
ii = item1->m_SheetList.Cmp( item2->m_SheetList ); |
|
|
|
if( ii == 0 ) |
|
|
|
ii = item1->m_Pos.x - item2->m_Pos.x; |
|
|
|
if( ii == 0 ) |
|
|
|
ii = item1->m_Pos.y - item2->m_Pos.y; |
|
|
|
if( ii == 0 ) |
|
|
|
ii = item1->m_TimeStamp - item2->m_TimeStamp; |
|
|
|
|
|
|
|
return ii; |
|
|
|
} |
|
|
|
|
|
|
|
/***********************************************************************/ |
|
|
|
void InstallAnnotateFrame( WinEDA_SchematicFrame* parent, wxPoint& pos ) |
|
|
|
/***********************************************************************/ |
|
|
|
|
|
|
|
/** Function InstallAnnotateFrame
|
|
|
|
* Install the annotate dialog frame |
|
|
|
*/ |
|
|
|
/*****************************************************************************
|
|
|
|
* qsort function to annotate items by value |
|
|
|
* Components are sorted |
|
|
|
* by reference |
|
|
|
* if same reference: by value |
|
|
|
* if same value: by unit number |
|
|
|
* if same unit number, by sheet |
|
|
|
* if same sheet, by time stamp |
|
|
|
*****************************************************************************/ |
|
|
|
int AnnotateByValue( const void* o1, const void* o2 ) |
|
|
|
{ |
|
|
|
WinEDA_AnnotateFrame* frame = new WinEDA_AnnotateFrame( parent ); |
|
|
|
CmpListStruct* item1 = (CmpListStruct*) o1; |
|
|
|
CmpListStruct* item2 = (CmpListStruct*) o2; |
|
|
|
|
|
|
|
frame->ShowModal(); |
|
|
|
frame->Destroy(); |
|
|
|
int ii = strnicmp( item1->m_TextRef, item2->m_TextRef, 32 ); |
|
|
|
|
|
|
|
if( ii == 0 ) |
|
|
|
ii = strnicmp( item1->m_TextValue, item2->m_TextValue, 32 ); |
|
|
|
if( ii == 0 ) |
|
|
|
ii = item1->m_Unit - item2->m_Unit; |
|
|
|
if( ii == 0 ) |
|
|
|
ii = item1->m_SheetList.Cmp( item2->m_SheetList ); |
|
|
|
if( ii == 0 ) |
|
|
|
ii = item1->m_Pos.x - item2->m_Pos.x; |
|
|
|
if( ii == 0 ) |
|
|
|
ii = item1->m_Pos.y - item2->m_Pos.y; |
|
|
|
if( ii == 0 ) |
|
|
|
ii = item1->m_TimeStamp - item2->m_TimeStamp; |
|
|
|
|
|
|
|
return ii; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************/ |
|
|
|
void WinEDA_AnnotateFrame::AnnotateComponents( wxCommandEvent& event ) |
|
|
|
/******************************************************************/ |
|
|
|
/*****************************************************************************
|
|
|
|
* DeleteAnnotation: |
|
|
|
* |
|
|
|
* Clear the current annotation. |
|
|
|
****************************************************************************/ |
|
|
|
void DeleteAnnotation( WinEDA_SchematicFrame* parent, bool annotateSchematic ) |
|
|
|
{ |
|
|
|
DrawSheetStruct* sheet; |
|
|
|
|
|
|
|
if( annotateSchematic ) |
|
|
|
sheet = g_RootSheet; |
|
|
|
else |
|
|
|
sheet = parent->GetSheet()->Last(); |
|
|
|
|
|
|
|
sheet->DeleteAnnotation( annotateSchematic ); |
|
|
|
|
|
|
|
g_RootSheet->m_s->SetModify(); |
|
|
|
parent->DrawPanel->Refresh( true ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** Function WinEDA_AnnotateFrame::AnnotateComponents
|
|
|
|
* Compute the annotation of the components for the whole project, or the current sheet only. |
|
|
|
* All the components or the new ones only will be annotated. |
|
|
|
*/ |
|
|
|
/*****************************************************************************
|
|
|
|
* AnnotateComponents: |
|
|
|
* |
|
|
|
* Compute the annotation of the components for the whole project, or the |
|
|
|
* current sheet only. All the components or the new ones only will be |
|
|
|
* annotated. |
|
|
|
*****************************************************************************/ |
|
|
|
void AnnotateComponents( WinEDA_SchematicFrame* parent, |
|
|
|
bool annotateSchematic, |
|
|
|
bool sortByPosition, |
|
|
|
bool resetAnnotation ) |
|
|
|
{ |
|
|
|
int ii, NbOfCmp; |
|
|
|
DrawSheetList* sheet; |
|
|
|
DrawSheetList* sheet; |
|
|
|
CmpListStruct* BaseListeCmp; |
|
|
|
|
|
|
|
wxBusyCursor dummy; |
|
|
|
|
|
|
|
AnnotProject = (m_AnnotProjetCtrl->GetSelection() == 0) ? true : FALSE; |
|
|
|
SortByPosition = (m_AnnotSortCmpCtrl->GetSelection() == 0) ? true : FALSE; |
|
|
|
|
|
|
|
/* If it is an annotation for all the components, reset previous annotation: */ |
|
|
|
if( m_AnnotNewCmpCtrl->GetSelection() == 0 ) |
|
|
|
DeleteAnnotation( event ); |
|
|
|
if( m_Abort ) |
|
|
|
return; |
|
|
|
|
|
|
|
/* If it is an annotation for all the components, reset previous
|
|
|
|
annotation: */ |
|
|
|
if( resetAnnotation ) |
|
|
|
DeleteAnnotation( parent, annotateSchematic ); |
|
|
|
|
|
|
|
/* Build the sheet list */ |
|
|
|
EDA_SheetList SheetList( g_RootSheet ); |
|
|
|
EDA_SheetList SheetList( g_RootSheet ); |
|
|
|
|
|
|
|
/* Update the sheet number */ |
|
|
|
ii = 0; |
|
|
|
ii = 0; |
|
|
|
|
|
|
|
/* First pass: Component counting */ |
|
|
|
sheet = m_Parent->GetSheet(); |
|
|
|
if( AnnotProject == true ){ |
|
|
|
sheet = parent->GetSheet(); |
|
|
|
if( annotateSchematic ) |
|
|
|
{ |
|
|
|
NbOfCmp = 0; |
|
|
|
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() ) |
|
|
|
for( sheet = SheetList.GetFirst(); |
|
|
|
sheet != NULL; |
|
|
|
sheet = SheetList.GetNext() ) |
|
|
|
NbOfCmp += ListeComposants( NULL, sheet ); |
|
|
|
} |
|
|
|
else |
|
|
|
@ -139,95 +211,52 @@ void WinEDA_AnnotateFrame::AnnotateComponents( wxCommandEvent& event ) |
|
|
|
if( NbOfCmp == 0 ) |
|
|
|
return; |
|
|
|
|
|
|
|
BaseListeCmp = AllocateCmpListStrct(NbOfCmp); |
|
|
|
BaseListeCmp = AllocateCmpListStrct( NbOfCmp ); |
|
|
|
|
|
|
|
/* Second pass : Int data tables */ |
|
|
|
if( AnnotProject == true ) |
|
|
|
{ |
|
|
|
if( annotateSchematic ) |
|
|
|
{ |
|
|
|
ii = 0; |
|
|
|
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() ) |
|
|
|
ii += ListeComposants( BaseListeCmp + ii, sheet); |
|
|
|
for( sheet = SheetList.GetFirst(); |
|
|
|
sheet != NULL; |
|
|
|
sheet = SheetList.GetNext() ) |
|
|
|
ii += ListeComposants( BaseListeCmp + ii, sheet ); |
|
|
|
} |
|
|
|
else |
|
|
|
ii = ListeComposants( BaseListeCmp, sheet); |
|
|
|
ii = ListeComposants( BaseListeCmp, sheet ); |
|
|
|
|
|
|
|
if( ii != NbOfCmp ) |
|
|
|
DisplayError( this, wxT( "Internal error in AnnotateComponents()" ) ); |
|
|
|
DisplayError( parent, wxT( "Internal error in AnnotateComponents()" ) ); |
|
|
|
|
|
|
|
/* Break full components reference in name (prefix) and number: example: IC1 become IC, and 1 */ |
|
|
|
/* Break full components reference in name (prefix) and number:
|
|
|
|
example: IC1 become IC, and 1 */ |
|
|
|
BreakReference( BaseListeCmp, NbOfCmp ); |
|
|
|
|
|
|
|
qsort( BaseListeCmp, NbOfCmp, sizeof(CmpListStruct), |
|
|
|
( int( * ) ( const void*, const void* ) )AnnotTriComposant ); |
|
|
|
if ( sortByPosition ) |
|
|
|
qsort( BaseListeCmp, NbOfCmp, sizeof(CmpListStruct), |
|
|
|
( int( * ) ( const void*, const void* ) )AnnotateByValue ); |
|
|
|
else |
|
|
|
qsort( BaseListeCmp, NbOfCmp, sizeof(CmpListStruct), |
|
|
|
( int( * ) ( const void*, const void* ) )AnnotateByPosition ); |
|
|
|
|
|
|
|
/* Recalculate reference numbers */ |
|
|
|
ComputeReferenceNumber( BaseListeCmp, NbOfCmp ); |
|
|
|
ReAnnotateComponents( BaseListeCmp, NbOfCmp ); |
|
|
|
|
|
|
|
MyFree( BaseListeCmp ); BaseListeCmp = NULL; |
|
|
|
MyFree( BaseListeCmp ); |
|
|
|
BaseListeCmp = NULL; |
|
|
|
|
|
|
|
/* Final control */ |
|
|
|
CheckAnnotate( m_Parent, AnnotProject ? FALSE : true ); |
|
|
|
|
|
|
|
m_Parent->DrawPanel->Refresh( true ); /* Refresh screen */ |
|
|
|
EndModal( 1 ); |
|
|
|
CheckAnnotate( parent, !annotateSchematic ); |
|
|
|
parent->DrawPanel->Refresh( true ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/********************************************************************/ |
|
|
|
void WinEDA_AnnotateFrame::DeleteAnnotation( wxCommandEvent& event ) |
|
|
|
/********************************************************************/ |
|
|
|
|
|
|
|
/* Clear the current annotation for the whole project or only for the current sheet
|
|
|
|
* Update sheet number and number of sheets |
|
|
|
*/ |
|
|
|
{ |
|
|
|
DrawSheetStruct* sheet; |
|
|
|
//EDA_SchComponentStruct* DrawLibItem;
|
|
|
|
|
|
|
|
if( !IsOK( this, _( "Previous Annotation will be deleted. Continue ?" ) ) ){ |
|
|
|
m_Abort = true; |
|
|
|
return; |
|
|
|
} |
|
|
|
AnnotProject = (m_AnnotProjetCtrl->GetSelection() == 0) ? true : FALSE; |
|
|
|
m_Abort = FALSE; |
|
|
|
|
|
|
|
if( AnnotProject == true ) |
|
|
|
sheet = g_RootSheet; |
|
|
|
else |
|
|
|
sheet = m_Parent->GetSheet()->Last(); |
|
|
|
|
|
|
|
sheet->DeleteAnnotation( AnnotProject ); |
|
|
|
/*
|
|
|
|
for( ; screen != NULL; screen = ScreenList.GetNext() ) |
|
|
|
{ |
|
|
|
EDA_BaseStruct* DrawList = screen->EEDrawList; |
|
|
|
for( ; DrawList != NULL; DrawList = DrawList->Pnext ) |
|
|
|
{ |
|
|
|
if( DrawList->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) |
|
|
|
{ |
|
|
|
DrawLibItem = (EDA_SchComponentStruct*) DrawList; |
|
|
|
DrawLibItem->ClearAnnotation(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if( !AnnotProject ) |
|
|
|
break; |
|
|
|
} |
|
|
|
*/ |
|
|
|
g_RootSheet->m_s->SetModify(); |
|
|
|
m_Parent->DrawPanel->Refresh( true ); |
|
|
|
//EndModal( 0 );
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************************/ |
|
|
|
int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetList* sheet) |
|
|
|
/***********************************************************************************/ |
|
|
|
|
|
|
|
/* if BaseListeCmp == NULL : count components
|
|
|
|
/*****************************************************************************
|
|
|
|
* if BaseListeCmp == NULL : count components |
|
|
|
* else update data table BaseListeCmp |
|
|
|
*/ |
|
|
|
*****************************************************************************/ |
|
|
|
int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetList* sheet ) |
|
|
|
{ |
|
|
|
int NbrCmp = 0; |
|
|
|
EDA_BaseStruct* DrawList = sheet->LastDrawList(); |
|
|
|
@ -236,42 +265,35 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetList* sheet) |
|
|
|
|
|
|
|
for( ; DrawList; DrawList = DrawList->Pnext ) |
|
|
|
{ |
|
|
|
switch( DrawList->Type() ) |
|
|
|
if( DrawList->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) |
|
|
|
{ |
|
|
|
case DRAW_SEGMENT_STRUCT_TYPE: |
|
|
|
case DRAW_JUNCTION_STRUCT_TYPE: |
|
|
|
case DRAW_TEXT_STRUCT_TYPE: |
|
|
|
case DRAW_LABEL_STRUCT_TYPE: |
|
|
|
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: |
|
|
|
case DRAW_HIER_LABEL_STRUCT_TYPE: |
|
|
|
break; |
|
|
|
|
|
|
|
case DRAW_LIB_ITEM_STRUCT_TYPE: |
|
|
|
DrawLibItem = (EDA_SchComponentStruct*) DrawList; |
|
|
|
Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); |
|
|
|
Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), |
|
|
|
wxEmptyString, |
|
|
|
FIND_ROOT ); |
|
|
|
if( Entry == NULL ) |
|
|
|
break; |
|
|
|
continue; |
|
|
|
|
|
|
|
if( BaseListeCmp == NULL ) /* Items counting only */ |
|
|
|
{ |
|
|
|
NbrCmp++; |
|
|
|
break; |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
BaseListeCmp[NbrCmp].m_Cmp = DrawLibItem; |
|
|
|
BaseListeCmp[NbrCmp].m_NbParts = Entry->m_UnitCount; |
|
|
|
BaseListeCmp[NbrCmp].m_Unit = DrawLibItem->m_Multi; |
|
|
|
BaseListeCmp[NbrCmp].m_PartsLocked = Entry->m_UnitSelectionLocked; |
|
|
|
BaseListeCmp[NbrCmp].m_SheetList = *sheet; |
|
|
|
BaseListeCmp[NbrCmp].m_SheetList = *sheet; |
|
|
|
BaseListeCmp[NbrCmp].m_IsNew = FALSE; |
|
|
|
BaseListeCmp[NbrCmp].m_Pos = DrawLibItem->m_Pos; |
|
|
|
BaseListeCmp[NbrCmp].m_TimeStamp = DrawLibItem->m_TimeStamp; |
|
|
|
|
|
|
|
if( DrawLibItem->GetRef(sheet).IsEmpty() ) |
|
|
|
DrawLibItem->SetRef( sheet, wxT( "DefRef?" ) ); |
|
|
|
if( DrawLibItem->GetRef( sheet ).IsEmpty() ) |
|
|
|
DrawLibItem->SetRef( sheet, wxT( "DefRef?" ) ); |
|
|
|
|
|
|
|
strncpy( BaseListeCmp[NbrCmp].m_TextRef, |
|
|
|
CONV_TO_UTF8(DrawLibItem->GetRef(sheet)), 32 ); |
|
|
|
CONV_TO_UTF8( DrawLibItem->GetRef( sheet ) ), 32 ); |
|
|
|
|
|
|
|
BaseListeCmp[NbrCmp].m_NumRef = -1; |
|
|
|
|
|
|
|
@ -281,19 +303,6 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetList* sheet) |
|
|
|
strncpy( BaseListeCmp[NbrCmp].m_TextValue, |
|
|
|
CONV_TO_UTF8( DrawLibItem->m_Field[VALUE].m_Text ), 32 ); |
|
|
|
NbrCmp++; |
|
|
|
break; |
|
|
|
|
|
|
|
case DRAW_PICK_ITEM_STRUCT_TYPE: |
|
|
|
case DRAW_POLYLINE_STRUCT_TYPE: |
|
|
|
case DRAW_BUSENTRY_STRUCT_TYPE: |
|
|
|
case DRAW_SHEET_STRUCT_TYPE: |
|
|
|
case DRAW_SHEETLABEL_STRUCT_TYPE: |
|
|
|
case DRAW_MARKER_STRUCT_TYPE: |
|
|
|
case DRAW_NOCONNECT_STRUCT_TYPE: |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -301,60 +310,11 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetList* sheet) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************/ |
|
|
|
int AnnotTriComposant( const void* o1, const void* o2 ) |
|
|
|
/****************************************************************/ |
|
|
|
|
|
|
|
/* function used par qsort() for sorting the list
|
|
|
|
* Composants are sorted |
|
|
|
* by reference |
|
|
|
* if same reference: by value |
|
|
|
* if same value: by unit number |
|
|
|
* if same unit number, by sheet |
|
|
|
* if same sheet, by time stamp |
|
|
|
**/ |
|
|
|
{ |
|
|
|
CmpListStruct* Objet1 = (CmpListStruct*) o1; |
|
|
|
CmpListStruct* Objet2 = (CmpListStruct*) o2; |
|
|
|
|
|
|
|
int ii = strnicmp( Objet1->m_TextRef, Objet2->m_TextRef, 32 ); |
|
|
|
|
|
|
|
if( SortByPosition == true ) |
|
|
|
{ |
|
|
|
if( ii == 0 ) |
|
|
|
ii = Objet1->m_SheetList.Cmp(Objet2->m_SheetList); |
|
|
|
if( ii == 0 ) |
|
|
|
ii = Objet1->m_Pos.x - Objet2->m_Pos.x; |
|
|
|
if( ii == 0 ) |
|
|
|
ii = Objet1->m_Pos.y - Objet2->m_Pos.y; |
|
|
|
} |
|
|
|
else // Sort by value
|
|
|
|
{ |
|
|
|
if( ii == 0 ) |
|
|
|
ii = strnicmp( Objet1->m_TextValue, Objet2->m_TextValue, 32 ); |
|
|
|
if( ii == 0 ) |
|
|
|
ii = Objet1->m_Unit - Objet2->m_Unit; |
|
|
|
if( ii == 0 ) |
|
|
|
ii = Objet1->m_SheetList.Cmp(Objet2->m_SheetList); |
|
|
|
if( ii == 0 ) |
|
|
|
ii = Objet1->m_Pos.x - Objet2->m_Pos.x; |
|
|
|
if( ii == 0 ) |
|
|
|
ii = Objet1->m_Pos.y - Objet2->m_Pos.y; |
|
|
|
} |
|
|
|
|
|
|
|
if( ii == 0 ) |
|
|
|
ii = Objet1->m_TimeStamp - Objet2->m_TimeStamp; |
|
|
|
|
|
|
|
return ii; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/********************************************************************/ |
|
|
|
/*****************************************************************************
|
|
|
|
* Update the reference component for the schematic project (or the current |
|
|
|
* sheet) |
|
|
|
*****************************************************************************/ |
|
|
|
static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp ) |
|
|
|
/********************************************************************/ |
|
|
|
|
|
|
|
/* Update the reference component for the schematic project (or the current sheet)
|
|
|
|
*/ |
|
|
|
{ |
|
|
|
int ii; |
|
|
|
char* Text; |
|
|
|
@ -371,22 +331,23 @@ static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp ) |
|
|
|
else |
|
|
|
sprintf( Text + strlen( Text ), "%d", BaseListeCmp[ii].m_NumRef ); |
|
|
|
|
|
|
|
DrawLibItem->SetRef(&(BaseListeCmp[ii].m_SheetList), CONV_FROM_UTF8( Text ) ); |
|
|
|
DrawLibItem->SetRef( &(BaseListeCmp[ii].m_SheetList), |
|
|
|
CONV_FROM_UTF8( Text ) ); |
|
|
|
DrawLibItem->m_Multi = BaseListeCmp[ii].m_Unit; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************/ |
|
|
|
/*****************************************************************************
|
|
|
|
* Split component reference designators into a name (prefix) and number. |
|
|
|
* Example: IC1 becomes IC and 1 in the .m_NumRef member. |
|
|
|
* For multi part per package components not already annotated, set .m_Unit |
|
|
|
* to a max value (0x7FFFFFFF). |
|
|
|
* |
|
|
|
* @param BaseListeCmp = list of component |
|
|
|
* @param NbOfCmp = item count in the list |
|
|
|
*****************************************************************************/ |
|
|
|
void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp ) |
|
|
|
/**************************************************************/ |
|
|
|
|
|
|
|
/** BreakReference
|
|
|
|
* Break full components reference in name (prefix) and number: example: IC1 become IC, and 1 in .m_NumRef |
|
|
|
* For multi part per package components not already annotated, set .m_Unit to a max value (0x7FFFFFFF) |
|
|
|
* @param BaseListeCmp = list of component |
|
|
|
* @param NbOfCmp = item count in the list |
|
|
|
*/ |
|
|
|
{ |
|
|
|
int ii, ll; |
|
|
|
char* Text; |
|
|
|
@ -425,26 +386,26 @@ void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp ) |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
/*printf("BreakReference(): %s number found: %d\n",
|
|
|
|
BaseListeCmp[ii].m_TextRef, |
|
|
|
BaseListeCmp[ii].m_NumRef); */ |
|
|
|
|
|
|
|
wxLogDebug( wxT("BreakReference(): %s number found: %d\n" ), |
|
|
|
BaseListeCmp[ii].m_TextRef, |
|
|
|
BaseListeCmp[ii].m_NumRef ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/ |
|
|
|
/*****************************************************************************
|
|
|
|
* Compute the reference number for components without reference number |
|
|
|
* Compute .m_NumRef member |
|
|
|
*****************************************************************************/ |
|
|
|
static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ) |
|
|
|
/*****************************************************************************/ |
|
|
|
|
|
|
|
/* Compute the reference number for components without reference number
|
|
|
|
* Compute .m_NumRef member |
|
|
|
*/ |
|
|
|
{ |
|
|
|
int ii, jj, LastReferenceNumber, NumberOfUnits, Unit; |
|
|
|
const char* Text, * RefText, * ValText; |
|
|
|
CmpListStruct* ObjRef, * ObjToTest; |
|
|
|
|
|
|
|
/* Components with an invisible reference (power...) always are re-annotated */ |
|
|
|
/* Components with an invisible reference (power...) always are
|
|
|
|
* re-annotated */ |
|
|
|
for( ii = 0; ii < NbOfCmp; ii++ ) |
|
|
|
{ |
|
|
|
Text = BaseListeCmp[ii].m_TextRef; |
|
|
|
@ -466,7 +427,9 @@ static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ) |
|
|
|
if( strnicmp( RefText, Text, 32 ) != 0 ) /* Nouveau Identificateur */ |
|
|
|
{ |
|
|
|
RefText = BaseListeCmp[ii].m_TextRef; |
|
|
|
LastReferenceNumber = GetLastReferenceNumber( BaseListeCmp + ii, BaseListeCmp, NbOfCmp ); |
|
|
|
LastReferenceNumber = GetLastReferenceNumber( BaseListeCmp + ii, |
|
|
|
BaseListeCmp, |
|
|
|
NbOfCmp ); |
|
|
|
} |
|
|
|
|
|
|
|
/* Annotation of one part per package components (trivial case)*/ |
|
|
|
@ -483,13 +446,16 @@ static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ) |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
/* Annotation of multi-part components ( n parts per package ) (complex case) */ |
|
|
|
/* Annotation of multi-part components ( n parts per package )
|
|
|
|
(complex case) */ |
|
|
|
ValText = BaseListeCmp[ii].m_TextValue; |
|
|
|
NumberOfUnits = BaseListeCmp[ii].m_NbParts; |
|
|
|
|
|
|
|
if( BaseListeCmp[ii].m_IsNew ) |
|
|
|
{ |
|
|
|
LastReferenceNumber++; BaseListeCmp[ii].m_NumRef = LastReferenceNumber; |
|
|
|
LastReferenceNumber++; |
|
|
|
BaseListeCmp[ii].m_NumRef = LastReferenceNumber; |
|
|
|
|
|
|
|
if( !BaseListeCmp[ii].m_PartsLocked ) |
|
|
|
BaseListeCmp[ii].m_Unit = 1; |
|
|
|
BaseListeCmp[ii].m_Flag = 1; |
|
|
|
@ -519,8 +485,10 @@ static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ) |
|
|
|
{ |
|
|
|
continue; |
|
|
|
} |
|
|
|
/* Component without reference number found, annotate it if possible */ |
|
|
|
if( !BaseListeCmp[jj].m_PartsLocked || (BaseListeCmp[jj].m_Unit == Unit) ) |
|
|
|
/* Component without reference number found, annotate it if
|
|
|
|
possible */ |
|
|
|
if( !BaseListeCmp[jj].m_PartsLocked || |
|
|
|
(BaseListeCmp[jj].m_Unit == Unit) ) |
|
|
|
{ |
|
|
|
BaseListeCmp[jj].m_NumRef = BaseListeCmp[ii].m_NumRef; |
|
|
|
BaseListeCmp[jj].m_Unit = Unit; |
|
|
|
@ -534,18 +502,18 @@ static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
static int GetLastReferenceNumber( CmpListStruct* Objet, CmpListStruct* BaseListeCmp, int NbOfCmp ) |
|
|
|
/*************************************************************************************************/ |
|
|
|
|
|
|
|
/** Function GetLastReferenceNumber
|
|
|
|
* Search the last (bigger) reference number in the component list |
|
|
|
* for the prefix reference given by Objet |
|
|
|
* The component list must be sorted |
|
|
|
/*****************************************************************************
|
|
|
|
* Search the last used (greatest) reference number in the component list |
|
|
|
* for the prefix reference given by Objet |
|
|
|
* The component list must be sorted. |
|
|
|
* |
|
|
|
* @param Objet = reference item ( Objet->m_TextRef is the search pattern) |
|
|
|
* @param BaseListeCmp = list of items |
|
|
|
* @param NbOfCmp = items count in list of items |
|
|
|
*/ |
|
|
|
*****************************************************************************/ |
|
|
|
int GetLastReferenceNumber( CmpListStruct* Objet, |
|
|
|
CmpListStruct* BaseListeCmp, |
|
|
|
int NbOfCmp ) |
|
|
|
{ |
|
|
|
CmpListStruct* LastObjet = BaseListeCmp + NbOfCmp; |
|
|
|
int LastNumber = 0; |
|
|
|
@ -554,7 +522,8 @@ static int GetLastReferenceNumber( CmpListStruct* Objet, CmpListStruct* BaseList |
|
|
|
RefText = Objet->m_TextRef; |
|
|
|
for( ; Objet < LastObjet; Objet++ ) |
|
|
|
{ |
|
|
|
if( strnicmp( RefText, Objet->m_TextRef, 32 ) != 0 ) /* Nouveau Identificateur */ |
|
|
|
/* Nouveau Identificateur */ |
|
|
|
if( strnicmp( RefText, Objet->m_TextRef, 32 ) != 0 ) |
|
|
|
break; |
|
|
|
if( LastNumber < Objet->m_NumRef ) |
|
|
|
LastNumber = Objet->m_NumRef; |
|
|
|
@ -564,17 +533,16 @@ static int GetLastReferenceNumber( CmpListStruct* Objet, CmpListStruct* BaseList |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************/ |
|
|
|
static int ExistUnit( CmpListStruct* Objet, int Unit, |
|
|
|
CmpListStruct* BaseListeCmp, int NbOfCmp ) |
|
|
|
/****************************************************************/ |
|
|
|
|
|
|
|
/* Recherche dans la liste triee des composants, pour les composants
|
|
|
|
/*****************************************************************************
|
|
|
|
* TODO: Translate this to english/ |
|
|
|
* Recherche dans la liste triee des composants, pour les composants |
|
|
|
* multiples s'il existe pour le composant de reference Objet, |
|
|
|
* une unite de numero Unit |
|
|
|
* Retourne index dans BaseListeCmp si oui |
|
|
|
* retourne -1 si non |
|
|
|
*/ |
|
|
|
*****************************************************************************/ |
|
|
|
static int ExistUnit( CmpListStruct* Objet, int Unit, |
|
|
|
CmpListStruct* BaseListeCmp, int NbOfCmp ) |
|
|
|
{ |
|
|
|
CmpListStruct* EndList = BaseListeCmp + NbOfCmp; |
|
|
|
char* RefText, * ValText; |
|
|
|
@ -584,7 +552,9 @@ static int ExistUnit( CmpListStruct* Objet, int Unit, |
|
|
|
RefText = Objet->m_TextRef; |
|
|
|
ValText = Objet->m_TextValue; |
|
|
|
NumRef = Objet->m_NumRef; |
|
|
|
for( ItemToTest = BaseListeCmp, ii = 0; ItemToTest < EndList; ItemToTest++, ii++ ) |
|
|
|
for( ItemToTest = BaseListeCmp, ii = 0; |
|
|
|
ItemToTest < EndList; |
|
|
|
ItemToTest++, ii++ ) |
|
|
|
{ |
|
|
|
if( Objet == ItemToTest ) |
|
|
|
continue; |
|
|
|
@ -592,7 +562,8 @@ static int ExistUnit( CmpListStruct* Objet, int Unit, |
|
|
|
continue; /* non affecte */ |
|
|
|
if( ItemToTest->m_NumRef != NumRef ) |
|
|
|
continue; |
|
|
|
if( strnicmp( RefText, ItemToTest->m_TextRef, 32 ) != 0 ) /* Nouveau Identificateur */ |
|
|
|
/* Nouveau Identificateur */ |
|
|
|
if( strnicmp( RefText, ItemToTest->m_TextRef, 32 ) != 0 ) |
|
|
|
continue; |
|
|
|
if( ItemToTest->m_Unit == Unit ) |
|
|
|
{ |
|
|
|
@ -604,36 +575,40 @@ static int ExistUnit( CmpListStruct* Objet, int Unit, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************/ |
|
|
|
int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly ) |
|
|
|
/******************************************************************/ |
|
|
|
|
|
|
|
/** Function CheckAnnotate
|
|
|
|
* @return composent count ( which are not annotated or have the same reference (duplicates)) |
|
|
|
* @param OneSheetOnly : true = search is made only in the current sheet |
|
|
|
/*****************************************************************************
|
|
|
|
* |
|
|
|
* Function CheckAnnotate |
|
|
|
* @return component count ( which are not annotated or have the same |
|
|
|
* reference (duplicates)) |
|
|
|
* @param oneSheetOnly : true = search is made only in the current sheet |
|
|
|
* false = search in whole hierarchy (usual search). |
|
|
|
*/ |
|
|
|
* |
|
|
|
*****************************************************************************/ |
|
|
|
int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly ) |
|
|
|
{ |
|
|
|
int ii, error, NbOfCmp; |
|
|
|
DrawSheetList* sheet; |
|
|
|
DrawSheetList* sheet; |
|
|
|
CmpListStruct* ListeCmp = NULL; |
|
|
|
wxString Buff; |
|
|
|
wxString msg, cmpref; |
|
|
|
|
|
|
|
/* build the screen list */ |
|
|
|
EDA_SheetList SheetList( NULL ); |
|
|
|
EDA_SheetList SheetList( NULL ); |
|
|
|
|
|
|
|
g_RootSheet->m_s->SetModify(); |
|
|
|
ii = 0; |
|
|
|
ii = 0; |
|
|
|
|
|
|
|
/* first pass : count composents */ |
|
|
|
if( !OneSheetOnly ){ |
|
|
|
if( !oneSheetOnly ) |
|
|
|
{ |
|
|
|
NbOfCmp = 0; |
|
|
|
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() ) |
|
|
|
for( sheet = SheetList.GetFirst(); |
|
|
|
sheet != NULL; |
|
|
|
sheet = SheetList.GetNext() ) |
|
|
|
NbOfCmp += ListeComposants( NULL, sheet ); |
|
|
|
} |
|
|
|
else |
|
|
|
NbOfCmp = ListeComposants( NULL, frame->GetSheet() ); |
|
|
|
NbOfCmp = ListeComposants( NULL, frame->GetSheet() ); |
|
|
|
|
|
|
|
if( NbOfCmp == 0 ) |
|
|
|
{ |
|
|
|
@ -643,22 +618,26 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly ) |
|
|
|
|
|
|
|
|
|
|
|
/* Second pass : create the list of components */ |
|
|
|
ListeCmp = AllocateCmpListStrct(NbOfCmp); |
|
|
|
ListeCmp = AllocateCmpListStrct( NbOfCmp ); |
|
|
|
|
|
|
|
printf("CheckAnnotate() listing all components:\n"); |
|
|
|
if( !OneSheetOnly ){ |
|
|
|
printf( "CheckAnnotate() listing all components:\n" ); |
|
|
|
if( !oneSheetOnly ) |
|
|
|
{ |
|
|
|
ii = 0; |
|
|
|
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() ) |
|
|
|
for( sheet = SheetList.GetFirst(); |
|
|
|
sheet != NULL; |
|
|
|
sheet = SheetList.GetNext() ) |
|
|
|
ii += ListeComposants( ListeCmp + ii, sheet ); |
|
|
|
} |
|
|
|
else |
|
|
|
ListeComposants( ListeCmp, frame->GetSheet() ); |
|
|
|
|
|
|
|
printf("CheckAnnotate() done:\n"); |
|
|
|
|
|
|
|
qsort( ListeCmp, NbOfCmp, sizeof(CmpListStruct), AnnotTriComposant ); |
|
|
|
ListeComposants( ListeCmp, frame->GetSheet() ); |
|
|
|
|
|
|
|
printf( "CheckAnnotate() done:\n" ); |
|
|
|
|
|
|
|
/* Break full components reference in name (prefix) and number: example: IC1 become IC, and 1 */ |
|
|
|
qsort( ListeCmp, NbOfCmp, sizeof(CmpListStruct), AnnotateByValue ); |
|
|
|
|
|
|
|
/* Break full components reference in name (prefix) and number: example:
|
|
|
|
IC1 become IC, and 1 */ |
|
|
|
BreakReference( ListeCmp, NbOfCmp ); |
|
|
|
|
|
|
|
/* count not yet annotated items */ |
|
|
|
@ -676,7 +655,8 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly ) |
|
|
|
Buff = wxT( "?" ); |
|
|
|
|
|
|
|
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() ); |
|
|
|
|
|
|
|
if( (ListeCmp[ii].m_Unit > 0) && (ListeCmp[ii].m_Unit < 0x7FFFFFFF) ) |
|
|
|
{ |
|
|
|
@ -688,7 +668,8 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly ) |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
if( MAX( ListeCmp[ii].m_NbParts, 1 ) < ListeCmp[ii].m_Unit ) // Annotate error
|
|
|
|
// Annotate error
|
|
|
|
if( MAX( ListeCmp[ii].m_NbParts, 1 ) < ListeCmp[ii].m_Unit ) |
|
|
|
{ |
|
|
|
if( ListeCmp[ii].m_NumRef >= 0 ) |
|
|
|
Buff << ListeCmp[ii].m_NumRef; |
|
|
|
@ -696,7 +677,8 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly ) |
|
|
|
Buff = wxT( "?" ); |
|
|
|
|
|
|
|
cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef ); |
|
|
|
msg.Printf( _( "Error item %s%s" ), cmpref.GetData(), Buff.GetData() ); |
|
|
|
msg.Printf( _( "Error item %s%s" ), cmpref.GetData(), |
|
|
|
Buff.GetData() ); |
|
|
|
|
|
|
|
Buff.Printf( _( " unit %d and no more than %d parts" ), |
|
|
|
ListeCmp[ii].m_Unit, ListeCmp[ii].m_NbParts ); |
|
|
|
@ -716,8 +698,9 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly ) |
|
|
|
msg.Empty(); |
|
|
|
Buff.Empty(); |
|
|
|
|
|
|
|
if( (stricmp( ListeCmp[ii].m_TextRef, ListeCmp[ii + 1].m_TextRef ) != 0) |
|
|
|
|| ( ListeCmp[ii].m_NumRef != ListeCmp[ii + 1].m_NumRef ) ) |
|
|
|
if( (stricmp( ListeCmp[ii].m_TextRef, |
|
|
|
ListeCmp[ii + 1].m_TextRef ) != 0)|| |
|
|
|
( ListeCmp[ii].m_NumRef != ListeCmp[ii + 1].m_NumRef ) ) |
|
|
|
continue; |
|
|
|
|
|
|
|
/* Same reference found */ |
|
|
|
@ -732,7 +715,7 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly ) |
|
|
|
|
|
|
|
cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef ); |
|
|
|
msg.Printf( _( "Multiple item %s%s" ), |
|
|
|
cmpref.GetData(), Buff.GetData() ); |
|
|
|
cmpref.GetData(), Buff.GetData() ); |
|
|
|
|
|
|
|
if( (ListeCmp[ii].m_Unit > 0) && (ListeCmp[ii].m_Unit < 0x7FFFFFFF) ) |
|
|
|
{ |
|
|
|
@ -744,8 +727,8 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly ) |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
/* Test error if units are different but number of parts per package too hight
|
|
|
|
* (ex U3 ( 1 part) and we find U3B the is an error) */ |
|
|
|
/* Test error if units are different but number of parts per package
|
|
|
|
* too hight (ex U3 ( 1 part) and we find U3B the is an error) */ |
|
|
|
if( ListeCmp[ii].m_NbParts != ListeCmp[ii + 1].m_NbParts ) |
|
|
|
{ |
|
|
|
if( ListeCmp[ii].m_NumRef >= 0 ) |
|
|
|
@ -754,7 +737,8 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly ) |
|
|
|
Buff = wxT( "?" ); |
|
|
|
|
|
|
|
cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef ); |
|
|
|
msg.Printf( _( "Multiple item %s%s" ), cmpref.GetData(), Buff.GetData() ); |
|
|
|
msg.Printf( _( "Multiple item %s%s" ), |
|
|
|
cmpref.GetData(), Buff.GetData() ); |
|
|
|
|
|
|
|
if( (ListeCmp[ii].m_Unit > 0) && (ListeCmp[ii].m_Unit < 0x7FFFFFFF) ) |
|
|
|
{ |
|
|
|
@ -766,8 +750,9 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly ) |
|
|
|
error++; |
|
|
|
} |
|
|
|
|
|
|
|
/* Error if values are diff�rent between units, for the same reference */ |
|
|
|
if( stricmp( ListeCmp[ii].m_TextValue, ListeCmp[ii + 1].m_TextValue ) != 0 ) |
|
|
|
/* Error if values are different between units, for the same reference */ |
|
|
|
if( stricmp( ListeCmp[ii].m_TextValue, |
|
|
|
ListeCmp[ii + 1].m_TextValue ) != 0 ) |
|
|
|
{ |
|
|
|
wxString nextcmpref, cmpvalue, nextcmpvalue; |
|
|
|
cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef ); |
|
|
|
@ -775,11 +760,13 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly ) |
|
|
|
cmpvalue = CONV_FROM_UTF8( ListeCmp[ii].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)" ), |
|
|
|
cmpref.GetData(), ListeCmp[ii].m_NumRef, ListeCmp[ii].m_Unit + 'A' - 1, |
|
|
|
cmpvalue.GetData(), nextcmpref.GetData(), |
|
|
|
ListeCmp[ii + 1].m_NumRef, |
|
|
|
ListeCmp[ii + 1].m_Unit + 'A' - 1, |
|
|
|
nextcmpvalue.GetData() ); |
|
|
|
cmpref.GetData(), |
|
|
|
ListeCmp[ii].m_NumRef, |
|
|
|
ListeCmp[ii].m_Unit + 'A' - 1, |
|
|
|
cmpvalue.GetData(), nextcmpref.GetData(), |
|
|
|
ListeCmp[ii + 1].m_NumRef, |
|
|
|
ListeCmp[ii + 1].m_Unit + 'A' - 1, |
|
|
|
nextcmpvalue.GetData() ); |
|
|
|
|
|
|
|
DisplayError( frame, msg ); |
|
|
|
error++; |
|
|
|
|