Eeschema: fix annotation bug.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6154
This commit is contained in:
Wayne Stambaugh 2020-10-26 13:01:20 -04:00
parent d7ee5fe97f
commit f7084afb72
3 changed files with 27 additions and 8 deletions

View File

@ -500,6 +500,7 @@ void SCH_EDIT_FRAME::SetSheetNumberAndCount()
for( screen = s_list.GetFirst(); screen != NULL; screen = s_list.GetNext() )
screen->SetPageCount( sheet_count );
GetCurrentSheet().SetVirtualPageNumber( sheet_number );
GetScreen()->SetVirtualPageNumber( sheet_number );
GetScreen()->SetPageNumber( GetCurrentSheet().GetPageNumber() );
}

View File

@ -96,7 +96,7 @@ namespace std
SCH_SHEET_PATH::SCH_SHEET_PATH()
{
m_pageNumber = 0;
m_virtualPageNumber = 0;
m_current_hash = 0;
}
@ -116,9 +116,9 @@ SCH_SHEET_PATH& SCH_SHEET_PATH::operator=( const SCH_SHEET_PATH& aOther )
void SCH_SHEET_PATH::initFromOther( const SCH_SHEET_PATH& aOther )
{
m_sheets = aOther.m_sheets;
m_pageNumber = aOther.m_pageNumber;
m_current_hash = aOther.m_current_hash;
m_sheets = aOther.m_sheets;
m_virtualPageNumber = aOther.m_virtualPageNumber;
m_current_hash = aOther.m_current_hash;
// Note: don't copy m_recursion_test_cache as it is slow and we want SCH_SHEET_PATHS to be
// very fast to construct for use in the connectivity algorithm.
@ -282,7 +282,7 @@ void SCH_SHEET_PATH::GetComponents( SCH_REFERENCE_LIST& aReferences, bool aInclu
{
SCH_REFERENCE schReference( component, part, *this );
schReference.SetSheetNumber( m_pageNumber );
schReference.SetSheetNumber( m_virtualPageNumber );
aReferences.AddItem( schReference );
}
}
@ -307,7 +307,7 @@ void SCH_SHEET_PATH::GetMultiUnitComponents( SCH_MULTI_UNIT_REFERENCE_MAP& aRefL
if( part && part->GetUnitCount() > 1 )
{
SCH_REFERENCE schReference = SCH_REFERENCE( component, part, *this );
schReference.SetSheetNumber( m_pageNumber );
schReference.SetSheetNumber( m_virtualPageNumber );
wxString reference_str = schReference.GetRef();
// Never lock unassigned references
@ -441,7 +441,7 @@ void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet, bool aCheckIntegrity )
std::vector<SCH_SHEET*> badSheets;
m_currentSheetPath.push_back( aSheet );
m_currentSheetPath.SetVirtualPageNumber( static_cast<int>( size() ) + 1 );
push_back( m_currentSheetPath );
if( m_currentSheetPath.LastScreen() )

View File

@ -141,7 +141,7 @@ protected:
size_t m_current_hash;
int m_pageNumber; /// Page numbers are maintained by the sheet load order.
int m_virtualPageNumber; /// Page numbers are maintained by the sheet load order.
std::map<std::pair<wxString, wxString>, bool> m_recursion_test_cache;
@ -186,6 +186,24 @@ public:
size_t GetCurrentHash() const { return m_current_hash; }
/**
* Set the sheet instance virtual page number.
*
* Virtual page numbers are incremental integers set automatically when the sheet path
* hierarchy is created (@see #SCH_SHEET_LIST::BuildSheetList). The virtual page
* numbering is ordered by the X and Y position of the sheet in a schematic which
* mimics the page numbering code prior to the addition of actual user definable page
* numbers. Virtual page numbers should only be use when annotating schematics.
*/
void SetVirtualPageNumber( int aPageNumber ) { m_virtualPageNumber = aPageNumber; }
int GetVirtualPageNumber() const { return m_virtualPageNumber; }
/**
* Set the sheet instance user definable page number.
*
* @note User definable page numbers can be any string devoid of white space characters.
*/
void SetPageNumber( const wxString& aPageNumber );
wxString GetPageNumber() const;