2011-10-15 13:25:57 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2017-04-12 06:18:46 +00:00
|
|
|
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2017-10-06 18:07:43 +00:00
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
2017-04-12 06:18:46 +00:00
|
|
|
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-15 13:25:57 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2018-01-30 08:56:43 +00:00
|
|
|
#include <sch_screen.h>
|
2019-05-10 19:57:24 +00:00
|
|
|
#include <sch_item.h>
|
2020-04-24 13:36:10 +00:00
|
|
|
#include <sch_marker.h>
|
2015-02-21 08:11:58 +00:00
|
|
|
#include <sch_reference_list.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_library.h>
|
|
|
|
#include <sch_sheet_path.h>
|
|
|
|
#include <sch_component.h>
|
2019-03-11 21:32:05 +00:00
|
|
|
#include <sch_sheet.h>
|
2020-05-13 02:00:37 +00:00
|
|
|
#include <schematic.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <template_fieldnames.h>
|
2020-04-26 20:53:29 +00:00
|
|
|
#include <trace_helpers.h>
|
|
|
|
|
2019-03-11 21:32:05 +00:00
|
|
|
#include <boost/functional/hash.hpp>
|
2015-06-07 20:31:55 +00:00
|
|
|
#include <wx/filename.h>
|
2020-04-24 13:36:10 +00:00
|
|
|
#include "erc_item.h"
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2020-06-17 12:46:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A singleton item of this class is returned for a weak reference that no longer exists.
|
|
|
|
* Its sole purpose is to flag the item as having been deleted.
|
|
|
|
*/
|
|
|
|
class DELETED_SHEET_ITEM : public SCH_ITEM
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DELETED_SHEET_ITEM() :
|
|
|
|
SCH_ITEM( nullptr, NOT_USED )
|
|
|
|
{}
|
|
|
|
|
|
|
|
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
|
|
|
|
{
|
|
|
|
return _( "(Deleted Item)" );
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString GetClass() const override
|
|
|
|
{
|
|
|
|
return wxT( "DELETED_SHEET_ITEM" );
|
|
|
|
}
|
|
|
|
|
|
|
|
// pure virtuals:
|
|
|
|
void SetPosition( const wxPoint& ) override {}
|
|
|
|
void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override {}
|
|
|
|
void Move( const wxPoint& aMoveVector ) override {}
|
|
|
|
void MirrorY( int aYaxis_position ) override {}
|
|
|
|
void MirrorX( int aXaxis_position ) override {}
|
|
|
|
void Rotate( wxPoint aPosition ) override {}
|
|
|
|
|
|
|
|
#if defined(DEBUG)
|
|
|
|
void Show( int , std::ostream& ) const override {}
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
DELETED_SHEET_ITEM* g_DeletedItem = nullptr;
|
|
|
|
|
|
|
|
|
2019-03-11 21:32:05 +00:00
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
size_t hash<SCH_SHEET_PATH>::operator()( const SCH_SHEET_PATH& path ) const
|
|
|
|
{
|
2019-04-09 03:27:04 +00:00
|
|
|
return path.GetCurrentHash();
|
2019-03-11 21:32:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_PATH::SCH_SHEET_PATH()
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2016-02-27 19:35:45 +00:00
|
|
|
m_pageNumber = 0;
|
2019-04-09 03:27:04 +00:00
|
|
|
m_current_hash = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SCH_SHEET_PATH::Rehash()
|
|
|
|
{
|
|
|
|
m_current_hash = 0;
|
|
|
|
|
|
|
|
for( auto sheet : m_sheets )
|
2020-02-20 12:11:04 +00:00
|
|
|
boost::hash_combine( m_current_hash, sheet->m_Uuid.Hash() );
|
2009-01-07 20:09:03 +00:00
|
|
|
}
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
int SCH_SHEET_PATH::Cmp( const SCH_SHEET_PATH& aSheetPathToTest ) const
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2016-02-27 19:35:45 +00:00
|
|
|
if( size() > aSheetPathToTest.size() )
|
2009-01-04 18:52:57 +00:00
|
|
|
return 1;
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2016-02-27 19:35:45 +00:00
|
|
|
if( size() < aSheetPathToTest.size() )
|
2009-01-04 18:52:57 +00:00
|
|
|
return -1;
|
|
|
|
|
2011-01-23 21:22:42 +00:00
|
|
|
//otherwise, same number of sheets.
|
2016-02-27 19:35:45 +00:00
|
|
|
for( unsigned i = 0; i < size(); i++ )
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2020-02-20 12:11:04 +00:00
|
|
|
if( at( i )->m_Uuid < aSheetPathToTest.at( i )->m_Uuid )
|
2009-01-04 18:52:57 +00:00
|
|
|
return -1;
|
2020-02-20 12:11:04 +00:00
|
|
|
|
|
|
|
if( at( i )->m_Uuid != aSheetPathToTest.at( i )->m_Uuid )
|
|
|
|
return 1;
|
2009-01-04 18:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-30 19:16:22 +00:00
|
|
|
SCH_SHEET* SCH_SHEET_PATH::Last() const
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2016-02-27 19:35:45 +00:00
|
|
|
if( !empty() )
|
2019-06-25 23:39:58 +00:00
|
|
|
return m_sheets.back();
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
return nullptr;
|
2009-01-04 18:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
SCH_SCREEN* SCH_SHEET_PATH::LastScreen()
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2010-04-01 13:15:48 +00:00
|
|
|
SCH_SHEET* lastSheet = Last();
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2010-04-01 13:15:48 +00:00
|
|
|
if( lastSheet )
|
2011-01-20 16:34:57 +00:00
|
|
|
return lastSheet->GetScreen();
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
return nullptr;
|
2009-01-04 18:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
SCH_SCREEN* SCH_SHEET_PATH::LastScreen() const
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2011-01-23 21:22:42 +00:00
|
|
|
SCH_SHEET* lastSheet = Last();
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
if( lastSheet )
|
|
|
|
return lastSheet->GetScreen();
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
return nullptr;
|
2010-03-16 18:22:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-22 21:39:59 +00:00
|
|
|
wxString SCH_SHEET_PATH::PathAsString() const
|
2009-12-02 21:44:03 +00:00
|
|
|
{
|
2020-02-20 12:11:04 +00:00
|
|
|
wxString s;
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2009-01-06 20:09:32 +00:00
|
|
|
s = wxT( "/" ); // This is the root path
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2019-06-17 15:59:39 +00:00
|
|
|
// Start at 1 to avoid the root sheet, which does not need to be added to the path.
|
|
|
|
// It's timestamp changes anyway.
|
2016-02-27 19:35:45 +00:00
|
|
|
for( unsigned i = 1; i < size(); i++ )
|
2020-02-21 23:18:43 +00:00
|
|
|
s += at( i )->m_Uuid.AsString() + "/";
|
2009-01-04 18:52:57 +00:00
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-22 21:39:59 +00:00
|
|
|
KIID_PATH SCH_SHEET_PATH::Path() const
|
|
|
|
{
|
|
|
|
KIID_PATH path;
|
|
|
|
|
|
|
|
for( const SCH_SHEET* sheet : m_sheets )
|
|
|
|
path.push_back( sheet->m_Uuid );
|
|
|
|
|
|
|
|
return path;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-23 17:37:21 +00:00
|
|
|
wxString SCH_SHEET_PATH::GetRootPathName( bool aUseShortName )
|
|
|
|
{
|
|
|
|
// return a PathName for the root sheet (like "/" or "<root>"
|
|
|
|
// DO NOT use it in netlists, because it can easily break these netlists
|
|
|
|
// especially after translation, because many netlists (i.e. spice) do not accept any char
|
|
|
|
// Use only the short name ("/") and the full name only in messages
|
|
|
|
return aUseShortName ? wxT( "/" ) : _( "<root_sheet>" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-08-03 02:13:33 +00:00
|
|
|
wxString SCH_SHEET_PATH::PathHumanReadable() const
|
2009-12-02 21:44:03 +00:00
|
|
|
{
|
2015-11-03 19:44:05 +00:00
|
|
|
wxString s;
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2019-06-17 15:59:39 +00:00
|
|
|
if( size() == 1 )
|
2019-06-23 17:37:21 +00:00
|
|
|
return GetRootPathName( true ); // Use only the short name in netlists
|
2019-06-17 15:59:39 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
s = wxT( "/" );
|
|
|
|
|
2019-06-17 15:59:39 +00:00
|
|
|
// Start at 1 to avoid the root sheet, as above.
|
2016-02-27 19:35:45 +00:00
|
|
|
for( unsigned i = 1; i < size(); i++ )
|
2020-05-03 14:52:31 +00:00
|
|
|
s = s + at( i )->GetFields()[ SHEETNAME ].GetShownText() + wxT( "/" );
|
2009-01-04 18:52:57 +00:00
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-02-15 20:17:51 +00:00
|
|
|
void SCH_SHEET_PATH::UpdateAllScreenReferences()
|
|
|
|
{
|
2019-06-25 23:39:58 +00:00
|
|
|
for( auto item : LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
|
2016-02-15 20:17:51 +00:00
|
|
|
{
|
2019-06-25 23:39:58 +00:00
|
|
|
auto component = static_cast<SCH_COMPONENT*>( item );
|
|
|
|
component->GetField( REFERENCE )->SetText( component->GetRef( this ) );
|
|
|
|
component->UpdateUnit( component->GetUnitSelection( this ) );
|
2016-02-15 20:17:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-02-15 20:18:32 +00:00
|
|
|
|
2017-11-21 17:06:37 +00:00
|
|
|
void SCH_SHEET_PATH::GetComponents( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols,
|
2020-05-12 11:53:45 +00:00
|
|
|
bool aForceIncludeOrphanComponents ) const
|
2016-02-15 20:16:54 +00:00
|
|
|
{
|
2019-06-25 23:39:58 +00:00
|
|
|
for( auto item : LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
|
2016-02-15 20:16:54 +00:00
|
|
|
{
|
2019-06-25 23:39:58 +00:00
|
|
|
auto component = static_cast<SCH_COMPONENT*>( item );
|
2016-02-15 20:16:54 +00:00
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
// Skip pseudo components, which have a reference starting with #. This mainly
|
|
|
|
// affects power symbols.
|
|
|
|
if( aIncludePowerSymbols || component->GetRef( this )[0] != wxT( '#' ) )
|
|
|
|
{
|
2019-11-06 19:15:42 +00:00
|
|
|
LIB_PART* part = component->GetPartRef().get();
|
2016-02-27 19:35:45 +00:00
|
|
|
|
2017-11-21 17:06:37 +00:00
|
|
|
if( part || aForceIncludeOrphanComponents )
|
2016-02-15 20:16:54 +00:00
|
|
|
{
|
2018-06-28 13:36:14 +00:00
|
|
|
SCH_REFERENCE schReference( component, part, *this );
|
2016-06-24 10:55:54 +00:00
|
|
|
|
2018-06-28 13:36:14 +00:00
|
|
|
schReference.SetSheetNumber( m_pageNumber );
|
|
|
|
aReferences.AddItem( schReference );
|
2016-02-15 20:16:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-15 20:14:48 +00:00
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
void SCH_SHEET_PATH::GetMultiUnitComponents( SCH_MULTI_UNIT_REFERENCE_MAP& aRefList,
|
2020-05-13 02:00:37 +00:00
|
|
|
bool aIncludePowerSymbols ) const
|
2016-02-27 19:35:45 +00:00
|
|
|
{
|
2019-06-25 23:39:58 +00:00
|
|
|
for( auto item : LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
|
2016-02-15 20:14:48 +00:00
|
|
|
{
|
2019-06-25 23:39:58 +00:00
|
|
|
auto component = static_cast<SCH_COMPONENT*>( item );
|
2016-02-15 20:14:48 +00:00
|
|
|
|
|
|
|
// Skip pseudo components, which have a reference starting with #. This mainly
|
|
|
|
// affects power symbols.
|
2016-02-15 20:17:51 +00:00
|
|
|
if( !aIncludePowerSymbols && component->GetRef( this )[0] == wxT( '#' ) )
|
2016-02-15 20:14:48 +00:00
|
|
|
continue;
|
|
|
|
|
2019-11-06 19:15:42 +00:00
|
|
|
LIB_PART* part = component->GetPartRef().get();
|
2016-02-27 19:35:45 +00:00
|
|
|
|
2016-02-15 20:14:48 +00:00
|
|
|
if( part && part->GetUnitCount() > 1 )
|
|
|
|
{
|
2018-06-28 13:36:14 +00:00
|
|
|
SCH_REFERENCE schReference = SCH_REFERENCE( component, part, *this );
|
|
|
|
schReference.SetSheetNumber( m_pageNumber );
|
|
|
|
wxString reference_str = schReference.GetRef();
|
2016-02-15 20:14:48 +00:00
|
|
|
|
|
|
|
// Never lock unassigned references
|
2016-02-27 19:35:45 +00:00
|
|
|
if( reference_str[reference_str.Len() - 1] == '?' )
|
|
|
|
continue;
|
2016-02-15 20:14:48 +00:00
|
|
|
|
2018-06-28 13:36:14 +00:00
|
|
|
aRefList[reference_str].AddItem( schReference );
|
2016-02-15 20:14:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-02-15 20:14:07 +00:00
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-08-03 02:13:33 +00:00
|
|
|
bool SCH_SHEET_PATH::operator==( const SCH_SHEET_PATH& d1 ) const
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2019-04-09 03:27:04 +00:00
|
|
|
return m_current_hash == d1.GetCurrentHash();
|
2009-01-04 18:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-29 04:03:04 +00:00
|
|
|
bool SCH_SHEET_PATH::TestForRecursion( const wxString& aSrcFileName, const wxString& aDestFileName )
|
2016-02-15 20:12:42 +00:00
|
|
|
{
|
2020-02-29 04:03:04 +00:00
|
|
|
auto pair = std::make_pair( aSrcFileName, aDestFileName );
|
|
|
|
|
|
|
|
if( m_recursion_test_cache.count( pair ) )
|
|
|
|
return m_recursion_test_cache.at( pair );
|
|
|
|
|
2020-05-13 02:00:37 +00:00
|
|
|
SCHEMATIC* sch = LastScreen()->Schematic();
|
|
|
|
|
|
|
|
wxCHECK_MSG( sch, false, "No SCHEMATIC found in SCH_SHEET_PATH::TestForRecursion!" );
|
|
|
|
|
|
|
|
wxFileName rootFn = sch->GetFileName();
|
2016-02-15 20:12:42 +00:00
|
|
|
wxFileName srcFn = aSrcFileName;
|
|
|
|
wxFileName destFn = aDestFileName;
|
|
|
|
|
|
|
|
if( srcFn.IsRelative() )
|
|
|
|
srcFn.MakeAbsolute( rootFn.GetPath() );
|
|
|
|
|
|
|
|
if( destFn.IsRelative() )
|
|
|
|
destFn.MakeAbsolute( rootFn.GetPath() );
|
|
|
|
|
|
|
|
|
|
|
|
// The source and destination sheet file names cannot be the same.
|
|
|
|
if( srcFn == destFn )
|
2020-02-29 04:03:04 +00:00
|
|
|
{
|
|
|
|
m_recursion_test_cache[pair] = true;
|
2016-02-15 20:12:42 +00:00
|
|
|
return true;
|
2020-02-29 04:03:04 +00:00
|
|
|
}
|
2016-02-15 20:12:42 +00:00
|
|
|
|
|
|
|
/// @todo Store sheet file names with full path, either relative to project path
|
|
|
|
/// or absolute path. The current design always assumes subsheet files are
|
|
|
|
/// located in the project folder which may or may not be desirable.
|
|
|
|
unsigned i = 0;
|
|
|
|
|
2016-02-27 19:35:45 +00:00
|
|
|
while( i < size() )
|
2016-02-15 20:12:42 +00:00
|
|
|
{
|
2016-02-27 19:35:45 +00:00
|
|
|
wxFileName cmpFn = at( i )->GetFileName();
|
2016-02-15 20:12:42 +00:00
|
|
|
|
|
|
|
if( cmpFn.IsRelative() )
|
|
|
|
cmpFn.MakeAbsolute( rootFn.GetPath() );
|
|
|
|
|
|
|
|
// Test if the file name of the destination sheet is in anywhere in this sheet path.
|
|
|
|
if( cmpFn == destFn )
|
|
|
|
break;
|
|
|
|
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The destination sheet file name was not found in the sheet path or the destination
|
|
|
|
// sheet file name is the root sheet so no recursion is possible.
|
2016-02-27 19:35:45 +00:00
|
|
|
if( i >= size() || i == 0 )
|
2020-02-29 04:03:04 +00:00
|
|
|
{
|
|
|
|
m_recursion_test_cache[pair] = false;
|
2016-02-15 20:12:42 +00:00
|
|
|
return false;
|
2020-02-29 04:03:04 +00:00
|
|
|
}
|
2016-02-15 20:12:42 +00:00
|
|
|
|
|
|
|
// Walk back up to the root sheet to see if the source file name is already a parent in
|
|
|
|
// the sheet path. If so, recursion will occur.
|
|
|
|
do
|
|
|
|
{
|
|
|
|
i -= 1;
|
|
|
|
|
2016-02-27 19:35:45 +00:00
|
|
|
wxFileName cmpFn = at( i )->GetFileName();
|
2016-02-15 20:12:42 +00:00
|
|
|
|
|
|
|
if( cmpFn.IsRelative() )
|
|
|
|
cmpFn.MakeAbsolute( rootFn.GetPath() );
|
|
|
|
|
|
|
|
if( cmpFn == srcFn )
|
2020-02-29 04:03:04 +00:00
|
|
|
{
|
|
|
|
m_recursion_test_cache[pair] = true;
|
2016-02-15 20:12:42 +00:00
|
|
|
return true;
|
2020-02-29 04:03:04 +00:00
|
|
|
}
|
2016-02-15 20:12:42 +00:00
|
|
|
|
|
|
|
} while( i != 0 );
|
|
|
|
|
|
|
|
// The source sheet file name is not a parent of the destination sheet file name.
|
2020-02-29 04:03:04 +00:00
|
|
|
m_recursion_test_cache[pair] = false;
|
2016-02-15 20:12:42 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_LIST::SCH_SHEET_LIST( SCH_SHEET* aSheet )
|
|
|
|
{
|
2016-03-06 21:22:01 +00:00
|
|
|
if( aSheet != NULL )
|
|
|
|
BuildSheetList( aSheet );
|
2009-01-04 18:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet )
|
|
|
|
{
|
2014-08-23 15:22:50 +00:00
|
|
|
wxCHECK_RET( aSheet != NULL, wxT( "Cannot build sheet list from undefined sheet." ) );
|
|
|
|
|
2020-01-27 14:38:14 +00:00
|
|
|
std::vector<SCH_SHEET*> badSheets;
|
|
|
|
|
2016-03-06 21:22:01 +00:00
|
|
|
m_currentSheetPath.push_back( aSheet );
|
2016-02-27 19:35:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @todo: Schematic page number is currently a left over relic and is generated as
|
|
|
|
* SCH_SHEET_PATH object is pushed to the list. This only has meaning when
|
|
|
|
* entire hierarchy is created from the root sheet down.
|
|
|
|
*/
|
2016-03-06 21:22:01 +00:00
|
|
|
m_currentSheetPath.SetPageNumber( size() + 1 );
|
|
|
|
push_back( m_currentSheetPath );
|
2009-12-02 21:44:03 +00:00
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
if( m_currentSheetPath.LastScreen() )
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2020-05-03 14:52:31 +00:00
|
|
|
std::vector<SCH_ITEM*> childSheets;
|
|
|
|
m_currentSheetPath.LastScreen()->GetSheets( &childSheets );
|
|
|
|
|
|
|
|
for( SCH_ITEM* item : childSheets )
|
2020-01-27 14:38:14 +00:00
|
|
|
{
|
|
|
|
auto sheet = static_cast<SCH_SHEET*>( item );
|
|
|
|
|
|
|
|
if( !m_currentSheetPath.TestForRecursion(
|
|
|
|
sheet->GetFileName(), aSheet->GetFileName() ) )
|
|
|
|
BuildSheetList( sheet );
|
|
|
|
else
|
|
|
|
badSheets.push_back( sheet );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for( auto sheet : badSheets )
|
|
|
|
{
|
|
|
|
m_currentSheetPath.LastScreen()->Remove( sheet );
|
|
|
|
m_currentSheetPath.LastScreen()->SetModify();
|
2009-01-04 18:52:57 +00:00
|
|
|
}
|
2009-12-02 21:44:03 +00:00
|
|
|
|
2016-03-06 21:22:01 +00:00
|
|
|
m_currentSheetPath.pop_back();
|
2009-01-04 18:52:57 +00:00
|
|
|
}
|
2010-03-16 18:22:59 +00:00
|
|
|
|
|
|
|
|
2020-03-13 09:53:44 +00:00
|
|
|
bool SCH_SHEET_LIST::NameExists( const wxString& aSheetName )
|
|
|
|
{
|
|
|
|
for( const SCH_SHEET_PATH& sheet : *this )
|
|
|
|
{
|
|
|
|
if( sheet.Last()->GetName() == aSheetName )
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-02-15 20:21:18 +00:00
|
|
|
bool SCH_SHEET_LIST::IsModified()
|
|
|
|
{
|
2020-03-13 09:53:44 +00:00
|
|
|
for( const SCH_SHEET_PATH& sheet : *this )
|
2016-02-15 20:21:18 +00:00
|
|
|
{
|
2020-03-13 09:53:44 +00:00
|
|
|
if( sheet.LastScreen() && sheet.LastScreen()->IsModify() )
|
2016-02-15 20:21:18 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SCH_SHEET_LIST::ClearModifyStatus()
|
|
|
|
{
|
2020-03-13 09:53:44 +00:00
|
|
|
for( const SCH_SHEET_PATH& sheet : *this )
|
2016-02-15 20:21:18 +00:00
|
|
|
{
|
2020-03-13 09:53:44 +00:00
|
|
|
if( sheet.LastScreen() )
|
|
|
|
sheet.LastScreen()->ClrModify();
|
2016-02-15 20:21:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
SCH_ITEM* SCH_SHEET_LIST::GetItem( const KIID& aID, SCH_SHEET_PATH* aPathOut )
|
|
|
|
{
|
|
|
|
for( const SCH_SHEET_PATH& sheet : *this )
|
|
|
|
{
|
|
|
|
SCH_SCREEN* screen = sheet.LastScreen();
|
|
|
|
|
|
|
|
for( SCH_ITEM* aItem : screen->Items() )
|
|
|
|
{
|
|
|
|
if( aItem->m_Uuid == aID )
|
|
|
|
{
|
2020-05-13 02:00:37 +00:00
|
|
|
if( aPathOut )
|
|
|
|
*aPathOut = sheet;
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
return aItem;
|
|
|
|
}
|
|
|
|
else if( aItem->Type() == SCH_COMPONENT_T )
|
|
|
|
{
|
|
|
|
SCH_COMPONENT* comp = static_cast<SCH_COMPONENT*>( aItem );
|
|
|
|
|
2020-03-26 11:02:59 +00:00
|
|
|
for( SCH_FIELD& field : comp->GetFields() )
|
2020-03-16 11:05:01 +00:00
|
|
|
{
|
2020-03-26 11:02:59 +00:00
|
|
|
if( field.m_Uuid == aID )
|
2020-03-16 11:05:01 +00:00
|
|
|
{
|
2020-05-13 02:00:37 +00:00
|
|
|
if( aPathOut )
|
|
|
|
*aPathOut = sheet;
|
|
|
|
|
2020-03-26 11:02:59 +00:00
|
|
|
return &field;
|
2020-03-16 11:05:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for( SCH_PIN* pin : comp->GetSchPins() )
|
|
|
|
{
|
|
|
|
if( pin->m_Uuid == aID )
|
|
|
|
{
|
2020-05-13 02:00:37 +00:00
|
|
|
if( aPathOut )
|
|
|
|
*aPathOut = sheet;
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
return pin;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( aItem->Type() == SCH_SHEET_T )
|
|
|
|
{
|
|
|
|
SCH_SHEET* sch_sheet = static_cast<SCH_SHEET*>( aItem );
|
|
|
|
|
2020-03-26 11:02:59 +00:00
|
|
|
for( SCH_FIELD& field : sch_sheet->GetFields() )
|
|
|
|
{
|
|
|
|
if( field.m_Uuid == aID )
|
|
|
|
{
|
2020-05-13 02:00:37 +00:00
|
|
|
if( aPathOut )
|
|
|
|
*aPathOut = sheet;
|
2020-03-26 11:02:59 +00:00
|
|
|
return &field;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
for( SCH_SHEET_PIN* pin : sch_sheet->GetPins() )
|
|
|
|
{
|
|
|
|
if( pin->m_Uuid == aID )
|
|
|
|
{
|
2020-05-13 02:00:37 +00:00
|
|
|
if( aPathOut )
|
|
|
|
*aPathOut = sheet;
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
return pin;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-17 12:46:50 +00:00
|
|
|
// Not found; weak reference has been deleted.
|
|
|
|
if( !g_DeletedItem )
|
|
|
|
g_DeletedItem = new DELETED_SHEET_ITEM();
|
|
|
|
|
|
|
|
return g_DeletedItem;
|
2020-03-16 11:05:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-04-24 22:22:11 +00:00
|
|
|
void SCH_SHEET_LIST::FillItemMap( std::map<KIID, EDA_ITEM*>& aMap )
|
2020-04-24 13:36:10 +00:00
|
|
|
{
|
|
|
|
for( const SCH_SHEET_PATH& sheet : *this )
|
|
|
|
{
|
|
|
|
SCH_SCREEN* screen = sheet.LastScreen();
|
|
|
|
|
|
|
|
for( SCH_ITEM* aItem : screen->Items() )
|
|
|
|
{
|
|
|
|
aMap[ aItem->m_Uuid ] = aItem;
|
|
|
|
|
|
|
|
if( aItem->Type() == SCH_COMPONENT_T )
|
|
|
|
{
|
|
|
|
SCH_COMPONENT* comp = static_cast<SCH_COMPONENT*>( aItem );
|
|
|
|
|
|
|
|
for( SCH_FIELD& field : comp->GetFields() )
|
|
|
|
aMap[ field.m_Uuid ] = &field;
|
|
|
|
|
|
|
|
for( SCH_PIN* pin : comp->GetSchPins() )
|
|
|
|
aMap[ pin->m_Uuid ] = pin;
|
|
|
|
}
|
|
|
|
else if( aItem->Type() == SCH_SHEET_T )
|
|
|
|
{
|
|
|
|
SCH_SHEET* sch_sheet = static_cast<SCH_SHEET*>( aItem );
|
|
|
|
|
|
|
|
for( SCH_FIELD& field : sch_sheet->GetFields() )
|
|
|
|
aMap[ field.m_Uuid ] = &field;
|
|
|
|
|
|
|
|
for( SCH_SHEET_PIN* pin : sch_sheet->GetPins() )
|
|
|
|
aMap[ pin->m_Uuid ] = pin;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
void SCH_SHEET_LIST::AnnotatePowerSymbols()
|
2016-02-15 20:18:32 +00:00
|
|
|
{
|
2017-07-20 18:23:21 +00:00
|
|
|
// List of reference for power symbols
|
|
|
|
SCH_REFERENCE_LIST references;
|
|
|
|
|
|
|
|
// Map of locked components (not used, but needed by Annotate()
|
|
|
|
SCH_MULTI_UNIT_REFERENCE_MAP lockedComponents;
|
2016-02-15 20:18:32 +00:00
|
|
|
|
2017-07-20 18:23:21 +00:00
|
|
|
// Build the list of power components:
|
2020-03-13 09:53:44 +00:00
|
|
|
for( SCH_SHEET_PATH& sheet : *this )
|
2017-07-20 18:23:21 +00:00
|
|
|
{
|
2020-03-13 09:53:44 +00:00
|
|
|
for( auto item : sheet.LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
|
2017-07-20 18:23:21 +00:00
|
|
|
{
|
2019-06-25 23:39:58 +00:00
|
|
|
auto component = static_cast<SCH_COMPONENT*>( item );
|
2019-11-06 19:15:42 +00:00
|
|
|
LIB_PART* part = component->GetPartRef().get();
|
2017-07-20 18:23:21 +00:00
|
|
|
|
|
|
|
if( !part || !part->IsPower() )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if( part )
|
|
|
|
{
|
2020-03-13 09:53:44 +00:00
|
|
|
SCH_REFERENCE schReference( component, part, sheet );
|
2018-06-28 13:36:14 +00:00
|
|
|
references.AddItem( schReference );
|
2017-07-20 18:23:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Find duplicate, and silently clear annotation of duplicate
|
|
|
|
std::map<wxString, int> ref_list; // stores the existing references
|
|
|
|
|
|
|
|
for( unsigned ii = 0; ii< references.GetCount(); ++ii )
|
|
|
|
{
|
|
|
|
wxString curr_ref = references[ii].GetRef();
|
|
|
|
|
|
|
|
if( ref_list.find( curr_ref ) == ref_list.end() )
|
|
|
|
{
|
|
|
|
ref_list[curr_ref] = ii;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Possible duplicate, if the ref ends by a number:
|
|
|
|
if( curr_ref.Last() < '0' && curr_ref.Last() > '9' )
|
|
|
|
continue; // not annotated
|
|
|
|
|
|
|
|
// Duplicate: clear annotation by removing the number ending the ref
|
|
|
|
while( curr_ref.Last() >= '0' && curr_ref.Last() <= '9' )
|
|
|
|
curr_ref.RemoveLast();
|
|
|
|
|
|
|
|
references[ii].SetRef( curr_ref );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Break full components reference in name (prefix) and number:
|
|
|
|
// example: IC1 become IC, and 1
|
|
|
|
references.SplitReferences();
|
|
|
|
|
|
|
|
// Ensure all power symbols have the reference starting by '#'
|
|
|
|
// (No sure this is really useful)
|
|
|
|
for( unsigned ii = 0; ii< references.GetCount(); ++ii )
|
|
|
|
{
|
|
|
|
if( references[ii].GetRef()[0] != '#' )
|
|
|
|
{
|
|
|
|
wxString new_ref = "#" + references[ii].GetRef();
|
|
|
|
references[ii].SetRef( new_ref );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Recalculate and update reference numbers in schematic
|
2018-02-18 20:44:33 +00:00
|
|
|
references.Annotate( false, 0, 100, lockedComponents );
|
2017-07-20 18:23:21 +00:00
|
|
|
references.UpdateAnnotation();
|
2016-02-15 20:18:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-11-21 17:06:37 +00:00
|
|
|
void SCH_SHEET_LIST::GetComponents( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols,
|
2020-05-13 02:00:37 +00:00
|
|
|
bool aForceIncludeOrphanComponents ) const
|
2016-02-15 20:16:54 +00:00
|
|
|
{
|
2020-05-13 02:00:37 +00:00
|
|
|
for( const SCH_SHEET_PATH& sheet : *this )
|
2020-03-13 09:53:44 +00:00
|
|
|
sheet.GetComponents( aReferences, aIncludePowerSymbols, aForceIncludeOrphanComponents );
|
2016-02-15 20:16:54 +00:00
|
|
|
}
|
|
|
|
|
2020-05-13 02:00:37 +00:00
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
void SCH_SHEET_LIST::GetMultiUnitComponents( SCH_MULTI_UNIT_REFERENCE_MAP &aRefList,
|
2020-05-13 02:00:37 +00:00
|
|
|
bool aIncludePowerSymbols ) const
|
2016-02-15 20:14:48 +00:00
|
|
|
{
|
2020-05-13 02:00:37 +00:00
|
|
|
for( SCH_SHEET_PATHS::const_iterator it = begin(); it != end(); ++it )
|
2016-02-15 20:14:48 +00:00
|
|
|
{
|
|
|
|
SCH_MULTI_UNIT_REFERENCE_MAP tempMap;
|
2017-10-06 18:07:43 +00:00
|
|
|
(*it).GetMultiUnitComponents( tempMap );
|
2016-03-06 21:22:01 +00:00
|
|
|
|
2016-06-29 20:07:55 +00:00
|
|
|
for( SCH_MULTI_UNIT_REFERENCE_MAP::value_type& pair : tempMap )
|
2016-02-15 20:14:48 +00:00
|
|
|
{
|
|
|
|
// Merge this list into the main one
|
|
|
|
unsigned n_refs = pair.second.GetCount();
|
2016-03-06 21:22:01 +00:00
|
|
|
|
2016-02-15 20:14:48 +00:00
|
|
|
for( unsigned thisRef = 0; thisRef < n_refs; ++thisRef )
|
|
|
|
{
|
|
|
|
aRefList[pair.first].AddItem( pair.second[thisRef] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-02-15 20:14:07 +00:00
|
|
|
bool SCH_SHEET_LIST::SetComponentFootprint( const wxString& aReference,
|
|
|
|
const wxString& aFootPrint, bool aSetVisible )
|
|
|
|
{
|
|
|
|
bool found = false;
|
|
|
|
|
2020-03-13 09:53:44 +00:00
|
|
|
for( SCH_SHEET_PATH& sheet : *this )
|
|
|
|
found = sheet.SetComponentFootprint( aReference, aFootPrint, aSetVisible );
|
2016-02-15 20:14:07 +00:00
|
|
|
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-02-15 20:12:42 +00:00
|
|
|
bool SCH_SHEET_LIST::TestForRecursion( const SCH_SHEET_LIST& aSrcSheetHierarchy,
|
2020-02-29 04:03:04 +00:00
|
|
|
const wxString& aDestFileName )
|
2016-02-15 20:12:42 +00:00
|
|
|
{
|
2020-05-13 02:00:37 +00:00
|
|
|
if( empty() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
SCHEMATIC* sch = at( 0 ).LastScreen()->Schematic();
|
|
|
|
|
|
|
|
wxCHECK_MSG( sch, false, "No SCHEMATIC found in SCH_SHEET_LIST::TestForRecursion!" );
|
|
|
|
|
|
|
|
wxFileName rootFn = sch->GetFileName();
|
2016-02-15 20:12:42 +00:00
|
|
|
wxFileName destFn = aDestFileName;
|
|
|
|
|
|
|
|
if( destFn.IsRelative() )
|
|
|
|
destFn.MakeAbsolute( rootFn.GetPath() );
|
|
|
|
|
|
|
|
// Test each SCH_SHEET_PATH in this SCH_SHEET_LIST for potential recursion.
|
2016-03-06 21:22:01 +00:00
|
|
|
for( unsigned i = 0; i < size(); i++ )
|
2016-02-15 20:12:42 +00:00
|
|
|
{
|
|
|
|
// Test each SCH_SHEET_PATH in the source sheet.
|
2016-03-06 21:22:01 +00:00
|
|
|
for( unsigned j = 0; j < aSrcSheetHierarchy.size(); j++ )
|
2016-02-15 20:12:42 +00:00
|
|
|
{
|
2016-03-06 21:22:01 +00:00
|
|
|
const SCH_SHEET_PATH* sheetPath = &aSrcSheetHierarchy[j];
|
2016-02-15 20:12:42 +00:00
|
|
|
|
2016-02-27 19:35:45 +00:00
|
|
|
for( unsigned k = 0; k < sheetPath->size(); k++ )
|
2016-02-15 20:12:42 +00:00
|
|
|
{
|
2016-03-06 21:22:01 +00:00
|
|
|
if( at( i ).TestForRecursion( sheetPath->GetSheet( k )->GetFileName(),
|
|
|
|
aDestFileName ) )
|
2016-02-15 20:12:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// The source sheet file can safely be added to the destination sheet file.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-19 21:04:04 +00:00
|
|
|
SCH_SHEET_PATH* SCH_SHEET_LIST::FindSheetForScreen( SCH_SCREEN* aScreen )
|
|
|
|
{
|
|
|
|
for( SCH_SHEET_PATH& sheetpath : *this )
|
|
|
|
{
|
|
|
|
if( sheetpath.LastScreen() == aScreen )
|
|
|
|
return &sheetpath;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
2020-04-24 13:36:10 +00:00
|
|
|
|
|
|
|
|
2020-04-26 20:53:29 +00:00
|
|
|
void SCH_SHEET_LIST::UpdateSymbolInstances(
|
2020-05-19 02:40:13 +00:00
|
|
|
const std::vector<COMPONENT_INSTANCE_REFERENCE>& aSymbolInstances )
|
2020-04-26 20:53:29 +00:00
|
|
|
{
|
|
|
|
SCH_REFERENCE_LIST symbolInstances;
|
|
|
|
|
|
|
|
GetComponents( symbolInstances, true, true );
|
|
|
|
|
|
|
|
for( size_t i = 0; i < symbolInstances.GetCount(); i++ )
|
|
|
|
{
|
|
|
|
// The instance paths are stored in the file sans root path so the comparison
|
|
|
|
// should not include the root path.
|
|
|
|
wxString path = symbolInstances[i].GetPath();
|
|
|
|
|
|
|
|
auto it = std::find_if( aSymbolInstances.begin(), aSymbolInstances.end(),
|
2020-05-19 02:40:13 +00:00
|
|
|
[ path ]( const COMPONENT_INSTANCE_REFERENCE& r ) -> bool
|
2020-04-26 20:53:29 +00:00
|
|
|
{
|
|
|
|
return path == r.m_Path.AsString();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
if( it == aSymbolInstances.end() )
|
|
|
|
{
|
|
|
|
wxLogTrace( traceSchSheetPaths, "No symbol instance found for path \"%s\"", path );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
SCH_COMPONENT* symbol = symbolInstances[i].GetComp();
|
|
|
|
|
|
|
|
wxCHECK2( symbol, continue );
|
|
|
|
|
|
|
|
// Symbol instance paths are stored and looked up in memory with the root path so use
|
|
|
|
// the full path here.
|
|
|
|
symbol->AddHierarchicalReference( symbolInstances[i].GetSheetPath().Path(),
|
|
|
|
it->m_Reference, it->m_Unit );
|
|
|
|
symbol->GetField( REFERENCE )->SetText( it->m_Reference );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<KIID_PATH> SCH_SHEET_LIST::GetPaths() const
|
|
|
|
{
|
|
|
|
std::vector<KIID_PATH> paths;
|
|
|
|
|
|
|
|
for( auto sheetPath : *this )
|
|
|
|
paths.emplace_back( sheetPath.Path() );
|
|
|
|
|
|
|
|
return paths;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SCH_SHEET_LIST::ReplaceLegacySheetPaths( const std::vector<KIID_PATH>& aOldSheetPaths )
|
|
|
|
{
|
|
|
|
wxCHECK( size() == aOldSheetPaths.size(), /* void */ );
|
|
|
|
|
|
|
|
for( size_t i = 0; i < size(); i++ )
|
|
|
|
{
|
|
|
|
const KIID_PATH oldSheetPath = aOldSheetPaths.at( i );
|
|
|
|
const KIID_PATH newSheetPath = at( i ).Path();
|
|
|
|
SCH_SCREEN* screen = at(i).LastScreen();
|
|
|
|
|
|
|
|
wxCHECK( screen, /* void */ );
|
|
|
|
|
|
|
|
for( auto symbol : screen->Items().OfType( SCH_COMPONENT_T ) )
|
|
|
|
{
|
|
|
|
static_cast<SCH_COMPONENT*>( symbol )->ReplaceInstanceSheetPath( oldSheetPath,
|
|
|
|
newSheetPath );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|