示例#1
0
文件: TrkRef.cs 项目: notator/Moritz
 internal void WriteSvg(SvgWriter w)
 {
     w.WriteStartElement("trkRef");
     w.WriteAttributeString("midiChannel", MidiChannel.ToString());
     w.WriteAttributeString("msPosition", _trkMsPosition.ToString());
     w.WriteAttributeString("nMidiObjects", _trkNumMidiObjects.ToString());
     if(TrkOptions != null)
     {
         TrkOptions.WriteSvg(w, false);
     }
     w.WriteEndElement(); // trk
 }
示例#2
0
文件: TrkOn.cs 项目: suvjunmd/Moritz
 internal void WriteSvg(SvgWriter w)
 {
     w.WriteStartElement("trkOn");
     w.WriteAttributeString("midiChannel", _trkMidiChannel.ToString());
     w.WriteAttributeString("msPosition", _trkMsPosition.ToString());
     w.WriteAttributeString("nMidiObjects", _trkNumMidiObjects.ToString());
     if(_inputControls != null)
     {
         _inputControls.WriteSvg(w);
     }
     w.WriteEndElement(); // trkOn
 }
示例#3
0
        public void WriteSVG(SvgWriter w)
        {
            w.WriteStartElement("sliders");

            if(PitchWheelMsbs != null && PitchWheelMsbs.Count > 0
                && !(PitchWheelMsbs.Count == 1 && PitchWheelMsbs[0] == M.DefaultPitchWheel))
                w.WriteAttributeString("pitchWheel", M.ByteListToString(PitchWheelMsbs));
            if(PanMsbs != null && PanMsbs.Count > 0
                && !(PanMsbs.Count == 1 && PanMsbs[0] == M.DefaultPan))
                w.WriteAttributeString("pan", M.ByteListToString(PanMsbs));
            if(ModulationWheelMsbs != null && ModulationWheelMsbs.Count > 0
                && !(ModulationWheelMsbs.Count == 1 && ModulationWheelMsbs[0] == M.DefaultModulationWheel))
                w.WriteAttributeString("modulationWheel", M.ByteListToString(ModulationWheelMsbs));
            if(ExpressionMsbs != null && ExpressionMsbs.Count > 0
                && !(ExpressionMsbs.Count == 1 && ExpressionMsbs[0] == M.DefaultExpression))
                w.WriteAttributeString("expressionSlider", M.ByteListToString(ExpressionMsbs));

            w.WriteEndElement();
        }
示例#4
0
        internal void WriteSvg(SvgWriter w)
        {
            w.WriteStartElement("inputNote");
            w.WriteAttributeString("notatedKey", _notatedMidiPitch.ToString());

            if(TrkOptions != null)
            {
                TrkOptions.WriteSvg(w, false);
            }

            if(NoteOn != null)
            {
                NoteOn.WriteSvg(w);
            }

            if(NoteOff != null)
            {
                NoteOff.WriteSvg(w);
            }

            w.WriteEndElement(); // score:inputNote N.B. This element can be empty!
        }
示例#5
0
 /// <summary>
 /// [g id="bassClef8"]
 ///    [text x="0" y="0" font-size="1px" font-family="CLicht"]?[/text]
 ///    [text x="0.16" y="1.1" font-size="0.67px" font-family="CLicht"]•[/text]
 /// [/g]
 /// </summary>
 private void WriteBassClef8SymbolDef(SvgWriter svgw)
 {
     svgw.WriteStartElement("g");
     svgw.WriteAttributeString("id", "bassClef8");
     svgw.WriteStartElement("text");
     svgw.WriteAttributeString("x", "0");
     svgw.WriteAttributeString("y", "0");
     svgw.WriteAttributeString("font-size", "1px");
     svgw.WriteAttributeString("font-family", "CLicht");
     svgw.WriteString("?");
     svgw.WriteEndElement(); // text
     svgw.WriteStartElement("text");
     svgw.WriteAttributeString("x", "0.16");
     svgw.WriteAttributeString("y", "1.1");
     svgw.WriteAttributeString("font-size", "0.67px");
     svgw.WriteAttributeString("font-family", "CLicht");
     svgw.WriteString("•");
     svgw.WriteEndElement(); // text
     svgw.WriteEndElement(); // g
 }
