Cleanups
* coding standard fixes * library part not library component (no such thing as a library component) * string concatenation fix * and an inline harmless debug/dump function
This commit is contained in:
parent
c11b0cef99
commit
e47f0df068
|
@ -187,14 +187,14 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
|
|||
int SCH_EDIT_FRAME::CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOnly )
|
||||
{
|
||||
// build the screen list
|
||||
SCH_SHEET_LIST SheetList( g_RootSheet );
|
||||
SCH_REFERENCE_LIST ComponentsList;
|
||||
SCH_SHEET_LIST sheetList( g_RootSheet );
|
||||
SCH_REFERENCE_LIST componentsList;
|
||||
|
||||
// Build the list of components
|
||||
if( !aOneSheetOnly )
|
||||
SheetList.GetComponents( Prj().SchLibs(), ComponentsList );
|
||||
sheetList.GetComponents( Prj().SchLibs(), componentsList );
|
||||
else
|
||||
m_CurrentSheet->GetComponents( Prj().SchLibs(), ComponentsList );
|
||||
m_CurrentSheet->GetComponents( Prj().SchLibs(), componentsList );
|
||||
|
||||
return ComponentsList.CheckAnnotation( aMessageList );
|
||||
return componentsList.CheckAnnotation( aMessageList );
|
||||
}
|
||||
|
|
|
@ -373,7 +373,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId,
|
|||
}
|
||||
|
||||
// Annotation of one part per package components (trivial case).
|
||||
if( componentFlatList[ii].GetLibComponent()->GetUnitCount() <= 1 )
|
||||
if( componentFlatList[ii].GetLibPart()->GetUnitCount() <= 1 )
|
||||
{
|
||||
if( componentFlatList[ii].m_IsNew )
|
||||
{
|
||||
|
@ -392,7 +392,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId,
|
|||
}
|
||||
|
||||
// Annotation of multi-unit parts ( n units per part ) (complex case)
|
||||
NumberOfUnits = componentFlatList[ii].GetLibComponent()->GetUnitCount();
|
||||
NumberOfUnits = componentFlatList[ii].GetLibPart()->GetUnitCount();
|
||||
|
||||
if( componentFlatList[ii].m_IsNew )
|
||||
{
|
||||
|
@ -540,7 +540,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList )
|
|||
// Error if unit number selected does not exist ( greater than the number of
|
||||
// parts in the component ). This can happen if a component has changed in a
|
||||
// library after a previous annotation.
|
||||
if( std::max( componentFlatList[ii].GetLibComponent()->GetUnitCount(), 1 )
|
||||
if( std::max( componentFlatList[ii].GetLibPart()->GetUnitCount(), 1 )
|
||||
< componentFlatList[ii].m_Unit )
|
||||
{
|
||||
if( componentFlatList[ii].m_NumRef >= 0 )
|
||||
|
@ -552,7 +552,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList )
|
|||
GetChars( componentFlatList[ii].GetRef() ),
|
||||
GetChars( tmp ),
|
||||
componentFlatList[ii].m_Unit,
|
||||
componentFlatList[ii].GetLibComponent()->GetUnitCount() );
|
||||
componentFlatList[ii].GetLibPart()->GetUnitCount() );
|
||||
|
||||
if( aMessageList )
|
||||
aMessageList->Add( msg );
|
||||
|
@ -609,8 +609,8 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList )
|
|||
|
||||
/* Test error if units are different but number of parts per package
|
||||
* too high (ex U3 ( 1 part) and we find U3B this is an error) */
|
||||
if( componentFlatList[ii].GetLibComponent()->GetUnitCount()
|
||||
!= componentFlatList[ii + 1].GetLibComponent()->GetUnitCount() )
|
||||
if( componentFlatList[ii].GetLibPart()->GetUnitCount()
|
||||
!= componentFlatList[ii + 1].GetLibPart()->GetUnitCount() )
|
||||
{
|
||||
if( componentFlatList[ii].m_NumRef >= 0 )
|
||||
tmp << componentFlatList[ii].m_NumRef;
|
||||
|
@ -694,13 +694,13 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList )
|
|||
}
|
||||
|
||||
|
||||
SCH_REFERENCE::SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_PART* aLibComponent,
|
||||
SCH_REFERENCE::SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_PART* aLibPart,
|
||||
SCH_SHEET_PATH& aSheetPath )
|
||||
{
|
||||
wxASSERT( aComponent != NULL && aLibComponent != NULL );
|
||||
wxASSERT( aComponent != NULL && aLibPart != NULL );
|
||||
|
||||
m_RootCmp = aComponent;
|
||||
m_Entry = aLibComponent;
|
||||
m_Entry = aLibPart;
|
||||
m_Unit = aComponent->GetUnitSelection( &aSheetPath );
|
||||
m_SheetPath = aSheetPath;
|
||||
m_IsNew = false;
|
||||
|
@ -712,7 +712,8 @@ SCH_REFERENCE::SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_PART* aLibComp
|
|||
if( aComponent->GetRef( &aSheetPath ).IsEmpty() )
|
||||
aComponent->SetRef( &aSheetPath, wxT( "DefRef?" ) );
|
||||
|
||||
SetRef( aComponent->GetRef( &aSheetPath ) );
|
||||
wxString ref = aComponent->GetRef( &aSheetPath );
|
||||
SetRef( ref );
|
||||
|
||||
m_NumRef = -1;
|
||||
|
||||
|
|
|
@ -529,7 +529,8 @@ void SCH_COMPONENT::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref )
|
|||
h_ref += wxT( " " );
|
||||
tokenizer.GetNextToken(); // Skip old reference
|
||||
h_ref += tokenizer.GetNextToken(); // Add part selection
|
||||
// Ann the part selection
|
||||
|
||||
// Add the part selection
|
||||
m_PathsAndReferences[ii] = h_ref;
|
||||
notInArray = false;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class SCH_REFERENCE
|
|||
bool m_IsNew; ///< True if not yet annotated.
|
||||
int m_SheetNum; ///< The sheet number for the reference.
|
||||
time_t m_TimeStamp; ///< The time stamp for the reference.
|
||||
EDA_TEXT* m_Value; ///< The component value of the refernce. It is the
|
||||
EDA_TEXT* m_Value; ///< The component value of the reference. It is the
|
||||
///< same for all instances.
|
||||
int m_NumRef; ///< The numeric part of the reference designator.
|
||||
int m_Flag;
|
||||
|
@ -90,12 +90,12 @@ public:
|
|||
m_SheetNum = 0;
|
||||
}
|
||||
|
||||
SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_PART* aLibComponent,
|
||||
SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_PART* aLibComponent,
|
||||
SCH_SHEET_PATH& aSheetPath );
|
||||
|
||||
SCH_COMPONENT* GetComp() const { return m_RootCmp; }
|
||||
|
||||
LIB_PART* GetLibComponent() const { return m_Entry; }
|
||||
LIB_PART* GetLibPart() const { return m_Entry; }
|
||||
|
||||
SCH_SHEET_PATH GetSheetPath() const { return m_SheetPath; }
|
||||
|
||||
|
@ -438,6 +438,25 @@ public:
|
|||
*/
|
||||
int GetLastReference( int aIndex, int aMinValue );
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( const char* aPrefix = "" )
|
||||
{
|
||||
printf( "%s\n", aPrefix );
|
||||
|
||||
for( unsigned i=0; i<componentFlatList.size(); ++i )
|
||||
{
|
||||
SCH_REFERENCE& schref = componentFlatList[i];
|
||||
|
||||
printf( " [%-2d] ref:%-8s num:%-3d lib_part:%s\n",
|
||||
i,
|
||||
schref.m_Ref.c_str(),
|
||||
schref.m_NumRef,
|
||||
TO_UTF8( schref.GetLibPart()->GetName() )
|
||||
);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
/* sort functions used to sort componentFlatList
|
||||
*/
|
||||
|
|
|
@ -595,6 +595,6 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
typedef std::vector< SCH_SHEET* > SCH_SHEETS;
|
||||
typedef std::vector< SCH_SHEET* > SCH_SHEETS; // no ownership over contained SCH_SHEETs
|
||||
|
||||
#endif /* SCH_SHEEET_H */
|
||||
#endif // SCH_SHEEET_H
|
||||
|
|
|
@ -207,7 +207,7 @@ void SCH_SHEET_PATH::AnnotatePowerSymbols( PART_LIBS* aLibs, int* aReference )
|
|||
refstr.RemoveLast();
|
||||
|
||||
if( !refstr.StartsWith( wxT( "#" ) ) )
|
||||
refstr = wxT( "#" ) + refstr;
|
||||
refstr.insert( refstr.begin(), wxChar( '#' ) );
|
||||
|
||||
refstr << wxT( "0" ) << ref;
|
||||
component->SetRef( this, refstr );
|
||||
|
@ -237,7 +237,8 @@ void SCH_SHEET_PATH::GetComponents( PART_LIBS* aLibs, SCH_REFERENCE_LIST& aRefer
|
|||
|
||||
if( part )
|
||||
{
|
||||
SCH_REFERENCE reference = SCH_REFERENCE( component, part, *this );
|
||||
SCH_REFERENCE reference( component, part, *this );
|
||||
|
||||
reference.SetSheetNumber( m_pageNumber );
|
||||
aReferences.AddItem( reference );
|
||||
}
|
||||
|
@ -247,7 +248,7 @@ void SCH_SHEET_PATH::GetComponents( PART_LIBS* aLibs, SCH_REFERENCE_LIST& aRefer
|
|||
|
||||
|
||||
void SCH_SHEET_PATH::GetMultiUnitComponents( PART_LIBS* aLibs,
|
||||
SCH_MULTI_UNIT_REFERENCE_MAP &aRefList,
|
||||
SCH_MULTI_UNIT_REFERENCE_MAP& aRefList,
|
||||
bool aIncludePowerSymbols )
|
||||
{
|
||||
|
||||
|
|
Loading…
Reference in New Issue