aboutsummaryrefslogtreecommitdiffstats
path: root/src/screens/UScreenEditSub.pas
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-06-11 16:43:50 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-06-11 16:43:50 +0000
commitac102e54fc6f7232c9cace99bffeb2d79f7de86b (patch)
treed5eff6e05ffbc4867ef05e2037aa07ddce9c107d /src/screens/UScreenEditSub.pas
parentcb8cc3c455ade321861e92829498cdf4f2c26a9b (diff)
downloadusdx-ac102e54fc6f7232c9cace99bffeb2d79f7de86b.tar.gz
usdx-ac102e54fc6f7232c9cace99bffeb2d79f7de86b.tar.xz
usdx-ac102e54fc6f7232c9cace99bffeb2d79f7de86b.zip
fix display bug after deleting last note of a line in editor
Only delete sentence if there are at least 2 left git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2489 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--src/screens/UScreenEditSub.pas69
1 files changed, 39 insertions, 30 deletions
diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas
index 425036b0..7f664fc6 100644
--- a/src/screens/UScreenEditSub.pas
+++ b/src/screens/UScreenEditSub.pas
@@ -530,7 +530,7 @@ begin
begin
if SDL_ModState = KMOD_LCTRL then
begin
- // moves text to right in current sentence
+ // deletes current note
DeleteNote;
end;
end;
@@ -1097,9 +1097,8 @@ begin
C := Lines[0].Current;
//Do Not delete Last Note
- if (Lines[0].High > 0) or (Lines[0].Line[C].HighNote > 0) then
+ if (Lines[0].Line[C].HighNote > 0) then
begin
-
// we copy all notes from the next to the selected one
for N := CurrentNote+1 to Lines[0].Line[C].HighNote do
begin
@@ -1107,37 +1106,47 @@ begin
end;
Dec(Lines[0].Line[C].HighNote);
- if (Lines[0].Line[C].HighNote >= 0) then
- begin
- SetLength(Lines[0].Line[C].Note, Lines[0].Line[C].HighNote + 1);
- // me slightly modify new note
- if CurrentNote > Lines[0].Line[C].HighNote then
- Dec(CurrentNote);
-
- Lines[0].Line[C].Note[CurrentNote].Color := 2;
- end
- //Last Note of current Sentence Deleted - > Delete Sentence
- else
+ SetLength(Lines[0].Line[C].Note, Lines[0].Line[C].HighNote + 1);
+
+ // last note was deleted
+ if (CurrentNote > Lines[0].Line[C].HighNote) then
begin
- //Move all Sentences after the current to the Left
- for N := C+1 to Lines[0].High do
- Lines[0].Line[N-1] := Lines[0].Line[N];
-
- //Delete Last Sentence
- SetLength(Lines[0].Line, Lines[0].High);
- Lines[0].High := High(Lines[0].Line);
- Lines[0].Number := Length(Lines[0].Line);
-
- CurrentNote := 0;
- if (C > 0) then
- Lines[0].Current := C - 1
- else
- Lines[0].Current := 0;
-
- Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 2;
+ // select new last note
+ CurrentNote := Lines[0].Line[C].HighNote;
+
+ // correct Line ending
+ with Lines[0].Line[C] do
+ End_ := Note[HighNote].Start + Note[HighNote].Length;
end;
+
+ Lines[0].Line[C].Note[CurrentNote].Color := 2;
+ end
+ // Last Note of current Sentence Deleted - > Delete Sentence
+ // if there are more than two left
+ else if (Lines[0].High > 1) then
+ begin
+ //Move all Sentences after the current to the Left
+ for N := C+1 to Lines[0].High do
+ Lines[0].Line[N-1] := Lines[0].Line[N];
+
+ //Delete Last Sentence
+ SetLength(Lines[0].Line, Lines[0].High);
+ Lines[0].High := High(Lines[0].Line);
+ Lines[0].Number := Length(Lines[0].Line);
+
+ CurrentNote := 0;
+ if (C > 0) then
+ Lines[0].Current := C - 1
+ else
+ Lines[0].Current := 0;
+
+ Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 2;
end;
+
+ // update lyric display
+ Lyric.AddLine(Lines[0].Current);
+ Lyric.Selected := CurrentNote;
end;
procedure TScreenEditSub.TransposeNote(Transpose: integer);