diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 6b4435022b..4ef114fd40 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -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() ); } diff --git a/eeschema/sch_sheet_path.cpp b/eeschema/sch_sheet_path.cpp index 37e86b36b8..d01fed2437 100644 --- a/eeschema/sch_sheet_path.cpp +++ b/eeschema/sch_sheet_path.cpp @@ -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 badSheets; m_currentSheetPath.push_back( aSheet ); - + m_currentSheetPath.SetVirtualPageNumber( static_cast( size() ) + 1 ); push_back( m_currentSheetPath ); if( m_currentSheetPath.LastScreen() ) diff --git a/eeschema/sch_sheet_path.h b/eeschema/sch_sheet_path.h index 8b673616f3..0dc87c8f5a 100644 --- a/eeschema/sch_sheet_path.h +++ b/eeschema/sch_sheet_path.h @@ -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, 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;