aboutsummaryrefslogtreecommitdiffstats
path: root/src/base/USongs.pas
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-11-17 16:21:03 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-11-17 16:21:03 +0000
commitdf0a8e7c62a4006ea7ac66ad7c0745a48a32ef24 (patch)
treed7bee1767d392e8c67e4eae39c2b80a12f9b106a /src/base/USongs.pas
parent61eaa45ee2bf7fc1d91faae3d10f3e093e3bc42c (diff)
downloadusdx-df0a8e7c62a4006ea7ac66ad7c0745a48a32ef24.tar.gz
usdx-df0a8e7c62a4006ea7ac66ad7c0745a48a32ef24.tar.xz
usdx-df0a8e7c62a4006ea7ac66ad7c0745a48a32ef24.zip
implemented suggestions by Canni from Assembla ticket #85
artist sorting replaced by artist2 title sorting replaced by title2 new sorting artist2 (suggestions for a better name?!) all songs by the same artist are put into the same category named by the artist git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1945 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/base/USongs.pas')
-rw-r--r--src/base/USongs.pas68
1 files changed, 27 insertions, 41 deletions
diff --git a/src/base/USongs.pas b/src/base/USongs.pas
index 49b84425..d3018bcf 100644
--- a/src/base/USongs.pas
+++ b/src/base/USongs.pas
@@ -410,8 +410,6 @@ begin
CompareFunc := CompareByArtist;
sFolder: // by folder
CompareFunc := CompareByFolder;
- sTitle2: // by title2
- CompareFunc := CompareByTitle;
sArtist2: // by artist2
CompareFunc := CompareByArtist;
sLanguage: // by Language
@@ -458,12 +456,8 @@ begin
Songs.Sort(sTitle);
Songs.Sort(sArtist);
end;
- sTitle2: begin
- Songs.Sort(sArtist2);
- Songs.Sort(sTitle2);
- end;
sArtist2: begin
- Songs.Sort(sTitle2);
+ Songs.Sort(sTitle);
Songs.Sort(sArtist2);
end;
end; // case
@@ -567,6 +561,15 @@ begin
if (Length(CurSong.Title) >= 1) then
begin
LetterTmp := UCS4UpperCase(UTF8ToUCS4String(CurSong.Title)[0]);
+ { all numbers and some punctuation chars are put into a
+ category named '#'
+ we can't put the other punctuation chars into this category
+ because they are not in order, so there will be two different
+ categories named '#' }
+ if (LetterTmp in [Ord('!') .. Ord('?')]) then
+ LetterTmp := Ord('#')
+ else
+ LetterTmp := UCS4UpperCase(LetterTmp);
if (Letter <> LetterTmp) then
begin
Letter := LetterTmp;
@@ -580,6 +583,16 @@ begin
if (Length(CurSong.Artist) >= 1) then
begin
LetterTmp := UCS4UpperCase(UTF8ToUCS4String(CurSong.Artist)[0]);
+ { all numbers and some punctuation chars are put into a
+ category named '#'
+ we can't put the other punctuation chars into this category
+ because they are not in order, so there will be two different
+ categories named '#' }
+ if (LetterTmp in [Ord('!') .. Ord('?')]) then
+ LetterTmp := Ord('#')
+ else
+ LetterTmp := UCS4UpperCase(LetterTmp);
+
if (Letter <> LetterTmp) then
begin
Letter := LetterTmp;
@@ -598,44 +611,17 @@ begin
end;
end;
- sTitle2: begin
- if (Length(CurSong.Title) >= 1) then
- begin
- LetterTmp := UTF8ToUCS4String(CurSong.Title)[0];
- // pack all numbers into a category named '#'
- if (LetterTmp in [Ord('0') .. Ord('9')]) then
- LetterTmp := Ord('#')
- else
- LetterTmp := UCS4UpperCase(LetterTmp);
-
- if (Letter <> LetterTmp) then
- begin
- Letter := LetterTmp;
- // add a letter Category Button
- AddCategoryButton(UCS4ToUTF8String(Letter));
- end;
- end;
- end;
-
sArtist2: begin
- if (Length(CurSong.Artist) >= 1) then
+ { this new sorting puts all songs by the same artist into
+ a single category }
+ if (UTF8CompareText(CurCategory, CurSong.Artist) <> 0) then
begin
- LetterTmp := UTF8ToUCS4String(CurSong.Artist)[0];
- // pack all numbers into a category named '#'
- if (LetterTmp in [Ord('0') .. Ord('9')]) then
- LetterTmp := Ord('#')
- else
- LetterTmp := UCS4UpperCase(LetterTmp);
-
- if (Letter <> LetterTmp) then
- begin
- Letter := LetterTmp;
- // add a letter Category Button
- AddCategoryButton(UCS4ToUTF8String(Letter));
- end;
+ CurCategory := CurSong.Artist;
+ // add folder tab
+ AddCategoryButton(CurCategory);
end;
end;
-
+
end; // case (Ini.Sorting)
end; // if (Ini.Tabs = 1)