示例#6
0
        private void WriteFontDefs(SvgWriter w)
        {
            string fontDefs =
            @"
            @font-face
            {
                font-family: 'CLicht';
                src: url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.eot');
                src: url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.eot?#iefix') format('embedded-opentype'),
                url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.woff') format('woff'),
                url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.ttf') format('truetype'),
                url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.svg#webfontl9D2oOyX') format('svg');
                font-weight: normal;
                font-style: normal;
            }
            @font-face
            {
                font-family: 'Arial';
                src: url('http://james-ingram-act-two.de/fonts/arial.ttf') format('truetype');
                font-weight:400;
                font-style: normal;
            }
            @font-face
            {
                font-family: 'Open Sans';
                src: url('http://james-ingram-act-two.de/fonts/OpenSans-Regular.ttf') format('truetype');
                font-weight:400;
                font-style: normal;
            }
            @font-face
            {
                font-family: 'Open Sans Condensed';
                src: url('http://james-ingram-act-two.de/fonts/OpenSans-CondBold.ttf') format('truetype');
                font-weight:600;
                font-style: normal;
            }
            ";

            w.WriteStartElement("style");
            w.WriteAttributeString("type", "text/css");
            w.WriteString(fontDefs);
            w.WriteEndElement();
        }
示例#7
0
        /// <summary>
        /// Note that, unlike Rests, MidiChordDefs do not have a msDuration attribute.
        /// Their msDuration is deduced from the contained BasicMidiChords.
        /// Patch indices already set in the BasicMidiChordDefs take priority over those set in the main MidiChordDef.
        /// However, if BasicMidiChordDefs[0].PatchIndex is null, and this.Patch is set, BasicMidiChordDefs[0].PatchIndex is set to Patch.
        /// The same is true for Bank settings.  
        /// The AssistantPerformer therefore only needs to look at BasicMidiChordDefs to find Bank and Patch changes.
        /// While constructing Tracks, the AssistantPerformer should monitor the current Bank and/or Patch, so that it can decide
        /// whether or not to actually construct and send bank and/or patch change messages.
        /// </summary>
        public void WriteSvg(SvgWriter w)
        {
            w.WriteStartElement("score", "midiChord", null);

            Debug.Assert(BasicMidiChordDefs != null && BasicMidiChordDefs.Count > 0);

            if(BasicMidiChordDefs[0].BankIndex == null && Bank != null)
            {
                BasicMidiChordDefs[0].BankIndex = Bank;
            }
            if(BasicMidiChordDefs[0].PatchIndex == null && Patch != null)
            {
                BasicMidiChordDefs[0].PatchIndex = Patch;
            }
            if(HasChordOff == false)
                w.WriteAttributeString("hasChordOff", "0");
            if(PitchWheelDeviation != null && PitchWheelDeviation != M.DefaultPitchWheelDeviation)
                w.WriteAttributeString("pitchWheelDeviation", PitchWheelDeviation.ToString());
            if(MinimumBasicMidiChordMsDuration != M.DefaultMinimumBasicMidiChordMsDuration)
                w.WriteAttributeString("minBasicChordMsDuration", MinimumBasicMidiChordMsDuration.ToString());

            w.WriteStartElement("basicChords");
            foreach(BasicMidiChordDef basicMidiChord in BasicMidiChordDefs) // containing basic <midiChord> elements
                basicMidiChord.WriteSVG(w);
            w.WriteEndElement();

            if(MidiChordSliderDefs != null)
                MidiChordSliderDefs.WriteSVG(w); // writes sliders element

            w.WriteEndElement(); // score:midiChord
        }
示例#8
0
        public void WriteSvg(SvgWriter w)
        {
            w.WriteStartElement("score", "ccSettings", null);

            if(_defaultSettings != null)
            {
                _defaultSettings.WriteSvg(w, "default");
            }
            if(_overrideSettings != null)
            {
                foreach(TrackCCSettings tccs in _overrideSettings)
                {
                    tccs.WriteSvg(w, "track");
                }
            }
            w.WriteEndElement(); // score:ccSettings
        }
