public virtual void DoLayout() { _preBeatGlyphs = new LeftToRightLayoutingGlyphGroup(); _preBeatGlyphs.Renderer = this; _voiceContainers = new FastDictionary <int, VoiceContainerGlyph>(); _postBeatGlyphs = new LeftToRightLayoutingGlyphGroup(); _postBeatGlyphs.Renderer = this; for (int i = 0; i < Bar.Voices.Count; i++) { var voice = Bar.Voices[i]; if (HasVoiceContainer(voice)) { var c = new VoiceContainerGlyph(0, 0, voice); c.Renderer = this; _voiceContainers[Bar.Voices[i].Index] = c; } } if (Bar.SimileMark == SimileMark.SecondOfDouble) { CanWrap = false; } CreatePreBeatGlyphs(); CreateBeatGlyphs(); CreatePostBeatGlyphs(); UpdateSizes(); }
public virtual void DoLayout() { for (int i = 0; i < Bar.Voices.Count; i++) { var voice = Bar.Voices[i]; var c = new VoiceContainerGlyph(0, 0, voice); c.Renderer = this; _voiceContainers[Bar.Voices[i].Index] = c; } CreatePreBeatGlyphs(); CreateBeatGlyphs(); CreatePostBeatGlyphs(); var postBeatStart = 0f; foreach (var voice in _voiceContainers) { var c = _voiceContainers[voice]; c.X = BeatGlyphsStart; c.DoLayout(); var x = c.X + c.Width; if (postBeatStart < x) { postBeatStart = x; } } _postBeatGlyphs.X = postBeatStart; Width = _postBeatGlyphs.X + _postBeatGlyphs.Width; }
private void UpdateWidth() { Width = PostBeatGlyphsStart; if (_postBeatGlyphs.Count > 0) { Width += _postBeatGlyphs[_postBeatGlyphs.Count - 1].X + _postBeatGlyphs[_postBeatGlyphs.Count - 1].Width; } Std.Foreach(_voiceContainers.Values, c => { if (_biggestVoiceContainer == null || c.Width > _biggestVoiceContainer.Width) { _biggestVoiceContainer = c; } }); }
private VoiceContainerGlyph GetOrCreateVoiceContainer(int voiceIndex) { VoiceContainerGlyph c; if (voiceIndex >= _voiceContainers.Count) { c = new VoiceContainerGlyph(0, 0, voiceIndex); c.Renderer = this; _voiceContainers[voiceIndex] = c; } else { c = _voiceContainers[voiceIndex]; } return(c); }
public ScoreBeatContainerGlyph(Beat beat, VoiceContainerGlyph voiceContainer) : base(beat, voiceContainer) { }