Exemple #1
0
        public MasterBarsRenderers AddMasterBarRenderers(Track[] tracks, MasterBarsRenderers renderers)
        {
            if (tracks.Length == 0)
            {
                return(null);
            }

            MasterBarsRenderers.Add(renderers);
            CalculateAccoladeSpacing(tracks);

            renderers.LayoutingInfo.PreBeatSize = 0;

            var src = 0;

            for (int i = 0, j = Staves.Count; i < j; i++)
            {
                var g = Staves[i];
                for (int k = 0, l = g.Staves.Count; k < l; k++)
                {
                    var s        = g.Staves[k];
                    var renderer = renderers.Renderers[src++];

                    s.AddBarRenderer(renderer);
                }
            }

            //Width += renderers.Width;
            UpdateWidth();

            return(renderers);
        }
Exemple #2
0
 public void RevertLastBar()
 {
     if (MasterBarsRenderers.Count > 1)
     {
         MasterBarsRenderers.RemoveAt(MasterBarsRenderers.Count - 1);
         var w = 0f;
         for (int i = 0, j = _allStaves.Count; i < j; i++)
         {
             var s = _allStaves[i];
             w = Math.Max(w, s.BarRenderers[s.BarRenderers.Count - 1].Width);
             s.RevertLastBar();
         }
         Width -= w;
     }
 }
Exemple #3
0
        public MasterBarsRenderers AddBars(Track[] tracks, int barIndex)
        {
            if (tracks.Length == 0)
            {
                return(null);
            }

            var result = new MasterBarsRenderers();

            result.LayoutingInfo = new BarLayoutingInfo();
            result.MasterBar     = tracks[0].Score.MasterBars[barIndex];
            MasterBarsRenderers.Add(result);

            CalculateAccoladeSpacing(tracks);

            // add renderers
            var barLayoutingInfo = result.LayoutingInfo;

            foreach (var g in Staves)
            {
                foreach (var s in g.Staves)
                {
                    var bar = g.Track.Staves[s.ModelStaff.Index].Bars[barIndex];
                    s.AddBar(bar, barLayoutingInfo);
                    var renderer = s.BarRenderers[s.BarRenderers.Count - 1];
                    result.Renderers.Add(renderer);
                    if (renderer.IsLinkedToPrevious)
                    {
                        result.IsLinkedToPrevious = true;
                    }

                    if (!renderer.CanWrap)
                    {
                        result.CanWrap = false;
                    }
                }
            }
            barLayoutingInfo.Finish();

            // ensure same widths of new renderer
            result.Width = UpdateWidth();

            return(result);
        }
Exemple #4
0
        public MasterBarsRenderers RevertLastBar()
        {
            if (MasterBarsRenderers.Count > 1)
            {
                var toRemove = MasterBarsRenderers[MasterBarsRenderers.Count - 1];
                MasterBarsRenderers.RemoveAt(MasterBarsRenderers.Count - 1);
                var w = 0f;
                for (int i = 0, j = _allStaves.Count; i < j; i++)
                {
                    var s       = _allStaves[i];
                    var lastBar = s.RevertLastBar();
                    w = Math.Max(w, lastBar.Width);
                }
                Width -= w;

                return(toRemove);
            }
            return(null);
        }