예제 #1
0
        public void AddBends(Note note)
        {
            _notes.Add(note);
            if (note.IsTieOrigin)
            {
                return;
            }

            switch (note.BendType)
            {
            case BendType.Bend:
            case BendType.PrebendRelease:
            case BendType.PrebendBend:
            {
                BendNoteHeadGroupGlyph endGlyphs = _endNoteGlyph;
                if (endGlyphs == null)
                {
                    endGlyphs          = _endNoteGlyph = new BendNoteHeadGroupGlyph(note.Beat);
                    endGlyphs.Renderer = Renderer;
                    _bendNoteHeads.Add(endGlyphs);
                }

                var lastBendPoint = note.BendPoints[note.BendPoints.Count - 1];
                endGlyphs.AddGlyph(GetBendNoteValue(note, lastBendPoint), (lastBendPoint.Value % 2) != 0);
            }

            break;

            case BendType.Release:
            {
                if (!note.IsTieOrigin)
                {
                    BendNoteHeadGroupGlyph endGlyphs = _endNoteGlyph;
                    if (endGlyphs == null)
                    {
                        endGlyphs          = _endNoteGlyph = new BendNoteHeadGroupGlyph(note.Beat);
                        endGlyphs.Renderer = Renderer;
                        _bendNoteHeads.Add(endGlyphs);
                    }

                    var lastBendPoint = note.BendPoints[note.BendPoints.Count - 1];
                    endGlyphs.AddGlyph(GetBendNoteValue(note, lastBendPoint), (lastBendPoint.Value % 2) != 0);
                }
            }

            break;

            case BendType.BendRelease:
            {
                BendNoteHeadGroupGlyph middleGlyphs = _middleNoteGlyph;
                if (middleGlyphs == null)
                {
                    middleGlyphs          = _middleNoteGlyph = new BendNoteHeadGroupGlyph(note.Beat);
                    middleGlyphs.Renderer = Renderer;
                    _bendNoteHeads.Add(middleGlyphs);
                }
                var middleBendPoint = note.BendPoints[1];
                middleGlyphs.AddGlyph(GetBendNoteValue(note, note.BendPoints[1]), (middleBendPoint.Value % 2) != 0);

                BendNoteHeadGroupGlyph endGlyphs = _endNoteGlyph;
                if (endGlyphs == null)
                {
                    endGlyphs          = _endNoteGlyph = new BendNoteHeadGroupGlyph(note.Beat);
                    endGlyphs.Renderer = Renderer;
                    _bendNoteHeads.Add(endGlyphs);
                }
                var lastBendPoint = note.BendPoints[note.BendPoints.Count - 1];
                endGlyphs.AddGlyph(GetBendNoteValue(note, lastBendPoint), (lastBendPoint.Value % 2) != 0);
            }

            break;
            }
        }
