AlphaTab.Rendering.Glyphs.TabBeatGlyph.DoLayout C# (CSharp) Method

DoLayout() public method

public DoLayout ( ) : void
return void
        public override void DoLayout()
        {
            // create glyphs
            if (!Container.Beat.IsRest)
            {
                //
                // Note numbers
                NoteNumbers = new TabNoteChordGlyph(0, 0, Container.Beat.GraceType != GraceType.None);
                NoteNumbers.Beat = Container.Beat;
                NoteNumbers.BeamingHelper = BeamingHelper;
                foreach (var note in Container.Beat.Notes)
                {
                    CreateNoteGlyph(note);
                }
                AddGlyph(NoteNumbers);

                //
                // Whammy Bar
                if (Container.Beat.HasWhammyBar && !NoteNumbers.BeatEffects.ContainsKey("Whammy"))
                {
                    NoteNumbers.BeatEffects["Whammy"] = new WhammyBarGlyph(Container.Beat, Container);

                    var whammyValueHeight = (WhammyBarGlyph.WhammyMaxOffset*Scale)/Beat.WhammyBarMaxValue;

                    var whammyHeight = Container.Beat.MaxWhammyPoint.Value * whammyValueHeight;
                    Renderer.RegisterOverflowTop(whammyHeight);
                }

                //
                // Tremolo Picking
                if (Container.Beat.IsTremolo && !NoteNumbers.BeatEffects.ContainsKey("Tremolo"))
                {
                    int offset = 0;
                    var speed = Container.Beat.TremoloSpeed.Value;
                    switch (speed)
                    {
                        case Duration.ThirtySecond:
                            offset = 10;
                            break;
                        case Duration.Sixteenth:
                            offset = 5;
                            break;
                        case Duration.Eighth:
                            offset = 0;
                            break;
                    }

                    NoteNumbers.BeatEffects["Tremolo"] = new TremoloPickingGlyph(5 * Scale, offset * Scale,
                        Container.Beat.TremoloSpeed.Value);
                }
            }
            else
            {
                RestGlyph = new TabRestGlyph();
                RestGlyph.Beat = Container.Beat;
                RestGlyph.BeamingHelper = BeamingHelper;
                AddGlyph(RestGlyph);
            }

            // left to right layout
            if (Glyphs == null) return;
            var w = 0f;
            for (int i = 0, j = Glyphs.Count; i < j; i++)
            {
                var g = Glyphs[i];
                g.X = w;
                g.Renderer = Renderer;
                g.DoLayout();
                w += g.Width;
            }
            Width = w;
        }