mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Cache full schematic sheet list sorted by sheet page number.
The sheet list is returned as a copy of the cached list rather than a reference to prevent external code from changing the list. While not as performant, it eliminates the risk of the sheet list being altered in ways that could break the schematic. The sheet list should only be updated by calling SCHEMATIC::RefreshHierarchy() when any appropriate sheet changes are made. Note to developers: there is something inherently different about how the QA tests are loading and handling schematics versus the schematic editor. Using the cached sheet list for the SCHEMATIC object will cause some QA test to fail. This is why SCHEMATIC::Hierarchy() has not replaced SCHEMATIC::BuildSheetListSortedByPageNumbers() everywhere.
This commit is contained in:
parent
eae84fd5f3
commit
a6923b3de3
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2004-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -39,7 +39,7 @@
|
|||||||
void SCH_EDIT_FRAME::mapExistingAnnotation( std::map<wxString, wxString>& aMap )
|
void SCH_EDIT_FRAME::mapExistingAnnotation( std::map<wxString, wxString>& aMap )
|
||||||
{
|
{
|
||||||
SCH_REFERENCE_LIST references;
|
SCH_REFERENCE_LIST references;
|
||||||
Schematic().BuildUnorderedSheetList().GetSymbols( references );
|
Schematic().Hierarchy().GetSymbols( references );
|
||||||
|
|
||||||
for( size_t i = 0; i < references.GetCount(); i++ )
|
for( size_t i = 0; i < references.GetCount(); i++ )
|
||||||
{
|
{
|
||||||
@ -61,7 +61,7 @@ void SCH_EDIT_FRAME::DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRe
|
|||||||
REPORTER& aReporter )
|
REPORTER& aReporter )
|
||||||
{
|
{
|
||||||
|
|
||||||
SCH_SHEET_LIST sheets = Schematic().BuildUnorderedSheetList();
|
SCH_SHEET_LIST sheets = Schematic().Hierarchy();
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
SCH_SHEET_PATH currentSheet = GetCurrentSheet();
|
SCH_SHEET_PATH currentSheet = GetCurrentSheet();
|
||||||
SCH_COMMIT commit( this );
|
SCH_COMMIT commit( this );
|
||||||
@ -219,7 +219,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( SCH_COMMIT* aCommit, ANNOTATE_SCOPE_T aAn
|
|||||||
|
|
||||||
SCH_REFERENCE_LIST references;
|
SCH_REFERENCE_LIST references;
|
||||||
SCH_SCREENS screens( Schematic().Root() );
|
SCH_SCREENS screens( Schematic().Root() );
|
||||||
SCH_SHEET_LIST sheets = Schematic().BuildSheetListSortedByPageNumbers();
|
SCH_SHEET_LIST sheets = Schematic().Hierarchy();
|
||||||
SCH_SHEET_PATH currentSheet = GetCurrentSheet();
|
SCH_SHEET_PATH currentSheet = GetCurrentSheet();
|
||||||
|
|
||||||
|
|
||||||
@ -463,7 +463,7 @@ int SCH_EDIT_FRAME::CheckAnnotate( ANNOTATION_ERROR_HANDLER aErrorHandler,
|
|||||||
{
|
{
|
||||||
SCH_REFERENCE_LIST referenceList;
|
SCH_REFERENCE_LIST referenceList;
|
||||||
constexpr bool includePowerSymbols = false;
|
constexpr bool includePowerSymbols = false;
|
||||||
SCH_SHEET_LIST sheets = Schematic().BuildSheetListSortedByPageNumbers();
|
SCH_SHEET_LIST sheets = Schematic().Hierarchy();
|
||||||
SCH_SHEET_PATH currentSheet = GetCurrentSheet();
|
SCH_SHEET_PATH currentSheet = GetCurrentSheet();
|
||||||
|
|
||||||
// Build the list of symbols
|
// Build the list of symbols
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 2004-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2004-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -54,7 +54,7 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString* aPath, const wx
|
|||||||
if( !aSearchHierarchy )
|
if( !aSearchHierarchy )
|
||||||
sheetList.push_back( m_frame->GetCurrentSheet() );
|
sheetList.push_back( m_frame->GetCurrentSheet() );
|
||||||
else
|
else
|
||||||
sheetList = m_frame->Schematic().BuildSheetListSortedByPageNumbers();
|
sheetList = m_frame->Schematic().Hierarchy();
|
||||||
|
|
||||||
for( SCH_SHEET_PATH& sheet : sheetList )
|
for( SCH_SHEET_PATH& sheet : sheetList )
|
||||||
{
|
{
|
||||||
@ -620,7 +620,7 @@ findItemsFromSyncSelection( const SCHEMATIC& aSchematic, const std::string aSync
|
|||||||
std::optional<std::pair<wxString, wxString>> focusPin;
|
std::optional<std::pair<wxString, wxString>> focusPin;
|
||||||
std::unordered_map<SCH_SHEET_PATH, std::vector<SCH_ITEM*>> focusItemResults;
|
std::unordered_map<SCH_SHEET_PATH, std::vector<SCH_ITEM*>> focusItemResults;
|
||||||
|
|
||||||
const SCH_SHEET_LIST allSheetsList = aSchematic.BuildUnorderedSheetList();
|
const SCH_SHEET_LIST allSheetsList = aSchematic.Hierarchy();
|
||||||
|
|
||||||
// In orderedSheets, the current sheet comes first.
|
// In orderedSheets, the current sheet comes first.
|
||||||
std::vector<SCH_SHEET_PATH> orderedSheets;
|
std::vector<SCH_SHEET_PATH> orderedSheets;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020-2021 CERN
|
* Copyright (C) 2020-2021 CERN
|
||||||
* Copyright (C) 2021-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2021-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* @author Wayne Stambaugh <stambaughw@gmail.com>
|
* @author Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
*
|
*
|
||||||
@ -289,7 +289,7 @@ void DIALOG_CHANGE_SYMBOLS::updateFieldsList()
|
|||||||
std::vector<SCH_FIELD*> libFields;
|
std::vector<SCH_FIELD*> libFields;
|
||||||
std::set<wxString> fieldNames;
|
std::set<wxString> fieldNames;
|
||||||
|
|
||||||
for( SCH_SHEET_PATH& instance : frame->Schematic().BuildUnorderedSheetList() )
|
for( SCH_SHEET_PATH& instance : frame->Schematic().Hierarchy() )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = instance.LastScreen();
|
SCH_SCREEN* screen = instance.LastScreen();
|
||||||
|
|
||||||
@ -495,7 +495,7 @@ int DIALOG_CHANGE_SYMBOLS::processMatchingSymbols( SCH_COMMIT* aCommit )
|
|||||||
|
|
||||||
std::map<SCH_SYMBOL*, SYMBOL_CHANGE_INFO> symbols;
|
std::map<SCH_SYMBOL*, SYMBOL_CHANGE_INFO> symbols;
|
||||||
|
|
||||||
for( SCH_SHEET_PATH& instance : frame->Schematic().BuildSheetListSortedByPageNumbers() )
|
for( SCH_SHEET_PATH& instance : frame->Schematic().Hierarchy() )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = instance.LastScreen();
|
SCH_SCREEN* screen = instance.LastScreen();
|
||||||
|
|
||||||
@ -796,7 +796,7 @@ wxString DIALOG_CHANGE_SYMBOLS::getSymbolReferences( SCH_SYMBOL& aSymbol,
|
|||||||
|
|
||||||
wxCHECK( parent, msg );
|
wxCHECK( parent, msg );
|
||||||
|
|
||||||
SCH_SHEET_LIST sheets = parent->Schematic().BuildUnorderedSheetList();
|
SCH_SHEET_LIST sheets = parent->Schematic().Hierarchy();
|
||||||
|
|
||||||
for( const SCH_SYMBOL_INSTANCE& instance : aSymbol.GetInstances() )
|
for( const SCH_SYMBOL_INSTANCE& instance : aSymbol.GetInstances() )
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright 2017 Jean-Pierre Charras, jp.charras@wanadoo.fr
|
* Copyright 2017 Jean-Pierre Charras, jp.charras@wanadoo.fr
|
||||||
* Copyright 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright 1992-2022, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -395,9 +395,9 @@ void DIALOG_EDIT_SYMBOLS_LIBID::initDlg()
|
|||||||
|
|
||||||
// build the full list of symbols including symbol having no symbol in loaded libs
|
// build the full list of symbols including symbol having no symbol in loaded libs
|
||||||
// (orphan symbols)
|
// (orphan symbols)
|
||||||
GetParent()->Schematic().BuildUnorderedSheetList().GetSymbols( references,
|
GetParent()->Schematic().Hierarchy().GetSymbols( references,
|
||||||
true /* include power symbols */,
|
true /* include power symbols */,
|
||||||
true /* include orphan symbols */ );
|
true /* include orphan symbols */ );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < references.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < references.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
|
@ -680,7 +680,7 @@ void DIALOG_FIELD_PROPERTIES::UpdateField( SCH_COMMIT* aCommit, SCH_FIELD* aFiel
|
|||||||
int unit = symbol->GetUnit();
|
int unit = symbol->GetUnit();
|
||||||
LIB_ID libId = symbol->GetLibId();
|
LIB_ID libId = symbol->GetLibId();
|
||||||
|
|
||||||
for( SCH_SHEET_PATH& sheet : editFrame->Schematic().BuildUnorderedSheetList() )
|
for( SCH_SHEET_PATH& sheet : editFrame->Schematic().Hierarchy() )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = sheet.LastScreen();
|
SCH_SCREEN* screen = sheet.LastScreen();
|
||||||
std::vector<SCH_SYMBOL*> otherUnits;
|
std::vector<SCH_SYMBOL*> otherUnits;
|
||||||
|
@ -583,7 +583,7 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
|
|||||||
SCH_COMMIT commit( m_parent );
|
SCH_COMMIT commit( m_parent );
|
||||||
|
|
||||||
// Go through sheets
|
// Go through sheets
|
||||||
for( const SCH_SHEET_PATH& sheetPath : m_parent->Schematic().BuildUnorderedSheetList() )
|
for( const SCH_SHEET_PATH& sheetPath : m_parent->Schematic().Hierarchy() )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = sheetPath.LastScreen();
|
SCH_SCREEN* screen = sheetPath.LastScreen();
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilena
|
|||||||
// Sheet file names are relative to the path of the current sheet. This allows for
|
// Sheet file names are relative to the path of the current sheet. This allows for
|
||||||
// nesting of schematic files in subfolders. Screen file names are always absolute.
|
// nesting of schematic files in subfolders. Screen file names are always absolute.
|
||||||
SCHEMATIC& schematic = m_frame->Schematic();
|
SCHEMATIC& schematic = m_frame->Schematic();
|
||||||
SCH_SHEET_LIST fullHierarchy = schematic.GetFullHierarchy();
|
SCH_SHEET_LIST fullHierarchy = schematic.Hierarchy();
|
||||||
wxFileName screenFileName( sheetFileName );
|
wxFileName screenFileName( sheetFileName );
|
||||||
wxFileName tmp( sheetFileName );
|
wxFileName tmp( sheetFileName );
|
||||||
SCH_SCREEN* currentScreen = m_frame->GetCurrentSheet().LastScreen();
|
SCH_SCREEN* currentScreen = m_frame->GetCurrentSheet().LastScreen();
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 Oliver Walters
|
* Copyright (C) 2017 Oliver Walters
|
||||||
* Copyright (C) 2017-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2017-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -176,7 +176,7 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent )
|
|||||||
m_schSettings( parent->Schematic().Settings() )
|
m_schSettings( parent->Schematic().Settings() )
|
||||||
{
|
{
|
||||||
// Get all symbols from the list of schematic sheets
|
// Get all symbols from the list of schematic sheets
|
||||||
m_parent->Schematic().BuildUnorderedSheetList().GetSymbols( m_symbolsList, false );
|
m_parent->Schematic().Hierarchy().GetSymbols( m_symbolsList, false );
|
||||||
|
|
||||||
m_bRefresh->SetBitmap( KiBitmapBundle( BITMAPS::small_refresh ) );
|
m_bRefresh->SetBitmap( KiBitmapBundle( BITMAPS::small_refresh ) );
|
||||||
m_bRefreshPreview->SetBitmap( KiBitmapBundle( BITMAPS::small_refresh ) );
|
m_bRefreshPreview->SetBitmap( KiBitmapBundle( BITMAPS::small_refresh ) );
|
||||||
@ -2217,7 +2217,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnSchItemsAdded( SCHEMATIC& aSch,
|
|||||||
std::vector<SCH_ITEM*>& aSchItem )
|
std::vector<SCH_ITEM*>& aSchItem )
|
||||||
{
|
{
|
||||||
SCH_REFERENCE_LIST allRefs;
|
SCH_REFERENCE_LIST allRefs;
|
||||||
m_parent->Schematic().BuildUnorderedSheetList().GetSymbols( allRefs );
|
m_parent->Schematic().Hierarchy().GetSymbols( allRefs );
|
||||||
|
|
||||||
for( SCH_ITEM* item : aSchItem )
|
for( SCH_ITEM* item : aSchItem )
|
||||||
{
|
{
|
||||||
@ -2286,7 +2286,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnSchItemsChanged( SCHEMATIC& aSch
|
|||||||
std::vector<SCH_ITEM*>& aSchItem )
|
std::vector<SCH_ITEM*>& aSchItem )
|
||||||
{
|
{
|
||||||
SCH_REFERENCE_LIST allRefs;
|
SCH_REFERENCE_LIST allRefs;
|
||||||
m_parent->Schematic().BuildUnorderedSheetList().GetSymbols( allRefs );
|
m_parent->Schematic().Hierarchy().GetSymbols( allRefs );
|
||||||
|
|
||||||
for( SCH_ITEM* item : aSchItem )
|
for( SCH_ITEM* item : aSchItem )
|
||||||
{
|
{
|
||||||
@ -2383,7 +2383,7 @@ DIALOG_SYMBOL_FIELDS_TABLE::getSymbolReferences( SCH_SYMBOL* aSymbol,
|
|||||||
|
|
||||||
SCH_REFERENCE_LIST DIALOG_SYMBOL_FIELDS_TABLE::getSheetSymbolReferences( SCH_SHEET& aSheet )
|
SCH_REFERENCE_LIST DIALOG_SYMBOL_FIELDS_TABLE::getSheetSymbolReferences( SCH_SHEET& aSheet )
|
||||||
{
|
{
|
||||||
SCH_SHEET_LIST allSheets = m_parent->Schematic().BuildUnorderedSheetList();
|
SCH_SHEET_LIST allSheets = m_parent->Schematic().Hierarchy();
|
||||||
SCH_REFERENCE_LIST sheetRefs;
|
SCH_REFERENCE_LIST sheetRefs;
|
||||||
|
|
||||||
// We need to operate on all instances of the sheet
|
// We need to operate on all instances of the sheet
|
||||||
|
@ -242,7 +242,7 @@ void DIALOG_TABLE_PROPERTIES::getContextualTextVars( const wxString& aCrossRef,
|
|||||||
SCH_REFERENCE_LIST refs;
|
SCH_REFERENCE_LIST refs;
|
||||||
SCH_SYMBOL* refSymbol = nullptr;
|
SCH_SYMBOL* refSymbol = nullptr;
|
||||||
|
|
||||||
m_frame->Schematic().BuildUnorderedSheetList().GetSymbols( refs );
|
m_frame->Schematic().Hierarchy().GetSymbols( refs );
|
||||||
|
|
||||||
for( int jj = 0; jj < (int) refs.GetCount(); jj++ )
|
for( int jj = 0; jj < (int) refs.GetCount(); jj++ )
|
||||||
{
|
{
|
||||||
|
@ -166,7 +166,7 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_BASE_FRAME* aParent, SCH_ITE
|
|||||||
{
|
{
|
||||||
const SCHEMATIC& schematic = schematicEditor->Schematic();
|
const SCHEMATIC& schematic = schematicEditor->Schematic();
|
||||||
|
|
||||||
for( const SCH_SHEET_PATH& sheet : schematic.BuildSheetListSortedByPageNumbers() )
|
for( const SCH_SHEET_PATH& sheet : schematic.Hierarchy() )
|
||||||
{
|
{
|
||||||
wxString sheetPageNum = sheet.GetPageNumber();
|
wxString sheetPageNum = sheet.GetPageNumber();
|
||||||
wxString sheetName = sheet.size() == 1 ? _( "<root sheet>" )
|
wxString sheetName = sheet.size() == 1 ? _( "<root sheet>" )
|
||||||
@ -230,7 +230,7 @@ void DIALOG_TEXT_PROPERTIES::getContextualTextVars( const wxString& aCrossRef,
|
|||||||
if( schematic )
|
if( schematic )
|
||||||
{
|
{
|
||||||
SCH_REFERENCE_LIST refs;
|
SCH_REFERENCE_LIST refs;
|
||||||
schematic->BuildUnorderedSheetList().GetSymbols( refs );
|
schematic->Hierarchy().GetSymbols( refs );
|
||||||
|
|
||||||
for( int jj = 0; jj < (int) refs.GetCount(); jj++ )
|
for( int jj = 0; jj < (int) refs.GetCount(); jj++ )
|
||||||
{
|
{
|
||||||
|
@ -94,7 +94,7 @@ static std::unique_ptr<SCHEMATIC> readSchematicFromFile( const std::string& aFil
|
|||||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
|
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
|
||||||
screen->UpdateLocalLibSymbolLinks();
|
screen->UpdateLocalLibSymbolLinks();
|
||||||
|
|
||||||
SCH_SHEET_LIST sheets = schematic->BuildSheetListSortedByPageNumbers();
|
SCH_SHEET_LIST sheets = schematic->Hierarchy();
|
||||||
|
|
||||||
// Restore all of the loaded symbol instances from the root sheet screen.
|
// Restore all of the loaded symbol instances from the root sheet screen.
|
||||||
sheets.UpdateSymbolInstanceData( schematic->RootScreen()->GetSymbolInstances() );
|
sheets.UpdateSymbolInstanceData( schematic->RootScreen()->GetSymbolInstances() );
|
||||||
@ -704,4 +704,4 @@ int IFACE::HandleJob( JOB* aJob )
|
|||||||
bool IFACE::HandleJobConfig( JOB* aJob, wxWindow* aParent )
|
bool IFACE::HandleJobConfig( JOB* aJob, wxWindow* aParent )
|
||||||
{
|
{
|
||||||
return m_jobHandler->HandleJobConfig( aJob, aParent );
|
return m_jobHandler->HandleJobConfig( aJob, aParent );
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.TXT for contributors.
|
* Copyright (C) 2022, 2024 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2022 Mark Roszko <mark.roszko@gmail.com>
|
* Copyright (C) 2022 Mark Roszko <mark.roszko@gmail.com>
|
||||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* 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
|
* under the terms of the GNU General Public License as published by the
|
||||||
@ -348,7 +348,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportNetlist( JOB* aJob )
|
|||||||
|
|
||||||
// Annotation warning check
|
// Annotation warning check
|
||||||
SCH_REFERENCE_LIST referenceList;
|
SCH_REFERENCE_LIST referenceList;
|
||||||
sch->BuildUnorderedSheetList().GetSymbols( referenceList );
|
sch->Hierarchy().GetSymbols( referenceList );
|
||||||
|
|
||||||
if( referenceList.GetCount() > 0 )
|
if( referenceList.GetCount() > 0 )
|
||||||
{
|
{
|
||||||
@ -458,7 +458,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportBom( JOB* aJob )
|
|||||||
|
|
||||||
// Annotation warning check
|
// Annotation warning check
|
||||||
SCH_REFERENCE_LIST referenceList;
|
SCH_REFERENCE_LIST referenceList;
|
||||||
sch->BuildUnorderedSheetList().GetSymbols( referenceList, false, false );
|
sch->Hierarchy().GetSymbols( referenceList, false, false );
|
||||||
|
|
||||||
if( referenceList.GetCount() > 0 )
|
if( referenceList.GetCount() > 0 )
|
||||||
{
|
{
|
||||||
@ -711,7 +711,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportPythonBom( JOB* aJob )
|
|||||||
|
|
||||||
// Annotation warning check
|
// Annotation warning check
|
||||||
SCH_REFERENCE_LIST referenceList;
|
SCH_REFERENCE_LIST referenceList;
|
||||||
sch->BuildUnorderedSheetList().GetSymbols( referenceList );
|
sch->Hierarchy().GetSymbols( referenceList );
|
||||||
|
|
||||||
if( referenceList.GetCount() > 0 )
|
if( referenceList.GetCount() > 0 )
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* 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
|
* under the terms of the GNU General Public License as published by the
|
||||||
@ -121,7 +121,7 @@ bool ERC_REPORT::WriteJsonReport( const wxString& aFullFileName )
|
|||||||
reportHead.kicad_version = GetMajorMinorPatchVersion();
|
reportHead.kicad_version = GetMajorMinorPatchVersion();
|
||||||
reportHead.coordinate_units = EDA_UNIT_UTILS::GetLabel( m_reportUnits );
|
reportHead.coordinate_units = EDA_UNIT_UTILS::GetLabel( m_reportUnits );
|
||||||
|
|
||||||
SCH_SHEET_LIST sheetList = m_sch->BuildSheetListSortedByPageNumbers();
|
SCH_SHEET_LIST sheetList = m_sch->Hierarchy();
|
||||||
sheetList.FillItemMap( itemMap );
|
sheetList.FillItemMap( itemMap );
|
||||||
|
|
||||||
ERC_SETTINGS& settings = m_sch->ErcSettings();
|
ERC_SETTINGS& settings = m_sch->ErcSettings();
|
||||||
@ -156,4 +156,4 @@ bool ERC_REPORT::WriteJsonReport( const wxString& aFullFileName )
|
|||||||
jsonFileStream.close();
|
jsonFileStream.close();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||||||
|
|
||||||
// It's possible the schematic parser fixed errors due to bugs so warn the user
|
// It's possible the schematic parser fixed errors due to bugs so warn the user
|
||||||
// that the schematic has been fixed (modified).
|
// that the schematic has been fixed (modified).
|
||||||
SCH_SHEET_LIST sheetList = Schematic().BuildSheetListSortedByPageNumbers();
|
SCH_SHEET_LIST sheetList = Schematic().Hierarchy();
|
||||||
|
|
||||||
if( sheetList.IsModified() )
|
if( sheetList.IsModified() )
|
||||||
{
|
{
|
||||||
@ -1022,7 +1022,7 @@ bool SCH_EDIT_FRAME::SaveProject( bool aSaveAs )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to make sheet file name paths relative to the new root schematic path.
|
// Attempt to make sheet file name paths relative to the new root schematic path.
|
||||||
for( SCH_SHEET_PATH& sheet : Schematic().BuildUnorderedSheetList() )
|
for( SCH_SHEET_PATH& sheet : Schematic().Hierarchy() )
|
||||||
{
|
{
|
||||||
if( !sheet.Last()->IsRootSheet() )
|
if( !sheet.Last()->IsRootSheet() )
|
||||||
sheet.MakeFilePathRelativeToParentSheet();
|
sheet.MakeFilePathRelativeToParentSheet();
|
||||||
@ -1185,7 +1185,7 @@ bool SCH_EDIT_FRAME::SaveProject( bool aSaveAs )
|
|||||||
std::vector<FILE_INFO_PAIR>& sheets = Prj().GetProjectFile().GetSheets();
|
std::vector<FILE_INFO_PAIR>& sheets = Prj().GetProjectFile().GetSheets();
|
||||||
sheets.clear();
|
sheets.clear();
|
||||||
|
|
||||||
for( SCH_SHEET_PATH& sheetPath : Schematic().BuildUnorderedSheetList() )
|
for( SCH_SHEET_PATH& sheetPath : Schematic().Hierarchy() )
|
||||||
{
|
{
|
||||||
SCH_SHEET* sheet = sheetPath.Last();
|
SCH_SHEET* sheet = sheetPath.Last();
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ void SCH_EDIT_FRAME::RefreshNetNavigator( const NET_NAVIGATOR_ITEM_DATA* aSelect
|
|||||||
if( !m_netNavigator->IsShown() )
|
if( !m_netNavigator->IsShown() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool singleSheetSchematic = m_schematic->BuildUnorderedSheetList().size() == 1;
|
bool singleSheetSchematic = m_schematic->Hierarchy().size() == 1;
|
||||||
size_t nodeCnt = 0;
|
size_t nodeCnt = 0;
|
||||||
|
|
||||||
m_netNavigator->Freeze();
|
m_netNavigator->Freeze();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -136,7 +136,7 @@ void NETLIST_EXPORTER_ALLEGRO::extractComponentsInfo()
|
|||||||
m_referencesAlreadyFound.Clear();
|
m_referencesAlreadyFound.Clear();
|
||||||
m_libParts.clear();
|
m_libParts.clear();
|
||||||
|
|
||||||
for( const SCH_SHEET_PATH& sheet : m_schematic->BuildSheetListSortedByPageNumbers() )
|
for( const SCH_SHEET_PATH& sheet : m_schematic->Hierarchy() )
|
||||||
{
|
{
|
||||||
m_schematic->SetCurrentSheet( sheet );
|
m_schematic->SetCurrentSheet( sheet );
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 1992-2017 jp.charras at wanadoo.fr
|
* Copyright (C) 1992-2017 jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2013-2017 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2013-2017 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -241,7 +241,7 @@ void NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol( SCH_SYMBOL* aSchSymbol,
|
|||||||
|
|
||||||
CONNECTION_GRAPH* graph = m_schematic->ConnectionGraph();
|
CONNECTION_GRAPH* graph = m_schematic->ConnectionGraph();
|
||||||
|
|
||||||
for( const SCH_SHEET_PATH& sheet : m_schematic->BuildSheetListSortedByPageNumbers() )
|
for( const SCH_SHEET_PATH& sheet : m_schematic->Hierarchy() )
|
||||||
{
|
{
|
||||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 1992-2018 jp.charras at wanadoo.fr
|
* Copyright (C) 1992-2018 jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -65,7 +65,7 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName,
|
|||||||
// Create netlist footprints section
|
// Create netlist footprints section
|
||||||
m_referencesAlreadyFound.Clear();
|
m_referencesAlreadyFound.Clear();
|
||||||
|
|
||||||
for( const SCH_SHEET_PATH& sheet : m_schematic->BuildSheetListSortedByPageNumbers() )
|
for( const SCH_SHEET_PATH& sheet : m_schematic->Hierarchy() )
|
||||||
{
|
{
|
||||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 1992-2018 jp.charras at wanadoo.fr
|
* Copyright (C) 1992-2018 jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -62,7 +62,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
|
|||||||
// Create netlist footprints section
|
// Create netlist footprints section
|
||||||
m_referencesAlreadyFound.Clear();
|
m_referencesAlreadyFound.Clear();
|
||||||
|
|
||||||
for( const SCH_SHEET_PATH& sheet : m_schematic->BuildSheetListSortedByPageNumbers() )
|
for( const SCH_SHEET_PATH& sheet : m_schematic->Hierarchy() )
|
||||||
{
|
{
|
||||||
// Process symbol attributes
|
// Process symbol attributes
|
||||||
for( EDA_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
for( EDA_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||||
|
@ -55,7 +55,7 @@ bool NETLIST_EXPORTER_PADS::WriteNetlist( const wxString& aOutFileName,
|
|||||||
// Create netlist footprints section
|
// Create netlist footprints section
|
||||||
m_referencesAlreadyFound.Clear();
|
m_referencesAlreadyFound.Clear();
|
||||||
|
|
||||||
for( const SCH_SHEET_PATH& sheet : m_schematic->BuildSheetListSortedByPageNumbers() )
|
for( const SCH_SHEET_PATH& sheet : m_schematic->Hierarchy() )
|
||||||
{
|
{
|
||||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||||
{
|
{
|
||||||
|
@ -706,7 +706,7 @@ SCH_SHEET_LIST NETLIST_EXPORTER_SPICE::BuildSheetList( unsigned aNetlistOptions
|
|||||||
if( aNetlistOptions & OPTION_CUR_SHEET_AS_ROOT )
|
if( aNetlistOptions & OPTION_CUR_SHEET_AS_ROOT )
|
||||||
sheets = SCH_SHEET_LIST( m_schematic->CurrentSheet().Last() );
|
sheets = SCH_SHEET_LIST( m_schematic->CurrentSheet().Last() );
|
||||||
else
|
else
|
||||||
sheets = m_schematic->BuildSheetListSortedByPageNumbers();
|
sheets = m_schematic->Hierarchy();
|
||||||
|
|
||||||
alg::delete_if( sheets,
|
alg::delete_if( sheets,
|
||||||
[&]( const SCH_SHEET_PATH& sheet )
|
[&]( const SCH_SHEET_PATH& sheet )
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
|
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2013-2017 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2013-2017 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -247,7 +247,7 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
|
|||||||
m_libParts.clear();
|
m_libParts.clear();
|
||||||
|
|
||||||
SCH_SHEET_PATH currentSheet = m_schematic->CurrentSheet();
|
SCH_SHEET_PATH currentSheet = m_schematic->CurrentSheet();
|
||||||
SCH_SHEET_LIST sheetList = m_schematic->BuildSheetListSortedByPageNumbers();
|
SCH_SHEET_LIST sheetList = m_schematic->Hierarchy();
|
||||||
|
|
||||||
// Output is xml, so there is no reason to remove spaces from the field values.
|
// Output is xml, so there is no reason to remove spaces from the field values.
|
||||||
// And XML element names need not be translated to various languages.
|
// And XML element names need not be translated to various languages.
|
||||||
@ -535,7 +535,7 @@ XNODE* NETLIST_EXPORTER_XML::makeDesignHeader()
|
|||||||
*/
|
*/
|
||||||
unsigned sheetIndex = 1; // Human readable index
|
unsigned sheetIndex = 1; // Human readable index
|
||||||
|
|
||||||
for( const SCH_SHEET_PATH& sheet : m_schematic->BuildSheetListSortedByPageNumbers() )
|
for( const SCH_SHEET_PATH& sheet : m_schematic->Hierarchy() )
|
||||||
{
|
{
|
||||||
screen = sheet.LastScreen();
|
screen = sheet.LastScreen();
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 1992-2018 jp.charras at wanadoo.fr
|
* Copyright (C) 1992-2018 jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 1992-2021 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 1992-2021, 2024 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -51,7 +51,7 @@ bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileNam
|
|||||||
unsigned aNetlistOptions, REPORTER* aReporter )
|
unsigned aNetlistOptions, REPORTER* aReporter )
|
||||||
{
|
{
|
||||||
// Ensure all power symbols have a valid reference
|
// Ensure all power symbols have a valid reference
|
||||||
Schematic().BuildSheetListSortedByPageNumbers().AnnotatePowerSymbols();
|
Schematic().Hierarchy().AnnotatePowerSymbols();
|
||||||
|
|
||||||
if( !ReadyToNetlist( _( "Exporting netlist requires a fully annotated schematic." ) ) )
|
if( !ReadyToNetlist( _( "Exporting netlist requires a fully annotated schematic." ) ) )
|
||||||
return false;
|
return false;
|
||||||
@ -193,7 +193,7 @@ bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileNam
|
|||||||
bool SCH_EDIT_FRAME::ReadyToNetlist( const wxString& aAnnotateMessage )
|
bool SCH_EDIT_FRAME::ReadyToNetlist( const wxString& aAnnotateMessage )
|
||||||
{
|
{
|
||||||
// Ensure all power symbols have a valid reference
|
// Ensure all power symbols have a valid reference
|
||||||
Schematic().BuildSheetListSortedByPageNumbers().AnnotatePowerSymbols();
|
Schematic().Hierarchy().AnnotatePowerSymbols();
|
||||||
|
|
||||||
// Symbols must be annotated
|
// Symbols must be annotated
|
||||||
if( CheckAnnotate( []( ERCE_T, const wxString&, SCH_REFERENCE*, SCH_REFERENCE* ) {} ) )
|
if( CheckAnnotate( []( ERCE_T, const wxString&, SCH_REFERENCE*, SCH_REFERENCE* ) {} ) )
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2023 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2023 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* 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
|
* under the terms of the GNU General Public License as published by the
|
||||||
@ -71,7 +71,7 @@ bool SCH_PRINTOUT::OnBeginDocument( int startPage, int endPage )
|
|||||||
|
|
||||||
bool SCH_PRINTOUT::OnPrintPage( int page )
|
bool SCH_PRINTOUT::OnPrintPage( int page )
|
||||||
{
|
{
|
||||||
SCH_SHEET_LIST sheetList = m_parent->Schematic().BuildSheetListSortedByPageNumbers();
|
SCH_SHEET_LIST sheetList = m_parent->Schematic().Hierarchy();
|
||||||
sheetList.SortByPageNumbers( false );
|
sheetList.SortByPageNumbers( false );
|
||||||
|
|
||||||
wxCHECK_MSG( page >= 1 && page <= (int)sheetList.size(), false,
|
wxCHECK_MSG( page >= 1 && page <= (int)sheetList.size(), false,
|
||||||
|
@ -383,8 +383,13 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
|
|||||||
if( itemsChanged.size() > 0 )
|
if( itemsChanged.size() > 0 )
|
||||||
schematic->OnItemsChanged( itemsChanged );
|
schematic->OnItemsChanged( itemsChanged );
|
||||||
|
|
||||||
if( frame && refreshHierarchy )
|
if( refreshHierarchy )
|
||||||
frame->UpdateHierarchyNavigator();
|
{
|
||||||
|
schematic->RefreshHierarchy();
|
||||||
|
|
||||||
|
if( frame )
|
||||||
|
frame->UpdateHierarchyNavigator();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !( aCommitFlags & SKIP_UNDO ) )
|
if( !( aCommitFlags & SKIP_UNDO ) )
|
||||||
@ -588,7 +593,7 @@ void SCH_COMMIT::Revert()
|
|||||||
{
|
{
|
||||||
// Lazy eval of sheet list; this is expensive even when unsorted
|
// Lazy eval of sheet list; this is expensive even when unsorted
|
||||||
if( sheets.empty() )
|
if( sheets.empty() )
|
||||||
sheets = schematic->BuildUnorderedSheetList();
|
sheets = schematic->Hierarchy();
|
||||||
|
|
||||||
SCH_SHEET_PATH sheet = sheets.FindSheetForScreen( screen );
|
SCH_SHEET_PATH sheet = sheets.FindSheetForScreen( screen );
|
||||||
symbol->SetRef( &sheet, field->GetText() );
|
symbol->SetRef( &sheet, field->GetText() );
|
||||||
|
@ -1050,7 +1050,7 @@ bool SCH_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
|
|||||||
|
|
||||||
void SCH_EDIT_FRAME::doCloseWindow()
|
void SCH_EDIT_FRAME::doCloseWindow()
|
||||||
{
|
{
|
||||||
SCH_SHEET_LIST sheetlist = Schematic().BuildUnorderedSheetList();
|
SCH_SHEET_LIST sheetlist = Schematic().Hierarchy();
|
||||||
|
|
||||||
// Shutdown all running tools
|
// Shutdown all running tools
|
||||||
if( m_toolManager )
|
if( m_toolManager )
|
||||||
@ -1763,7 +1763,7 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FL
|
|||||||
wxString highlightedConn = GetHighlightedConnection();
|
wxString highlightedConn = GetHighlightedConnection();
|
||||||
bool hasHighlightedConn = !highlightedConn.IsEmpty();
|
bool hasHighlightedConn = !highlightedConn.IsEmpty();
|
||||||
SCHEMATIC_SETTINGS& settings = Schematic().Settings();
|
SCHEMATIC_SETTINGS& settings = Schematic().Settings();
|
||||||
SCH_SHEET_LIST list = Schematic().BuildSheetListSortedByPageNumbers();
|
SCH_SHEET_LIST list = Schematic().Hierarchy();
|
||||||
SCH_COMMIT localCommit( m_toolManager );
|
SCH_COMMIT localCommit( m_toolManager );
|
||||||
|
|
||||||
if( !aCommit )
|
if( !aCommit )
|
||||||
@ -2275,7 +2275,7 @@ const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
|
|||||||
|
|
||||||
bool SCH_EDIT_FRAME::IsContentModified() const
|
bool SCH_EDIT_FRAME::IsContentModified() const
|
||||||
{
|
{
|
||||||
return Schematic().BuildUnorderedSheetList().IsModified();
|
return Schematic().Hierarchy().IsModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2347,7 +2347,7 @@ void SCH_EDIT_FRAME::SaveSymbolToSchematic( const LIB_SYMBOL& aSymbol,
|
|||||||
const KIID& aSchematicSymbolUUID )
|
const KIID& aSchematicSymbolUUID )
|
||||||
{
|
{
|
||||||
SCH_SHEET_PATH principalPath;
|
SCH_SHEET_PATH principalPath;
|
||||||
SCH_SHEET_LIST sheets = Schematic().BuildUnorderedSheetList();
|
SCH_SHEET_LIST sheets = Schematic().Hierarchy();
|
||||||
SCH_ITEM* item = sheets.GetItem( aSchematicSymbolUUID, &principalPath );
|
SCH_ITEM* item = sheets.GetItem( aSchematicSymbolUUID, &principalPath );
|
||||||
SCH_SYMBOL* principalSymbol = dynamic_cast<SCH_SYMBOL*>( item );
|
SCH_SYMBOL* principalSymbol = dynamic_cast<SCH_SYMBOL*>( item );
|
||||||
SCH_COMMIT commit( m_toolManager );
|
SCH_COMMIT commit( m_toolManager );
|
||||||
|
@ -875,7 +875,7 @@ void SCH_FIELD::OnScintillaCharAdded( SCINTILLA_TRICKS* aScintillaTricks,
|
|||||||
SCH_REFERENCE_LIST refs;
|
SCH_REFERENCE_LIST refs;
|
||||||
SCH_SYMBOL* refSymbol = nullptr;
|
SCH_SYMBOL* refSymbol = nullptr;
|
||||||
|
|
||||||
schematic->BuildUnorderedSheetList().GetSymbols( refs );
|
schematic->Hierarchy().GetSymbols( refs );
|
||||||
|
|
||||||
for( size_t jj = 0; jj < refs.GetCount(); jj++ )
|
for( size_t jj = 0; jj < refs.GetCount(); jj++ )
|
||||||
{
|
{
|
||||||
@ -1776,4 +1776,4 @@ static struct SCH_FIELD_DESC
|
|||||||
|
|
||||||
|
|
||||||
DECLARE_ENUM_TO_WXANY( GR_TEXT_H_ALIGN_T )
|
DECLARE_ENUM_TO_WXANY( GR_TEXT_H_ALIGN_T )
|
||||||
DECLARE_ENUM_TO_WXANY( GR_TEXT_V_ALIGN_T )
|
DECLARE_ENUM_TO_WXANY( GR_TEXT_V_ALIGN_T )
|
||||||
|
@ -145,7 +145,7 @@ SCH_SHEET* SCH_IO_CADSTAR_ARCHIVE::LoadSchematicFile( const wxString& aFi
|
|||||||
sch_plugin->SaveLibrary( libFileName.GetFullPath() );
|
sch_plugin->SaveLibrary( libFileName.GetFullPath() );
|
||||||
|
|
||||||
// Link up all symbols in the design to the newly created library
|
// Link up all symbols in the design to the newly created library
|
||||||
for( SCH_SHEET_PATH& sheet : aSchematic->BuildUnorderedSheetList() )
|
for( SCH_SHEET_PATH& sheet : aSchematic->Hierarchy() )
|
||||||
{
|
{
|
||||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||||
{
|
{
|
||||||
|
@ -368,7 +368,7 @@ void SCH_IO_KICAD_SEXPR::Format( SCH_SHEET* aSheet )
|
|||||||
wxCHECK_RET( aSheet != nullptr, "NULL SCH_SHEET* object." );
|
wxCHECK_RET( aSheet != nullptr, "NULL SCH_SHEET* object." );
|
||||||
wxCHECK_RET( m_schematic != nullptr, "NULL SCHEMATIC* object." );
|
wxCHECK_RET( m_schematic != nullptr, "NULL SCHEMATIC* object." );
|
||||||
|
|
||||||
SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
|
SCH_SHEET_LIST sheets = m_schematic->Hierarchy();
|
||||||
SCH_SCREEN* screen = aSheet->GetScreen();
|
SCH_SCREEN* screen = aSheet->GetScreen();
|
||||||
|
|
||||||
wxCHECK( screen, /* void */ );
|
wxCHECK( screen, /* void */ );
|
||||||
@ -538,7 +538,7 @@ void SCH_IO_KICAD_SEXPR::Format( EE_SELECTION* aSelection, SCH_SHEET_PATH* aSele
|
|||||||
wxCHECK( aSelection && aSelectionPath && aFormatter, /* void */ );
|
wxCHECK( aSelection && aSelectionPath && aFormatter, /* void */ );
|
||||||
|
|
||||||
LOCALE_IO toggle;
|
LOCALE_IO toggle;
|
||||||
SCH_SHEET_LIST sheets = aSchematic.BuildSheetListSortedByPageNumbers();
|
SCH_SHEET_LIST sheets = aSchematic.Hierarchy();
|
||||||
|
|
||||||
m_schematic = &aSchematic;
|
m_schematic = &aSchematic;
|
||||||
m_out = aFormatter;
|
m_out = aFormatter;
|
||||||
|
@ -1696,7 +1696,7 @@ void SCH_SCREENS::ClearAnnotationOfNewSheetPaths( SCH_SHEET_LIST& aInitialSheetP
|
|||||||
|
|
||||||
// Search for new sheet paths, not existing in aInitialSheetPathList
|
// Search for new sheet paths, not existing in aInitialSheetPathList
|
||||||
// and existing in sheetpathList
|
// and existing in sheetpathList
|
||||||
for( SCH_SHEET_PATH& sheetpath : sch->BuildSheetListSortedByPageNumbers() )
|
for( SCH_SHEET_PATH& sheetpath : sch->Hierarchy() )
|
||||||
{
|
{
|
||||||
bool path_exists = false;
|
bool path_exists = false;
|
||||||
|
|
||||||
@ -1836,7 +1836,7 @@ void SCH_SCREENS::UpdateSymbolLinks( REPORTER* aReporter )
|
|||||||
|
|
||||||
wxCHECK_RET( sch, "Null schematic in SCH_SCREENS::UpdateSymbolLinks" );
|
wxCHECK_RET( sch, "Null schematic in SCH_SCREENS::UpdateSymbolLinks" );
|
||||||
|
|
||||||
SCH_SHEET_LIST sheets = sch->BuildSheetListSortedByPageNumbers();
|
SCH_SHEET_LIST sheets = sch->Hierarchy();
|
||||||
|
|
||||||
// All of the library symbols have been replaced with copies so the connection graph
|
// All of the library symbols have been replaced with copies so the connection graph
|
||||||
// pointers are stale.
|
// pointers are stale.
|
||||||
@ -1935,7 +1935,7 @@ void SCH_SCREENS::BuildClientSheetPathList()
|
|||||||
for( SCH_SCREEN* curr_screen = GetFirst(); curr_screen; curr_screen = GetNext() )
|
for( SCH_SCREEN* curr_screen = GetFirst(); curr_screen; curr_screen = GetNext() )
|
||||||
curr_screen->GetClientSheetPaths().clear();
|
curr_screen->GetClientSheetPaths().clear();
|
||||||
|
|
||||||
for( SCH_SHEET_PATH& sheetpath : sch->BuildSheetListSortedByPageNumbers() )
|
for( SCH_SHEET_PATH& sheetpath : sch->Hierarchy() )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* used_screen = sheetpath.LastScreen();
|
SCH_SCREEN* used_screen = sheetpath.LastScreen();
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ bool SCH_SHEET::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, in
|
|||||||
}
|
}
|
||||||
else if( token->IsSameAs( wxT( "##" ) ) )
|
else if( token->IsSameAs( wxT( "##" ) ) )
|
||||||
{
|
{
|
||||||
*token = wxString::Format( wxT( "%d" ), (int) schematic->BuildUnorderedSheetList().size() );
|
*token = wxString::Format( wxT( "%d" ), (int) schematic->Hierarchy().size() );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if( token->IsSameAs( wxT( "SHEETPATH" ) ) )
|
else if( token->IsSameAs( wxT( "SHEETPATH" ) ) )
|
||||||
|
@ -1142,7 +1142,7 @@ void SCH_SYMBOL::SyncOtherUnits( const SCH_SHEET_PATH& aSourceSheet, SCH_COMMIT&
|
|||||||
{
|
{
|
||||||
wxString ref = GetRef( &aSourceSheet );
|
wxString ref = GetRef( &aSourceSheet );
|
||||||
|
|
||||||
for( SCH_SHEET_PATH& sheet : Schematic()->BuildUnorderedSheetList() )
|
for( SCH_SHEET_PATH& sheet : Schematic()->Hierarchy() )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = sheet.LastScreen();
|
SCH_SCREEN* screen = sheet.LastScreen();
|
||||||
std::vector<SCH_SYMBOL*> otherUnits;
|
std::vector<SCH_SYMBOL*> otherUnits;
|
||||||
|
@ -78,7 +78,7 @@ SCHEMATIC::SCHEMATIC( PROJECT* aPrj ) :
|
|||||||
int unit = symbol->GetUnit();
|
int unit = symbol->GetUnit();
|
||||||
LIB_ID libId = symbol->GetLibId();
|
LIB_ID libId = symbol->GetLibId();
|
||||||
|
|
||||||
for( SCH_SHEET_PATH& sheet : BuildUnorderedSheetList() )
|
for( SCH_SHEET_PATH& sheet : Hierarchy() )
|
||||||
{
|
{
|
||||||
std::vector<SCH_SYMBOL*> otherUnits;
|
std::vector<SCH_SYMBOL*> otherUnits;
|
||||||
|
|
||||||
@ -200,6 +200,7 @@ void SCHEMATIC::SetRoot( SCH_SHEET* aRootSheet )
|
|||||||
m_currentSheet->clear();
|
m_currentSheet->clear();
|
||||||
m_currentSheet->push_back( m_rootSheet );
|
m_currentSheet->push_back( m_rootSheet );
|
||||||
|
|
||||||
|
m_hierarchy = BuildSheetListSortedByPageNumbers();
|
||||||
m_connectionGraph->Reset();
|
m_connectionGraph->Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,6 +211,22 @@ SCH_SCREEN* SCHEMATIC::RootScreen() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SCH_SHEET_LIST SCHEMATIC::Hierarchy() const
|
||||||
|
{
|
||||||
|
wxCHECK( !m_hierarchy.empty(), m_hierarchy );
|
||||||
|
|
||||||
|
return m_hierarchy;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCHEMATIC::RefreshHierarchy()
|
||||||
|
{
|
||||||
|
wxLogDebug( wxS( "Refreshing schematic heirarchy." ) );
|
||||||
|
|
||||||
|
m_hierarchy = SCH_SHEET_LIST( m_rootSheet );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCHEMATIC::GetContextualTextVars( wxArrayString* aVars ) const
|
void SCHEMATIC::GetContextualTextVars( wxArrayString* aVars ) const
|
||||||
{
|
{
|
||||||
auto add =
|
auto add =
|
||||||
@ -310,7 +327,7 @@ ERC_SETTINGS& SCHEMATIC::ErcSettings() const
|
|||||||
|
|
||||||
std::vector<SCH_MARKER*> SCHEMATIC::ResolveERCExclusions()
|
std::vector<SCH_MARKER*> SCHEMATIC::ResolveERCExclusions()
|
||||||
{
|
{
|
||||||
SCH_SHEET_LIST sheetList = BuildUnorderedSheetList();
|
SCH_SHEET_LIST sheetList = Hierarchy();
|
||||||
ERC_SETTINGS& settings = ErcSettings();
|
ERC_SETTINGS& settings = ErcSettings();
|
||||||
|
|
||||||
// Migrate legacy marker exclusions to new format to ensure exclusion matching functions across
|
// Migrate legacy marker exclusions to new format to ensure exclusion matching functions across
|
||||||
@ -392,7 +409,7 @@ std::vector<SCH_MARKER*> SCHEMATIC::ResolveERCExclusions()
|
|||||||
|
|
||||||
std::shared_ptr<BUS_ALIAS> SCHEMATIC::GetBusAlias( const wxString& aLabel ) const
|
std::shared_ptr<BUS_ALIAS> SCHEMATIC::GetBusAlias( const wxString& aLabel ) const
|
||||||
{
|
{
|
||||||
for( const SCH_SHEET_PATH& sheet : BuildUnorderedSheetList() )
|
for( const SCH_SHEET_PATH& sheet : Hierarchy() )
|
||||||
{
|
{
|
||||||
for( const std::shared_ptr<BUS_ALIAS>& alias : sheet.LastScreen()->GetBusAliases() )
|
for( const std::shared_ptr<BUS_ALIAS>& alias : sheet.LastScreen()->GetBusAliases() )
|
||||||
{
|
{
|
||||||
@ -462,7 +479,7 @@ std::map<int, wxString> SCHEMATIC::GetVirtualPageToSheetNamesMap() const
|
|||||||
{
|
{
|
||||||
std::map<int, wxString> namesMap;
|
std::map<int, wxString> namesMap;
|
||||||
|
|
||||||
for( const SCH_SHEET_PATH& sheet : BuildUnorderedSheetList() )
|
for( const SCH_SHEET_PATH& sheet : Hierarchy() )
|
||||||
{
|
{
|
||||||
if( sheet.size() == 1 )
|
if( sheet.size() == 1 )
|
||||||
namesMap[sheet.GetVirtualPageNumber()] = _( "<root sheet>" );
|
namesMap[sheet.GetVirtualPageNumber()] = _( "<root sheet>" );
|
||||||
@ -478,7 +495,7 @@ std::map<int, wxString> SCHEMATIC::GetVirtualPageToSheetPagesMap() const
|
|||||||
{
|
{
|
||||||
std::map<int, wxString> pagesMap;
|
std::map<int, wxString> pagesMap;
|
||||||
|
|
||||||
for( const SCH_SHEET_PATH& sheet : BuildUnorderedSheetList() )
|
for( const SCH_SHEET_PATH& sheet : Hierarchy() )
|
||||||
pagesMap[sheet.GetVirtualPageNumber()] = sheet.GetPageNumber();
|
pagesMap[sheet.GetVirtualPageNumber()] = sheet.GetPageNumber();
|
||||||
|
|
||||||
return pagesMap;
|
return pagesMap;
|
||||||
@ -526,7 +543,7 @@ wxString SCHEMATIC::ConvertRefsToKIIDs( const wxString& aSource ) const
|
|||||||
wxString ref = token.BeforeFirst( ':', &remainder );
|
wxString ref = token.BeforeFirst( ':', &remainder );
|
||||||
SCH_REFERENCE_LIST references;
|
SCH_REFERENCE_LIST references;
|
||||||
|
|
||||||
BuildUnorderedSheetList().GetSymbols( references );
|
Hierarchy().GetSymbols( references );
|
||||||
|
|
||||||
for( size_t jj = 0; jj < references.GetCount(); jj++ )
|
for( size_t jj = 0; jj < references.GetCount(); jj++ )
|
||||||
{
|
{
|
||||||
@ -602,17 +619,6 @@ wxString SCHEMATIC::ConvertKIIDsToRefs( const wxString& aSource ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_SHEET_LIST& SCHEMATIC::GetFullHierarchy() const
|
|
||||||
{
|
|
||||||
static SCH_SHEET_LIST hierarchy;
|
|
||||||
|
|
||||||
hierarchy.clear();
|
|
||||||
hierarchy.BuildSheetList( m_rootSheet, false );
|
|
||||||
|
|
||||||
return hierarchy;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SCHEMATIC::SetLegacySymbolInstanceData()
|
void SCHEMATIC::SetLegacySymbolInstanceData()
|
||||||
{
|
{
|
||||||
SCH_SCREENS screens( m_rootSheet );
|
SCH_SCREENS screens( m_rootSheet );
|
||||||
@ -649,7 +655,7 @@ void SCHEMATIC::SetSheetNumberAndCount()
|
|||||||
|
|
||||||
// @todo Remove all pseudo page number system is left over from prior to real page number
|
// @todo Remove all pseudo page number system is left over from prior to real page number
|
||||||
// implementation.
|
// implementation.
|
||||||
for( const SCH_SHEET_PATH& sheet : BuildSheetListSortedByPageNumbers() )
|
for( const SCH_SHEET_PATH& sheet : Hierarchy() )
|
||||||
{
|
{
|
||||||
if( sheet.Path() == current_sheetpath ) // Current sheet path found
|
if( sheet.Path() == current_sheetpath ) // Current sheet path found
|
||||||
break;
|
break;
|
||||||
@ -672,7 +678,7 @@ void SCHEMATIC::RecomputeIntersheetRefs( const std::function<void( SCH_GLOBALLAB
|
|||||||
|
|
||||||
pageRefsMap.clear();
|
pageRefsMap.clear();
|
||||||
|
|
||||||
for( const SCH_SHEET_PATH& sheet : BuildSheetListSortedByPageNumbers() )
|
for( const SCH_SHEET_PATH& sheet : Hierarchy() )
|
||||||
{
|
{
|
||||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_GLOBAL_LABEL_T ) )
|
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_GLOBAL_LABEL_T ) )
|
||||||
{
|
{
|
||||||
@ -811,7 +817,7 @@ void SCHEMATIC::RemoveAllListeners()
|
|||||||
void SCHEMATIC::RecordERCExclusions()
|
void SCHEMATIC::RecordERCExclusions()
|
||||||
{
|
{
|
||||||
// Use a sorted sheetList to reduce file churn
|
// Use a sorted sheetList to reduce file churn
|
||||||
SCH_SHEET_LIST sheetList = BuildSheetListSortedByPageNumbers();
|
SCH_SHEET_LIST sheetList = Hierarchy();
|
||||||
ERC_SETTINGS& ercSettings = ErcSettings();
|
ERC_SETTINGS& ercSettings = ErcSettings();
|
||||||
|
|
||||||
ercSettings.m_ErcExclusions.clear();
|
ercSettings.m_ErcExclusions.clear();
|
||||||
@ -836,7 +842,7 @@ void SCHEMATIC::RecordERCExclusions()
|
|||||||
|
|
||||||
void SCHEMATIC::ResolveERCExclusionsPostUpdate()
|
void SCHEMATIC::ResolveERCExclusionsPostUpdate()
|
||||||
{
|
{
|
||||||
SCH_SHEET_LIST sheetList = BuildUnorderedSheetList();
|
SCH_SHEET_LIST sheetList = Hierarchy();
|
||||||
|
|
||||||
for( SCH_MARKER* marker : ResolveERCExclusions() )
|
for( SCH_MARKER* marker : ResolveERCExclusions() )
|
||||||
{
|
{
|
||||||
@ -867,7 +873,7 @@ void SCHEMATIC::EmbedFonts()
|
|||||||
{
|
{
|
||||||
std::set<KIFONT::OUTLINE_FONT*> fonts;
|
std::set<KIFONT::OUTLINE_FONT*> fonts;
|
||||||
|
|
||||||
SCH_SHEET_LIST sheetList = BuildUnorderedSheetList();
|
SCH_SHEET_LIST sheetList = Hierarchy();
|
||||||
|
|
||||||
for( const SCH_SHEET_PATH& sheet : sheetList )
|
for( const SCH_SHEET_PATH& sheet : sheetList )
|
||||||
{
|
{
|
||||||
|
@ -49,6 +49,7 @@ public:
|
|||||||
virtual SCH_SHEET_PATH& CurrentSheet() const = 0;
|
virtual SCH_SHEET_PATH& CurrentSheet() const = 0;
|
||||||
virtual wxString GetFileName() const = 0;
|
virtual wxString GetFileName() const = 0;
|
||||||
virtual PROJECT& Prj() const = 0;
|
virtual PROJECT& Prj() const = 0;
|
||||||
|
virtual SCH_SHEET_LIST Hierarchy() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SCHEMATIC;
|
class SCHEMATIC;
|
||||||
@ -105,6 +106,13 @@ public:
|
|||||||
return sheets;
|
return sheets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the full schematic flattened hierarchical sheet list.
|
||||||
|
*/
|
||||||
|
SCH_SHEET_LIST Hierarchy() const override;
|
||||||
|
|
||||||
|
void RefreshHierarchy();
|
||||||
|
|
||||||
SCH_ITEM* GetItem( const KIID& aID, SCH_SHEET_PATH* aPathOut = nullptr ) const
|
SCH_ITEM* GetItem( const KIID& aID, SCH_SHEET_PATH* aPathOut = nullptr ) const
|
||||||
{
|
{
|
||||||
return BuildUnorderedSheetList().GetItem( aID, aPathOut );
|
return BuildUnorderedSheetList().GetItem( aID, aPathOut );
|
||||||
@ -193,11 +201,6 @@ public:
|
|||||||
wxString ConvertRefsToKIIDs( const wxString& aSource ) const;
|
wxString ConvertRefsToKIIDs( const wxString& aSource ) const;
|
||||||
wxString ConvertKIIDsToRefs( const wxString& aSource ) const;
|
wxString ConvertKIIDsToRefs( const wxString& aSource ) const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the full schematic flattened hierarchical sheet list.
|
|
||||||
*/
|
|
||||||
SCH_SHEET_LIST& GetFullHierarchy() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the symbol value and footprint instance data for legacy designs.
|
* Update the symbol value and footprint instance data for legacy designs.
|
||||||
*
|
*
|
||||||
@ -380,6 +383,11 @@ private:
|
|||||||
*/
|
*/
|
||||||
std::map<wxString, double> m_operatingPoints;
|
std::map<wxString, double> m_operatingPoints;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache of the entire schematic hierarchy sorted by sheet page number.
|
||||||
|
*/
|
||||||
|
SCH_SHEET_LIST m_hierarchy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Currently installed listeners
|
* Currently installed listeners
|
||||||
*/
|
*/
|
||||||
|
@ -285,6 +285,7 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
|||||||
std::set<SCH_TABLE*> changedTables;
|
std::set<SCH_TABLE*> changedTables;
|
||||||
bool dirtyConnectivity = false;
|
bool dirtyConnectivity = false;
|
||||||
bool rebuildHierarchyNavigator = false;
|
bool rebuildHierarchyNavigator = false;
|
||||||
|
bool refreshHierarchy = false;
|
||||||
SCH_CLEANUP_FLAGS connectivityCleanUp = NO_CLEANUP;
|
SCH_CLEANUP_FLAGS connectivityCleanUp = NO_CLEANUP;
|
||||||
SCH_SHEET_LIST sheets;
|
SCH_SHEET_LIST sheets;
|
||||||
bool clearedRepeatItems = false;
|
bool clearedRepeatItems = false;
|
||||||
@ -357,6 +358,7 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
|||||||
if( eda_item->Type() == SCH_SHEET_T )
|
if( eda_item->Type() == SCH_SHEET_T )
|
||||||
{
|
{
|
||||||
rebuildHierarchyNavigator = true;
|
rebuildHierarchyNavigator = true;
|
||||||
|
refreshHierarchy = true;
|
||||||
|
|
||||||
if( static_cast<SCH_SHEET*>( eda_item )->GetScreen() == GetScreen() )
|
if( static_cast<SCH_SHEET*>( eda_item )->GetScreen() == GetScreen() )
|
||||||
GetToolManager()->PostAction( EE_ACTIONS::leaveSheet );
|
GetToolManager()->PostAction( EE_ACTIONS::leaveSheet );
|
||||||
@ -370,7 +372,10 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
|||||||
else if( status == UNDO_REDO::DELETED )
|
else if( status == UNDO_REDO::DELETED )
|
||||||
{
|
{
|
||||||
if( eda_item->Type() == SCH_SHEET_T )
|
if( eda_item->Type() == SCH_SHEET_T )
|
||||||
|
{
|
||||||
rebuildHierarchyNavigator = true;
|
rebuildHierarchyNavigator = true;
|
||||||
|
refreshHierarchy = true;
|
||||||
|
}
|
||||||
|
|
||||||
if( schItem )
|
if( schItem )
|
||||||
updateConnectivityFlag();
|
updateConnectivityFlag();
|
||||||
@ -385,7 +390,7 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
|||||||
{
|
{
|
||||||
// Lazy eval of sheet list; this is expensive even when unsorted
|
// Lazy eval of sheet list; this is expensive even when unsorted
|
||||||
if( sheets.empty() )
|
if( sheets.empty() )
|
||||||
sheets = m_schematic->BuildUnorderedSheetList();
|
sheets = m_schematic->Hierarchy();
|
||||||
|
|
||||||
SCH_SHEET_PATH undoSheet = sheets.FindSheetForScreen( screen );
|
SCH_SHEET_PATH undoSheet = sheets.FindSheetForScreen( screen );
|
||||||
|
|
||||||
@ -415,7 +420,10 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
|||||||
AddCopyForRepeatItem( schItem );
|
AddCopyForRepeatItem( schItem );
|
||||||
|
|
||||||
if( schItem->Type() == SCH_SHEET_T )
|
if( schItem->Type() == SCH_SHEET_T )
|
||||||
|
{
|
||||||
rebuildHierarchyNavigator = true;
|
rebuildHierarchyNavigator = true;
|
||||||
|
refreshHierarchy = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( schItem )
|
else if( schItem )
|
||||||
@ -448,6 +456,13 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
|||||||
{
|
{
|
||||||
rebuildHierarchyNavigator = true;
|
rebuildHierarchyNavigator = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sheet name changes do not require rebuilding the hiearchy.
|
||||||
|
if( ( origSheet->GetFileName() != copySheet->GetFileName() )
|
||||||
|
|| origSheet->HasPageNumberChanges( *copySheet ) )
|
||||||
|
{
|
||||||
|
refreshHierarchy = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
schItem->SwapData( itemCopy );
|
schItem->SwapData( itemCopy );
|
||||||
@ -464,7 +479,7 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
|||||||
{
|
{
|
||||||
// Lazy eval of sheet list; this is expensive even when unsorted
|
// Lazy eval of sheet list; this is expensive even when unsorted
|
||||||
if( sheets.empty() )
|
if( sheets.empty() )
|
||||||
sheets = m_schematic->BuildUnorderedSheetList();
|
sheets = m_schematic->Hierarchy();
|
||||||
|
|
||||||
SCH_SHEET_PATH sheet = sheets.FindSheetForScreen( screen );
|
SCH_SHEET_PATH sheet = sheets.FindSheetForScreen( screen );
|
||||||
symbol->SetRef( &sheet, field->GetText() );
|
symbol->SetRef( &sheet, field->GetText() );
|
||||||
@ -504,6 +519,9 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
|||||||
if( bulkChangedItems.size() > 0 )
|
if( bulkChangedItems.size() > 0 )
|
||||||
Schematic().OnItemsChanged( bulkChangedItems );
|
Schematic().OnItemsChanged( bulkChangedItems );
|
||||||
|
|
||||||
|
if( refreshHierarchy )
|
||||||
|
Schematic().RefreshHierarchy();
|
||||||
|
|
||||||
if( dirtyConnectivity )
|
if( dirtyConnectivity )
|
||||||
{
|
{
|
||||||
wxLogTrace( wxS( "CONN_PROFILE" ),
|
wxLogTrace( wxS( "CONN_PROFILE" ),
|
||||||
|
@ -53,7 +53,7 @@ bool SCH_EDIT_FRAME::CheckSheetForRecursion( SCH_SHEET* aSheet, SCH_SHEET_PATH*
|
|||||||
wxASSERT( aSheet && aCurrentSheet );
|
wxASSERT( aSheet && aCurrentSheet );
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
SCH_SHEET_LIST schematicSheets = Schematic().BuildUnorderedSheetList();
|
SCH_SHEET_LIST schematicSheets = Schematic().Hierarchy();
|
||||||
SCH_SHEET_LIST loadedSheets( aSheet ); // This is the schematicSheets of the loaded file.
|
SCH_SHEET_LIST loadedSheets( aSheet ); // This is the schematicSheets of the loaded file.
|
||||||
|
|
||||||
wxString destFilePath = aCurrentSheet->LastScreen()->GetFileName();
|
wxString destFilePath = aCurrentSheet->LastScreen()->GetFileName();
|
||||||
@ -282,7 +282,7 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aCurr
|
|||||||
}
|
}
|
||||||
|
|
||||||
SCH_SHEET_LIST loadedSheets( tmpSheet.get() );
|
SCH_SHEET_LIST loadedSheets( tmpSheet.get() );
|
||||||
SCH_SHEET_LIST schematicSheets = Schematic().BuildUnorderedSheetList();
|
SCH_SHEET_LIST schematicSheets = Schematic().Hierarchy();
|
||||||
|
|
||||||
// Make sure any new sheet changes do not cause any recursion issues.
|
// Make sure any new sheet changes do not cause any recursion issues.
|
||||||
if( !aSkipRecursionCheck && CheckSheetForRecursion( tmpSheet.get(), aCurrentSheet ) )
|
if( !aSkipRecursionCheck && CheckSheetForRecursion( tmpSheet.get(), aCurrentSheet ) )
|
||||||
@ -699,7 +699,7 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard()
|
|||||||
bool SCH_EDIT_FRAME::AllowCaseSensitiveFileNameClashes( const wxString& aOldName, const wxString& aSchematicFileName )
|
bool SCH_EDIT_FRAME::AllowCaseSensitiveFileNameClashes( const wxString& aOldName, const wxString& aSchematicFileName )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
SCH_SHEET_LIST sheets = Schematic().BuildUnorderedSheetList();
|
SCH_SHEET_LIST sheets = Schematic().Hierarchy();
|
||||||
wxFileName fn = aSchematicFileName;
|
wxFileName fn = aSchematicFileName;
|
||||||
|
|
||||||
wxCHECK( fn.IsAbsolute(), false );
|
wxCHECK( fn.IsAbsolute(), false );
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2004-2022, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -48,7 +48,7 @@ void SCH_EDITOR_CONTROL::AssignFootprints( const std::string& aChangedSetOfRefer
|
|||||||
bool isChanged = false;
|
bool isChanged = false;
|
||||||
bool appendToUndoList = false;
|
bool appendToUndoList = false;
|
||||||
|
|
||||||
m_frame->Schematic().BuildUnorderedSheetList().GetSymbols( refs, false );
|
m_frame->Schematic().Hierarchy().GetSymbols( refs, false );
|
||||||
|
|
||||||
DSNLEXER lexer( aChangedSetOfReferences, From_UTF8( __func__ ) );
|
DSNLEXER lexer( aChangedSetOfReferences, From_UTF8( __func__ ) );
|
||||||
PTREE doc;
|
PTREE doc;
|
||||||
@ -128,7 +128,7 @@ bool SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile( const wxString& aFullFil
|
|||||||
{
|
{
|
||||||
// Build a flat list of symbols in schematic:
|
// Build a flat list of symbols in schematic:
|
||||||
SCH_REFERENCE_LIST referencesList;
|
SCH_REFERENCE_LIST referencesList;
|
||||||
m_frame->Schematic().BuildUnorderedSheetList().GetSymbols( referencesList, false );
|
m_frame->Schematic().Hierarchy().GetSymbols( referencesList, false );
|
||||||
|
|
||||||
FILE* cmpFile = wxFopen( aFullFilename, wxT( "rt" ) );
|
FILE* cmpFile = wxFopen( aFullFilename, wxT( "rt" ) );
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019 Alexander Shuklin <Jasuramme@gmail.com>
|
* Copyright (C) 2019 Alexander Shuklin <Jasuramme@gmail.com>
|
||||||
* Copyright (C) 2004-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2004-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -80,7 +80,7 @@ bool BACK_ANNOTATE::BackAnnotateSymbols( const std::string& aNetlist )
|
|||||||
|
|
||||||
getPcbModulesFromString( aNetlist );
|
getPcbModulesFromString( aNetlist );
|
||||||
|
|
||||||
SCH_SHEET_LIST sheets = m_frame->Schematic().BuildUnorderedSheetList();
|
SCH_SHEET_LIST sheets = m_frame->Schematic().Hierarchy();
|
||||||
sheets.GetSymbols( m_refs, false );
|
sheets.GetSymbols( m_refs, false );
|
||||||
sheets.GetMultiUnitSymbols( m_multiUnitsRefs );
|
sheets.GetMultiUnitSymbols( m_multiUnitsRefs );
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
|||||||
|
|
||||||
// First we need to get all instances of this sheet so we can annotate
|
// First we need to get all instances of this sheet so we can annotate
|
||||||
// whatever symbols we place on all copies
|
// whatever symbols we place on all copies
|
||||||
SCH_SHEET_LIST hierarchy = m_frame->Schematic().BuildSheetListSortedByPageNumbers();
|
SCH_SHEET_LIST hierarchy = m_frame->Schematic().Hierarchy();
|
||||||
SCH_SHEET_LIST newInstances =
|
SCH_SHEET_LIST newInstances =
|
||||||
hierarchy.FindAllSheetsForScreen( m_frame->GetCurrentSheet().LastScreen() );
|
hierarchy.FindAllSheetsForScreen( m_frame->GetCurrentSheet().LastScreen() );
|
||||||
newInstances.SortByPageNumbers();
|
newInstances.SortByPageNumbers();
|
||||||
@ -2929,7 +2929,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||||||
sheet->SetBackgroundColor( cfg->m_Drawing.default_sheet_background_color );
|
sheet->SetBackgroundColor( cfg->m_Drawing.default_sheet_background_color );
|
||||||
sizeSheet( sheet, cursorPos );
|
sizeSheet( sheet, cursorPos );
|
||||||
|
|
||||||
SCH_SHEET_LIST hierarchy = m_frame->Schematic().GetFullHierarchy();
|
SCH_SHEET_LIST hierarchy = m_frame->Schematic().Hierarchy();
|
||||||
SCH_SHEET_PATH instance = m_frame->GetCurrentSheet();
|
SCH_SHEET_PATH instance = m_frame->GetCurrentSheet();
|
||||||
instance.push_back( sheet );
|
instance.push_back( sheet );
|
||||||
wxString pageNumber;
|
wxString pageNumber;
|
||||||
|
@ -2086,9 +2086,14 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||||||
if( okPressed )
|
if( okPressed )
|
||||||
{
|
{
|
||||||
if( isUndoable )
|
if( isUndoable )
|
||||||
|
{
|
||||||
commit.Push( _( "Edit Sheet Properties" ) );
|
commit.Push( _( "Edit Sheet Properties" ) );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
m_frame->Schematic().RefreshHierarchy();
|
||||||
m_frame->UpdateHierarchyNavigator();
|
m_frame->UpdateHierarchyNavigator();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1656,7 +1656,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||||||
EDA_ITEMS loadedItems;
|
EDA_ITEMS loadedItems;
|
||||||
std::vector<SCH_ITEM*> sortedLoadedItems;
|
std::vector<SCH_ITEM*> sortedLoadedItems;
|
||||||
bool sheetsPasted = false;
|
bool sheetsPasted = false;
|
||||||
SCH_SHEET_LIST hierarchy = m_frame->Schematic().BuildSheetListSortedByPageNumbers();
|
SCH_SHEET_LIST hierarchy = m_frame->Schematic().Hierarchy();
|
||||||
SCH_SHEET_PATH& pasteRoot = m_frame->GetCurrentSheet();
|
SCH_SHEET_PATH& pasteRoot = m_frame->GetCurrentSheet();
|
||||||
wxFileName destFn = pasteRoot.Last()->GetFileName();
|
wxFileName destFn = pasteRoot.Last()->GetFileName();
|
||||||
|
|
||||||
@ -1818,7 +1818,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||||||
|
|
||||||
// Update hierarchy to include any other sheets we already added, avoiding
|
// Update hierarchy to include any other sheets we already added, avoiding
|
||||||
// duplicate sheet names
|
// duplicate sheet names
|
||||||
hierarchy = m_frame->Schematic().BuildSheetListSortedByPageNumbers();
|
hierarchy = m_frame->Schematic().Hierarchy();
|
||||||
|
|
||||||
//@todo: it might be better to just iterate through the sheet names
|
//@todo: it might be better to just iterate through the sheet names
|
||||||
// in this screen instead of the whole hierarchy.
|
// in this screen instead of the whole hierarchy.
|
||||||
@ -1968,7 +1968,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||||||
|
|
||||||
// Get a version with correct sheet numbers since we've pasted sheets,
|
// Get a version with correct sheet numbers since we've pasted sheets,
|
||||||
// we'll need this when annotating next
|
// we'll need this when annotating next
|
||||||
hierarchy = m_frame->Schematic().BuildSheetListSortedByPageNumbers();
|
hierarchy = m_frame->Schematic().Hierarchy();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<SCH_SHEET_PATH, SCH_REFERENCE_LIST> annotatedSymbols;
|
std::map<SCH_SHEET_PATH, SCH_REFERENCE_LIST> annotatedSymbols;
|
||||||
@ -2057,7 +2057,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||||||
// schematic file.
|
// schematic file.
|
||||||
prunePastedSymbolInstances();
|
prunePastedSymbolInstances();
|
||||||
|
|
||||||
SCH_SHEET_LIST sheets = m_frame->Schematic().BuildUnorderedSheetList();
|
SCH_SHEET_LIST sheets = m_frame->Schematic().Hierarchy();
|
||||||
SCH_SCREENS allScreens( m_frame->Schematic().Root() );
|
SCH_SCREENS allScreens( m_frame->Schematic().Root() );
|
||||||
|
|
||||||
allScreens.PruneOrphanedSymbolInstances( m_frame->Prj().GetProjectName(), sheets );
|
allScreens.PruneOrphanedSymbolInstances( m_frame->Prj().GetProjectName(), sheets );
|
||||||
@ -2278,7 +2278,7 @@ int SCH_EDITOR_CONTROL::IncrementAnnotations( const TOOL_EVENT& aEvent )
|
|||||||
SCH_REFERENCE_LIST references;
|
SCH_REFERENCE_LIST references;
|
||||||
|
|
||||||
if( dlg.m_AllSheets->GetValue() )
|
if( dlg.m_AllSheets->GetValue() )
|
||||||
schematic->BuildSheetListSortedByPageNumbers().GetSymbols( references );
|
schematic->Hierarchy().GetSymbols( references );
|
||||||
else
|
else
|
||||||
schematic->CurrentSheet().GetSymbols( references );
|
schematic->CurrentSheet().GetSymbols( references );
|
||||||
|
|
||||||
@ -2665,7 +2665,7 @@ int SCH_EDITOR_CONTROL::RepairSchematic( const TOOL_EVENT& aEvent )
|
|||||||
std::map<KIID, EDA_ITEM*> ids;
|
std::map<KIID, EDA_ITEM*> ids;
|
||||||
int duplicates = 0;
|
int duplicates = 0;
|
||||||
|
|
||||||
SCH_SHEET_LIST sheets = m_frame->Schematic().BuildUnorderedSheetList();
|
SCH_SHEET_LIST sheets = m_frame->Schematic().Hierarchy();
|
||||||
|
|
||||||
auto processItem =
|
auto processItem =
|
||||||
[&]( EDA_ITEM* aItem )
|
[&]( EDA_ITEM* aItem )
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019 CERN
|
* Copyright (C) 2019 CERN
|
||||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -434,7 +434,7 @@ int SCH_FIND_REPLACE_TOOL::ReplaceAll( const TOOL_EVENT& aEvent )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SCH_SHEET_LIST allSheets = m_frame->Schematic().BuildUnorderedSheetList();
|
SCH_SHEET_LIST allSheets = m_frame->Schematic().Hierarchy();
|
||||||
SCH_SCREENS screens( m_frame->Schematic().Root() );
|
SCH_SCREENS screens( m_frame->Schematic().Root() );
|
||||||
|
|
||||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
|
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019 CERN
|
* Copyright (C) 2019 CERN
|
||||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -42,7 +42,7 @@ void SCH_NAVIGATE_TOOL::ResetHistory()
|
|||||||
|
|
||||||
void SCH_NAVIGATE_TOOL::CleanHistory()
|
void SCH_NAVIGATE_TOOL::CleanHistory()
|
||||||
{
|
{
|
||||||
SCH_SHEET_LIST sheets = m_frame->Schematic().BuildUnorderedSheetList();
|
SCH_SHEET_LIST sheets = m_frame->Schematic().Hierarchy();
|
||||||
|
|
||||||
// Search through our history, and removing any entries
|
// Search through our history, and removing any entries
|
||||||
// that the no longer point to a sheet on the schematic
|
// that the no longer point to a sheet on the schematic
|
||||||
@ -69,7 +69,7 @@ void SCH_NAVIGATE_TOOL::HypertextCommand( const wxString& href )
|
|||||||
}
|
}
|
||||||
else if( EDA_TEXT::IsGotoPageHref( href, &destPage ) && !destPage.IsEmpty() )
|
else if( EDA_TEXT::IsGotoPageHref( href, &destPage ) && !destPage.IsEmpty() )
|
||||||
{
|
{
|
||||||
for( const SCH_SHEET_PATH& sheet : m_frame->Schematic().BuildSheetListSortedByPageNumbers() )
|
for( const SCH_SHEET_PATH& sheet : m_frame->Schematic().Hierarchy() )
|
||||||
{
|
{
|
||||||
if( sheet.GetPageNumber() == destPage )
|
if( sheet.GetPageNumber() == destPage )
|
||||||
{
|
{
|
||||||
@ -147,7 +147,7 @@ int SCH_NAVIGATE_TOOL::Previous( const TOOL_EVENT& aEvent )
|
|||||||
if( CanGoPrevious() )
|
if( CanGoPrevious() )
|
||||||
{
|
{
|
||||||
int targetSheet = m_frame->GetCurrentSheet().GetVirtualPageNumber() - 1;
|
int targetSheet = m_frame->GetCurrentSheet().GetVirtualPageNumber() - 1;
|
||||||
changeSheet( m_frame->Schematic().BuildSheetListSortedByPageNumbers().at( targetSheet - 1 ) );
|
changeSheet( m_frame->Schematic().Hierarchy().at( targetSheet - 1 ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -163,7 +163,7 @@ int SCH_NAVIGATE_TOOL::Next( const TOOL_EVENT& aEvent )
|
|||||||
if( CanGoNext() )
|
if( CanGoNext() )
|
||||||
{
|
{
|
||||||
int targetSheet = m_frame->GetCurrentSheet().GetVirtualPageNumber() + 1;
|
int targetSheet = m_frame->GetCurrentSheet().GetVirtualPageNumber() + 1;
|
||||||
changeSheet( m_frame->Schematic().BuildSheetListSortedByPageNumbers().at( targetSheet - 1 ) );
|
changeSheet( m_frame->Schematic().Hierarchy().at( targetSheet - 1 ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -201,7 +201,7 @@ bool SCH_NAVIGATE_TOOL::CanGoPrevious()
|
|||||||
bool SCH_NAVIGATE_TOOL::CanGoNext()
|
bool SCH_NAVIGATE_TOOL::CanGoNext()
|
||||||
{
|
{
|
||||||
return m_frame->GetCurrentSheet().GetVirtualPageNumber()
|
return m_frame->GetCurrentSheet().GetVirtualPageNumber()
|
||||||
< (int) m_frame->Schematic().BuildUnorderedSheetList().size();
|
< (int) m_frame->Schematic().Hierarchy().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user