예제 #2
0
        public override void DoLayout()
        {
            var whammyMode = Renderer.Settings.DisplayMode;

            switch (_beat.WhammyBarType)
            {
            case WhammyType.None:
            case WhammyType.Custom:
            case WhammyType.Hold:
                return;

            case WhammyType.Dive:
            case WhammyType.PrediveDive:
            {
                var endGlyphs = new BendNoteHeadGroupGlyph(_beat);
                endGlyphs.Renderer = Renderer;

                var lastWhammyPoint = _beat.WhammyBarPoints[_beat.WhammyBarPoints.Count - 1];
                foreach (var note in _beat.Notes)
                {
                    if (!note.IsTieOrigin)
                    {
                        endGlyphs.AddGlyph(GetBendNoteValue(note, lastWhammyPoint), (lastWhammyPoint.Value % 2) != 0);
                    }
                }

                endGlyphs.DoLayout();
                _bendNoteHeads.Add(endGlyphs);
            }
            break;

            case WhammyType.Dip:
            {
                if (whammyMode == DisplayMode.SongBook)
                {
                    var res = Renderer.Resources;
                    ((ScoreBarRenderer)Renderer).SimpleWhammyOverflow =
                        res.TablatureFont.Size * 1.5f + SimpleDipHeight * Scale + 2 * Scale;
                }
                else
                {
                    var middleGlyphs = new BendNoteHeadGroupGlyph(_beat);
                    middleGlyphs.Renderer = Renderer;
                    if (Renderer.Settings.DisplayMode == DisplayMode.GuitarPro)
                    {
                        var middleBendPoint = _beat.WhammyBarPoints[1];
                        foreach (var note in _beat.Notes)
                        {
                            middleGlyphs.AddGlyph(GetBendNoteValue(note, _beat.WhammyBarPoints[1]), (middleBendPoint.Value % 2) != 0);
                        }
                    }

                    middleGlyphs.DoLayout();
                    _bendNoteHeads.Add(middleGlyphs);

                    var endGlyphs = new BendNoteHeadGroupGlyph(_beat);
                    endGlyphs.Renderer = Renderer;
                    if (Renderer.Settings.DisplayMode == DisplayMode.GuitarPro)
                    {
                        var lastBendPoint = _beat.WhammyBarPoints[_beat.WhammyBarPoints.Count - 1];
                        foreach (var note in _beat.Notes)
                        {
                            endGlyphs.AddGlyph(GetBendNoteValue(note, lastBendPoint), (lastBendPoint.Value % 2) != 0);
                        }
                    }
                    endGlyphs.DoLayout();

                    _bendNoteHeads.Add(endGlyphs);
                }
            }
            break;

            case WhammyType.Predive:
                break;
            }
            base.DoLayout();
        }
예제 #3
0
        public override void DoLayout()
        {
            if (!Container.Beat.IsRest)
            {
                var accidentals = new AccidentalGroupGlyph();
                var ghost       = new GhostNoteContainerGlyph(true);
                ghost.Renderer     = Renderer;
                _prebends          = new BendNoteHeadGroupGlyph(Container.Beat, true);
                _prebends.Renderer = Renderer;
                foreach (var note in Container.Beat.Notes)
                {
                    if (note.IsVisible)
                    {
                        if (note.HasBend)
                        {
                            switch (note.BendType)
                            {
                            case BendType.PrebendBend:
                            case BendType.Prebend:
                            case BendType.PrebendRelease:
                                _prebends.AddGlyph(note.DisplayValue - note.BendPoints[0].Value / 2);
                                break;
                            }
                        }
                        else if (note.Beat.HasWhammyBar)
                        {
                            switch (note.Beat.WhammyBarType)
                            {
                            case WhammyType.PrediveDive:
                            case WhammyType.Predive:
                                _prebends.AddGlyph(note.DisplayValue - note.Beat.WhammyBarPoints[0].Value / 2);
                                break;
                            }
                        }

                        CreateAccidentalGlyph(note, accidentals);
                        ghost.AddParenthesis(note);
                    }
                }

                if (!_prebends.IsEmpty)
                {
                    AddGlyph(_prebends);
                    AddGlyph(new SpacingGlyph(0, 0, 4 * (Container.Beat.GraceType != GraceType.None ? NoteHeadGlyph.GraceScale : 1) * Scale));
                }

                if (Container.Beat.BrushType != BrushType.None)
                {
                    AddGlyph(new ScoreBrushGlyph(Container.Beat));
                    AddGlyph(new SpacingGlyph(0, 0, 4 * Scale));
                }

                if (!ghost.IsEmpty)
                {
                    AddGlyph(ghost);
                    AddGlyph(new SpacingGlyph(0, 0, 4 * (Container.Beat.GraceType != GraceType.None ? NoteHeadGlyph.GraceScale : 1) * Scale));
                }

                if (!accidentals.IsEmpty)
                {
                    AddGlyph(accidentals);
                    AddGlyph(new SpacingGlyph(0, 0, 4 * (Container.Beat.GraceType != GraceType.None ? NoteHeadGlyph.GraceScale : 1) * Scale));
                }
            }

            base.DoLayout();
        }