aboutsummaryrefslogtreecommitdiffstats
path: root/unicode/src/screens/UScreenEditConvert.pas
diff options
context:
space:
mode:
Diffstat (limited to 'unicode/src/screens/UScreenEditConvert.pas')
-rw-r--r--unicode/src/screens/UScreenEditConvert.pas86
1 files changed, 36 insertions, 50 deletions
diff --git a/unicode/src/screens/UScreenEditConvert.pas b/unicode/src/screens/UScreenEditConvert.pas
index 109a828b..835590ed 100644
--- a/unicode/src/screens/UScreenEditConvert.pas
+++ b/unicode/src/screens/UScreenEditConvert.pas
@@ -34,7 +34,6 @@ interface
{$I switches.inc}
uses
- math,
UMenu,
SDL,
{$IFDEF UseMIDIPort}
@@ -138,7 +137,7 @@ uses
function TScreenEditConvert.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean;
begin
Result := true;
- if (PressedDown) then
+ If (PressedDown) Then
begin // Key Down
// check normal keys
case UCS4UpperCase(CharCode) of
@@ -181,15 +180,15 @@ begin
end;
if Interaction = 2 then
- begin
+ begin
Selected := true;
{$IFDEF UseMIDIPort}
MidiFile.OnMidiEvent := nil;
{$ENDIF}
{for T := 0 to High(ATrack) do
- begin
+ begin
if ATrack[T].Hear then
- begin
+ begin
MidiTrack := MidiFile.GetTrack(T);
MidiTrack.OnMidiEvent := MidiFile1MidiEvent;
end;
@@ -198,9 +197,9 @@ begin
end;
if Interaction = 3 then
- begin
+ begin
if SelectedNumber > 0 then
- begin
+ begin
Extract;
SaveSong(Song, Lines, ChangeFileExt(ConversionFileName, '.txt'), false);
end;
@@ -211,16 +210,16 @@ begin
SDLK_SPACE:
begin
// ATrack[Sel].Hear := not ATrack[Sel].Hear;
- if Notes in ATrack[Sel].Status then
- begin
- ATrack[Sel].Status := ATrack[Sel].Status - [Notes];
- if Lyrics in ATrack[Sel].Status then
- ATrack[Sel].Status := ATrack[Sel].Status - [Lyrics]
- else
- ATrack[Sel].Status := ATrack[Sel].Status + [Lyrics];
- end
- else
- ATrack[Sel].Status := ATrack[Sel].Status + [Notes];
+ if Notes in ATrack[Sel].Status then
+ begin
+ ATrack[Sel].Status := ATrack[Sel].Status - [Notes];
+ if Lyrics in ATrack[Sel].Status then
+ ATrack[Sel].Status := ATrack[Sel].Status - [Lyrics]
+ else
+ ATrack[Sel].Status := ATrack[Sel].Status + [Lyrics];
+ end
+ else
+ ATrack[Sel].Status := ATrack[Sel].Status + [Notes];
{ if Selected then
begin
@@ -246,13 +245,13 @@ begin
begin
Inc(Sel);
if Sel > High(ATrack) then
- Sel := 0;
+ Sel := 0;
end;
SDLK_UP:
begin
Dec(Sel);
if Sel < 0 then
- Sel := High(ATrack);
+ Sel := High(ATrack);
end;
end;
end;
@@ -314,7 +313,7 @@ begin
for N := 0 to High(ATrack[T].Note) do
begin
if (ATrack[T].Note[N].EventType = 9) and (ATrack[T].Note[N].Data2 > 0) then
- begin
+ begin
Nu := Length(Note);
SetLength(Note, Nu + 1);
Note[Nu].Start := Round(ATrack[T].Note[N].Start / Ticks);
@@ -336,7 +335,7 @@ begin
for N := 0 to High(ATrack[T].Note) do
begin
if (ATrack[T].Note[N].EventType = 15) then
- begin
+ begin
// Log.LogStatus('<' + Track[T].Note[N].Str + '>', 'MIDI');
AddLyric(Round(ATrack[T].Note[N].Start / Ticks), ATrack[T].Note[N].Str);
end;
@@ -454,6 +453,7 @@ begin
AddButton(500, 20, 100, 40, Skin.GetTextureFileName('ButtonF'));
AddButtonText(20, 5, 0, 0, 0, 'Save');
+
{ MidiOut := TMidiOutput.Create(nil);
// MidiOut.Close;
// MidiOut.DeviceID := 0;
@@ -493,11 +493,13 @@ begin
Log.LogStatus(MidiOut.ProductName, 'MIDI');
MidiOut.Open;
+
if FileExists(ConversionFileName) then
begin
MidiFile.Filename := ConversionFileName;
MidiFile.ReadFile;
+
Len := 0;
Sel := 0;
BPM := MidiFile.Bpm;
@@ -577,7 +579,7 @@ var
Bottom: real;
X: real;
Y: real;
- Height: real;
+ H: real;
YSkip: real;
begin
// draw static menu
@@ -585,24 +587,20 @@ begin
Y := 100;
- Height := min(480, 40 * Length(ATrack));
- Bottom := Y + Height;
+ H := Length(ATrack)*40;
+ if H > 480 then
+ H := 480;
+ Bottom := Y + H;
- if Length(ATrack) = 0 then // prevent crash with uncomplete code.
- begin
- Log.LogDebug ('UScreenEditConvert -> TScreenEditConvert.Draw:', 'Length(ATrack) = 0');
- YSkip := 40;
- end
- else
- YSkip := Height / Length(ATrack);
+ YSkip := H / Length(ATrack);
// select
- DrawQuad(10, Y + Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8);
+ DrawQuad(10, Y+Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8);
// selected - now me use Status System
for Count := 0 to High(ATrack) do
if ATrack[Count].Hear then
- DrawQuad(10, Y + Count*YSkip, 50, YSkip, 0.8, 0.3, 0.3);
+ DrawQuad(10, Y+Count*YSkip, 50, YSkip, 0.8, 0.3, 0.3);
glColor3f(0, 0, 0);
for Count := 0 to High(ATrack) do
begin
@@ -620,12 +618,12 @@ begin
end;
end;
- DrawLine( 10, Y, 10, Bottom, 0, 0, 0);
- DrawLine( 60, Y, 60, Bottom, 0, 0, 0);
+ DrawLine(10, Y, 10, Bottom, 0, 0, 0);
+ DrawLine(60, Y, 60, Bottom, 0, 0, 0);
DrawLine(790, Y, 790, Bottom, 0, 0, 0);
for Count := 0 to Length(ATrack) do
- DrawLine(10, Y + Count*YSkip, 790, Y + Count*YSkip, 0, 0, 0);
+ DrawLine(10, Y+Count*YSkip, 790, Y+Count*YSkip, 0, 0, 0);
for Count := 0 to High(ATrack) do
begin
@@ -638,21 +636,9 @@ begin
for Count2 := 0 to High(ATrack[Count].Note) do
begin
if ATrack[Count].Note[Count2].EventType = 9 then
- DrawQuad(60 + ATrack[Count].Note[Count2].Start/Len*725,
- Y + (Count+1)*YSkip - ATrack[Count].Note[Count2].Data1*35/127,
- 3,
- 3,
- ColR[Count],
- ColG[Count],
- ColB[Count]);
+ DrawQuad(60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + (Count+1)*YSkip - ATrack[Count].Note[Count2].Data1*35/127, 3, 3, ColR[Count], ColG[Count], ColB[Count]);
if ATrack[Count].Note[Count2].EventType = 15 then
- DrawLine(60 + ATrack[Count].Note[Count2].Start/Len*725,
- Y + 0.75*YSkip + Count*YSkip,
- 60 + ATrack[Count].Note[Count2].Start/Len*725,
- Y + YSkip + Count*YSkip,
- ColR[Count],
- ColG[Count],
- ColB[Count]);
+ DrawLine(60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + 0.75 * YSkip + Count*YSkip, 60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + YSkip + Count*YSkip, ColR[Count], ColG[Count], ColB[Count]);
end;
// playing line