Undo commit -r6509.
This commit is contained in:
parent
663394749d
commit
5a5fffb349
|
@ -49,7 +49,6 @@ class SCH_SHEET_PIN;
|
||||||
class SCH_LINE;
|
class SCH_LINE;
|
||||||
class SCH_TEXT;
|
class SCH_TEXT;
|
||||||
class PLOTTER;
|
class PLOTTER;
|
||||||
class SCH_SHEET;
|
|
||||||
|
|
||||||
|
|
||||||
enum SCH_LINE_TEST_T
|
enum SCH_LINE_TEST_T
|
||||||
|
@ -501,13 +500,13 @@ public:
|
||||||
* searches screen for a component with \a aReference and set the footprint field to
|
* searches screen for a component with \a aReference and set the footprint field to
|
||||||
* \a aFootPrint if found.
|
* \a aFootPrint if found.
|
||||||
*
|
*
|
||||||
* @param aSheet The sheet used to look up the reference designator.
|
* @param aSheetPath The sheet path used to look up the reference designator.
|
||||||
* @param aReference The reference designator of the component.
|
* @param aReference The reference designator of the component.
|
||||||
* @param aFootPrint The value to set the footprint field.
|
* @param aFootPrint The value to set the footprint field.
|
||||||
* @param aSetVisible The value to set the field visibility flag.
|
* @param aSetVisible The value to set the field visibility flag.
|
||||||
* @return True if \a aReference was found otherwise false.
|
* @return True if \a aReference was found otherwise false.
|
||||||
*/
|
*/
|
||||||
bool SetComponentFootprint( SCH_SHEET* aSheet, const wxString& aReference,
|
bool SetComponentFootprint( SCH_SHEET_PATH* aSheetPath, const wxString& aReference,
|
||||||
const wxString& aFootPrint, bool aSetVisible );
|
const wxString& aFootPrint, bool aSetVisible );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -71,8 +71,7 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
|
||||||
if( event.GetFlags() & FR_CURRENT_SHEET_ONLY )
|
if( event.GetFlags() & FR_CURRENT_SHEET_ONLY )
|
||||||
{
|
{
|
||||||
sheetFoundIn = m_CurrentSheet;
|
sheetFoundIn = m_CurrentSheet;
|
||||||
lastMarker = (SCH_MARKER*) m_CurrentSheet->Last()->FindNextItem( SCH_MARKER_T,
|
lastMarker = (SCH_MARKER*) m_CurrentSheet->FindNextItem( SCH_MARKER_T, lastMarker, wrap );
|
||||||
lastMarker, wrap );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1103,7 +1103,7 @@ SCH_TEXT* SCH_SCREEN::GetLabel( const wxPoint& aPosition, int aAccuracy )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SCH_SCREEN::SetComponentFootprint( SCH_SHEET* aSheet, const wxString& aReference,
|
bool SCH_SCREEN::SetComponentFootprint( SCH_SHEET_PATH* aSheetPath, const wxString& aReference,
|
||||||
const wxString& aFootPrint, bool aSetVisible )
|
const wxString& aFootPrint, bool aSetVisible )
|
||||||
{
|
{
|
||||||
SCH_COMPONENT* component;
|
SCH_COMPONENT* component;
|
||||||
|
@ -1116,7 +1116,7 @@ bool SCH_SCREEN::SetComponentFootprint( SCH_SHEET* aSheet, const wxString& aRefe
|
||||||
|
|
||||||
component = (SCH_COMPONENT*) item;
|
component = (SCH_COMPONENT*) item;
|
||||||
|
|
||||||
if( aReference.CmpNoCase( component->GetRef( aSheet ) ) == 0 )
|
if( aReference.CmpNoCase( component->GetRef( aSheetPath->Last() ) ) == 0 )
|
||||||
{
|
{
|
||||||
// Found: Init Footprint Field
|
// Found: Init Footprint Field
|
||||||
|
|
||||||
|
@ -1125,7 +1125,6 @@ bool SCH_SCREEN::SetComponentFootprint( SCH_SHEET* aSheet, const wxString& aRefe
|
||||||
* it is probably not yet initialized
|
* it is probably not yet initialized
|
||||||
*/
|
*/
|
||||||
SCH_FIELD * fpfield = component->GetField( FOOTPRINT );
|
SCH_FIELD * fpfield = component->GetField( FOOTPRINT );
|
||||||
|
|
||||||
if( fpfield->GetText().IsEmpty()
|
if( fpfield->GetText().IsEmpty()
|
||||||
&& ( fpfield->GetTextPosition() == component->GetPosition() ) )
|
&& ( fpfield->GetTextPosition() == component->GetPosition() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -811,11 +811,6 @@ void SCH_SHEET::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "File Name" ), m_fileName, BROWN ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "File Name" ), m_fileName, BROWN ) );
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Path" ), GetHumanReadablePath(), DARKMAGENTA ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Path" ), GetHumanReadablePath(), DARKMAGENTA ) );
|
||||||
|
|
||||||
if( IsRootSheet() )
|
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Hierarchy Type" ),
|
|
||||||
IsComplexHierarchy() ? _( "Complex" ) : _( "Simple" ),
|
|
||||||
GREEN ) );
|
|
||||||
|
|
||||||
#if 1 // Set to 1 to display the sheet time stamp (mainly for test)
|
#if 1 // Set to 1 to display the sheet time stamp (mainly for test)
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Time Stamp" ), GetPath(), BLUE ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Time Stamp" ), GetPath(), BLUE ) );
|
||||||
#endif
|
#endif
|
||||||
|
@ -1166,27 +1161,6 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned SCH_SHEET::GetSheets( std::vector<const SCH_SHEET*>& aSheetList ) const
|
|
||||||
{
|
|
||||||
// Sheet pointers must be unique.
|
|
||||||
wxASSERT( find( aSheetList.begin(), aSheetList.end(), this ) == aSheetList.end() );
|
|
||||||
|
|
||||||
aSheetList.push_back( this );
|
|
||||||
|
|
||||||
const SCH_ITEM* item = m_screen->GetDrawItems();
|
|
||||||
|
|
||||||
while( item )
|
|
||||||
{
|
|
||||||
if( item->Type() == SCH_SHEET_T )
|
|
||||||
( (SCH_SHEET*) item )->GetSheets( aSheetList );
|
|
||||||
|
|
||||||
item = item->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
return aSheetList.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SCH_SHEET* SCH_SHEET::GetRootSheet()
|
SCH_SHEET* SCH_SHEET::GetRootSheet()
|
||||||
{
|
{
|
||||||
EDA_ITEM* parent = GetParent();
|
EDA_ITEM* parent = GetParent();
|
||||||
|
@ -1489,60 +1463,6 @@ void SCH_SHEET::GetMultiUnitComponents( PART_LIBS* aLibs,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SCH_SHEET::IsComplexHierarchy() const
|
|
||||||
{
|
|
||||||
std::set<wxString> fileNames;
|
|
||||||
std::vector< const SCH_SHEET* > sheets;
|
|
||||||
|
|
||||||
unsigned count = GetSheets( sheets );
|
|
||||||
|
|
||||||
for( unsigned i = 0; i < count; i++ )
|
|
||||||
{
|
|
||||||
if( fileNames.find( sheets[i]->m_fileName ) != fileNames.end() )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
fileNames.insert( sheets[i]->m_fileName );
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SCH_ITEM* SCH_SHEET::FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) const
|
|
||||||
{
|
|
||||||
wxCHECK( m_screen != NULL, NULL );
|
|
||||||
|
|
||||||
bool hasWrapped = false;
|
|
||||||
bool firstItemFound = false;
|
|
||||||
SCH_ITEM* drawItem = m_screen->GetDrawItems();
|
|
||||||
|
|
||||||
while( drawItem )
|
|
||||||
{
|
|
||||||
if( drawItem->Type() == aType )
|
|
||||||
{
|
|
||||||
if( !aLastItem || firstItemFound )
|
|
||||||
{
|
|
||||||
return drawItem;
|
|
||||||
}
|
|
||||||
else if( !firstItemFound && drawItem == aLastItem )
|
|
||||||
{
|
|
||||||
firstItemFound = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
drawItem = drawItem->Next();
|
|
||||||
|
|
||||||
if( !drawItem && aLastItem && aWrap && !hasWrapped )
|
|
||||||
{
|
|
||||||
hasWrapped = true;
|
|
||||||
drawItem = m_screen->GetDrawItems();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool SCH_SHEET::operator<( const SCH_SHEET& aRhs ) const
|
bool SCH_SHEET::operator<( const SCH_SHEET& aRhs ) const
|
||||||
{
|
{
|
||||||
if( (*this - aRhs) < 0 )
|
if( (*this - aRhs) < 0 )
|
||||||
|
|
|
@ -589,16 +589,6 @@ public:
|
||||||
|
|
||||||
EDA_ITEM* Clone() const;
|
EDA_ITEM* Clone() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GetSheets
|
|
||||||
*
|
|
||||||
* add the point to #SCH_SHEET and all of it's sub-sheets to \a aSheetList.
|
|
||||||
*
|
|
||||||
* @param aSheetList is a reference to a set containing the #SCH_SHEET pointers.
|
|
||||||
* @return the number of #SCH_SHEET object pointers in \a aSheetList.
|
|
||||||
*/
|
|
||||||
unsigned GetSheets( std::vector<const SCH_SHEET*>& aSheetList ) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetRootSheet
|
* Function GetRootSheet
|
||||||
*
|
*
|
||||||
|
@ -723,30 +713,6 @@ public:
|
||||||
void GetMultiUnitComponents( PART_LIBS* aLibs, SCH_MULTI_UNIT_REFERENCE_MAP& aRefList,
|
void GetMultiUnitComponents( PART_LIBS* aLibs, SCH_MULTI_UNIT_REFERENCE_MAP& aRefList,
|
||||||
bool aIncludePowerSymbols = true );
|
bool aIncludePowerSymbols = true );
|
||||||
|
|
||||||
/**
|
|
||||||
* Function IsComplexHierarchy
|
|
||||||
* searches all of the sheets for duplicate files names which indicates a complex
|
|
||||||
* hierarchy.
|
|
||||||
*
|
|
||||||
* Typically this function would be called from the root sheet. However, it is possible
|
|
||||||
* to test only the sub-hierarchy from any #SCH_SHEET object.
|
|
||||||
*
|
|
||||||
* @return true if the #SCH_SHEET is a complex hierarchy.
|
|
||||||
*/
|
|
||||||
bool IsComplexHierarchy() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find the next schematic item in this sheet object.
|
|
||||||
*
|
|
||||||
* @param aType - The type of schematic item object to search for.
|
|
||||||
* @param aLastItem - Start search from aLastItem. If no aLastItem, search from
|
|
||||||
* the beginning of the list.
|
|
||||||
* @param aWrap - Wrap around the end of the list to find the next item if aLastItem
|
|
||||||
* is defined.
|
|
||||||
* @return - The next schematic item if found. Otherwise, NULL is returned.
|
|
||||||
*/
|
|
||||||
SCH_ITEM* FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem = NULL, bool aWrap = false ) const;
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void Show( int nestLevel, std::ostream& os ) const; // override
|
void Show( int nestLevel, std::ostream& os ) const; // override
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -227,6 +227,39 @@ wxString SCH_SHEET_PATH::PathHumanReadable() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SCH_ITEM* SCH_SHEET_PATH::FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) const
|
||||||
|
{
|
||||||
|
bool hasWrapped = false;
|
||||||
|
bool firstItemFound = false;
|
||||||
|
SCH_ITEM* drawItem = LastDrawList();
|
||||||
|
|
||||||
|
while( drawItem )
|
||||||
|
{
|
||||||
|
if( drawItem->Type() == aType )
|
||||||
|
{
|
||||||
|
if( !aLastItem || firstItemFound )
|
||||||
|
{
|
||||||
|
return drawItem;
|
||||||
|
}
|
||||||
|
else if( !firstItemFound && drawItem == aLastItem )
|
||||||
|
{
|
||||||
|
firstItemFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
drawItem = drawItem->Next();
|
||||||
|
|
||||||
|
if( !drawItem && aLastItem && aWrap && !hasWrapped )
|
||||||
|
{
|
||||||
|
hasWrapped = true;
|
||||||
|
drawItem = LastDrawList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_ITEM* SCH_SHEET_PATH::FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) const
|
SCH_ITEM* SCH_SHEET_PATH::FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) const
|
||||||
{
|
{
|
||||||
bool hasWrapped = false;
|
bool hasWrapped = false;
|
||||||
|
@ -260,6 +293,18 @@ SCH_ITEM* SCH_SHEET_PATH::FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SCH_SHEET_PATH::SetComponentFootprint( const wxString& aReference, const wxString& aFootPrint,
|
||||||
|
bool aSetVisible )
|
||||||
|
{
|
||||||
|
SCH_SCREEN* screen = LastScreen();
|
||||||
|
|
||||||
|
if( screen == NULL )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return screen->SetComponentFootprint( this, aReference, aFootPrint, aSetVisible );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_SHEET_PATH& SCH_SHEET_PATH::operator=( const SCH_SHEET_PATH& d1 )
|
SCH_SHEET_PATH& SCH_SHEET_PATH::operator=( const SCH_SHEET_PATH& d1 )
|
||||||
{
|
{
|
||||||
if( this == &d1 ) // Self assignment is bad!
|
if( this == &d1 ) // Self assignment is bad!
|
||||||
|
@ -600,6 +645,40 @@ SCH_ITEM* SCH_SHEET_LIST::FindPreviousItem( KICAD_T aType, SCH_SHEET_PATH** aShe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SCH_SHEET_LIST::SetComponentFootprint( const wxString& aReference,
|
||||||
|
const wxString& aFootPrint, bool aSetVisible )
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
for( SCH_SHEET_PATH* path = GetFirst(); path; path = GetNext() )
|
||||||
|
found = path->SetComponentFootprint( aReference, aFootPrint, aSetVisible );
|
||||||
|
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SCH_SHEET_LIST::IsComplexHierarchy() const
|
||||||
|
{
|
||||||
|
wxString fileName;
|
||||||
|
|
||||||
|
for( int i = 0; i < m_count; i++ )
|
||||||
|
{
|
||||||
|
fileName = m_list[i].Last()->GetFileName();
|
||||||
|
|
||||||
|
for( int j = 0; j < m_count; j++ )
|
||||||
|
{
|
||||||
|
if( i == j )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( fileName == m_list[j].Last()->GetFileName() )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SCH_SHEET_LIST::TestForRecursion( const SCH_SHEET_LIST& aSrcSheetHierarchy,
|
bool SCH_SHEET_LIST::TestForRecursion( const SCH_SHEET_LIST& aSrcSheetHierarchy,
|
||||||
const wxString& aDestFileName ) const
|
const wxString& aDestFileName ) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -208,6 +208,31 @@ public:
|
||||||
*/
|
*/
|
||||||
bool BuildSheetPathInfoFromSheetPathValue( const wxString& aPath, bool aFound = false );
|
bool BuildSheetPathInfoFromSheetPathValue( const wxString& aPath, bool aFound = false );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SetFootprintField
|
||||||
|
* searches last sheet in the path for a component with \a aReference and set the footprint
|
||||||
|
* field to \a aFootPrint if found.
|
||||||
|
*
|
||||||
|
* @param aReference The reference designator of the component.
|
||||||
|
* @param aFootPrint The value to set the footprint field.
|
||||||
|
* @param aSetVisible The value to set the field visibility flag.
|
||||||
|
* @return True if \a aReference was found otherwise false.
|
||||||
|
*/
|
||||||
|
bool SetComponentFootprint( const wxString& aReference, const wxString& aFootPrint,
|
||||||
|
bool aSetVisible );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the next schematic item in this sheet object.
|
||||||
|
*
|
||||||
|
* @param aType - The type of schematic item object to search for.
|
||||||
|
* @param aLastItem - Start search from aLastItem. If no aLastItem, search from
|
||||||
|
* the beginning of the list.
|
||||||
|
* @param aWrap - Wrap around the end of the list to find the next item if aLastItem
|
||||||
|
* is defined.
|
||||||
|
* @return - The next schematic item if found. Otherwise, NULL is returned.
|
||||||
|
*/
|
||||||
|
SCH_ITEM* FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem = NULL, bool aWrap = false ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the previous schematic item in this sheet path object.
|
* Find the previous schematic item in this sheet path object.
|
||||||
*
|
*
|
||||||
|
@ -388,6 +413,28 @@ public:
|
||||||
SCH_ITEM* FindPreviousItem( KICAD_T aType, SCH_SHEET_PATH** aSheetFound = NULL,
|
SCH_ITEM* FindPreviousItem( KICAD_T aType, SCH_SHEET_PATH** aSheetFound = NULL,
|
||||||
SCH_ITEM* aLastItem = NULL, bool aWrap = true );
|
SCH_ITEM* aLastItem = NULL, bool aWrap = true );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SetFootprintField
|
||||||
|
* searches all the sheets for a component with \a aReference and set the footprint
|
||||||
|
* field to \a aFootPrint if found.
|
||||||
|
*
|
||||||
|
* @param aReference The reference designator of the component.
|
||||||
|
* @param aFootPrint The value to set the footprint field.
|
||||||
|
* @param aSetVisible The value to set the field visibility flag.
|
||||||
|
* @return True if \a aReference was found otherwise false.
|
||||||
|
*/
|
||||||
|
bool SetComponentFootprint( const wxString& aReference, const wxString& aFootPrint,
|
||||||
|
bool aSetVisible );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function IsComplexHierarchy
|
||||||
|
* searches all of the sheets for duplicate files names which indicates a complex
|
||||||
|
* hierarchy.
|
||||||
|
*
|
||||||
|
* @return true if the #SCH_SHEET_LIST is a complex hierarchy.
|
||||||
|
*/
|
||||||
|
bool IsComplexHierarchy() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function TestForRecursion
|
* Function TestForRecursion
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue