public void ApplySizes(BarSizeInfo sizes)
        {
            float size;
            float diff;

            size       = sizes.GetPreNoteSize(Beat.Start);
            diff       = size - PreNotes.Width;
            PreNotes.X = 0;
            if (diff > 0)
            {
                PreNotes.ApplyGlyphSpacing(diff);
            }

            size      = sizes.GetOnNoteSize(Beat.Start);
            diff      = size - OnNotes.Width;
            OnNotes.X = PreNotes.X + PreNotes.Width;
            if (diff > 0)
            {
                OnNotes.ApplyGlyphSpacing(diff);
            }

            size        = sizes.GetPostNoteSize(Beat.Start);
            diff        = size - PostNotes.Width;
            PostNotes.X = OnNotes.X + OnNotes.Width;
            if (diff > 0)
            {
                PostNotes.ApplyGlyphSpacing(diff);
            }

            Width = CalculateWidth();
        }
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            // canvas.Color = new Color(200, 0, 0, 100);
            // canvas.FillRect(cx + x, cy + y + 15 * Beat.Voice.Index, width, 10);
            // canvas.Font = new Font("Arial", 10);
            // canvas.Color = new Color(0, 0, 0);
            // canvas.FillText(Beat.Voice.Index + ":" + Beat.Index, cx + X, cy + Y + 15 * Beat.Voice.Index);

            PreNotes.Paint(cx + X, cy + Y, canvas);
            //canvas.Color = new Color(200, 0, 0, 100);
            //canvas.FillRect(cx + X + PreNotes.X, cy + Y + PreNotes.Y, PreNotes.Width, 10);

            OnNotes.Paint(cx + X, cy + Y, canvas);
            //canvas.Color new Color(0, 200, 0, 100);
            //canvas.FillRect(cx + X + OnNotes.X, cy + Y + OnNotes.Y + 10, OnNotes.Width, 10);

            PostNotes.Paint(cx + X, cy + Y, canvas);
            //canvas.Color = new Color(0, 0, 200, 100);
            //canvas.FillRect(cx + X + PostNotes.X, cy + Y + PostNotes.Y + 20, PostNotes.Width, 10);

            for (int i = 0, j = Ties.Count; i < j; i++)
            {
                var t = Ties[i];
                t.Renderer = Renderer;
                t.Paint(cx, cy + Y, canvas);
            }
        }
        public override void DoLayout()
        {
            PreNotes.X         = 0;
            PreNotes.Index     = 0;
            PreNotes.Renderer  = Renderer;
            PreNotes.Container = this;
            PreNotes.DoLayout();

            OnNotes.X         = PreNotes.X + PreNotes.Width;
            OnNotes.Index     = 1;
            OnNotes.Renderer  = Renderer;
            OnNotes.Container = this;
            OnNotes.DoLayout();

            PostNotes.X         = OnNotes.X + OnNotes.Width;
            PostNotes.Index     = 2;
            PostNotes.Renderer  = Renderer;
            PostNotes.Container = this;
            PostNotes.DoLayout();

            var i = Beat.Notes.Count - 1;

            while (i >= 0)
            {
                CreateTies(Beat.Notes[i--]);
            }

            Width = CalculateWidth();
        }
Ejemplo n.º 4
0
 public virtual void ApplyLayoutingInfo(BarLayoutingInfo info)
 {
     PreNotes.Width = info.GetPreBeatSize(Beat);
     OnNotes.Width  = info.GetOnBeatSize(Beat);
     OnNotes.X      = PreNotes.X + PreNotes.Width;
     OnTimeX        = OnNotes.X + OnNotes.Width / 2;
     OnNotes.UpdateBeamingHelper();
 }
Ejemplo n.º 5
0
 public virtual void ScaleToWidth(float beatWidth)
 {
     foreach (var tie in Ties)
     {
         tie.DoLayout();
     }
     OnNotes.UpdateBeamingHelper();
     Width = beatWidth;
 }
