public override void DoLayout()
{
var res = Resources;
var glyphOverflow = (res.TablatureFont.Size / 2) + (res.TablatureFont.Size * 0.2f);
TopPadding = glyphOverflow;
BottomPadding = glyphOverflow;
base.DoLayout();
Height = (LineOffset * 4) + TopPadding + BottomPadding;
if (Index == 0)
{
Staff.RegisterStaveTop(TopPadding);
Staff.RegisterStaveBottom(Height - BottomPadding);
}
var top = GetScoreY(0);
var bottom = GetScoreY(8);
for (int i = 0, j = Helpers.BeamHelpers.Count; i < j; i++)
{
var v = Helpers.BeamHelpers[i];
for (int k = 0, l = v.Count; k < l; k++)
{
var h = v[k];
//
// max note (highest) -> top overflow
//
var maxNoteY = GetScoreY(GetNoteLine(h.MaxNote));
if (h.Direction == BeamDirection.Up)
{
maxNoteY -= GetStemSize(h);
maxNoteY -= h.FingeringCount * Resources.GraceFont.Size;
if (h.HasTuplet)
{
maxNoteY -= Resources.EffectFont.Size * 2;
}
}
if (h.HasTuplet)
{
maxNoteY -= Resources.EffectFont.Size * 1.5f;
}
if (maxNoteY < top)
{
RegisterOverflowTop(Math.Abs(maxNoteY));
}
//
// min note (lowest) -> bottom overflow
//t
var minNoteY = GetScoreY(GetNoteLine(h.MinNote));
if (h.Direction == BeamDirection.Down)
{
minNoteY += GetStemSize(h);
minNoteY += h.FingeringCount * Resources.GraceFont.Size;
}
if (minNoteY > bottom)
{
RegisterOverflowBottom(Math.Abs(minNoteY) - bottom);
}
}
}
}