Beispiel #1
0
 public override void FinalizeGlyph(ScoreLayout layout)
 {
     if (!Container.Beat.IsRest)
     {
         NoteHeads.UpdateBeamingHelper(Container.X + X);
     }
 }
Beispiel #2
0
 public override void ApplyGlyphSpacing(float spacing)
 {
     base.ApplyGlyphSpacing(spacing);
     // TODO: we need to tell the beaming helper the position of rest beats
     if (!Container.Beat.IsRest)
     {
         NoteHeads.UpdateBeamingHelper(Container.X + X);
     }
 }
Beispiel #3
0
 public override void UpdateBeamingHelper()
 {
     if (NoteHeads != null)
     {
         NoteHeads.UpdateBeamingHelper(Container.X + X);
     }
     else if (RestGlyph != null)
     {
         RestGlyph.UpdateBeamingHelper(Container.X + X);
     }
 }
Beispiel #4
0
 public override void ApplyGlyphSpacing(float spacing)
 {
     base.ApplyGlyphSpacing(spacing);
     if (!Container.Beat.IsRest)
     {
         NoteHeads.UpdateBeamingHelper(Container.X + X);
     }
     else
     {
         RestGlyph.UpdateBeamingHelper(Container.X + X);
     }
 }
Beispiel #5
0
        public override void DoLayout()
        {
            // create glyphs
            var sr = (ScoreBarRenderer)Renderer;

            if (!Container.Beat.IsEmpty)
            {
                if (!Container.Beat.IsRest)
                {
                    //
                    // Note heads
                    //
                    NoteHeads               = new ScoreNoteChordGlyph();
                    NoteHeads.Beat          = Container.Beat;
                    NoteHeads.BeamingHelper = BeamingHelper;
                    NoteLoop(CreateNoteGlyph);
                    AddGlyph(NoteHeads);

                    //
                    // Note dots
                    //
                    if (Container.Beat.Dots > 0)
                    {
                        AddGlyph(new SpacingGlyph(0, 0, 5 * Scale, false));
                        for (var i = 0; i < Container.Beat.Dots; i++)
                        {
                            var group = new GlyphGroup(0, 0);
                            NoteLoop(n => CreateBeatDot(sr.GetNoteLine(n), 2, group));
                            AddGlyph(group);
                        }
                    }
                }
                else
                {
                    var dotLine   = 0;
                    var line      = 0;
                    var offset    = 0;
                    var dotOffset = 0;

                    switch (Container.Beat.Duration)
                    {
                    case Duration.Whole:
                        line    = 4;
                        dotLine = 4;
                        break;

                    case Duration.Half:
                        line    = 5;
                        dotLine = 5;
                        break;

                    case Duration.Quarter:
                        line      = 7;
                        offset    = -2;
                        dotLine   = 4;
                        dotOffset = 3;
                        break;

                    case Duration.Eighth:
                        line      = 8;
                        dotLine   = 4;
                        dotOffset = 3;
                        break;

                    case Duration.Sixteenth:
                        line      = 10;
                        dotLine   = 4;
                        dotOffset = 3;
                        break;

                    case Duration.ThirtySecond:
                        line      = 10;
                        dotLine   = 2;
                        dotOffset = 2;
                        break;

                    case Duration.SixtyFourth:
                        line      = 12;
                        dotLine   = 2;
                        dotOffset = 2;
                        break;
                    }

                    var y = sr.GetScoreY(line, offset);

                    AddGlyph(new RestGlyph(0, y, Container.Beat.Duration));

                    //
                    // Note dots
                    //
                    if (Container.Beat.Dots > 0)
                    {
                        AddGlyph(new SpacingGlyph(0, 0, 5 * Scale, false));
                        for (var i = 0; i < Container.Beat.Dots; i++)
                        {
                            var group = new GlyphGroup(0, 0);
                            CreateBeatDot(dotLine, dotOffset, group);
                            AddGlyph(group);
                        }
                    }
                }
            }

            base.DoLayout();
            if (NoteHeads != null)
            {
                NoteHeads.UpdateBeamingHelper(X);
            }
        }