From 006a27598cfdf1ceafdcc938c781a217119ab6e2 Mon Sep 17 00:00:00 2001 From: barbeque-squared Date: Sat, 2 Dec 2023 11:59:50 +0100 Subject: [PATCH] proof of concept to fix SDL double input --- src/base/UMain.pas | 21 +++++++- src/screens/UScreenAbout.pas | 6 +-- src/screens/UScreenCredits.pas | 4 +- src/screens/UScreenEdit.pas | 4 +- src/screens/UScreenEditConvert.pas | 4 +- src/screens/UScreenEditSub.pas | 54 +++++++++++++------ src/screens/UScreenJukebox.pas | 18 +++---- src/screens/UScreenJukeboxPlaylist.pas | 4 +- src/screens/UScreenLevel.pas | 4 +- src/screens/UScreenMain.pas | 22 ++++---- src/screens/UScreenName.pas | 9 +++- src/screens/UScreenOptions.pas | 26 ++++----- src/screens/UScreenOptionsAdvanced.pas | 4 +- src/screens/UScreenOptionsGame.pas | 4 +- src/screens/UScreenOptionsGraphics.pas | 4 +- src/screens/UScreenOptionsInput.pas | 4 +- src/screens/UScreenOptionsJukebox.pas | 4 +- src/screens/UScreenOptionsLyrics.pas | 4 +- src/screens/UScreenOptionsRecord.pas | 10 ++-- src/screens/UScreenOptionsSound.pas | 4 +- src/screens/UScreenOptionsThemes.pas | 4 +- src/screens/UScreenOptionsWebcam.pas | 4 +- src/screens/UScreenPartyNewRound.pas | 4 +- src/screens/UScreenPartyOptions.pas | 4 +- src/screens/UScreenPartyPlayer.pas | 4 +- src/screens/UScreenPartyRounds.pas | 4 +- src/screens/UScreenPartyScore.pas | 4 +- src/screens/UScreenPartyTournamentOptions.pas | 4 +- src/screens/UScreenPartyTournamentPlayer.pas | 4 +- src/screens/UScreenPartyTournamentRounds.pas | 4 +- src/screens/UScreenPartyTournamentWin.pas | 4 +- src/screens/UScreenPartyWin.pas | 4 +- src/screens/UScreenScore.pas | 4 +- src/screens/UScreenSong.pas | 22 ++++---- src/screens/UScreenSongJumpto.pas | 1 + src/screens/UScreenSongMenu.pas | 4 +- src/screens/UScreenStatDetail.pas | 4 +- src/screens/UScreenStatMain.pas | 4 +- src/screens/UScreenTop5.pas | 4 +- .../controllers/UScreenSingController.pas | 28 +++++----- 40 files changed, 189 insertions(+), 144 deletions(-) diff --git a/src/base/UMain.pas b/src/base/UMain.pas index 8ef2a2d45..08ea4aae0 100644 --- a/src/base/UMain.pas +++ b/src/base/UMain.pas @@ -45,6 +45,9 @@ interface procedure Main; procedure MainLoop; procedure CheckEvents; +procedure StartTextInput; +procedure StopTextInput; +procedure SetTextInput(enabled: boolean); type TMainThreadExecProc = procedure(Data: Pointer); @@ -299,6 +302,21 @@ procedure Main; {$ENDIF} end; +procedure StartTextInput; +begin + SDL_StartTextInput; +end; + +procedure StopTextInput; +begin + SDL_StopTextInput; +end; + +procedure SetTextInput(enabled: boolean); +begin + if enabled then StartTextInput else StopTextInput; +end; + procedure MainLoop; var Delay: integer; @@ -309,7 +327,8 @@ procedure MainLoop; I,J: Integer; begin Max_FPS := Ini.MaxFramerateGet; - SDL_StartTextInput; + // need to explicitly stop this because it appears to be started by default + SDL_StopTextInput; Done := false; J := 1; CountSkipTime(); diff --git a/src/screens/UScreenAbout.pas b/src/screens/UScreenAbout.pas index 402e340f1..584d99d98 100644 --- a/src/screens/UScreenAbout.pas +++ b/src/screens/UScreenAbout.pas @@ -77,14 +77,14 @@ function TScreenAbout.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Press if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('C'): + case PressedKey of + SDLK_C: begin FadeTo(@ScreenCredits, SoundLib.Start); Exit; end; - Ord('Q'): + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index b567c62aa..9db1102f7 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -268,8 +268,8 @@ function TScreenCredits.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenEdit.pas b/src/screens/UScreenEdit.pas index cbc741ec5..9725812d1 100644 --- a/src/screens/UScreenEdit.pas +++ b/src/screens/UScreenEdit.pas @@ -77,8 +77,8 @@ function TScreenEdit.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Presse if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas index c65de3cc7..ba444e6c0 100644 --- a/src/screens/UScreenEditConvert.pas +++ b/src/screens/UScreenEditConvert.pas @@ -229,8 +229,8 @@ function TScreenEditConvert.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 83a92b1a0..53f3329f8 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -39,6 +39,7 @@ interface UFilesystem, UGraphicClasses, UIni, + UMain, UMenu, UMenuText, UMusic, @@ -497,14 +498,14 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre if (PressedDown) then // Key Down begin // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; end; { - Ord('S'): + SDLK_S: begin if SDL_ModState = KMOD_LSHIFT then begin @@ -536,7 +537,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre end; } - Ord('S'): + SDLK_S: begin // handle medley tags first if CurrentSong.isDuet then @@ -608,7 +609,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre end; // set PreviewStart tag - Ord('I'): + SDLK_I: begin CopyToUndo; if SDL_ModState and KMOD_SHIFT <> 0 then @@ -699,7 +700,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre end; // set Medley tags - Ord('A'): + SDLK_A: begin CopyToUndo; if CurrentSong.Relative then @@ -798,7 +799,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre end; // jump to Medley tags - Ord('J'): + SDLK_J: begin if CurrentSong.Relative then begin @@ -894,7 +895,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre Exit; end; - Ord('R'): //reload + SDLK_R: //reload begin AudioPlayback.Stop; {$IFDEF UseMIDIPort} @@ -906,7 +907,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre Text[TextInfo].Text := Language.Translate('EDIT_INFO_SONG_RELOADED'); end; - Ord('D'): + SDLK_D: begin // Divide lengths by 2 if (SDL_ModState = KMOD_LSHIFT) then @@ -935,7 +936,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre end; end; - Ord('M'): + SDLK_M: begin // Multiply lengths by 2 if (SDL_ModState = KMOD_LSHIFT) then @@ -948,7 +949,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre end; end; - Ord('C'): + SDLK_C: begin // Capitalize letter at the beginning of line if SDL_ModState = 0 then @@ -978,7 +979,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre Exit; end; - Ord('V'): + SDLK_V: begin if (SDL_ModState = 0) or (SDL_ModState = KMOD_LALT) then // play current line/remainder of song with video begin @@ -1047,7 +1048,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre ShowInteractiveBackground; end; - Ord('T'): + SDLK_T: begin // Fixes timings between sentences CopyToUndo; @@ -1056,7 +1057,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre Exit; end; - Ord('P'): + SDLK_P: begin if SDL_ModState = 0 then begin @@ -1118,7 +1119,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre end; // Golden Note - Ord('G'): + SDLK_G: begin CopyToUndo; if (Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].NoteType = ntGolden) then @@ -1141,7 +1142,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre end; // Freestyle Note - Ord('F'): + SDLK_F: begin CopyToUndo; if (Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].NoteType = ntFreestyle) then @@ -1168,7 +1169,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre end; // undo - Ord('Z'): + SDLK_Z: begin if SDL_ModState = KMOD_LCTRL then begin @@ -1468,6 +1469,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre TextPosition := LengthUTF8(BackupEditText); editLengthText := LengthUTF8(BackupEditText); TextEditMode := true; + StartTextInput; end; SDLK_F5: @@ -1479,6 +1481,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre TextPosition := LengthUTF8(BackupEditText); editLengthText := LengthUTF8(BackupEditText); BPMEditMode := true; + StartTextInput; end; SDLK_SPACE: @@ -1533,6 +1536,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre CurrentSlideId := TitleSlideId; TextPosition := LengthUTF8(BackupEditText); TitleEditMode := true; + StartTextInput; end; if Interaction = ArtistSlideId then @@ -1543,6 +1547,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre CurrentSlideId := ArtistSlideId; TextPosition := LengthUTF8(BackupEditText); ArtistEditMode := true; + StartTextInput; end; if Interaction = LanguageSlideId then @@ -1553,6 +1558,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre CurrentSlideId := LanguageSlideId; TextPosition := LengthUTF8(BackupEditText); LanguageEditMode := true; + StartTextInput; end; if Interaction = EditionSlideId then @@ -1563,6 +1569,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre CurrentSlideId := EditionSlideId; TextPosition := LengthUTF8(BackupEditText); EditionEditMode := true; + StartTextInput; end; if Interaction = GenreSlideId then @@ -1573,6 +1580,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre CurrentSlideId := GenreSlideId; TextPosition := LengthUTF8(BackupEditText); GenreEditMode := true; + StartTextInput; end; if Interaction = YearSlideId then @@ -1583,6 +1591,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre CurrentSlideId := YearSlideId; TextPosition := LengthUTF8(BackupEditText); YearEditMode := true; + StartTextInput; end; if Interaction = CreatorSlideId then @@ -1593,6 +1602,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre CurrentSlideId := CreatorSlideId; TextPosition := LengthUTF8(BackupEditText); CreatorEditMode := true; + StartTextInput; end; // Interaction = 7 // Mp3SlideId @@ -1609,6 +1619,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre CurrentSlideId := BPMSlideId; TextPosition := LengthUTF8(BackupEditText); BPMEditMode := true; + StartTextInput; end; // Interaction = 13 // GAPSlideId @@ -1625,6 +1636,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre CurrentSlideId := MedleyStartSlideId; TextPosition := LengthUTF8(BackupEditText); P1EditMode := true; + StartTextInput; end; if Interaction = MedleyEndSlideId then @@ -1635,6 +1647,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre CurrentSlideId := MedleyEndSlideId; TextPosition := LengthUTF8(BackupEditText); P2EditMode := true; + StartTextInput; end; // Interaction = 20 // StartSlideId @@ -1649,6 +1662,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre CurrentSlideId := LyricSlideId; TextPosition := LengthUTF8(BackupEditText); TextEditMode := true; + StartTextInput; end; if Interaction = 24 then // UndoButtonId @@ -2230,6 +2244,7 @@ function TScreenEditSub.ParseInputEditText(PressedKey: cardinal; CharCode: UCS4C CreatorEditMode := false; P1EditMode := false; P2EditMode := false; + StopTextInput; editLengthText := 0; TextPosition := -1; end; @@ -2349,6 +2364,7 @@ function TScreenEditSub.ParseInputEditText(PressedKey: cardinal; CharCode: UCS4C P1EditMode := false; P2EditMode := false; TextEditMode := false; + StopTextInput; editLengthText := 0; TextPosition := -1; CurrentSlideId := -1; @@ -2408,6 +2424,7 @@ function TScreenEditSub.ParseInputEditText(PressedKey: cardinal; CharCode: UCS4C // divide note DivideNote(false); TextEditMode := false; + StopTextInput; EditorLyrics[CurrentTrack].AddLine(CurrentTrack, Tracks[CurrentTrack].CurrentLine); EditorLyrics[CurrentTrack].Selected := CurrentNote[CurrentTrack]; GoldenRec.KillAll; @@ -2449,6 +2466,7 @@ function TScreenEditSub.ParseInputEditBPM(PressedKey: cardinal; CharCode: UCS4Ch // exit BPM edit mode, restore previous BPM value SelectsS[CurrentSlideId].TextOpt[0].Text := FloatToStr(CurrentSong.BPM[0].BPM / 4); BPMEditMode := false; + StopTextInput; editLengthText := 0; TextPosition := -1; end; @@ -2472,6 +2490,7 @@ function TScreenEditSub.ParseInputEditBPM(PressedKey: cardinal; CharCode: UCS4Ch end; BPMEditMode := false; + StopTextInput; editLengthText := 0; TextPosition := -1; CurrentSlideId := -1; @@ -5000,6 +5019,7 @@ procedure TScreenEditSub.OnShow; P1EditMode := false; P2EditMode := false; BPMEditMode := false; + StopTextInput; editLengthText := 0; TextPosition := -1; diff --git a/src/screens/UScreenJukebox.pas b/src/screens/UScreenJukebox.pas index 3149c4dff..30649dacd 100644 --- a/src/screens/UScreenJukebox.pas +++ b/src/screens/UScreenJukebox.pas @@ -1371,8 +1371,8 @@ function TScreenJukebox.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; end else begin - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin // when not ask before exit then finish now if (Ini.AskbeforeDel <> 1) then @@ -1386,7 +1386,7 @@ function TScreenJukebox.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; end; // show visualization - Ord('V'): + SDLK_V: begin if fShowWebcam then begin @@ -1431,7 +1431,7 @@ function TScreenJukebox.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; end; // show Webcam - Ord('W'): + SDLK_W: begin if (fShowWebCam = false) then begin @@ -1461,7 +1461,7 @@ function TScreenJukebox.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; end; // allow search for songs - Ord('J'): + SDLK_J: begin if (SongListVisible) then begin @@ -1490,7 +1490,7 @@ function TScreenJukebox.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; end; // skip intro - Ord('S'): + SDLK_S: begin if (AudioPlayback.Position < CurrentSong.gap / 1000 - 6) then begin @@ -1502,13 +1502,13 @@ function TScreenJukebox.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; end; // pause - Ord('P'): + SDLK_P: begin Pause; Exit; end; - Ord('R'): + SDLK_R: begin if (SongListVisible) then begin @@ -1517,7 +1517,7 @@ function TScreenJukebox.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; end; // toggle time display - Ord('T'): + SDLK_T: begin LastTick := SDL_GetTicks(); diff --git a/src/screens/UScreenJukeboxPlaylist.pas b/src/screens/UScreenJukeboxPlaylist.pas index 16c3bb32c..8cb3338e7 100644 --- a/src/screens/UScreenJukeboxPlaylist.pas +++ b/src/screens/UScreenJukeboxPlaylist.pas @@ -93,8 +93,8 @@ function TScreenJukeboxPlaylist.ParseInput(PressedKey: cardinal; CharCode: UCS4C if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenLevel.pas b/src/screens/UScreenLevel.pas index df404b25f..b9cee9e7a 100644 --- a/src/screens/UScreenLevel.pas +++ b/src/screens/UScreenLevel.pas @@ -72,8 +72,8 @@ function TScreenLevel.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Press if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 8a05eae56..43eaccbac 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -97,13 +97,13 @@ function TScreenMain.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('S'): begin + case PressedKey of + SDLK_S: begin FadeTo(@ScreenName, SoundLib.Start); Exit; end; - Ord('P'): begin + SDLK_P: begin if (Ini.Players >= 1) and (Party.ModesAvailable) then begin FadeTo(@ScreenPartyOptions, SoundLib.Start); @@ -111,43 +111,43 @@ function TScreenMain.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; end; end; - Ord('J'): begin + SDLK_J: begin FadeTo(@ScreenJukeboxPlaylist, SoundLib.Start); Exit; end; - Ord('R'): begin + SDLK_R: begin UGraphic.UnLoadScreens(); Theme.LoadTheme(Ini.Theme, Ini.Color); UGraphic.LoadScreens(USDXVersionStr); end; - Ord('T'): begin + SDLK_T: begin FadeTo(@ScreenStatMain, SoundLib.Start); Exit; end; - Ord('E'): begin + SDLK_E: begin FadeTo(@ScreenEdit, SoundLib.Start); Exit; end; - Ord('O'): begin + SDLK_O: begin FadeTo(@ScreenOptions, SoundLib.Start); Exit; end; - Ord('A'): begin + SDLK_A: begin FadeTo(@ScreenAbout, SoundLib.Start); Exit; end; - Ord('C'): begin + SDLK_C: begin FadeTo(@ScreenCredits, SoundLib.Start); Exit; end; - Ord('Q'): begin + SDLK_Q: begin Result := false; Exit; end; diff --git a/src/screens/UScreenName.pas b/src/screens/UScreenName.pas index a049860e6..e501ac20e 100644 --- a/src/screens/UScreenName.pas +++ b/src/screens/UScreenName.pas @@ -131,6 +131,7 @@ implementation UHelp, ULanguage, ULog, + UMain, UMenuButton, UPath, USkins, @@ -294,8 +295,8 @@ function TScreenName.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Presse if (not Button[PlayerName].Selected) then begin // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; @@ -347,6 +348,7 @@ function TScreenName.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Presse SDLK_ESCAPE : begin + StopTextInput; Ini.SaveNames; AudioPlayback.PlaySound(SoundLib.Back); if GoTo_SingScreen then @@ -357,6 +359,7 @@ function TScreenName.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Presse SDLK_RETURN: begin + StopTextInput; Ini.Players := CountIndex; PlayersPlay:= UIni.IPlayersVals[CountIndex]; @@ -427,11 +430,13 @@ function TScreenName.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Presse SDLK_DOWN: begin InteractNext; + SetTextInput(Button[PlayerName].Selected); end; SDLK_UP: begin InteractPrev; + SetTextInput(Button[PlayerName].Selected); end; SDLK_RIGHT: diff --git a/src/screens/UScreenOptions.pas b/src/screens/UScreenOptions.pas index 236c05f69..cd2e5ceeb 100644 --- a/src/screens/UScreenOptions.pas +++ b/src/screens/UScreenOptions.pas @@ -93,56 +93,56 @@ function TScreenOptions.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('G'): + case PressedKey of + SDLK_G: begin FadeTo(@ScreenOptionsGame, SoundLib.Start); Exit; end; - Ord('H'): + SDLK_H: begin FadeTo(@ScreenOptionsGraphics, SoundLib.Start); Exit; end; - Ord('S'): + SDLK_S: begin FadeTo(@ScreenOptionsSound, SoundLib.Start); Exit; end; - Ord('I'): + SDLK_I: begin FadeTo(@ScreenOptionsInput, SoundLib.Start); Exit; end; - Ord('L'): + SDLK_L: begin FadeTo(@ScreenOptionsLyrics, SoundLib.Start); Exit; end; - Ord('T'): + SDLK_T: begin FadeTo(@ScreenOptionsThemes, SoundLib.Start); Exit; end; - Ord('R'): + SDLK_R: begin FadeTo(@ScreenOptionsRecord, SoundLib.Start); Exit; end; - Ord('A'): + SDLK_A: begin FadeTo(@ScreenOptionsAdvanced, SoundLib.Start); Exit; end; - Ord('N'): + SDLK_N: begin if (High(DataBase.NetworkUser) = -1) then ScreenPopupError.ShowPopup(Language.Translate('SING_OPTIONS_NETWORK_NO_DLL')) @@ -154,19 +154,19 @@ function TScreenOptions.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre Exit; end; - Ord('W'): + SDLK_W: begin FadeTo(@ScreenOptionsWebcam, SoundLib.Start); Exit; end; - Ord('J'): + SDLK_J: begin FadeTo(@ScreenOptionsJukebox, SoundLib.Start); Exit; end; - Ord('Q'): + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenOptionsAdvanced.pas b/src/screens/UScreenOptionsAdvanced.pas index 61c57291d..2c6d6aa16 100644 --- a/src/screens/UScreenOptionsAdvanced.pas +++ b/src/screens/UScreenOptionsAdvanced.pas @@ -68,8 +68,8 @@ function TScreenOptionsAdvanced.ParseInput(PressedKey: cardinal; CharCode: UCS4C if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenOptionsGame.pas b/src/screens/UScreenOptionsGame.pas index e4b6cf420..b4abaf49d 100644 --- a/src/screens/UScreenOptionsGame.pas +++ b/src/screens/UScreenOptionsGame.pas @@ -92,8 +92,8 @@ function TScreenOptionsGame.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; if PressedDown then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenOptionsGraphics.pas b/src/screens/UScreenOptionsGraphics.pas index 2491353f0..7c8c6b0ac 100644 --- a/src/screens/UScreenOptionsGraphics.pas +++ b/src/screens/UScreenOptionsGraphics.pas @@ -82,8 +82,8 @@ function TScreenOptionsGraphics.ParseInput(PressedKey: cardinal; CharCode: UCS4C if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenOptionsInput.pas b/src/screens/UScreenOptionsInput.pas index 648b592b7..f404cb66e 100644 --- a/src/screens/UScreenOptionsInput.pas +++ b/src/screens/UScreenOptionsInput.pas @@ -92,8 +92,8 @@ function TScreenOptionsInput.ParseInput(PressedKey: cardinal; CharCode: UCS4Char if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenOptionsJukebox.pas b/src/screens/UScreenOptionsJukebox.pas index 67fae16f5..7fc1c6686 100644 --- a/src/screens/UScreenOptionsJukebox.pas +++ b/src/screens/UScreenOptionsJukebox.pas @@ -128,8 +128,8 @@ function TScreenOptionsJukebox.ParseInput(PressedKey: cardinal; CharCode: UCS4Ch if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenOptionsLyrics.pas b/src/screens/UScreenOptionsLyrics.pas index ca307ef11..f699dc4c9 100644 --- a/src/screens/UScreenOptionsLyrics.pas +++ b/src/screens/UScreenOptionsLyrics.pas @@ -77,8 +77,8 @@ function TScreenOptionsLyrics.ParseInput(PressedKey: cardinal; CharCode: UCS4Cha if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas index d8285e542..f3c6690d7 100644 --- a/src/screens/UScreenOptionsRecord.pas +++ b/src/screens/UScreenOptionsRecord.pas @@ -139,25 +139,25 @@ function TScreenOptionsRecord.ParseInput(PressedKey: cardinal; CharCode: UCS4Cha if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; end; - Ord('+'): + SDLK_PLUS: begin // FIXME: add a nice volume-slider instead // or at least provide visualization and acceleration if the user holds the key pressed. ChangeVolume(0.02); end; - Ord('-'): + SDLK_MINUS: begin // FIXME: add a nice volume-slider instead // or at least provide visualization and acceleration if the user holds the key pressed. ChangeVolume(-0.02); end; - Ord('T'): + SDLK_T: begin if ((SDL_GetModState() and KMOD_SHIFT) <> 0) then Ini.ThresholdIndex := (Ini.ThresholdIndex + Length(IThresholdVals) - 1) mod Length(IThresholdVals) diff --git a/src/screens/UScreenOptionsSound.pas b/src/screens/UScreenOptionsSound.pas index 068c79f05..072618388 100644 --- a/src/screens/UScreenOptionsSound.pas +++ b/src/screens/UScreenOptionsSound.pas @@ -70,8 +70,8 @@ function TScreenOptionsSound.ParseInput(PressedKey: cardinal; if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenOptionsThemes.pas b/src/screens/UScreenOptionsThemes.pas index fb8b4780a..20f4c67c8 100644 --- a/src/screens/UScreenOptionsThemes.pas +++ b/src/screens/UScreenOptionsThemes.pas @@ -84,8 +84,8 @@ function TScreenOptionsThemes.ParseInput(PressedKey: cardinal; CharCode: UCS4Cha if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenOptionsWebcam.pas b/src/screens/UScreenOptionsWebcam.pas index 3e792a9dd..6ed3aee61 100644 --- a/src/screens/UScreenOptionsWebcam.pas +++ b/src/screens/UScreenOptionsWebcam.pas @@ -85,8 +85,8 @@ function TScreenOptionsWebcam.ParseInput(PressedKey: cardinal; CharCode: UCS4Cha if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin if (PreVisualization) then Webcam.Release; Result := false; diff --git a/src/screens/UScreenPartyNewRound.pas b/src/screens/UScreenPartyNewRound.pas index 396f75a18..30bf6a6c0 100644 --- a/src/screens/UScreenPartyNewRound.pas +++ b/src/screens/UScreenPartyNewRound.pas @@ -113,8 +113,8 @@ function TScreenPartyNewRound.ParseInput(PressedKey: cardinal; CharCode: UCS4Cha if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenPartyOptions.pas b/src/screens/UScreenPartyOptions.pas index 69ae0469d..8db5b12b8 100644 --- a/src/screens/UScreenPartyOptions.pas +++ b/src/screens/UScreenPartyOptions.pas @@ -103,8 +103,8 @@ function TScreenPartyOptions.ParseInput(PressedKey: cardinal; CharCode: UCS4Char if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenPartyPlayer.pas b/src/screens/UScreenPartyPlayer.pas index a75146921..451c4359b 100644 --- a/src/screens/UScreenPartyPlayer.pas +++ b/src/screens/UScreenPartyPlayer.pas @@ -316,8 +316,8 @@ function TScreenPartyPlayer.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; else begin // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenPartyRounds.pas b/src/screens/UScreenPartyRounds.pas index 60d9e1b23..71ecb700e 100644 --- a/src/screens/UScreenPartyRounds.pas +++ b/src/screens/UScreenPartyRounds.pas @@ -172,8 +172,8 @@ function TScreenPartyRounds.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenPartyScore.pas b/src/screens/UScreenPartyScore.pas index 3f0a13059..ffb9cbff5 100644 --- a/src/screens/UScreenPartyScore.pas +++ b/src/screens/UScreenPartyScore.pas @@ -98,8 +98,8 @@ function TScreenPartyScore.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenPartyTournamentOptions.pas b/src/screens/UScreenPartyTournamentOptions.pas index b8cc25ecf..d45f48954 100644 --- a/src/screens/UScreenPartyTournamentOptions.pas +++ b/src/screens/UScreenPartyTournamentOptions.pas @@ -108,8 +108,8 @@ function TScreenPartyTournamentOptions.ParseInput(PressedKey: cardinal; CharCode if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenPartyTournamentPlayer.pas b/src/screens/UScreenPartyTournamentPlayer.pas index 0f0fee319..4c4c21833 100644 --- a/src/screens/UScreenPartyTournamentPlayer.pas +++ b/src/screens/UScreenPartyTournamentPlayer.pas @@ -333,8 +333,8 @@ function TScreenPartyTournamentPlayer.ParseInput(PressedKey: cardinal; CharCode: else begin // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenPartyTournamentRounds.pas b/src/screens/UScreenPartyTournamentRounds.pas index 2a5e04dc6..8ad8eddd9 100644 --- a/src/screens/UScreenPartyTournamentRounds.pas +++ b/src/screens/UScreenPartyTournamentRounds.pas @@ -148,8 +148,8 @@ function TScreenPartyTournamentRounds.ParseInput(PressedKey: cardinal; CharCode: if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenPartyTournamentWin.pas b/src/screens/UScreenPartyTournamentWin.pas index bfbc02486..8168af0dd 100644 --- a/src/screens/UScreenPartyTournamentWin.pas +++ b/src/screens/UScreenPartyTournamentWin.pas @@ -84,8 +84,8 @@ function TScreenPartyTournamentWin.ParseInput(PressedKey: cardinal; CharCode: UC if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenPartyWin.pas b/src/screens/UScreenPartyWin.pas index 184047627..0660db32d 100644 --- a/src/screens/UScreenPartyWin.pas +++ b/src/screens/UScreenPartyWin.pas @@ -87,8 +87,8 @@ function TScreenPartyWin.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pr if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenScore.pas b/src/screens/UScreenScore.pas index e2fd2c24b..42821819d 100644 --- a/src/screens/UScreenScore.pas +++ b/src/screens/UScreenScore.pas @@ -364,8 +364,8 @@ function TScreenScore.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Press if (PressedDown) then begin // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 6154e50c5..dcb7761c2 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -778,14 +778,14 @@ function TScreenSong.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Presse // ********************** // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; end; - Ord('F'): + SDLK_F: begin if (Mode = smNormal) and (SDL_ModState = KMOD_LSHIFT) and MakeMedley then begin @@ -805,7 +805,7 @@ function TScreenSong.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Presse end; end; - Ord('M'): //Show SongMenu + SDLK_M: //Show SongMenu begin if (Songs.SongList.Count > 0) then begin @@ -862,7 +862,7 @@ function TScreenSong.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Presse Exit; end; - Ord('P'): //Show Playlist Menu + SDLK_P: //Show Playlist Menu begin if (Songs.SongList.Count > 0) and (FreeListMode) then begin @@ -872,7 +872,7 @@ function TScreenSong.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Presse Exit; end; - Ord('J'): //Show Jumpto Menu + SDLK_J: //Show Jumpto Menu begin if (Songs.SongList.Count > 0) and (FreeListMode) then begin @@ -881,13 +881,13 @@ function TScreenSong.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Presse Exit; end; - Ord('E'): + SDLK_E: begin OpenEditor; Exit; end; - Ord('S'): + SDLK_S: begin if not (SDL_ModState = KMOD_LSHIFT) and (CatSongs.Song[Interaction].Medley.Source>=msTag) and not MakeMedley and (Mode = smNormal) then @@ -898,7 +898,7 @@ function TScreenSong.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Presse StartMedley(0, msCalculated); end; - Ord('D'): + SDLK_D: begin if not (SDL_ModState = KMOD_LSHIFT) and (Mode = smNormal) and (Length(getVisibleMedleyArr(msTag)) > 0) and not MakeMedley then @@ -908,7 +908,7 @@ function TScreenSong.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Presse StartMedley(5, msCalculated); end; - Ord('R'): + SDLK_R: begin Randomize; if (Songs.SongList.Count > 0) and @@ -987,7 +987,7 @@ function TScreenSong.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Presse Exit; end; - Ord('W'): + SDLK_W: begin if not CatSongs.Song[Interaction].Main then diff --git a/src/screens/UScreenSongJumpto.pas b/src/screens/UScreenSongJumpto.pas index f6fd817a4..dc758b814 100644 --- a/src/screens/UScreenSongJumpto.pas +++ b/src/screens/UScreenSongJumpto.pas @@ -196,6 +196,7 @@ procedure TScreenSongJumpto.SetVisible(Value: boolean); if (fVisible = false) and (Value = true) then OnShow; + SetTextInput(Value); fVisible := Value; end; diff --git a/src/screens/UScreenSongMenu.pas b/src/screens/UScreenSongMenu.pas index 785ca6d49..5808be93f 100644 --- a/src/screens/UScreenSongMenu.pas +++ b/src/screens/UScreenSongMenu.pas @@ -143,8 +143,8 @@ function TScreenSongMenu.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pr end; // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenStatDetail.pas b/src/screens/UScreenStatDetail.pas index 2fe742865..2e84787e1 100644 --- a/src/screens/UScreenStatDetail.pas +++ b/src/screens/UScreenStatDetail.pas @@ -83,8 +83,8 @@ function TScreenStatDetail.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenStatMain.pas b/src/screens/UScreenStatMain.pas index 17be298df..8c016b2c0 100644 --- a/src/screens/UScreenStatMain.pas +++ b/src/screens/UScreenStatMain.pas @@ -83,8 +83,8 @@ function TScreenStatMain.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pr if (PressedDown) then begin // Key Down // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/UScreenTop5.pas b/src/screens/UScreenTop5.pas index d63b85787..b8612a0d2 100644 --- a/src/screens/UScreenTop5.pas +++ b/src/screens/UScreenTop5.pas @@ -86,8 +86,8 @@ function TScreenTop5.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Presse if PressedDown then begin // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; diff --git a/src/screens/controllers/UScreenSingController.pas b/src/screens/controllers/UScreenSingController.pas index 79be24b28..6164fb9d7 100644 --- a/src/screens/controllers/UScreenSingController.pas +++ b/src/screens/controllers/UScreenSingController.pas @@ -234,8 +234,8 @@ function TScreenSingController.ParseInput(PressedKey: Cardinal; CharCode: UCS4Ch + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin // when not ask before exit then finish now if (Ini.AskbeforeDel <> 1) then @@ -249,7 +249,7 @@ function TScreenSingController.ParseInput(PressedKey: Cardinal; CharCode: UCS4Ch end; //Restart and pause song - Ord('R'): + SDLK_R: begin if ScreenSong.Mode = smMedley then Exit; for i1 := 0 to High(Player) do @@ -289,7 +289,7 @@ function TScreenSingController.ParseInput(PressedKey: Cardinal; CharCode: UCS4Ch end; // show visualization - Ord('V'): + SDLK_V: begin if fShowWebcam then begin @@ -334,7 +334,7 @@ function TScreenSingController.ParseInput(PressedKey: Cardinal; CharCode: UCS4Ch end; // show Webcam - Ord('W'): + SDLK_W: begin if (fShowWebCam = false) then begin @@ -364,14 +364,14 @@ function TScreenSingController.ParseInput(PressedKey: Cardinal; CharCode: UCS4Ch end; // pause - Ord('P'): + SDLK_P: begin Pause; Exit; end; // toggle time display: running time/remaining time/total time / SHIFT: show/hide time bar - Ord('T'): + SDLK_T: begin if (SDL_ModState = KMOD_LSHIFT) then begin @@ -395,7 +395,7 @@ function TScreenSingController.ParseInput(PressedKey: Cardinal; CharCode: UCS4Ch end; // skip intro / SHIFT: show/hide score display - Ord('S'): + SDLK_S: begin if (SDL_ModState = KMOD_LSHIFT) then begin @@ -420,7 +420,7 @@ function TScreenSingController.ParseInput(PressedKey: Cardinal; CharCode: UCS4Ch end; // SHIFT: show/hide oscilloscope - Ord('O'): + SDLK_O: begin if (SDL_ModState = KMOD_LSHIFT) then begin @@ -433,7 +433,7 @@ function TScreenSingController.ParseInput(PressedKey: Cardinal; CharCode: UCS4Ch end; // SHIFT: show/hide notes - Ord('N'): + SDLK_N: begin if (SDL_ModState = KMOD_LSHIFT) then begin @@ -446,7 +446,7 @@ function TScreenSingController.ParseInput(PressedKey: Cardinal; CharCode: UCS4Ch end; // SHIFT: show/hide notes - Ord('L'): + SDLK_L: begin if (SDL_ModState = KMOD_LSHIFT) then begin @@ -459,7 +459,7 @@ function TScreenSingController.ParseInput(PressedKey: Cardinal; CharCode: UCS4Ch end; // SHIFT: show/hide avatars and player names - Ord('A'): + SDLK_A: begin if (SDL_ModState = KMOD_LSHIFT) then begin @@ -480,7 +480,7 @@ function TScreenSingController.ParseInput(PressedKey: Cardinal; CharCode: UCS4Ch end; // SHIFT: show/hide microphone input/sung notes - Ord('I'): + SDLK_I: begin if (SDL_ModState = KMOD_LSHIFT) then begin @@ -493,7 +493,7 @@ function TScreenSingController.ParseInput(PressedKey: Cardinal; CharCode: UCS4Ch end; // SHIFT: show/hide (toggle) all display elements - Ord('H'): + SDLK_H: begin if (SDL_ModState = KMOD_LSHIFT) then begin