Ejemplo n.º 6
0
        public virtual void ApplyLayoutingInfo(BarLayoutingInfo info)
        {
            var offset = info.GetBeatCenterX(Beat) - OnNotes.CenterX;

            PreNotes.X     = offset;
            PreNotes.Width = info.GetPreBeatSize(Beat);
            OnNotes.Width  = info.GetOnBeatSize(Beat);
            OnNotes.X      = PreNotes.X + PreNotes.Width;
            OnNotes.UpdateBeamingHelper();
        }
Ejemplo n.º 7
0
        public override void DoLayout()
        {
            PreNotes.X         = 0;
            PreNotes.Renderer  = Renderer;
            PreNotes.Container = this;
            PreNotes.DoLayout();

            OnNotes.X         = PreNotes.X + PreNotes.Width;
            OnNotes.Renderer  = Renderer;
            OnNotes.Container = this;
            OnNotes.DoLayout();
            var i = Beat.Notes.Count - 1;

            while (i >= 0)
            {
                CreateTies(Beat.Notes[i--]);
            }

            MinWidth = PreNotes.Width + OnNotes.Width;
            if (!Beat.IsRest)
            {
                if (OnNotes.BeamingHelper.Beats.Count == 1)
                {
                    // make space for footer
                    if (Beat.Duration >= Duration.Eighth)
                    {
                        MinWidth += 20 * Scale;
                    }
                }
                else
                {
                    // ensure some space for small notes
                    switch (Beat.Duration)
                    {
                    case Duration.OneHundredTwentyEighth:
                    case Duration.TwoHundredFiftySixth:
                        MinWidth += 10 * Scale;
                        break;
                    }
                }
            }


            Width   = MinWidth;
            OnTimeX = OnNotes.X + OnNotes.Width / 2;
        }
Ejemplo n.º 8
0
        public override void DoLayout()
        {
            PreNotes.X         = 0;
            PreNotes.Renderer  = Renderer;
            PreNotes.Container = this;
            PreNotes.DoLayout();

            OnNotes.X         = PreNotes.X + PreNotes.Width;
            OnNotes.Renderer  = Renderer;
            OnNotes.Container = this;
            OnNotes.DoLayout();
            var i = Beat.Notes.Count - 1;

            while (i >= 0)
            {
                CreateTies(Beat.Notes[i--]);
            }

            UpdateWidth();
        }
Ejemplo n.º 9
0
        public override void DoLayout()
        {
            PreNotes.X         = 0;
            PreNotes.Renderer  = Renderer;
            PreNotes.Container = this;
            PreNotes.DoLayout();

            OnNotes.X         = PreNotes.X + PreNotes.Width;
            OnNotes.Renderer  = Renderer;
            OnNotes.Container = this;
            OnNotes.DoLayout();
            var i = Beat.Notes.Count - 1;

            while (i >= 0)
            {
                CreateTies(Beat.Notes[i--]);
            }

            MinWidth = PreNotes.Width + OnNotes.Width;
            Width    = MinWidth;
            OnTimeX  = OnNotes.X + OnNotes.Width / 2;
        }
Ejemplo n.º 10
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            if (Beat.Voice.IsEmpty)
            {
                return;
            }
            //canvas.Color = new Color(200, 0, 0, 100);
            //canvas.StrokeRect(cx + X, cy + Y + 15 * Beat.Voice.Index, Width, 10);
            //canvas.Font = new Font("Arial", 10);
            //canvas.Color = new Color(0, 0, 0);
            //canvas.FillText(Beat.Voice.Index + ":" + Beat.Index, cx + X, cy + Y + 15 * Beat.Voice.Index);

            //if (Beat.Voice.Index == 0)
            //{
            //    canvas.Color = new Color(200, 200, 0, 100);
            //    canvas.StrokeRect(cx + X, cy + Y + PreNotes.Y - 10, Width, 10);
            //}


            PreNotes.Paint(cx + X, cy + Y, canvas);
            //if (Beat.Voice.Index == 0)
            //{
            //    canvas.Color = new Color(200, 0, 0, 100);
            //    canvas.StrokeRect(cx + X + PreNotes.X, cy + Y + PreNotes.Y, PreNotes.Width, 10);
            //}
            OnNotes.Paint(cx + X, cy + Y, canvas);
            //if (Beat.Voice.Index == 0)
            //{
            //    canvas.Color = new Color(0, 200, 0, 100);
            //    canvas.StrokeRect(cx + X + OnNotes.X, cy + Y + OnNotes.Y + 10, OnNotes.Width, 10);
            //}

            for (int i = 0, j = Ties.Count; i < j; i++)
            {
                var t = Ties[i];
                t.Renderer = Renderer;
                t.Paint(cx, cy + Y, canvas);
            }
        }
