diff --git a/eeschema/hierarch.cpp b/eeschema/hierarch.cpp index 4267e136bf..8de2227043 100644 --- a/eeschema/hierarch.cpp +++ b/eeschema/hierarch.cpp @@ -165,7 +165,7 @@ int HIERARCHY_TREE::OnCompareItems( const wxTreeItemId& item1, const wxTreeItemI SCH_SHEET_PATH* item1Path = &static_cast( GetItemData( item1 ) )->m_SheetPath; SCH_SHEET_PATH* item2Path = &static_cast( GetItemData( item2 ) )->m_SheetPath; - return item1Path->ComparePageNumAndName( *item2Path ); + return item1Path->ComparePageNum( *item2Path ); } diff --git a/eeschema/sch_sheet_path.cpp b/eeschema/sch_sheet_path.cpp index 649a209559..5efa924742 100644 --- a/eeschema/sch_sheet_path.cpp +++ b/eeschema/sch_sheet_path.cpp @@ -163,7 +163,7 @@ int SCH_SHEET_PATH::Cmp( const SCH_SHEET_PATH& aSheetPathToTest ) const } -int SCH_SHEET_PATH::ComparePageNumAndName( const SCH_SHEET_PATH& aSheetPathToTest ) const +int SCH_SHEET_PATH::ComparePageNum( const SCH_SHEET_PATH& aSheetPathToTest ) const { wxString pageA = GetPageNumber(); wxString pageB = aSheetPathToTest.GetPageNumber(); @@ -588,7 +588,7 @@ void SCH_SHEET_LIST::SortByPageNumbers( bool aUpdateVirtualPageNums ) std::sort( begin(), end(), []( SCH_SHEET_PATH a, SCH_SHEET_PATH b ) -> bool { - return a.ComparePageNumAndName( b ) < 0; + return a.ComparePageNum( b ) < 0; } ); if( aUpdateVirtualPageNums ) diff --git a/eeschema/sch_sheet_path.h b/eeschema/sch_sheet_path.h index 682fdc1bed..cc31805a7e 100644 --- a/eeschema/sch_sheet_path.h +++ b/eeschema/sch_sheet_path.h @@ -215,14 +215,14 @@ public: int Cmp( const SCH_SHEET_PATH& aSheetPathToTest ) const; /** - * Compare sheets by their page number and then by their name. Finally - * compare using #Cmp() + * Compare sheets by their page number. If the actual page number is equal, use virtual page numbers + * to compare. * * @return -1 if aSheetPathToTest is greater than this (should appear later in the sort order) * 0 if aSheetPathToTest is equal to this * 1 if aSheetPathToTest is less than this (should appear earlier in the sort order) */ - int ComparePageNumAndName( const SCH_SHEET_PATH& aSheetPathToTest ) const; + int ComparePageNum( const SCH_SHEET_PATH& aSheetPathToTest ) const; /** * Check if this path is contained inside aSheetPathToTest. diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 014afddca6..5837830a3f 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -469,13 +469,13 @@ int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent ) std::sort( paths.begin(), paths.end(), [] ( const SCH_SHEET_PATH* lhs, const SCH_SHEET_PATH* rhs ) -> bool { - int retval = lhs->ComparePageNumAndName( *rhs ); + int retval = lhs->ComparePageNum( *rhs ); if( retval < 0 ) return true; else if( retval > 0 ) return false; - else /// Enforce strict ordering. If the name and number are the same, we use UUIDs + else /// Enforce strict ordering. If the page numbers are the same, use UUIDs return lhs->GetCurrentHash() < rhs->GetCurrentHash(); } );