aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/src/screens/UScreenEditConvert.pas
diff options
context:
space:
mode:
authors_alexander <s_alexander@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-06-29 01:02:40 +0000
committers_alexander <s_alexander@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-06-29 01:02:40 +0000
commit1ed2c76ecb3f7351b9194356623bbad2f1313aa8 (patch)
tree5d3df5062c8f76fa419d05a383e29fa68510845f /cmake/src/screens/UScreenEditConvert.pas
parent94b6070c9a28db1d7ba5116a6580bff8e991ff75 (diff)
downloadusdx-1ed2c76ecb3f7351b9194356623bbad2f1313aa8.tar.gz
usdx-1ed2c76ecb3f7351b9194356623bbad2f1313aa8.tar.xz
usdx-1ed2c76ecb3f7351b9194356623bbad2f1313aa8.zip
merged svn trunk r1837 into cmake branche
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1838 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'cmake/src/screens/UScreenEditConvert.pas')
-rw-r--r--cmake/src/screens/UScreenEditConvert.pas43
1 files changed, 30 insertions, 13 deletions
diff --git a/cmake/src/screens/UScreenEditConvert.pas b/cmake/src/screens/UScreenEditConvert.pas
index 361a3be7..e4a691cf 100644
--- a/cmake/src/screens/UScreenEditConvert.pas
+++ b/cmake/src/screens/UScreenEditConvert.pas
@@ -34,6 +34,7 @@ interface
{$I switches.inc}
uses
+ math,
UMenu,
SDL,
{$IFDEF UseMIDIPort}
@@ -575,7 +576,7 @@ var
Bottom: real;
X: real;
Y: real;
- H: real;
+ Height: real;
YSkip: real;
begin
// draw static menu
@@ -583,20 +584,24 @@ begin
Y := 100;
- H := Length(ATrack)*40;
- if H > 480 then
- H := 480;
- Bottom := Y + H;
+ Height := min(480, 40 * Length(ATrack));
+ Bottom := Y + Height;
- YSkip := H / Length(ATrack);
+ 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);
// 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
@@ -614,12 +619,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
@@ -632,9 +637,21 @@ 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