Ejemplo n.º 11
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            if (Beat.Voice.IsEmpty)
            {
                return;
            }

            var isEmptyGlyph = PreNotes.IsEmpty && OnNotes.IsEmpty && Ties.Count == 0;

            if (isEmptyGlyph)
            {
                return;
            }

            canvas.BeginGroup(GetGroupId(Beat));

            //var c = canvas.Color;
            //var ta = canvas.TextAlign;
            //canvas.Color = new Color(255, 0, 0);
            //canvas.TextAlign = TextAlign.Left;
            //canvas.FillText(Beat.DisplayStart.ToString(), cx + X, cy + Y - 10);
            //canvas.Color = c;
            //canvas.TextAlign = ta;

            //canvas.Color = Color.Random();
            //canvas.FillRect(cx + X, cy + Y, Width, Renderer.Height);

            //var oldColor = canvas.Color;
            //canvas.Color = new Color((byte)Platform.Platform.Random(255), (byte)Platform.Platform.Random(255), (byte)Platform.Platform.Random(255), 100);
            //canvas.FillRect(cx + X, cy + Y, Width, Renderer.Height);
            //canvas.Color = oldColor;

            //canvas.Color = new Color(200, 0, 0, 100);
            //canvas.StrokeRect(cx + X, cy + Y + 15 * Beat.Voice.Index, Width, 10);
            //canvas.Font = new Font("Arial", 10);
            //canvas.Color = new Color(0, 0, 0);
            //canvas.FillText(Beat.Voice.Index + ":" + Beat.Index, cx + X, cy + Y + 15 * Beat.Voice.Index);

            //if (Beat.Voice.Index == 0)
            //{
            //    canvas.Color = new Color(200, 0, 0, 100);
            //    canvas.StrokeRect(cx + X, cy + Y + PreNotes.Y + 30, Width, 10);
            //}

            PreNotes.Paint(cx + X, cy + Y, canvas);
            //if (Beat.Voice.Index == 0)
            //{
            //    canvas.Color = new Color(200, 0, 0, 100);
            //    canvas.StrokeRect(cx + X + PreNotes.X, cy + Y + PreNotes.Y, PreNotes.Width, 10);
            //}
            OnNotes.Paint(cx + X, cy + Y, canvas);
            //if (Beat.Voice.Index == 0)
            //{
            //    canvas.Color = new Color(0, 200, 0, 100);
            //    canvas.StrokeRect(cx + X + OnNotes.X, cy + Y + OnNotes.Y + 10, OnNotes.Width, 10);
            //}

            // paint the ties relative to the whole staff,
            // reason: we have possibly multiple staves involved and need to calculate the correct positions.
            var staffX = cx - VoiceContainer.X - Renderer.X;
            var staffY = cy - VoiceContainer.Y - Renderer.Y;

            for (int i = 0, j = Ties.Count; i < j; i++)
            {
                var t = Ties[i];
                t.Renderer = Renderer;
                t.Paint(staffX, staffY, canvas);
            }

            canvas.EndGroup();
        }
Ejemplo n.º 12
0
 public virtual void ScaleToWidth(float beatWidth)
 {
     OnNotes.UpdateBeamingHelper();
     Width = beatWidth;
 }
 public void FinalizeGlyph(ScoreLayout layout)
 {
     PreNotes.FinalizeGlyph(layout);
     OnNotes.FinalizeGlyph(layout);
     PostNotes.FinalizeGlyph(layout);
 }