示例#9
0
        public void WriteSVG(SvgWriter w, int pageNumber, int nScorePages, int nOutputVoices)
        {
            string pageTitle;

            if (pageNumber == 0)
            {
                pageTitle = base.Title + " (scroll)";
            }
            else
            {
                pageTitle = base.Title + ", page " + pageNumber.ToString() + " of " + nScorePages.ToString();
            }

            w.WriteStartElement("title");
            w.WriteAttributeString("class", "pageTitle");
            w.WriteString(pageTitle);
            w.WriteEndElement();

            w.WriteStartElement(CSSObjectClass.metadata.ToString()); // Inkscape compatible
            w.WriteAttributeString("class", CSSObjectClass.metadata.ToString());
            w.WriteStartElement("rdf", "RDF", null);
            w.WriteStartElement("cc", "Work", null);
            w.WriteAttributeString("rdf", "about", null, "");

            w.WriteStartElement("dc", "format", null);
            w.WriteString("image/svg+xml");
            w.WriteEndElement();             // ends the dc:format element

            w.WriteStartElement("dc", "type", null);
            w.WriteAttributeString("rdf", "resource", null, "http://purl.org/dc/dcmitype/StillImage");
            w.WriteEndElement();             // ends the dc:type element

            w.WriteStartElement("dc", "title", null);
            w.WriteString(pageTitle);
            w.WriteEndElement();             // ends the dc:title element

            w.WriteStartElement("dc", "date", null);
            w.WriteString(M.NowString);
            w.WriteEndElement();             // ends the dc:date element

            w.WriteStartElement("dc", "creator", null);
            w.WriteStartElement("cc", "Agent", null);
            w.WriteStartElement("dc", "title", null);
            w.WriteString("James Ingram");
            w.WriteEndElement();             // ends the dc:title element
            w.WriteEndElement();             // ends the cc:Agent element
            w.WriteEndElement();             // ends the dc:creator element

            w.WriteStartElement("dc", "source", null);
            w.WriteString("Website: https://www.james-ingram-act-two.de");
            w.WriteEndElement();             // ends the dc:source element

            if (!string.IsNullOrEmpty(Keywords))
            {
                w.WriteStartElement("dc", "subject", null);
                w.WriteStartElement("rdf", "Bag", null);
                w.WriteStartElement("rdf", "li", null);
                w.WriteString(Keywords);
                w.WriteEndElement();                 // ends the rdf:li element
                w.WriteEndElement();                 // ends the rdf:Bag element
                w.WriteEndElement();                 // ends the dc:subject element
            }

            StringBuilder desc = new StringBuilder();

            if (pageNumber == 0)
            {
                desc.Append("\nNumber of pages in the score: 1");
            }
            else
            {
                desc.Append("\nNumber of pages in the score: " + nScorePages.ToString());
            }
            desc.Append("\nNumber of output voices: " + nOutputVoices.ToString());
            if (!String.IsNullOrEmpty(Comment))
            {
                desc.Append("\nComments: " + Comment);
            }

            w.WriteStartElement("dc", "description", null);
            w.WriteString(desc.ToString());
            w.WriteEndElement();             // ends the dc:description element

            string contributor = "Originally created using Assistant Composer software:" +
                                 "\nhttps://james-ingram-act-two.de/moritz3/assistantComposer/assistantComposer.html" +
                                 "\nAnnotations, if there are any, have been made using Inkscape.";

            w.WriteStartElement("dc", "contributor", null);
            w.WriteStartElement("cc", "Agent", null);
            w.WriteStartElement("dc", "title", null);
            w.WriteString(contributor);
            w.WriteEndElement();             // ends the dc:title element
            w.WriteEndElement();             // ends the cc:Agent element
            w.WriteEndElement();             // ends the dc:creator element

            w.WriteEndElement();             // ends the cc:Work element
            w.WriteEndElement();             // ends the rdf:RDF element
            w.WriteEndElement();             // ends the metadata element
        }
