Loading change_log.txt +20 −12 Original line number Diff line number Diff line Loading @@ -4,6 +4,14 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. 2007-Sep-20 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ + eeschema * beautify, add debug Show() functions, changed ReturnFieldName() to return "const wxString&" for speed, added GetFieldValue(). * tracking down questionable behavior (a bug?) in erc regarding pwr_flag, still looking 2007-sept-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ + all Loading common/base_screen.cpp +26 −0 Original line number Diff line number Diff line Loading @@ -555,3 +555,29 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList() return item; } #if defined(DEBUG) /** * Function Show * is used to output the object tree, currently for debugging only. * @param nestLevel An aid to prettier tree indenting, and is the level * of nesting of this object within the overall tree. * @param os The ostream& to output to. */ void BASE_SCREEN::Show( int nestLevel, std::ostream& os ) { EDA_BaseStruct* item = EEDrawList; // for now, make it look like XML, expand on this later. NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n"; for( ; item; item = item->Next() ) { item->Show( nestLevel+1, os ); } NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n"; } #endif No newline at end of file common/base_struct.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -188,11 +188,14 @@ void EDA_BaseStruct::Show( int nestLevel, std::ostream& os ) // for now, make it look like XML: NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n"; /* EDA_BaseStruct* kid = m_Son; for( ; kid; kid = kid->Pnext ) { kid->Show( nestLevel+1, os ); } */ NestedSpace( nestLevel+1, os ) << "Need ::Show() override, shown class is using EDA_BaseStruct::Show()\n"; NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n"; } Loading eeschema/annotate.cpp +690 −634 Original line number Diff line number Diff line Loading @@ -28,11 +28,12 @@ static bool SortByPosition = TRUE; /**************************************/ void ReAnnotatePowerSymbolsOnly() /**************************************/ /* Used to reannotate the power symbols, before testing erc or computing netlist when a true component reannotation is not necessary In order to avoid conflicts the ref number start with a 0: PWR with id 12 is named PWR12 in global annotation and PWR012 by the Power annotation /* Used to reannotate the power symbols, before testing erc or computing netlist * when a true component reannotation is not necessary * * In order to avoid conflicts the ref number start with a 0: * PWR with id 12 is named PWR12 in global annotation and PWR012 by the Power annotation */ { /* Build the screen list */ Loading Loading @@ -70,6 +71,7 @@ void InstallAnnotateFrame(WinEDA_SchematicFrame *parent, wxPoint & pos) /******************************************************************/ { WinEDA_AnnotateFrame* frame = new WinEDA_AnnotateFrame( parent ); frame->ShowModal(); frame->Destroy(); } Loading @@ -77,9 +79,10 @@ void InstallAnnotateFrame(WinEDA_SchematicFrame *parent, wxPoint & pos) /******************************************************************/ void WinEDA_AnnotateFrame::AnnotateComponents( wxCommandEvent& event ) /******************************************************************/ /* Compute the annotation of the components for the whole projeect, or the current sheet only. All the components or the new ones only will be annotated. * Compute the annotation of the components for the whole projeect, or the current sheet only. * All the components or the new ones only will be annotated. */ { int NbSheet, ii, NbOfCmp; Loading @@ -92,12 +95,15 @@ CmpListStruct * BaseListeCmp; 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( m_AnnotNewCmpCtrl->GetSelection() == 0 ) DeleteAnnotation( event ); if( m_Abort ) return; /* Build the screen list */ EDA_ScreenList ScreenList( NULL ); NbSheet = ScreenList.GetCount(); /* Update the sheet number, sheet count and date */ Loading @@ -114,7 +120,8 @@ CmpListStruct * BaseListeCmp; NbOfCmp += ListeComposants( NULL, screen, screen->m_SheetNumber ); } } else NbOfCmp = ListeComposants(NULL, screen, screen->m_SheetNumber); else NbOfCmp = ListeComposants( NULL, screen, screen->m_SheetNumber ); if( NbOfCmp == 0 ) return; Loading @@ -133,7 +140,8 @@ CmpListStruct * BaseListeCmp; screen, screen->m_SheetNumber ); } } else ii = ListeComposants(BaseListeCmp, screen, screen->m_SheetNumber); else ii = ListeComposants( BaseListeCmp, screen, screen->m_SheetNumber ); if( ii != NbOfCmp ) DisplayError( this, wxT( "Internal error in AnnotateComponents()" ) ); Loading Loading @@ -161,8 +169,9 @@ CmpListStruct * BaseListeCmp; /********************************************************************/ 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 * Update sheet number and number of sheets */ { int NbSheet; Loading @@ -179,6 +188,7 @@ EDA_SchComponentStruct *DrawLibItem; /* Build the screen list */ EDA_ScreenList ScreenList( NULL ); NbSheet = ScreenList.GetCount(); /* Update the sheet number, sheet count and date */ Loading @@ -186,8 +196,10 @@ EDA_SchComponentStruct *DrawLibItem; ScreenSch->SetModify(); if( AnnotProject == TRUE ) screen = ScreenList.GetFirst(); else screen = (SCH_SCREEN*) m_Parent->m_CurrentScreen; if( AnnotProject == TRUE ) screen = ScreenList.GetFirst(); else screen = (SCH_SCREEN*) m_Parent->m_CurrentScreen; for( ; screen != NULL; screen = ScreenList.GetNext() ) { Loading @@ -200,7 +212,9 @@ EDA_SchComponentStruct *DrawLibItem; DrawLibItem->ClearAnnotation(); } } if( ! AnnotProject ) break; if( !AnnotProject ) break; } m_Parent->DrawPanel->Refresh( TRUE ); Loading @@ -211,8 +225,9 @@ EDA_SchComponentStruct *DrawLibItem; /************************************************************************************/ int ListeComposants( CmpListStruct* BaseListeCmp, SCH_SCREEN* screen, int NumSheet ) /***********************************************************************************/ /* if BaseListeCmp == NULL : Components counting else update data table BaseListeCmp * else update data table BaseListeCmp */ { int NbrCmp = 0; Loading @@ -236,7 +251,8 @@ EDA_LibComponentStruct *Entry; case DRAW_LIB_ITEM_STRUCT_TYPE: DrawLibItem = (EDA_SchComponentStruct*) DrawList; Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); if( Entry == NULL) break; if( Entry == NULL ) break; if( BaseListeCmp == NULL ) /* Items counting only */ { NbrCmp++; break; Loading Loading @@ -279,44 +295,58 @@ EDA_LibComponentStruct *Entry; DrawList = DrawList->Pnext; } return(NbrCmp); return NbrCmp; } /*****************************************************************/ int AnnotTriComposant( CmpListStruct* Objet1, CmpListStruct* Objet2 ) /****************************************************************/ /* 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 * 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 **/ { int ii; ii = strnicmp( Objet1->m_TextRef, Objet2->m_TextRef, 32 ); if ( SortByPosition == TRUE ) { if ( ii == 0 ) ii = Objet1->m_Sheet - Objet2->m_Sheet; if ( ii == 0 ) ii = Objet1->m_Unit - Objet2->m_Unit; 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 { 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_Sheet - Objet2->m_Sheet; if( SortByPosition == TRUE ) { if( ii == 0 ) ii = Objet1->m_Sheet - Objet2->m_Sheet; if( ii == 0 ) ii = Objet1->m_Unit - Objet2->m_Unit; 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 { 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_Sheet - Objet2->m_Sheet; } if ( ii == 0 ) ii = Objet1->m_TimeStamp - Objet2->m_TimeStamp; if( ii == 0 ) ii = Objet1->m_TimeStamp - Objet2->m_TimeStamp; return(ii); return ii; } /********************************************************************/ static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp ) /********************************************************************/ /* Update the reference component for the schematic project (or the current sheet) */ { Loading @@ -330,29 +360,31 @@ EDA_SchComponentStruct *DrawLibItem; Text = BaseListeCmp[ii].m_TextRef; DrawLibItem = BaseListeCmp[ii].m_Cmp; if ( BaseListeCmp[ii].m_NumRef < 0 ) strcat( Text, "?" ); else sprintf( Text + strlen(Text),"%d",BaseListeCmp[ii].m_NumRef ); if( BaseListeCmp[ii].m_NumRef < 0 ) strcat( Text, "?" ); else sprintf( Text + strlen( Text ), "%d", BaseListeCmp[ii].m_NumRef ); DrawLibItem->m_Field[REFERENCE].m_Text = CONV_FROM_UTF8( Text ); DrawLibItem->m_Multi = BaseListeCmp[ii].m_Unit; DrawLibItem->m_RefIdNumber = BaseListeCmp[ii].m_NumRef; if ( DrawLibItem->m_RefIdNumber < 0 ) DrawLibItem->m_RefIdNumber = 0; if( DrawLibItem->m_RefIdNumber < 0 ) DrawLibItem->m_RefIdNumber = 0; } } /**************************************************************/ void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp ) /**************************************************************/ /* Modifie dans BaseListeCmp la reference des composants en supprimant la partie nombre de la partie texte. Place le nombre dans .m_NumRef Pour les composants multiples non encore annotes, met .m_Unit a sa valeur max Utilise: BaseListeCmp NbOfCmp * partie nombre de la partie texte. * Place le nombre dans .m_NumRef * Pour les composants multiples non encore annotes, met .m_Unit a sa valeur max * Utilise: * BaseListeCmp * NbOfCmp */ { int ii, ll; Loading Loading @@ -399,8 +431,9 @@ char * Text; /*****************************************************************************/ static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ) /*****************************************************************************/ /* Compute the reference number for components without reference number Compute .m_NumRef member * Compute .m_NumRef member */ { int ii, jj, LastReferenceNumber, NumberOfUnits, Unit; Loading @@ -422,7 +455,8 @@ CmpListStruct * ObjRef, * ObjToTest; for( ii = 0; ii < NbOfCmp; ii++ ) { ObjRef = &BaseListeCmp[ii]; if( BaseListeCmp[ii].m_Flag ) continue; if( BaseListeCmp[ii].m_Flag ) continue; Text = BaseListeCmp[ii].m_TextRef; if( strnicmp( RefText, Text, 32 ) != 0 ) /* Nouveau Identificateur */ Loading Loading @@ -459,19 +493,24 @@ CmpListStruct * ObjRef, * ObjToTest; for( Unit = 1; Unit <= NumberOfUnits; Unit++ ) { if( BaseListeCmp[ii].m_Unit == Unit ) continue; if( BaseListeCmp[ii].m_Unit == Unit ) continue; jj = ExistUnit( BaseListeCmp + ii, Unit, BaseListeCmp, NbOfCmp ); if ( jj >= 0 ) continue; /* Unit exists for this reference */ if( jj >= 0 ) continue; /* Unit exists for this reference */ /* Search a component to annotate ( same prefix, same value) */ for( jj = ii + 1; jj < NbOfCmp; jj++ ) { ObjToTest = &BaseListeCmp[jj]; if( BaseListeCmp[jj].m_Flag ) continue; if( BaseListeCmp[jj].m_Flag ) continue; Text = BaseListeCmp[jj].m_TextRef; if( strnicmp(RefText, Text, 32) != 0 ) break; // references are different if( strnicmp( RefText, Text, 32 ) != 0 ) break; // references are different Text = BaseListeCmp[jj].m_TextValue; if( strnicmp(ValText, Text, 32) != 0 ) break; // values are different if( strnicmp( ValText, Text, 32 ) != 0 ) break; // values are different if( !BaseListeCmp[jj].m_IsNew ) { //BaseListeCmp[jj].m_Flag = 1; Loading @@ -495,9 +534,10 @@ CmpListStruct * ObjRef, * ObjToTest; /*************************************************************************************************/ static int GetLastReferenceNumber( CmpListStruct* Objet, CmpListStruct* BaseListeCmp, int NbOfCmp ) /*************************************************************************************************/ /* Recherche le plus grand numero de reference dans les composants de meme prefixe de reference que celui pointe par Objet la liste des composants est supposee triee * de meme prefixe de reference que celui pointe par Objet * la liste des composants est supposee triee */ { CmpListStruct* LastObjet = BaseListeCmp + NbOfCmp; Loading @@ -509,9 +549,11 @@ const char * RefText; { if( strnicmp( RefText, Objet->m_TextRef, 32 ) != 0 ) /* Nouveau Identificateur */ break; if( LastNumber < Objet->m_NumRef ) LastNumber = Objet->m_NumRef; if( LastNumber < Objet->m_NumRef ) LastNumber = Objet->m_NumRef; } return(LastNumber); return LastNumber; } Loading @@ -519,11 +561,12 @@ const char * RefText; static int ExistUnit( CmpListStruct* Objet, int Unit, CmpListStruct* BaseListeCmp, int NbOfCmp ) /****************************************************************/ /* 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 * 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 */ { CmpListStruct* EndList = BaseListeCmp + NbOfCmp; Loading @@ -536,26 +579,31 @@ CmpListStruct *ItemToTest; NumRef = Objet->m_NumRef; for( ItemToTest = BaseListeCmp, ii = 0; ItemToTest < EndList; ItemToTest++, ii++ ) { if ( Objet == ItemToTest ) continue; if ( ItemToTest->m_IsNew ) continue; /* non affecte */ if ( ItemToTest->m_NumRef != NumRef ) continue; if( Objet == ItemToTest ) continue; if( ItemToTest->m_IsNew ) continue; /* non affecte */ if( ItemToTest->m_NumRef != NumRef ) continue; if( strnicmp( RefText, ItemToTest->m_TextRef, 32 ) != 0 ) /* Nouveau Identificateur */ continue; if( ItemToTest->m_Unit == Unit ) { return(ii); return ii; } } return(-1); return -1; } /******************************************************************/ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly ) /******************************************************************/ /* Retourne le nombre de composants non annots ou de meme rfrence (doubls) Si OneSheetOnly : recherche sur le schema courant sinon: recherche sur toute la hierarchie * Si OneSheetOnly : recherche sur le schema courant * sinon: recherche sur toute la hierarchie */ { int NbSheet, ii, NumSheet = 1, error, NbOfCmp; Loading @@ -566,6 +614,7 @@ wxString msg, cmpref; /* build tje screen list */ EDA_ScreenList ScreenList( NULL ); NbSheet = ScreenList.GetCount(); /* Update the sheet number, sheet count and date */ Loading @@ -582,12 +631,13 @@ wxString msg, cmpref; NbOfCmp += ListeComposants( NULL, screen, NumSheet ); } } else NbOfCmp = ListeComposants(NULL, screen, NumSheet); else NbOfCmp = ListeComposants( NULL, screen, NumSheet ); if( NbOfCmp == 0 ) { wxBell(); return(0); return 0; } ii = sizeof(CmpListStruct) * NbOfCmp; Loading Loading @@ -622,8 +672,10 @@ wxString msg, cmpref; msg.Empty(); Buff.Empty(); if( ListeCmp[ii].m_IsNew ) { if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef; else Buff = wxT("?"); if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef; else Buff = wxT( "?" ); cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef ); msg.Printf( _( "item not annotated: %s%s" ), cmpref.GetData(), Buff.GetData() ); Loading @@ -638,8 +690,10 @@ wxString msg, cmpref; if( MAX( ListeCmp[ii].m_NbParts, 1 ) < ListeCmp[ii].m_Unit ) // Annotate error { if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef; else Buff = wxT("?"); if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef; else Buff = wxT( "?" ); cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef ); msg.Printf( _( "Error item %s%s" ), cmpref.GetData(), Buff.GetData() ); Loading @@ -652,23 +706,25 @@ wxString msg, cmpref; } } if ( error ) return error; if( error ) return error; /* comptage des elements doubls (si tous sont annots) */ for( ii = 0; (ii < NbOfCmp - 1) && (error < 4); ii++ ) { 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; /* Meme reference trouve */ /* Il y a erreur si meme unite */ if( ListeCmp[ii].m_Unit == ListeCmp[ii + 1].m_Unit ) { if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef; else Buff = wxT("?"); if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef; else Buff = wxT( "?" ); cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef ); msg.Printf( _( "Multiple item %s%s" ), Loading @@ -684,12 +740,13 @@ wxString msg, cmpref; } /* Il y a erreur si unites differentes mais nombre de parts differentes par boitier (ex U3 ( 1 part) et U3B sont incompatibles) */ * par boitier (ex U3 ( 1 part) et U3B sont incompatibles) */ if( ListeCmp[ii].m_NbParts != ListeCmp[ii + 1].m_NbParts ) { if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef; else Buff = wxT("?"); if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef; else Buff = wxT( "?" ); cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef ); msg.Printf( _( "Multiple item %s%s" ), cmpref.GetData(), Buff.GetData() ); Loading @@ -715,7 +772,8 @@ wxString msg, cmpref; 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, nextcmpref.GetData( ), ListeCmp[ii + 1].m_NumRef, ListeCmp[ii + 1].m_Unit + 'A' - 1, nextcmpvalue.GetData() ); DisplayError( frame, msg ); Loading @@ -724,7 +782,5 @@ wxString msg, cmpref; } MyFree( ListeCmp ); return(error); return error; } eeschema/class_screen.h +1 −1 Original line number Diff line number Diff line Loading @@ -90,12 +90,12 @@ class SCH_SCREEN : public BASE_SCREEN public: SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE ); ~SCH_SCREEN(); virtual wxString GetClass() const { return wxT("SCH_SCREEN"); } void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies) void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { }; Loading Loading
change_log.txt +20 −12 Original line number Diff line number Diff line Loading @@ -4,6 +4,14 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. 2007-Sep-20 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ + eeschema * beautify, add debug Show() functions, changed ReturnFieldName() to return "const wxString&" for speed, added GetFieldValue(). * tracking down questionable behavior (a bug?) in erc regarding pwr_flag, still looking 2007-sept-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ + all Loading
common/base_screen.cpp +26 −0 Original line number Diff line number Diff line Loading @@ -555,3 +555,29 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList() return item; } #if defined(DEBUG) /** * Function Show * is used to output the object tree, currently for debugging only. * @param nestLevel An aid to prettier tree indenting, and is the level * of nesting of this object within the overall tree. * @param os The ostream& to output to. */ void BASE_SCREEN::Show( int nestLevel, std::ostream& os ) { EDA_BaseStruct* item = EEDrawList; // for now, make it look like XML, expand on this later. NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n"; for( ; item; item = item->Next() ) { item->Show( nestLevel+1, os ); } NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n"; } #endif No newline at end of file
common/base_struct.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -188,11 +188,14 @@ void EDA_BaseStruct::Show( int nestLevel, std::ostream& os ) // for now, make it look like XML: NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n"; /* EDA_BaseStruct* kid = m_Son; for( ; kid; kid = kid->Pnext ) { kid->Show( nestLevel+1, os ); } */ NestedSpace( nestLevel+1, os ) << "Need ::Show() override, shown class is using EDA_BaseStruct::Show()\n"; NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n"; } Loading
eeschema/annotate.cpp +690 −634 Original line number Diff line number Diff line Loading @@ -28,11 +28,12 @@ static bool SortByPosition = TRUE; /**************************************/ void ReAnnotatePowerSymbolsOnly() /**************************************/ /* Used to reannotate the power symbols, before testing erc or computing netlist when a true component reannotation is not necessary In order to avoid conflicts the ref number start with a 0: PWR with id 12 is named PWR12 in global annotation and PWR012 by the Power annotation /* Used to reannotate the power symbols, before testing erc or computing netlist * when a true component reannotation is not necessary * * In order to avoid conflicts the ref number start with a 0: * PWR with id 12 is named PWR12 in global annotation and PWR012 by the Power annotation */ { /* Build the screen list */ Loading Loading @@ -70,6 +71,7 @@ void InstallAnnotateFrame(WinEDA_SchematicFrame *parent, wxPoint & pos) /******************************************************************/ { WinEDA_AnnotateFrame* frame = new WinEDA_AnnotateFrame( parent ); frame->ShowModal(); frame->Destroy(); } Loading @@ -77,9 +79,10 @@ void InstallAnnotateFrame(WinEDA_SchematicFrame *parent, wxPoint & pos) /******************************************************************/ void WinEDA_AnnotateFrame::AnnotateComponents( wxCommandEvent& event ) /******************************************************************/ /* Compute the annotation of the components for the whole projeect, or the current sheet only. All the components or the new ones only will be annotated. * Compute the annotation of the components for the whole projeect, or the current sheet only. * All the components or the new ones only will be annotated. */ { int NbSheet, ii, NbOfCmp; Loading @@ -92,12 +95,15 @@ CmpListStruct * BaseListeCmp; 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( m_AnnotNewCmpCtrl->GetSelection() == 0 ) DeleteAnnotation( event ); if( m_Abort ) return; /* Build the screen list */ EDA_ScreenList ScreenList( NULL ); NbSheet = ScreenList.GetCount(); /* Update the sheet number, sheet count and date */ Loading @@ -114,7 +120,8 @@ CmpListStruct * BaseListeCmp; NbOfCmp += ListeComposants( NULL, screen, screen->m_SheetNumber ); } } else NbOfCmp = ListeComposants(NULL, screen, screen->m_SheetNumber); else NbOfCmp = ListeComposants( NULL, screen, screen->m_SheetNumber ); if( NbOfCmp == 0 ) return; Loading @@ -133,7 +140,8 @@ CmpListStruct * BaseListeCmp; screen, screen->m_SheetNumber ); } } else ii = ListeComposants(BaseListeCmp, screen, screen->m_SheetNumber); else ii = ListeComposants( BaseListeCmp, screen, screen->m_SheetNumber ); if( ii != NbOfCmp ) DisplayError( this, wxT( "Internal error in AnnotateComponents()" ) ); Loading Loading @@ -161,8 +169,9 @@ CmpListStruct * BaseListeCmp; /********************************************************************/ 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 * Update sheet number and number of sheets */ { int NbSheet; Loading @@ -179,6 +188,7 @@ EDA_SchComponentStruct *DrawLibItem; /* Build the screen list */ EDA_ScreenList ScreenList( NULL ); NbSheet = ScreenList.GetCount(); /* Update the sheet number, sheet count and date */ Loading @@ -186,8 +196,10 @@ EDA_SchComponentStruct *DrawLibItem; ScreenSch->SetModify(); if( AnnotProject == TRUE ) screen = ScreenList.GetFirst(); else screen = (SCH_SCREEN*) m_Parent->m_CurrentScreen; if( AnnotProject == TRUE ) screen = ScreenList.GetFirst(); else screen = (SCH_SCREEN*) m_Parent->m_CurrentScreen; for( ; screen != NULL; screen = ScreenList.GetNext() ) { Loading @@ -200,7 +212,9 @@ EDA_SchComponentStruct *DrawLibItem; DrawLibItem->ClearAnnotation(); } } if( ! AnnotProject ) break; if( !AnnotProject ) break; } m_Parent->DrawPanel->Refresh( TRUE ); Loading @@ -211,8 +225,9 @@ EDA_SchComponentStruct *DrawLibItem; /************************************************************************************/ int ListeComposants( CmpListStruct* BaseListeCmp, SCH_SCREEN* screen, int NumSheet ) /***********************************************************************************/ /* if BaseListeCmp == NULL : Components counting else update data table BaseListeCmp * else update data table BaseListeCmp */ { int NbrCmp = 0; Loading @@ -236,7 +251,8 @@ EDA_LibComponentStruct *Entry; case DRAW_LIB_ITEM_STRUCT_TYPE: DrawLibItem = (EDA_SchComponentStruct*) DrawList; Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); if( Entry == NULL) break; if( Entry == NULL ) break; if( BaseListeCmp == NULL ) /* Items counting only */ { NbrCmp++; break; Loading Loading @@ -279,44 +295,58 @@ EDA_LibComponentStruct *Entry; DrawList = DrawList->Pnext; } return(NbrCmp); return NbrCmp; } /*****************************************************************/ int AnnotTriComposant( CmpListStruct* Objet1, CmpListStruct* Objet2 ) /****************************************************************/ /* 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 * 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 **/ { int ii; ii = strnicmp( Objet1->m_TextRef, Objet2->m_TextRef, 32 ); if ( SortByPosition == TRUE ) { if ( ii == 0 ) ii = Objet1->m_Sheet - Objet2->m_Sheet; if ( ii == 0 ) ii = Objet1->m_Unit - Objet2->m_Unit; 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 { 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_Sheet - Objet2->m_Sheet; if( SortByPosition == TRUE ) { if( ii == 0 ) ii = Objet1->m_Sheet - Objet2->m_Sheet; if( ii == 0 ) ii = Objet1->m_Unit - Objet2->m_Unit; 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 { 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_Sheet - Objet2->m_Sheet; } if ( ii == 0 ) ii = Objet1->m_TimeStamp - Objet2->m_TimeStamp; if( ii == 0 ) ii = Objet1->m_TimeStamp - Objet2->m_TimeStamp; return(ii); return ii; } /********************************************************************/ static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp ) /********************************************************************/ /* Update the reference component for the schematic project (or the current sheet) */ { Loading @@ -330,29 +360,31 @@ EDA_SchComponentStruct *DrawLibItem; Text = BaseListeCmp[ii].m_TextRef; DrawLibItem = BaseListeCmp[ii].m_Cmp; if ( BaseListeCmp[ii].m_NumRef < 0 ) strcat( Text, "?" ); else sprintf( Text + strlen(Text),"%d",BaseListeCmp[ii].m_NumRef ); if( BaseListeCmp[ii].m_NumRef < 0 ) strcat( Text, "?" ); else sprintf( Text + strlen( Text ), "%d", BaseListeCmp[ii].m_NumRef ); DrawLibItem->m_Field[REFERENCE].m_Text = CONV_FROM_UTF8( Text ); DrawLibItem->m_Multi = BaseListeCmp[ii].m_Unit; DrawLibItem->m_RefIdNumber = BaseListeCmp[ii].m_NumRef; if ( DrawLibItem->m_RefIdNumber < 0 ) DrawLibItem->m_RefIdNumber = 0; if( DrawLibItem->m_RefIdNumber < 0 ) DrawLibItem->m_RefIdNumber = 0; } } /**************************************************************/ void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp ) /**************************************************************/ /* Modifie dans BaseListeCmp la reference des composants en supprimant la partie nombre de la partie texte. Place le nombre dans .m_NumRef Pour les composants multiples non encore annotes, met .m_Unit a sa valeur max Utilise: BaseListeCmp NbOfCmp * partie nombre de la partie texte. * Place le nombre dans .m_NumRef * Pour les composants multiples non encore annotes, met .m_Unit a sa valeur max * Utilise: * BaseListeCmp * NbOfCmp */ { int ii, ll; Loading Loading @@ -399,8 +431,9 @@ char * Text; /*****************************************************************************/ static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ) /*****************************************************************************/ /* Compute the reference number for components without reference number Compute .m_NumRef member * Compute .m_NumRef member */ { int ii, jj, LastReferenceNumber, NumberOfUnits, Unit; Loading @@ -422,7 +455,8 @@ CmpListStruct * ObjRef, * ObjToTest; for( ii = 0; ii < NbOfCmp; ii++ ) { ObjRef = &BaseListeCmp[ii]; if( BaseListeCmp[ii].m_Flag ) continue; if( BaseListeCmp[ii].m_Flag ) continue; Text = BaseListeCmp[ii].m_TextRef; if( strnicmp( RefText, Text, 32 ) != 0 ) /* Nouveau Identificateur */ Loading Loading @@ -459,19 +493,24 @@ CmpListStruct * ObjRef, * ObjToTest; for( Unit = 1; Unit <= NumberOfUnits; Unit++ ) { if( BaseListeCmp[ii].m_Unit == Unit ) continue; if( BaseListeCmp[ii].m_Unit == Unit ) continue; jj = ExistUnit( BaseListeCmp + ii, Unit, BaseListeCmp, NbOfCmp ); if ( jj >= 0 ) continue; /* Unit exists for this reference */ if( jj >= 0 ) continue; /* Unit exists for this reference */ /* Search a component to annotate ( same prefix, same value) */ for( jj = ii + 1; jj < NbOfCmp; jj++ ) { ObjToTest = &BaseListeCmp[jj]; if( BaseListeCmp[jj].m_Flag ) continue; if( BaseListeCmp[jj].m_Flag ) continue; Text = BaseListeCmp[jj].m_TextRef; if( strnicmp(RefText, Text, 32) != 0 ) break; // references are different if( strnicmp( RefText, Text, 32 ) != 0 ) break; // references are different Text = BaseListeCmp[jj].m_TextValue; if( strnicmp(ValText, Text, 32) != 0 ) break; // values are different if( strnicmp( ValText, Text, 32 ) != 0 ) break; // values are different if( !BaseListeCmp[jj].m_IsNew ) { //BaseListeCmp[jj].m_Flag = 1; Loading @@ -495,9 +534,10 @@ CmpListStruct * ObjRef, * ObjToTest; /*************************************************************************************************/ static int GetLastReferenceNumber( CmpListStruct* Objet, CmpListStruct* BaseListeCmp, int NbOfCmp ) /*************************************************************************************************/ /* Recherche le plus grand numero de reference dans les composants de meme prefixe de reference que celui pointe par Objet la liste des composants est supposee triee * de meme prefixe de reference que celui pointe par Objet * la liste des composants est supposee triee */ { CmpListStruct* LastObjet = BaseListeCmp + NbOfCmp; Loading @@ -509,9 +549,11 @@ const char * RefText; { if( strnicmp( RefText, Objet->m_TextRef, 32 ) != 0 ) /* Nouveau Identificateur */ break; if( LastNumber < Objet->m_NumRef ) LastNumber = Objet->m_NumRef; if( LastNumber < Objet->m_NumRef ) LastNumber = Objet->m_NumRef; } return(LastNumber); return LastNumber; } Loading @@ -519,11 +561,12 @@ const char * RefText; static int ExistUnit( CmpListStruct* Objet, int Unit, CmpListStruct* BaseListeCmp, int NbOfCmp ) /****************************************************************/ /* 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 * 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 */ { CmpListStruct* EndList = BaseListeCmp + NbOfCmp; Loading @@ -536,26 +579,31 @@ CmpListStruct *ItemToTest; NumRef = Objet->m_NumRef; for( ItemToTest = BaseListeCmp, ii = 0; ItemToTest < EndList; ItemToTest++, ii++ ) { if ( Objet == ItemToTest ) continue; if ( ItemToTest->m_IsNew ) continue; /* non affecte */ if ( ItemToTest->m_NumRef != NumRef ) continue; if( Objet == ItemToTest ) continue; if( ItemToTest->m_IsNew ) continue; /* non affecte */ if( ItemToTest->m_NumRef != NumRef ) continue; if( strnicmp( RefText, ItemToTest->m_TextRef, 32 ) != 0 ) /* Nouveau Identificateur */ continue; if( ItemToTest->m_Unit == Unit ) { return(ii); return ii; } } return(-1); return -1; } /******************************************************************/ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly ) /******************************************************************/ /* Retourne le nombre de composants non annots ou de meme rfrence (doubls) Si OneSheetOnly : recherche sur le schema courant sinon: recherche sur toute la hierarchie * Si OneSheetOnly : recherche sur le schema courant * sinon: recherche sur toute la hierarchie */ { int NbSheet, ii, NumSheet = 1, error, NbOfCmp; Loading @@ -566,6 +614,7 @@ wxString msg, cmpref; /* build tje screen list */ EDA_ScreenList ScreenList( NULL ); NbSheet = ScreenList.GetCount(); /* Update the sheet number, sheet count and date */ Loading @@ -582,12 +631,13 @@ wxString msg, cmpref; NbOfCmp += ListeComposants( NULL, screen, NumSheet ); } } else NbOfCmp = ListeComposants(NULL, screen, NumSheet); else NbOfCmp = ListeComposants( NULL, screen, NumSheet ); if( NbOfCmp == 0 ) { wxBell(); return(0); return 0; } ii = sizeof(CmpListStruct) * NbOfCmp; Loading Loading @@ -622,8 +672,10 @@ wxString msg, cmpref; msg.Empty(); Buff.Empty(); if( ListeCmp[ii].m_IsNew ) { if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef; else Buff = wxT("?"); if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef; else Buff = wxT( "?" ); cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef ); msg.Printf( _( "item not annotated: %s%s" ), cmpref.GetData(), Buff.GetData() ); Loading @@ -638,8 +690,10 @@ wxString msg, cmpref; if( MAX( ListeCmp[ii].m_NbParts, 1 ) < ListeCmp[ii].m_Unit ) // Annotate error { if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef; else Buff = wxT("?"); if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef; else Buff = wxT( "?" ); cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef ); msg.Printf( _( "Error item %s%s" ), cmpref.GetData(), Buff.GetData() ); Loading @@ -652,23 +706,25 @@ wxString msg, cmpref; } } if ( error ) return error; if( error ) return error; /* comptage des elements doubls (si tous sont annots) */ for( ii = 0; (ii < NbOfCmp - 1) && (error < 4); ii++ ) { 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; /* Meme reference trouve */ /* Il y a erreur si meme unite */ if( ListeCmp[ii].m_Unit == ListeCmp[ii + 1].m_Unit ) { if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef; else Buff = wxT("?"); if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef; else Buff = wxT( "?" ); cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef ); msg.Printf( _( "Multiple item %s%s" ), Loading @@ -684,12 +740,13 @@ wxString msg, cmpref; } /* Il y a erreur si unites differentes mais nombre de parts differentes par boitier (ex U3 ( 1 part) et U3B sont incompatibles) */ * par boitier (ex U3 ( 1 part) et U3B sont incompatibles) */ if( ListeCmp[ii].m_NbParts != ListeCmp[ii + 1].m_NbParts ) { if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef; else Buff = wxT("?"); if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef; else Buff = wxT( "?" ); cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef ); msg.Printf( _( "Multiple item %s%s" ), cmpref.GetData(), Buff.GetData() ); Loading @@ -715,7 +772,8 @@ wxString msg, cmpref; 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, nextcmpref.GetData( ), ListeCmp[ii + 1].m_NumRef, ListeCmp[ii + 1].m_Unit + 'A' - 1, nextcmpvalue.GetData() ); DisplayError( frame, msg ); Loading @@ -724,7 +782,5 @@ wxString msg, cmpref; } MyFree( ListeCmp ); return(error); return error; }
eeschema/class_screen.h +1 −1 Original line number Diff line number Diff line Loading @@ -90,12 +90,12 @@ class SCH_SCREEN : public BASE_SCREEN public: SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE ); ~SCH_SCREEN(); virtual wxString GetClass() const { return wxT("SCH_SCREEN"); } void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies) void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { }; Loading