Enforce strictly weak ordering in sheets
This ensures that irreflexivity is given in sort ordering. This may have been triggering issues in MacOS when adding sheets Fixes https://gitlab.com/kicad/code/kicad/issues/10557
This commit is contained in:
parent
871556ebda
commit
a1615cce7e
|
@ -22,6 +22,9 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <climits>
|
||||||
|
|
||||||
#include <bitmaps.h>
|
#include <bitmaps.h>
|
||||||
#include <core/mirror.h>
|
#include <core/mirror.h>
|
||||||
#include <sch_draw_panel.h>
|
#include <sch_draw_panel.h>
|
||||||
|
@ -1224,10 +1227,9 @@ int SCH_SHEET::ComparePageNum( const wxString& aPageNumberA, const wxString& aPa
|
||||||
// If not numeric, then sort as strings using natural sort
|
// If not numeric, then sort as strings using natural sort
|
||||||
int result = StrNumCmp( aPageNumberA, aPageNumberB );
|
int result = StrNumCmp( aPageNumberA, aPageNumberB );
|
||||||
|
|
||||||
if( result > 0 )
|
result = result / std::abs( result );
|
||||||
return 1; // A > B
|
|
||||||
|
|
||||||
return -1; //A < B
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -175,12 +175,13 @@ int SCH_SHEET_PATH::ComparePageNum( const SCH_SHEET_PATH& aSheetPathToTest ) con
|
||||||
int virtualPageA = GetVirtualPageNumber();
|
int virtualPageA = GetVirtualPageNumber();
|
||||||
int virtualPageB = aSheetPathToTest.GetVirtualPageNumber();
|
int virtualPageB = aSheetPathToTest.GetVirtualPageNumber();
|
||||||
|
|
||||||
return virtualPageA > virtualPageB ? 1 : -1;
|
if( virtualPageA > virtualPageB )
|
||||||
}
|
pageNumComp = 1;
|
||||||
else
|
else if( virtualPageA < virtualPageB )
|
||||||
{
|
pageNumComp = -1;
|
||||||
return pageNumComp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return pageNumComp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue