aboutsummaryrefslogtreecommitdiffstats
path: root/unicode/src/screens
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--unicode/src/screens/UScreenEditSub.pas2
-rw-r--r--unicode/src/screens/UScreenMain.pas4
-rw-r--r--unicode/src/screens/UScreenOpen.pas48
-rw-r--r--unicode/src/screens/UScreenPopup.pas44
4 files changed, 70 insertions, 28 deletions
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.