diff options
Diffstat (limited to '')
-rw-r--r-- | unicode/src/base/UGraphic.pas | 4 | ||||
-rw-r--r-- | unicode/src/base/UMain.pas | 4 | ||||
-rw-r--r-- | unicode/src/menu/UDisplay.pas | 7 | ||||
-rw-r--r-- | unicode/src/screens/UScreenEditSub.pas | 2 | ||||
-rw-r--r-- | unicode/src/screens/UScreenMain.pas | 4 | ||||
-rw-r--r-- | unicode/src/screens/UScreenOpen.pas | 48 | ||||
-rw-r--r-- | unicode/src/screens/UScreenPopup.pas | 44 |
7 files changed, 83 insertions, 30 deletions
diff --git a/unicode/src/base/UGraphic.pas b/unicode/src/base/UGraphic.pas index edbdd0b6..07ef71c0 100644 --- a/unicode/src/base/UGraphic.pas +++ b/unicode/src/base/UGraphic.pas @@ -150,6 +150,7 @@ var //popup mod ScreenPopupCheck: TScreenPopupCheck; ScreenPopupError: TScreenPopupError; + ScreenPopupInfo: TScreenPopupInfo; //Notes Tex_Left: array[0..6] of TTexture; //rename to tex_note_left @@ -743,6 +744,8 @@ begin Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Check)', 3); Log.BenchmarkStart(3); ScreenPopupError := TScreenPopupError.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Error)', 3); Log.BenchmarkStart(3); + ScreenPopupInfo := TScreenPopupInfo.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Info)', 3); Log.BenchmarkStart(3); ScreenPartyNewRound := TScreenPartyNewRound.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyNewRound', 3); Log.BenchmarkStart(3); ScreenPartyScore := TScreenPartyScore.Create; @@ -794,6 +797,7 @@ begin ScreenSongJumpto.Destroy; ScreenPopupCheck.Destroy; ScreenPopupError.Destroy; + ScreenPopupInfo.Destroy; ScreenPartyNewRound.Destroy; ScreenPartyScore.Destroy; ScreenPartyWin.Destroy; diff --git a/unicode/src/base/UMain.pas b/unicode/src/base/UMain.pas index 663ece9b..cc6ffc1d 100644 --- a/unicode/src/base/UMain.pas +++ b/unicode/src/base/UMain.pas @@ -437,6 +437,8 @@ begin if (ScreenPopupError <> nil) and (ScreenPopupError.Visible) then done := not ScreenPopupError.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y) + else if (ScreenPopupInfo <> nil) and (ScreenPopupInfo.Visible) then + done := not ScreenPopupInfo.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y) else if (ScreenPopupCheck <> nil) and (ScreenPopupCheck.Visible) then done := not ScreenPopupCheck.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y) else @@ -511,6 +513,8 @@ begin // shoud be done in a way to be sure the topmost popup has preference (maybe error, then check) else if (ScreenPopupError <> nil) and (ScreenPopupError.Visible) then Done := not ScreenPopupError.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, true) + else if (ScreenPopupInfo <> nil) and (ScreenPopupInfo.Visible) then + Done := not ScreenPopupInfo.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, true) else if (ScreenPopupCheck <> nil) and (ScreenPopupCheck.Visible) then Done := not ScreenPopupCheck.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, true) else diff --git a/unicode/src/menu/UDisplay.pas b/unicode/src/menu/UDisplay.pas index e8bcecfb..6f29d2e1 100644 --- a/unicode/src/menu/UDisplay.pas +++ b/unicode/src/menu/UDisplay.pas @@ -124,6 +124,7 @@ uses UMain, UTexture, UTime, + ULanguage, UPathUtils; constructor TDisplay.Create; @@ -220,6 +221,8 @@ begin //popup mod if (ScreenPopupError <> nil) and ScreenPopupError.Visible then ScreenPopupError.Draw + else if (ScreenPopupInfo <> nil) and ScreenPopupInfo.Visible then + ScreenPopupInfo.Draw else if (ScreenPopupCheck <> nil) and ScreenPopupCheck.Visible then ScreenPopupCheck.Draw; @@ -545,9 +548,9 @@ begin // Success := WriteBMPImage(FileName, Surface); Success := WritePNGImage(FileName, Surface); if Success then - ScreenPopupError.ShowPopup('Screenshot saved: ' + FileName.GetName.ToUTF8()) + ScreenPopupInfo.ShowPopup(Format(Language.Translate('SCREENSHOT_SAVED'), [FileName.GetName.ToUTF8()])) else - ScreenPopupError.ShowPopup('Screenshot failed'); + ScreenPopupError.ShowPopup(Language.Translate('SCREENSHOT_FAILED')); SDL_FreeSurface(Surface); FreeMem(ScreenData); diff --git a/unicode/src/screens/UScreenEditSub.pas b/unicode/src/screens/UScreenEditSub.pas index 8567e88b..56d11124 100644 --- a/unicode/src/screens/UScreenEditSub.pas +++ b/unicode/src/screens/UScreenEditSub.pas @@ -184,7 +184,7 @@ begin (SDL_ModState = KMOD_LSHIFT)); if (SResult = ssrEncodingError) then begin - ScreenPopupCheck.ShowPopup('Encoding error, save as UTF-8?', OnSaveEncodingError, + ScreenPopupCheck.ShowPopup(Language.Translate('ENCODING_ERROR_ASK_FOR_UTF8'), OnSaveEncodingError, Pointer(SDL_ModState = KMOD_LSHIFT), true); end; Exit; diff --git a/unicode/src/screens/UScreenMain.pas b/unicode/src/screens/UScreenMain.pas index 2ddeda06..7237eb80 100644 --- a/unicode/src/screens/UScreenMain.pas +++ b/unicode/src/screens/UScreenMain.pas @@ -168,7 +168,11 @@ begin //Editor if Interaction = 3 then begin + {$IFDEF UseMIDIPort} FadeTo(@ScreenEdit, SoundLib.Start); + {$ELSE} + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_EDITOR')); + {$ENDIF} end; //Options diff --git a/unicode/src/screens/UScreenOpen.pas b/unicode/src/screens/UScreenOpen.pas index 0d134615..70b883c4 100644 --- a/unicode/src/screens/UScreenOpen.pas +++ b/unicode/src/screens/UScreenOpen.pas @@ -54,19 +54,26 @@ uses type TScreenOpen = class(TMenu) private - TextF: array[0..1] of integer; - TextN: integer; - fPath: IPath; - public - Tex_Background: TTexture; - FadeOut: boolean; - BackScreen: pointer; + //fTextF: array[0..1] of integer; + fTextN: integer; // text-box ID of filename + fFilename: IPath; + fBackScreen: PMenu; + procedure AddBox(X, Y, W, H: real); + public constructor Create; override; procedure OnShow; override; function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; - //function Draw: boolean; override; - //procedure Finish; + + {** + * Set by the caller to provide a default filename. + * Set to the selected filename after calling this screen or to PATH_NONE + * if the screen was aborted. + * TODO: maybe pass this value with a callback OnValueChanged() + *} + property Filename: IPath READ fFilename WRITE fFilename; + {** The screen that is shown after this screen is closed (set by the caller) *} + property BackScreen: PMenu READ fBackScreen WRITE fBackScreen; end; implementation @@ -90,7 +97,7 @@ begin begin if (Interaction = 0) then begin - Text[TextN].Text := Text[TextN].Text + UCS4ToUTF8String(CharCode); + Text[fTextN].Text := Text[fTextN].Text + UCS4ToUTF8String(CharCode); Exit; end; end; @@ -101,16 +108,16 @@ begin begin if Interaction = 0 then begin - Text[TextN].DeleteLastLetter; + Text[fTextN].DeleteLastLetter; end; end; SDLK_ESCAPE: begin //Empty Filename and go to last Screen - ConversionFileName := PATH_NONE; + fFileName := PATH_NONE; AudioPlayback.PlaySound(SoundLib.Back); - FadeTo(BackScreen); + FadeTo(fBackScreen); end; SDLK_RETURN: @@ -118,16 +125,16 @@ begin if (Interaction = 2) then begin //Update Filename and go to last Screen - ConversionFileName := Path(Text[TextN].Text); + fFileName := Path(Text[fTextN].Text); AudioPlayback.PlaySound(SoundLib.Back); - FadeTo(BackScreen); + FadeTo(fBackScreen); end else if (Interaction = 1) then begin //Empty Filename and go to last Screen - ConversionFileName := PATH_NONE; + fFileName := PATH_NONE; AudioPlayback.PlaySound(SoundLib.Back); - FadeTo(BackScreen); + FadeTo(fBackScreen); end; end; @@ -162,6 +169,8 @@ constructor TScreenOpen.Create; begin inherited Create; + fFilename := PATH_NONE; + // line { AddStatic(20, 10, 80, 30, 0, 0, 0, 'MainBar', 'JPG', TEXTURE_TYPE_COLORIZED); @@ -177,8 +186,8 @@ begin // file name AddBox(20, 540, 500, 40); - TextN := AddText(50, 548, 0, 24, 0, 0, 0, ConversionFileName.ToUTF8); - AddInteraction(iText, TextN); + fTextN := AddText(50, 548, 0, 24, 0, 0, 0, fFileName.ToUTF8); + AddInteraction(iText, fTextN); // buttons {AddButton(540, 540, 100, 40, Skin.SkinPath + Skin.ButtonF); @@ -200,6 +209,7 @@ begin inherited; Interaction := 0; + Text[fTextN].Text := fFilename.ToUTF8(); end; (* diff --git a/unicode/src/screens/UScreenPopup.pas b/unicode/src/screens/UScreenPopup.pas index 1af712dd..fdf4a69c 100644 --- a/unicode/src/screens/UScreenPopup.pas +++ b/unicode/src/screens/UScreenPopup.pas @@ -61,7 +61,7 @@ type end; type - TScreenPopupError = class(TMenu) + TScreenPopup = class(TMenu) { private CurMenu: byte; //Num of the cur. Shown Menu @@ -77,6 +77,16 @@ type function Draw: boolean; override; end; + TScreenPopupError = class(TScreenPopup) + public + constructor Create; + end; + + TScreenPopupInfo = class(TScreenPopup) + public + constructor Create; + end; + var //ISelections: array of string; SelectValue: integer; @@ -94,6 +104,8 @@ uses UDisplay, UUnicodeUtils; +{ TScreenPopupCheck } + function TScreenPopupCheck.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; var Value: boolean; @@ -187,9 +199,9 @@ begin Background.OnShow end; -// error popup +{ TScreenPopup } -function TScreenPopupError.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenPopup.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then @@ -223,7 +235,7 @@ begin end; end; -constructor TScreenPopupError.Create; +constructor TScreenPopup.Create; begin inherited Create; @@ -238,22 +250,22 @@ begin Interaction := 0; end; -function TScreenPopupError.Draw: boolean; +function TScreenPopup.Draw: boolean; begin Draw := inherited Draw; end; -procedure TScreenPopupError.OnShow; +procedure TScreenPopup.OnShow; begin inherited; end; -procedure TScreenPopupError.OnHide; +procedure TScreenPopup.OnHide; begin end; -procedure TScreenPopupError.ShowPopup(const Msg: UTF8String); +procedure TScreenPopup.ShowPopup(const Msg: UTF8String); begin Interaction := 0; //Reset Interaction Visible := true; //Set Visible @@ -277,4 +289,20 @@ begin Button[0].Text[0].Text := 'OK'; end; +{ TScreenPopupError } + +constructor TScreenPopupError.Create; +begin + inherited; + Text[1].Text := Language.Translate('MSG_ERROR_TITLE'); +end; + +{ TScreenPopupInfo } + +constructor TScreenPopupInfo.Create; +begin + inherited; + Text[1].Text := Language.Translate('MSG_INFO_TITLE'); +end; + end. |