示例#10
0
文件: SvgPage.cs 项目: notator/Moritz
        /// <summary>
        /// Adds the link, main title and the author to the first page.
        /// </summary>
        protected void WritePage1TitleAndAuthor(SvgWriter w, Metadata metadata)
        {
            string titlesFontFamily = "Open Sans";

            TextInfo titleInfo =
                new TextInfo(metadata.MainTitle, titlesFontFamily, _pageFormat.Page1TitleHeight,
                    null, TextHorizAlign.center);
            TextInfo authorInfo =
              new TextInfo(metadata.Author, titlesFontFamily, _pageFormat.Page1AuthorHeight,
                  null, TextHorizAlign.right);
            w.WriteStartElement("g");
            w.WriteAttributeString("id", "titles");
            w.SvgText("mainTitle", titleInfo, _pageFormat.Right / 2F, _pageFormat.Page1TitleY);
            w.SvgText("author", authorInfo, _pageFormat.RightMarginPos, _pageFormat.Page1TitleY);
            w.WriteEndElement(); // group
        }
示例#11
0
        public void WriteSvg(SvgWriter w, bool writeScoreNamespace)
        {
            if(writeScoreNamespace)
            {
                w.WriteStartElement("score", "trkOptions", null);
            }
            else
            {
                w.WriteStartElement("trkOptions");
            }

            if(_velocityOption != VelocityOption.inherit)
            {
                w.WriteAttributeString("velocity", _velocityOption.ToString());
                if(_velocityOption != VelocityOption.undefined)
                {
                    if(_minimumVelocity == null || _minimumVelocity < 1 || _minimumVelocity > 127)
                    {
                        Debug.Assert(false,
                            "If the VelocityOption is being used, then\n" +
                            "MinimumVelocity must be set to a value in range [1..127]");
                    }
                    w.WriteAttributeString("minVelocity", _minimumVelocity.ToString());
                }
            }

            if(PedalOption != PedalOption.inherit)
            {
                w.WriteAttributeString("pedal", PedalOption.ToString());
            }

            if(SpeedOption > 0)
            {
                w.WriteAttributeString("speed", SpeedOption.ToString(M.En_USNumberFormat));
            }

            if(TrkOffOption != TrkOffOption.inherit)
            {
                w.WriteAttributeString("trkOff", TrkOffOption.ToString());
            }

            w.WriteEndElement(); // score:trkOptions
        }
示例#12
0
文件: Metrics.cs 项目: notator/Moritz
 public override void WriteSVG(SvgWriter w)
 {
     w.WriteStartElement("text");
     w.WriteAttributeString("x", _originX.ToString(M.En_USNumberFormat));
     w.WriteAttributeString("y", _originY.ToString(M.En_USNumberFormat));
     w.WriteAttributeString("font-size", _fontHeight.ToString(M.En_USNumberFormat));
     w.WriteAttributeString("font-family", "CLicht");
     if(! string.IsNullOrEmpty(_colorAttribute))
     {
         w.WriteAttributeString("fill", _colorAttribute);
     }
     switch(_textHorizAlign)
     {
         case TextHorizAlign.left:
             break;
         case TextHorizAlign.center:
             w.WriteAttributeString("text-anchor", "middle");
             break;
         case TextHorizAlign.right:
             w.WriteAttributeString("text-anchor", "end");
             break;
     }
     w.WriteString(_objectType); // e.g. Unicode character
     w.WriteEndElement();
 }
示例#13
0
文件: Metrics.cs 项目: notator/Moritz
 /// <summary>
 /// Only writes the Barline's barnumber to the SVG file.
 /// The barline itself is drawn when the system is complete.
 /// </summary>
 public override void WriteSVG(SvgWriter w)
 {
     if(_staffNameMetrics != null)
     {
         _staffNameMetrics.WriteSVG(w, "staffName");
     }
     if(_barnumberMetrics != null)
     {
         w.WriteStartElement("g");
         w.WriteAttributeString("class", "barNumber");
         _barnumberMetrics.WriteSVG(w); // writes the number and the frame
         w.WriteEndElement(); // barnumber group
     }
 }
