force NUM to the top and OTHER to the bottom of the ABC sort

this is intuitively correct (numbers before letters and "other" at the end),
and also looks somewhat symmetrical
This commit is contained in:
Glenn Maynard
2003-02-12 21:34:12 +00:00
parent 97f63638e7
commit de9c496399
+10 -2
View File
@@ -276,8 +276,16 @@ struct CompareSongPointerArrayBySectionName
CompareSongPointerArrayBySectionName( SongSortOrder so_ ): so(so_) { }
bool operator() (const Song *p1, const Song *p2) const
{
return MusicWheel::GetSectionNameFromSongAndSort( p1, so ) <
MusicWheel::GetSectionNameFromSongAndSort( p2, so );
CString sec1 = MusicWheel::GetSectionNameFromSongAndSort( p1, so );
CString sec2 = MusicWheel::GetSectionNameFromSongAndSort( p2, so );
/* In the TITLE sort, make sure NUM comes first and OTHER comes last. */
if(so == SORT_TITLE && sec1 == "NUM" && sec2 != "NUM") return true;
if(so == SORT_TITLE && sec1 != "NUM" && sec2 == "NUM") return false;
if(so == SORT_TITLE && sec1 != "OTHER" && sec2 == "OTHER") return true;
if(so == SORT_TITLE && sec1 == "OTHER" && sec2 != "OTHER") return false;
return sec1 < sec2;
}
};