Пример #1
0
        /// <summary>
        /// Old constructor, currently not used (03.05.2020), but retained for future inspection
        /// </summary>
        public OutputChordSymbol(Voice voice, MidiChordDef umcd, int absMsPosition, PageFormat pageFormat)
            : base(voice, umcd.MsDuration, absMsPosition, pageFormat.MinimumCrotchetDuration, pageFormat.MusicFontHeight)
        {
            M.Assert(false); // 03.05.2020: don't use this constructor (to be inspected once work on midi info begins).

            _midiChordDef = umcd;

            _msDurationToNextBarline = umcd.MsDurationToNextBarline;

            SetNoteheadPitchesAndVelocities(umcd.NotatedMidiPitches, umcd.NotatedMidiVelocities);

            if (!String.IsNullOrEmpty(umcd.OrnamentText))
            {
                string ornamentString = null;
                if (Char.IsDigit(umcd.OrnamentText[0]))
                {
                    // if umcd.OrnamentText is null or empty, there will be no ornamentString DrawObject
                    ornamentString = String.Concat('~', umcd.OrnamentText);
                }
                else
                {
                    ornamentString = umcd.OrnamentText;
                }
                OrnamentText ornamentText = new OrnamentText(this, ornamentString, pageFormat.OrnamentFontHeight);
                DrawObjects.Add(ornamentText);
            }

            if (umcd.Lyric != null)
            {
                LyricText lyric = new LyricText(this, umcd.Lyric, FontHeight);
                DrawObjects.Add(lyric);
            }
        }
Пример #2
0
 protected void SetDrawObjects(List <DrawObject> drawObjects)
 {
     DrawObjects.Clear();
     foreach (DrawObject drawObject in drawObjects)
     {
         drawObject.Container = this;
         DrawObjects.Add(drawObject);
     }
 }
Пример #3
0
        public InputChordSymbol(Voice voice, InputChordDef umcd, int minimumCrotchetDurationMS, float fontSize)
            : base(voice, umcd.MsDuration, umcd.MsPosition, minimumCrotchetDurationMS, fontSize)
        {
            _inputChordDef = umcd;

            _msDurationToNextBarline = umcd.MsDurationToNextBarline;

            SetNoteheadPitches(umcd.NotatedMidiPitches);

            if (umcd.Lyric != null)
            {
                LyricText lyricText = new LyricText(this, umcd.Lyric, FontHeight);
                DrawObjects.Add(lyricText);
            }
        }
Пример #4
0
        public OutputChordSymbol(Voice voice, MidiChordDef umcd, int minimumCrotchetDurationMS, float fontSize)
            : base(voice, umcd.MsDuration, umcd.MsPosition, minimumCrotchetDurationMS, fontSize)
        {
            _midiChordDef = umcd;

            _msDurationToNextBarline = umcd.MsDurationToNextBarline;

            SetNoteheadPitches(umcd.NotatedMidiPitches);

            if (umcd.OrnamentNumberSymbol != 0)
            {
                OrnamentText ornamentText = new OrnamentText(this, "~" + umcd.OrnamentNumberSymbol.ToString(), FontHeight);
                DrawObjects.Add(ornamentText);
            }

            if (umcd.Lyric != null)
            {
                LyricText lyric = new LyricText(this, umcd.Lyric, FontHeight);
                DrawObjects.Add(lyric);
            }
        }
Пример #5
0
        private void ParseDraw(StreamReader reader)
        {
            do
            {
                String line = reader.ReadLine();

                if (line.StartsWith("#"))
                {
                    continue;
                }

                char[]   charSeparator = new char[] { ' ' };
                String[] items         = line.Split(charSeparator, System.StringSplitOptions.RemoveEmptyEntries);

                switch (items[0])
                {
                case "ENDDRAW":
                    return;

                case "C":
                    KicadLibCircle circle = new KicadLibCircle();
                    circle.Parse(items);
                    DrawObjects.Add(circle);
                    break;

                case "A":
                    KicadLibArc arc = new KicadLibArc();
                    arc.Parse(items);
                    DrawObjects.Add(arc);
                    break;

                case "P":
                    KicadLibPolygon polygon = new KicadLibPolygon();
                    polygon.Parse(items);
                    DrawObjects.Add(polygon);
                    break;

                case "S":
                    KicadLibRectangle rect = new KicadLibRectangle();
                    rect.Parse(items);
                    DrawObjects.Add(rect);
                    break;

                case "T":
                    KicadLibText text = new KicadLibText();
                    text.Parse(items);
                    DrawObjects.Add(text);
                    break;

                case "B":
                    KicadLibBezier bezier = new KicadLibBezier();
                    bezier.Parse(items);
                    DrawObjects.Add(bezier);
                    break;

                case "X":
                    KicadLibPin pin = new KicadLibPin();
                    pin.Parse(items);
                    DrawObjects.Add(pin);
                    break;

                default:
                    throw new Exception("KicadLibComponent parse error. Unknown draw object.");
                }
            } while (true);
        }