示例#14
0
        internal void WriteSvg(SvgWriter w)
        {
            w.WriteStartElement("inputNote");
            w.WriteAttributeString("notatedKey", _notatedMidiPitch.ToString());

            if(InputControls != null)
            {
                InputControls.WriteSvg(w);
            }

            if(NoteOnTrkOns != null || NoteOnTrkOffs != null)
            {
                w.WriteStartElement("noteOn");
                WriteNoteOnOff(w, NoteOnTrkOns, NoteOnTrkOffs);
                w.WriteEndElement(); // noteOn
            }

            if(NotePressures != null)
            {
                NotePressures.WriteSvg(w);
            }

            if(NoteOffTrkOns != null || NoteOffTrkOffs != null)
            {
                w.WriteStartElement("noteOff");
                WriteNoteOnOff(w, NoteOffTrkOns, NoteOffTrkOffs);
                w.WriteEndElement(); // noteOff
            }

            w.WriteEndElement(); // score:inputNote N.B. This element can be empty!
        }
示例#15
0
        /// <summary>
        /// (the actual numbers have changed -- see function below)
        /// [g id="trebleClef2x8"]
        ///     [text x="0" y="0" font-size="1px" font-family="CLicht"]&amp;[/text]
        ///     [text x="0.037" y="-1.17" font-size="0.67px" font-family="CLicht"]™[/text]
        ///     [text x="0.252" y="-1.17" font-size="0.4px" font-family="Arial"]x[/text]
        ///     [text x="0.441" y="-1.17" font-size="0.67px" font-family="CLicht"]•[/text]
        /// [/g]
        /// and
        /// [g id="trebleClef3x8"]
        ///     [text x="0" y="0" font-size="1px" font-family="CLicht"]&amp;[/text]
        ///     [text x="0.037" y="-1.17" font-size="0.67px" font-family="CLicht"]£[/text]
        ///     [text x="0.252" y="-1.17" font-size="0.4px" font-family="Arial"]x[/text]
        ///     [text x="0.441" y="-1.17" font-size="0.67px" font-family="CLicht"]•[/text]
        /// [/g]
        /// </summary>
        private void WriteTrebleClefMulti8SymbolDef(SvgWriter svgw, int octaveShift)
        {
            svgw.WriteStartElement("g");
            svgw.WriteAttributeString("id", "trebleClef" + octaveShift.ToString() + "x8");

            svgw.WriteStartElement("text");
            svgw.WriteAttributeString("x", "0");
            svgw.WriteAttributeString("y", "0");
            svgw.WriteAttributeString("font-size", "1px");
            svgw.WriteAttributeString("font-family", "CLicht");
            svgw.WriteString("&");
            svgw.WriteEndElement(); // text

            svgw.WriteStartElement("text");
            svgw.WriteAttributeString("x", "0.036");
            svgw.WriteAttributeString("y", "-1.17");
            svgw.WriteAttributeString("font-size", "0.67px");
            svgw.WriteAttributeString("font-family", "CLicht");
            switch(octaveShift)
            {
                case 2:
                    svgw.WriteString("™");
                    break;
                case 3:
                    svgw.WriteString("£");
                    break;
            }
            svgw.WriteEndElement(); // text

            svgw.WriteStartElement("text");
            svgw.WriteAttributeString("x", "0.252");
            svgw.WriteAttributeString("y", "-1.17");
            svgw.WriteAttributeString("font-size", "0.4px");
            svgw.WriteAttributeString("font-family", "Arial");
            svgw.WriteString("x");
            svgw.WriteEndElement(); // text

            svgw.WriteStartElement("text");
            svgw.WriteAttributeString("x", "0.48");
            svgw.WriteAttributeString("y", "-1.17");
            svgw.WriteAttributeString("font-size", "0.67px");
            svgw.WriteAttributeString("font-family", "CLicht");
            svgw.WriteString("•");
            svgw.WriteEndElement(); // text

            svgw.WriteEndElement(); // g
        }
示例#16
0
 /// <summary>
 /// [g id="trebleClef"]
 ///   [text x="0" y="0" font-size="1px" font-family="CLicht"] &amp; [/text]
 /// [/g]
 /// </summary>
 private void WriteTrebleClefSymbolDef(SvgWriter svgw)
 {
     svgw.WriteStartElement("g");
     svgw.WriteAttributeString("id", "trebleClef");
     svgw.WriteStartElement("text");
     svgw.WriteAttributeString("x", "0");
     svgw.WriteAttributeString("y", "0");
     svgw.WriteAttributeString("font-size", "1px");
     svgw.WriteAttributeString("font-family", "CLicht");
     svgw.WriteString("&");
     svgw.WriteEndElement(); // text
     svgw.WriteEndElement(); // g
 }
