Ejemplo n.º 1
0
        private float GetLeftMarginPos(SvgSystem system, Graphics graphics, PageFormat pageFormat)
        {
            float leftMarginPos = pageFormat.LeftMarginPos;
            float maxNameWidth  = 0;

            foreach (Staff staff in system.Staves)
            {
                foreach (NoteObject noteObject in staff.Voices[0].NoteObjects)
                {
                    Barline firstBarline = noteObject as Barline;
                    if (firstBarline != null)
                    {
                        foreach (DrawObject drawObject in firstBarline.DrawObjects)
                        {
                            StaffNameText staffName = drawObject as StaffNameText;
                            if (staffName != null)
                            {
                                Debug.Assert(staffName.TextInfo != null);

                                TextMetrics staffNameMetrics = new TextMetrics(graphics, null, staffName.TextInfo);
                                float       nameWidth        = staffNameMetrics.Right - staffNameMetrics.Left;
                                maxNameWidth = (maxNameWidth > nameWidth) ? maxNameWidth : nameWidth;
                            }
                        }
                        break;
                    }
                }
            }
            leftMarginPos = maxNameWidth + (pageFormat.Gap * 2.0F);
            leftMarginPos = (leftMarginPos > pageFormat.LeftMarginPos) ? leftMarginPos : pageFormat.LeftMarginPos;

            return(leftMarginPos);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Writes out an SVG Voice
        /// </summary>
        /// <param name="w"></param>
        public virtual void WriteSVG(SvgWriter w, bool staffIsVisible)
        {
            for (int i = 0; i < NoteObjects.Count; ++i)
            {
                NoteObject noteObject = NoteObjects[i];
                Barline    barline    = noteObject as Barline;
                if (staffIsVisible && barline != null)
                {
                    bool       isLastNoteObject = (i == (NoteObjects.Count - 1));
                    float      top                  = Staff.Metrics.StafflinesTop;
                    float      bottom               = Staff.Metrics.StafflinesBottom;
                    PageFormat pageFormat           = Staff.SVGSystem.Score.PageFormat;
                    float      barlineStrokeWidth   = pageFormat.BarlineStrokeWidth;
                    float      stafflineStrokeWidth = pageFormat.StafflineStemStrokeWidth;
                    barline.WriteSVG(w, top, bottom, barlineStrokeWidth, stafflineStrokeWidth, isLastNoteObject, false);
                }

                ChordSymbol chordSymbol = noteObject as ChordSymbol;
                if (chordSymbol != null)
                {
                    chordSymbol.WriteSVG(w, staffIsVisible);
                }
                else
                {
                    // if this is the first barline, the staff name and (maybe) barnumber will be written.
                    noteObject.WriteSVG(w, staffIsVisible);
                }
            }
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
0
        public Notator(PageFormat pageFormat)
        {
            _pageFormat = pageFormat;
            bool error = false;

            switch (pageFormat.ChordSymbolType)
            {
            case "standard":
                SymbolSet = new StandardSymbolSet();
                break;

            //case "2b2":
            //	SymbolSet = new Study2b2SymbolSet();
            //	break;
            case "none":
                SymbolSet = null;
                break;

            default:
                error = true;
                break;
            }
            if (error)
            {
                throw new ApplicationException("Cannot construct Notator!");
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// The systems contain Metrics info, but their top staffline is at 0.
        /// The systems are moved to their correct vertical positions on the page here.
        /// If pageNumber is set to 0, all the systems in pageSystems will be printed
        /// in a single .svg file, whose page height has been changed accordingly.
        /// </summary>
        /// <param name="Systems"></param>
        public SvgPage(SvgScore containerScore, PageFormat pageFormat, int pageNumber, TextInfo infoTextInfo, List <SvgSystem> pageSystems, bool lastPage)
        {
            _score        = containerScore;
            _pageFormat   = pageFormat;
            _pageNumber   = pageNumber;
            _infoTextInfo = infoTextInfo;

            Systems = pageSystems;

            MoveSystemsVertically(pageFormat, pageSystems, (pageNumber == 1 || pageNumber == 0), lastPage);
        }
Ejemplo n.º 6
0
        public KrystalPaletteScore(string scoreTitleName, CompositionAlgorithm algorithm, PageFormat pageFormat,
            List<Krystal> krystals, List<Palette> palettes, string folder,
            string keywords, string comment)
            : base(folder, scoreTitleName, algorithm, keywords, comment, pageFormat)
        {
            Notator = new Notator(pageFormat);

            bool success = CreateScore(krystals, palettes);

            if(success == false)
            {
                this.Systems.Clear();
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Sets Chord.Stem.Direction for each chord.
        /// BeamBlocks are created, beginning with a chord that has IsBeamStart == true, and ending with a chord that has IsBeamEnd == true.
        /// BeamBlocks only contain ChordSymbols, but these may be interspersed with other NoteObjects (barlines, clefs, rests, cautionaryChords etc...)
        /// </summary>
        public void SetChordStemDirectionsAndCreateBeamBlocks(PageFormat pageFormat)
        {
            List <List <OutputChordSymbol> > beamedGroups = GetBeamedGroups();

            Clef currentClef = null;
            List <OutputChordSymbol> beamedGroup = null;
            int groupIndex = 0;
            OutputChordSymbol firstChordInVoice = ((OutputChordSymbol)NoteObjects.Find(x => x is OutputChordSymbol));

            foreach (var noteObject in NoteObjects)
            {
                if (noteObject is OutputChordSymbol chord)
                {
                    if (chord.BeamBlockDef != null)
                    {
                        M.Assert(currentClef != null);
                        beamedGroup = beamedGroups[groupIndex];
                        if (chord.IsBeamStart || (chord == firstChordInVoice && (chord.IsBeamRestart || chord.IsBeamEnd)))
                        {
                            groupIndex++;
                        }
                        double beamThickness       = pageFormat.BeamThickness;
                        double beamStrokeThickness = pageFormat.StafflineStemStrokeWidthVBPX;
                        chord.BeamBlock = new BeamBlock(currentClef, beamedGroup, this.StemDirection, beamThickness, beamStrokeThickness);
                    }
                    else if (chord.IsBeamEnd)
                    {
                        beamedGroup = null;
                    }
                    else if (beamedGroup == null)
                    {
                        M.Assert(currentClef != null);
                        if (this.StemDirection == VerticalDir.none)
                        {
                            chord.Stem.Direction = chord.DefaultStemDirection(currentClef);
                        }
                        else
                        {
                            chord.Stem.Direction = this.StemDirection;
                        }
                    }
                }

                if (noteObject is Clef clef)
                {
                    currentClef = clef;
                }
            }
        }
Ejemplo n.º 8
0
        public override NoteObject GetNoteObject(Voice voice, IUniqueDef iud, bool firstDefInVoice,
                                                 ref byte currentVelocity, float musicFontHeight)
        {
            NoteObject         noteObject         = null;
            CautionaryChordDef cautionaryChordDef = iud as CautionaryChordDef;
            MidiChordDef       midiChordDef       = iud as MidiChordDef;
            InputChordDef      inputChordDef      = iud as InputChordDef;
            RestDef            restDef            = iud as RestDef;
            ClefChangeDef      clefChangeDef      = iud as ClefChangeDef;

            PageFormat pageFormat              = voice.Staff.SVGSystem.Score.PageFormat;
            float      cautionaryFontHeight    = pageFormat.CautionaryNoteheadsFontHeight;
            int        minimumCrotchetDuration = pageFormat.MinimumCrotchetDuration;

            if (cautionaryChordDef != null && firstDefInVoice)
            {
                CautionaryChordSymbol cautionaryChordSymbol = new CautionaryChordSymbol(voice, cautionaryChordDef, cautionaryFontHeight);
                noteObject = cautionaryChordSymbol;
            }
            else if (midiChordDef != null)
            {
                OutputChordSymbol outputChordSymbol = new OutputChordSymbol(voice, midiChordDef, minimumCrotchetDuration, musicFontHeight);

                if (midiChordDef.MidiVelocity != currentVelocity)
                {
                    outputChordSymbol.AddDynamic(midiChordDef.MidiVelocity, currentVelocity);
                    currentVelocity = midiChordDef.MidiVelocity;
                }
                noteObject = outputChordSymbol;
            }
            else if (inputChordDef != null)
            {
                InputChordSymbol inputChordSymbol = new InputChordSymbol(voice, inputChordDef, minimumCrotchetDuration, musicFontHeight);
                noteObject = inputChordSymbol;
            }
            else if (restDef != null)
            {
                RestSymbol restSymbol = new RestSymbol(voice, iud, minimumCrotchetDuration, musicFontHeight);
                noteObject = restSymbol;
            }
            else if (clefChangeDef != null)
            {
                ClefChangeSymbol clefChangeSymbol = new ClefChangeSymbol(voice, clefChangeDef.ClefType, cautionaryFontHeight, ((IUniqueDef)iud).MsPosition);
                noteObject = clefChangeSymbol;
            }

            return(noteObject);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// The systems contain Metrics info, but their top staffline is at 0.
        /// The systems are moved to their correct vertical positions on the page here.
        /// If pageNumber is set to 0, all the systems in pageSystems will be printed
        /// in a single .svg file, whose page height has been changed accordingly.
        /// </summary>
        /// <param name="Systems"></param>
        public SvgPage(SvgScore containerScore, PageFormat pageFormat, int pageNumber, TextInfo infoTextInfo, List<SvgSystem> pageSystems, bool lastPage)
        {
            _score = containerScore;
            _pageFormat = pageFormat;
            _pageNumber = pageNumber;
            _infoTextInfo = infoTextInfo;

            Systems = pageSystems;

            if(pageNumber == 0)
            {
                pageFormat.BottomVBPX = GetNewBottomVBPX(pageSystems);
                pageFormat.BottomMarginPos = (int) (pageFormat.BottomVBPX - pageFormat.DefaultDistanceBetweenSystems);
            }

            MoveSystemsVertically(pageFormat, pageSystems, (pageNumber == 1 || pageNumber == 0), lastPage);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Old constructor, currently not used (03.05.2020), but retained for future inspection
        /// </summary>
        public OutputRestSymbol(Voice voice, IUniqueDef iumdd, int absMsPosition, PageFormat pageFormat)
            : base(voice, iumdd, 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).

            if (iumdd is MidiRestDef mrd)
            {
                _midiRestDef = mrd;
            }

            // This needs testing!!
            if (iumdd is CautionaryChordDef ccd)
            {
                Console.WriteLine("rest is CautionaryChordDef!");
                LocalCautionaryChordDef = ccd;
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// The systems contain Metrics info, but their top staffline is at 0.
        /// The systems are moved to their correct vertical positions on the page here.
        /// If pageNumber is set to 0, all the systems in pageSystems will be printed
        /// in a single .svg file, whose page height has been changed accordingly.
        /// </summary>
        /// <param name="Systems"></param>
        public SvgPage(SvgScore containerScore, PageFormat pageFormat, int pageNumber, TextInfo infoTextInfo, List <SvgSystem> pageSystems, bool lastPage)
        {
            _score        = containerScore;
            _pageFormat   = pageFormat;
            _pageNumber   = pageNumber;
            _infoTextInfo = infoTextInfo;

            Systems = pageSystems;

            if (pageNumber == 0)
            {
                pageFormat.BottomVBPX      = GetNewBottomVBPX(pageSystems);
                pageFormat.BottomMarginPos = (int)(pageFormat.BottomVBPX - pageFormat.DefaultDistanceBetweenSystems);
            }

            MoveSystemsVertically(pageFormat, pageSystems, (pageNumber == 1 || pageNumber == 0), lastPage);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Moves the systems to their correct vertical position. Justifies on all but the last page.
        /// On the first page use pageFormat.FirstPageFrameHeight.
        /// On the last page (which may also be the first), the systems are separated by
        /// pageFormat.MinimumDistanceBetweenSystems.
        /// </summary>
        private void MoveSystemsVertically(PageFormat pageFormat, List <SvgSystem> pageSystems, bool firstPage, bool lastPage)
        {
            float frameTop;
            float frameHeight;

            if (firstPage)
            {
                frameTop    = pageFormat.TopMarginPage1;
                frameHeight = pageFormat.FirstPageFrameHeight;                 // property uses BottomMarginPos
            }
            else
            {
                frameTop    = pageFormat.TopMarginOtherPages;
                frameHeight = pageFormat.OtherPagesFrameHeight;
            }

            MoveSystemsVertically(pageSystems, frameTop, frameHeight, pageFormat.DefaultDistanceBetweenSystems, lastPage);
        }
Ejemplo n.º 13
0
 public Notator(PageFormat pageFormat)
 {
     _pageFormat = pageFormat;
     bool error = false;
     switch(pageFormat.ChordSymbolType)
     {
         case "standard":
             SymbolSet = new StandardSymbolSet();
             break;
         //case "2b2":
         //	SymbolSet = new Study2b2SymbolSet();
         //	break;
         case "none":
             SymbolSet = null;
             break;
         default:
             error = true;
             break;
     }
     if(error)
         throw new ApplicationException("Cannot construct Notator!");
 }
Ejemplo n.º 14
0
 public Notator(PageFormat pageFormat)
 {
     _pageFormat = pageFormat;
     bool error = false;
     switch(pageFormat.ChordSymbolType)
     {
         case "standard":
             SymbolSet = new StandardSymbolSet(false); // _coloredVelocities = false;
             break;
         case "coloredVelocities":
             SymbolSet = new StandardSymbolSet(true); // _coloredVelocities = true;
             break;
         case "none":
             SymbolSet = null;
             break;
         default:
             error = true;
             break;
     }
     if(error)
         throw new ApplicationException("Cannot construct Notator!");
 }
Ejemplo n.º 15
0
        private List <float> GetCautionaryRightExtenderX2s(CautionaryChordSymbol cautionaryChordSymbol1,
                                                           List <NoteObject> noteObjects, List <float> x1s, List <float> ys, float hairlinePadding)
        {
            List <float> x2s     = new List <float>();
            NoteObject   no2     = GetFollowingChordRestOrBarlineSymbol(noteObjects);
            Barline      barline = no2 as Barline;
            ChordSymbol  chord2  = no2 as ChordSymbol;
            RestSymbol   rest2   = no2 as RestSymbol;

            if (barline != null)
            {
                float x2 = barline.Metrics.OriginX;
                x2s = GetEqualFloats(x2, x1s.Count);
            }
            else if (chord2 != null)
            {
                x2s = GetX2sFromChord2(ys, chord2.ChordMetrics, hairlinePadding);
            }
            else if (rest2 != null)
            {
                float x2 = rest2.Metrics.Left - hairlinePadding;
                x2s = GetEqualFloats(x2, x1s.Count);
            }
            else // no2 == null
            {
                Debug.Assert(no2 == null);
                // This voice has no further chords or rests,
                // so draw extenders to the right margin.
                // extend to the right margin
                PageFormat pageFormat     = cautionaryChordSymbol1.Voice.Staff.SVGSystem.Score.PageFormat;
                float      rightMarginPos = pageFormat.RightMarginPos;
                float      gap            = pageFormat.Gap;
                x2s = GetEqualFloats(rightMarginPos + gap, ys.Count);
            }
            return(x2s);
        }
Ejemplo n.º 16
0
 private void SetWebsiteLink(PageFormat pageFormat)
 {
     DimensionsAndMetadataForm damf = _dimensionsAndMetadataForm;
     pageFormat.AboutLinkText = damf.AboutLinkText;
     pageFormat.AboutLinkURL = damf.AboutLinkURL;
 }
Ejemplo n.º 17
0
 private void SetTitleSizeAndPosition(PageFormat pageFormat)
 {
     DimensionsAndMetadataForm damf = _dimensionsAndMetadataForm;
     pageFormat.Page1TitleHeight = damf.TitleHeight * pageFormat.ViewBoxMagnification;
     pageFormat.Page1AuthorHeight = damf.AuthorHeight * pageFormat.ViewBoxMagnification;
     pageFormat.Page1TitleY = damf.TitleY * pageFormat.ViewBoxMagnification;
 }
Ejemplo n.º 18
0
 public SvgScore(string folder, string scoreTitleName, string keywords, string comment, PageFormat pageFormat)
 {
     _pageFormat      = pageFormat;
     _uniqueID_Number = 0;
     SetFilePathAndMetadata(folder, scoreTitleName, keywords, comment);
 }
Ejemplo n.º 19
0
 public abstract void WriteSymbolDefinitions(SvgWriter w, PageFormat pageFormat);
Ejemplo n.º 20
0
 public OutputChordSymbol(Voice voice, MNX.Common.Event mnxEventDef, int absMsPosition, PageFormat pageFormat)
     : base(voice, mnxEventDef.MsDuration, absMsPosition, mnxEventDef, pageFormat.MusicFontHeight)
 {
     SetHeads(mnxEventDef);
 }
Ejemplo n.º 21
0
        private void WriteConnectors(SvgWriter w, int systemNumber, PageFormat pageFormat)
        {
            List<bool> barlineContinuesDownList = pageFormat.BarlineContinuesDownList;
            int topVisibleStaffIndex = TopUnHiddenStaffIndex();
            Debug.Assert(barlineContinuesDownList[barlineContinuesDownList.Count - 1] == false);
            Barline barline = null;
            bool isFirstBarline = true;

            for(int staffIndex = topVisibleStaffIndex; staffIndex < Staves.Count; staffIndex++)
            {
                Staff staff = Staves[staffIndex];
                if(staff.Metrics != null)
                {
                    Voice voice = staff.Voices[0];
                    float barlinesTop = staff.Metrics.StafflinesTop;
                    float barlinesBottom = staff.Metrics.StafflinesBottom;

                    #region set barlinesTop, barlinesBottom
                    switch(staff.NumberOfStafflines)
                    {
                        case 1:
                            barlinesTop -= (staff.Gap * 1.5F);
                            barlinesBottom += (staff.Gap * 1.5F);
                            break;
                        case 2:
                        case 3:
                        case 4:
                            barlinesTop -= staff.Gap;
                            barlinesBottom += staff.Gap;
                            break;
                        default:
                            break;
                    }
                    #endregion set barlinesTop, barlinesBottom

                    #region draw barlines down from staves
                    if(staffIndex < Staves.Count - 1)
                    {
                        //TopEdge topEdge = new TopEdge(Staves[staffIndex + 1], 0F, pageFormat.Right);
                        TopEdge topEdge = GetTopEdge(staffIndex + 1, pageFormat.Right);
                        if(topEdge != null)
                        {
                            BottomEdge bottomEdge = new BottomEdge(staff, 0F, pageFormat.Right, pageFormat.Gap);
                            isFirstBarline = true;

                            for(int i = 0; i < voice.NoteObjects.Count; ++i)
                            {
                                NoteObject noteObject = voice.NoteObjects[i];
                                barline = noteObject as Barline;
                                if(barline != null)
                                {
                                    // draw grouping barlines between staves
                                    if(barlineContinuesDownList[staffIndex - topVisibleStaffIndex] || isFirstBarline)
                                    {
                                        float top = bottomEdge.YatX(barline.Metrics.OriginX);
                                        float bottom = topEdge.YatX(barline.Metrics.OriginX);
                                        bool isLastNoteObject = (i == (voice.NoteObjects.Count - 1));
                                        barline.WriteSVG(w, top, bottom, pageFormat.BarlineStrokeWidth, pageFormat.StafflineStemStrokeWidth, isLastNoteObject, true);
                                        isFirstBarline = false;
                                    }
                                }
                            }
                        }
                    }
                    #endregion
                }
            }
        }
Ejemplo n.º 22
0
 public SmallClef(Voice voice, string clefType, int absMsPosition, PageFormat pageFormat)
     : base(voice, clefType, pageFormat.MusicFontHeight * pageFormat.SmallSizeFactor)
 {
     _absMsPosition = absMsPosition;
     _isVisible     = true;
 }
Ejemplo n.º 23
0
 public ComposableScore(string folder, string scoreTitleName, CompositionAlgorithm algorithm, string keywords, string comment, PageFormat pageFormat)
     : base(folder, scoreTitleName, keywords, comment, pageFormat)
 {
     _algorithm = algorithm;
 }
Ejemplo n.º 24
0
        /// <summary>
        /// When this function returns, the moments have been distributed proportionally within each bar.
        /// Symbols are at their correct positions, except that no checking has been done for overlapping noteObject Metrics.
        /// </summary>
        private void DistributeProportionally(List<NoteObjectMoment> moments, Dictionary<int, float> barlineWidths, PageFormat pageFormat,
            float leftMarginPos)
        {
            List<float> momentWidths = new List<float>();

            float momentWidth = 0;
            for(int i = 1; i < moments.Count; i++)
            {
                momentWidth = (moments[i].AbsMsPosition - moments[i - 1].AbsMsPosition) * 10000F;
                momentWidths.Add(momentWidth);
            }
            momentWidths.Add(0F); // final barline

            float totalMomentWidths = 0F;
            foreach(float width in momentWidths)
                totalMomentWidths += width;

            float totalBarlineWidths = 0F;
            foreach(float width in barlineWidths.Values)
            {
                totalBarlineWidths += width;
            }

            float leftEdgeToFirstAlignment = moments[0].LeftEdgeToAlignment();

            float spreadWidth = pageFormat.RightMarginPos - leftMarginPos - leftEdgeToFirstAlignment - totalBarlineWidths;

            float factor = spreadWidth / totalMomentWidths;

            float currentPosition = leftMarginPos + leftEdgeToFirstAlignment;
            for(int i = 0; i < momentWidths.Count; i++)
            {
                if(barlineWidths.ContainsKey(moments[i].AbsMsPosition))
                {
                    currentPosition += barlineWidths[moments[i].AbsMsPosition];
                }
                moments[i].MoveToAlignmentX(currentPosition);
                currentPosition += momentWidths[i] * factor;
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// All the objects in this SvgSystem are given Metrics which are then moved to their
        /// final positions within the SvgSystem.
        /// When this function returns, all the contained, drawable objects have their correct
        /// relative positions. They are actually drawn when the SvgSystem has been moved to 
        /// its final position on the page.
        /// If the function can't squash everything into the given width, it returns false.
        /// Otherwise it returns true.
        /// </summary>
        public bool MakeGraphics(Graphics graphics, int systemNumber, PageFormat pageFormat, float leftMargin)
        {
            if(Metrics == null)
                CreateMetrics(graphics, pageFormat, leftMargin);

            // All noteObject metrics are now on the left edge of the page.
            // Chords are aligned on the left edge of the page, with accidentals etc further to
            // the left. If two standard chords are synchronous in two voices of the same staff,
            // and the noteheads would overlap, the lower chord will have been been moved slightly
            // left or right. The two chords are at their final positions relative to each other.
            // Barnumbers are aligned centred at a default position just above the first barline

            MoveClefsAndBarlines(pageFormat.StafflineStemStrokeWidth);

            List<NoteObjectMoment> moments = MomentSymbols(pageFormat.Gap);

            // barlineWidths:  Key is a moment's msPosition. Value is the distance between the left edge
            // of the barline and the AlignmentX of the moment which immediately follows it.
            Dictionary<int, float> barlineWidths = GetBarlineWidths(moments, pageFormat.Gap);

            DistributeProportionally(moments, barlineWidths, pageFormat, leftMargin);

            // The moments have now been distributed proportionally within each bar, but no checking has
            // been done for overlapping noteObject Metrics.

            SymbolSet symbolSet = Score.Notator.SymbolSet;
            // SymbolSet is an abstract root class, and the functions called on symbolSet are virtual.
            // Usually they only do something when symbolSet is a StandardSymbolSet.
            symbolSet.AdjustRestsVertically(Staves);
            symbolSet.SetBeamedStemLengths(Staves); // see the comment next to the function

            bool success = JustifyHorizontally(moments, barlineWidths, pageFormat.StafflineStemStrokeWidth);
            if(success)
            {
                symbolSet.FinalizeBeamBlocks(Staves);
                symbolSet.AlignLyrics(Staves);
                SvgSystem nextSystem = null;
                if(systemNumber < this.Score.Systems.Count)
                {
                    nextSystem = this.Score.Systems[systemNumber];
                }
                symbolSet.AddNoteheadExtenderLines(Staves, pageFormat.RightMarginPos, pageFormat.Gap,
                    pageFormat.NoteheadExtenderStrokeWidth, pageFormat.StafflineStemStrokeWidth, nextSystem);

                SetBarlineVisibility(pageFormat.BarlineContinuesDownList);

                JustifyVertically(pageFormat.Right, pageFormat.Gap);

                AdjustBarnumberVertically(pageFormat.Gap);

                AlignStaffnamesInLeftMargin(leftMargin, pageFormat.Gap);

                ResetStaffMetricsBoundaries();
            }
            else
            {
                string msg =
                    "There was not enough horizontal space for all the symbols in\n\n" +
                    "                         system number " + systemNumber.ToString() + ".\n\n" +
                    "Possible solutions:\n" +
                    "    Reduce the number of bars in the system.\n" +
                    "    Set a smaller gap size for the score.";
                MessageBox.Show(msg, "Problem", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            return success;
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Sets InitialClefPerChannel to contain a clef for every channel (=voiceDef).
        /// Channels that will end up on a HiddenOutputStaff are also given a clef - even though it isn't going to be displayed.
        /// </summary>
        public void GetInitialClefPerChannel(PageFormat pageFormat)
        {
            List<string> pageFormatClefsList = pageFormat.ClefsList;
            List<List<byte>> visibleOutputVoiceIndicesPerStaff = pageFormat.VisibleOutputVoiceIndicesPerStaff;
            List<List<byte>> visibleInputVoiceIndicesPerStaff = pageFormat.VisibleInputVoiceIndicesPerStaff;

            List<string> initialClefs = new List<string>();
            #region fill initialClefs to the right length, just so that it can be indexed.
            for(int i = 0; i < this.MidiChannelIndexPerOutputVoice.Count; ++i)
            {
                initialClefs.Add("t");
            }
            for(int i = 0; i < this.NumberOfInputVoices; ++i)
            {
                initialClefs.Add("t");
            }
            #endregion

            int pageFormatClefsListIndex = 0;
            for(int i = 0; i < visibleOutputVoiceIndicesPerStaff.Count; ++i)
            {
                List<byte> voiceIndices = visibleOutputVoiceIndicesPerStaff[i];
                foreach(byte index in voiceIndices)
                {
                    initialClefs[index] = pageFormatClefsList[pageFormatClefsListIndex++];
                }
            }

            int firstInputClefIndex = this.MidiChannelIndexPerOutputVoice.Count;
            for(int i = 0; i < visibleInputVoiceIndicesPerStaff.Count; ++i)
            {
                List<byte> inputVoiceIndices = visibleInputVoiceIndicesPerStaff[i];
                foreach(byte index in inputVoiceIndices)
                {
                    initialClefs[firstInputClefIndex + index] = pageFormatClefsList[pageFormatClefsListIndex++];
                }
            }

            InitialClefPerChannel = initialClefs;
        }
Ejemplo n.º 27
0
        public CautionaryChordSymbol(Voice voice, CautionaryChordDef lccd, int absMsPosition, PageFormat pageFormat)
            : base(voice, lccd.MsDuration, absMsPosition, pageFormat.MinimumCrotchetDuration, pageFormat.MusicFontHeight * pageFormat.SmallSizeFactor)
        {
            SetNoteheadPitchesAndVelocities(lccd.NotatedMidiPitches, lccd.NotatedMidiVelocities);

            _durationClass = DurationClass.cautionary;
            _msDuration    = 0;
            Stem.Draw      = false;
        }
Ejemplo n.º 28
0
 private PageFormat GetPageFormat()
 {
     PageFormat pageFormat = new PageFormat();
     SetPaperSize(pageFormat);
     SetTitleSizeAndPosition(pageFormat);
     SetFrame(pageFormat);
     SetWebsiteLink(pageFormat);
     SetNotation(pageFormat);
     return pageFormat;
 }
Ejemplo n.º 29
0
        /// <summary>
        /// Writes out all the SVGSystem's staves. 
        /// </summary>
        /// <param name="w"></param>
        public void WriteSVG(SvgWriter w, int systemNumber, PageFormat pageFormat)
        {
            w.SvgStartGroup("system");

            for(int staffIndex = 0; staffIndex < Staves.Count; staffIndex++)
            {
                Staves[staffIndex].WriteSVG(w, systemNumber, staffIndex + 1);
            }

            w.SvgStartGroup("staffConnectors");

            WriteConnectors(w, systemNumber, pageFormat);

            w.SvgEndGroup(); // connectors

            w.SvgEndGroup(); // system
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Moves the systems to their correct vertical position. Justifies on all but the last page.
        /// On the first page use pageFormat.FirstPageFrameHeight.
        /// On the last page (which may also be the first), the systems are separated by 
        /// pageFormat.MinimumDistanceBetweenSystems.
        /// </summary>
        private void MoveSystemsVertically(PageFormat pageFormat, List<SvgSystem> pageSystems, bool firstPage, bool lastPage)
        {
            float frameTop;
            float frameHeight;
            if(firstPage)
            {
                frameTop = pageFormat.TopMarginPage1;
                frameHeight = pageFormat.FirstPageFrameHeight; // property uses BottomMarginPos
            }
            else
            {
                frameTop = pageFormat.TopMarginOtherPages;
                frameHeight = pageFormat.OtherPagesFrameHeight;
            }

            MoveSystemsVertically(pageSystems, frameTop, frameHeight, pageFormat.DefaultDistanceBetweenSystems, lastPage);
        }
Ejemplo n.º 31
0
        /// <summary>
        /// Sets Chord.Stem.Direction for each chord.
        /// Chords are beamed together, duration classes permitting, unless a rest or clef intervenes.
        /// If a barline intervenes, and beamsCrossBarlines is true, the chords are beamed together.
        /// If a barline intervenes, and beamsCrossBarlines is false, the beam is broken.
        /// </summary>
        public void SetChordStemDirectionsAndCreateBeamBlocks(PageFormat pageFormat)
        {
            List <ChordSymbol> chordsBeamedTogether = new List <ChordSymbol>();
            ClefSymbol         currentClef          = null;
            bool        breakGroup = false;
            ChordSymbol lastChord  = null;

            foreach (ChordSymbol cs in ChordSymbols)
            {
                lastChord = cs;
            }

            foreach (NoteObject noteObject in NoteObjects)
            {
                CautionaryChordSymbol cautionaryChord = noteObject as CautionaryChordSymbol;
                ChordSymbol           chord           = noteObject as ChordSymbol;
                RestSymbol            rest            = noteObject as RestSymbol;
                ClefSymbol            clef            = noteObject as ClefSymbol;
                Barline barline = noteObject as Barline;

                if (cautionaryChord != null)
                {
                    continue;
                }

                if (chord != null)
                {
                    if (chord.DurationClass == DurationClass.cautionary ||
                        chord.DurationClass == DurationClass.breve ||
                        chord.DurationClass == DurationClass.semibreve ||
                        chord.DurationClass == DurationClass.minim ||
                        chord.DurationClass == DurationClass.crotchet)
                    {
                        if (currentClef != null)
                        {
                            if (this.StemDirection == VerticalDir.none)
                            {
                                chord.Stem.Direction = chord.DefaultStemDirection(currentClef);
                            }
                            else
                            {
                                chord.Stem.Direction = this.StemDirection;
                            }
                        }
                        breakGroup = true;
                    }
                    else
                    {
                        chordsBeamedTogether.Add(chord);
                        if (chord.Stem.BeamContinues) // this is true by default
                        {
                            breakGroup = false;
                        }
                        else
                        {
                            breakGroup = true;
                        }
                    }
                }

                if (chordsBeamedTogether.Count > 0)
                {
                    if (rest != null)
                    {
                        if (rest.LocalCautionaryChordDef == null)
                        {
                            breakGroup = true;
                        }
                    }

                    if (clef != null)
                    {
                        breakGroup = true;
                    }

                    if (barline != null && !pageFormat.BeamsCrossBarlines)
                    {
                        breakGroup = true;
                    }

                    if (chord == lastChord)
                    {
                        breakGroup = true;
                    }
                }

                if (chordsBeamedTogether.Count > 0 && breakGroup)
                {
                    if (currentClef != null)
                    {
                        if (chordsBeamedTogether.Count == 1)
                        {
                            if (this.StemDirection == VerticalDir.none)
                            {
                                chordsBeamedTogether[0].Stem.Direction = chordsBeamedTogether[0].DefaultStemDirection(currentClef);
                            }
                            else
                            {
                                chordsBeamedTogether[0].Stem.Direction = this.StemDirection;
                            }
                        }
                        else if (chordsBeamedTogether.Count > 1)
                        {
                            float beamThickness       = pageFormat.BeamThickness;
                            float beamStrokeThickness = pageFormat.StafflineStemStrokeWidth;
                            if (this is InputVoice)
                            {
                                beamThickness       *= pageFormat.InputStavesSizeFactor;
                                beamStrokeThickness *= pageFormat.InputStavesSizeFactor;
                            }
                            chordsBeamedTogether[0].BeamBlock =
                                new BeamBlock(currentClef, chordsBeamedTogether, this.StemDirection, beamThickness, beamStrokeThickness);
                        }
                    }
                    chordsBeamedTogether.Clear();
                }

                if (clef != null)
                {
                    currentClef = clef;
                }
            }
        }
Ejemplo n.º 32
0
        private float CreateMetrics(Graphics graphics, PageFormat pageFormat, float leftMarginPos)
        {
            this.Metrics = new SystemMetrics();
            List<NoteObject> NoteObjectsToRemove = new List<NoteObject>();
            int topUnHiddenStaffIndex = TopUnHiddenStaffIndex();
            for(int staffIndex = topUnHiddenStaffIndex; staffIndex < Staves.Count; ++staffIndex)
            {
                Staff staff = Staves[staffIndex];
                Debug.Assert(!(staff is HiddenOutputStaff));

                // Staves that contain no chords will be invisible. Their Metrics attribute is null.
                if(staff.ContainsAChordSymbol)
                {
                    float staffHeight = staff.Gap * (staff.NumberOfStafflines - 1);
                    staff.Metrics = new StaffMetrics(leftMarginPos, pageFormat.RightMarginPos, staffHeight);

                    for(int voiceIndex = 0; voiceIndex < staff.Voices.Count; ++voiceIndex)
                    {
                        Voice voice = staff.Voices[voiceIndex];

                        voice.SetChordStemDirectionsAndCreateBeamBlocks(pageFormat);

                        for(int nIndex = 0; nIndex < staff.Voices[voiceIndex].NoteObjects.Count; nIndex++)
                        {
                            NoteObject noteObject = staff.Voices[voiceIndex].NoteObjects[nIndex];
                            noteObject.Metrics = Score.Notator.SymbolSet.NoteObjectMetrics(graphics, noteObject, voice.StemDirection, staff.Gap, staff.StafflineStemStrokeWidth);

                            if(noteObject.Metrics != null)
                                staff.Metrics.Add(noteObject.Metrics);
                            else
                                NoteObjectsToRemove.Add(noteObject);
                        }

                        foreach(NoteObject noteObject in NoteObjectsToRemove)
                            staff.Voices[voiceIndex].NoteObjects.Remove(noteObject);
                        NoteObjectsToRemove.Clear();
                    }

                    if(staff.Voices.Count > 1)
                    {
                        Debug.Assert(Score.Notator.SymbolSet is StandardSymbolSet);
                        // Other symbol sets do not support multi voice staves.
                        staff.AdjustTwoPartChords();
                    }

                    staff.Metrics.Move(0f, pageFormat.DefaultDistanceBetweenStaves * (staffIndex - topUnHiddenStaffIndex));
                    this.Metrics.Add(staff.Metrics);
                }
            }

            return (this.Metrics.Bottom - this.Metrics.Top);
        }
Ejemplo n.º 33
0
 public abstract Metrics NoteObjectMetrics(Graphics graphics, NoteObject noteObject, VerticalDir voiceStemDirection, double gap, PageFormat pageFormat, string currentClefType);
Ejemplo n.º 34
0
 private void SetFrame(PageFormat pageFormat)
 {
     DimensionsAndMetadataForm damf = _dimensionsAndMetadataForm;
     pageFormat.TopMarginPage1 = damf.TopMarginWidthPage1 * pageFormat.ViewBoxMagnification;
     pageFormat.TopMarginOtherPages = damf.TopMarginWidthOtherPages * pageFormat.ViewBoxMagnification;
     pageFormat.RightMarginPos = pageFormat.RightVBPX - (damf.RightMarginWidth * pageFormat.ViewBoxMagnification);
     pageFormat.LeftMarginPos = damf.LeftMarginWidth * pageFormat.ViewBoxMagnification;
     pageFormat.BottomMarginPos = pageFormat.BottomVBPX - (damf.BottomMarginWidth * pageFormat.ViewBoxMagnification);
 }
Ejemplo n.º 35
0
        private void SetNotation(PageFormat pageFormat)
        {
            pageFormat.ChordSymbolType = "standard";
            pageFormat.MinimumCrotchetDuration = int.Parse(this.MinimumCrotchetDurationTextBox.Text);
            pageFormat.BeamsCrossBarlines = this.BeamsCrossBarlinesCheckBox.Checked;

            float strokeWidth = float.Parse(StafflineStemStrokeWidthComboBox.Text, M.En_USNumberFormat) * pageFormat.ViewBoxMagnification;
            pageFormat.StafflineStemStrokeWidth = strokeWidth;
            pageFormat.Gap = float.Parse(GapPixelsComboBox.Text, M.En_USNumberFormat) * pageFormat.ViewBoxMagnification;
            pageFormat.DefaultDistanceBetweenStaves = int.Parse(MinimumGapsBetweenStavesTextBox.Text) * pageFormat.Gap;
            pageFormat.DefaultDistanceBetweenSystems = int.Parse(MinimumGapsBetweenSystemsTextBox.Text) * pageFormat.Gap;

            pageFormat.VisibleOutputVoiceIndicesPerStaff = _visibleOutputVoiceIndicesPerStaff; // one value per output staff
            pageFormat.VisibleInputVoiceIndicesPerStaff = _visibleInputVoiceIndicesPerStaff; // one value per input staff
            pageFormat.ClefsList = M.StringToStringList(this.ClefsPerStaffTextBox.Text, ',');
            pageFormat.StafflinesPerStaff = M.StringToIntList(this.StafflinesPerStaffTextBox.Text, ',');
            pageFormat.StaffGroups = M.StringToIntList(this.StaffGroupsTextBox.Text, ',');

            pageFormat.LongStaffNames = M.StringToStringList(this.LongStaffNamesTextBox.Text, ',');
            pageFormat.ShortStaffNames = M.StringToStringList(this.ShortStaffNamesTextBox.Text, ',');
            pageFormat.SystemStartBars = M.StringToIntList(SystemStartBarsTextBox.Text, ',');
        }
Ejemplo n.º 36
0
 private void SetPaperSize(PageFormat pageFormat)
 {
     pageFormat.PaperSize = _dimensionsAndMetadataForm.PaperSize;
     pageFormat.IsLandscape = _dimensionsAndMetadataForm.Landscape;
     int bottomPX;
     int rightPX;
     Debug.Assert(Regex.Matches(pageFormat.PaperSize, @"^(A4|B4|A5|B5|A3|Letter|Legal|Tabloid)$") != null);
     if(pageFormat.IsLandscape == true)
     {
         bottomPX = (int)(pageFormat.VerticalPixelsPerMillimeter * M.PaperSizes[pageFormat.PaperSize].ShortDimension_MM);
         rightPX = (int)(pageFormat.HorizontalPixelsPerMillimeter * M.PaperSizes[pageFormat.PaperSize].LongDimension_MM);
     }
     else
     {
         rightPX = (int)(pageFormat.HorizontalPixelsPerMillimeter * M.PaperSizes[pageFormat.PaperSize].ShortDimension_MM);
         bottomPX = (int)(pageFormat.VerticalPixelsPerMillimeter * M.PaperSizes[pageFormat.PaperSize].LongDimension_MM);
     }
     pageFormat.RightVBPX = rightPX * pageFormat.ViewBoxMagnification;
     pageFormat.BottomVBPX = bottomPX * pageFormat.ViewBoxMagnification;
 }
Ejemplo n.º 37
0
 public SvgScore(string folder, string scoreTitleName, string keywords, string comment, PageFormat pageFormat)
 {
     _pageFormat = pageFormat;
     SetFilePathAndMetadata(folder, scoreTitleName, keywords, comment);
 }
Ejemplo n.º 38
0
        /// <summary>
        /// Sets Chord.Stem.Direction for each chord.
        /// Chords are beamed together, duration classes permitting, unless a rest or clef intervenes.
        /// If a barline intervenes, and beamsCrossBarlines is true, the chords are beamed together.
        /// If a barline intervenes, and beamsCrossBarlines is false, the beam is broken.
        /// </summary>
        public void SetChordStemDirectionsAndCreateBeamBlocks(PageFormat pageFormat)
        {
            List<ChordSymbol> chordsBeamedTogether = new List<ChordSymbol>();
            ClefSymbol currentClef = null;
            bool breakGroup = false;
            ChordSymbol lastChord = null;
            foreach(ChordSymbol cs in ChordSymbols)
                lastChord = cs;

            foreach(NoteObject noteObject in NoteObjects)
            {
                CautionaryChordSymbol cautionaryChord = noteObject as CautionaryChordSymbol;
                ChordSymbol chord = noteObject as ChordSymbol;
                RestSymbol rest = noteObject as RestSymbol;
                ClefSymbol clef = noteObject as ClefSymbol;
                Barline barline = noteObject as Barline;

                if(cautionaryChord != null)
                    continue;

                if(chord != null)
                {
                    if(chord.DurationClass == DurationClass.cautionary
                    || chord.DurationClass == DurationClass.breve
                    || chord.DurationClass == DurationClass.semibreve
                    || chord.DurationClass == DurationClass.minim
                    || chord.DurationClass == DurationClass.crotchet)
                    {
                        if(currentClef != null)
                        {
                            if(this.StemDirection == VerticalDir.none)
                                chord.Stem.Direction = chord.DefaultStemDirection(currentClef);
                            else
                                chord.Stem.Direction = this.StemDirection;
                        }
                        breakGroup = true;
                    }
                    else
                    {
                        chordsBeamedTogether.Add(chord);
                        if(chord.Stem.BeamContinues) // this is true by default
                            breakGroup = false;
                        else
                            breakGroup = true;
                    }
                }

                if(chordsBeamedTogether.Count > 0)
                {
                    if(rest != null)
                    {
                        if(rest.LocalCautionaryChordDef == null)
                            breakGroup = true;
                    }

                    if(clef != null)
                        breakGroup = true;

                    if(barline != null && !pageFormat.BeamsCrossBarlines)
                        breakGroup = true;

                    if(chord == lastChord)
                        breakGroup = true;
                }

                if(chordsBeamedTogether.Count > 0 && breakGroup)
                {
                    if(currentClef != null)
                    {
                        if(chordsBeamedTogether.Count == 1)
                        {
                            if(this.StemDirection == VerticalDir.none)
                                chordsBeamedTogether[0].Stem.Direction = chordsBeamedTogether[0].DefaultStemDirection(currentClef);
                            else
                                chordsBeamedTogether[0].Stem.Direction = this.StemDirection;

                        }
                        else if(chordsBeamedTogether.Count > 1)
                        {
                            float beamThickness = pageFormat.BeamThickness;
                            float beamStrokeThickness = pageFormat.StafflineStemStrokeWidth;
                            if(this is InputVoice)
                            {
                                beamThickness *= pageFormat.InputStavesSizeFactor;
                                beamStrokeThickness *= pageFormat.InputStavesSizeFactor;
                            }
                            chordsBeamedTogether[0].BeamBlock =
                                new BeamBlock(currentClef, chordsBeamedTogether, this.StemDirection, beamThickness, beamStrokeThickness);
                        }
                    }
                    chordsBeamedTogether.Clear();
                }

                if(clef != null)
                    currentClef = clef;
            }
        }
Ejemplo n.º 39
0
        private Dictionary<int, string> GetUpperVoiceClefDict(List<List<VoiceDef>> bars, PageFormat _pageFormat, List<int> visibleLowerVoiceIndices)
        {
            int nVisibleOutputStaves = _pageFormat.VisibleOutputVoiceIndicesPerStaff.Count;
            int nVisibleInputStaves = _pageFormat.VisibleInputVoiceIndicesPerStaff.Count;
            Debug.Assert(_pageFormat.ClefsList.Count == nVisibleOutputStaves + nVisibleInputStaves);

            int nTrks = GetNumberOfTrks(bars[0]);

            Dictionary<int, string> upperVoiceClefDict = new Dictionary<int, string>();
            int clefIndex = 0;
            #region get upperVoiceClefs and visibleLowerVoiceIndices
            for(int i = 0; i < nVisibleOutputStaves; ++i)
            {
                List<byte> visibleOutputVoiceIndicesPerStaff = _pageFormat.VisibleOutputVoiceIndicesPerStaff[i];
                upperVoiceClefDict.Add(visibleOutputVoiceIndicesPerStaff[0], _pageFormat.ClefsList[clefIndex++]);
                if(visibleOutputVoiceIndicesPerStaff.Count > 1)
                {
                    visibleLowerVoiceIndices.Add(visibleOutputVoiceIndicesPerStaff[1]);
                }

            }
            for(int i = 0; i < nVisibleInputStaves; ++i)
            {
                List<byte> visibleInputVoiceIndicesPerStaff = _pageFormat.VisibleInputVoiceIndicesPerStaff[i];
                upperVoiceClefDict.Add(nTrks + visibleInputVoiceIndicesPerStaff[0], _pageFormat.ClefsList[clefIndex++]);
                if(visibleInputVoiceIndicesPerStaff.Count > 1)
                {
                    visibleLowerVoiceIndices.Add(nTrks + visibleInputVoiceIndicesPerStaff[1]);
                }
            }
            for(int i = 0; i < bars[0].Count; ++i)
            {
                if(!upperVoiceClefDict.ContainsKey(i))
                {
                    upperVoiceClefDict.Add(i, "noClef");
                }
            }
            #endregion

            return upperVoiceClefDict;
        }
Ejemplo n.º 40
0
        private float GetLeftMarginPos(SvgSystem system, Graphics graphics, PageFormat pageFormat)
        {
            float leftMarginPos = pageFormat.LeftMarginPos;
            float maxNameWidth = 0;
            foreach(Staff staff in system.Staves)
            {
                foreach(NoteObject noteObject in staff.Voices[0].NoteObjects)
                {
                    Barline firstBarline = noteObject as Barline;
                    if(firstBarline != null)
                    {
                        foreach(DrawObject drawObject in firstBarline.DrawObjects)
                        {
                            StaffNameText staffName = drawObject as StaffNameText;
                            if(staffName != null)
                            {
                                Debug.Assert(staffName.TextInfo != null);

                                TextMetrics staffNameMetrics = new TextMetrics(graphics, null, staffName.TextInfo);
                                float nameWidth = staffNameMetrics.Right - staffNameMetrics.Left;
                                maxNameWidth = (maxNameWidth > nameWidth) ? maxNameWidth : nameWidth;
                            }
                        }
                        break;
                    }
                }
            }
            leftMarginPos = maxNameWidth + (pageFormat.Gap * 2.0F);
            leftMarginPos = (leftMarginPos > pageFormat.LeftMarginPos) ? leftMarginPos : pageFormat.LeftMarginPos;

            return leftMarginPos;
        }