diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-07-23 19:21:06 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-07-23 19:21:06 +0000 |
commit | b73bb7080b12266fba7ebfaf4282ca12b9c89577 (patch) | |
tree | 28afec83329dc5456b943167e208404d1c6bd17b | |
parent | 230d5ed9b8cd6ed6d8a85a53e614a3bbd6ccddb3 (diff) | |
download | usdx-b73bb7080b12266fba7ebfaf4282ca12b9c89577.tar.gz usdx-b73bb7080b12266fba7ebfaf4282ca12b9c89577.tar.xz usdx-b73bb7080b12266fba7ebfaf4282ca12b9c89577.zip |
further string -> UTF8String or IPath conversions
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1887 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r-- | unicode/src/base/UEditorLyrics.pas | 4 | ||||
-rw-r--r-- | unicode/src/base/UFont.pas | 2 | ||||
-rw-r--r-- | unicode/src/base/ULanguage.pas | 7 | ||||
-rw-r--r-- | unicode/src/base/ULog.pas | 20 | ||||
-rw-r--r-- | unicode/src/base/ULyrics.pas | 4 | ||||
-rw-r--r-- | unicode/src/base/UMusic.pas | 2 | ||||
-rw-r--r-- | unicode/src/base/UNote.pas | 2 | ||||
-rw-r--r-- | unicode/src/base/UParty.pas | 4 | ||||
-rw-r--r-- | unicode/src/base/UPlatformWindows.pas | 38 | ||||
-rw-r--r-- | unicode/src/base/USongs.pas | 2 | ||||
-rw-r--r-- | unicode/src/menu/UMenuBackgroundVideo.pas | 4 | ||||
-rw-r--r-- | unicode/src/menu/UMenuSelectSlide.pas | 2 | ||||
-rw-r--r-- | unicode/src/screens/UScreenEditConvert.pas | 2 | ||||
-rw-r--r-- | unicode/src/screens/UScreenPartyNewRound.pas | 10 | ||||
-rw-r--r-- | unicode/src/screens/UScreenPartyScore.pas | 6 | ||||
-rw-r--r-- | unicode/src/screens/UScreenSong.pas | 4 | ||||
-rw-r--r-- | unicode/src/screens/UScreenSongMenu.pas | 6 | ||||
-rw-r--r-- | unicode/src/screens/UScreenStatMain.pas | 18 |
18 files changed, 50 insertions, 87 deletions
diff --git a/unicode/src/base/UEditorLyrics.pas b/unicode/src/base/UEditorLyrics.pas index ef9d8dd6..0eacd1f9 100644 --- a/unicode/src/base/UEditorLyrics.pas +++ b/unicode/src/base/UEditorLyrics.pas @@ -74,7 +74,7 @@ type procedure SetSize(Value: real); procedure SetSelected(Value: integer); procedure SetFontStyle(Value: integer); - procedure AddWord(Text: string); + procedure AddWord(Text: UTF8String); procedure Refresh; public ColR: real; @@ -179,7 +179,7 @@ begin FontStyleI := Value; end; -procedure TEditorLyrics.AddWord(Text: string); +procedure TEditorLyrics.AddWord(Text: UTF8String); var WordNum: integer; begin diff --git a/unicode/src/base/UFont.pas b/unicode/src/base/UFont.pas index 473e8f95..8baab629 100644 --- a/unicode/src/base/UFont.pas +++ b/unicode/src/base/UFont.pas @@ -128,7 +128,7 @@ type {** * Splits lines in Text seperated by newline (char-code #13). - * @param Text UTF-8 encoded string + * @param Text UCS-4 encoded string * @param Lines splitted UCS4String lines *} procedure SplitLines(const Text: UCS4String; var Lines: TUCS4StringArray); diff --git a/unicode/src/base/ULanguage.pas b/unicode/src/base/ULanguage.pas index 88b6647f..3dd5a9e0 100644 --- a/unicode/src/base/ULanguage.pas +++ b/unicode/src/base/ULanguage.pas @@ -33,6 +33,9 @@ interface {$I switches.inc} +uses + UUnicodeUtils; + type TLanguageEntry = record ID: AnsiString; //**< identifier (ASCII) @@ -60,7 +63,7 @@ type public constructor Create; - function Translate(const Text: UTF8String): UTF8String; + function Translate(const Text: RawByteString): UTF8String; procedure ChangeLanguage(const Language: AnsiString); procedure AddConst(const ID: AnsiString; const Text: UTF8String); procedure ChangeConst(const ID: AnsiString; const Text: UTF8String); @@ -208,7 +211,7 @@ end; * setting. If Text is not a known ID, it will be returned as is. * @param Text either an ID or an UTF-8 encoded string *} -function TLanguage.Translate(const Text: UTF8String): UTF8String; +function TLanguage.Translate(const Text: RawByteString): UTF8String; var E: integer; // entry ID: AnsiString; diff --git a/unicode/src/base/ULog.pas b/unicode/src/base/ULog.pas index 08a64e2b..e4ff4862 100644 --- a/unicode/src/base/ULog.pas +++ b/unicode/src/base/ULog.pas @@ -116,7 +116,7 @@ type // voice procedure LogVoice(SoundNr: integer); // buffer - procedure LogBuffer(const buf : Pointer; const bufLength : Integer; const filename : string); + procedure LogBuffer(const buf : Pointer; const bufLength : Integer; const filename : IPath); end; procedure DebugWriteln(const aString: String); @@ -420,21 +420,19 @@ begin FS.Free; end; -procedure TLog.LogBuffer(const buf: Pointer; const bufLength: Integer; const filename: string); +procedure TLog.LogBuffer(const buf: Pointer; const bufLength: Integer; const filename: IPath); var - f : TFileStream; + f : TBinaryFileStream; begin - f := nil; - try - f := TFileStream.Create( filename, fmCreate); - f.Write( buf^, bufLength); - f.Free; - except - on e : Exception do begin - Log.LogError('TLog.LogBuffer: Failed to log buffer into file "' + filename + '". ErrMsg: ' + e.Message); + f := TBinaryFileStream.Create( filename, fmCreate); + try + f.Write( buf^, bufLength); + finally f.Free; end; + except on e : Exception do + Log.LogError('TLog.LogBuffer: Failed to log buffer into file "' + filename.ToNative + '". ErrMsg: ' + e.Message); end; end; diff --git a/unicode/src/base/ULyrics.pas b/unicode/src/base/ULyrics.pas index 82982981..3f62db9c 100644 --- a/unicode/src/base/ULyrics.pas +++ b/unicode/src/base/ULyrics.pas @@ -52,14 +52,14 @@ type Width: real; // width Start: cardinal; // start of the word in quarters (beats) Length: cardinal; // length of the word in quarters - Text: string; // text + Text: UTF8String; // text Freestyle: boolean; // is freestyle? end; TLyricWordArray = array of TLyricWord; TLyricLine = class public - Text: string; // text + Text: UTF8String; // text Width: real; // width Height: real; // height Words: TLyricWordArray; // words in this line diff --git a/unicode/src/base/UMusic.pas b/unicode/src/base/UMusic.pas index 51759b6f..24eb0f45 100644 --- a/unicode/src/base/UMusic.pas +++ b/unicode/src/base/UMusic.pas @@ -457,7 +457,7 @@ const SOUNDID_CLICK = 5; LAST_SOUNDID = SOUNDID_CLICK; - BaseSoundFilenames: array[0..LAST_SOUNDID] of string = ( + BaseSoundFilenames: array[0..LAST_SOUNDID] of IPath = ( '%SOUNDPATH%/Common start.mp3', // Start '%SOUNDPATH%/Common back.mp3', // Back '%SOUNDPATH%/menu swoosh.mp3', // Swoosh diff --git a/unicode/src/base/UNote.pas b/unicode/src/base/UNote.pas index b457bda3..8e5b709a 100644 --- a/unicode/src/base/UNote.pas +++ b/unicode/src/base/UNote.pas @@ -61,7 +61,7 @@ type PPLayer = ^TPlayer; TPlayer = record - Name: string; + Name: UTF8String; // Index in Teaminfo record TeamID: byte; diff --git a/unicode/src/base/UParty.pas b/unicode/src/base/UParty.pas index b02d13be..3cfcb6cb 100644 --- a/unicode/src/base/UParty.pas +++ b/unicode/src/base/UParty.pas @@ -71,7 +71,7 @@ type procedure StartRound; procedure EndRound; function GetTeamOrder: TeamOrderArray; - function GetWinnerString(Round: byte): string; + function GetWinnerString(Round: byte): UTF8String; end; var @@ -347,7 +347,7 @@ end; //---------- //GetWinnerString - Get string with WinnerTeam Name, when there is more than one Winner than Connect with and or , //---------- -function TPartySession.GetWinnerString(Round: byte): string; +function TPartySession.GetWinnerString(Round: byte): UTF8String; var Winners: array of UTF8String; I: integer; diff --git a/unicode/src/base/UPlatformWindows.pas b/unicode/src/base/UPlatformWindows.pas index 2d0bd212..a0372dad 100644 --- a/unicode/src/base/UPlatformWindows.pas +++ b/unicode/src/base/UPlatformWindows.pas @@ -61,44 +61,6 @@ uses Windows, UConfig; -(* -function FindMatchingFileW(var F: TSearchRecW): Integer; forward; -function DirectoryExistsW(const Directory: widestring): Boolean; forward; - -function FindMatchingFileW(var F: TSearchRecW): Integer; -var - LocalFileTime: TFileTime; -begin - with F do - begin - while FindData.dwFileAttributes and ExcludeAttr <> 0 do -{$IFDEF Delphi} - if not FindNextFileW(FindHandle, FindData) then -{$ELSE} - if not FindNextFileW(FindHandle, @FindData) then -{$ENDIF} - begin - Result := GetLastError; - Exit; - end; - FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime); - FileTimeToDosDateTime(LocalFileTime, LongRec(Time).Hi, LongRec(Time).Lo); - Size := FindData.nFileSizeLow; - Attr := FindData.dwFileAttributes; - Name := FindData.cFileName; - end; - Result := 0; -end; - -function DirectoryExistsW(const Directory: widestring): Boolean; -var - Code: Integer; -begin - Code := GetFileAttributesW(PWideChar(Directory)); - Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0); -end; -*) - //------------------------------ //Start more than One Time Prevention //------------------------------ diff --git a/unicode/src/base/USongs.pas b/unicode/src/base/USongs.pas index 55ddc5e9..c650c04d 100644 --- a/unicode/src/base/USongs.pas +++ b/unicode/src/base/USongs.pas @@ -76,7 +76,7 @@ type end; TScore = record - Name: widestring; + Name: UTF8String; Score: integer; Length: string; end; diff --git a/unicode/src/menu/UMenuBackgroundVideo.pas b/unicode/src/menu/UMenuBackgroundVideo.pas index ca32fded..9d265764 100644 --- a/unicode/src/menu/UMenuBackgroundVideo.pas +++ b/unicode/src/menu/UMenuBackgroundVideo.pas @@ -73,7 +73,7 @@ type public constructor Create; - function GetBGVideo(filename: string): TBGVideo; + function GetBGVideo(filename: IPath): TBGVideo; procedure RemoveItem( procedure FreeAllItems; @@ -190,7 +190,7 @@ begin end; -function TBGVideoPool.GetBGVideo(filename: string): TBGVideo; +function TBGVideoPool.GetBGVideo(filename: IPath): TBGVideo; begin end; diff --git a/unicode/src/menu/UMenuSelectSlide.pas b/unicode/src/menu/UMenuSelectSlide.pas index f9f6bbae..6bc824f4 100644 --- a/unicode/src/menu/UMenuSelectSlide.pas +++ b/unicode/src/menu/UMenuSelectSlide.pas @@ -48,7 +48,7 @@ type // objects Text: TText; // Main text describing option TextOpt: array of TText; // 3 texts in the position of possible options - TextOptT: array of string; // array of names for possible options + TextOptT: array of UTF8String; // array of names for possible options Texture: TTexture; // Select Texture TextureSBG: TTexture; // Background Selections Texture diff --git a/unicode/src/screens/UScreenEditConvert.pas b/unicode/src/screens/UScreenEditConvert.pas index 6c84ecad..2705a5b7 100644 --- a/unicode/src/screens/UScreenEditConvert.pas +++ b/unicode/src/screens/UScreenEditConvert.pas @@ -96,7 +96,7 @@ type ColB: array[0..100] of real; Len: real; SelTrack: integer; // index of selected track - //FileName: string; + //FileName: IPath; {$IFDEF UseMIDIPort} MidiFile: TMidiFile; diff --git a/unicode/src/screens/UScreenPartyNewRound.pas b/unicode/src/screens/UScreenPartyNewRound.pas index 2430735b..c4295502 100644 --- a/unicode/src/screens/UScreenPartyNewRound.pas +++ b/unicode/src/screens/UScreenPartyNewRound.pas @@ -219,7 +219,7 @@ end; procedure TScreenPartyNewRound.OnShow; var I: integer; - function GetTeamPlayers(const Num: byte): string; + function GetTeamPlayers(const Num: byte): UTF8String; var Players: array of UTF8String; J: byte; @@ -230,7 +230,7 @@ var //Create Players array SetLength(Players, PartySession.Teams.TeamInfo[Num-1].NumPlayers); for J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do - Players[J] := string(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name); + Players[J] := UTF8String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name); //Implode and Return Result := Language.Implode(Players); @@ -365,7 +365,7 @@ begin if (PartySession.Teams.NumTeams >= 1) then begin Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score); - Text[TextNameTeam1].Text := string(PartySession.Teams.TeamInfo[0].Name); + Text[TextNameTeam1].Text := UTF8String(PartySession.Teams.TeamInfo[0].Name); Text[TextTeam1Players].Text := GetTeamPlayers(1); Text[TextScoreTeam1].Visible := true; @@ -386,7 +386,7 @@ begin if (PartySession.Teams.NumTeams >= 2) then begin Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[1].Score); - Text[TextNameTeam2].Text := string(PartySession.Teams.TeamInfo[1].Name); + Text[TextNameTeam2].Text := UTF8String(PartySession.Teams.TeamInfo[1].Name); Text[TextTeam2Players].Text := GetTeamPlayers(2); Text[TextScoreTeam2].Visible := true; @@ -407,7 +407,7 @@ begin if (PartySession.Teams.NumTeams >= 3) then begin Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[2].Score); - Text[TextNameTeam3].Text := string(PartySession.Teams.TeamInfo[2].Name); + Text[TextNameTeam3].Text := UTF8String(PartySession.Teams.TeamInfo[2].Name); Text[TextTeam3Players].Text := GetTeamPlayers(3); Text[TextScoreTeam3].Visible := true; diff --git a/unicode/src/screens/UScreenPartyScore.pas b/unicode/src/screens/UScreenPartyScore.pas index bf3b3428..2de240b8 100644 --- a/unicode/src/screens/UScreenPartyScore.pas +++ b/unicode/src/screens/UScreenPartyScore.pas @@ -245,7 +245,7 @@ begin if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then begin Text[TextScoreTeam1].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[0].Score); - Text[TextNameTeam1].Text := string(ScreenSingModi.TeamInfo.Teaminfo[0].Name); + Text[TextNameTeam1].Text := UTF8String(ScreenSingModi.TeamInfo.Teaminfo[0].Name); //Set Deco Texture if Theme.PartyScore.DecoTextures.ChangeTextures then @@ -274,7 +274,7 @@ begin if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then begin Text[TextScoreTeam2].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[1].Score); - Text[TextNameTeam2].Text := string(ScreenSingModi.TeamInfo.Teaminfo[1].Name); + Text[TextNameTeam2].Text := UTF8String(ScreenSingModi.TeamInfo.Teaminfo[1].Name); //Set Deco Texture if Theme.PartyScore.DecoTextures.ChangeTextures then @@ -303,7 +303,7 @@ begin if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then begin Text[TextScoreTeam3].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[2].Score); - Text[TextNameTeam3].Text := string(ScreenSingModi.TeamInfo.Teaminfo[2].Name); + Text[TextNameTeam3].Text := UTF8String(ScreenSingModi.TeamInfo.Teaminfo[2].Name); //Set Deco Texture if Theme.PartyScore.DecoTextures.ChangeTextures then diff --git a/unicode/src/screens/UScreenSong.pas b/unicode/src/screens/UScreenSong.pas index d71206c1..5fa6de39 100644 --- a/unicode/src/screens/UScreenSong.pas +++ b/unicode/src/screens/UScreenSong.pas @@ -131,7 +131,7 @@ type procedure FixSelected; //Show Wrong Song when Tabs on Fix procedure FixSelected2; //Show Wrong Song when Tabs on Fix procedure ShowCatTL(Cat: integer);// Show Cat in Top left - procedure ShowCatTLCustom(Caption: string);// Show Custom Text in Top left + procedure ShowCatTLCustom(Caption: UTF8String);// Show Custom Text in Top left procedure HideCatTL;// Show Cat in Tob left procedure Refresh; //Refresh Song Sorting procedure ChangeMusic; @@ -213,7 +213,7 @@ begin end; //Show Wrong Song when Tabs on Fix End -procedure TScreenSong.ShowCatTLCustom(Caption: string);// Show Custom Text in Top left +procedure TScreenSong.ShowCatTLCustom(Caption: UTF8String);// Show Custom Text in Top left begin Text[TextCat].Text := Caption; Text[TextCat].Visible := true; diff --git a/unicode/src/screens/UScreenSongMenu.pas b/unicode/src/screens/UScreenSongMenu.pas index 2441b929..ec893c7a 100644 --- a/unicode/src/screens/UScreenSongMenu.pas +++ b/unicode/src/screens/UScreenSongMenu.pas @@ -408,9 +408,9 @@ begin Button[3].Visible := true; SelectsS[0].Visible := false; - Button[0].Text[0].Text := string(PartySession.Teams.Teaminfo[0].Name); - Button[1].Text[0].Text := string(PartySession.Teams.Teaminfo[1].Name); - Button[2].Text[0].Text := string(PartySession.Teams.Teaminfo[2].Name); + Button[0].Text[0].Text := UTF8String(PartySession.Teams.Teaminfo[0].Name); + Button[1].Text[0].Text := UTF8String(PartySession.Teams.Teaminfo[1].Name); + Button[2].Text[0].Text := UTF8String(PartySession.Teams.Teaminfo[2].Name); Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); // set right interaction diff --git a/unicode/src/screens/UScreenStatMain.pas b/unicode/src/screens/UScreenStatMain.pas index 9237cdfa..204f40cd 100644 --- a/unicode/src/screens/UScreenStatMain.pas +++ b/unicode/src/screens/UScreenStatMain.pas @@ -47,9 +47,9 @@ type private //Some Stat Value that don't need to be calculated 2 times SongsWithVid: cardinal; - function FormatOverviewIntro(FormatStr: string): string; - function FormatSongOverview(FormatStr: string): string; - function FormatPlayerOverview(FormatStr: string): string; + function FormatOverviewIntro(FormatStr: UTF8String): UTF8String; + function FormatSongOverview(FormatStr: UTF8String): UTF8String; + function FormatPlayerOverview(FormatStr: UTF8String): UTF8String; public TextOverview: integer; constructor Create; override; @@ -178,7 +178,7 @@ begin SetOverview; end; -function TScreenStatMain.FormatOverviewIntro(FormatStr: string): string; +function TScreenStatMain.FormatOverviewIntro(FormatStr: UTF8String): UTF8String; var Year, Month, Day: word; begin @@ -199,10 +199,10 @@ begin end; end; -function TScreenStatMain.FormatSongOverview(FormatStr: string): string; +function TScreenStatMain.FormatSongOverview(FormatStr: UTF8String): UTF8String; var CntSongs, CntSungSongs, CntVidSongs: integer; - MostPopSongArtist, MostPopSongTitle: string; + MostPopSongArtist, MostPopSongTitle: UTF8String; StatList: TList; MostSungSong: TStatResultMostSungSong; begin @@ -243,12 +243,12 @@ begin end; end; -function TScreenStatMain.FormatPlayerOverview(FormatStr: string): string; +function TScreenStatMain.FormatPlayerOverview(FormatStr: UTF8String): UTF8String; var CntPlayers: integer; BestScoreStat: TStatResultBestScores; BestSingerStat: TStatResultBestSingers; - BestPlayer, BestScorePlayer: string; + BestPlayer, BestScorePlayer: UTF8String; BestPlayerScore, BestScore: integer; SingerStats, ScoreStats: TList; begin @@ -303,7 +303,7 @@ end; procedure TScreenStatMain.SetOverview; var - Overview: string; + Overview: UTF8String; begin // Format overview Overview := FormatOverviewIntro(Language.Translate('STAT_OVERVIEW_INTRO')) + '\n \n' + |