示例#17
0
文件: SvgPage.cs 项目: notator/Moritz
 private void WriteEmptyLayer(SvgWriter w, int layerNumber, string layerName, bool locked)
 {
     w.WriteStartElement("g"); // start layer (for Inkscape)
     WriteInkscapeLayerAttributes(w, layerNumber, layerName, locked);
     w.WriteEndElement(); // end layer (for Inkscape)
 }
示例#18
0
        /// <summary>
        /// Writes the logical content of this InputChordDef
        /// </summary>
        /// <param name="w"></param>
        public void WriteSvg(SvgWriter w)
        {
            // we are inside a score:inputChord element
            if(_ccSettings != null)
            {
                _ccSettings.WriteSvg(w);
            }

            if(_trkOptions != null)
            {
                _trkOptions.WriteSvg(w, true);
            }

            w.WriteStartElement("score", "inputNotes", null);

            foreach(InputNoteDef ind in _inputNoteDefs)
            {
                ind.WriteSvg(w);
            }
            w.WriteEndElement(); // score:inputNotes
        }
示例#19
0
文件: SvgPage.cs 项目: notator/Moritz
        private void WritePageSizedLayer(SvgWriter w, int layerNumber, string layerName, float width, float height, string style)
        {
            w.WriteStartElement("g"); // start layer (for Inkscape)
            WriteInkscapeLayerAttributes(w, layerNumber, layerName, true);

            w.WriteStartElement("rect");
            w.WriteAttributeString("x", "0");
            w.WriteAttributeString("y", "0");
            w.WriteAttributeString("width", width.ToString(M.En_USNumberFormat));
            w.WriteAttributeString("height", height.ToString(M.En_USNumberFormat));
            w.WriteAttributeString("style", style);

            w.WriteEndElement(); // rect
            w.WriteEndElement(); // end layer2 (for Inkscape)
        }
示例#20
0
        public void WriteSvg(SvgWriter w, string elementName)
        {
            Debug.Assert((_pressureOption != CControllerType.undefined || _pressureVolumeOption == true)
                    || (_modWheelOption != CControllerType.undefined || _modWheelVolumeOption == true)
                    || (_pitchWheelOption != PitchWheelOption.undefined), "Attempt to write an empty TrackCCSettings element.");

            w.WriteStartElement(elementName);

            if(_midiChannel != null)
            {
                w.WriteAttributeString("midiChannel", _midiChannel.ToString());
            }

            bool isControllingVolume = false;
            if(_pressureOption != CControllerType.undefined)
            {
                w.WriteAttributeString("pressure", _pressureOption.ToString());
            }
            else if(_pressureVolumeOption == true)
            {
                w.WriteAttributeString("pressure", "volume");
                WriteMaxMinVolume(w);
                isControllingVolume = true;
            }

            if(_pitchWheelOption != PitchWheelOption.undefined)
            {
                w.WriteAttributeString("pitchWheel", _pitchWheelOption.ToString());
                switch(_pitchWheelOption)
                {
                    case PitchWheelOption.pitch:
                        //(range 0..127)
                        Debug.Assert(_pitchWheelDeviationOption != null && _pitchWheelDeviationOption >= 0 && _pitchWheelDeviationOption <= 127);
                        w.WriteAttributeString("pitchWheelDeviation", _pitchWheelDeviationOption.ToString());
                        break;
                    case PitchWheelOption.pan:
                        //(range 0..127, centre is 64)
                        Debug.Assert(_panOriginOption != null && _panOriginOption >= 0 && _panOriginOption <= 127);
                        w.WriteAttributeString("panOrigin", _panOriginOption.ToString());
                        break;
                    case PitchWheelOption.speed:
                        // maximum speed is when durations = durations / speedDeviation
                        // minimum speed is when durations = durations * speedDeviation
                        Debug.Assert(_speedDeviationOption != null && _speedDeviationOption >= 1);
                        w.WriteAttributeString("speedDeviation", ((float)_speedDeviationOption).ToString(M.En_USNumberFormat));
                        break;
                }
            }

            if(_modWheelOption != CControllerType.undefined)
            {
                w.WriteAttributeString("modWheel", _modWheelOption.ToString());
            }
            else if(_modWheelVolumeOption == true)
            {
                Debug.Assert(isControllingVolume == false, "Can't control volume with both pressure and modWheel.");
                w.WriteAttributeString("modWheel", "volume");
                WriteMaxMinVolume(w);
                isControllingVolume = true;
            }

            w.WriteEndElement(); // "default" or "track"
        }
