コード例 #1
0
ファイル: SvgPage.cs プロジェクト: notator/MNXtoSVG
        private void WriteSystemsLayer(SvgWriter w, int pageNumber, MetadataWithDate metadataWithDate, bool graphicsOnly, bool printTitleAndAuthorOnScorePage1)
        {
            w.SvgStartGroup(CSSObjectClass.systems.ToString());

            w.SvgText(CSSObjectClass.timeStamp, _infoTextInfo.Text, 32, _infoTextInfo.FontHeight);

            if ((pageNumber == 1 || pageNumber == 0) && printTitleAndAuthorOnScorePage1)
            {
                WritePage1TitleAndAuthor(w, metadataWithDate);
            }

            List <CarryMsgs> carryMsgsPerChannel = new List <CarryMsgs>();

            foreach (Staff staff in Systems[0].Staves)
            {
                foreach (Voice voice in staff.Voices)
                {
                    carryMsgsPerChannel.Add(new CarryMsgs());
                }
            }

            int systemNumber = 1;

            foreach (SvgSystem system in Systems)
            {
                system.WriteSVG(w, systemNumber++, _pageFormat, carryMsgsPerChannel, graphicsOnly);
            }

            w.WriteEndElement();             // end layer
        }
コード例 #2
0
ファイル: SvgPage.cs プロジェクト: notator/MNXtoSVG
        /// <summary>
        /// Adds the main title and the author to the first page.
        /// </summary>
        protected void WritePage1TitleAndAuthor(SvgWriter w, MetadataWithDate metadataWithDate)
        {
            string titlesFontFamily = "Open Sans";

            TextInfo titleInfo =
                new TextInfo(metadataWithDate.Title, titlesFontFamily, _pageFormat.Page1TitleHeightVBPX,
                             null, TextHorizAlign.center);
            TextInfo authorInfo =
                new TextInfo(metadataWithDate.Author, titlesFontFamily, _pageFormat.Page1AuthorHeightVBPX,
                             null, TextHorizAlign.right);

            w.WriteStartElement("g");
            w.WriteAttributeString("class", CSSObjectClass.titles.ToString());
            w.SvgText(CSSObjectClass.mainTitle, titleInfo.Text, _pageFormat.RightVBPX / 2, _pageFormat.Page1TitleYVBPX);
            w.SvgText(CSSObjectClass.author, authorInfo.Text, _pageFormat.RightMarginPosVBPX, _pageFormat.Page1TitleYVBPX);
            w.WriteEndElement();             // group
        }
コード例 #3
0
ファイル: SvgPage.cs プロジェクト: notator/MNXtoSVG
        /// <summary>
        /// Writes this page.
        /// </summary>
        /// <param name="w"></param>
        public void WriteSVG(SvgWriter w, MetadataWithDate metadataWithDate, bool isSinglePageScore, bool graphicsOnly, bool printTitleAndAuthorOnScorePage1)
        {
            int nOutputVoices = 0;

            GetNumberOfVoices(Systems[0], ref nOutputVoices);

            w.WriteStartDocument(); // standalone="no"
            //<?xml-stylesheet href="../../fontsStyleSheet.css" type="text/css"?>
            w.WriteProcessingInstruction("xml-stylesheet", "href=\"../../fontsStyleSheet.css\" type=\"text/css\"");
            w.WriteStartElement("svg", "http://www.w3.org/2000/svg");

            WriteSvgHeader(w, graphicsOnly);

            if (!graphicsOnly)
            {
                metadataWithDate.WriteSVG(w, _pageNumber, _score.PageCount, nOutputVoices);
            }

            _score.WriteDefs(w, _pageNumber);

            if (isSinglePageScore && (!graphicsOnly))
            {
                _score.WriteScoreData(w);
            }

            #region layers

            WriteBackgroundLayer(w, _pageFormat.RightVBPX, _pageFormat.BottomVBPX);

            if (_pageNumber > 0)
            {
                WriteFrameLayer(w, _pageFormat.RightVBPX, _pageFormat.BottomVBPX);
            }

            WriteSystemsLayer(w, _pageNumber, metadataWithDate, graphicsOnly, printTitleAndAuthorOnScorePage1);

            w.WriteComment(@" Annotations that are added here will be ignored by the AssistantPerformer. ");

            #endregion layers

            w.WriteEndElement(); // close the svg element
            w.WriteEndDocument();
        }