diff options
author | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-03-30 16:44:20 +0000 |
---|---|---|
committer | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-03-30 16:44:20 +0000 |
commit | d520f9f6ed8a3a0cb8e3063040db19758b7c6f38 (patch) | |
tree | b506e6c32265bea8d5dc5b96cab09ad8dd60b12c /Game/Code/Classes | |
parent | 61cbc6464e0c9469c4ddcf35285db220a18f153f (diff) | |
download | usdx-d520f9f6ed8a3a0cb8e3063040db19758b7c6f38.tar.gz usdx-d520f9f6ed8a3a0cb8e3063040db19758b7c6f38.tar.xz usdx-d520f9f6ed8a3a0cb8e3063040db19758b7c6f38.zip |
Prepared some classes for enhanced Song loading.
Commited to work with s_alexander in this task.
Song loading doesn't work at this point
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@983 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes')
-rw-r--r-- | Game/Code/Classes/UCovers.pas | 64 | ||||
-rw-r--r-- | Game/Code/Classes/UDataBase.pas | 166 | ||||
-rw-r--r-- | Game/Code/Classes/UPlaylist.pas | 18 | ||||
-rw-r--r-- | Game/Code/Classes/USong.pas | 201 | ||||
-rw-r--r-- | Game/Code/Classes/USongs.pas | 74 |
5 files changed, 427 insertions, 96 deletions
diff --git a/Game/Code/Classes/UCovers.pas b/Game/Code/Classes/UCovers.pas index 9cc2a5e9..4068e02b 100644 --- a/Game/Code/Classes/UCovers.pas +++ b/Game/Code/Classes/UCovers.pas @@ -32,25 +32,32 @@ type end; TCovers = class - Cover: array of TCover; - W: word; - H: word; - Size: integer; - Data: array of byte; - WritetoFile: Boolean; - - constructor Create; - procedure Load; - procedure Save; - procedure AddCover(Name: string); - function CoverExists(Name: string): boolean; - function CoverNumber(Name: string): integer; - procedure PrepareData(Name: string); + private + Filename: String; + + + + WritetoFile: Boolean; + public + W: word; + H: word; + Size: integer; + Data: array of byte; + Cover: array of TCover; + + constructor Create; + procedure Load; + procedure Save; + Function AddCover(FileName: string): Integer; //Returns ID, Checks Cover for Change, Updates Cover if required + function CoverExists(FileName: string): boolean; + function CoverNumber(FileName: string): integer; //Returns ID by FilePath + procedure PrepareData(FileName: string); + Procedure LoadTextures; end; var Covers: TCovers; - + // to - do : new Song management implementation uses UMain, @@ -155,7 +162,7 @@ begin CloseFile(F);} end; -procedure TCovers.AddCover(Name: string); +Function TCovers.AddCover(FileName: string): Integer; var B: integer; F: File; @@ -163,10 +170,10 @@ var NLen: word; Bits: byte; begin - if not CoverExists(Name) then + if not CoverExists(FileName) then begin SetLength(Cover, Length(Cover)+1); - Cover[High(Cover)].Name := Name; + Cover[High(Cover)].Name := FileName; Cover[High(Cover)].W := W; Cover[High(Cover)].H := H; @@ -197,9 +204,9 @@ begin BlockWrite(F, H, 2); BlockWrite(F, Bits, 1); - NLen := Length(Name); + NLen := Length(FileName); BlockWrite(F, NLen, 2); - BlockWrite(F, Name[1], NLen); + BlockWrite(F, FileName[1], NLen); Cover[High(Cover)].Position := FilePos(F); BlockWrite(F, CacheMipmap[0], W*H*(Bits div 8)); @@ -211,7 +218,7 @@ begin Cover[High(Cover)].Position := 0; end; -function TCovers.CoverExists(Name: string): boolean; +function TCovers.CoverExists(FileName: string): boolean; var C: integer; // cover begin @@ -220,14 +227,14 @@ begin while (C <= High(Cover)) and (Result = false) do begin - if Cover[C].Name = Name then + if Cover[C].Name = FileName then Result := true; Inc(C); end; end; -function TCovers.CoverNumber(Name: string): integer; +function TCovers.CoverNumber(FileName: string): integer; var C: integer; begin @@ -236,14 +243,14 @@ begin while (C <= High(Cover)) and (Result = -1) do begin - if Cover[C].Name = Name then + if Cover[C].Name = FileName then Result := C; Inc(C); end; end; -procedure TCovers.PrepareData(Name: string); +procedure TCovers.PrepareData(FileName: string); var F: File; C: integer; @@ -253,7 +260,7 @@ begin AssignFile(F, GamePath + 'covers.cache'); Reset(F, 1); - C := CoverNumber(Name); + C := CoverNumber(FileName); SetLength(Data, Cover[C].Size); if Length(Data) < 6 then beep; Seek(F, Cover[C].Position); @@ -262,4 +269,9 @@ begin end; end; +Procedure TCovers.LoadTextures; +begin + +end; + end. diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas index dcf32315..059443ac 100644 --- a/Game/Code/Classes/UDataBase.pas +++ b/Game/Code/Classes/UDataBase.pas @@ -35,28 +35,116 @@ type TimesSungtot: Word); end; AStatResult = Array of TStatResult; - + + TDBSongInfo = record + FileName: String; + FolderID: String; + FullPath: String; + LastChanged: Integer; //TimeStamp + + //Required Information + Title: widestring; + Artist: widestring; + + Mp3: widestring; + + Text: widestring; + Creator: widestring; + + Resolution: integer; + BPM: array of TBPM; + GAP: real; // in miliseconds + + Base : array[0..1] of integer; + Rel : array[0..1] of integer; + Mult : integer; + MultBPM : integer; + + //Some Files + Cover: widestring; //Path to Cover + CoverID: Integer; //ID of Cover in Covers Cache + Background: widestring; + Video: widestring; + VideoGAP: real; + + + //Additional Information + NotesGAP: integer; + Start: real; // in seconds + Finish: integer; // in miliseconds + Relative: boolean; + + //Sorting + Genre: widestring; + Edition: widestring; + Language: widestring; + end; + + TSongListInfo = record //SongInfo used by Songscreen + ID: Integer; + Title: widestring; + Artist: widestring; + + Mp3: widestring; + Video: widestring; + CoverID: Integer; //Cover ID in CoversCache + end; + ASongList = Array of TSongListInfo; + + TSongListFilter = record + Field: Byte; //FieldID //See constants below + isSearch: Boolean; //Search Mask(true) or exact Match(False) + Filter: String; + end; + ASongListFilter = Array of TSongListFilter; + TDataBaseSystem = class private ScoreDB: TSqliteDatabase; sFilename: string; - + public property Filename: String read sFilename; - + Destructor Free; Procedure Init(const Filename: string); - procedure ReadScore(var Song: TSong); - procedure AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); - procedure WriteScore(var Song: TSong); + procedure ReadScore(Song: Integer); + procedure AddScore(Song: Integer; Level: integer; Name: string; Score: integer); + procedure WriteScore(Song: Integer); + + Function GetIDbyPath(const Path: String): Integer; + Function GetIDbyFileName(const Filename: String; FolderID: Integer): Integer; + Procedure GetSongData(ID: Integer; var Info: TDBSongInfo); + Procedure SetSongData(ID: Integer; var Info: TDBSongInfo); + Function GetLastChangedbyID(const Song: Integer): Integer; + Function GetLastChangedbyFileName(const Filename: String; FolderID: Integer): Integer; + + Function GetFolderIDbyPath(Path: String): Integer; + Function GetFolderIDbyName(const Name: String; ParentFolder: Integer): Integer; + + Function GetSongList(var List: ASongList; const Filter: ASongListFilter): Integer; Function GetStats(var Stats: AStatResult; const Typ, Count: Byte; const Page: Cardinal; const Reversed: Boolean): Boolean; Function GetTotalEntrys(const Typ: Byte): Cardinal; end; +const + //Filter FieldIDs + SLF_Edition = 0; + SLF_Genre = 1; + SLF_Language = 2; + SLF_Folder = 3; + SLF_Title = 4; + SLF_Artist = 5; + SLF_Year = 6; + SLF_Creator = 7; + SLF_Video = 8; //Songs w/ Video are returned + SLF_NoVideo = 9; //Songs w/o Video are returned + Max_FilterFieldID = SLF_NoVideo; + var DataBase: TDataBaseSystem; @@ -123,12 +211,12 @@ end; //-------------------- //ReadScore - Read Scores into SongArray //-------------------- -procedure TDataBaseSystem.ReadScore(var Song: TSong); +procedure TDataBaseSystem.ReadScore(Song: Integer); var TableData: TSqliteTable; Difficulty: Integer; begin - if not assigned( ScoreDB ) then + {if not assigned( ScoreDB ) then exit; @@ -169,18 +257,18 @@ begin finally //ScoreDb.Free; - end; + end; } end; //-------------------- //AddScore - Add one new Score to DB //-------------------- -procedure TDataBaseSystem.AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); +procedure TDataBaseSystem.AddScore(Song: Integer; Level: integer; Name: string; Score: integer); var ID: Integer; TableData: TSqliteTable; begin - if not assigned( ScoreDB ) then + {if not assigned( ScoreDB ) then exit; //ScoreDB := TSqliteDatabase.Create(sFilename); @@ -210,15 +298,15 @@ begin end; finally //ScoreDB.Free; - end; + end; } end; //-------------------- //WriteScore - Not needed with new System; But used for Increment Played Count //-------------------- -procedure TDataBaseSystem.WriteScore(var Song: TSong); +procedure TDataBaseSystem.WriteScore(Song: Integer); begin - if not assigned( ScoreDB ) then + {if not assigned( ScoreDB ) then exit; try @@ -226,7 +314,7 @@ begin ScoreDB.ExecSQL ('UPDATE `'+cUS_Songs+'` SET `TimesPlayed` = `TimesPlayed` + "1" WHERE `Title` = "' + Song.Title + '" AND `Artist` = "' + Song.Artist + '";'); except - end; + end; } end; //-------------------- @@ -369,4 +457,52 @@ begin end; +Function TDataBaseSystem.GetIDbyPath(const Path: String): Integer; +begin + +end; + +Function TDataBaseSystem.GetIDbyFileName(const Filename: String; FolderID: Integer): Integer; +begin + +end; + +Procedure TDataBaseSystem.GetSongData(ID: Integer; var Info: TDBSongInfo); +begin + +end; + +Procedure TDataBaseSystem.SetSongData(ID: Integer; var Info: TDBSongInfo); +begin + +end; + +Function TDataBaseSystem.GetLastChangedbyID(const Song: Integer): Integer; +begin + +end; + +Function TDataBaseSystem.GetLastChangedbyFileName(const Filename: String; FolderID: Integer): Integer; +begin + +end; + + +Function TDataBaseSystem.GetFolderIDbyPath(Path: String): Integer; +begin + +end; + +Function TDataBaseSystem.GetFolderIDbyName(const Name: String; ParentFolder: Integer): Integer; +begin + +end; + + +Function TDataBaseSystem.GetSongList(var List: ASongList; const Filter: ASongListFilter): Integer; +begin + +end; + + end. diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas index 4f181d73..c05460cf 100644 --- a/Game/Code/Classes/UPlaylist.pas +++ b/Game/Code/Classes/UPlaylist.pas @@ -267,13 +267,13 @@ begin exit; //Hide all Songs - For I := 0 to high(CatSongs.Song) do - CatSongs.Song[I].Visible := False; + {For I := 0 to high(CatSongs.Song) do + CatSongs.Song[I].Visible := False;} //Show Songs in PL For I := 0 to high(PlayLists[Index].Items) do begin - CatSongs.Song[PlayLists[Index].Items[I].SongID].Visible := True; + //CatSongs.Song[PlayLists[Index].Items[I].SongID].Visible := True; end; //Set CatSongsMode + Playlist Mode @@ -335,8 +335,8 @@ Procedure TPlayListManager.DelPlaylist(const Index: Cardinal); var I: Integer; Filename: String; -begin - If Int(Index) > High(Playlists) then +begin // to - do : new Song management + {If Int(Index) > High(Playlists) then Exit; Filename := PlaylistPath + Playlists[Index].Filename; @@ -368,7 +368,7 @@ begin ScreenSong.Interaction := 0; ScreenSong.FixSelected; ScreenSong.ChangeMusic; - end; + end; } end; //---------- @@ -385,8 +385,8 @@ begin P := iPlaylist else exit; - - if (Int(SongID) <= High(CatSongs.Song)) AND (NOT CatSongs.Song[SongID].Main) then + // to - do : new Song management + {if (Int(SongID) <= High(CatSongs.Song)) AND (NOT CatSongs.Song[SongID].Main) then begin Len := Length(Playlists[P].Items); SetLength(Playlists[P].Items, Len + 1); @@ -401,7 +401,7 @@ begin //Correct Display when Editing current Playlist if (CatSongs.CatNumShow = -3) and (P = CurPlaylist) then SetPlaylist(P); - end; + end; } end; //---------- diff --git a/Game/Code/Classes/USong.pas b/Game/Code/Classes/USong.pas index 2693ed48..27c79a71 100644 --- a/Game/Code/Classes/USong.pas +++ b/Game/Code/Classes/USong.pas @@ -48,7 +48,7 @@ type Length: string; end; - TSong = class + {TSong = class FileLineNo : integer; //Line which is readed at Last, for error reporting procedure ParseNote(LineNumber: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); @@ -111,6 +111,76 @@ type function Analyse(): boolean; function AnalyseXML(): boolean; procedure clear(); + end; } + + AScore = Array[0..4] of TScore; + {******************* + New TSong Class. + Containing some Methods for DB communication + but none for Song laoding, saving, these should be + implemented by child classes + *******************} + TSong = class + protected + SongID: Integer; //ID of this Song in the Song Database + FolderID: Integer; //ID of the Folder containing this Song + FileName: String; //Filename of this Song w/o Path + FullPath: String; //Path + Filename + + Procedure ResetAttributes; virtual; //Reset all Attributes of this object + Procedure ReadHeader; virtual; //Reads Fileheader (Implemented by Child only) + Procedure ReadFile; virtual; //Reads complete File (Header + Notes) (Implemented by Child only) + Procedure WriteFile; virtual; //Writes complete File (Header + Notes) (Implemented by Child only) + Procedure ReadFromDB; virtual; //Reads all available Information from DB + Function CheckDB: Integer; virtual; //Checks DB for Song. Result > 0 SongExists (ID Returned) + Function UpdateDB: Integer; virtual;//Writes all Header Information set in this Song Object to DB. Returns ID (Required when Updated first Time) + public + //Required Information + Title: widestring; + Artist: widestring; + + Mp3: widestring; //Full Path to MP3 + + Text: widestring; + Creator: widestring; + + Resolution: integer; + BPM: array of TBPM; + GAP: real; // in miliseconds + + Base : array[0..1] of integer; + Rel : array[0..1] of integer; + Mult : integer; + MultBPM : integer; + + //Some Files + Cover: widestring; //Full Path to Cover + CoverID: Integer; //ID of Cover in Covers Cache + Background: widestring; //Full Path to BG + Video: widestring; //Full Path to Video + VideoGAP: real; + + + //Additional Information + NotesGAP: integer; + Start: real; // in seconds + Finish: integer; // in miliseconds + Relative: boolean; + + //Sorting + Genre: widestring; + Edition: widestring; + Language: widestring; + + + constructor Create(const Path: String = ''; const FolderID: Integer = 0); + Procedure LoadbyFile(const Path: String); + Procedure LoadbyID(const ID: Integer); + Procedure SavetoFile(const Filename: String = ''); + + Function Score(const Difficulty: Byte): AScore; + + Procedure Clear; end; implementation @@ -121,7 +191,120 @@ uses UMusic, //needed for Lines UMain; //needed for Player -constructor TSong.create( const aFileName : WideString ); +constructor TSong.Create(const Path: String = ''; const FolderID: Integer = 0); +begin + If (Length(Path) > 0) AND (FolderID > 0) then + begin //Read Song Infos from File or DB + FullPath := Path; + FileName := ExtractFileName(Path); + Self.FolderID := FolderID; + SongID := CheckDB; + + If (SongID = 0) then //Check if File has changed + begin + ResetAttributes; + ReadHeader; + SongID := UpdateDB; + //Get CoverID from Covers by Covers.AddCover(Coverscache checks if the Cover requires update + end; + end + else + begin + ResetAttributes; + end; +end; + +Procedure TSong.LoadbyFile(const Path: String); +begin + //Call all Functions to Load From File + //Set Song and Folder ID and Update DB if required + //Get CoverID from Covers by Covers.AddCover(Coverscache checks if the Cover requires update +end; + +Procedure TSong.LoadbyID(const ID: Integer); +begin + //Call all Functions to Load Song by ID + //Read all Information from file + //Get CoverID from Covers by Covers.AddCover(Coverscache checks if the Cover requires update +end; + +Procedure TSong.SavetoFile(const Filename: String = ''); +begin + //Save HeaderInformation and Notes to File. If File = '' use File that was read from +end; + +Function TSong.Score(const Difficulty: Byte): AScore; +begin + //Return Score of Difficulty(0..2) Easy to Difficult +end; + +Procedure TSong.Clear; +begin + ResetAttributes; +end; + +//-------- +// Reset all Attributes of this object +//-------- +Procedure TSong.ResetAttributes; +begin + //to do +end; + +//-------- +// Reads Fileheader (Implemented by Child only) +//-------- +Procedure TSong.ReadHeader; +begin + //Implented in Childs only! +end; + +//-------- +// Reads complete File (Header + Notes) (Implemented by Child only) +//-------- +Procedure TSong.ReadFile; +begin + //Implented in Childs only! +end; + + +//-------- +// Writes complete File (Header + Notes) (Implemented by Child only) +//-------- +Procedure TSong.WriteFile; +begin + //Implented in Childs only! +end; + + +//-------- +// Reads all available Information from DB +//-------- +Procedure TSong.ReadFromDB; +begin + // to- do +end; + + +//-------- +// Checks DB for Song. Result > 0 SongExists (ID Returned) +//-------- +Function TSong.CheckDB: Integer; +begin + // to- do +end; + + +//-------- +// Writes all Header Information set in this Song Object to DB. Returns ID (Required when Updated first Time) +//-------- +Function TSong.UpdateDB: Integer; +begin + // to- do +end; + + +{constructor TSong.create( const aFileName : WideString ); begin Mult := 1; @@ -323,7 +506,7 @@ begin end; Read(SongFile, TempC); Inc(FileLineNo); - end; // while} + end; // while} { for Count := 0 to High(Lines) do begin Lines[Count].Line[High(Lines[Count].Line)].LastLine := True; @@ -667,10 +850,10 @@ begin //Required Attributes //----------- - {$IFDEF UTF8_FILENAMES} + {$IFDEF UTF8_FILENAMES} { if ((Identifier = 'MP3') or (Identifier = 'BACKGROUND') or (Identifier = 'COVER') or (Identifier = 'VIDEO')) then Value := Utf8Encode(Value); - {$ENDIF} + {$ENDIF} { //Title if (Identifier = 'TITLE') then @@ -947,11 +1130,11 @@ begin //Required Information Mp3 := ''; - {$IFDEF FPC} + {$IFDEF FPC} { setlength( BPM, 0 ); - {$ELSE} + {$ELSE} { BPM := nil; - {$ENDIF} + {$ENDIF} { GAP := 0; Start := 0; @@ -1007,6 +1190,6 @@ begin //Read Header Result := self.ReadXMLHeader( FileName ); -end; +end; } end. diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index df748e74..87497b17 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -259,8 +259,8 @@ var Files : TDirectoryEntryArray; lSong : TSong; begin - - Files := Platform.DirectoryFindFiles( Dir, '.txt', true); + // to - do : new Song management + {Files := Platform.DirectoryFindFiles( Dir, '.txt', true); for i := 0 to Length(Files)-1 do begin @@ -282,7 +282,7 @@ begin end; end; SetLength( Files, 0); - + } end; procedure TSongs.BrowseXMLFiles(Dir: widestring); @@ -292,7 +292,7 @@ var lSong : TSong; begin - Files := Platform.DirectoryFindFiles( Dir, '.xml', true); + {Files := Platform.DirectoryFindFiles( Dir, '.xml', true); for i := 0 to Length(Files)-1 do begin @@ -313,7 +313,7 @@ begin end; end; - SetLength( Files, 0); + SetLength( Files, 0); } end; @@ -323,7 +323,7 @@ var S2: integer; TempSong: TSong; begin - case Order of + {case Order of sEdition: // by edition begin for S2 := 0 to SongList.Count -1 do @@ -422,7 +422,7 @@ begin end; end; - end; // case + end; // case } end; function TSongs.FindSongFile(Dir, Mask: widestring): widestring; @@ -449,7 +449,7 @@ begin CatNumShow := -1; // Songs.Sort(0); // by title -case Ini.Sorting of +{case Ini.Sorting of sEdition: begin Songs.Sort(sArtist); Songs.Sort(sEdition); @@ -514,7 +514,7 @@ case Ini.Sorting of {// cover-patch if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//}{ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); @@ -541,7 +541,7 @@ case Ini.Sorting of {// cover-patch if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}{ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); //CatNumber Patch @@ -567,7 +567,7 @@ case Ini.Sorting of {// cover-patch if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}{ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); //CatNumber Patch @@ -597,7 +597,7 @@ case Ini.Sorting of {// cover-patch if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}{ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); //CatNumber Patch @@ -625,7 +625,7 @@ case Ini.Sorting of {// cover-patch if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}{ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); //CatNumber Patch @@ -651,7 +651,7 @@ case Ini.Sorting of {// cover-patch if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}{ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); //CatNumber Patch @@ -680,7 +680,7 @@ case Ini.Sorting of {// cover-patch if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}{ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); //CatNumber Patch @@ -710,7 +710,7 @@ case Ini.Sorting of {// cover-patch if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}{ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); //CatNumber Patch @@ -719,7 +719,7 @@ case Ini.Sorting of Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy CatNumber := 0; end; - + CatSongs.Song[CatLen].Visible := true; end; end; @@ -744,45 +744,45 @@ case Ini.Sorting of if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy //CatCount Patch -CatCount := Order; +CatCount := Order; } end; procedure TCatSongs.ShowCategory(Index: integer); var S: integer; // song -begin - CatNumShow := Index; +begin // to - do : new Song management + { CatNumShow := Index; for S := 0 to high(CatSongs.Song) do begin if (CatSongs.Song[S].OrderNum = Index) AND (Not CatSongs.Song[S].Main) then CatSongs.Song[S].Visible := true else CatSongs.Song[S].Visible := false; - end; + end; } end; procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category var S: integer; // song -begin - for S := 0 to high(CatSongs.Song) do begin +begin // to - do : new Song management + {for S := 0 to high(CatSongs.Song) do begin if not CatSongs.Song[S].Main then CatSongs.Song[S].Visible := false // hides all at now - end; + end; } end; procedure TCatSongs.ClickCategoryButton(Index: integer); var Num, S: integer; begin - Num := CatSongs.Song[Index].OrderNum; + { Num := CatSongs.Song[Index].OrderNum; if Num <> CatNumShow then begin ShowCategory(Num); end else begin ShowCategoryList; - end; + end; } end; //Hide Categorys when in Category Hack @@ -790,7 +790,7 @@ procedure TCatSongs.ShowCategoryList; var Num, S: integer; begin - //Hide All Songs Show All Cats + {//Hide All Songs Show All Cats for S := 0 to high(CatSongs.Song) do begin if CatSongs.Song[S].Main then CatSongs.Song[S].Visible := true @@ -798,7 +798,7 @@ begin CatSongs.Song[S].Visible := false end; CatSongs.Selected := CatNumShow; //Show last shown Category - CatNumShow := -1; + CatNumShow := -1; } end; //Hide Categorys when in Category Hack End @@ -808,7 +808,7 @@ var I: Integer; begin Result := -1; - I := SearchFrom + 1; + I := SearchFrom + 1; { while not CatSongs.Song[I].Visible do begin Inc (I); @@ -816,7 +816,7 @@ var I := low(CatSongs.Song); if (I = SearchFrom) then //Make One Round and no song found->quit break; - end; + end; } end; //Wrong song selected when tabs on bug End @@ -825,8 +825,8 @@ var S: integer; // song begin Result := 0; - for S := 0 to high(CatSongs.Song) do - if CatSongs.Song[S].Visible = true then Inc(Result); + {for S := 0 to high(CatSongs.Song) do + if CatSongs.Song[S].Visible = true then Inc(Result); } end; function TCatSongs.VisibleIndex(Index: integer): integer; @@ -834,8 +834,8 @@ var S: integer; // song begin Result := 0; - for S := 0 to Index-1 do - if CatSongs.Song[S].Visible = true then Inc(Result); + {for S := 0 to Index-1 do + if CatSongs.Song[S].Visible = true then Inc(Result); } end; function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; @@ -847,7 +847,7 @@ begin {fType: 0: All 1: Title 2: Artist} - FilterStr := Trim(FilterStr); + {FilterStr := Trim(FilterStr); if FilterStr<>'' then begin Result := 0; //Create Search Array @@ -893,9 +893,9 @@ begin for i:=0 to High(Song) do begin Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; CatNumShow := -1; - end; + end; } Result := 0; - end; + {end; } end; |