Skip to content

Commit

Permalink
Rename ComparePageNumAndName -> ComparePageNum
Browse files Browse the repository at this point in the history
  • Loading branch information
Qbort committed Jan 2, 2022
1 parent 404659d commit 2d3624a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion eeschema/hierarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ int HIERARCHY_TREE::OnCompareItems( const wxTreeItemId& item1, const wxTreeItemI
SCH_SHEET_PATH* item1Path = &static_cast<TreeItemData*>( GetItemData( item1 ) )->m_SheetPath;
SCH_SHEET_PATH* item2Path = &static_cast<TreeItemData*>( GetItemData( item2 ) )->m_SheetPath;

return item1Path->ComparePageNumAndName( *item2Path );
return item1Path->ComparePageNum( *item2Path );
}


Expand Down
4 changes: 2 additions & 2 deletions eeschema/sch_sheet_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 )
Expand Down
6 changes: 3 additions & 3 deletions eeschema/sch_sheet_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,14 @@ class SCH_SHEET_PATH
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.
Expand Down
4 changes: 2 additions & 2 deletions eeschema/tools/sch_editor_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
} );

Expand Down

0 comments on commit 2d3624a

Please sign in to comment.