示例#21
0
文件: SvgPage.cs 项目: notator/Moritz
        private void WriteScoreLayer(SvgWriter w, int layerNumber, string layerName, int pageNumber, Metadata metadata)
        {
            w.WriteStartElement("g"); // start layer (for Inkscape)
            WriteInkscapeLayerAttributes(w, layerNumber, layerName, true);

            w.SvgText("timeStamp", _infoTextInfo, 32, 80);

            if(pageNumber == 1 || pageNumber == 0)
            {
                WritePage1TitleAndAuthor(w, metadata);
            }

            int systemNumber = 1;
            foreach(SvgSystem system in Systems)
            {
                system.WriteSVG(w, systemNumber++, _pageFormat);
            }

            w.WriteEndElement(); // end layer (for Inkscape)
        }
示例#22
0
        /// <summary>
        /// Writes a metadata element compatible with Inkscape's
        /// </summary>
        /// <param name="w"></param>
        /// <param name="pageNumber"></param>
        /// <param name="nScorePages"></param>
        public void WriteSVG(SvgWriter w, int pageNumber, int nScorePages, string aboutThePieceLinkURL, int nOutputVoices, int nInputVoices)
        {
            Debug.Assert(!String.IsNullOrEmpty(MainTitle));

            string pageTitle;
            if(pageNumber == 0)
            {
                pageTitle = MainTitle + " (scroll)";
            }
            else
            {
                pageTitle = MainTitle + ", page " + pageNumber.ToString() + " of " + nScorePages.ToString();
            }

            w.WriteStartElement("title");
            w.WriteAttributeString("id", "pageTitle");
            w.WriteString(pageTitle);
            w.WriteEndElement();

            w.WriteStartElement("metadata"); // Inkscape compatible
            w.WriteAttributeString("id", "metadata");
            w.WriteStartElement("rdf", "RDF", null);
            w.WriteStartElement("cc", "Work", null);
            w.WriteAttributeString("rdf", "about", null, "");

            w.WriteStartElement("dc", "format", null);
            w.WriteString("image/svg+xml");
            w.WriteEndElement(); // ends the dc:format element

            w.WriteStartElement("dc", "type", null);
            w.WriteAttributeString("rdf", "resource", null, "http://purl.org/dc/dcmitype/StillImage");
            w.WriteEndElement(); // ends the dc:type element

            w.WriteStartElement("dc", "title", null);
            w.WriteString(pageTitle);
            w.WriteEndElement(); // ends the dc:title element

            w.WriteStartElement("dc", "date", null);
            w.WriteString(M.NowString);
            w.WriteEndElement(); // ends the dc:date element

            w.WriteStartElement("dc", "creator", null);
            w.WriteStartElement("cc", "Agent", null);
            w.WriteStartElement("dc", "title", null);
            w.WriteString("James Ingram");
            w.WriteEndElement(); // ends the dc:title element
            w.WriteEndElement(); // ends the cc:Agent element
            w.WriteEndElement(); // ends the dc:creator element

            w.WriteStartElement("dc", "source", null);
            w.WriteString("Website: http://www.james-ingram-act-two.de");
            w.WriteEndElement(); // ends the dc:source element

            if(!string.IsNullOrEmpty(Keywords))
            {
                w.WriteStartElement("dc", "subject", null);
                w.WriteStartElement("rdf", "Bag", null);
                w.WriteStartElement("rdf", "li", null);
                w.WriteString(Keywords);
                w.WriteEndElement(); // ends the rdf:li element
                w.WriteEndElement(); // ends the rdf:Bag element
                w.WriteEndElement(); // ends the dc:subject element
            }

            StringBuilder desc = new StringBuilder("About: " + aboutThePieceLinkURL );
            if(pageNumber == 0)
            {
                desc.Append("\nNumber of pages in the score: 1");
            }
            else
            {
                desc.Append("\nNumber of pages in the score: " + nScorePages.ToString());
            }
            desc.Append("\nNumber of output voices: " + nOutputVoices.ToString());
            desc.Append("\nNumber of input voices: " + nInputVoices.ToString());
            if(!String.IsNullOrEmpty(Comment))
                desc.Append("\nComments: " + Comment);

            w.WriteStartElement("dc", "description", null);
            w.WriteString(desc.ToString());
            w.WriteEndElement(); // ends the dc:description element

            string contributor = "Originally created using Assistant Composer software:" +
                            "\nhttp://james-ingram-act-two.de/moritz3/assistantComposer/assistantComposer.html" +
                            "\nAnnotations, if there are any, have been made using Inkscape.";
            w.WriteStartElement("dc", "contributor", null);
            w.WriteStartElement("cc", "Agent", null);
            w.WriteStartElement("dc", "title", null);
            w.WriteString(contributor);
            w.WriteEndElement(); // ends the dc:title element
            w.WriteEndElement(); // ends the cc:Agent element
            w.WriteEndElement(); // ends the dc:creator element

            w.WriteEndElement(); // ends the cc:Work element
            w.WriteEndElement(); // ends the rdf:RDF element
            w.WriteEndElement(); // ends the metadata element
        }
