aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/base/UEditorLyrics.pas89
1 files changed, 47 insertions, 42 deletions
diff --git a/src/base/UEditorLyrics.pas b/src/base/UEditorLyrics.pas
index d06fc891..0b16110f 100644
--- a/src/base/UEditorLyrics.pas
+++ b/src/base/UEditorLyrics.pas
@@ -41,28 +41,28 @@ uses
type
TWord = record
- X: real;
- Y: real;
- Size: real;
- Width: real;
- Text: string;
- ColR: real;
- ColG: real;
- ColB: real;
- FontStyle: integer;
- Italic: boolean;
- Selected: boolean;
+ X: real;
+ Y: real;
+ Size: real;
+ Width: real;
+ Text: string;
+ ColR: real;
+ ColG: real;
+ ColB: real;
+ FontStyle: integer;
+ Italic: boolean;
+ Selected: boolean;
end;
TEditorLyrics = class
private
- AlignI: integer;
- XR: real;
- YR: real;
- SizeR: real;
- SelectedI: integer;
- FontStyleI: integer; // font number
- Word: array of TWord;
+ AlignI: integer;
+ XR: real;
+ YR: real;
+ SizeR: real;
+ SelectedI: integer;
+ FontStyleI: integer; // font number
+ Word: array of TWord;
procedure SetX(Value: real);
procedure SetY(Value: real);
@@ -71,17 +71,17 @@ type
function GetSize: real;
procedure SetSize(Value: real);
procedure SetSelected(Value: integer);
- procedure SetFStyle(Value: integer);
+ procedure SetFontStyle(Value: integer);
procedure AddWord(Text: string);
procedure Refresh;
public
- ColR: real;
- ColG: real;
- ColB: real;
- ColSR: real;
- ColSG: real;
- ColSB: real;
- Italic: boolean;
+ ColR: real;
+ ColG: real;
+ ColB: real;
+ ColSR: real;
+ ColSG: real;
+ ColSB: real;
+ Italic: boolean;
constructor Create;
destructor Destroy; override;
@@ -97,13 +97,17 @@ type
property Align: integer write SetAlign;
property Size: real read GetSize write SetSize;
property Selected: integer read SelectedI write SetSelected;
- property FontStyle: integer write SetFStyle;
+ property FontStyle: integer write SetFontStyle;
end;
implementation
uses
- TextGL, UGraphic, UDrawTexture, Math, USkins;
+ TextGL,
+ UGraphic,
+ UDrawTexture,
+ Math,
+ USkins;
constructor TEditorLyrics.Create;
begin
@@ -148,7 +152,7 @@ end;
procedure TEditorLyrics.SetSelected(Value: integer);
begin
- if (SelectedI > -1) and (SelectedI <= High(Word)) then
+ if (-1 < SelectedI) and (SelectedI <= High(Word)) then
begin
Word[SelectedI].Selected := false;
Word[SelectedI].ColR := ColR;
@@ -157,7 +161,7 @@ begin
end;
SelectedI := Value;
- if (Value > -1) and (Value <= High(Word)) then
+ if (-1 < Value) and (Value <= High(Word)) then
begin
Word[Value].Selected := true;
Word[Value].ColR := ColSR;
@@ -168,22 +172,21 @@ begin
Refresh;
end;
-procedure TEditorLyrics.SetFStyle(Value: integer);
+procedure TEditorLyrics.SetFontStyle(Value: integer);
begin
FontStyleI := Value;
end;
procedure TEditorLyrics.AddWord(Text: string);
var
- WordNum: integer;
+ WordNum: integer;
begin
WordNum := Length(Word);
SetLength(Word, WordNum + 1);
- if WordNum = 0 then begin
- Word[WordNum].X := XR;
- end else begin
+ if WordNum = 0 then
+ Word[WordNum].X := XR
+ else
Word[WordNum].X := Word[WordNum - 1].X + Word[WordNum - 1].Width;
- end;
Word[WordNum].Y := YR;
Word[WordNum].Size := SizeR;
@@ -202,10 +205,11 @@ end;
procedure TEditorLyrics.AddLine(NrLine: integer);
var
- N: integer;
+ N: integer;
begin
Clear;
- for N := 0 to Lines[0].Line[NrLine].HighNote do begin
+ for N := 0 to Lines[0].Line[NrLine].HighNote do
+ begin
Italic := Lines[0].Line[NrLine].Note[N].NoteType = ntFreestyle;
AddWord(Lines[0].Line[NrLine].Note[N].Text);
end;
@@ -220,10 +224,11 @@ end;
procedure TEditorLyrics.Refresh;
var
- W: integer;
- TotWidth: real;
+ W: integer;
+ TotWidth: real;
begin
- if AlignI = 1 then begin
+ if AlignI = 1 then
+ begin
TotWidth := 0;
for W := 0 to High(Word) do
TotWidth := TotWidth + Word[W].Width;
@@ -236,7 +241,7 @@ end;
procedure TEditorLyrics.Draw;
var
- W: integer;
+ W: integer;
begin
for W := 0 to High(Word) do
begin