start moving to virtual page numbers
This commit is contained in:
parent
72e39fc865
commit
51bcfaafd7
|
@ -1509,23 +1509,23 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags )
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::RecomputeIntersheetRefs()
|
void SCH_EDIT_FRAME::RecomputeIntersheetRefs()
|
||||||
{
|
{
|
||||||
std::map<wxString, std::set<wxString>>& pageRefsMap = Schematic().GetPageRefsMap();
|
std::map<wxString, std::set<int>>& pageRefsMap = Schematic().GetPageRefsMap();
|
||||||
|
|
||||||
pageRefsMap.clear();
|
pageRefsMap.clear();
|
||||||
|
|
||||||
SCH_SCREENS screens( Schematic().Root() );
|
SCH_SCREENS screens( Schematic().Root() );
|
||||||
std::vector<wxString> pageNumbers;
|
std::vector<int> virtualPageNumbers;
|
||||||
|
|
||||||
/* Iterate over screens */
|
/* Iterate over screens */
|
||||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen != nullptr; screen = screens.GetNext() )
|
for( SCH_SCREEN* screen = screens.GetFirst(); screen != nullptr; screen = screens.GetNext() )
|
||||||
{
|
{
|
||||||
pageNumbers.clear();
|
virtualPageNumbers.clear();
|
||||||
|
|
||||||
/* Find in which sheets this screen is used */
|
/* Find in which sheets this screen is used */
|
||||||
for( const SCH_SHEET_PATH& sheet : Schematic().GetSheets() )
|
for( const SCH_SHEET_PATH& sheet : Schematic().GetSheets() )
|
||||||
{
|
{
|
||||||
if( sheet.LastScreen() == screen )
|
if( sheet.LastScreen() == screen )
|
||||||
pageNumbers.push_back( sheet.GetPageNumber() );
|
virtualPageNumbers.push_back( sheet.GetVirtualPageNumber() );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( SCH_ITEM* item : screen->Items() )
|
for( SCH_ITEM* item : screen->Items() )
|
||||||
|
@ -1533,10 +1533,10 @@ void SCH_EDIT_FRAME::RecomputeIntersheetRefs()
|
||||||
if( item->Type() == SCH_GLOBAL_LABEL_T )
|
if( item->Type() == SCH_GLOBAL_LABEL_T )
|
||||||
{
|
{
|
||||||
SCH_GLOBALLABEL* globalLabel = static_cast<SCH_GLOBALLABEL*>( item );
|
SCH_GLOBALLABEL* globalLabel = static_cast<SCH_GLOBALLABEL*>( item );
|
||||||
std::set<wxString>& pageList = pageRefsMap[ globalLabel->GetText() ];
|
std::set<int>& virtualpageList = pageRefsMap[ globalLabel->GetText() ];
|
||||||
|
|
||||||
for( const wxString& pageNo : pageNumbers )
|
for( const int& pageNo : virtualPageNumbers )
|
||||||
pageList.insert( pageNo );
|
virtualpageList.insert( pageNo );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -750,8 +750,8 @@ void SCH_FIELD::DoHypertextMenu( EDA_DRAW_FRAME* aFrame ) const
|
||||||
|
|
||||||
if( it != Schematic()->GetPageRefsMap().end() )
|
if( it != Schematic()->GetPageRefsMap().end() )
|
||||||
{
|
{
|
||||||
std::map<wxString, wxString> sheetNames;
|
std::map<int, wxString> sheetNames;
|
||||||
std::vector<wxString> pageListCopy;
|
std::vector<int> pageListCopy;
|
||||||
|
|
||||||
pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() );
|
pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() );
|
||||||
if( !Schematic()->Settings().m_IntersheetRefsListOwnPage )
|
if( !Schematic()->Settings().m_IntersheetRefsListOwnPage )
|
||||||
|
@ -772,9 +772,9 @@ void SCH_FIELD::DoHypertextMenu( EDA_DRAW_FRAME* aFrame ) const
|
||||||
for( const SCH_SHEET_PATH& sheet : Schematic()->GetSheets() )
|
for( const SCH_SHEET_PATH& sheet : Schematic()->GetSheets() )
|
||||||
{
|
{
|
||||||
if( sheet.size() == 1 )
|
if( sheet.size() == 1 )
|
||||||
sheetNames[ sheet.GetPageNumber() ] = _( "<root sheet>" );
|
sheetNames[ sheet.GetVirtualPageNumber() ] = _( "<root sheet>" );
|
||||||
else
|
else
|
||||||
sheetNames[ sheet.GetPageNumber() ] = sheet.Last()->GetName();
|
sheetNames[sheet.GetVirtualPageNumber()] = sheet.Last()->GetName();
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int i = 0; i < (int) pageListCopy.size(); ++i )
|
for( int i = 0; i < (int) pageListCopy.size(); ++i )
|
||||||
|
|
|
@ -159,7 +159,7 @@ public:
|
||||||
*/
|
*/
|
||||||
bool ResolveCrossReference( wxString* token, int aDepth ) const;
|
bool ResolveCrossReference( wxString* token, int aDepth ) const;
|
||||||
|
|
||||||
std::map<wxString, std::set<wxString>>& GetPageRefsMap() { return m_labelToPageRefsMap; }
|
std::map<wxString, std::set<int>>& GetPageRefsMap() { return m_labelToPageRefsMap; }
|
||||||
|
|
||||||
wxString ConvertRefsToKIIDs( const wxString& aSource ) const;
|
wxString ConvertRefsToKIIDs( const wxString& aSource ) const;
|
||||||
wxString ConvertKIIDsToRefs( const wxString& aSource ) const;
|
wxString ConvertKIIDsToRefs( const wxString& aSource ) const;
|
||||||
|
@ -202,10 +202,10 @@ private:
|
||||||
CONNECTION_GRAPH* m_connectionGraph;
|
CONNECTION_GRAPH* m_connectionGraph;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds a map of labels to the page numbers that they appear on. Used to update global
|
* Holds a map of labels to the page sequence (virtual page number) that they appear on. It is
|
||||||
* label intersheet references.
|
* used for updating global label intersheet references.
|
||||||
*/
|
*/
|
||||||
std::map<wxString, std::set<wxString>> m_labelToPageRefsMap;
|
std::map<wxString, std::set<int>> m_labelToPageRefsMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue