示例#1
0
        internal void AddMasterBar(MasterBar masterBar)
        {
            if (Openings.Count == 0)
            {
                Openings.Add(masterBar);
            }

            MasterBars.Add(masterBar);
            masterBar.RepeatGroup = this;

            if (masterBar.IsRepeatEnd)
            {
                Closings.Add(masterBar);
                IsClosed = true;
                if (!IsOpened)
                {
                    MasterBars[0].IsRepeatStart = true;
                    IsOpened = true;
                }
            }
            // a new item after the header was closed? -> repeat alternative reopens the group
            else if (IsClosed)
            {
                IsClosed = false;
                Openings.Add(masterBar);
            }
        }
示例#2
0
 internal static void CopyTo(MasterBar src, MasterBar dst)
 {
     dst.IsAnacrusis              = src.IsAnacrusis;
     dst.AlternateEndings         = src.AlternateEndings;
     dst.Index                    = src.Index;
     dst.KeySignature             = src.KeySignature;
     dst.KeySignatureType         = src.KeySignatureType;
     dst.IsDoubleBar              = src.IsDoubleBar;
     dst.IsRepeatStart            = src.IsRepeatStart;
     dst.RepeatCount              = src.RepeatCount;
     dst.TimeSignatureNumerator   = src.TimeSignatureNumerator;
     dst.TimeSignatureDenominator = src.TimeSignatureDenominator;
     dst.TimeSignatureCommon      = src.TimeSignatureCommon;
     dst.TripletFeel              = src.TripletFeel;
     dst.Start                    = src.Start;
 }
示例#3
0
        internal void AddMasterBar(MasterBar bar)
        {
            bar.Score = this;
            bar.Index = MasterBars.Count;
            if (MasterBars.Count != 0)
            {
                bar.PreviousMasterBar = MasterBars[MasterBars.Count - 1];
                bar.PreviousMasterBar.NextMasterBar = bar;
                bar.Start = bar.PreviousMasterBar.Start + bar.PreviousMasterBar.CalculateDuration();
            }

            // if the group is closed only the next upcoming header can
            // reopen the group in case of a repeat alternative, so we
            // remove the current group
            if (bar.IsRepeatStart || _currentRepeatGroup.IsClosed && bar.AlternateEndings <= 0)
            {
                _currentRepeatGroup = new RepeatGroup();
            }

            _currentRepeatGroup.AddMasterBar(bar);
            MasterBars.Add(bar);
        }