示例#23
0
文件: SvgPage.cs 项目: notator/Moritz
        /// <summary>
        /// The presence of this element means that Inkscape opens the file at full screen size
        /// with level2, the annotations, selected.
        /// </summary>
        /// <param name="w"></param>
        private void WriteSodipodiNamedview(SvgWriter w)
        {
            string scoreLayerID = "layer2";

            w.WriteStartElement("sodipodi", "namedview", null);
            w.WriteAttributeString("inkscape", "window-maximized", null, "1");
            w.WriteAttributeString("inkscape", "current-layer", null, scoreLayerID);
            w.WriteEndElement(); // ends the sodipodi:namedview element
        }
示例#24
0
文件: SvgPage.cs 项目: notator/Moritz
        /// <summary>
        /// Writes this page.
        /// </summary>
        /// <param name="w"></param>
        public void WriteSVG(SvgWriter w, Metadata metadata)
        {
            int nOutputVoices = 0;
            int nInputVoices = 0;
            GetNumbersOfVoices(Systems[0], ref nOutputVoices, ref nInputVoices);

            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);

            WriteSodipodiNamedview(w);

            metadata.WriteSVG(w, _pageNumber, _score.PageCount, _pageFormat.AboutLinkURL, nOutputVoices, nInputVoices);

            _score.WriteDefs(w);

            #region layers

            int layerNumber = 1;

            if(_pageNumber > 0)
            {
                WriteFrameLayer(w, layerNumber++, "frame", _pageFormat.Right, _pageFormat.Bottom);
            }

            WriteScoreLayer(w, layerNumber++, "score", _pageNumber, metadata);

            WriteEmptyLayer(w, layerNumber++, "user annotations", true);
            #endregion layers

            w.WriteEndElement(); // close the svg element
            w.WriteEndDocument();
        }
示例#25
0
        protected void WriteSvg(SvgWriter w, string elementName)
        {
            w.WriteStartElement(elementName); // "noteOn" or "noteOff"

            if(_trkOptions != null)
            {
                _trkOptions.WriteSvg(w, false);
            }

            if(_seqRef != null)
            {
                _seqRef.WriteSvg(w);
            }

            if(_trkOffs != null && _trkOffs.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                foreach(int midiChannel in _trkOffs)
                {
                    sb.Append(midiChannel);
                    sb.Append(' ');
                }
                sb.Remove(sb.Length - 1, 1);

                w.WriteStartElement("trkOffs");

                w.WriteAttributeString("midiChannels", sb.ToString());

                w.WriteEndElement(); // trkOffs
            }

            w.WriteEndElement(); // noteOn or noteOff
        }