call UpdateTimings on CLines at the end of loading (was called after adding a note)

This commit is contained in:
Benjamin Hess authored and Alexander Eckart committed 2012-03-30 23:25:16 +08:00
1 parent 269dd38402
commit ed5e5bf0b6
2 files changed
+24 -8

No files matched your search

+18 -6
View File
@@ -43,9 +43,7 @@ namespace Vocaluxe.Lib.Song
if (Index >= _Lines.Count) if (Index >= _Lines.Count)
return false; return false;
CLines lines = new CLines(); _Lines[Index] = Lines;
lines = Lines;
_Lines[Index] = lines;
return true; return true;
} }
@@ -549,9 +547,16 @@ namespace Vocaluxe.Lib.Song
#region Methods #region Methods
public void AddLine(CLine Line) public void AddLine(CLine Line)
{
AddLine(Line, true);
}
public void AddLine(CLine Line, bool updateTimings)
{ {
_Lines.Add(Line); _Lines.Add(Line);
UpdateTimings(); if (updateTimings)
{
UpdateTimings();
}
} }
public bool InsertLine(CLine Line, int Index) public bool InsertLine(CLine Line, int Index)
@@ -581,16 +586,23 @@ namespace Vocaluxe.Lib.Song
_Lines.Clear(); _Lines.Clear();
} }
public bool AddNote(CNote Note, int LineIndex) public bool AddNote(CNote Note, int LineIndex, bool updateTimings)
{ {
if (_Lines.Count > LineIndex) if (_Lines.Count > LineIndex)
{ {
_Lines[LineIndex].AddNote(Note); _Lines[LineIndex].AddNote(Note);
UpdateTimings(); if (updateTimings)
{
UpdateTimings();
}
return true; return true;
} }
return false; return false;
} }
public bool AddNote(CNote Note, int LineIndex)
{
return AddNote(Note, LineIndex, true);
}
public bool InsertNote(CNote Note, int LineIndex, int NoteIndex) public bool InsertNote(CNote Note, int LineIndex, int NoteIndex)
{ {
+6 -2
View File
@@ -463,6 +463,10 @@ namespace Vocaluxe.Lib.Song
TempC = (char)c; TempC = (char)c;
} while ((TempC.CompareTo('E') != 0) && !sr.EndOfStream && (c == 19 || c == 16 || c == 13)); } while ((TempC.CompareTo('E') != 0) && !sr.EndOfStream && (c == 19 || c == 16 || c == 13));
} }
foreach(CLines lines in this.Notes.Lines)
{
lines.UpdateTimings();
}
} }
catch (Exception e) catch (Exception e)
{ {
@@ -482,11 +486,11 @@ namespace Vocaluxe.Lib.Song
{ {
CLine line = new CLine(); CLine line = new CLine();
line.AddNote(note); line.AddNote(note);
lines.AddLine(line); lines.AddLine(line, false);
} }
else else
{ {
lines.AddNote(note, lines.LineCount - 1); lines.AddNote(note, lines.LineCount - 1, false);
} }
} }