Loading change_log.txt +8 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,14 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. 2008-Apr-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Apr-16 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ +eeschema In complex hierarchies, multiples parts per packages now should work, without restrictions 2008-Apr-15 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ +eeschema More code cleaning and Files cleaning and reorganization. Loading eeschema/annotate.cpp +17 −15 Original line number Diff line number Diff line Loading @@ -265,7 +265,7 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent, BaseListeCmp = AllocateCmpListStrct( NbOfCmp ); /* Second pass : Int data tables */ /* Second pass : Init data tables */ if( annotateSchematic ) { ii = 0; Loading Loading @@ -334,7 +334,7 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet ) BaseListeCmp[NbrCmp].m_Cmp = DrawLibItem; BaseListeCmp[NbrCmp].m_NbParts = Entry->m_UnitCount; BaseListeCmp[NbrCmp].m_Unit = DrawLibItem->m_Multi; BaseListeCmp[NbrCmp].m_Unit = DrawLibItem->GetUnitSelection( sheet );// DrawLibItem->m_Multi; BaseListeCmp[NbrCmp].m_PartsLocked = Entry->m_UnitSelectionLocked; BaseListeCmp[NbrCmp].m_SheetList = *sheet; BaseListeCmp[NbrCmp].m_IsNew = FALSE; Loading Loading @@ -386,6 +386,7 @@ static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp ) DrawLibItem->SetRef( &(BaseListeCmp[ii].m_SheetList), CONV_FROM_UTF8( Text ) ); DrawLibItem->m_Multi = BaseListeCmp[ii].m_Unit; DrawLibItem->SetUnitSelection( &(BaseListeCmp[ii].m_SheetList), DrawLibItem->m_Multi ); } } Loading Loading @@ -587,12 +588,14 @@ int GetLastReferenceNumber( CmpListStruct* Objet, /***************************************************************************** * 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 * Search in the sorted list of components, for a given componen,t an other component * with the same reference and a given part unit. * Mainly used to manage multiple parts per package components * @param Objet = the given CmpListStruct* item to test * @param Unit = the given unit number to search * @param BaseListeCmp = list of items to examine * @param NbOfCmp = size of list * @return index in BaseListeCmp if found or -1 if not found *****************************************************************************/ static int ExistUnit( CmpListStruct* Objet, int Unit, CmpListStruct* BaseListeCmp, int NbOfCmp ) Loading @@ -609,16 +612,15 @@ static int ExistUnit( CmpListStruct* Objet, int Unit, ItemToTest < EndList; ItemToTest++, ii++ ) { if( Objet == ItemToTest ) if( Objet == ItemToTest ) // Do not compare with itself ! continue; if( ItemToTest->m_IsNew ) continue; /* non affecte */ if( ItemToTest->m_NumRef != NumRef ) if( ItemToTest->m_IsNew ) // Not already with an updated reference continue; /* Nouveau Identificateur */ if( strnicmp( RefText, ItemToTest->m_TextRef, 32 ) != 0 ) if( ItemToTest->m_NumRef != NumRef ) // Not the same reference number (like 35 in R35) continue; if( strnicmp( RefText, ItemToTest->m_TextRef, 32 ) != 0 ) // Not the same reference prefix continue; if( ItemToTest->m_Unit == Unit ) if( ItemToTest->m_Unit == Unit ) // A part with the same reference and the given unit is found { return ii; } Loading eeschema/class_drawsheet.cpp +11 −4 Original line number Diff line number Diff line Loading @@ -772,7 +772,15 @@ wxString DrawSheetPath::PathHumanReadable() } /***********************************************/ void DrawSheetPath::UpdateAllScreenReferences() /***********************************************/ /** Function UpdateAllScreenReferences * Update the reference and the m_Multi parameter (part selection) for all components on a screen * depending on the actual sheet path. * Mandatory in complex hierarchies sheets use the same screen (basic schematic) * but with different references and part selection according to the displayed sheet */ { EDA_BaseStruct* t = LastDrawList(); Loading @@ -780,13 +788,12 @@ void DrawSheetPath::UpdateAllScreenReferences() { if( t->Type() == TYPE_SCH_COMPONENT ) { SCH_COMPONENT* d = (SCH_COMPONENT*) t; d->m_Field[REFERENCE].m_Text = d->GetRef( this ); SCH_COMPONENT* component = (SCH_COMPONENT*) t; component->m_Field[REFERENCE].m_Text = component->GetRef( this ); component->m_Multi = component->GetUnitSelection( this ); } t = t->Pnext; } printf( "on sheet: %s \n", CONV_TO_UTF8( PathHumanReadable() ) ); } Loading eeschema/class_drawsheet.h +16 −1 Original line number Diff line number Diff line Loading @@ -127,7 +127,7 @@ public: /* class to handle a series of sheets *********/ /* a 'path' so to speak.. *********************/ /**********************************************/ #define DSLSZ 32 #define DSLSZ 32 // Max number of levels for a sheet path class DrawSheetPath { public: Loading @@ -143,8 +143,23 @@ public: EDA_BaseStruct* LastDrawList(); void Push( DrawSheetStruct* sheet ); DrawSheetStruct* Pop(); /** Function Path * the path uses the time stamps which do not changes even when editing sheet parameters * a path is something like / (root) or /34005677 or /34005677/00AE4523 */ wxString Path(); /** Function PathHumanReadable * Return the sheet path in a readable form, i.e. * as a path made from sheet names. * (the "normal" path uses the time stamps which do not changes even when editing sheet parameters) */ wxString PathHumanReadable(); /** Function UpdateAllScreenReferences * Update the reference and the m_Multi parameter (part selection) for all components on a screen * depending on the actual sheet path. * Mandatory in complex hierarchies because sheets use the same screen (basic schematic) * but with different references and part selection according to the displayed sheet */ void UpdateAllScreenReferences(); bool operator =( const DrawSheetPath& d1 ); Loading eeschema/component_class.cpp +84 −15 Original line number Diff line number Diff line Loading @@ -27,12 +27,14 @@ WX_DEFINE_OBJARRAY( ArrayOfSheetLists ); /** Function AddHierarchicalReference * Add a full hierachical reference (path + local reference) * @param path = hierarchical path (/<sheet timestamp>/component timestamp> like /05678E50/A23EF560) * @param ref = local reference like C45, R56 * @param aPath = hierarchical path (/<sheet timestamp>/component timestamp> like /05678E50/A23EF560) * @param aRef = local reference like C45, R56 * @param aMulti = part selection, used in multi part per package (0 or 1 for non multi) */ void SCH_COMPONENT::AddHierarchicalReference( const wxString& path, const wxString& ref ) void SCH_COMPONENT::AddHierarchicalReference( const wxString& aPath, const wxString& aRef, int aMulti ) { wxString h_path, h_ref; wxStringTokenizer tokenizer; wxString separators( wxT( " " ) ); Loading @@ -42,16 +44,16 @@ void SCH_COMPONENT::AddHierarchicalReference( const wxString& path, const wxStri { tokenizer.SetString( m_PathsAndReferences[ii], separators ); h_path = tokenizer.GetNextToken(); if( h_path.Cmp( path ) == 0 ) if( h_path.Cmp( aPath ) == 0 ) { m_PathsAndReferences.RemoveAt( ii ); ii--; } } h_ref = path + wxT( " " ) + ref; h_ref = aPath + wxT( " " ) + aRef; h_ref << wxT( " " ) << m_Multi; h_ref << wxT( " " ) << aMulti; m_PathsAndReferences.Add( h_ref ); } Loading Loading @@ -156,16 +158,15 @@ const wxString SCH_COMPONENT::GetRef( DrawSheetPath* sheet ) void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref ) /***********************************************************************/ { //check to see if it is already there before inserting it wxString path = GetPath( sheet ); // printf( "SetRef path: %s ref: %s\n", CONV_TO_UTF8( path ), CONV_TO_UTF8( ref ) ); // Debug bool notInArray = true; wxString h_path, h_ref; wxStringTokenizer tokenizer; wxString separators( wxT( " " ) ); //check to see if it is already there before inserting it for( unsigned ii = 0; ii<m_PathsAndReferences.GetCount(); ii++ ) { tokenizer.SetString( m_PathsAndReferences[ii], separators ); Loading @@ -184,7 +185,7 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref ) } if( notInArray ) AddHierarchicalReference( path, ref ); AddHierarchicalReference( path, ref, m_Multi ); if( m_Field[REFERENCE].m_Text.IsEmpty() || ( abs( m_Field[REFERENCE].m_Pos.x - m_Pos.x ) + Loading @@ -199,6 +200,74 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref ) } /***********************************************************/ int SCH_COMPONENT::GetUnitSelection( DrawSheetPath* aSheet ) /***********************************************************/ //returns the unit selection, for the given sheet path. { wxString path = GetPath( aSheet ); wxString h_path, h_multi; wxStringTokenizer tokenizer; wxString separators( wxT( " " ) ); for( unsigned ii = 0; ii<m_PathsAndReferences.GetCount(); ii++ ) { tokenizer.SetString( m_PathsAndReferences[ii], separators ); h_path = tokenizer.GetNextToken(); if( h_path.Cmp( path ) == 0 ) { tokenizer.GetNextToken(); // Skip reference h_multi = tokenizer.GetNextToken(); long imulti = 1; h_multi.ToLong( &imulti ); return imulti; } } //if it was not found in m_Paths array, then use m_Multi. // this will happen if we load a version 1 schematic file. return m_Multi; } /********************************************************************************/ void SCH_COMPONENT::SetUnitSelection( DrawSheetPath* aSheet, int aUnitSelection ) /********************************************************************************/ //Set the unit selection, for the given sheet path. { wxString path = GetPath( aSheet ); bool notInArray = true; wxString h_path, h_ref; wxStringTokenizer tokenizer; wxString separators( wxT( " " ) ); //check to see if it is already there before inserting it for( unsigned ii = 0; ii<m_PathsAndReferences.GetCount(); ii++ ) { tokenizer.SetString( m_PathsAndReferences[ii], separators ); h_path = tokenizer.GetNextToken(); if( h_path.Cmp( path ) == 0 ) { //just update the unit selection. h_ref = h_path + wxT( " " ); h_ref += tokenizer.GetNextToken(); // Add reference h_ref += wxT( " " ); h_ref << aUnitSelection; // Add part selection // Ann the part selection m_PathsAndReferences[ii] = h_ref; notInArray = false; } } if( notInArray ) AddHierarchicalReference( path, m_PrefixString, aUnitSelection ); } /******************************************************************/ const wxString& SCH_COMPONENT::GetFieldValue( int aFieldNdx ) const /******************************************************************/ Loading Loading
change_log.txt +8 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,14 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. 2008-Apr-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Apr-16 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ +eeschema In complex hierarchies, multiples parts per packages now should work, without restrictions 2008-Apr-15 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ +eeschema More code cleaning and Files cleaning and reorganization. Loading
eeschema/annotate.cpp +17 −15 Original line number Diff line number Diff line Loading @@ -265,7 +265,7 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent, BaseListeCmp = AllocateCmpListStrct( NbOfCmp ); /* Second pass : Int data tables */ /* Second pass : Init data tables */ if( annotateSchematic ) { ii = 0; Loading Loading @@ -334,7 +334,7 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet ) BaseListeCmp[NbrCmp].m_Cmp = DrawLibItem; BaseListeCmp[NbrCmp].m_NbParts = Entry->m_UnitCount; BaseListeCmp[NbrCmp].m_Unit = DrawLibItem->m_Multi; BaseListeCmp[NbrCmp].m_Unit = DrawLibItem->GetUnitSelection( sheet );// DrawLibItem->m_Multi; BaseListeCmp[NbrCmp].m_PartsLocked = Entry->m_UnitSelectionLocked; BaseListeCmp[NbrCmp].m_SheetList = *sheet; BaseListeCmp[NbrCmp].m_IsNew = FALSE; Loading Loading @@ -386,6 +386,7 @@ static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp ) DrawLibItem->SetRef( &(BaseListeCmp[ii].m_SheetList), CONV_FROM_UTF8( Text ) ); DrawLibItem->m_Multi = BaseListeCmp[ii].m_Unit; DrawLibItem->SetUnitSelection( &(BaseListeCmp[ii].m_SheetList), DrawLibItem->m_Multi ); } } Loading Loading @@ -587,12 +588,14 @@ int GetLastReferenceNumber( CmpListStruct* Objet, /***************************************************************************** * 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 * Search in the sorted list of components, for a given componen,t an other component * with the same reference and a given part unit. * Mainly used to manage multiple parts per package components * @param Objet = the given CmpListStruct* item to test * @param Unit = the given unit number to search * @param BaseListeCmp = list of items to examine * @param NbOfCmp = size of list * @return index in BaseListeCmp if found or -1 if not found *****************************************************************************/ static int ExistUnit( CmpListStruct* Objet, int Unit, CmpListStruct* BaseListeCmp, int NbOfCmp ) Loading @@ -609,16 +612,15 @@ static int ExistUnit( CmpListStruct* Objet, int Unit, ItemToTest < EndList; ItemToTest++, ii++ ) { if( Objet == ItemToTest ) if( Objet == ItemToTest ) // Do not compare with itself ! continue; if( ItemToTest->m_IsNew ) continue; /* non affecte */ if( ItemToTest->m_NumRef != NumRef ) if( ItemToTest->m_IsNew ) // Not already with an updated reference continue; /* Nouveau Identificateur */ if( strnicmp( RefText, ItemToTest->m_TextRef, 32 ) != 0 ) if( ItemToTest->m_NumRef != NumRef ) // Not the same reference number (like 35 in R35) continue; if( strnicmp( RefText, ItemToTest->m_TextRef, 32 ) != 0 ) // Not the same reference prefix continue; if( ItemToTest->m_Unit == Unit ) if( ItemToTest->m_Unit == Unit ) // A part with the same reference and the given unit is found { return ii; } Loading
eeschema/class_drawsheet.cpp +11 −4 Original line number Diff line number Diff line Loading @@ -772,7 +772,15 @@ wxString DrawSheetPath::PathHumanReadable() } /***********************************************/ void DrawSheetPath::UpdateAllScreenReferences() /***********************************************/ /** Function UpdateAllScreenReferences * Update the reference and the m_Multi parameter (part selection) for all components on a screen * depending on the actual sheet path. * Mandatory in complex hierarchies sheets use the same screen (basic schematic) * but with different references and part selection according to the displayed sheet */ { EDA_BaseStruct* t = LastDrawList(); Loading @@ -780,13 +788,12 @@ void DrawSheetPath::UpdateAllScreenReferences() { if( t->Type() == TYPE_SCH_COMPONENT ) { SCH_COMPONENT* d = (SCH_COMPONENT*) t; d->m_Field[REFERENCE].m_Text = d->GetRef( this ); SCH_COMPONENT* component = (SCH_COMPONENT*) t; component->m_Field[REFERENCE].m_Text = component->GetRef( this ); component->m_Multi = component->GetUnitSelection( this ); } t = t->Pnext; } printf( "on sheet: %s \n", CONV_TO_UTF8( PathHumanReadable() ) ); } Loading
eeschema/class_drawsheet.h +16 −1 Original line number Diff line number Diff line Loading @@ -127,7 +127,7 @@ public: /* class to handle a series of sheets *********/ /* a 'path' so to speak.. *********************/ /**********************************************/ #define DSLSZ 32 #define DSLSZ 32 // Max number of levels for a sheet path class DrawSheetPath { public: Loading @@ -143,8 +143,23 @@ public: EDA_BaseStruct* LastDrawList(); void Push( DrawSheetStruct* sheet ); DrawSheetStruct* Pop(); /** Function Path * the path uses the time stamps which do not changes even when editing sheet parameters * a path is something like / (root) or /34005677 or /34005677/00AE4523 */ wxString Path(); /** Function PathHumanReadable * Return the sheet path in a readable form, i.e. * as a path made from sheet names. * (the "normal" path uses the time stamps which do not changes even when editing sheet parameters) */ wxString PathHumanReadable(); /** Function UpdateAllScreenReferences * Update the reference and the m_Multi parameter (part selection) for all components on a screen * depending on the actual sheet path. * Mandatory in complex hierarchies because sheets use the same screen (basic schematic) * but with different references and part selection according to the displayed sheet */ void UpdateAllScreenReferences(); bool operator =( const DrawSheetPath& d1 ); Loading
eeschema/component_class.cpp +84 −15 Original line number Diff line number Diff line Loading @@ -27,12 +27,14 @@ WX_DEFINE_OBJARRAY( ArrayOfSheetLists ); /** Function AddHierarchicalReference * Add a full hierachical reference (path + local reference) * @param path = hierarchical path (/<sheet timestamp>/component timestamp> like /05678E50/A23EF560) * @param ref = local reference like C45, R56 * @param aPath = hierarchical path (/<sheet timestamp>/component timestamp> like /05678E50/A23EF560) * @param aRef = local reference like C45, R56 * @param aMulti = part selection, used in multi part per package (0 or 1 for non multi) */ void SCH_COMPONENT::AddHierarchicalReference( const wxString& path, const wxString& ref ) void SCH_COMPONENT::AddHierarchicalReference( const wxString& aPath, const wxString& aRef, int aMulti ) { wxString h_path, h_ref; wxStringTokenizer tokenizer; wxString separators( wxT( " " ) ); Loading @@ -42,16 +44,16 @@ void SCH_COMPONENT::AddHierarchicalReference( const wxString& path, const wxStri { tokenizer.SetString( m_PathsAndReferences[ii], separators ); h_path = tokenizer.GetNextToken(); if( h_path.Cmp( path ) == 0 ) if( h_path.Cmp( aPath ) == 0 ) { m_PathsAndReferences.RemoveAt( ii ); ii--; } } h_ref = path + wxT( " " ) + ref; h_ref = aPath + wxT( " " ) + aRef; h_ref << wxT( " " ) << m_Multi; h_ref << wxT( " " ) << aMulti; m_PathsAndReferences.Add( h_ref ); } Loading Loading @@ -156,16 +158,15 @@ const wxString SCH_COMPONENT::GetRef( DrawSheetPath* sheet ) void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref ) /***********************************************************************/ { //check to see if it is already there before inserting it wxString path = GetPath( sheet ); // printf( "SetRef path: %s ref: %s\n", CONV_TO_UTF8( path ), CONV_TO_UTF8( ref ) ); // Debug bool notInArray = true; wxString h_path, h_ref; wxStringTokenizer tokenizer; wxString separators( wxT( " " ) ); //check to see if it is already there before inserting it for( unsigned ii = 0; ii<m_PathsAndReferences.GetCount(); ii++ ) { tokenizer.SetString( m_PathsAndReferences[ii], separators ); Loading @@ -184,7 +185,7 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref ) } if( notInArray ) AddHierarchicalReference( path, ref ); AddHierarchicalReference( path, ref, m_Multi ); if( m_Field[REFERENCE].m_Text.IsEmpty() || ( abs( m_Field[REFERENCE].m_Pos.x - m_Pos.x ) + Loading @@ -199,6 +200,74 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref ) } /***********************************************************/ int SCH_COMPONENT::GetUnitSelection( DrawSheetPath* aSheet ) /***********************************************************/ //returns the unit selection, for the given sheet path. { wxString path = GetPath( aSheet ); wxString h_path, h_multi; wxStringTokenizer tokenizer; wxString separators( wxT( " " ) ); for( unsigned ii = 0; ii<m_PathsAndReferences.GetCount(); ii++ ) { tokenizer.SetString( m_PathsAndReferences[ii], separators ); h_path = tokenizer.GetNextToken(); if( h_path.Cmp( path ) == 0 ) { tokenizer.GetNextToken(); // Skip reference h_multi = tokenizer.GetNextToken(); long imulti = 1; h_multi.ToLong( &imulti ); return imulti; } } //if it was not found in m_Paths array, then use m_Multi. // this will happen if we load a version 1 schematic file. return m_Multi; } /********************************************************************************/ void SCH_COMPONENT::SetUnitSelection( DrawSheetPath* aSheet, int aUnitSelection ) /********************************************************************************/ //Set the unit selection, for the given sheet path. { wxString path = GetPath( aSheet ); bool notInArray = true; wxString h_path, h_ref; wxStringTokenizer tokenizer; wxString separators( wxT( " " ) ); //check to see if it is already there before inserting it for( unsigned ii = 0; ii<m_PathsAndReferences.GetCount(); ii++ ) { tokenizer.SetString( m_PathsAndReferences[ii], separators ); h_path = tokenizer.GetNextToken(); if( h_path.Cmp( path ) == 0 ) { //just update the unit selection. h_ref = h_path + wxT( " " ); h_ref += tokenizer.GetNextToken(); // Add reference h_ref += wxT( " " ); h_ref << aUnitSelection; // Add part selection // Ann the part selection m_PathsAndReferences[ii] = h_ref; notInArray = false; } } if( notInArray ) AddHierarchicalReference( path, m_PrefixString, aUnitSelection ); } /******************************************************************/ const wxString& SCH_COMPONENT::GetFieldValue( int aFieldNdx ) const /******************************************************************/ Loading