public override void RegisterMaxSizes(BarSizeInfo sizes) { var preSize = BeatGlyphsStart; if (sizes.GetSize(KeySizePre) < preSize) { sizes.SetSize(KeySizePre, preSize); } Std.Foreach(_voiceContainers.Values, c => c.RegisterMaxSizes(sizes)); float postSize; if (_postBeatGlyphs.Count == 0) { postSize = 0; } else { postSize = _postBeatGlyphs[_postBeatGlyphs.Count - 1].X + _postBeatGlyphs[_postBeatGlyphs.Count - 1].Width; } if (sizes.GetSize(KeySizePost) < postSize) { sizes.SetSize(KeySizePost, postSize); } if (sizes.FullWidth < Width) { sizes.FullWidth = Width; } }
public override void ApplySizes(BarSizeInfo sizes) { // if we need additional space in the preBeat group we simply // add a new spacer var preSize = sizes.GetSize(KeySizePre); var preSizeDiff = preSize - BeatGlyphsStart; if (preSizeDiff > 0) { AddPreBeatGlyph(new SpacingGlyph(0, 0, preSizeDiff)); } // on beat glyphs we apply the glyph spacing Std.Foreach(_voiceContainers.Values, c => c.ApplySizes(sizes)); // on the post glyphs we add the spacing before all other glyphs var postSize = sizes.GetSize(KeySizePost); float postSizeDiff; if (_postBeatGlyphs.Count == 0) { postSizeDiff = postSize; } else { postSizeDiff = postSize - (_postBeatGlyphs[_postBeatGlyphs.Count - 1].X + _postBeatGlyphs[_postBeatGlyphs.Count - 1].Width); } if (postSizeDiff > 0) { _postBeatGlyphs.Insert(0, new SpacingGlyph(0, 0, postSizeDiff)); for (var i = 0; i < _postBeatGlyphs.Count; i++) { var g = _postBeatGlyphs[i]; g.X = i == 0 ? 0 : _postBeatGlyphs[_postBeatGlyphs.Count - 1].X + _postBeatGlyphs[_postBeatGlyphs.Count - 1].Width; g.Index = i; g.Renderer = this; } } UpdateWidth(); }