From 17614ea059162f432f7feba5f39329667a335fa6 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 7 Nov 2008 20:49:01 +0000 Subject: - WideStringUpperCase moved to UUnicodeUtils.pas - WideCharUpperCase removed as single characters (code-point) can be represented by two WideChars (surrogates). Convert to UCS4 instead (one code-point <-> one UCS4Char). - UCS4 functions added to UUUnicodeUtils - string replaced with UTF8String (although it's just a typedef) to mark UTF8 strings. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1507 b956fd51-792f-4845-bead-9b4dfca2ff2c --- unicode/src/base/UUnicodeUtils.pas | 87 ++++++++++++++++++++++++- unicode/src/menu/UMenu.pas | 89 +++++++------------------- unicode/src/menu/UMenuText.pas | 24 +++---- unicode/src/screens/UScreenEdit.pas | 9 ++- unicode/src/screens/UScreenEditConvert.pas | 50 ++++++++------- unicode/src/screens/UScreenEditHeader.pas | 22 +++++-- unicode/src/screens/UScreenEditSub.pas | 43 +++++++------ unicode/src/screens/UScreenLevel.pas | 5 +- unicode/src/screens/UScreenMain.pas | 5 +- unicode/src/screens/UScreenOptions.pas | 15 ++++- unicode/src/screens/UScreenOptionsAdvanced.pas | 15 ++++- unicode/src/screens/UScreenOptionsGame.pas | 16 ++++- unicode/src/screens/UScreenOptionsGraphics.pas | 8 ++- unicode/src/screens/UScreenOptionsLyrics.pas | 7 +- unicode/src/screens/UScreenOptionsRecord.pas | 3 +- unicode/src/screens/UScreenOptionsSound.pas | 15 ++++- unicode/src/screens/UScreenOptionsThemes.pas | 12 ++-- unicode/src/screens/UScreenPartyNewRound.pas | 32 +++++---- unicode/src/screens/UScreenPartyOptions.pas | 23 ++++++- unicode/src/screens/UScreenPartyScore.pas | 19 +++++- unicode/src/screens/UScreenPartyWin.pas | 17 ++++- unicode/src/screens/UScreenPopup.pas | 20 +++++- unicode/src/screens/UScreenScore.pas | 20 +++--- unicode/src/screens/UScreenSing.pas | 17 +++-- unicode/src/screens/UScreenSong.pas | 53 ++++++++------- unicode/src/screens/UScreenSongMenu.pas | 24 +++---- unicode/src/screens/UScreenStatDetail.pas | 9 +-- unicode/src/screens/UScreenStatMain.pas | 25 ++++---- unicode/src/screens/UScreenTop5.pas | 20 ++++-- 29 files changed, 452 insertions(+), 252 deletions(-) (limited to 'unicode/src') diff --git a/unicode/src/base/UUnicodeUtils.pas b/unicode/src/base/UUnicodeUtils.pas index 91c5966f..49be200f 100644 --- a/unicode/src/base/UUnicodeUtils.pas +++ b/unicode/src/base/UUnicodeUtils.pas @@ -47,11 +47,51 @@ function IsAlphaNumericChar(ch: WideChar): boolean; function IsPunctuationChar(ch: WideChar): boolean; function IsControlChar(ch: WideChar): boolean; +{* + * String format conversion + *} + function UTF8ToUCS4String(const str: UTF8String): UCS4String; -function UCS4ToUTF8String(const str: UCS4String): UTF8String; +function UCS4ToUTF8String(const str: UCS4String): UTF8String; overload; +function UCS4ToUTF8String(ch: UCS4Char): UTF8String; overload; + +{** + * Returns the number of characters (not bytes) in string str. + *} +function LengthUTF8(const str: UTF8String): integer; + +{** + * Converts a UCS-4 char ch to its upper-case representation. + *} +function UCS4UpperCase(ch: UCS4Char): UCS4Char; overload; + +{** + * Converts a UCS-4 string str to its upper-case representation. + *} +function UCS4UpperCase(const str: UCS4String): UCS4String; overload; + +{** + * + *} +function UCS4CharToString(ch: UCS4Char): UCS4String; + +(* + + * Converts a WideString to its upper-case representation. + * Wrapper for WideUpperCase. Needed because some plattforms have problems with + * unicode support. + * + * Note that characters in UTF-16 might consist of one or two WideChar valus + * (see surrogates). So instead of using WideStringUpperCase(ch)[1] for single + * character access, convert to UCS-4 where each character is represented by + * one UCS4Char. + *) +function WideStringUpperCase(const str: WideString) : WideString; + implementation + function IsAlphaChar(ch: WideChar): boolean; begin {$IFDEF MSWINDOWS} @@ -121,4 +161,49 @@ begin Result := UTF8Encode(UCS4StringToWideString(str)); end; +function UCS4ToUTF8String(ch: UCS4Char): UTF8String; +begin + Result := UCS4ToUTF8String(UCS4CharToString(ch)); +end; + +function LengthUTF8(const str: UTF8String): integer; +begin + Result := Length(UTF8ToUCS4String(str)); +end; + +function UCS4UpperCase(ch: UCS4Char): UCS4Char; +begin + Result := UCS4UpperCase(UCS4CharToString(ch))[0]; +end; + +function UCS4UpperCase(const str: UCS4String): UCS4String; +begin + // convert to upper-case as WideString and convert result back to UCS-4 + Result := WideStringToUCS4String( + WideStringUpperCase( + UCS4StringToWideString(str))); +end; + +function UCS4CharToString(ch: UCS4Char): UCS4String; +begin + SetLength(Result, 2); + Result[0] := ch; + Result[1] := 0; +end; + +function WideStringUpperCase(const str: WideString): WideString; +begin + // On Linux and MacOSX the cwstring unit is necessary for Unicode function-calls. + // Otherwise you will get an EIntOverflow exception (thrown by unimplementedwidestring()). + // The Unicode manager cwstring does not work with MacOSX at the moment because + // of missing references to iconv. So we have to use Ansi... for the moment. + + {.$IFNDEF DARWIN} + {$IFDEF NOIGNORE} + Result := WideUpperCase(str) + {$ELSE} + Result := UTF8Decode(AnsiUpperCase(UTF8Encode(str))); + {$ENDIF} +end; + end. diff --git a/unicode/src/menu/UMenu.pas b/unicode/src/menu/UMenu.pas index 16ecc658..5528c6fe 100644 --- a/unicode/src/menu/UMenu.pas +++ b/unicode/src/menu/UMenu.pas @@ -79,8 +79,6 @@ type //constructor Create(Back: string; W, H: integer); overload; virtual; // W and H are the number of overlaps // interaction - function WideCharUpperCase(wchar: WideChar) : WideString; - function WideStringUpperCase(wstring: WideString) : WideString; procedure AddInteraction(Typ, Num: integer); procedure SetInteraction(Num: integer); property Interaction: integer read SelInteraction write SetInteraction; @@ -106,9 +104,9 @@ type // text function AddText(ThemeText: TThemeText): integer; overload; - function AddText(X, Y: real; const Text_: string): integer; overload; - function AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; const Text: string): integer; overload; - function AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; const Text_: string; Reflection_: boolean; ReflectionSpacing_: real; Z : real): integer; overload; + function AddText(X, Y: real; const Text_: UTF8String): integer; overload; + function AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; const Text: UTF8String): integer; overload; + function AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; const Text_: UTF8String; Reflection_: boolean; ReflectionSpacing_: real; Z : real): integer; overload; // button Procedure SetButtonLength(Length: cardinal); //Function that Set Length of Button Array in one Step instead of register new Memory for every Button @@ -117,22 +115,22 @@ type function AddButton(X, Y, W, H: real; const Name: string; Typ: TTextureType; Reflection: boolean): integer; overload; function AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; const Name: string; Typ: TTextureType; Reflection: boolean; ReflectionSpacing, DeSelectReflectionSpacing: real): integer; overload; procedure ClearButtons; - procedure AddButtonText(AddX, AddY: real; const AddText: string); overload; - procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; const AddText: string); overload; - procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; const AddText: string); overload; - procedure AddButtonText(CustomButton: TButton; AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; const AddText: string); overload; + procedure AddButtonText(AddX, AddY: real; const AddText: UTF8String); overload; + procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; const AddText: UTF8String); overload; + procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; const AddText: UTF8String); overload; + procedure AddButtonText(CustomButton: TButton; AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; const AddText: UTF8String); overload; // select slide - function AddSelectSlide(ThemeSelectS: TThemeSelectSlide; var Data: integer; Values: array of string): integer; overload; + function AddSelectSlide(ThemeSelectS: TThemeSelectSlide; var Data: integer; const Values: array of string): integer; overload; function AddSelectSlide(X, Y, W, H, SkipX, SBGW, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt, TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; const Name: string; Typ: TTextureType; const SBGName: string; SBGTyp: TTextureType; - const Caption: string; var Data: integer): integer; overload; - procedure AddSelectSlideOption(const AddText: string); overload; - procedure AddSelectSlideOption(SelectNo: cardinal; const AddText: string); overload; - procedure UpdateSelectSlideOptions(ThemeSelectSlide: TThemeSelectSlide; SelectNum: integer; Values: array of string; var Data: integer); + const Caption: UTF8String; var Data: integer): integer; overload; + procedure AddSelectSlideOption(const AddText: UTF8String); overload; + procedure AddSelectSlideOption(SelectNo: cardinal; const AddText: UTF8String); overload; + procedure UpdateSelectSlideOptions(ThemeSelectSlide: TThemeSelectSlide; SelectNum: integer; const Values: array of string; var Data: integer); // function AddWidget(X, Y : UInt16; WidgetSrc : PSDL_Surface): Int16; // procedure ClearWidgets(MinNumber : Int16); @@ -683,7 +681,7 @@ begin ThemeText.ColR, ThemeText.ColG, ThemeText.ColB, ThemeText.Align, ThemeText.Text, ThemeText.Reflection, ThemeText.ReflectionSpacing, ThemeText.Z); end; -function TMenu.AddText(X, Y: real; const Text_: string): integer; +function TMenu.AddText(X, Y: real; const Text_: UTF8String): integer; var TextNum: integer; begin @@ -694,12 +692,12 @@ begin Result := TextNum; end; -function TMenu.AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; const Text: string): integer; +function TMenu.AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; const Text: UTF8String): integer; begin Result := AddText(X, Y, 0, Style, Size, ColR, ColG, ColB, 0, Text, false, 0, 0); end; -function TMenu.AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; const Text_: string; Reflection_: boolean; ReflectionSpacing_: real; Z : real): integer; +function TMenu.AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; const Text_: UTF8String; Reflection_: boolean; ReflectionSpacing_: real; Z : real): integer; var TextNum: integer; begin @@ -1127,12 +1125,12 @@ begin ScreenPopupCheck.ShowPopup(msg); end; -procedure TMenu.AddButtonText(AddX, AddY: real; const AddText: string); +procedure TMenu.AddButtonText(AddX, AddY: real; const AddText: UTF8String); begin AddButtonText(AddX, AddY, 1, 1, 1, AddText); end; -procedure TMenu.AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; const AddText: string); +procedure TMenu.AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; const AddText: UTF8String); var Il: integer; begin @@ -1148,7 +1146,7 @@ begin end; end; -procedure TMenu.AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; const AddText: string); +procedure TMenu.AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; const AddText: UTF8String); var Il: integer; begin @@ -1167,7 +1165,7 @@ begin end; end; -procedure TMenu.AddButtonText(CustomButton: TButton; AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; const AddText: string); +procedure TMenu.AddButtonText(CustomButton: TButton; AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; const AddText: UTF8String); var Il: integer; begin @@ -1186,7 +1184,7 @@ begin end; end; -function TMenu.AddSelectSlide(ThemeSelectS: TThemeSelectSlide; var Data: integer; Values: array of string): integer; +function TMenu.AddSelectSlide(ThemeSelectS: TThemeSelectSlide; var Data: integer; const Values: array of string): integer; var SO: integer; begin @@ -1221,7 +1219,7 @@ function TMenu.AddSelectSlide(X, Y, W, H, SkipX, SBGW, ColR, ColG, ColB, Int, DC SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; const Name: string; Typ: TTextureType; const SBGName: string; SBGTyp: TTextureType; - const Caption: string; var Data: integer): integer; + const Caption: UTF8String; var Data: integer): integer; var S: integer; I: integer; @@ -1339,12 +1337,12 @@ begin Result := S; end; -procedure TMenu.AddSelectSlideOption(const AddText: string); +procedure TMenu.AddSelectSlideOption(const AddText: UTF8String); begin AddSelectSlideOption(High(SelectsS), AddText); end; -procedure TMenu.AddSelectSlideOption(SelectNo: cardinal; const AddText: string); +procedure TMenu.AddSelectSlideOption(SelectNo: cardinal; const AddText: UTF8String); var SO: integer; begin @@ -1358,7 +1356,7 @@ begin //if SO = Selects[S].PData^ then Selects[S].SelectedOption := SO; end; -procedure TMenu.UpdateSelectSlideOptions(ThemeSelectSlide: TThemeSelectSlide; SelectNum: integer; Values: array of string; var Data: integer); +procedure TMenu.UpdateSelectSlideOptions(ThemeSelectSlide: TThemeSelectSlide; SelectNum: integer; const Values: array of string; var Data: integer); var SO: integer; begin @@ -1517,45 +1515,6 @@ begin // nothing end; -(* - * Wrapper for WideUpperCase. Needed because some plattforms have problems with - * unicode support. - *) -function TMenu.WideCharUpperCase(wchar: WideChar) : WideString; -begin - // On Linux and MacOSX the cwstring unit is necessary for Unicode function-calls. - // Otherwise you will get an EIntOverflow exception (thrown by unimplementedwidestring()). - // The Unicode manager cwstring does not work with MacOSX at the moment because - // of missing references to iconv. So we have to use Ansi... for the moment. - - // cwstring crashes in FPC 2.2.2 so do not use the cwstring stuff - {.$IFNDEF DARWIN} - {$IFDEF NOIGNORE} - // The FPC implementation of WideUpperCase returns nil if wchar is #0 (e.g. if an arrow key is pressed) - if (wchar <> #0) then - Result := WideUpperCase(wchar) - else - Result := #0; - {$ELSE} - Result := AnsiUpperCase(wchar) - {$ENDIF} -end; - -(* - * Wrapper for WideUpperCase. Needed because some plattforms have problems with - * unicode support. - *) -function TMenu.WideStringUpperCase(wstring: WideString) : WideString; -begin - // cwstring crashes in FPC 2.2.2 so do not use the cwstring stuff - {.$IFNDEF DARWIN} - {$IFDEF NOIGNORE} - Result := WideUpperCase(wstring) - {$ELSE} - Result := AnsiUpperCase(wstring); - {$ENDIF} -end; - procedure TMenu.onHide; begin // nothing diff --git a/unicode/src/menu/UMenuText.pas b/unicode/src/menu/UMenuText.pas index 24c7eae6..87f9ce54 100644 --- a/unicode/src/menu/UMenuText.pas +++ b/unicode/src/menu/UMenuText.pas @@ -45,8 +45,8 @@ type TText = class private SelectBool: boolean; - TextString: string; - TextTiles: array of string; + TextString: UTF8String; + TextTiles: array of UTF8String; STicks: Cardinal; SelectBlink: boolean; @@ -75,15 +75,15 @@ type procedure SetSelect(Value: boolean); property Selected: boolean read SelectBool write SetSelect; - procedure SetText(Value: string); - property Text: string read TextString write SetText; + procedure SetText(Value: UTF8String); + property Text: UTF8String read TextString write SetText; procedure DeleteLastLetter; //Procedure to Delete Last Letter procedure Draw; constructor Create; overload; - constructor Create(X, Y: real; Tekst: string); overload; - constructor Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string; ParReflection: boolean; ParReflectionSpacing: real; ParZ: real); overload; + constructor Create(X, Y: real; const Text: UTF8String); overload; + constructor Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; const ParText: UTF8String; ParReflection: boolean; ParReflectionSpacing: real; ParZ: real); overload; end; implementation @@ -102,7 +102,7 @@ begin STicks := SDL_GetTicks() div 550; end; -procedure TText.SetText(Value: string); +procedure TText.SetText(Value: UTF8String); var NextPos: Cardinal; //NextPos of a Space etc. LastPos: Cardinal; //LastPos " @@ -260,7 +260,7 @@ end; procedure TText.Draw; var X2, Y2: real; - Text2: string; + Text2: UTF8String; I: integer; begin if Visible then @@ -348,12 +348,12 @@ begin Create(0, 0, ''); end; -constructor TText.Create(X, Y: real; Tekst: string); +constructor TText.Create(X, Y: real; const Text: UTF8String); begin - Create(X, Y, 0, 0, 30, 0, 0, 0, 0, Tekst, false, 0, 0); + Create(X, Y, 0, 0, 30, 0, 0, 0, 0, Text, false, 0, 0); end; -constructor TText.Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string; ParReflection: boolean; ParReflectionSpacing: real; ParZ:real); +constructor TText.Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; const ParText: UTF8String; ParReflection: boolean; ParReflectionSpacing: real; ParZ:real); begin inherited Create; Alpha := 1; @@ -363,7 +363,7 @@ begin Z := ParZ; Style := ParStyle; Size := ParSize; - Text := ParTekst; + Text := ParText; ColR := ParColR; ColG := ParColG; ColB := ParColB; diff --git a/unicode/src/screens/UScreenEdit.pas b/unicode/src/screens/UScreenEdit.pas index f141edee..14d45213 100644 --- a/unicode/src/screens/UScreenEdit.pas +++ b/unicode/src/screens/UScreenEdit.pas @@ -51,7 +51,12 @@ type implementation -uses UGraphic, UMusic, USkins, SysUtils; +uses + UGraphic, + UMusic, + USkins, + UUnicodeUtils, + SysUtils; function TScreenEdit.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -59,7 +64,7 @@ begin If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenEditConvert.pas b/unicode/src/screens/UScreenEditConvert.pas index 8cc6c59d..712817c3 100644 --- a/unicode/src/screens/UScreenEditConvert.pas +++ b/unicode/src/screens/UScreenEditConvert.pas @@ -33,17 +33,18 @@ interface {$I switches.inc} -uses UMenu, - SDL, - {$IFDEF UseMIDIPort} - MidiFile, - MidiOut, - {$ENDIF} - ULog, - USongs, - USong, - UMusic, - UThemes; +uses + UMenu, + SDL, + {$IFDEF UseMIDIPort} + MidiFile, + MidiOut, + {$ENDIF} + ULog, + USongs, + USong, + UMusic, + UThemes; type TNote = record @@ -93,7 +94,7 @@ type MidiEvent: pMidiEvent; MidiOut: TMidiOutput; {$ENDIF} - + Song: TSong; Lines: TLines; BPM: real; @@ -106,7 +107,7 @@ type {$IFDEF UseMIDIPort} procedure MidiFile1MidiEvent(event: PMidiEvent); {$ENDIF} - + function SelectedNumber: integer; constructor Create; override; procedure onShow; override; @@ -116,15 +117,18 @@ type end; implementation -uses UGraphic, - SysUtils, - UDrawTexture, - TextGL, - UFiles, - UMain, - UIni, - gl, - USkins; + +uses + SysUtils, + gl, + UGraphic, + UDrawTexture, + TextGL, + UFiles, + UMain, + UIni, + USkins, + UUnicodeUtils; function TScreenEditConvert.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -132,7 +136,7 @@ begin If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenEditHeader.pas b/unicode/src/screens/UScreenEditHeader.pas index edced1fa..616c523b 100644 --- a/unicode/src/screens/UScreenEditHeader.pas +++ b/unicode/src/screens/UScreenEditHeader.pas @@ -33,11 +33,12 @@ interface {$I switches.inc} -uses UMenu, - SDL, - USongs, - USong, - UThemes; +uses + UMenu, + SDL, + USongs, + USong, + UThemes; type TScreenEditHeader = class(TMenu) @@ -79,7 +80,14 @@ type implementation -uses UGraphic, UMusic, SysUtils, UFiles, USkins, UTexture; +uses + UGraphic, + UMusic, + SysUtils, + UFiles, + USkins, + UTexture, + UUnicodeUtils; function TScreenEditHeader.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; var @@ -88,7 +96,7 @@ begin Result := true; If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenEditSub.pas b/unicode/src/screens/UScreenEditSub.pas index 167d94b4..4189ec74 100644 --- a/unicode/src/screens/UScreenEditSub.pas +++ b/unicode/src/screens/UScreenEditSub.pas @@ -33,25 +33,25 @@ interface {$I switches.inc} uses - UMenu, - UMusic, - SDL, - SysUtils, - UFiles, - UTime, - USongs, - USong, - UIni, - ULog, - UTexture, - UMenuText, - UEditorLyrics, - Math, - gl, - {$IFDEF UseMIDIPort} - MidiOut, - {$ENDIF} - UThemes; + UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + USong, + UIni, + ULog, + UTexture, + UMenuText, + UEditorLyrics, + Math, + gl, + {$IFDEF UseMIDIPort} + MidiOut, + {$ENDIF} + UThemes; type TScreenEditSub = class(TMenu) @@ -130,7 +130,8 @@ uses UDraw, UMain, USkins, - ULanguage; + ULanguage, + UUnicodeUtils; // Method for input parsing. If False is returned, GetNextWindow // should be checked to know the next window to load; @@ -150,7 +151,7 @@ begin If (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenLevel.pas b/unicode/src/screens/UScreenLevel.pas index a632cf78..c0c856dd 100644 --- a/unicode/src/screens/UScreenLevel.pas +++ b/unicode/src/screens/UScreenLevel.pas @@ -51,7 +51,8 @@ uses UGraphic, UMain, UIni, USong, - UTexture; + UTexture, + UUnicodeUtils; function TScreenLevel.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -59,7 +60,7 @@ begin If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenMain.pas b/unicode/src/screens/UScreenMain.pas index 2a2d0613..ed8e2170 100644 --- a/unicode/src/screens/UScreenMain.pas +++ b/unicode/src/screens/UScreenMain.pas @@ -72,7 +72,8 @@ uses UParty, UDLLManager, UScreenCredits, - USkins; + USkins, + UUnicodeUtils; function TScreenMain.ParseInput(PressedKey: cardinal; CharCode: widechar; PressedDown: boolean): boolean; @@ -87,7 +88,7 @@ begin if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := False; diff --git a/unicode/src/screens/UScreenOptions.pas b/unicode/src/screens/UScreenOptions.pas index 10eba591..30f69987 100644 --- a/unicode/src/screens/UScreenOptions.pas +++ b/unicode/src/screens/UScreenOptions.pas @@ -34,7 +34,14 @@ interface {$I switches.inc} uses - UMenu, SDL, SysUtils, UDisplay, UMusic, UFiles, UIni, UThemes; + SDL, + SysUtils, + UMenu, + UDisplay, + UMusic, + UFiles, + UIni, + UThemes; type TScreenOptions = class(TMenu) @@ -52,7 +59,9 @@ type implementation -uses UGraphic; +uses + UGraphic, + UUnicodeUtils; function TScreenOptions.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -60,7 +69,7 @@ begin If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenOptionsAdvanced.pas b/unicode/src/screens/UScreenOptionsAdvanced.pas index 8960640d..bbfb7813 100644 --- a/unicode/src/screens/UScreenOptionsAdvanced.pas +++ b/unicode/src/screens/UScreenOptionsAdvanced.pas @@ -34,7 +34,13 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; + SDL, + UMenu, + UDisplay, + UMusic, + UFiles, + UIni, + UThemes; type TScreenOptionsAdvanced = class(TMenu) @@ -46,7 +52,10 @@ type implementation -uses UGraphic, SysUtils; +uses + UGraphic, + UUnicodeUtils, + SysUtils; function TScreenOptionsAdvanced.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -54,7 +63,7 @@ begin If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenOptionsGame.pas b/unicode/src/screens/UScreenOptionsGame.pas index e634419b..07249591 100644 --- a/unicode/src/screens/UScreenOptionsGame.pas +++ b/unicode/src/screens/UScreenOptionsGame.pas @@ -34,7 +34,14 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes, USongs; + SDL, + UMenu, + UDisplay, + UMusic, + UFiles, + UIni, + UThemes, + USongs; type TScreenOptionsGame = class(TMenu) @@ -48,7 +55,10 @@ type implementation -uses UGraphic, SysUtils; +uses + UGraphic, + UUnicodeUtils, + SysUtils; function TScreenOptionsGame.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -56,7 +66,7 @@ begin If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenOptionsGraphics.pas b/unicode/src/screens/UScreenOptionsGraphics.pas index 2e2b4f0e..bd233597 100644 --- a/unicode/src/screens/UScreenOptionsGraphics.pas +++ b/unicode/src/screens/UScreenOptionsGraphics.pas @@ -52,7 +52,11 @@ type implementation -uses UGraphic, UMain, SysUtils, TypInfo; +uses + UGraphic, + UMain, + UUnicodeUtils, + SysUtils; function TScreenOptionsGraphics.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -60,7 +64,7 @@ begin If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenOptionsLyrics.pas b/unicode/src/screens/UScreenOptionsLyrics.pas index b5228a52..c237bf83 100644 --- a/unicode/src/screens/UScreenOptionsLyrics.pas +++ b/unicode/src/screens/UScreenOptionsLyrics.pas @@ -52,7 +52,10 @@ type implementation -uses UGraphic, SysUtils; +uses + UGraphic, + UUnicodeUtils, + SysUtils; function TScreenOptionsLyrics.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -60,7 +63,7 @@ begin If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenOptionsRecord.pas b/unicode/src/screens/UScreenOptionsRecord.pas index b622f56c..144ae0cf 100644 --- a/unicode/src/screens/UScreenOptionsRecord.pas +++ b/unicode/src/screens/UScreenOptionsRecord.pas @@ -126,6 +126,7 @@ uses UFiles, UDisplay, UIni, + UUnicodeUtils, ULog; function TScreenOptionsRecord.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; @@ -134,7 +135,7 @@ begin If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenOptionsSound.pas b/unicode/src/screens/UScreenOptionsSound.pas index 80210f63..17cef0a4 100644 --- a/unicode/src/screens/UScreenOptionsSound.pas +++ b/unicode/src/screens/UScreenOptionsSound.pas @@ -34,7 +34,13 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; + SDL, + UMenu, + UDisplay, + UMusic, + UFiles, + UIni, + UThemes; type TScreenOptionsSound = class(TMenu) @@ -47,7 +53,10 @@ type implementation -uses UGraphic, SysUtils; +uses + UGraphic, + UUnicodeUtils, + SysUtils; function TScreenOptionsSound.ParseInput(PressedKey: cardinal; CharCode: widechar; PressedDown: boolean): boolean; @@ -56,7 +65,7 @@ begin if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := False; diff --git a/unicode/src/screens/UScreenOptionsThemes.pas b/unicode/src/screens/UScreenOptionsThemes.pas index ec6fe014..07e948df 100644 --- a/unicode/src/screens/UScreenOptionsThemes.pas +++ b/unicode/src/screens/UScreenOptionsThemes.pas @@ -57,10 +57,12 @@ type implementation -uses UMain, - UGraphic, - USkins, - SysUtils; +uses + UMain, + UGraphic, + USkins, + UUnicodeUtils, + SysUtils; function TScreenOptionsThemes.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -68,7 +70,7 @@ begin If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenPartyNewRound.pas b/unicode/src/screens/UScreenPartyNewRound.pas index 01de9df7..1b83b6e4 100644 --- a/unicode/src/screens/UScreenPartyNewRound.pas +++ b/unicode/src/screens/UScreenPartyNewRound.pas @@ -34,7 +34,13 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; + SDL, + SysUtils, + UMenu, + UDisplay, + UMusic, + UFiles, + UThemes; type TScreenPartyNewRound = class(TMenu) @@ -101,15 +107,17 @@ type implementation -uses UGraphic, - UMain, - UIni, - UTexture, - UParty, - UDLLManager, - ULanguage, - USong, - ULog; +uses + UGraphic, + UMain, + UIni, + UTexture, + UParty, + UDLLManager, + ULanguage, + USong, + ULog, + UUnicodeUtils; function TScreenPartyNewRound.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -117,7 +125,7 @@ begin If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; @@ -214,7 +222,7 @@ var I: Integer; function GetTeamPlayers(const Num: Byte): String; var - Players: Array of String; + Players: array of UTF8String; //J: Byte; begin // to-do : Party if (Num-1 >= {PartySession.Teams.NumTeams}0) then diff --git a/unicode/src/screens/UScreenPartyOptions.pas b/unicode/src/screens/UScreenPartyOptions.pas index fafae0e0..9bd47836 100644 --- a/unicode/src/screens/UScreenPartyOptions.pas +++ b/unicode/src/screens/UScreenPartyOptions.pas @@ -34,7 +34,13 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; + SDL, + SysUtils, + UMenu, + UDisplay, + UMusic, + UFiles, + UThemes; type TScreenPartyOptions = class(TMenu) @@ -71,7 +77,18 @@ const implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, USong, UDLLManager, UPlaylist, USongs; +uses + UGraphic, + UMain, + UIni, + UTexture, + ULanguage, + UParty, + USong, + UDLLManager, + UPlaylist, + USongs, + UUnicodeUtils; function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; var @@ -82,7 +99,7 @@ begin If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenPartyScore.pas b/unicode/src/screens/UScreenPartyScore.pas index bd54d55e..a7ebadf5 100644 --- a/unicode/src/screens/UScreenPartyScore.pas +++ b/unicode/src/screens/UScreenPartyScore.pas @@ -34,7 +34,12 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, SysUtils, UThemes; + SDL, + SysUtils, + UMenu, + UDisplay, + UMusic, + UThemes; type TScreenPartyScore = class(TMenu) @@ -71,7 +76,15 @@ type implementation -uses UGraphic, UMain, UParty, UScreenSingModi, ULanguage, UTexture, USkins; +uses + UGraphic, + UMain, + UParty, + UScreenSingModi, + ULanguage, + UTexture, + USkins, + UUnicodeUtils; function TScreenPartyScore.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -79,7 +92,7 @@ begin If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenPartyWin.pas b/unicode/src/screens/UScreenPartyWin.pas index 6b4a55c0..6e56a1a8 100644 --- a/unicode/src/screens/UScreenPartyWin.pas +++ b/unicode/src/screens/UScreenPartyWin.pas @@ -34,7 +34,12 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, SysUtils, UThemes; + SDL, + SysUtils, + UMenu, + UDisplay, + UMusic, + UThemes; type TScreenPartyWin = class(TMenu) @@ -64,7 +69,13 @@ type implementation -uses UGraphic, UMain, UParty, UScreenSingModi, ULanguage; +uses + UGraphic, + UMain, + UParty, + UScreenSingModi, + ULanguage, + UUnicodeUtils; function TScreenPartyWin.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -72,7 +83,7 @@ begin If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenPopup.pas b/unicode/src/screens/UScreenPopup.pas index bf4752b9..8fcb7f2f 100644 --- a/unicode/src/screens/UScreenPopup.pas +++ b/unicode/src/screens/UScreenPopup.pas @@ -34,7 +34,12 @@ interface {$I switches.inc} uses - UMenu, SDL, UMusic, UFiles, SysUtils, UThemes; + SDL, + SysUtils, + UMenu, + UMusic, + UFiles, + UThemes; type TScreenPopupCheck = class(TMenu) @@ -70,7 +75,16 @@ var implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist, UDisplay; +uses + UGraphic, + UMain, + UIni, + UTexture, + ULanguage, + UParty, + UPlaylist, + UDisplay, + UUnicodeUtils; function TScreenPopupCheck.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -78,7 +92,7 @@ begin If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenScore.pas b/unicode/src/screens/UScreenScore.pas index ee94d345..c7f0d8f1 100644 --- a/unicode/src/screens/UScreenScore.pas +++ b/unicode/src/screens/UScreenScore.pas @@ -154,21 +154,23 @@ type implementation -uses UGraphic, - UScreenSong, - UMenuStatic, - UTime, - UMain, - UIni, - ULog, - ULanguage; +uses + UGraphic, + UScreenSong, + UMenuStatic, + UTime, + UMain, + UIni, + ULog, + ULanguage, + UUnicodeUtils; function TScreenScore.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin Result := true; If (PressedDown) Then begin // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenSing.pas b/unicode/src/screens/UScreenSing.pas index 5783366d..1be1371e 100644 --- a/unicode/src/screens/UScreenSing.pas +++ b/unicode/src/screens/UScreenSing.pas @@ -34,10 +34,12 @@ interface {$I switches.inc} -uses UMenu, - UMusic, +uses SDL, SysUtils, + gl, + UMenu, + UMusic, UFiles, UTime, USongs, @@ -46,7 +48,6 @@ uses UMenu, UTexture, ULyrics, TextGL, - gl, UThemes, UGraphicClasses, USingScores; @@ -119,14 +120,16 @@ type implementation -uses UGraphic, +uses + Classes, + Math, + UGraphic, UDraw, UMain, USong, - Classes, URecord, ULanguage, - Math; + UUnicodeUtils; // Method for input parsing. If False is returned, GetNextWindow // should be checked to know the next window to load; @@ -137,7 +140,7 @@ begin if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin //When not ask before Exit then Finish now diff --git a/unicode/src/screens/UScreenSong.pas b/unicode/src/screens/UScreenSong.pas index 9fc74aae..5336efe5 100644 --- a/unicode/src/screens/UScreenSong.pas +++ b/unicode/src/screens/UScreenSong.pas @@ -164,6 +164,7 @@ uses UParty, UPlaylist, UMenuButton, + UUnicodeUtils, UScreenSongMenu; // ***** Public methods ****** // @@ -247,7 +248,8 @@ var I: integer; I2: integer; SDL_ModState: Word; - Letter: WideChar; + UpperLetter: UCS4Char; + TempStr: UTF8String; begin Result := true; @@ -272,9 +274,10 @@ begin //Jump to Artist/Titel if ((SDL_ModState and KMOD_LALT <> 0) and (Mode = smNormal)) then begin - if (WideCharUpperCase(CharCode)[1] in ([WideChar('A')..WideChar('Z'), WideChar('0') .. WideChar('9')]) ) then + UpperLetter := UCS4UpperCase(WideStringToUCS4String(CharCode)[0]); + + if (UpperLetter in ([UCS4Char('A')..UCS4Char('Z'), UCS4Char('0') .. UCS4Char('9')]) ) then begin - Letter := WideCharUpperCase(CharCode)[1]; I2 := Length(CatSongs.Song); //Jump To Titel @@ -282,18 +285,21 @@ begin begin for I := 1 to high(CatSongs.Song) do begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) and - (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) and - (WideStringUpperCase(CatSongs.Song[(I + Interaction) mod I2].Title)[1] = Letter) then + if (CatSongs.Song[(I + Interaction) mod I2].Visible) then begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + TempStr := CatSongs.Song[(I + Interaction) mod I2].Title; + if (Length(TempStr) > 0) and + (UCS4UpperCase(UTF8ToUCS4String(TempStr)[0]) = UpperLetter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - AudioPlayback.PlaySound(SoundLib.Change); + AudioPlayback.PlaySound(SoundLib.Change); - ChangeMusic; - SetScroll4; - //Break and Exit - Exit; + ChangeMusic; + SetScroll4; + //Break and Exit + Exit; + end; end; end; end @@ -302,19 +308,22 @@ begin begin for I := 1 to high(CatSongs.Song) do begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) and - (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) and - (WideStringUpperCase(CatSongs.Song[(I + Interaction) mod I2].Artist)[1] = Letter) then + if (CatSongs.Song[(I + Interaction) mod I2].Visible) then begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + TempStr := CatSongs.Song[(I + Interaction) mod I2].Artist; + if (Length(TempStr) > 0) and + (UCS4UpperCase(UTF8ToUCS4String(TempStr)[0]) = UpperLetter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - AudioPlayback.PlaySound(SoundLib.Change); + AudioPlayback.PlaySound(SoundLib.Change); - ChangeMusic; - SetScroll4; + ChangeMusic; + SetScroll4; - //Break and Exit - Exit; + //Break and Exit + Exit; + end; end; end; end; @@ -324,7 +333,7 @@ begin end; // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenSongMenu.pas b/unicode/src/screens/UScreenSongMenu.pas index 6febdcab..f1008ff5 100644 --- a/unicode/src/screens/UScreenSongMenu.pas +++ b/unicode/src/screens/UScreenSongMenu.pas @@ -74,20 +74,22 @@ const SM_Party_Joker = 128 or 2; var - ISelections: Array of String; + ISelections: Array of string; SelectValue: Integer; implementation -uses UGraphic, - UMain, - UIni, - UTexture, - ULanguage, - UParty, - UPlaylist, - USongs; +uses + UGraphic, + UMain, + UIni, + UTexture, + ULanguage, + UParty, + UPlaylist, + USongs, + UUnicodeUtils; function TScreenSongMenu.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -97,7 +99,7 @@ begin if (CurMenu = SM_Playlist_New) AND (Interaction=0) then begin // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of '0'..'9', 'A'..'Z', ' ', '-', '_', '!', ',', '<', '/', '*', '?', '''', '"': begin Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + CharCode; @@ -116,7 +118,7 @@ begin end; // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenStatDetail.pas b/unicode/src/screens/UScreenStatDetail.pas index 20b89b33..ffc5152c 100644 --- a/unicode/src/screens/UScreenStatDetail.pas +++ b/unicode/src/screens/UScreenStatDetail.pas @@ -67,11 +67,12 @@ type implementation uses - UGraphic, - ULanguage, Math, Classes, - ULog; + UGraphic, + ULanguage, + ULog, + UUnicodeUtils; function TScreenStatDetail.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -79,7 +80,7 @@ begin If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenStatMain.pas b/unicode/src/screens/UScreenStatMain.pas index a6f67cab..c9bff348 100644 --- a/unicode/src/screens/UScreenStatMain.pas +++ b/unicode/src/screens/UScreenStatMain.pas @@ -62,19 +62,16 @@ type implementation -uses UGraphic, - UDataBase, - USongs, - USong, - ULanguage, - UCommon, - Classes, - {$IFDEF win32} - windows, - {$ELSE} - sysconst, - {$ENDIF} - ULog; +uses + UGraphic, + UDataBase, + USongs, + USong, + ULanguage, + UCommon, + Classes, + ULog, + UUnicodeUtils; function TScreenStatMain.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -82,7 +79,7 @@ begin If (PressedDown) Then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; diff --git a/unicode/src/screens/UScreenTop5.pas b/unicode/src/screens/UScreenTop5.pas index cf5ee257..dede9a35 100644 --- a/unicode/src/screens/UScreenTop5.pas +++ b/unicode/src/screens/UScreenTop5.pas @@ -34,7 +34,13 @@ interface {$I switches.inc} uses - UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes; + SDL, + SysUtils, + UMenu, + UDisplay, + UMusic, + USongs, + UThemes; type TScreenTop5 = class(TMenu) @@ -56,14 +62,19 @@ type implementation -uses UGraphic, UDataBase, UMain, UIni; +uses + UGraphic, + UDataBase, + UMain, + UIni, + UUnicodeUtils; function TScreenTop5.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin Result := true; If (PressedDown) Then begin // check normal keys - case WideCharUpperCase(CharCode)[1] of + case WideStringUpperCase(CharCode)[1] of 'Q': begin Result := false; @@ -126,7 +137,8 @@ begin //ReadScore(CurrentSong); PMax := Ini.Players; - if PMax = 4 then PMax := 5; + if PMax = 4 then + PMax := 5; for I := 0 to PMax do DataBase.AddScore(CurrentSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalInt)); -- cgit v1.2.3