瀏覽代碼

More new files and fixes in files.

Matthias 9 年之前
父節點
當前提交
6f557a402f

+ 16 - 18
src/Common/DataObjects/PointF_2D.ts

@@ -1,19 +1,17 @@
-module PhonicScore.Common.DataObjects {
-    export class PointF_2D {
-        public X: number;
-        public Y: number;
-        constructor(x: number = 0, y: number = 0) {
-            this.X = x;
-            this.Y = y;
-        }
-        public static get Empty(): PointF_2D {
-            return new PointF_2D();
-        }
-        public static pointsAreEqual(p1: PointF_2D, p2: PointF_2D): boolean {
-            return (p1.X == p2.X && p1.Y == p2.Y);
-        }
-        public ToString(): string {
-            return "[" + this.X + ", " + this.Y + "]";
-        }
+export class PointF_2D {
+    public X: number;
+    public Y: number;
+    constructor(x: number = 0, y: number = 0) {
+        this.X = x;
+        this.Y = y;
     }
-}
+    public static get Empty(): PointF_2D {
+        return new PointF_2D();
+    }
+    public static pointsAreEqual(p1: PointF_2D, p2: PointF_2D): boolean {
+        return (p1.X == p2.X && p1.Y == p2.Y);
+    }
+    public ToString(): string {
+        return "[" + this.X + ", " + this.Y + "]";
+    }
+}

+ 20 - 22
src/Common/DataObjects/RectangleF_2D.ts

@@ -1,23 +1,21 @@
-module PhonicScore.Common.DataObjects {
-    export class RectangleF_2D {
-        public X: number;
-        public Y: number;
-        public Width: number;
-        public Height: number;
-        constructor(x: number, y: number, width: number, height: number) {
-            this.X = x;
-            this.Y = y;
-            this.Width = width;
-            this.Height = height;
-        }
-        public static createFromLocationAndSize(location: PointF_2D, size: SizeF_2D): RectangleF_2D {
-            return new RectangleF_2D(location.X, location.Y, size.Width, size.Height);
-        }
-        public get Location(): PointF_2D {
-            return new PointF_2D(this.X, this.Y);
-        }
-        public get Size(): SizeF_2D {
-            return new SizeF_2D(this.Width, this.Height);
-        }
+export class RectangleF_2D {
+    public X: number;
+    public Y: number;
+    public Width: number;
+    public Height: number;
+    constructor(x: number, y: number, width: number, height: number) {
+        this.X = x;
+        this.Y = y;
+        this.Width = width;
+        this.Height = height;
     }
-}
+    public static createFromLocationAndSize(location: PointF_2D, size: SizeF_2D): RectangleF_2D {
+        return new RectangleF_2D(location.X, location.Y, size.Width, size.Height);
+    }
+    public get Location(): PointF_2D {
+        return new PointF_2D(this.X, this.Y);
+    }
+    public get Size(): SizeF_2D {
+        return new SizeF_2D(this.Width, this.Height);
+    }
+}

+ 7 - 9
src/Common/DataObjects/SizeF_2D.ts

@@ -1,10 +1,8 @@
-module PhonicScore.Common.DataObjects {
-    export class SizeF_2D {
-        public Width: number;
-        public Height: number;
-        constructor(width: number, height: number) {
-            this.Width = width;
-            this.Height = height;
-        }
+export class SizeF_2D {
+    public Width: number;
+    public Height: number;
+    constructor(width: number, height: number) {
+        this.Width = width;
+        this.Height = height;
     }
-}
+}

+ 3 - 3
src/MusicalScore/Graphical/BoundingBox.ts

@@ -1,7 +1,7 @@
 import {ArgumentOutOfRangeException} from "../Exceptions";
-import PointF_2D = PhonicScore.Common.DataObjects.PointF_2D;
-import SizeF_2D = PhonicScore.Common.DataObjects.SizeF_2D;
-import RectangleF_2D = PhonicScore.Common.DataObjects.RectangleF_2D;
+import {PointF_2D} from "../../Common/DataObjects/PointF_2D";
+import {SizeF_2D} from "../../Common/DataObjects/SizeF_2D";
+import {RectangleF_2D} from "../../Common/DataObjects/RectangleF_2D";
 export class BoundingBox {
         protected isSymbol: boolean = false;
         protected relativePositionHasBeenSet: boolean;

+ 3 - 4
src/MusicalScore/Graphical/Clickable.ts

@@ -1,5 +1,4 @@
-module PhonicScore.MusicalScore.Graphical {
-    export class Clickable extends GraphicalObject {
-        public DataObject: Object;
-    }
+import {GraphicalObject} from "./GraphicalObject";
+export class Clickable extends GraphicalObject {
+    public DataObject: Object;
 }

+ 1110 - 1112
src/MusicalScore/Graphical/EngravingRules.ts

@@ -1,1119 +1,1117 @@
-module PhonicScore.MusicalScore.Graphical {
-    import PagePlacementEnum = PhonicScore.MusicalScore.Graphical.SheetData.PagePlacementEnum;
-    export class EngravingRules {
-        private static rules: EngravingRules;
-        private static unit: number = 1.0;
-        private samplingUnit: number;
-        private staccatoShorteningFactor: number;
-        private sheetTitleHeight: number;
-        private sheetSubtitleHeight: number;
-        private sheetMinimumDistanceBetweenTitleAndSubtitle: number;
-        private sheetComposerHeight: number;
-        private sheetAuthorHeight: number;
-        private pagePlacementEnum: PagePlacementEnum;
-        private pageHeight: number;
-        private pageTopMargin: number;
-        private pageBottomMargin: number;
-        private pageLeftMargin: number;
-        private pageRightMargin: number;
-        private titleTopDistance: number;
-        private titleBottomDistance: number;
-        private systemDistance: number;
-        private systemLeftMargin: number;
-        private systemRightMargin: number;
-        private firstSystemMargin: number;
-        private systemLabelsRightMargin: number;
-        private systemComposerDistance: number;
-        private instrumentLabelTextHeight: number;
-        private minimumAllowedDistanceBetweenSystems: number;
-        private lastSystemMaxScalingFactor: number;
-        private staffDistance: number;
-        private betweenStaffDistance: number;
-        private staffHeight: number;
-        private betweenStaffLinesDistance: number;
-        private beamWidth: number;
-        private beamSpaceWidth: number;
-        private beamForwardLength: number;
-        private clefLeftMargin: number;
-        private clefRightMargin: number;
-        private betweenKeySymbolsDistance: number;
-        private keyRightMargin: number;
-        private rhythmRightMargin: number;
-        private inStaffClefScalingFactor: number;
-        private distanceBetweenNaturalAndSymbolWhenCancelling: number;
-        private noteHelperLinesOffset: number;
-        private measureLeftMargin: number;
-        private measureRightMargin: number;
-        private distanceBetweenLastInstructionAndRepetitionBarline: number;
-        private arpeggioDistance: number;
-        private idealStemLength: number;
-        private stemNoteHeadBorderYOffset: number;
-        private stemWidth: number;
-        private stemMargin: number;
-        private stemMinLength: number;
-        private stemMaxLength: number;
-        private beamSlopeMaxAngle: number;
-        private stemMinAllowedDistanceBetweenNoteHeadAndBeamLine: number;
-        private graceNoteScalingFactor: number;
-        private graceNoteXOffset: number;
-        private wedgeOpeningLength: number;
-        private wedgeMeasureEndOpeningLength: number;
-        private wedgeMeasureBeginOpeningLength: number;
-        private wedgePlacementAboveY: number;
-        private wedgePlacementBelowY: number;
-        private wedgeHorizontalMargin: number;
-        private wedgeVerticalMargin: number;
-        private distanceOffsetBetweenTwoHorizontallyCrossedWedges: number;
-        private wedgeMinLength: number;
-        private distanceBetweenAdjacentDynamics: number;
-        private tempoChangeMeasureValitidy: number;
-        private tempoContinousFactor: number;
-        private staccatoScalingFactor: number;
-        private betweenDotsDistance: number;
-        private ornamentAccidentalScalingFactor: number;
-        private chordSymbolTextHeight: number;
-        private chordSymbolYOffset: number;
-        private fingeringLabelFontHeight: number;
-        private measureNumberLabelHeight: number;
-        private measureNumberLabelOffset: number;
-        private tupletNumberLabelHeight: number;
-        private tupletNumberYOffset: number;
-        private labelMarginBorderFactor: number;
-        private tupletVerticalLineLength: number;
-        private repetitionEndingLabelHeight: number;
-        private repetitionEndingLabelXOffset: number;
-        private repetitionEndingLabelYOffset: number;
-        private repetitionEndingLineYLowerOffset: number;
-        private repetitionEndingLineYUpperOffset: number;
-        private lyricsHeight: number;
-        private verticalBetweenLyricsDistance: number;
-        private betweenSyllabelMaximumDistance: number;
-        private minimumDistanceBetweenDashes: number;
-        private bezierCurveStepSize: number;
-        private tPower3: number[];
-        private oneMinusTPower3: number[];
-        private factorOne: number[];
-        private factorTwo: number[];
-        private tieGhostObjectWidth: number;
-        private tieYPositionOffsetFactor: number;
-        private minimumNeededXspaceForTieGhostObject: number;
-        private tieHeightMinimum: number;
-        private tieHeightMaximum: number;
-        private tieHeightInterpolationK: number;
-        private tieHeightInterpolationD: number;
-        private slurNoteHeadYOffset: number;
-        private slurStemXOffset: number;
-        private slurSlopeMaxAngle: number;
-        private slurTangentMinAngle: number;
-        private slurTangentMaxAngle: number;
-        private slursStartingAtSameStaffEntryYOffset: number;
-        private instantaniousTempoTextHeight: number;
-        private continuousDynamicTextHeight: number;
-        private moodTextHeight: number;
-        private unknownTextHeight: number;
-        private continuousTempoTextHeight: number;
-        private staffLineWidth: number;
-        private ledgerLineWidth: number;
-        private wedgeLineWidth: number;
-        private tupletLineWidth: number;
-        private lyricUnderscoreLineWidth: number;
-        private systemThinLineWidth: number;
-        private systemBoldLineWidth: number;
-        private systemRepetitionEndingLineWidth: number;
-        private systemDotWidth: number;
-        private distanceBetweenVerticalSystemLines: number;
-        private distanceBetweenDotAndLine: number;
-        private octaveShiftLineWidth: number;
-        private octaveShiftVerticalLineLength: number;
-        private graceLineWidth: number;
-        private minimumStaffLineDistance: number;
-        private minimumCrossedBeamDifferenceMargin: number;
-        private displacedNoteMargin: number;
-        private minNoteDistance: number;
-        private subMeasureXSpacingThreshold: number;
-        private measureDynamicsMaxScalingFactor: number;
-        private maxInstructionsConstValue: number;
-        private noteDistances: number[] = 1.0,1.0,1.3,1.6,2.0,2.5,3.0,4.0;
-        private noteDistancesScalingFactors: number[] = 1.0,2.0,4.0,8.0,16.0,32.0,64.0,128.0;
-        private durationDistanceDict: Dictionary<number, number> = new Dictionary<number, number>();
-        private durationScalingDistanceDict: Dictionary<number, number> = new Dictionary<number, number>();
-        constructor() {
-            this.samplingUnit = EngravingRules.unit * 3;
-            this.sheetTitleHeight = 4.0;
-            this.sheetSubtitleHeight = 2.0;
-            this.sheetMinimumDistanceBetweenTitleAndSubtitle = 1.0;
-            this.sheetComposerHeight = 2.0;
-            this.sheetAuthorHeight = 2.0;
-            this.pagePlacementEnum = PagePlacementEnum.Down;
-            this.pageHeight = 100000.0;
-            this.pageTopMargin = 5.0;
-            this.pageBottomMargin = 5.0;
-            this.pageLeftMargin = 5.0;
-            this.pageRightMargin = 5.0;
-            this.titleTopDistance = 9.0;
-            this.titleBottomDistance = 1.0;
-            this.staffDistance = 7.0;
-            this.betweenStaffDistance = 5.0;
-            this.staffHeight = 4.0;
-            this.betweenStaffLinesDistance = EngravingRules.unit;
-            this.systemDistance = 10.0;
-            this.systemLeftMargin = 0.0;
-            this.systemRightMargin = 0.0;
-            this.firstSystemMargin = 15.0;
-            this.systemLabelsRightMargin = 2.0;
-            this.systemComposerDistance = 2.0;
-            this.instrumentLabelTextHeight = 2;
-            this.minimumAllowedDistanceBetweenSystems = 3.0;
-            this.lastSystemMaxScalingFactor = 1.4;
-            this.beamWidth = EngravingRules.unit / 2.0;
-            this.beamSpaceWidth = EngravingRules.unit / 3.0;
-            this.beamForwardLength = 1.25 * EngravingRules.unit;
-            this.clefLeftMargin = 0.5;
-            this.clefRightMargin = 0.75;
-            this.betweenKeySymbolsDistance = 0.2;
-            this.keyRightMargin = 0.75;
-            this.rhythmRightMargin = 1.25;
-            this.inStaffClefScalingFactor = 0.8;
-            this.distanceBetweenNaturalAndSymbolWhenCancelling = 0.4;
-            this.noteHelperLinesOffset = 0.25;
-            this.measureLeftMargin = 0.7;
-            this.measureRightMargin = 0.0;
-            this.distanceBetweenLastInstructionAndRepetitionBarline = 1.0;
-            this.arpeggioDistance = 0.6;
-            this.staccatoShorteningFactor = 2;
-            this.idealStemLength = 3.0;
-            this.stemNoteHeadBorderYOffset = 0.2;
-            this.stemWidth = 0.13;
-            this.stemMargin = 0.2;
-            this.stemMinLength = 2.5;
-            this.stemMaxLength = 4.5;
-            this.beamSlopeMaxAngle = 10.0;
-            this.stemMinAllowedDistanceBetweenNoteHeadAndBeamLine = 1.0;
-            this.graceNoteScalingFactor = 0.6;
-            this.graceNoteXOffset = 0.2;
-            this.wedgeOpeningLength = 1.2;
-            this.wedgeMeasureEndOpeningLength = 0.75;
-            this.wedgeMeasureBeginOpeningLength = 0.75;
-            this.wedgePlacementAboveY = -1.5;
-            this.wedgePlacementBelowY = 1.5;
-            this.wedgeHorizontalMargin = 0.6;
-            this.wedgeVerticalMargin = 0.5;
-            this.distanceOffsetBetweenTwoHorizontallyCrossedWedges = 0.3;
-            this.wedgeMinLength = 2.0;
-            this.distanceBetweenAdjacentDynamics = 0.75;
-            this.tempoChangeMeasureValitidy = 4;
-            this.tempoContinousFactor = 0.7;
-            this.staccatoScalingFactor = 0.8;
-            this.betweenDotsDistance = 0.8;
-            this.ornamentAccidentalScalingFactor = 0.65;
-            this.chordSymbolTextHeight = 2.0;
-            this.fingeringLabelFontHeight = 1.7;
-            this.measureNumberLabelHeight = 1.5 * EngravingRules.unit;
-            this.measureNumberLabelOffset = 2;
-            this.tupletNumberLabelHeight = 1.5 * EngravingRules.unit;
-            this.tupletNumberYOffset = 0.5;
-            this.labelMarginBorderFactor = 0.1;
-            this.tupletVerticalLineLength = 0.5;
-            this.bezierCurveStepSize = 1000;
-            this.calculateCurveParametersArrays();
-            this.tieGhostObjectWidth = 0.75;
-            this.tieYPositionOffsetFactor = 0.3;
-            this.minimumNeededXspaceForTieGhostObject = 1.0;
-            this.tieHeightMinimum = 0.28;
-            this.tieHeightMaximum = 1.2;
-            this.tieHeightInterpolationK = 0.0288;
-            this.tieHeightInterpolationD = 0.136;
-            this.slurNoteHeadYOffset = 0.5;
-            this.slurStemXOffset = 0.3;
-            this.slurSlopeMaxAngle = 15.0;
-            this.slurTangentMinAngle = 30.0;
-            this.slurTangentMaxAngle = 80.0;
-            this.slursStartingAtSameStaffEntryYOffset = 0.8;
-            this.repetitionEndingLabelHeight = 2.0;
-            this.repetitionEndingLabelXOffset = 0.5;
-            this.repetitionEndingLabelYOffset = 0.3;
-            this.repetitionEndingLineYLowerOffset = 0.5;
-            this.repetitionEndingLineYUpperOffset = 0.3;
-            this.lyricsHeight = 2.0;
-            this.verticalBetweenLyricsDistance = 0.5;
-            this.betweenSyllabelMaximumDistance = 10.0;
-            this.minimumDistanceBetweenDashes = 5.0;
-            this.instantaniousTempoTextHeight = 2.3;
-            this.continuousDynamicTextHeight = 2.3;
-            this.moodTextHeight = 2.3;
-            this.unknownTextHeight = 2.0;
-            this.continuousTempoTextHeight = 2.3;
-            this.staffLineWidth = 0.12;
-            this.ledgerLineWidth = 0.12;
-            this.wedgeLineWidth = 0.12;
-            this.tupletLineWidth = 0.12;
-            this.lyricUnderscoreLineWidth = 0.12;
-            this.systemThinLineWidth = 0.12;
-            this.systemBoldLineWidth = EngravingRules.unit / 2.0;
-            this.systemRepetitionEndingLineWidth = 0.12;
-            this.systemDotWidth = EngravingRules.unit / 5.0;
-            this.distanceBetweenVerticalSystemLines = 0.35;
-            this.distanceBetweenDotAndLine = 0.7;
-            this.octaveShiftLineWidth = 0.12;
-            this.octaveShiftVerticalLineLength = EngravingRules.unit;
-            this.graceLineWidth = this.staffLineWidth * this.GraceNoteScalingFactor;
-            this.minimumStaffLineDistance = 1.0;
-            this.minimumCrossedBeamDifferenceMargin = 0.0001;
-            this.displacedNoteMargin = 0.1;
-            this.minNoteDistance = 2.0;
-            this.subMeasureXSpacingThreshold = 35;
-            this.measureDynamicsMaxScalingFactor = 2.5;
-            this.populateDictionaries();
-            try {
-                this.maxInstructionsConstValue = this.ClefLeftMargin + this.ClefRightMargin + this.KeyRightMargin + this.RhythmRightMargin;
-                if (FontInfo.Info != null) {
-                    this.maxInstructionsConstValue += FontInfo.Info.getBoundingBox(MusicSymbol.G_CLEF).Width + FontInfo.Info.getBoundingBox(MusicSymbol.FOUR).Width + 7 * FontInfo.Info.getBoundingBox(MusicSymbol.SHARP).Width;
-                }
+import PagePlacementEnum = PhonicScore.MusicalScore.Graphical.SheetData.PagePlacementEnum;
+export class EngravingRules {
+    private static rules: EngravingRules;
+    private static unit: number = 1.0;
+    private samplingUnit: number;
+    private staccatoShorteningFactor: number;
+    private sheetTitleHeight: number;
+    private sheetSubtitleHeight: number;
+    private sheetMinimumDistanceBetweenTitleAndSubtitle: number;
+    private sheetComposerHeight: number;
+    private sheetAuthorHeight: number;
+    private pagePlacementEnum: PagePlacementEnum;
+    private pageHeight: number;
+    private pageTopMargin: number;
+    private pageBottomMargin: number;
+    private pageLeftMargin: number;
+    private pageRightMargin: number;
+    private titleTopDistance: number;
+    private titleBottomDistance: number;
+    private systemDistance: number;
+    private systemLeftMargin: number;
+    private systemRightMargin: number;
+    private firstSystemMargin: number;
+    private systemLabelsRightMargin: number;
+    private systemComposerDistance: number;
+    private instrumentLabelTextHeight: number;
+    private minimumAllowedDistanceBetweenSystems: number;
+    private lastSystemMaxScalingFactor: number;
+    private staffDistance: number;
+    private betweenStaffDistance: number;
+    private staffHeight: number;
+    private betweenStaffLinesDistance: number;
+    private beamWidth: number;
+    private beamSpaceWidth: number;
+    private beamForwardLength: number;
+    private clefLeftMargin: number;
+    private clefRightMargin: number;
+    private betweenKeySymbolsDistance: number;
+    private keyRightMargin: number;
+    private rhythmRightMargin: number;
+    private inStaffClefScalingFactor: number;
+    private distanceBetweenNaturalAndSymbolWhenCancelling: number;
+    private noteHelperLinesOffset: number;
+    private measureLeftMargin: number;
+    private measureRightMargin: number;
+    private distanceBetweenLastInstructionAndRepetitionBarline: number;
+    private arpeggioDistance: number;
+    private idealStemLength: number;
+    private stemNoteHeadBorderYOffset: number;
+    private stemWidth: number;
+    private stemMargin: number;
+    private stemMinLength: number;
+    private stemMaxLength: number;
+    private beamSlopeMaxAngle: number;
+    private stemMinAllowedDistanceBetweenNoteHeadAndBeamLine: number;
+    private graceNoteScalingFactor: number;
+    private graceNoteXOffset: number;
+    private wedgeOpeningLength: number;
+    private wedgeMeasureEndOpeningLength: number;
+    private wedgeMeasureBeginOpeningLength: number;
+    private wedgePlacementAboveY: number;
+    private wedgePlacementBelowY: number;
+    private wedgeHorizontalMargin: number;
+    private wedgeVerticalMargin: number;
+    private distanceOffsetBetweenTwoHorizontallyCrossedWedges: number;
+    private wedgeMinLength: number;
+    private distanceBetweenAdjacentDynamics: number;
+    private tempoChangeMeasureValitidy: number;
+    private tempoContinousFactor: number;
+    private staccatoScalingFactor: number;
+    private betweenDotsDistance: number;
+    private ornamentAccidentalScalingFactor: number;
+    private chordSymbolTextHeight: number;
+    private chordSymbolYOffset: number;
+    private fingeringLabelFontHeight: number;
+    private measureNumberLabelHeight: number;
+    private measureNumberLabelOffset: number;
+    private tupletNumberLabelHeight: number;
+    private tupletNumberYOffset: number;
+    private labelMarginBorderFactor: number;
+    private tupletVerticalLineLength: number;
+    private repetitionEndingLabelHeight: number;
+    private repetitionEndingLabelXOffset: number;
+    private repetitionEndingLabelYOffset: number;
+    private repetitionEndingLineYLowerOffset: number;
+    private repetitionEndingLineYUpperOffset: number;
+    private lyricsHeight: number;
+    private verticalBetweenLyricsDistance: number;
+    private betweenSyllabelMaximumDistance: number;
+    private minimumDistanceBetweenDashes: number;
+    private bezierCurveStepSize: number;
+    private tPower3: number[];
+    private oneMinusTPower3: number[];
+    private factorOne: number[];
+    private factorTwo: number[];
+    private tieGhostObjectWidth: number;
+    private tieYPositionOffsetFactor: number;
+    private minimumNeededXspaceForTieGhostObject: number;
+    private tieHeightMinimum: number;
+    private tieHeightMaximum: number;
+    private tieHeightInterpolationK: number;
+    private tieHeightInterpolationD: number;
+    private slurNoteHeadYOffset: number;
+    private slurStemXOffset: number;
+    private slurSlopeMaxAngle: number;
+    private slurTangentMinAngle: number;
+    private slurTangentMaxAngle: number;
+    private slursStartingAtSameStaffEntryYOffset: number;
+    private instantaniousTempoTextHeight: number;
+    private continuousDynamicTextHeight: number;
+    private moodTextHeight: number;
+    private unknownTextHeight: number;
+    private continuousTempoTextHeight: number;
+    private staffLineWidth: number;
+    private ledgerLineWidth: number;
+    private wedgeLineWidth: number;
+    private tupletLineWidth: number;
+    private lyricUnderscoreLineWidth: number;
+    private systemThinLineWidth: number;
+    private systemBoldLineWidth: number;
+    private systemRepetitionEndingLineWidth: number;
+    private systemDotWidth: number;
+    private distanceBetweenVerticalSystemLines: number;
+    private distanceBetweenDotAndLine: number;
+    private octaveShiftLineWidth: number;
+    private octaveShiftVerticalLineLength: number;
+    private graceLineWidth: number;
+    private minimumStaffLineDistance: number;
+    private minimumCrossedBeamDifferenceMargin: number;
+    private displacedNoteMargin: number;
+    private minNoteDistance: number;
+    private subMeasureXSpacingThreshold: number;
+    private measureDynamicsMaxScalingFactor: number;
+    private maxInstructionsConstValue: number;
+    private noteDistances: number[] = 1.0,1.0,1.3,1.6,2.0,2.5,3.0,4.0;
+    private noteDistancesScalingFactors: number[] = 1.0,2.0,4.0,8.0,16.0,32.0,64.0,128.0;
+    private durationDistanceDict: Dictionary<number, number> = new Dictionary<number, number>();
+    private durationScalingDistanceDict: Dictionary<number, number> = new Dictionary<number, number>();
+    constructor() {
+        this.samplingUnit = EngravingRules.unit * 3;
+        this.sheetTitleHeight = 4.0;
+        this.sheetSubtitleHeight = 2.0;
+        this.sheetMinimumDistanceBetweenTitleAndSubtitle = 1.0;
+        this.sheetComposerHeight = 2.0;
+        this.sheetAuthorHeight = 2.0;
+        this.pagePlacementEnum = PagePlacementEnum.Down;
+        this.pageHeight = 100000.0;
+        this.pageTopMargin = 5.0;
+        this.pageBottomMargin = 5.0;
+        this.pageLeftMargin = 5.0;
+        this.pageRightMargin = 5.0;
+        this.titleTopDistance = 9.0;
+        this.titleBottomDistance = 1.0;
+        this.staffDistance = 7.0;
+        this.betweenStaffDistance = 5.0;
+        this.staffHeight = 4.0;
+        this.betweenStaffLinesDistance = EngravingRules.unit;
+        this.systemDistance = 10.0;
+        this.systemLeftMargin = 0.0;
+        this.systemRightMargin = 0.0;
+        this.firstSystemMargin = 15.0;
+        this.systemLabelsRightMargin = 2.0;
+        this.systemComposerDistance = 2.0;
+        this.instrumentLabelTextHeight = 2;
+        this.minimumAllowedDistanceBetweenSystems = 3.0;
+        this.lastSystemMaxScalingFactor = 1.4;
+        this.beamWidth = EngravingRules.unit / 2.0;
+        this.beamSpaceWidth = EngravingRules.unit / 3.0;
+        this.beamForwardLength = 1.25 * EngravingRules.unit;
+        this.clefLeftMargin = 0.5;
+        this.clefRightMargin = 0.75;
+        this.betweenKeySymbolsDistance = 0.2;
+        this.keyRightMargin = 0.75;
+        this.rhythmRightMargin = 1.25;
+        this.inStaffClefScalingFactor = 0.8;
+        this.distanceBetweenNaturalAndSymbolWhenCancelling = 0.4;
+        this.noteHelperLinesOffset = 0.25;
+        this.measureLeftMargin = 0.7;
+        this.measureRightMargin = 0.0;
+        this.distanceBetweenLastInstructionAndRepetitionBarline = 1.0;
+        this.arpeggioDistance = 0.6;
+        this.staccatoShorteningFactor = 2;
+        this.idealStemLength = 3.0;
+        this.stemNoteHeadBorderYOffset = 0.2;
+        this.stemWidth = 0.13;
+        this.stemMargin = 0.2;
+        this.stemMinLength = 2.5;
+        this.stemMaxLength = 4.5;
+        this.beamSlopeMaxAngle = 10.0;
+        this.stemMinAllowedDistanceBetweenNoteHeadAndBeamLine = 1.0;
+        this.graceNoteScalingFactor = 0.6;
+        this.graceNoteXOffset = 0.2;
+        this.wedgeOpeningLength = 1.2;
+        this.wedgeMeasureEndOpeningLength = 0.75;
+        this.wedgeMeasureBeginOpeningLength = 0.75;
+        this.wedgePlacementAboveY = -1.5;
+        this.wedgePlacementBelowY = 1.5;
+        this.wedgeHorizontalMargin = 0.6;
+        this.wedgeVerticalMargin = 0.5;
+        this.distanceOffsetBetweenTwoHorizontallyCrossedWedges = 0.3;
+        this.wedgeMinLength = 2.0;
+        this.distanceBetweenAdjacentDynamics = 0.75;
+        this.tempoChangeMeasureValitidy = 4;
+        this.tempoContinousFactor = 0.7;
+        this.staccatoScalingFactor = 0.8;
+        this.betweenDotsDistance = 0.8;
+        this.ornamentAccidentalScalingFactor = 0.65;
+        this.chordSymbolTextHeight = 2.0;
+        this.fingeringLabelFontHeight = 1.7;
+        this.measureNumberLabelHeight = 1.5 * EngravingRules.unit;
+        this.measureNumberLabelOffset = 2;
+        this.tupletNumberLabelHeight = 1.5 * EngravingRules.unit;
+        this.tupletNumberYOffset = 0.5;
+        this.labelMarginBorderFactor = 0.1;
+        this.tupletVerticalLineLength = 0.5;
+        this.bezierCurveStepSize = 1000;
+        this.calculateCurveParametersArrays();
+        this.tieGhostObjectWidth = 0.75;
+        this.tieYPositionOffsetFactor = 0.3;
+        this.minimumNeededXspaceForTieGhostObject = 1.0;
+        this.tieHeightMinimum = 0.28;
+        this.tieHeightMaximum = 1.2;
+        this.tieHeightInterpolationK = 0.0288;
+        this.tieHeightInterpolationD = 0.136;
+        this.slurNoteHeadYOffset = 0.5;
+        this.slurStemXOffset = 0.3;
+        this.slurSlopeMaxAngle = 15.0;
+        this.slurTangentMinAngle = 30.0;
+        this.slurTangentMaxAngle = 80.0;
+        this.slursStartingAtSameStaffEntryYOffset = 0.8;
+        this.repetitionEndingLabelHeight = 2.0;
+        this.repetitionEndingLabelXOffset = 0.5;
+        this.repetitionEndingLabelYOffset = 0.3;
+        this.repetitionEndingLineYLowerOffset = 0.5;
+        this.repetitionEndingLineYUpperOffset = 0.3;
+        this.lyricsHeight = 2.0;
+        this.verticalBetweenLyricsDistance = 0.5;
+        this.betweenSyllabelMaximumDistance = 10.0;
+        this.minimumDistanceBetweenDashes = 5.0;
+        this.instantaniousTempoTextHeight = 2.3;
+        this.continuousDynamicTextHeight = 2.3;
+        this.moodTextHeight = 2.3;
+        this.unknownTextHeight = 2.0;
+        this.continuousTempoTextHeight = 2.3;
+        this.staffLineWidth = 0.12;
+        this.ledgerLineWidth = 0.12;
+        this.wedgeLineWidth = 0.12;
+        this.tupletLineWidth = 0.12;
+        this.lyricUnderscoreLineWidth = 0.12;
+        this.systemThinLineWidth = 0.12;
+        this.systemBoldLineWidth = EngravingRules.unit / 2.0;
+        this.systemRepetitionEndingLineWidth = 0.12;
+        this.systemDotWidth = EngravingRules.unit / 5.0;
+        this.distanceBetweenVerticalSystemLines = 0.35;
+        this.distanceBetweenDotAndLine = 0.7;
+        this.octaveShiftLineWidth = 0.12;
+        this.octaveShiftVerticalLineLength = EngravingRules.unit;
+        this.graceLineWidth = this.staffLineWidth * this.GraceNoteScalingFactor;
+        this.minimumStaffLineDistance = 1.0;
+        this.minimumCrossedBeamDifferenceMargin = 0.0001;
+        this.displacedNoteMargin = 0.1;
+        this.minNoteDistance = 2.0;
+        this.subMeasureXSpacingThreshold = 35;
+        this.measureDynamicsMaxScalingFactor = 2.5;
+        this.populateDictionaries();
+        try {
+            this.maxInstructionsConstValue = this.ClefLeftMargin + this.ClefRightMargin + this.KeyRightMargin + this.RhythmRightMargin;
+            if (FontInfo.Info != null) {
+                this.maxInstructionsConstValue += FontInfo.Info.getBoundingBox(MusicSymbol.G_CLEF).Width + FontInfo.Info.getBoundingBox(MusicSymbol.FOUR).Width + 7 * FontInfo.Info.getBoundingBox(MusicSymbol.SHARP).Width;
             }
-            catch (ex) {
-                Logger.DefaultLogger.LogError(PhonicScore.Common.Enums.LogLevel.NORMAL, "EngravingRules()", ex);
-            }
-
-        }
-        public static get Rules(): EngravingRules {
-            return EngravingRules.rules != null ? EngravingRules.rules : (EngravingRules.rules = new EngravingRules());
-        }
-        public get SamplingUnit(): number {
-            return this.samplingUnit;
-        }
-        public get SheetTitleHeight(): number {
-            return this.sheetTitleHeight;
-        }
-        public set SheetTitleHeight(value: number) {
-            this.sheetTitleHeight = value;
-        }
-        public get SheetSubtitleHeight(): number {
-            return this.sheetSubtitleHeight;
-        }
-        public set SheetSubtitleHeight(value: number) {
-            this.sheetSubtitleHeight = value;
-        }
-        public get SheetMinimumDistanceBetweenTitleAndSubtitle(): number {
-            return this.sheetMinimumDistanceBetweenTitleAndSubtitle;
-        }
-        public set SheetMinimumDistanceBetweenTitleAndSubtitle(value: number) {
-            this.sheetMinimumDistanceBetweenTitleAndSubtitle = value;
-        }
-        public get SheetComposerHeight(): number {
-            return this.sheetComposerHeight;
-        }
-        public set SheetComposerHeight(value: number) {
-            this.sheetComposerHeight = value;
-        }
-        public get SheetAuthorHeight(): number {
-            return this.sheetAuthorHeight;
-        }
-        public set SheetAuthorHeight(value: number) {
-            this.sheetAuthorHeight = value;
-        }
-        public get PagePlacement(): PagePlacementEnum {
-            return this.pagePlacementEnum;
-        }
-        public set PagePlacement(value: PagePlacementEnum) {
-            this.pagePlacementEnum = value;
-        }
-        public get PageHeight(): number {
-            return this.pageHeight;
-        }
-        public set PageHeight(value: number) {
-            this.pageHeight = value;
-        }
-        public get PageTopMargin(): number {
-            return this.pageTopMargin;
-        }
-        public set PageTopMargin(value: number) {
-            this.pageTopMargin = value;
-        }
-        public get PageBottomMargin(): number {
-            return this.pageBottomMargin;
-        }
-        public set PageBottomMargin(value: number) {
-            this.pageBottomMargin = value;
-        }
-        public get PageLeftMargin(): number {
-            return this.pageLeftMargin;
-        }
-        public set PageLeftMargin(value: number) {
-            this.pageLeftMargin = value;
-        }
-        public get PageRightMargin(): number {
-            return this.pageRightMargin;
-        }
-        public set PageRightMargin(value: number) {
-            this.pageRightMargin = value;
-        }
-        public get TitleTopDistance(): number {
-            return this.titleTopDistance;
-        }
-        public set TitleTopDistance(value: number) {
-            this.titleTopDistance = value;
-        }
-        public get TitleBottomDistance(): number {
-            return this.titleBottomDistance;
-        }
-        public set TitleBottomDistance(value: number) {
-            this.titleBottomDistance = value;
-        }
-        public get SystemComposerDistance(): number {
-            return this.systemComposerDistance;
-        }
-        public set SystemComposerDistance(value: number) {
-            this.systemComposerDistance = value;
-        }
-        public get InstrumentLabelTextHeight(): number {
-            return this.instrumentLabelTextHeight;
-        }
-        public set InstrumentLabelTextHeight(value: number) {
-            this.instrumentLabelTextHeight = value;
-        }
-        public get SystemDistance(): number {
-            return this.systemDistance;
-        }
-        public set SystemDistance(value: number) {
-            this.systemDistance = value;
-        }
-        public get SystemLeftMargin(): number {
-            return this.systemLeftMargin;
-        }
-        public set SystemLeftMargin(value: number) {
-            this.systemLeftMargin = value;
-        }
-        public get SystemRightMargin(): number {
-            return this.systemRightMargin;
-        }
-        public set SystemRightMargin(value: number) {
-            this.systemRightMargin = value;
-        }
-        public get FirstSystemMargin(): number {
-            return this.firstSystemMargin;
-        }
-        public set FirstSystemMargin(value: number) {
-            this.firstSystemMargin = value;
-        }
-        public get SystemLabelsRightMargin(): number {
-            return this.systemLabelsRightMargin;
-        }
-        public get MinimumAllowedDistanceBetweenSystems(): number {
-            return this.minimumAllowedDistanceBetweenSystems;
-        }
-        public set MinimumAllowedDistanceBetweenSystems(value: number) {
-            this.minimumAllowedDistanceBetweenSystems = value;
-        }
-        public get LastSystemMaxScalingFactor(): number {
-            return this.lastSystemMaxScalingFactor;
-        }
-        public set LastSystemMaxScalingFactor(value: number) {
-            this.lastSystemMaxScalingFactor = value;
-        }
-        public get StaffDistance(): number {
-            return this.staffDistance;
-        }
-        public set StaffDistance(value: number) {
-            this.staffDistance = value;
-        }
-        public get BetweenStaffDistance(): number {
-            return this.betweenStaffDistance;
-        }
-        public set BetweenStaffDistance(value: number) {
-            this.betweenStaffDistance = value;
-        }
-        public get StaffHeight(): number {
-            return this.staffHeight;
-        }
-        public set StaffHeight(value: number) {
-            this.staffHeight = value;
-        }
-        public get BetweenStaffLinesDistance(): number {
-            return this.betweenStaffLinesDistance;
-        }
-        public set BetweenStaffLinesDistance(value: number) {
-            this.betweenStaffLinesDistance = value;
-        }
-        public get BeamWidth(): number {
-            return this.beamWidth;
-        }
-        public set BeamWidth(value: number) {
-            this.beamWidth = value;
-        }
-        public get BeamSpaceWidth(): number {
-            return this.beamSpaceWidth;
-        }
-        public set BeamSpaceWidth(value: number) {
-            this.beamSpaceWidth = value;
-        }
-        public get BeamForwardLength(): number {
-            return this.beamForwardLength;
-        }
-        public set BeamForwardLength(value: number) {
-            this.beamForwardLength = value;
-        }
-        public get BetweenKeySymbolsDistance(): number {
-            return this.betweenKeySymbolsDistance;
-        }
-        public set BetweenKeySymbolsDistance(value: number) {
-            this.betweenKeySymbolsDistance = value;
-        }
-        public get ClefLeftMargin(): number {
-            return this.clefLeftMargin;
-        }
-        public set ClefLeftMargin(value: number) {
-            this.clefLeftMargin = value;
-        }
-        public get ClefRightMargin(): number {
-            return this.clefRightMargin;
-        }
-        public set ClefRightMargin(value: number) {
-            this.clefRightMargin = value;
-        }
-        public get KeyRightMargin(): number {
-            return this.keyRightMargin;
-        }
-        public set KeyRightMargin(value: number) {
-            this.keyRightMargin = value;
-        }
-        public get RhythmRightMargin(): number {
-            return this.rhythmRightMargin;
-        }
-        public set RhythmRightMargin(value: number) {
-            this.rhythmRightMargin = value;
-        }
-        public get InStaffClefScalingFactor(): number {
-            return this.inStaffClefScalingFactor;
-        }
-        public set InStaffClefScalingFactor(value: number) {
-            this.inStaffClefScalingFactor = value;
-        }
-        public get DistanceBetweenNaturalAndSymbolWhenCancelling(): number {
-            return this.distanceBetweenNaturalAndSymbolWhenCancelling;
-        }
-        public set DistanceBetweenNaturalAndSymbolWhenCancelling(value: number) {
-            this.distanceBetweenNaturalAndSymbolWhenCancelling = value;
-        }
-        public get NoteHelperLinesOffset(): number {
-            return this.noteHelperLinesOffset;
-        }
-        public set NoteHelperLinesOffset(value: number) {
-            this.noteHelperLinesOffset = value;
-        }
-        public get MeasureLeftMargin(): number {
-            return this.measureLeftMargin;
-        }
-        public set MeasureLeftMargin(value: number) {
-            this.measureLeftMargin = value;
-        }
-        public get MeasureRightMargin(): number {
-            return this.measureRightMargin;
-        }
-        public set MeasureRightMargin(value: number) {
-            this.measureRightMargin = value;
-        }
-        public get DistanceBetweenLastInstructionAndRepetitionBarline(): number {
-            return this.distanceBetweenLastInstructionAndRepetitionBarline;
-        }
-        public set DistanceBetweenLastInstructionAndRepetitionBarline(value: number) {
-            this.distanceBetweenLastInstructionAndRepetitionBarline = value;
-        }
-        public get ArpeggioDistance(): number {
-            return this.arpeggioDistance;
-        }
-        public set ArpeggioDistance(value: number) {
-            this.arpeggioDistance = value;
-        }
-        public get StaccatoShorteningFactor(): number {
-            return this.staccatoShorteningFactor;
-        }
-        public set StaccatoShorteningFactor(value: number) {
-            this.staccatoShorteningFactor = value;
-        }
-        public get IdealStemLength(): number {
-            return this.idealStemLength;
-        }
-        public set IdealStemLength(value: number) {
-            this.idealStemLength = value;
-        }
-        public get StemNoteHeadBorderYOffset(): number {
-            return this.stemNoteHeadBorderYOffset;
-        }
-        public set StemNoteHeadBorderYOffset(value: number) {
-            this.stemNoteHeadBorderYOffset = value;
-        }
-        public get StemWidth(): number {
-            return this.stemWidth;
-        }
-        public set StemWidth(value: number) {
-            this.stemWidth = value;
-        }
-        public get StemMargin(): number {
-            return this.stemMargin;
-        }
-        public set StemMargin(value: number) {
-            this.stemMargin = value;
-        }
-        public get StemMinLength(): number {
-            return this.stemMinLength;
-        }
-        public set StemMinLength(value: number) {
-            this.stemMinLength = value;
-        }
-        public get StemMaxLength(): number {
-            return this.stemMaxLength;
-        }
-        public set StemMaxLength(value: number) {
-            this.stemMaxLength = value;
-        }
-        public get BeamSlopeMaxAngle(): number {
-            return this.beamSlopeMaxAngle;
-        }
-        public set BeamSlopeMaxAngle(value: number) {
-            this.beamSlopeMaxAngle = value;
-        }
-        public get StemMinAllowedDistanceBetweenNoteHeadAndBeamLine(): number {
-            return this.stemMinAllowedDistanceBetweenNoteHeadAndBeamLine;
-        }
-        public set StemMinAllowedDistanceBetweenNoteHeadAndBeamLine(value: number) {
-            this.stemMinAllowedDistanceBetweenNoteHeadAndBeamLine = value;
-        }
-        public get GraceNoteScalingFactor(): number {
-            return this.graceNoteScalingFactor;
-        }
-        public set GraceNoteScalingFactor(value: number) {
-            this.graceNoteScalingFactor = value;
-        }
-        public get GraceNoteXOffset(): number {
-            return this.graceNoteXOffset;
-        }
-        public set GraceNoteXOffset(value: number) {
-            this.graceNoteXOffset = value;
-        }
-        public get WedgeOpeningLength(): number {
-            return this.wedgeOpeningLength;
-        }
-        public set WedgeOpeningLength(value: number) {
-            this.wedgeOpeningLength = value;
-        }
-        public get WedgeMeasureEndOpeningLength(): number {
-            return this.wedgeMeasureEndOpeningLength;
-        }
-        public set WedgeMeasureEndOpeningLength(value: number) {
-            this.wedgeMeasureEndOpeningLength = value;
-        }
-        public get WedgeMeasureBeginOpeningLength(): number {
-            return this.wedgeMeasureBeginOpeningLength;
-        }
-        public set WedgeMeasureBeginOpeningLength(value: number) {
-            this.wedgeMeasureBeginOpeningLength = value;
-        }
-        public get WedgePlacementAboveY(): number {
-            return this.wedgePlacementAboveY;
-        }
-        public set WedgePlacementAboveY(value: number) {
-            this.wedgePlacementAboveY = value;
-        }
-        public get WedgePlacementBelowY(): number {
-            return this.wedgePlacementBelowY;
-        }
-        public set WedgePlacementBelowY(value: number) {
-            this.wedgePlacementBelowY = value;
-        }
-        public get WedgeHorizontalMargin(): number {
-            return this.wedgeHorizontalMargin;
-        }
-        public set WedgeHorizontalMargin(value: number) {
-            this.wedgeHorizontalMargin = value;
-        }
-        public get WedgeVerticalMargin(): number {
-            return this.wedgeVerticalMargin;
-        }
-        public set WedgeVerticalMargin(value: number) {
-            this.wedgeVerticalMargin = value;
-        }
-        public get DistanceOffsetBetweenTwoHorizontallyCrossedWedges(): number {
-            return this.distanceOffsetBetweenTwoHorizontallyCrossedWedges;
-        }
-        public set DistanceOffsetBetweenTwoHorizontallyCrossedWedges(value: number) {
-            this.distanceOffsetBetweenTwoHorizontallyCrossedWedges = value;
-        }
-        public get WedgeMinLength(): number {
-            return this.wedgeMinLength;
-        }
-        public set WedgeMinLength(value: number) {
-            this.wedgeMinLength = value;
-        }
-        public get DistanceBetweenAdjacentDynamics(): number {
-            return this.distanceBetweenAdjacentDynamics;
-        }
-        public set DistanceBetweenAdjacentDynamics(value: number) {
-            this.distanceBetweenAdjacentDynamics = value;
-        }
-        public get TempoChangeMeasureValitidy(): number {
-            return this.tempoChangeMeasureValitidy;
-        }
-        public set TempoChangeMeasureValitidy(value: number) {
-            this.tempoChangeMeasureValitidy = value;
-        }
-        public get TempoContinousFactor(): number {
-            return this.tempoContinousFactor;
-        }
-        public set TempoContinousFactor(value: number) {
-            this.tempoContinousFactor = value;
-        }
-        public get StaccatoScalingFactor(): number {
-            return this.staccatoScalingFactor;
-        }
-        public set StaccatoScalingFactor(value: number) {
-            this.staccatoScalingFactor = value;
-        }
-        public get BetweenDotsDistance(): number {
-            return this.betweenDotsDistance;
-        }
-        public set BetweenDotsDistance(value: number) {
-            this.betweenDotsDistance = value;
-        }
-        public get OrnamentAccidentalScalingFactor(): number {
-            return this.ornamentAccidentalScalingFactor;
-        }
-        public set OrnamentAccidentalScalingFactor(value: number) {
-            this.ornamentAccidentalScalingFactor = value;
-        }
-        public get ChordSymbolTextHeight(): number {
-            return this.chordSymbolTextHeight;
         }
-        public set ChordSymbolTextHeight(value: number) {
-            this.chordSymbolTextHeight = value;
+        catch (ex) {
+            Logger.DefaultLogger.LogError(PhonicScore.Common.Enums.LogLevel.NORMAL, "EngravingRules()", ex);
         }
-        public get FingeringLabelFontHeight(): number {
-            return this.fingeringLabelFontHeight;
-        }
-        public set FingeringLabelFontHeight(value: number) {
-            this.fingeringLabelFontHeight = value;
-        }
-        public get MeasureNumberLabelHeight(): number {
-            return this.measureNumberLabelHeight;
-        }
-        public set MeasureNumberLabelHeight(value: number) {
-            this.measureNumberLabelHeight = value;
-        }
-        public get MeasureNumberLabelOffset(): number {
-            return this.measureNumberLabelOffset;
-        }
-        public set MeasureNumberLabelOffset(value: number) {
-            this.measureNumberLabelOffset = value;
-        }
-        public get TupletNumberLabelHeight(): number {
-            return this.tupletNumberLabelHeight;
-        }
-        public set TupletNumberLabelHeight(value: number) {
-            this.tupletNumberLabelHeight = value;
-        }
-        public get TupletNumberYOffset(): number {
-            return this.tupletNumberYOffset;
-        }
-        public set TupletNumberYOffset(value: number) {
-            this.tupletNumberYOffset = value;
-        }
-        public get LabelMarginBorderFactor(): number {
-            return this.labelMarginBorderFactor;
-        }
-        public set LabelMarginBorderFactor(value: number) {
-            this.labelMarginBorderFactor = value;
-        }
-        public get TupletVerticalLineLength(): number {
-            return this.tupletVerticalLineLength;
-        }
-        public set TupletVerticalLineLength(value: number) {
-            this.tupletVerticalLineLength = value;
-        }
-        public get RepetitionEndingLabelHeight(): number {
-            return this.repetitionEndingLabelHeight;
-        }
-        public set RepetitionEndingLabelHeight(value: number) {
-            this.repetitionEndingLabelHeight = value;
-        }
-        public get RepetitionEndingLabelXOffset(): number {
-            return this.repetitionEndingLabelXOffset;
-        }
-        public set RepetitionEndingLabelXOffset(value: number) {
-            this.repetitionEndingLabelXOffset = value;
-        }
-        public get RepetitionEndingLabelYOffset(): number {
-            return this.repetitionEndingLabelYOffset;
-        }
-        public set RepetitionEndingLabelYOffset(value: number) {
-            this.repetitionEndingLabelYOffset = value;
-        }
-        public get RepetitionEndingLineYLowerOffset(): number {
-            return this.repetitionEndingLineYLowerOffset;
-        }
-        public set RepetitionEndingLineYLowerOffset(value: number) {
-            this.repetitionEndingLineYLowerOffset = value;
-        }
-        public get RepetitionEndingLineYUpperOffset(): number {
-            return this.repetitionEndingLineYUpperOffset;
-        }
-        public set RepetitionEndingLineYUpperOffset(value: number) {
-            this.repetitionEndingLineYUpperOffset = value;
-        }
-        public get LyricsHeight(): number {
-            return this.lyricsHeight;
-        }
-        public set LyricsHeight(value: number) {
-            this.lyricsHeight = value;
-        }
-        public get VerticalBetweenLyricsDistance(): number {
-            return this.verticalBetweenLyricsDistance;
-        }
-        public set VerticalBetweenLyricsDistance(value: number) {
-            this.verticalBetweenLyricsDistance = value;
-        }
-        public get BetweenSyllabelMaximumDistance(): number {
-            return this.betweenSyllabelMaximumDistance;
-        }
-        public set BetweenSyllabelMaximumDistance(value: number) {
-            this.betweenSyllabelMaximumDistance = value;
-        }
-        public get MinimumDistanceBetweenDashes(): number {
-            return this.minimumDistanceBetweenDashes;
-        }
-        public set MinimumDistanceBetweenDashes(value: number) {
-            this.minimumDistanceBetweenDashes = value;
-        }
-        public get BezierCurveStepSize(): number {
-            return this.bezierCurveStepSize;
-        }
-        public set BezierCurveStepSize(value: number) {
-            this.bezierCurveStepSize = value;
-        }
-        public get TPow3(): number[] {
-            return this.tPower3;
-        }
-        public set TPow3(value: number[]) {
-            this.tPower3 = value;
-        }
-        public get OneMinusTPow3(): number[] {
-            return this.oneMinusTPower3;
-        }
-        public set OneMinusTPow3(value: number[]) {
-            this.oneMinusTPower3 = value;
-        }
-        public get BezierFactorOne(): number[] {
-            return this.factorOne;
-        }
-        public set BezierFactorOne(value: number[]) {
-            this.factorOne = value;
-        }
-        public get BezierFactorTwo(): number[] {
-            return this.factorTwo;
-        }
-        public set BezierFactorTwo(value: number[]) {
-            this.factorTwo = value;
-        }
-        public get TieGhostObjectWidth(): number {
-            return this.tieGhostObjectWidth;
-        }
-        public set TieGhostObjectWidth(value: number) {
-            this.tieGhostObjectWidth = value;
-        }
-        public get TieYPositionOffsetFactor(): number {
-            return this.tieYPositionOffsetFactor;
-        }
-        public set TieYPositionOffsetFactor(value: number) {
-            this.tieYPositionOffsetFactor = value;
-        }
-        public get MinimumNeededXspaceForTieGhostObject(): number {
-            return this.minimumNeededXspaceForTieGhostObject;
-        }
-        public set MinimumNeededXspaceForTieGhostObject(value: number) {
-            this.minimumNeededXspaceForTieGhostObject = value;
-        }
-        public get TieHeightMinimum(): number {
-            return this.tieHeightMinimum;
-        }
-        public set TieHeightMinimum(value: number) {
-            this.tieHeightMinimum = value;
-        }
-        public get TieHeightMaximum(): number {
-            return this.tieHeightMaximum;
-        }
-        public set TieHeightMaximum(value: number) {
-            this.tieHeightMaximum = value;
-        }
-        public get TieHeightInterpolationK(): number {
-            return this.tieHeightInterpolationK;
-        }
-        public set TieHeightInterpolationK(value: number) {
-            this.tieHeightInterpolationK = value;
-        }
-        public get TieHeightInterpolationD(): number {
-            return this.tieHeightInterpolationD;
-        }
-        public set TieHeightInterpolationD(value: number) {
-            this.tieHeightInterpolationD = value;
-        }
-        public get SlurNoteHeadYOffset(): number {
-            return this.slurNoteHeadYOffset;
-        }
-        public set SlurNoteHeadYOffset(value: number) {
-            this.slurNoteHeadYOffset = value;
-        }
-        public get SlurStemXOffset(): number {
-            return this.slurStemXOffset;
-        }
-        public set SlurStemXOffset(value: number) {
-            this.slurStemXOffset = value;
-        }
-        public get SlurSlopeMaxAngle(): number {
-            return this.slurSlopeMaxAngle;
-        }
-        public set SlurSlopeMaxAngle(value: number) {
-            this.slurSlopeMaxAngle = value;
-        }
-        public get SlurTangentMinAngle(): number {
-            return this.slurTangentMinAngle;
-        }
-        public set SlurTangentMinAngle(value: number) {
-            this.slurTangentMinAngle = value;
-        }
-        public get SlurTangentMaxAngle(): number {
-            return this.slurTangentMaxAngle;
-        }
-        public set SlurTangentMaxAngle(value: number) {
-            this.slurTangentMaxAngle = value;
-        }
-        public get SlursStartingAtSameStaffEntryYOffset(): number {
-            return this.slursStartingAtSameStaffEntryYOffset;
-        }
-        public set SlursStartingAtSameStaffEntryYOffset(value: number) {
-            this.slursStartingAtSameStaffEntryYOffset = value;
-        }
-        public get InstantaniousTempoTextHeight(): number {
-            return this.instantaniousTempoTextHeight;
-        }
-        public set InstantaniousTempoTextHeight(value: number) {
-            this.instantaniousTempoTextHeight = value;
-        }
-        public get ContinuousDynamicTextHeight(): number {
-            return this.continuousDynamicTextHeight;
-        }
-        public set ContinuousDynamicTextHeight(value: number) {
-            this.continuousDynamicTextHeight = value;
-        }
-        public get MoodTextHeight(): number {
-            return this.moodTextHeight;
-        }
-        public set MoodTextHeight(value: number) {
-            this.moodTextHeight = value;
-        }
-        public get ContinuousTempoTextHeight(): number {
-            return this.continuousTempoTextHeight;
-        }
-        public set ContinuousTempoTextHeight(value: number) {
-            this.continuousTempoTextHeight = value;
-        }
-        public get UnknownTextHeight(): number {
-            return this.unknownTextHeight;
-        }
-        public set UnknownTextHeight(value: number) {
-            this.unknownTextHeight = value;
-        }
-        public get StaffLineWidth(): number {
-            return this.staffLineWidth;
-        }
-        public set StaffLineWidth(value: number) {
-            this.staffLineWidth = value;
-        }
-        public get LedgerLineWidth(): number {
-            return this.ledgerLineWidth;
-        }
-        public set LedgerLineWidth(value: number) {
-            this.ledgerLineWidth = value;
-        }
-        public get WedgeLineWidth(): number {
-            return this.wedgeLineWidth;
-        }
-        public set WedgeLineWidth(value: number) {
-            this.wedgeLineWidth = value;
-        }
-        public get TupletLineWidth(): number {
-            return this.tupletLineWidth;
-        }
-        public set TupletLineWidth(value: number) {
-            this.tupletLineWidth = value;
-        }
-        public get LyricUnderscoreLineWidth(): number {
-            return this.lyricUnderscoreLineWidth;
-        }
-        public set LyricUnderscoreLineWidth(value: number) {
-            this.lyricUnderscoreLineWidth = value;
-        }
-        public get SystemThinLineWidth(): number {
-            return this.systemThinLineWidth;
-        }
-        public set SystemThinLineWidth(value: number) {
-            this.systemThinLineWidth = value;
-        }
-        public get SystemBoldLineWidth(): number {
-            return this.systemBoldLineWidth;
-        }
-        public set SystemBoldLineWidth(value: number) {
-            this.systemBoldLineWidth = value;
-        }
-        public get SystemRepetitionEndingLineWidth(): number {
-            return this.systemRepetitionEndingLineWidth;
-        }
-        public set SystemRepetitionEndingLineWidth(value: number) {
-            this.systemRepetitionEndingLineWidth = value;
-        }
-        public get SystemDotWidth(): number {
-            return this.systemDotWidth;
-        }
-        public set SystemDotWidth(value: number) {
-            this.systemDotWidth = value;
-        }
-        public get DistanceBetweenVerticalSystemLines(): number {
-            return this.distanceBetweenVerticalSystemLines;
-        }
-        public set DistanceBetweenVerticalSystemLines(value: number) {
-            this.distanceBetweenVerticalSystemLines = value;
-        }
-        public get DistanceBetweenDotAndLine(): number {
-            return this.distanceBetweenDotAndLine;
-        }
-        public set DistanceBetweenDotAndLine(value: number) {
-            this.distanceBetweenDotAndLine = value;
-        }
-        public get OctaveShiftLineWidth(): number {
-            return this.octaveShiftLineWidth;
-        }
-        public set OctaveShiftLineWidth(value: number) {
-            this.octaveShiftLineWidth = value;
-        }
-        public get OctaveShiftVerticalLineLength(): number {
-            return this.octaveShiftVerticalLineLength;
-        }
-        public set OctaveShiftVerticalLineLength(value: number) {
-            this.octaveShiftVerticalLineLength = value;
-        }
-        public get GraceLineWidth(): number {
-            return this.graceLineWidth;
-        }
-        public set GraceLineWidth(value: number) {
-            this.graceLineWidth = value;
-        }
-        public get MinimumStaffLineDistance(): number {
-            return this.minimumStaffLineDistance;
-        }
-        public set MinimumStaffLineDistance(value: number) {
-            this.minimumStaffLineDistance = value;
-        }
-        public get MinimumCrossedBeamDifferenceMargin(): number {
-            return this.minimumCrossedBeamDifferenceMargin;
-        }
-        public set MinimumCrossedBeamDifferenceMargin(value: number) {
-            this.minimumCrossedBeamDifferenceMargin = value;
-        }
-        public get DisplacedNoteMargin(): number {
-            return this.displacedNoteMargin;
-        }
-        public set DisplacedNoteMargin(value: number) {
-            this.displacedNoteMargin = value;
-        }
-        public get MinNoteDistance(): number {
-            return this.minNoteDistance;
-        }
-        public set MinNoteDistance(value: number) {
-            this.minNoteDistance = value;
-        }
-        public get SubMeasureXSpacingThreshold(): number {
-            return this.subMeasureXSpacingThreshold;
-        }
-        public set SubMeasureXSpacingThreshold(value: number) {
-            this.subMeasureXSpacingThreshold = value;
-        }
-        public get MeasureDynamicsMaxScalingFactor(): number {
-            return this.measureDynamicsMaxScalingFactor;
-        }
-        public set MeasureDynamicsMaxScalingFactor(value: number) {
-            this.measureDynamicsMaxScalingFactor = value;
-        }
-        public get MaxInstructionsConstValue(): number {
-            return this.maxInstructionsConstValue;
-        }
-        public set MaxInstructionsConstValue(value: number) {
-            this.maxInstructionsConstValue = value;
-        }
-        public get NoteDistances(): number[] {
-            return this.noteDistances;
-        }
-        public set NoteDistances(value: number[]) {
-            this.noteDistances = value;
-        }
-        public get NoteDistancesScalingFactors(): number[] {
-            return this.noteDistancesScalingFactors;
-        }
-        public set NoteDistancesScalingFactors(value: number[]) {
-            this.noteDistancesScalingFactors = value;
-        }
-        public get DurationDistanceDict(): Dictionary<number, number> {
-            return this.durationDistanceDict;
-        }
-        public get DurationScalingDistanceDict(): Dictionary<number, number> {
-            return this.durationScalingDistanceDict;
-        }
-        private populateDictionaries(): void {
-            for (var i: number = 0; i < this.noteDistances.length; i++) {
-                switch (i) {
-                    case 0:
-                        this.durationDistanceDict.Add(0.015625, this.noteDistances[i]);
-                        this.durationScalingDistanceDict.Add(0.015625, this.noteDistancesScalingFactors[i]);
-                        break;
-                    case 1:
-                        this.durationDistanceDict.Add(0.03125, this.noteDistances[i]);
-                        this.durationScalingDistanceDict.Add(0.03125, this.noteDistancesScalingFactors[i]);
-                        break;
-                    case 2:
-                        this.durationDistanceDict.Add(0.0625, this.noteDistances[i]);
-                        this.durationScalingDistanceDict.Add(0.0625, this.noteDistancesScalingFactors[i]);
-                        break;
-                    case 3:
-                        this.durationDistanceDict.Add(0.125, this.noteDistances[i]);
-                        this.durationScalingDistanceDict.Add(0.125, this.noteDistancesScalingFactors[i]);
-                        break;
-                    case 4:
-                        this.durationDistanceDict.Add(0.25, this.noteDistances[i]);
-                        this.durationScalingDistanceDict.Add(0.25, this.noteDistancesScalingFactors[i]);
-                        break;
-                    case 5:
-                        this.durationDistanceDict.Add(0.5, this.noteDistances[i]);
-                        this.durationScalingDistanceDict.Add(0.5, this.noteDistancesScalingFactors[i]);
-                        break;
-                    case 6:
-                        this.durationDistanceDict.Add(1.0, this.noteDistances[i]);
-                        this.durationScalingDistanceDict.Add(1.0, this.noteDistancesScalingFactors[i]);
-                        break;
-                    case 7:
-                        this.durationDistanceDict.Add(2.0, this.noteDistances[i]);
-                        this.durationScalingDistanceDict.Add(2.0, this.noteDistancesScalingFactors[i]);
-                        break;
-                }
+
+    }
+    public static get Rules(): EngravingRules {
+        return EngravingRules.rules != null ? EngravingRules.rules : (EngravingRules.rules = new EngravingRules());
+    }
+    public get SamplingUnit(): number {
+        return this.samplingUnit;
+    }
+    public get SheetTitleHeight(): number {
+        return this.sheetTitleHeight;
+    }
+    public set SheetTitleHeight(value: number) {
+        this.sheetTitleHeight = value;
+    }
+    public get SheetSubtitleHeight(): number {
+        return this.sheetSubtitleHeight;
+    }
+    public set SheetSubtitleHeight(value: number) {
+        this.sheetSubtitleHeight = value;
+    }
+    public get SheetMinimumDistanceBetweenTitleAndSubtitle(): number {
+        return this.sheetMinimumDistanceBetweenTitleAndSubtitle;
+    }
+    public set SheetMinimumDistanceBetweenTitleAndSubtitle(value: number) {
+        this.sheetMinimumDistanceBetweenTitleAndSubtitle = value;
+    }
+    public get SheetComposerHeight(): number {
+        return this.sheetComposerHeight;
+    }
+    public set SheetComposerHeight(value: number) {
+        this.sheetComposerHeight = value;
+    }
+    public get SheetAuthorHeight(): number {
+        return this.sheetAuthorHeight;
+    }
+    public set SheetAuthorHeight(value: number) {
+        this.sheetAuthorHeight = value;
+    }
+    public get PagePlacement(): PagePlacementEnum {
+        return this.pagePlacementEnum;
+    }
+    public set PagePlacement(value: PagePlacementEnum) {
+        this.pagePlacementEnum = value;
+    }
+    public get PageHeight(): number {
+        return this.pageHeight;
+    }
+    public set PageHeight(value: number) {
+        this.pageHeight = value;
+    }
+    public get PageTopMargin(): number {
+        return this.pageTopMargin;
+    }
+    public set PageTopMargin(value: number) {
+        this.pageTopMargin = value;
+    }
+    public get PageBottomMargin(): number {
+        return this.pageBottomMargin;
+    }
+    public set PageBottomMargin(value: number) {
+        this.pageBottomMargin = value;
+    }
+    public get PageLeftMargin(): number {
+        return this.pageLeftMargin;
+    }
+    public set PageLeftMargin(value: number) {
+        this.pageLeftMargin = value;
+    }
+    public get PageRightMargin(): number {
+        return this.pageRightMargin;
+    }
+    public set PageRightMargin(value: number) {
+        this.pageRightMargin = value;
+    }
+    public get TitleTopDistance(): number {
+        return this.titleTopDistance;
+    }
+    public set TitleTopDistance(value: number) {
+        this.titleTopDistance = value;
+    }
+    public get TitleBottomDistance(): number {
+        return this.titleBottomDistance;
+    }
+    public set TitleBottomDistance(value: number) {
+        this.titleBottomDistance = value;
+    }
+    public get SystemComposerDistance(): number {
+        return this.systemComposerDistance;
+    }
+    public set SystemComposerDistance(value: number) {
+        this.systemComposerDistance = value;
+    }
+    public get InstrumentLabelTextHeight(): number {
+        return this.instrumentLabelTextHeight;
+    }
+    public set InstrumentLabelTextHeight(value: number) {
+        this.instrumentLabelTextHeight = value;
+    }
+    public get SystemDistance(): number {
+        return this.systemDistance;
+    }
+    public set SystemDistance(value: number) {
+        this.systemDistance = value;
+    }
+    public get SystemLeftMargin(): number {
+        return this.systemLeftMargin;
+    }
+    public set SystemLeftMargin(value: number) {
+        this.systemLeftMargin = value;
+    }
+    public get SystemRightMargin(): number {
+        return this.systemRightMargin;
+    }
+    public set SystemRightMargin(value: number) {
+        this.systemRightMargin = value;
+    }
+    public get FirstSystemMargin(): number {
+        return this.firstSystemMargin;
+    }
+    public set FirstSystemMargin(value: number) {
+        this.firstSystemMargin = value;
+    }
+    public get SystemLabelsRightMargin(): number {
+        return this.systemLabelsRightMargin;
+    }
+    public get MinimumAllowedDistanceBetweenSystems(): number {
+        return this.minimumAllowedDistanceBetweenSystems;
+    }
+    public set MinimumAllowedDistanceBetweenSystems(value: number) {
+        this.minimumAllowedDistanceBetweenSystems = value;
+    }
+    public get LastSystemMaxScalingFactor(): number {
+        return this.lastSystemMaxScalingFactor;
+    }
+    public set LastSystemMaxScalingFactor(value: number) {
+        this.lastSystemMaxScalingFactor = value;
+    }
+    public get StaffDistance(): number {
+        return this.staffDistance;
+    }
+    public set StaffDistance(value: number) {
+        this.staffDistance = value;
+    }
+    public get BetweenStaffDistance(): number {
+        return this.betweenStaffDistance;
+    }
+    public set BetweenStaffDistance(value: number) {
+        this.betweenStaffDistance = value;
+    }
+    public get StaffHeight(): number {
+        return this.staffHeight;
+    }
+    public set StaffHeight(value: number) {
+        this.staffHeight = value;
+    }
+    public get BetweenStaffLinesDistance(): number {
+        return this.betweenStaffLinesDistance;
+    }
+    public set BetweenStaffLinesDistance(value: number) {
+        this.betweenStaffLinesDistance = value;
+    }
+    public get BeamWidth(): number {
+        return this.beamWidth;
+    }
+    public set BeamWidth(value: number) {
+        this.beamWidth = value;
+    }
+    public get BeamSpaceWidth(): number {
+        return this.beamSpaceWidth;
+    }
+    public set BeamSpaceWidth(value: number) {
+        this.beamSpaceWidth = value;
+    }
+    public get BeamForwardLength(): number {
+        return this.beamForwardLength;
+    }
+    public set BeamForwardLength(value: number) {
+        this.beamForwardLength = value;
+    }
+    public get BetweenKeySymbolsDistance(): number {
+        return this.betweenKeySymbolsDistance;
+    }
+    public set BetweenKeySymbolsDistance(value: number) {
+        this.betweenKeySymbolsDistance = value;
+    }
+    public get ClefLeftMargin(): number {
+        return this.clefLeftMargin;
+    }
+    public set ClefLeftMargin(value: number) {
+        this.clefLeftMargin = value;
+    }
+    public get ClefRightMargin(): number {
+        return this.clefRightMargin;
+    }
+    public set ClefRightMargin(value: number) {
+        this.clefRightMargin = value;
+    }
+    public get KeyRightMargin(): number {
+        return this.keyRightMargin;
+    }
+    public set KeyRightMargin(value: number) {
+        this.keyRightMargin = value;
+    }
+    public get RhythmRightMargin(): number {
+        return this.rhythmRightMargin;
+    }
+    public set RhythmRightMargin(value: number) {
+        this.rhythmRightMargin = value;
+    }
+    public get InStaffClefScalingFactor(): number {
+        return this.inStaffClefScalingFactor;
+    }
+    public set InStaffClefScalingFactor(value: number) {
+        this.inStaffClefScalingFactor = value;
+    }
+    public get DistanceBetweenNaturalAndSymbolWhenCancelling(): number {
+        return this.distanceBetweenNaturalAndSymbolWhenCancelling;
+    }
+    public set DistanceBetweenNaturalAndSymbolWhenCancelling(value: number) {
+        this.distanceBetweenNaturalAndSymbolWhenCancelling = value;
+    }
+    public get NoteHelperLinesOffset(): number {
+        return this.noteHelperLinesOffset;
+    }
+    public set NoteHelperLinesOffset(value: number) {
+        this.noteHelperLinesOffset = value;
+    }
+    public get MeasureLeftMargin(): number {
+        return this.measureLeftMargin;
+    }
+    public set MeasureLeftMargin(value: number) {
+        this.measureLeftMargin = value;
+    }
+    public get MeasureRightMargin(): number {
+        return this.measureRightMargin;
+    }
+    public set MeasureRightMargin(value: number) {
+        this.measureRightMargin = value;
+    }
+    public get DistanceBetweenLastInstructionAndRepetitionBarline(): number {
+        return this.distanceBetweenLastInstructionAndRepetitionBarline;
+    }
+    public set DistanceBetweenLastInstructionAndRepetitionBarline(value: number) {
+        this.distanceBetweenLastInstructionAndRepetitionBarline = value;
+    }
+    public get ArpeggioDistance(): number {
+        return this.arpeggioDistance;
+    }
+    public set ArpeggioDistance(value: number) {
+        this.arpeggioDistance = value;
+    }
+    public get StaccatoShorteningFactor(): number {
+        return this.staccatoShorteningFactor;
+    }
+    public set StaccatoShorteningFactor(value: number) {
+        this.staccatoShorteningFactor = value;
+    }
+    public get IdealStemLength(): number {
+        return this.idealStemLength;
+    }
+    public set IdealStemLength(value: number) {
+        this.idealStemLength = value;
+    }
+    public get StemNoteHeadBorderYOffset(): number {
+        return this.stemNoteHeadBorderYOffset;
+    }
+    public set StemNoteHeadBorderYOffset(value: number) {
+        this.stemNoteHeadBorderYOffset = value;
+    }
+    public get StemWidth(): number {
+        return this.stemWidth;
+    }
+    public set StemWidth(value: number) {
+        this.stemWidth = value;
+    }
+    public get StemMargin(): number {
+        return this.stemMargin;
+    }
+    public set StemMargin(value: number) {
+        this.stemMargin = value;
+    }
+    public get StemMinLength(): number {
+        return this.stemMinLength;
+    }
+    public set StemMinLength(value: number) {
+        this.stemMinLength = value;
+    }
+    public get StemMaxLength(): number {
+        return this.stemMaxLength;
+    }
+    public set StemMaxLength(value: number) {
+        this.stemMaxLength = value;
+    }
+    public get BeamSlopeMaxAngle(): number {
+        return this.beamSlopeMaxAngle;
+    }
+    public set BeamSlopeMaxAngle(value: number) {
+        this.beamSlopeMaxAngle = value;
+    }
+    public get StemMinAllowedDistanceBetweenNoteHeadAndBeamLine(): number {
+        return this.stemMinAllowedDistanceBetweenNoteHeadAndBeamLine;
+    }
+    public set StemMinAllowedDistanceBetweenNoteHeadAndBeamLine(value: number) {
+        this.stemMinAllowedDistanceBetweenNoteHeadAndBeamLine = value;
+    }
+    public get GraceNoteScalingFactor(): number {
+        return this.graceNoteScalingFactor;
+    }
+    public set GraceNoteScalingFactor(value: number) {
+        this.graceNoteScalingFactor = value;
+    }
+    public get GraceNoteXOffset(): number {
+        return this.graceNoteXOffset;
+    }
+    public set GraceNoteXOffset(value: number) {
+        this.graceNoteXOffset = value;
+    }
+    public get WedgeOpeningLength(): number {
+        return this.wedgeOpeningLength;
+    }
+    public set WedgeOpeningLength(value: number) {
+        this.wedgeOpeningLength = value;
+    }
+    public get WedgeMeasureEndOpeningLength(): number {
+        return this.wedgeMeasureEndOpeningLength;
+    }
+    public set WedgeMeasureEndOpeningLength(value: number) {
+        this.wedgeMeasureEndOpeningLength = value;
+    }
+    public get WedgeMeasureBeginOpeningLength(): number {
+        return this.wedgeMeasureBeginOpeningLength;
+    }
+    public set WedgeMeasureBeginOpeningLength(value: number) {
+        this.wedgeMeasureBeginOpeningLength = value;
+    }
+    public get WedgePlacementAboveY(): number {
+        return this.wedgePlacementAboveY;
+    }
+    public set WedgePlacementAboveY(value: number) {
+        this.wedgePlacementAboveY = value;
+    }
+    public get WedgePlacementBelowY(): number {
+        return this.wedgePlacementBelowY;
+    }
+    public set WedgePlacementBelowY(value: number) {
+        this.wedgePlacementBelowY = value;
+    }
+    public get WedgeHorizontalMargin(): number {
+        return this.wedgeHorizontalMargin;
+    }
+    public set WedgeHorizontalMargin(value: number) {
+        this.wedgeHorizontalMargin = value;
+    }
+    public get WedgeVerticalMargin(): number {
+        return this.wedgeVerticalMargin;
+    }
+    public set WedgeVerticalMargin(value: number) {
+        this.wedgeVerticalMargin = value;
+    }
+    public get DistanceOffsetBetweenTwoHorizontallyCrossedWedges(): number {
+        return this.distanceOffsetBetweenTwoHorizontallyCrossedWedges;
+    }
+    public set DistanceOffsetBetweenTwoHorizontallyCrossedWedges(value: number) {
+        this.distanceOffsetBetweenTwoHorizontallyCrossedWedges = value;
+    }
+    public get WedgeMinLength(): number {
+        return this.wedgeMinLength;
+    }
+    public set WedgeMinLength(value: number) {
+        this.wedgeMinLength = value;
+    }
+    public get DistanceBetweenAdjacentDynamics(): number {
+        return this.distanceBetweenAdjacentDynamics;
+    }
+    public set DistanceBetweenAdjacentDynamics(value: number) {
+        this.distanceBetweenAdjacentDynamics = value;
+    }
+    public get TempoChangeMeasureValitidy(): number {
+        return this.tempoChangeMeasureValitidy;
+    }
+    public set TempoChangeMeasureValitidy(value: number) {
+        this.tempoChangeMeasureValitidy = value;
+    }
+    public get TempoContinousFactor(): number {
+        return this.tempoContinousFactor;
+    }
+    public set TempoContinousFactor(value: number) {
+        this.tempoContinousFactor = value;
+    }
+    public get StaccatoScalingFactor(): number {
+        return this.staccatoScalingFactor;
+    }
+    public set StaccatoScalingFactor(value: number) {
+        this.staccatoScalingFactor = value;
+    }
+    public get BetweenDotsDistance(): number {
+        return this.betweenDotsDistance;
+    }
+    public set BetweenDotsDistance(value: number) {
+        this.betweenDotsDistance = value;
+    }
+    public get OrnamentAccidentalScalingFactor(): number {
+        return this.ornamentAccidentalScalingFactor;
+    }
+    public set OrnamentAccidentalScalingFactor(value: number) {
+        this.ornamentAccidentalScalingFactor = value;
+    }
+    public get ChordSymbolTextHeight(): number {
+        return this.chordSymbolTextHeight;
+    }
+    public set ChordSymbolTextHeight(value: number) {
+        this.chordSymbolTextHeight = value;
+    }
+    public get FingeringLabelFontHeight(): number {
+        return this.fingeringLabelFontHeight;
+    }
+    public set FingeringLabelFontHeight(value: number) {
+        this.fingeringLabelFontHeight = value;
+    }
+    public get MeasureNumberLabelHeight(): number {
+        return this.measureNumberLabelHeight;
+    }
+    public set MeasureNumberLabelHeight(value: number) {
+        this.measureNumberLabelHeight = value;
+    }
+    public get MeasureNumberLabelOffset(): number {
+        return this.measureNumberLabelOffset;
+    }
+    public set MeasureNumberLabelOffset(value: number) {
+        this.measureNumberLabelOffset = value;
+    }
+    public get TupletNumberLabelHeight(): number {
+        return this.tupletNumberLabelHeight;
+    }
+    public set TupletNumberLabelHeight(value: number) {
+        this.tupletNumberLabelHeight = value;
+    }
+    public get TupletNumberYOffset(): number {
+        return this.tupletNumberYOffset;
+    }
+    public set TupletNumberYOffset(value: number) {
+        this.tupletNumberYOffset = value;
+    }
+    public get LabelMarginBorderFactor(): number {
+        return this.labelMarginBorderFactor;
+    }
+    public set LabelMarginBorderFactor(value: number) {
+        this.labelMarginBorderFactor = value;
+    }
+    public get TupletVerticalLineLength(): number {
+        return this.tupletVerticalLineLength;
+    }
+    public set TupletVerticalLineLength(value: number) {
+        this.tupletVerticalLineLength = value;
+    }
+    public get RepetitionEndingLabelHeight(): number {
+        return this.repetitionEndingLabelHeight;
+    }
+    public set RepetitionEndingLabelHeight(value: number) {
+        this.repetitionEndingLabelHeight = value;
+    }
+    public get RepetitionEndingLabelXOffset(): number {
+        return this.repetitionEndingLabelXOffset;
+    }
+    public set RepetitionEndingLabelXOffset(value: number) {
+        this.repetitionEndingLabelXOffset = value;
+    }
+    public get RepetitionEndingLabelYOffset(): number {
+        return this.repetitionEndingLabelYOffset;
+    }
+    public set RepetitionEndingLabelYOffset(value: number) {
+        this.repetitionEndingLabelYOffset = value;
+    }
+    public get RepetitionEndingLineYLowerOffset(): number {
+        return this.repetitionEndingLineYLowerOffset;
+    }
+    public set RepetitionEndingLineYLowerOffset(value: number) {
+        this.repetitionEndingLineYLowerOffset = value;
+    }
+    public get RepetitionEndingLineYUpperOffset(): number {
+        return this.repetitionEndingLineYUpperOffset;
+    }
+    public set RepetitionEndingLineYUpperOffset(value: number) {
+        this.repetitionEndingLineYUpperOffset = value;
+    }
+    public get LyricsHeight(): number {
+        return this.lyricsHeight;
+    }
+    public set LyricsHeight(value: number) {
+        this.lyricsHeight = value;
+    }
+    public get VerticalBetweenLyricsDistance(): number {
+        return this.verticalBetweenLyricsDistance;
+    }
+    public set VerticalBetweenLyricsDistance(value: number) {
+        this.verticalBetweenLyricsDistance = value;
+    }
+    public get BetweenSyllabelMaximumDistance(): number {
+        return this.betweenSyllabelMaximumDistance;
+    }
+    public set BetweenSyllabelMaximumDistance(value: number) {
+        this.betweenSyllabelMaximumDistance = value;
+    }
+    public get MinimumDistanceBetweenDashes(): number {
+        return this.minimumDistanceBetweenDashes;
+    }
+    public set MinimumDistanceBetweenDashes(value: number) {
+        this.minimumDistanceBetweenDashes = value;
+    }
+    public get BezierCurveStepSize(): number {
+        return this.bezierCurveStepSize;
+    }
+    public set BezierCurveStepSize(value: number) {
+        this.bezierCurveStepSize = value;
+    }
+    public get TPow3(): number[] {
+        return this.tPower3;
+    }
+    public set TPow3(value: number[]) {
+        this.tPower3 = value;
+    }
+    public get OneMinusTPow3(): number[] {
+        return this.oneMinusTPower3;
+    }
+    public set OneMinusTPow3(value: number[]) {
+        this.oneMinusTPower3 = value;
+    }
+    public get BezierFactorOne(): number[] {
+        return this.factorOne;
+    }
+    public set BezierFactorOne(value: number[]) {
+        this.factorOne = value;
+    }
+    public get BezierFactorTwo(): number[] {
+        return this.factorTwo;
+    }
+    public set BezierFactorTwo(value: number[]) {
+        this.factorTwo = value;
+    }
+    public get TieGhostObjectWidth(): number {
+        return this.tieGhostObjectWidth;
+    }
+    public set TieGhostObjectWidth(value: number) {
+        this.tieGhostObjectWidth = value;
+    }
+    public get TieYPositionOffsetFactor(): number {
+        return this.tieYPositionOffsetFactor;
+    }
+    public set TieYPositionOffsetFactor(value: number) {
+        this.tieYPositionOffsetFactor = value;
+    }
+    public get MinimumNeededXspaceForTieGhostObject(): number {
+        return this.minimumNeededXspaceForTieGhostObject;
+    }
+    public set MinimumNeededXspaceForTieGhostObject(value: number) {
+        this.minimumNeededXspaceForTieGhostObject = value;
+    }
+    public get TieHeightMinimum(): number {
+        return this.tieHeightMinimum;
+    }
+    public set TieHeightMinimum(value: number) {
+        this.tieHeightMinimum = value;
+    }
+    public get TieHeightMaximum(): number {
+        return this.tieHeightMaximum;
+    }
+    public set TieHeightMaximum(value: number) {
+        this.tieHeightMaximum = value;
+    }
+    public get TieHeightInterpolationK(): number {
+        return this.tieHeightInterpolationK;
+    }
+    public set TieHeightInterpolationK(value: number) {
+        this.tieHeightInterpolationK = value;
+    }
+    public get TieHeightInterpolationD(): number {
+        return this.tieHeightInterpolationD;
+    }
+    public set TieHeightInterpolationD(value: number) {
+        this.tieHeightInterpolationD = value;
+    }
+    public get SlurNoteHeadYOffset(): number {
+        return this.slurNoteHeadYOffset;
+    }
+    public set SlurNoteHeadYOffset(value: number) {
+        this.slurNoteHeadYOffset = value;
+    }
+    public get SlurStemXOffset(): number {
+        return this.slurStemXOffset;
+    }
+    public set SlurStemXOffset(value: number) {
+        this.slurStemXOffset = value;
+    }
+    public get SlurSlopeMaxAngle(): number {
+        return this.slurSlopeMaxAngle;
+    }
+    public set SlurSlopeMaxAngle(value: number) {
+        this.slurSlopeMaxAngle = value;
+    }
+    public get SlurTangentMinAngle(): number {
+        return this.slurTangentMinAngle;
+    }
+    public set SlurTangentMinAngle(value: number) {
+        this.slurTangentMinAngle = value;
+    }
+    public get SlurTangentMaxAngle(): number {
+        return this.slurTangentMaxAngle;
+    }
+    public set SlurTangentMaxAngle(value: number) {
+        this.slurTangentMaxAngle = value;
+    }
+    public get SlursStartingAtSameStaffEntryYOffset(): number {
+        return this.slursStartingAtSameStaffEntryYOffset;
+    }
+    public set SlursStartingAtSameStaffEntryYOffset(value: number) {
+        this.slursStartingAtSameStaffEntryYOffset = value;
+    }
+    public get InstantaniousTempoTextHeight(): number {
+        return this.instantaniousTempoTextHeight;
+    }
+    public set InstantaniousTempoTextHeight(value: number) {
+        this.instantaniousTempoTextHeight = value;
+    }
+    public get ContinuousDynamicTextHeight(): number {
+        return this.continuousDynamicTextHeight;
+    }
+    public set ContinuousDynamicTextHeight(value: number) {
+        this.continuousDynamicTextHeight = value;
+    }
+    public get MoodTextHeight(): number {
+        return this.moodTextHeight;
+    }
+    public set MoodTextHeight(value: number) {
+        this.moodTextHeight = value;
+    }
+    public get ContinuousTempoTextHeight(): number {
+        return this.continuousTempoTextHeight;
+    }
+    public set ContinuousTempoTextHeight(value: number) {
+        this.continuousTempoTextHeight = value;
+    }
+    public get UnknownTextHeight(): number {
+        return this.unknownTextHeight;
+    }
+    public set UnknownTextHeight(value: number) {
+        this.unknownTextHeight = value;
+    }
+    public get StaffLineWidth(): number {
+        return this.staffLineWidth;
+    }
+    public set StaffLineWidth(value: number) {
+        this.staffLineWidth = value;
+    }
+    public get LedgerLineWidth(): number {
+        return this.ledgerLineWidth;
+    }
+    public set LedgerLineWidth(value: number) {
+        this.ledgerLineWidth = value;
+    }
+    public get WedgeLineWidth(): number {
+        return this.wedgeLineWidth;
+    }
+    public set WedgeLineWidth(value: number) {
+        this.wedgeLineWidth = value;
+    }
+    public get TupletLineWidth(): number {
+        return this.tupletLineWidth;
+    }
+    public set TupletLineWidth(value: number) {
+        this.tupletLineWidth = value;
+    }
+    public get LyricUnderscoreLineWidth(): number {
+        return this.lyricUnderscoreLineWidth;
+    }
+    public set LyricUnderscoreLineWidth(value: number) {
+        this.lyricUnderscoreLineWidth = value;
+    }
+    public get SystemThinLineWidth(): number {
+        return this.systemThinLineWidth;
+    }
+    public set SystemThinLineWidth(value: number) {
+        this.systemThinLineWidth = value;
+    }
+    public get SystemBoldLineWidth(): number {
+        return this.systemBoldLineWidth;
+    }
+    public set SystemBoldLineWidth(value: number) {
+        this.systemBoldLineWidth = value;
+    }
+    public get SystemRepetitionEndingLineWidth(): number {
+        return this.systemRepetitionEndingLineWidth;
+    }
+    public set SystemRepetitionEndingLineWidth(value: number) {
+        this.systemRepetitionEndingLineWidth = value;
+    }
+    public get SystemDotWidth(): number {
+        return this.systemDotWidth;
+    }
+    public set SystemDotWidth(value: number) {
+        this.systemDotWidth = value;
+    }
+    public get DistanceBetweenVerticalSystemLines(): number {
+        return this.distanceBetweenVerticalSystemLines;
+    }
+    public set DistanceBetweenVerticalSystemLines(value: number) {
+        this.distanceBetweenVerticalSystemLines = value;
+    }
+    public get DistanceBetweenDotAndLine(): number {
+        return this.distanceBetweenDotAndLine;
+    }
+    public set DistanceBetweenDotAndLine(value: number) {
+        this.distanceBetweenDotAndLine = value;
+    }
+    public get OctaveShiftLineWidth(): number {
+        return this.octaveShiftLineWidth;
+    }
+    public set OctaveShiftLineWidth(value: number) {
+        this.octaveShiftLineWidth = value;
+    }
+    public get OctaveShiftVerticalLineLength(): number {
+        return this.octaveShiftVerticalLineLength;
+    }
+    public set OctaveShiftVerticalLineLength(value: number) {
+        this.octaveShiftVerticalLineLength = value;
+    }
+    public get GraceLineWidth(): number {
+        return this.graceLineWidth;
+    }
+    public set GraceLineWidth(value: number) {
+        this.graceLineWidth = value;
+    }
+    public get MinimumStaffLineDistance(): number {
+        return this.minimumStaffLineDistance;
+    }
+    public set MinimumStaffLineDistance(value: number) {
+        this.minimumStaffLineDistance = value;
+    }
+    public get MinimumCrossedBeamDifferenceMargin(): number {
+        return this.minimumCrossedBeamDifferenceMargin;
+    }
+    public set MinimumCrossedBeamDifferenceMargin(value: number) {
+        this.minimumCrossedBeamDifferenceMargin = value;
+    }
+    public get DisplacedNoteMargin(): number {
+        return this.displacedNoteMargin;
+    }
+    public set DisplacedNoteMargin(value: number) {
+        this.displacedNoteMargin = value;
+    }
+    public get MinNoteDistance(): number {
+        return this.minNoteDistance;
+    }
+    public set MinNoteDistance(value: number) {
+        this.minNoteDistance = value;
+    }
+    public get SubMeasureXSpacingThreshold(): number {
+        return this.subMeasureXSpacingThreshold;
+    }
+    public set SubMeasureXSpacingThreshold(value: number) {
+        this.subMeasureXSpacingThreshold = value;
+    }
+    public get MeasureDynamicsMaxScalingFactor(): number {
+        return this.measureDynamicsMaxScalingFactor;
+    }
+    public set MeasureDynamicsMaxScalingFactor(value: number) {
+        this.measureDynamicsMaxScalingFactor = value;
+    }
+    public get MaxInstructionsConstValue(): number {
+        return this.maxInstructionsConstValue;
+    }
+    public set MaxInstructionsConstValue(value: number) {
+        this.maxInstructionsConstValue = value;
+    }
+    public get NoteDistances(): number[] {
+        return this.noteDistances;
+    }
+    public set NoteDistances(value: number[]) {
+        this.noteDistances = value;
+    }
+    public get NoteDistancesScalingFactors(): number[] {
+        return this.noteDistancesScalingFactors;
+    }
+    public set NoteDistancesScalingFactors(value: number[]) {
+        this.noteDistancesScalingFactors = value;
+    }
+    public get DurationDistanceDict(): Dictionary<number, number> {
+        return this.durationDistanceDict;
+    }
+    public get DurationScalingDistanceDict(): Dictionary<number, number> {
+        return this.durationScalingDistanceDict;
+    }
+    private populateDictionaries(): void {
+        for (var i: number = 0; i < this.noteDistances.length; i++) {
+            switch (i) {
+                case 0:
+                    this.durationDistanceDict.Add(0.015625, this.noteDistances[i]);
+                    this.durationScalingDistanceDict.Add(0.015625, this.noteDistancesScalingFactors[i]);
+                    break;
+                case 1:
+                    this.durationDistanceDict.Add(0.03125, this.noteDistances[i]);
+                    this.durationScalingDistanceDict.Add(0.03125, this.noteDistancesScalingFactors[i]);
+                    break;
+                case 2:
+                    this.durationDistanceDict.Add(0.0625, this.noteDistances[i]);
+                    this.durationScalingDistanceDict.Add(0.0625, this.noteDistancesScalingFactors[i]);
+                    break;
+                case 3:
+                    this.durationDistanceDict.Add(0.125, this.noteDistances[i]);
+                    this.durationScalingDistanceDict.Add(0.125, this.noteDistancesScalingFactors[i]);
+                    break;
+                case 4:
+                    this.durationDistanceDict.Add(0.25, this.noteDistances[i]);
+                    this.durationScalingDistanceDict.Add(0.25, this.noteDistancesScalingFactors[i]);
+                    break;
+                case 5:
+                    this.durationDistanceDict.Add(0.5, this.noteDistances[i]);
+                    this.durationScalingDistanceDict.Add(0.5, this.noteDistancesScalingFactors[i]);
+                    break;
+                case 6:
+                    this.durationDistanceDict.Add(1.0, this.noteDistances[i]);
+                    this.durationScalingDistanceDict.Add(1.0, this.noteDistancesScalingFactors[i]);
+                    break;
+                case 7:
+                    this.durationDistanceDict.Add(2.0, this.noteDistances[i]);
+                    this.durationScalingDistanceDict.Add(2.0, this.noteDistancesScalingFactors[i]);
+                    break;
             }
         }
-        private calculateCurveParametersArrays(): void {
-            this.tPower3 = new Array(this.bezierCurveStepSize);
-            this.oneMinusTPower3 = new Array(this.bezierCurveStepSize);
-            this.factorOne = new Array(this.bezierCurveStepSize);
-            this.factorTwo = new Array(this.bezierCurveStepSize);
-            for (var i: number = 0; i < this.bezierCurveStepSize; i++) {
-                var t: number = <number>i / this.bezierCurveStepSize;
-                this.tPower3[i] = Math.Pow(t, 3);
-                this.oneMinusTPower3[i] = Math.Pow((1 - t), 3);
-                this.factorOne[i] = 3 * Math.Pow((1 - t), 2) * t;
-                this.factorTwo[i] = 3 * (1 - t) * Math.Pow(t, 2);
-            }
+    }
+    private calculateCurveParametersArrays(): void {
+        this.tPower3 = new Array(this.bezierCurveStepSize);
+        this.oneMinusTPower3 = new Array(this.bezierCurveStepSize);
+        this.factorOne = new Array(this.bezierCurveStepSize);
+        this.factorTwo = new Array(this.bezierCurveStepSize);
+        for (var i: number = 0; i < this.bezierCurveStepSize; i++) {
+            var t: number = <number>i / this.bezierCurveStepSize;
+            this.tPower3[i] = Math.Pow(t, 3);
+            this.oneMinusTPower3[i] = Math.Pow((1 - t), 3);
+            this.factorOne[i] = 3 * Math.Pow((1 - t), 2) * t;
+            this.factorTwo[i] = 3 * (1 - t) * Math.Pow(t, 2);
         }
     }
-}
+}

+ 89 - 88
src/MusicalScore/Graphical/GraphicalLabel.ts

@@ -1,92 +1,93 @@
 import {Label} from "../Label";
 import {TextAlignment} from "../../Common/Enums/TextAlignment";
-module PhonicScore.MusicalScore.Graphical.Primitives {
-    export class GraphicalLabel extends Clickable {
-        private label: Label;
-        constructor(label: Label, textHeight: number, alignment: TextAlignment) {
-            this.label = label;
-            this.boundingBox = new BoundingBox(this);
-            this.label.FontHeight = textHeight;
-            this.label.TextAlignment = alignment;
-        }
-        constructor(label: Label, textHeight: number, alignment: TextAlignment, parent: BoundingBox) {
-            this.label = label;
-            this.boundingBox = new BoundingBox(parent, this);
-            this.label.FontHeight = textHeight;
-            this.label.TextAlignment = alignment;
-        }
-        public get Label(): Label {
-            return this.label;
-        }
-        public setLabelPositionAndShapeBorders(): void {
-            if (this.Label.Text.Trim().Equals(String.Empty))
-                return
-            var labelMarginBorderFactor: number = EngravingRules.Rules.LabelMarginBorderFactor;
-            
-            var widthToHeightRatio: number = MusicSheetCalculator.TextMeasurer.computeTextWidthToHeightRatio(this.Label.Text, this.Label.Font, this.Label.FontStyle);
-            var height: number = this.Label.FontHeight;
-            var width: number = height * widthToHeightRatio;
-            var psi: BoundingBox = PositionAndShape;
-            switch (this.Label.TextAlignment) {
-                case TextAlignment.CenterBottom:
-                    psi.BorderTop = -height;
-                    psi.BorderLeft = -width / 2;
-                    psi.BorderBottom = 0;
-                    psi.BorderRight = width / 2;
-                    break;
-                case TextAlignment.CenterCenter:
-                    psi.BorderTop = -height / 2;
-                    psi.BorderLeft = -width / 2;
-                    psi.BorderBottom = height / 2;
-                    psi.BorderRight = width / 2;
-                    break;
-                case TextAlignment.CenterTop:
-                    psi.BorderTop = 0;
-                    psi.BorderLeft = -width / 2;
-                    psi.BorderBottom = height;
-                    psi.BorderRight = width / 2;
-                    break;
-                case TextAlignment.LeftBottom:
-                    psi.BorderTop = -height;
-                    psi.BorderLeft = 0;
-                    psi.BorderBottom = 0;
-                    psi.BorderRight = width;
-                    break;
-                case TextAlignment.LeftCenter:
-                    psi.BorderTop = -height / 2;
-                    psi.BorderLeft = 0;
-                    psi.BorderBottom = height / 2;
-                    psi.BorderRight = width;
-                    break;
-                case TextAlignment.LeftTop:
-                    psi.BorderTop = 0;
-                    psi.BorderLeft = 0;
-                    psi.BorderBottom = height;
-                    psi.BorderRight = width;
-                    break;
-                case TextAlignment.RightBottom:
-                    psi.BorderTop = -height;
-                    psi.BorderLeft = -width;
-                    psi.BorderBottom = 0;
-                    psi.BorderRight = 0;
-                    break;
-                case TextAlignment.RightCenter:
-                    psi.BorderTop = -height / 2;
-                    psi.BorderLeft = -width;
-                    psi.BorderBottom = height / 2;
-                    psi.BorderRight = 0;
-                    break;
-                case TextAlignment.RightTop:
-                    psi.BorderTop = 0;
-                    psi.BorderLeft = -width;
-                    psi.BorderBottom = height;
-                    psi.BorderRight = 0;
-                    break;
-            }
-            psi.BorderMarginTop = psi.BorderTop - height * labelMarginBorderFactor;
-            psi.BorderMarginLeft = psi.BorderLeft - height * labelMarginBorderFactor;
-            psi.BorderMarginBottom = psi.BorderBottom + height * labelMarginBorderFactor;
-            psi.BorderMarginRight = psi.BorderRight + height * labelMarginBorderFactor;
+import {Clickable} from "./Clickable";
+import {BoundingBox} from "./BoundingBox";
+import {EngravingRules} from "./EngravingRules";
+export class GraphicalLabel extends Clickable {
+    private label: Label;
+    constructor(label: Label, textHeight: number, alignment: TextAlignment) {
+        this.label = label;
+        this.boundingBox = new BoundingBox(this);
+        this.label.FontHeight = textHeight;
+        this.label.TextAlignment = alignment;
+    }
+    constructor(label: Label, textHeight: number, alignment: TextAlignment, parent: BoundingBox) {
+        this.label = label;
+        this.boundingBox = new BoundingBox(parent, this);
+        this.label.FontHeight = textHeight;
+        this.label.TextAlignment = alignment;
+    }
+    public get Label(): Label {
+        return this.label;
+    }
+    public setLabelPositionAndShapeBorders(): void {
+        if (this.Label.Text.Trim().Equals(String.Empty))
+            return
+        var labelMarginBorderFactor: number = EngravingRules.Rules.LabelMarginBorderFactor;
+
+        var widthToHeightRatio: number = MusicSheetCalculator.TextMeasurer.computeTextWidthToHeightRatio(this.Label.Text, this.Label.Font, this.Label.FontStyle);
+        var height: number = this.Label.FontHeight;
+        var width: number = height * widthToHeightRatio;
+        var psi: BoundingBox = this.PositionAndShape;
+        switch (this.Label.TextAlignment) {
+            case TextAlignment.CenterBottom:
+                psi.BorderTop = -height;
+                psi.BorderLeft = -width / 2;
+                psi.BorderBottom = 0;
+                psi.BorderRight = width / 2;
+                break;
+            case TextAlignment.CenterCenter:
+                psi.BorderTop = -height / 2;
+                psi.BorderLeft = -width / 2;
+                psi.BorderBottom = height / 2;
+                psi.BorderRight = width / 2;
+                break;
+            case TextAlignment.CenterTop:
+                psi.BorderTop = 0;
+                psi.BorderLeft = -width / 2;
+                psi.BorderBottom = height;
+                psi.BorderRight = width / 2;
+                break;
+            case TextAlignment.LeftBottom:
+                psi.BorderTop = -height;
+                psi.BorderLeft = 0;
+                psi.BorderBottom = 0;
+                psi.BorderRight = width;
+                break;
+            case TextAlignment.LeftCenter:
+                psi.BorderTop = -height / 2;
+                psi.BorderLeft = 0;
+                psi.BorderBottom = height / 2;
+                psi.BorderRight = width;
+                break;
+            case TextAlignment.LeftTop:
+                psi.BorderTop = 0;
+                psi.BorderLeft = 0;
+                psi.BorderBottom = height;
+                psi.BorderRight = width;
+                break;
+            case TextAlignment.RightBottom:
+                psi.BorderTop = -height;
+                psi.BorderLeft = -width;
+                psi.BorderBottom = 0;
+                psi.BorderRight = 0;
+                break;
+            case TextAlignment.RightCenter:
+                psi.BorderTop = -height / 2;
+                psi.BorderLeft = -width;
+                psi.BorderBottom = height / 2;
+                psi.BorderRight = 0;
+                break;
+            case TextAlignment.RightTop:
+                psi.BorderTop = 0;
+                psi.BorderLeft = -width;
+                psi.BorderBottom = height;
+                psi.BorderRight = 0;
+                break;
         }
+        psi.BorderMarginTop = psi.BorderTop - height * labelMarginBorderFactor;
+        psi.BorderMarginLeft = psi.BorderLeft - height * labelMarginBorderFactor;
+        psi.BorderMarginBottom = psi.BorderBottom + height * labelMarginBorderFactor;
+        psi.BorderMarginRight = psi.BorderRight + height * labelMarginBorderFactor;
     }
-}
+}

+ 2 - 2
src/MusicalScore/Graphical/GraphicalLine.ts

@@ -1,5 +1,5 @@
-import PointF_2D = PhonicScore.Common.DataObjects.PointF_2D;
-import {OutlineAndFillStyleEnum} from "./DrawingEnums";
+import {OutlineAndFillStyleEnum} from "./DrawingEnums";
+import {PointF_2D} from "../../Common/DataObjects/PointF_2D";
 export class GraphicalLine {
     private start: PointF_2D;
     private end: PointF_2D;

+ 51 - 50
src/MusicalScore/Graphical/GraphicalMusicPage.ts

@@ -1,57 +1,58 @@
 import {BoundingBox} from "./BoundingBox";
-module PhonicScore.MusicalScore.Graphical.SheetData {
-    import GraphicalLabel = PhonicScore.MusicalScore.Graphical.Primitives.GraphicalLabel;
-    import PointF_2D = PhonicScore.Common.DataObjects.PointF_2D;
-    export class GraphicalMusicPage extends GraphicalObject {
-        private musicSystems: List<MusicSystem> = new List<MusicSystem>();
-        private labels: List<GraphicalLabel> = new List<GraphicalLabel>();
-        private parent: GraphicalMusicSheet;
-        constructor(parent: GraphicalMusicSheet) {
-            this.parent = parent;
-            this.boundingBox = new BoundingBox(null, this);
-        }
-        public get MusicSystems(): List<MusicSystem> {
-            return this.musicSystems;
-        }
-        public set MusicSystems(value: List<MusicSystem>) {
-            this.musicSystems = value;
-        }
-        public get Labels(): List<GraphicalLabel> {
-            return this.labels;
-        }
-        public set Labels(value: List<GraphicalLabel>) {
-            this.labels = value;
-        }
-        public get Parent(): GraphicalMusicSheet {
-            return this.parent;
-        }
-        public set Parent(value: GraphicalMusicSheet) {
-            this.parent = value;
-        }
-        public setMusicPageAbsolutePosition(pageIndex: number, rules: EngravingRules): PointF_2D {
-            if (rules.PagePlacement == PagePlacementEnum.Down)
-                return new PointF_2D(0.0f, pageIndex * rules.PageHeight);
-            else if (rules.PagePlacement == PagePlacementEnum.Right)
-                return new PointF_2D(pageIndex * this.parent.ParentMusicSheet.PageWidth, 0.0f);
+import {GraphicalObject} from "./GraphicalObject";
+import {GraphicalLabel} from "./GraphicalLabel";
+import {MusicSystem} from "./MusicSystem";
+import {EngravingRules} from "./EngravingRules";
+import {PointF_2D} from "../../Common/DataObjects/PointF_2D";
+export class GraphicalMusicPage extends GraphicalObject {
+    private musicSystems: List<MusicSystem> = new List<MusicSystem>();
+    private labels: List<GraphicalLabel> = new List<GraphicalLabel>();
+    private parent: GraphicalMusicSheet;
+    constructor(parent: GraphicalMusicSheet) {
+        this.parent = parent;
+        this.boundingBox = new BoundingBox(null, this);
+    }
+    public get MusicSystems(): List<MusicSystem> {
+        return this.musicSystems;
+    }
+    public set MusicSystems(value: List<MusicSystem>) {
+        this.musicSystems = value;
+    }
+    public get Labels(): List<GraphicalLabel> {
+        return this.labels;
+    }
+    public set Labels(value: List<GraphicalLabel>) {
+        this.labels = value;
+    }
+    public get Parent(): GraphicalMusicSheet {
+        return this.parent;
+    }
+    public set Parent(value: GraphicalMusicSheet) {
+        this.parent = value;
+    }
+    public setMusicPageAbsolutePosition(pageIndex: number, rules: EngravingRules): PointF_2D {
+        if (rules.PagePlacement == PagePlacementEnum.Down)
+            return new PointF_2D(0.0, pageIndex * rules.PageHeight);
+        else if (rules.PagePlacement == PagePlacementEnum.Right)
+            return new PointF_2D(pageIndex * this.parent.ParentMusicSheet.PageWidth, 0.0);
+        else {
+            if (pageIndex % 2 == 0) {
+                if (pageIndex == 0)
+                    return new PointF_2D(0.0, pageIndex * rules.PageHeight);
+                else return new PointF_2D(0.0, (pageIndex - 1) * rules.PageHeight);
+            }
             else {
-                if (pageIndex % 2 == 0) {
-                    if (pageIndex == 0)
-                        return new PointF_2D(0.0f, pageIndex * rules.PageHeight);
-                    else return new PointF_2D(0.0f, (pageIndex - 1) * rules.PageHeight);
-                }
-                else {
-                    if (pageIndex == 1)
-                        return new PointF_2D(this.parent.ParentMusicSheet.PageWidth, (pageIndex - 1) * rules.PageHeight);
-                    else return new PointF_2D(this.parent.ParentMusicSheet.PageWidth, (pageIndex - 2) * rules.PageHeight);
-                }
+                if (pageIndex == 1)
+                    return new PointF_2D(this.parent.ParentMusicSheet.PageWidth, (pageIndex - 1) * rules.PageHeight);
+                else return new PointF_2D(this.parent.ParentMusicSheet.PageWidth, (pageIndex - 2) * rules.PageHeight);
             }
         }
     }
-    export enum PagePlacementEnum {
-        Down,
+}
+export enum PagePlacementEnum {
+    Down,
 
-        Right,
+    Right,
 
-        RightDown
-    }
-}
+    RightDown
+}

+ 23 - 23
src/MusicalScore/Graphical/GraphicalNote.ts

@@ -4,28 +4,28 @@ import {KeyInstruction} from "../VoiceData/Instructions/KeyInstruction";
 import {ClefInstruction} from "../VoiceData/Instructions/ClefInstruction";
 import {OctaveEnum} from "../VoiceData/Expressions/ContinuousExpressions/octaveShift";
 import {Pitch} from "../../Common/DataObjects/pitch";
-module PhonicScore.MusicalScore.Graphical.SheetData {
-    export class GraphicalNote extends GraphicalObject {
-        constructor(note: Note, parent: GraphicalStaffEntry) {
-            this.SourceNote = note;
-            this.ParentStaffEntry = parent;
-        }
-        public SourceNote: Note;
-        public GraphicalNoteLength: Fraction;
-        public ParentStaffEntry: GraphicalStaffEntry;
-        public get ParentList(): List<GraphicalNote> {
-            for (var idx: number = 0, len = this.ParentStaffEntry.Notes.Count; idx < len; ++idx) {
-                var graphicalNotes: List<GraphicalNote> = this.ParentStaffEntry.Notes[idx];
-                if (graphicalNotes.Contains(this))
-                    return graphicalNotes;
-            }
-            return null;
-        }
-        public Transpose(keyInstruction: KeyInstruction, activeClef: ClefInstruction, halfTones: number, octaveEnum: OctaveEnum): Pitch {
-            var transposedPitch: Pitch = this.SourceNote.Pitch;
-            if (MusicSheetCalculator.TransposeCalculator != null)
-                transposedPitch = MusicSheetCalculator.TransposeCalculator.TransposePitch(this.SourceNote.Pitch, keyInstruction, halfTones);
-            return transposedPitch;
+import {GraphicalStaffEntry} from "./GraphicalStaffEntry";
+import {GraphicalObject} from "./GraphicalObject";
+export class GraphicalNote extends GraphicalObject {
+    constructor(note: Note, parent: GraphicalStaffEntry) {
+        this.SourceNote = note;
+        this.ParentStaffEntry = parent;
+    }
+    public SourceNote: Note;
+    public GraphicalNoteLength: Fraction;
+    public ParentStaffEntry: GraphicalStaffEntry;
+    public get ParentList(): List<GraphicalNote> {
+        for (var idx: number = 0, len = this.ParentStaffEntry.Notes.Count; idx < len; ++idx) {
+            var graphicalNotes: List<GraphicalNote> = this.ParentStaffEntry.Notes[idx];
+            if (graphicalNotes.Contains(this))
+                return graphicalNotes;
         }
+        return null;
+    }
+    public Transpose(keyInstruction: KeyInstruction, activeClef: ClefInstruction, halfTones: number, octaveEnum: OctaveEnum): Pitch {
+        var transposedPitch: Pitch = this.SourceNote.Pitch;
+        if (MusicSheetCalculator.TransposeCalculator != null)
+            transposedPitch = MusicSheetCalculator.TransposeCalculator.TransposePitch(this.SourceNote.Pitch, keyInstruction, halfTones);
+        return transposedPitch;
     }
-}
+}

+ 8 - 10
src/MusicalScore/Graphical/GraphicalObject.ts

@@ -1,12 +1,10 @@
 import {BoundingBox} from "./BoundingBox";
-module PhonicScore.MusicalScore.Graphical {
-    export class GraphicalObject {
-        protected boundingBox: BoundingBox;
-        public get PositionAndShape(): BoundingBox {
-            return this.boundingBox;
-        }
-        public set PositionAndShape(value: BoundingBox) {
-            this.boundingBox = value;
-        }
+export class GraphicalObject {
+    protected boundingBox: BoundingBox;
+    public get PositionAndShape(): BoundingBox {
+        return this.boundingBox;
     }
-}
+    public set PositionAndShape(value: BoundingBox) {
+        this.boundingBox = value;
+    }
+}

+ 245 - 0
src/MusicalScore/Graphical/GraphicalStaffEntry.ts

@@ -0,0 +1,245 @@
+import {SourceStaffEntry} from "../VoiceData/SourceStaffEntry";
+import {BoundingBox} from "./BoundingBox";
+import {Fraction} from "../../Common/DataObjects/fraction";
+import {VerticalGraphicalStaffEntryContainer} from "./VerticalGraphicalStaffEntryContainer";
+import {Note} from "../VoiceData/Note";
+import {Slur} from "../VoiceData/Expressions/ContinuousExpressions/Slur";
+import {Voice} from "../VoiceData/Voice";
+import {VoiceEntry} from "../VoiceData/VoiceEntry";
+import {LinkedVoice} from "../VoiceData/LinkedVoice";
+import {GraphicalTie} from "./GraphicalTie";
+import {GraphicalObject} from "./GraphicalObject";
+import {StaffMeasure} from "./StaffMeasure";
+import {GraphicalNote} from "./GraphicalNote";
+export class GraphicalStaffEntry extends GraphicalObject {
+    private graphicalInstructions: List<AbstractGraphicalInstruction> = new List<AbstractGraphicalInstruction>();
+    private graphicalTies: List<GraphicalTie> = new List<GraphicalTie>();
+    private lyricsEntries: List<GraphicalLyricEntry> = new List<GraphicalLyricEntry>();
+    constructor(parentMeasure: StaffMeasure, sourceStaffEntry: SourceStaffEntry = null, staffEntryParent: GraphicalStaffEntry = null) {
+        this.ParentMeasure = parentMeasure;
+        this.Notes = new List<List<GraphicalNote>>();
+        this.GraceStaffEntriesBefore = new List<GraphicalStaffEntry>();
+        this.GraceStaffEntriesAfter = new List<GraphicalStaffEntry>();
+        this.SourceStaffEntry = sourceStaffEntry;
+        if (staffEntryParent != null) {
+            this.StaffEntryParent = staffEntryParent;
+            this.ParentVerticalContainer = staffEntryParent.ParentVerticalContainer;
+            this.PositionAndShape = new BoundingBox(staffEntryParent.PositionAndShape, this);
+        }
+        else this.PositionAndShape = new BoundingBox(parentMeasure.PositionAndShape, this);
+        if (sourceStaffEntry != null)
+            this.RelInMeasureTimestamp = sourceStaffEntry.Timestamp;
+    }
+    public GraphicalChordContainer: GraphicalChordSymbolContainer;
+    public GraphicalLink: GraphicalStaffEntryLink;
+    public RelInMeasureTimestamp: Fraction;
+    public SourceStaffEntry: SourceStaffEntry;
+    public ParentMeasure: StaffMeasure;
+    public Notes: List<List<GraphicalNote>>;
+    public GraceStaffEntriesBefore: List<GraphicalStaffEntry>;
+    public GraceStaffEntriesAfter: List<GraphicalStaffEntry>;
+    public StaffEntryParent: GraphicalStaffEntry;
+    public ParentVerticalContainer: VerticalGraphicalStaffEntryContainer;
+    public get GraphicalInstructions(): List<AbstractGraphicalInstruction> {
+        return this.graphicalInstructions;
+    }
+    public get GraphicalTies(): List<GraphicalTie> {
+        return this.graphicalTies;
+    }
+    public get LyricsEntries(): List<GraphicalLyricEntry> {
+        return this.lyricsEntries;
+    }
+    public getAbsoluteTimestamp(): Fraction {
+        var result: Fraction = Fraction.CreateFractionFromFraction(this.ParentMeasure.ParentSourceMeasure.AbsoluteTimestamp);
+        if (this.RelInMeasureTimestamp != null)
+            result += this.RelInMeasureTimestamp;
+        return result;
+    }
+    public findEndTieGraphicalNoteFromNote(tieNote: Note): GraphicalNote {
+        for (var idx: number = 0, len = this.Notes.Count; idx < len; ++idx) {
+            var graphicalNotes: List<GraphicalNote> = this.Notes[idx];
+            for (var idx2: number = 0, len2 = graphicalNotes.Count; idx2 < len2; ++idx2) {
+                var graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                var note: Note = graphicalNote.SourceNote;
+                if (note.Pitch != null && note.Pitch.FundamentalNote == tieNote.Pitch.FundamentalNote && note.Pitch.Octave == tieNote.Pitch.Octave && note.getAbsoluteTimestamp() == tieNote.getAbsoluteTimestamp())
+                    return graphicalNote;
+            }
+        }
+        return null;
+    }
+    public findEndTieGraphicalNoteFromNoteWithStartingSlur(tieNote: Note, slur: Slur): GraphicalNote {
+        for (var idx: number = 0, len = this.Notes.Count; idx < len; ++idx) {
+            var graphicalNotes: List<GraphicalNote> = this.Notes[idx];
+            for (var idx2: number = 0, len2 = graphicalNotes.Count; idx2 < len2; ++idx2) {
+                var graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                var note: Note = graphicalNote.SourceNote;
+                if (note.NoteTie != null && note.NoteSlurs.Contains(slur))
+                    return graphicalNote;
+            }
+        }
+        return null;
+    }
+    public findEndTieGraphicalNoteFromNoteWithEndingSlur(tieNote: Note): GraphicalNote {
+        for (var idx: number = 0, len = this.Notes.Count; idx < len; ++idx) {
+            var graphicalNotes: List<GraphicalNote> = this.Notes[idx];
+            for (var idx2: number = 0, len2 = graphicalNotes.Count; idx2 < len2; ++idx2) {
+                var graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                var note: Note = graphicalNote.SourceNote;
+                if (note.Pitch != null && note.Pitch.FundamentalNote == tieNote.Pitch.FundamentalNote && note.Pitch.Octave == tieNote.Pitch.Octave && this.getAbsoluteTimestamp() == tieNote.getAbsoluteTimestamp())
+                    return graphicalNote;
+            }
+        }
+        return null;
+    }
+    public findGraphicalNoteFromGraceNote(graceNote: Note): GraphicalNote {
+        for (var idx: number = 0, len = this.Notes.Count; idx < len; ++idx) {
+            var graphicalNotes: List<GraphicalNote> = this.Notes[idx];
+            for (var idx2: number = 0, len2 = graphicalNotes.Count; idx2 < len2; ++idx2) {
+                var graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                if (graphicalNote.SourceNote == graceNote)
+                    return graphicalNote;
+            }
+        }
+        return null;
+    }
+    public findGraphicalNoteFromNote(baseNote: Note): GraphicalNote {
+        for (var idx: number = 0, len = this.Notes.Count; idx < len; ++idx) {
+            var graphicalNotes: List<GraphicalNote> = this.Notes[idx];
+            for (var idx2: number = 0, len2 = graphicalNotes.Count; idx2 < len2; ++idx2) {
+                var graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                if (graphicalNote.SourceNote == baseNote && this.getAbsoluteTimestamp() == baseNote.getAbsoluteTimestamp())
+                    return graphicalNote;
+            }
+        }
+        return null;
+    }
+    public getGraphicalNoteDurationFromVoice(voice: Voice): Fraction {
+        for (var idx: number = 0, len = this.Notes.Count; idx < len; ++idx) {
+            var graphicalNotes: List<GraphicalNote> = this.Notes[idx];
+            if (graphicalNotes[0].SourceNote.ParentVoiceEntry.ParentVoice == voice)
+                return graphicalNotes[0].GraphicalNoteLength;
+        }
+        return new Fraction(0, 1);
+    }
+    public findLinkedNotes(notLinkedNotes: List<GraphicalNote>): void {
+        if (this.SourceStaffEntry != null && this.SourceStaffEntry.Link != null) {
+            for (var idx: number = 0, len = this.Notes.Count; idx < len; ++idx) {
+                var graphicalNotes: List<GraphicalNote> = this.Notes[idx];
+                for (var idx2: number = 0, len2 = graphicalNotes.Count; idx2 < len2; ++idx2) {
+                    var graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                    if (graphicalNote.ParentStaffEntry == this)
+                        notLinkedNotes.Add(graphicalNote);
+                }
+            }
+        }
+    }
+    public findVoiceEntryGraphicalNotes(voiceEntry: VoiceEntry): List<GraphicalNote> {
+        for (var idx: number = 0, len = this.Notes.Count; idx < len; ++idx) {
+            var graphicalNotes: List<GraphicalNote> = this.Notes[idx];
+            for (var idx2: number = 0, len2 = graphicalNotes.Count; idx2 < len2; ++idx2) {
+                var graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                if (graphicalNote.SourceNote.ParentVoiceEntry == voiceEntry)
+                    return graphicalNotes;
+            }
+        }
+        return null;
+    }
+    public isVoiceEntryPartOfLinkedVoiceEntry(voiceEntry: VoiceEntry): boolean {
+        if (this.SourceStaffEntry.Link != null) {
+            for (var idx: number = 0, len = this.SourceStaffEntry.Link.LinkStaffEntries.Count; idx < len; ++idx) {
+                var sEntry: SourceStaffEntry = this.SourceStaffEntry.Link.LinkStaffEntries[idx];
+                if (sEntry.VoiceEntries.Contains(voiceEntry) && sEntry != this.SourceStaffEntry)
+                    return true;
+            }
+        }
+        return false;
+    }
+    public getMainVoice(): Voice {
+        for (var idx: number = 0, len = this.SourceStaffEntry.VoiceEntries.Count; idx < len; ++idx) {
+            var voiceEntry: VoiceEntry = this.SourceStaffEntry.VoiceEntries[idx];
+            if (voiceEntry.ParentVoice.GetType() != /*typeof*/LinkedVoice)
+                return voiceEntry.ParentVoice;
+        }
+        return this.Notes[0][0].SourceNote.ParentVoiceEntry.ParentVoice;
+    }
+    public findStaffEntryMinNoteLength(): Fraction {
+        var minLength: Fraction = new Fraction(Int32.MaxValue, 1);
+        for (var idx: number = 0, len = this.Notes.Count; idx < len; ++idx) {
+            var graphicalNotes: List<GraphicalNote> = this.Notes[idx];
+            for (var idx2: number = 0, len2 = graphicalNotes.Count; idx2 < len2; ++idx2) {
+                var graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                var calNoteLen: Fraction = graphicalNote.GraphicalNoteLength;
+                if (calNoteLen < minLength && calNoteLen.Numerator > 0)
+                    minLength = calNoteLen;
+            }
+        }
+        return minLength;
+    }
+    public findStaffEntryMaxNoteLength(): Fraction {
+        var maxLength: Fraction = new Fraction(0, 1);
+        for (var idx: number = 0, len = this.Notes.Count; idx < len; ++idx) {
+            var graphicalNotes: List<GraphicalNote> = this.Notes[idx];
+            for (var idx2: number = 0, len2 = graphicalNotes.Count; idx2 < len2; ++idx2) {
+                var graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                var calNoteLen: Fraction = graphicalNote.GraphicalNoteLength;
+                if (calNoteLen > maxLength && calNoteLen.Numerator > 0)
+                    maxLength = calNoteLen;
+            }
+        }
+        return maxLength;
+    }
+    public findOrCreateGraphicalNotesListFromVoiceEntry(voiceEntry: VoiceEntry): List<GraphicalNote> {
+        var graphicalNotes: List<GraphicalNote>;
+        if (this.Notes.Count == 0) {
+            graphicalNotes = new List<GraphicalNote>();
+            this.Notes.Add(graphicalNotes);
+        }
+        else {
+            for (var i: number = 0; i < this.Notes.Count; i++) {
+                if (this.Notes[i][0].SourceNote.ParentVoiceEntry.ParentVoice == voiceEntry.ParentVoice)
+                    return this.Notes[i];
+            }
+            graphicalNotes = new List<GraphicalNote>();
+            this.Notes.Add(graphicalNotes);
+        }
+        return graphicalNotes;
+    }
+    public findOrCreateGraphicalNotesListFromGraphicalNote(graphicalNote: GraphicalNote): List<GraphicalNote> {
+        var graphicalNotes: List<GraphicalNote>;
+        var tieStartSourceStaffEntry: SourceStaffEntry = graphicalNote.SourceNote.ParentStaffEntry;
+        if (this.SourceStaffEntry != tieStartSourceStaffEntry)
+            graphicalNotes = this.findOrCreateGraphicalNotesListFromVoiceEntry(graphicalNote.SourceNote.ParentVoiceEntry);
+        else {
+            if (this.Notes.Count == 0) {
+                graphicalNotes = new List<GraphicalNote>();
+                this.Notes.Add(graphicalNotes);
+            }
+            else {
+                for (var i: number = 0; i < this.Notes.Count; i++) {
+                    if (this.Notes[i][0].SourceNote.ParentVoiceEntry.ParentVoice == graphicalNote.SourceNote.ParentVoiceEntry.ParentVoice) {
+                        return this.Notes[i];
+                    }
+                }
+                graphicalNotes = new List<GraphicalNote>();
+                this.Notes.Add(graphicalNotes);
+            }
+        }
+        return graphicalNotes;
+    }
+    public addGraphicalNoteToListAtCorrectYPosition(graphicalNotes: List<GraphicalNote>, graphicalNote: GraphicalNote): void {
+        if (graphicalNotes.Count == 0 || graphicalNote.PositionAndShape.RelativePosition.Y < graphicalNotes.Last().PositionAndShape.RelativePosition.Y)
+            graphicalNotes.Add(graphicalNote);
+        else {
+            for (var i: number = graphicalNotes.Count - 1; i >= 0; i--) {
+                if (graphicalNotes[i].PositionAndShape.RelativePosition.Y > graphicalNote.PositionAndShape.RelativePosition.Y) {
+                    graphicalNotes.Insert(i + 1, graphicalNote);
+                    break;
+                }
+                if (i == 0) {
+                    graphicalNotes.Insert(0, graphicalNote);
+                    break;
+                }
+            }
+        }
+    }
+}

+ 30 - 0
src/MusicalScore/Graphical/GraphicalTie.ts

@@ -0,0 +1,30 @@
+import {Tie} from "../VoiceData/Tie";
+import {GraphicalNote} from "./GraphicalNote";
+export class GraphicalTie {
+    private tie: Tie;
+    private startNote: GraphicalNote;
+    private endNote: GraphicalNote;
+    constructor(tie: Tie) {
+        this.tie = tie;
+    }
+    constructor(tie: Tie, start: GraphicalNote, end: GraphicalNote) {
+        this.tie = tie;
+        this.startNote = start;
+        this.endNote = end;
+    }
+    public get GetTie(): Tie {
+        return this.tie;
+    }
+    public get StartNote(): GraphicalNote {
+        return this.startNote;
+    }
+    public set StartNote(value: GraphicalNote) {
+        this.startNote = value;
+    }
+    public get EndNote(): GraphicalNote {
+        return this.endNote;
+    }
+    public set EndNote(value: GraphicalNote) {
+        this.endNote = value;
+    }
+}

+ 204 - 200
src/MusicalScore/Graphical/MusicSystem.ts

@@ -5,114 +5,92 @@ import {Fraction} from "../../Common/DataObjects/fraction";
 import {SourceMeasure} from "../VoiceData/SourceMeasure";
 import {InstrumentalGroup} from "../InstrumentalGroup";
 import {TextAlignment} from "../../Common/Enums/TextAlignment";
-module PhonicScore.MusicalScore.Graphical.SheetData {
-    export class MusicSystem extends GraphicalObject {
-        public NeedsToBeRedrawn: boolean = true;
-        protected parent: GraphicalMusicPage;
-        protected id: number;
-        protected staffLines: List<StaffLine> = new List<StaffLine>();
-        protected graphicalMeasures: List<List<StaffMeasure>> = new List<List<StaffMeasure>>();
-        protected labels: Dictionary<GraphicalLabel, Instrument> = new Dictionary<GraphicalLabel, Instrument>();
-        protected measureNumberLabels: List<GraphicalLabel> = new List<GraphicalLabel>();
-        protected maxLabelLength: number;
-        protected objectsToRedraw: List<Tuple<List<Object>, Object>> = new List<Tuple<List<Object>, Object>>();
-        constructor(parent: GraphicalMusicPage, id: number) {
-            this.parent = parent;
-            this.id = id;
-            this.boundingBox = new BoundingBox(parent.PositionAndShape, this);
-            this.maxLabelLength = 0.0f;
-        }
-        public get Parent(): GraphicalMusicPage {
-            return this.parent;
-        }
-        public set Parent(value: GraphicalMusicPage) {
-            this.parent = value;
-        }
-        public get StaffLines(): List<StaffLine> {
-            return this.staffLines;
-        }
-        public get GraphicalMeasures(): List<List<StaffMeasure>> {
-            return this.graphicalMeasures;
-        }
-        public get MeasureNumberLabels(): List<GraphicalLabel> {
-            return this.measureNumberLabels;
-        }
-        public get Labels(): List<GraphicalLabel> {
-            return this.labels.Keys.ToList();
-        }
-        public get ObjectsToRedraw(): List<Tuple<List<Object>, Object>> {
-            return this.objectsToRedraw;
-        }
-        public get Id(): number {
-            return this.id;
-        }
-        public createSystemLeftVerticalLineObject(lineWidth: number, systemLabelsRightMargin: number): void { throw new Error('not implemented'); }
-        public createVerticalLineForMeasure(position: number, lineType: SystemLinesEnum, lineWidth: number,
-            index: number): void { throw new Error('not implemented'); }
-        public setYPositionsToVerticalLineObjectsAndCreateLines(rules: EngravingRules): void { throw new Error('not implemented'); }
-        public calculateBorders(rules: EngravingRules): void {
+import {GraphicalMusicPage} from "./GraphicalMusicPage";
+import {GraphicalLabel} from "./GraphicalLabel";
+import {StaffMeasure} from "./StaffMeasure";
+import {GraphicalObject} from "./GraphicalObject";
+import {EngravingRules} from "./EngravingRules";
+import {PointF_2D} from "../../Common/DataObjects/PointF_2D";
+export class MusicSystem extends GraphicalObject {
+    public NeedsToBeRedrawn: boolean = true;
+    protected parent: GraphicalMusicPage;
+    protected id: number;
+    protected staffLines: List<StaffLine> = new List<StaffLine>();
+    protected graphicalMeasures: List<List<StaffMeasure>> = new List<List<StaffMeasure>>();
+    protected labels: Dictionary<GraphicalLabel, Instrument> = new Dictionary<GraphicalLabel, Instrument>();
+    protected measureNumberLabels: List<GraphicalLabel> = new List<GraphicalLabel>();
+    protected maxLabelLength: number;
+    protected objectsToRedraw: List<Tuple<List<Object>, Object>> = new List<Tuple<List<Object>, Object>>();
+    constructor(parent: GraphicalMusicPage, id: number) {
+        this.parent = parent;
+        this.id = id;
+        this.boundingBox = new BoundingBox(parent.PositionAndShape, this);
+        this.maxLabelLength = 0.0;
+    }
+    public get Parent(): GraphicalMusicPage {
+        return this.parent;
+    }
+    public set Parent(value: GraphicalMusicPage) {
+        this.parent = value;
+    }
+    public get StaffLines(): List<StaffLine> {
+        return this.staffLines;
+    }
+    public get GraphicalMeasures(): List<List<StaffMeasure>> {
+        return this.graphicalMeasures;
+    }
+    public get MeasureNumberLabels(): List<GraphicalLabel> {
+        return this.measureNumberLabels;
+    }
+    public get Labels(): List<GraphicalLabel> {
+        return this.labels.Keys.ToList();
+    }
+    public get ObjectsToRedraw(): List<Tuple<List<Object>, Object>> {
+        return this.objectsToRedraw;
+    }
+    public get Id(): number {
+        return this.id;
+    }
+    public createSystemLeftVerticalLineObject(lineWidth: number, systemLabelsRightMargin: number): void { throw new Error('not implemented'); }
+    public createVerticalLineForMeasure(position: number, lineType: SystemLinesEnum, lineWidth: number,
+        index: number): void { throw new Error('not implemented'); }
+    public setYPositionsToVerticalLineObjectsAndCreateLines(rules: EngravingRules): void { throw new Error('not implemented'); }
+    public calculateBorders(rules: EngravingRules): void {
 
-        }
-        public alignBeginInstructions(): void {
+    }
+    public alignBeginInstructions(): void {
 
+    }
+    public GetLeftBorderAbsoluteXPosition(): number {
+        return this.StaffLines[0].PositionAndShape.AbsolutePosition.X + this.StaffLines[0].Measures[0].BeginInstructionsWidth;
+    }
+    public GetRightBorderAbsoluteXPosition(): number {
+        return this.StaffLines[0].PositionAndShape.AbsolutePosition.X + this.StaffLines[0].StaffLines[0].End.X;
+    }
+    public AddStaffMeasures(graphicalMeasures: List<StaffMeasure>): void {
+        for (var idx: number = 0, len = graphicalMeasures.Count; idx < len; ++idx) {
+            var graphicalMeasure: StaffMeasure = graphicalMeasures[idx];
+            graphicalMeasure.ParentMusicSystem = this;
         }
-        public GetLeftBorderAbsoluteXPosition(): number {
-            return this.StaffLines[0].PositionAndShape.AbsolutePosition.X + this.StaffLines[0].Measures[0].BeginInstructionsWidth;
-        }
-        public GetRightBorderAbsoluteXPosition(): number {
-            return this.StaffLines[0].PositionAndShape.AbsolutePosition.X + this.StaffLines[0].StaffLines[0].End.X;
-        }
-        public AddStaffMeasures(graphicalMeasures: List<StaffMeasure>): void {
-            for (var idx: number = 0, len = graphicalMeasures.Count; idx < len; ++idx) {
-                var graphicalMeasure: StaffMeasure = graphicalMeasures[idx];
-                graphicalMeasure.ParentMusicSystem = this;
-            }
-            this.graphicalMeasures.Add(graphicalMeasures);
-        }
-        public GetSystemsFirstTimeStamp(): Fraction {
-            return this.graphicalMeasures[0][0].ParentSourceMeasure.AbsoluteTimestamp;
-        }
-        public GetSystemsLastTimeStamp(): Fraction {
-            var m: SourceMeasure = this.graphicalMeasures[this.graphicalMeasures.Count - 1][0].ParentSourceMeasure;
-            return m.AbsoluteTimestamp + m.Duration;
-        }
-        public createInstrumentBrackets(instruments: List<Instrument>, staffHeight: number): void {
-            for (var idx: number = 0, len = instruments.Count; idx < len; ++idx) {
-                var instrument: Instrument = instruments[idx];
-                if (instrument.Staves.Count > 1) {
-                    var firstStaffLine: StaffLine = null, lastStaffLine = null;
-                    for (var idx2: number = 0, len2 = this.staffLines.Count; idx2 < len2; ++idx2) {
-                        var staffLine: StaffLine = this.staffLines[idx2];
-                        if (staffLine.ParentStaff == instrument.Staves[0])
-                            firstStaffLine = staffLine;
-                        if (staffLine.ParentStaff == instrument.Staves[instrument.Staves.Count - 1])
-                            lastStaffLine = staffLine;
-                    }
-                    if (firstStaffLine != null && lastStaffLine != null) {
-                        var rightUpper: PointF_2D = new PointF_2D(firstStaffLine.PositionAndShape.RelativePosition.X,
-                            firstStaffLine.PositionAndShape.RelativePosition.Y);
-                        var rightLower: PointF_2D = new PointF_2D(lastStaffLine.PositionAndShape.RelativePosition.X,
-                            lastStaffLine.PositionAndShape.RelativePosition.Y + staffHeight);
-                        this.createInstrumentBracket(rightUpper, rightLower);
-                    }
-                }
-            }
-        }
-        public createGroupBrackets(instrumentGroups: List<InstrumentalGroup>, staffHeight: number, recursionDepth: number): void {
-            for (var idx: number = 0, len = instrumentGroups.Count; idx < len; ++idx) {
-                var instrumentGroup: InstrumentalGroup = instrumentGroups[idx];
-                if (instrumentGroup.InstrumentalGroups.Count < 1)
-                    continue;
-                var instrument1: Instrument = this.findFirstVisibleInstrumentInInstrumentalGroup(instrumentGroup);
-                var instrument2: Instrument = this.findLastVisibleInstrumentInInstrumentalGroup(instrumentGroup);
-                if (instrument1 == null || instrument2 == null)
-                    continue;
+        this.graphicalMeasures.Add(graphicalMeasures);
+    }
+    public GetSystemsFirstTimeStamp(): Fraction {
+        return this.graphicalMeasures[0][0].ParentSourceMeasure.AbsoluteTimestamp;
+    }
+    public GetSystemsLastTimeStamp(): Fraction {
+        var m: SourceMeasure = this.graphicalMeasures[this.graphicalMeasures.Count - 1][0].ParentSourceMeasure;
+        return m.AbsoluteTimestamp + m.Duration;
+    }
+    public createInstrumentBrackets(instruments: List<Instrument>, staffHeight: number): void {
+        for (var idx: number = 0, len = instruments.Count; idx < len; ++idx) {
+            var instrument: Instrument = instruments[idx];
+            if (instrument.Staves.Count > 1) {
                 var firstStaffLine: StaffLine = null, lastStaffLine = null;
                 for (var idx2: number = 0, len2 = this.staffLines.Count; idx2 < len2; ++idx2) {
                     var staffLine: StaffLine = this.staffLines[idx2];
-                    if (staffLine.ParentStaff == instrument1.Staves[0])
+                    if (staffLine.ParentStaff == instrument.Staves[0])
                         firstStaffLine = staffLine;
-                    if (staffLine.ParentStaff == instrument2.Staves.Last())
+                    if (staffLine.ParentStaff == instrument.Staves[instrument.Staves.Count - 1])
                         lastStaffLine = staffLine;
                 }
                 if (firstStaffLine != null && lastStaffLine != null) {
@@ -120,123 +98,149 @@ module PhonicScore.MusicalScore.Graphical.SheetData {
                         firstStaffLine.PositionAndShape.RelativePosition.Y);
                     var rightLower: PointF_2D = new PointF_2D(lastStaffLine.PositionAndShape.RelativePosition.X,
                         lastStaffLine.PositionAndShape.RelativePosition.Y + staffHeight);
-                    this.createGroupBracket(rightUpper, rightLower, staffHeight, recursionDepth);
+                    this.createInstrumentBracket(rightUpper, rightLower);
                 }
-                if (instrumentGroup.InstrumentalGroups.Count < 1)
-                    continue;
-                createGroupBrackets(instrumentGroup.InstrumentalGroups, staffHeight, recursionDepth + 1);
             }
         }
-        public createMusicSystemLabel(instrumentLabelTextHeight: number, systemLabelsRightMargin: number, labelMarginBorderFactor: number): void {
-            if (this.parent == this.parent.Parent.MusicPages[0] && this == this.parent.MusicSystems[0]) {
-                var instruments: Instrument[] = this.parent.Parent.ParentMusicSheet.Instruments.Where(i => i.Voices.Count > 0 && i.Voices[0].Visible).ToArray();
-                for (var idx: number = 0, len = instruments.length; idx < len; ++idx) {
-                    var instrument: Instrument = instruments[idx];
-                    var graphicalLabel: GraphicalLabel = new GraphicalLabel(instrument.NameLabel, instrumentLabelTextHeight, TextAlignment.LeftCenter, this.boundingBox);
-                    graphicalLabel.setLabelPositionAndShapeBorders();
-                    this.labels.Add(graphicalLabel, instrument);
-                    this.boundingBox.ChildElements.Add(graphicalLabel.PositionAndShape);
-                    graphicalLabel.PositionAndShape.RelativePosition = new PointF_2D(0.0, 0.0);
-                }
-                this.maxLabelLength = 0.0f;
-                var labels: GraphicalLabel[] = this.labels.Keys.ToArray();
-                for (var idx: number = 0, len = labels.length; idx < len; ++idx) {
-                    var label: GraphicalLabel = labels[idx];
-                    if (label.PositionAndShape.Size.Width > this.maxLabelLength)
-                        this.maxLabelLength = label.PositionAndShape.Size.Width;
-                }
-                this.updateMusicSystemStaffLineXPosition(systemLabelsRightMargin);
+    }
+    public createGroupBrackets(instrumentGroups: List<InstrumentalGroup>, staffHeight: number, recursionDepth: number): void {
+        for (var idx: number = 0, len = instrumentGroups.Count; idx < len; ++idx) {
+            var instrumentGroup: InstrumentalGroup = instrumentGroups[idx];
+            if (instrumentGroup.InstrumentalGroups.Count < 1)
+                continue;
+            var instrument1: Instrument = this.findFirstVisibleInstrumentInInstrumentalGroup(instrumentGroup);
+            var instrument2: Instrument = this.findLastVisibleInstrumentInInstrumentalGroup(instrumentGroup);
+            if (instrument1 == null || instrument2 == null)
+                continue;
+            var firstStaffLine: StaffLine = null, lastStaffLine = null;
+            for (var idx2: number = 0, len2 = this.staffLines.Count; idx2 < len2; ++idx2) {
+                var staffLine: StaffLine = this.staffLines[idx2];
+                if (staffLine.ParentStaff == instrument1.Staves[0])
+                    firstStaffLine = staffLine;
+                if (staffLine.ParentStaff == instrument2.Staves.Last())
+                    lastStaffLine = staffLine;
             }
+            if (firstStaffLine != null && lastStaffLine != null) {
+                var rightUpper: PointF_2D = new PointF_2D(firstStaffLine.PositionAndShape.RelativePosition.X,
+                    firstStaffLine.PositionAndShape.RelativePosition.Y);
+                var rightLower: PointF_2D = new PointF_2D(lastStaffLine.PositionAndShape.RelativePosition.X,
+                    lastStaffLine.PositionAndShape.RelativePosition.Y + staffHeight);
+                this.createGroupBracket(rightUpper, rightLower, staffHeight, recursionDepth);
+            }
+            if (instrumentGroup.InstrumentalGroups.Count < 1)
+                continue;
+            createGroupBrackets(instrumentGroup.InstrumentalGroups, staffHeight, recursionDepth + 1);
         }
-        public setMusicSystemLabelsYPosition(): void {
-            if (this.parent == this.parent.Parent.MusicPages[0] && this == this.parent.MusicSystems[0]) {
-                var labels: KeyValuePair<GraphicalLabel, Instrument>[] = this.labels.ToArray();
-                for (var idx: number = 0, len = labels.length; idx < len; ++idx) {
-                    var entry: KeyValuePair<GraphicalLabel, Instrument> = labels[idx];
-                    var ypositionSum: number = 0;
-                    var staffCounter: number = 0;
-                    for (var i: number = 0; i < this.staffLines.Count; i++) {
-                        if (this.staffLines[i].ParentStaff.ParentInstrument == entry.Value) {
-                            for (var j: number = i; j < this.staffLines.Count; j++) {
-                                var staffLine: StaffLine = this.staffLines[j];
-                                if (staffLine.ParentStaff.ParentInstrument != entry.Value)
-                                    break;
-                                ypositionSum += staffLine.PositionAndShape.RelativePosition.Y;
-                                staffCounter++;
-                            }
-                            break;
+    }
+    public createMusicSystemLabel(instrumentLabelTextHeight: number, systemLabelsRightMargin: number, labelMarginBorderFactor: number): void {
+        if (this.parent == this.parent.Parent.MusicPages[0] && this == this.parent.MusicSystems[0]) {
+            var instruments: Instrument[] = this.parent.Parent.ParentMusicSheet.Instruments.Where(i => i.Voices.Count > 0 && i.Voices[0].Visible).ToArray();
+            for (var idx: number = 0, len = instruments.length; idx < len; ++idx) {
+                var instrument: Instrument = instruments[idx];
+                var graphicalLabel: GraphicalLabel = new GraphicalLabel(instrument.NameLabel, instrumentLabelTextHeight, TextAlignment.LeftCenter, this.boundingBox);
+                graphicalLabel.setLabelPositionAndShapeBorders();
+                this.labels.Add(graphicalLabel, instrument);
+                this.boundingBox.ChildElements.Add(graphicalLabel.PositionAndShape);
+                graphicalLabel.PositionAndShape.RelativePosition = new PointF_2D(0.0, 0.0);
+            }
+            this.maxLabelLength = 0.0;
+            var labels: GraphicalLabel[] = this.labels.Keys.ToArray();
+            for (var idx: number = 0, len = labels.length; idx < len; ++idx) {
+                var label: GraphicalLabel = labels[idx];
+                if (label.PositionAndShape.Size.Width > this.maxLabelLength)
+                    this.maxLabelLength = label.PositionAndShape.Size.Width;
+            }
+            this.updateMusicSystemStaffLineXPosition(systemLabelsRightMargin);
+        }
+    }
+    public setMusicSystemLabelsYPosition(): void {
+        if (this.parent == this.parent.Parent.MusicPages[0] && this == this.parent.MusicSystems[0]) {
+            var labels: KeyValuePair<GraphicalLabel, Instrument>[] = this.labels.ToArray();
+            for (var idx: number = 0, len = labels.length; idx < len; ++idx) {
+                var entry: KeyValuePair<GraphicalLabel, Instrument> = labels[idx];
+                var ypositionSum: number = 0;
+                var staffCounter: number = 0;
+                for (var i: number = 0; i < this.staffLines.Count; i++) {
+                    if (this.staffLines[i].ParentStaff.ParentInstrument == entry.Value) {
+                        for (var j: number = i; j < this.staffLines.Count; j++) {
+                            var staffLine: StaffLine = this.staffLines[j];
+                            if (staffLine.ParentStaff.ParentInstrument != entry.Value)
+                                break;
+                            ypositionSum += staffLine.PositionAndShape.RelativePosition.Y;
+                            staffCounter++;
                         }
+                        break;
                     }
-                    if (staffCounter > 0)
-                        entry.Key.PositionAndShape.RelativePosition = new PointF_2D(0.0, ypositionSum / staffCounter + 2.0);
                 }
+                if (staffCounter > 0)
+                    entry.Key.PositionAndShape.RelativePosition = new PointF_2D(0.0, ypositionSum / staffCounter + 2.0);
             }
         }
-        public checkStaffEntriesForStaffEntryLink(): boolean {
-            var first: boolean = false;
-            var second: boolean = false;
-            for (var i: number = 0; i < this.staffLines.Count - 1; i++) {
-                for (var idx: number = 0, len = this.staffLines[i].Measures.Count; idx < len; ++idx) {
-                    var measure: StaffMeasure = this.staffLines[i].Measures[idx];
-                    for (var idx2: number = 0, len2 = measure.StaffEntries.Count; idx2 < len2; ++idx2) {
-                        var staffEntry: GraphicalStaffEntry = measure.StaffEntries[idx2];
-                        if (staffEntry.SourceStaffEntry.Link != null)
-                            first = true;
-                    }
+    }
+    public checkStaffEntriesForStaffEntryLink(): boolean {
+        var first: boolean = false;
+        var second: boolean = false;
+        for (var i: number = 0; i < this.staffLines.Count - 1; i++) {
+            for (var idx: number = 0, len = this.staffLines[i].Measures.Count; idx < len; ++idx) {
+                var measure: StaffMeasure = this.staffLines[i].Measures[idx];
+                for (var idx2: number = 0, len2 = measure.StaffEntries.Count; idx2 < len2; ++idx2) {
+                    var staffEntry: GraphicalStaffEntry = measure.StaffEntries[idx2];
+                    if (staffEntry.SourceStaffEntry.Link != null)
+                        first = true;
                 }
-                for (var idx: number = 0, len = this.staffLines[i + 1].Measures.Count; idx < len; ++idx) {
-                    var measure: StaffMeasure = this.staffLines[i + 1].Measures[idx];
-                    for (var idx2: number = 0, len2 = measure.StaffEntries.Count; idx2 < len2; ++idx2) {
-                        var staffEntry: GraphicalStaffEntry = measure.StaffEntries[idx2];
-                        if (staffEntry.SourceStaffEntry.Link != null)
-                            second = true;
-                    }
+            }
+            for (var idx: number = 0, len = this.staffLines[i + 1].Measures.Count; idx < len; ++idx) {
+                var measure: StaffMeasure = this.staffLines[i + 1].Measures[idx];
+                for (var idx2: number = 0, len2 = measure.StaffEntries.Count; idx2 < len2; ++idx2) {
+                    var staffEntry: GraphicalStaffEntry = measure.StaffEntries[idx2];
+                    if (staffEntry.SourceStaffEntry.Link != null)
+                        second = true;
                 }
             }
-            if (first && second)
-                return true;
-            return false;
         }
-        protected calcInstrumentsBracketsWidth(): number { throw new Error('not implemented'); }
-        protected createInstrumentBracket(rightUpper: PointF_2D, rightLower: PointF_2D): void { throw new Error('not implemented'); }
-        protected createGroupBracket(rightUpper: PointF_2D, rightLower: PointF_2D, staffHeight: number,
-            recursionDepth: number): void { throw new Error('not implemented'); }
-        private findFirstVisibleInstrumentInInstrumentalGroup(instrumentalGroup: InstrumentalGroup): Instrument {
-            for (var idx: number = 0, len = instrumentalGroup.InstrumentalGroups.Count; idx < len; ++idx) {
-                var groupOrInstrument: InstrumentalGroup = instrumentalGroup.InstrumentalGroups[idx];
-                if (groupOrInstrument instanceof Instrument) {
-                    if ((<Instrument>groupOrInstrument).Visible == true)
-                        return <Instrument>groupOrInstrument;
-                    continue;
-                }
-                return this.findFirstVisibleInstrumentInInstrumentalGroup(groupOrInstrument);
+        if (first && second)
+            return true;
+        return false;
+    }
+    protected calcInstrumentsBracketsWidth(): number { throw new Error('not implemented'); }
+    protected createInstrumentBracket(rightUpper: PointF_2D, rightLower: PointF_2D): void { throw new Error('not implemented'); }
+    protected createGroupBracket(rightUpper: PointF_2D, rightLower: PointF_2D, staffHeight: number,
+        recursionDepth: number): void { throw new Error('not implemented'); }
+    private findFirstVisibleInstrumentInInstrumentalGroup(instrumentalGroup: InstrumentalGroup): Instrument {
+        for (var idx: number = 0, len = instrumentalGroup.InstrumentalGroups.Count; idx < len; ++idx) {
+            var groupOrInstrument: InstrumentalGroup = instrumentalGroup.InstrumentalGroups[idx];
+            if (groupOrInstrument instanceof Instrument) {
+                if ((<Instrument>groupOrInstrument).Visible == true)
+                    return <Instrument>groupOrInstrument;
+                continue;
             }
-            return null;
+            return this.findFirstVisibleInstrumentInInstrumentalGroup(groupOrInstrument);
         }
-        private findLastVisibleInstrumentInInstrumentalGroup(instrumentalGroup: InstrumentalGroup): Instrument {
-            var groupOrInstrument: InstrumentalGroup;
-            for (var i: number = instrumentalGroup.InstrumentalGroups.Count - 1; i >= 0; i--) {
-                groupOrInstrument = instrumentalGroup.InstrumentalGroups[i];
-                if (groupOrInstrument instanceof Instrument) {
-                    if ((<Instrument>groupOrInstrument).Visible == true)
-                        return <Instrument>groupOrInstrument;
-                    continue;
-                }
-                return this.findLastVisibleInstrumentInInstrumentalGroup(groupOrInstrument);
+        return null;
+    }
+    private findLastVisibleInstrumentInInstrumentalGroup(instrumentalGroup: InstrumentalGroup): Instrument {
+        var groupOrInstrument: InstrumentalGroup;
+        for (var i: number = instrumentalGroup.InstrumentalGroups.Count - 1; i >= 0; i--) {
+            groupOrInstrument = instrumentalGroup.InstrumentalGroups[i];
+            if (groupOrInstrument instanceof Instrument) {
+                if ((<Instrument>groupOrInstrument).Visible == true)
+                    return <Instrument>groupOrInstrument;
+                continue;
             }
-            return null;
+            return this.findLastVisibleInstrumentInInstrumentalGroup(groupOrInstrument);
         }
-        private updateMusicSystemStaffLineXPosition(systemLabelsRightMargin: number): void {
-            for (var idx: number = 0, len = this.StaffLines.Count; idx < len; ++idx) {
-                var staffLine: StaffLine = this.StaffLines[idx];
-                var relative: PointF_2D = staffLine.PositionAndShape.RelativePosition;
-                relative.X = this.maxLabelLength + systemLabelsRightMargin;
-                staffLine.PositionAndShape.RelativePosition = relative;
-                staffLine.PositionAndShape.BorderRight = this.boundingBox.Size.Width - this.maxLabelLength - systemLabelsRightMargin;
-                for (var i: number = 0; i < staffLine.StaffLines.Length; i++) {
-                    var lineEnd: PointF_2D = new PointF_2D(staffLine.PositionAndShape.Size.Width, staffLine.StaffLines[i].End.Y);
-                    staffLine.StaffLines[i].End = lineEnd;
-                }
+        return null;
+    }
+    private updateMusicSystemStaffLineXPosition(systemLabelsRightMargin: number): void {
+        for (var idx: number = 0, len = this.StaffLines.Count; idx < len; ++idx) {
+            var staffLine: StaffLine = this.StaffLines[idx];
+            var relative: PointF_2D = staffLine.PositionAndShape.RelativePosition;
+            relative.X = this.maxLabelLength + systemLabelsRightMargin;
+            staffLine.PositionAndShape.RelativePosition = relative;
+            staffLine.PositionAndShape.BorderRight = this.boundingBox.Size.Width - this.maxLabelLength - systemLabelsRightMargin;
+            for (var i: number = 0; i < staffLine.StaffLines.Length; i++) {
+                var lineEnd: PointF_2D = new PointF_2D(staffLine.PositionAndShape.Size.Width, staffLine.StaffLines[i].End.Y);
+                staffLine.StaffLines[i].End = lineEnd;
             }
         }
     }

+ 5 - 4
src/MusicalScore/Graphical/StaffLine.ts

@@ -1,10 +1,11 @@
 import {Staff} from "../VoiceData/Staff";
 import {BoundingBox} from "./BoundingBox";
 import {Instrument} from "../Instrument";
-import GraphicalObject = PhonicScore.MusicalScore.Graphical.GraphicalObject;
-import StaffMeasure = PhonicScore.MusicalScore.Graphical.SheetData.StaffMeasure;
-import MusicSystem = PhonicScore.MusicalScore.Graphical.SheetData.MusicSystem;
 import {GraphicalLine} from "./GraphicalLine";
+import {GraphicalStaffEntry} from "./GraphicalStaffEntry";
+import {GraphicalObject} from "./GraphicalObject";
+import {StaffMeasure} from "./StaffMeasure";
+import {MusicSystem} from "./MusicSystem";
 export class StaffLine extends GraphicalObject {
     protected measures: List<StaffMeasure> = new List<StaffMeasure>();
     protected staffLines: GraphicalLine[] = new Array(5);
@@ -66,7 +67,7 @@ export class StaffLine extends GraphicalObject {
             var graphicalMeasure: StaffMeasure = this.Measures[idx];
             for (var idx2: number = 0, len2 = graphicalMeasure.StaffEntries.Count; idx2 < len2; ++idx2) {
                 var graphicalStaffEntry: GraphicalStaffEntry = graphicalMeasure.StaffEntries[idx2];
-                if (Math.Abs(graphicalStaffEntry.PositionAndShape.RelativePosition.X - xPosition + graphicalMeasure.PositionAndShape.RelativePosition.X) < 5.0f)
+                if (Math.Abs(graphicalStaffEntry.PositionAndShape.RelativePosition.X - xPosition + graphicalMeasure.PositionAndShape.RelativePosition.X) < 5.0)
                 {
                     difference = Math.Abs(graphicalStaffEntry.PositionAndShape.RelativePosition.X - xPosition + graphicalMeasure.PositionAndShape.RelativePosition.X);
                     closestStaffentry = graphicalStaffEntry;

+ 175 - 164
src/MusicalScore/Graphical/StaffMeasure.ts

@@ -1,179 +1,190 @@
-module PhonicScore.MusicalScore.Graphical.SheetData {
-    export class StaffMeasure extends GraphicalObject {
-        protected firstInstructionStaffEntry: GraphicalStaffEntry;
-        protected lastInstructionStaffEntry: GraphicalStaffEntry;
-        private staff: Staff;
-        private measureNumber: number = -1;
-        private parentStaffLine: StaffLine;
-        constructor(staff: Staff, parentSourceMeasure: SourceMeasure) {
-            this.staff = staff;
-            this.ParentSourceMeasure = parentSourceMeasure;
-            this.StaffEntries = new List<GraphicalStaffEntry>();
-            if (this.ParentSourceMeasure != null)
-                this.measureNumber = this.ParentSourceMeasure.MeasureNumber;
-        }
-        constructor(staffLine: StaffLine) {
-            this.parentStaffLine = staffLine;
-            this.staff = staffLine.ParentStaff;
-            this.StaffEntries = new List<GraphicalStaffEntry>();
-        }
-        public ParentSourceMeasure: SourceMeasure;
-        public StaffEntries: List<GraphicalStaffEntry>;
-        public ParentMusicSystem: MusicSystem;
-        public BeginInstructionsWidth: number;
-        public MinimumStaffEntriesWidth: number;
-        public StaffEntriesScaleFactor: number;
-        public EndInstructionsWidth: number;
-        public hasError: boolean;
-        public get ParentStaff(): Staff {
-            return this.staff;
-        }
-        public get MeasureNumber(): number {
-            return this.measureNumber;
-        }
-        public get FirstInstructionStaffEntry(): GraphicalStaffEntry {
-            return this.firstInstructionStaffEntry;
-        }
-        public set FirstInstructionStaffEntry(value: GraphicalStaffEntry) {
-            this.firstInstructionStaffEntry = value;
-        }
-        public get LastInstructionStaffEntry(): GraphicalStaffEntry {
-            return this.lastInstructionStaffEntry;
-        }
-        public set LastInstructionStaffEntry(value: GraphicalStaffEntry) {
-            this.lastInstructionStaffEntry = value;
-        }
-        public get ParentStaffLine(): StaffLine {
-            return this.parentStaffLine;
-        }
-        public set ParentStaffLine(value: StaffLine) {
-            this.parentStaffLine = value;
-            if (this.parentStaffLine != null)
-                PositionAndShape.Parent = this.parentStaffLine.PositionAndShape;
-        }
-        public ResetLayout(): void { throw new Error('not implemented'); }
-        public GetLineWidth(line: SystemLinesEnum): number { throw new Error('not implemented'); }
-        public AddClefAtBegin(clef: ClefInstruction): void { throw new Error('not implemented'); }
-        public AddKeyAtBegin(currentKey: KeyInstruction, previousKey: KeyInstruction, currentClef: ClefInstruction): void { throw new Error('not implemented'); }
-        public AddRhythmAtBegin(rhythm: RhythmInstruction): void { throw new Error('not implemented'); }
-        public AddClefAtEnd(clef: ClefInstruction): void { throw new Error('not implemented'); }
-        public SetPositionInStaffline(xPos: number): void { throw new Error('not implemented'); }
-        public SetWidth(width: number): void { throw new Error('not implemented'); }
-        public LayoutSymbols(): void { throw new Error('not implemented'); }
-        public findGraphicalStaffEntryFromTimestamp(relativeTimestamp: Fraction): GraphicalStaffEntry {
-            for (var idx: number = 0, len = this.StaffEntries.Count; idx < len; ++idx) {
-                var graphicalStaffEntry: GraphicalStaffEntry = this.StaffEntries[idx];
-                if (graphicalStaffEntry.RelInMeasureTimestamp == relativeTimestamp)
-                    return graphicalStaffEntry;
-            }
-            return null;
+import {MusicSystem} from "./MusicSystem";
+import {GraphicalStaffEntry} from "./GraphicalStaffEntry";
+import {SourceMeasure} from "../VoiceData/SourceMeasure";
+import {StaffLine} from "./StaffLine";
+import {Staff} from "../VoiceData/Staff";
+import {GraphicalObject} from "./GraphicalObject";
+import {ClefInstruction} from "../VoiceData/Instructions/ClefInstruction";
+import {KeyInstruction} from "../VoiceData/Instructions/KeyInstruction";
+import {RhythmInstruction} from "../VoiceData/Instructions/RhythmInstruction";
+import {Fraction} from "../../Common/DataObjects/fraction";
+import {Voice} from "../VoiceData/Voice";
+import {VoiceEntry} from "../VoiceData/VoiceEntry";
+import {GraphicalNote} from "./GraphicalNote";
+export class StaffMeasure extends GraphicalObject {
+    protected firstInstructionStaffEntry: GraphicalStaffEntry;
+    protected lastInstructionStaffEntry: GraphicalStaffEntry;
+    private staff: Staff;
+    private measureNumber: number = -1;
+    private parentStaffLine: StaffLine;
+    constructor(staff: Staff, parentSourceMeasure: SourceMeasure) {
+        this.staff = staff;
+        this.ParentSourceMeasure = parentSourceMeasure;
+        this.StaffEntries = new List<GraphicalStaffEntry>();
+        if (this.ParentSourceMeasure != null)
+            this.measureNumber = this.ParentSourceMeasure.MeasureNumber;
+    }
+    constructor(staffLine: StaffLine) {
+        this.parentStaffLine = staffLine;
+        this.staff = staffLine.ParentStaff;
+        this.StaffEntries = new List<GraphicalStaffEntry>();
+    }
+    public ParentSourceMeasure: SourceMeasure;
+    public StaffEntries: List<GraphicalStaffEntry>;
+    public ParentMusicSystem: MusicSystem;
+    public BeginInstructionsWidth: number;
+    public MinimumStaffEntriesWidth: number;
+    public StaffEntriesScaleFactor: number;
+    public EndInstructionsWidth: number;
+    public hasError: boolean;
+    public get ParentStaff(): Staff {
+        return this.staff;
+    }
+    public get MeasureNumber(): number {
+        return this.measureNumber;
+    }
+    public get FirstInstructionStaffEntry(): GraphicalStaffEntry {
+        return this.firstInstructionStaffEntry;
+    }
+    public set FirstInstructionStaffEntry(value: GraphicalStaffEntry) {
+        this.firstInstructionStaffEntry = value;
+    }
+    public get LastInstructionStaffEntry(): GraphicalStaffEntry {
+        return this.lastInstructionStaffEntry;
+    }
+    public set LastInstructionStaffEntry(value: GraphicalStaffEntry) {
+        this.lastInstructionStaffEntry = value;
+    }
+    public get ParentStaffLine(): StaffLine {
+        return this.parentStaffLine;
+    }
+    public set ParentStaffLine(value: StaffLine) {
+        this.parentStaffLine = value;
+        if (this.parentStaffLine != null)
+            this.PositionAndShape.Parent = this.parentStaffLine.PositionAndShape;
+    }
+    public ResetLayout(): void { throw new Error('not implemented'); }
+    public GetLineWidth(line: SystemLinesEnum): number { throw new Error('not implemented'); }
+    public AddClefAtBegin(clef: ClefInstruction): void { throw new Error('not implemented'); }
+    public AddKeyAtBegin(currentKey: KeyInstruction, previousKey: KeyInstruction, currentClef: ClefInstruction): void { throw new Error('not implemented'); }
+    public AddRhythmAtBegin(rhythm: RhythmInstruction): void { throw new Error('not implemented'); }
+    public AddClefAtEnd(clef: ClefInstruction): void { throw new Error('not implemented'); }
+    public SetPositionInStaffline(xPos: number): void { throw new Error('not implemented'); }
+    public SetWidth(width: number): void { throw new Error('not implemented'); }
+    public LayoutSymbols(): void { throw new Error('not implemented'); }
+    public findGraphicalStaffEntryFromTimestamp(relativeTimestamp: Fraction): GraphicalStaffEntry {
+        for (var idx: number = 0, len = this.StaffEntries.Count; idx < len; ++idx) {
+            var graphicalStaffEntry: GraphicalStaffEntry = this.StaffEntries[idx];
+            if (graphicalStaffEntry.RelInMeasureTimestamp == relativeTimestamp)
+                return graphicalStaffEntry;
+        }
+        return null;
+    }
+    public findGraphicalStaffEntryFromVerticalContainerTimestamp(absoluteTimestamp: Fraction): GraphicalStaffEntry {
+        for (var idx: number = 0, len = this.StaffEntries.Count; idx < len; ++idx) {
+            var graphicalStaffEntry: GraphicalStaffEntry = this.StaffEntries[idx];
+            if (graphicalStaffEntry.SourceStaffEntry.VerticalContainerParent.getAbsoluteTimestamp() == absoluteTimestamp)
+                return graphicalStaffEntry;
         }
-        public findGraphicalStaffEntryFromVerticalContainerTimestamp(absoluteTimestamp: Fraction): GraphicalStaffEntry {
-            for (var idx: number = 0, len = this.StaffEntries.Count; idx < len; ++idx) {
-                var graphicalStaffEntry: GraphicalStaffEntry = this.StaffEntries[idx];
-                if (graphicalStaffEntry.SourceStaffEntry.VerticalContainerParent.getAbsoluteTimestamp() == absoluteTimestamp)
-                    return graphicalStaffEntry;
-            }
-            return null;
+        return null;
+    }
+    public hasSameDurationWithSourceMeasureParent(): boolean {
+        var duration: Fraction = new Fraction(0, 1);
+        for (var idx: number = 0, len = this.StaffEntries.Count; idx < len; ++idx) {
+            var graphicalStaffEntry: GraphicalStaffEntry = this.StaffEntries[idx];
+            duration.Add(graphicalStaffEntry.findStaffEntryMinNoteLength());
         }
-        public hasSameDurationWithSourceMeasureParent(): boolean {
-            var duration: Fraction = new Fraction(0, 1);
-            for (var idx: number = 0, len = this.StaffEntries.Count; idx < len; ++idx) {
-                var graphicalStaffEntry: GraphicalStaffEntry = this.StaffEntries[idx];
-                duration.Add(graphicalStaffEntry.findStaffEntryMinNoteLength());
+        return duration == this.ParentSourceMeasure.Duration;
+    }
+    public hasMultipleVoices(): boolean {
+        if (this.StaffEntries.Count == 0)
+            return false;
+        var voices: List<Voice> = new List<Voice>();
+        for (var idx: number = 0, len = this.StaffEntries.Count; idx < len; ++idx) {
+            var staffEntry: GraphicalStaffEntry = this.StaffEntries[idx];
+            for (var idx2: number = 0, len2 = staffEntry.SourceStaffEntry.VoiceEntries.Count; idx2 < len2; ++idx2) {
+                var voiceEntry: VoiceEntry = staffEntry.SourceStaffEntry.VoiceEntries[idx2];
+                if (!voices.Contains(voiceEntry.ParentVoice))
+                    voices.Add(voiceEntry.ParentVoice);
             }
-            return duration == this.ParentSourceMeasure.Duration;
         }
-        public hasMultipleVoices(): boolean {
-            if (this.StaffEntries.Count == 0)
-                return false;
-            var voices: List<Voice> = new List<Voice>();
-            for (var idx: number = 0, len = this.StaffEntries.Count; idx < len; ++idx) {
-                var staffEntry: GraphicalStaffEntry = this.StaffEntries[idx];
-                for (var idx2: number = 0, len2 = staffEntry.SourceStaffEntry.VoiceEntries.Count; idx2 < len2; ++idx2) {
-                    var voiceEntry: VoiceEntry = staffEntry.SourceStaffEntry.VoiceEntries[idx2];
-                    if (!voices.Contains(voiceEntry.ParentVoice))
-                        voices.Add(voiceEntry.ParentVoice);
-                }
+        if (voices.Count > 1)
+            return true;
+        return false;
+    }
+    public isVisible(): boolean {
+        return this.ParentStaff.ParentInstrument.Visible;
+    }
+    public getGraphicalMeasureDurationFromStaffEntries(): Fraction {
+        var duration: Fraction = new Fraction(0, 1);
+        var voices: List<Voice> = new List<Voice>();
+        for (var idx: number = 0, len = this.StaffEntries.Count; idx < len; ++idx) {
+            var graphicalStaffEntry: GraphicalStaffEntry = this.StaffEntries[idx];
+            for (var idx2: number = 0, len2 = graphicalStaffEntry.SourceStaffEntry.VoiceEntries.Count; idx2 < len2; ++idx2) {
+                var voiceEntry: VoiceEntry = graphicalStaffEntry.SourceStaffEntry.VoiceEntries[idx2];
+                if (!voices.Contains(voiceEntry.ParentVoice))
+                    voices.Add(voiceEntry.ParentVoice);
             }
-            if (voices.Count > 1)
-                return true;
-            return false;
-        }
-        public isVisible(): boolean {
-            return this.ParentStaff.ParentInstrument.Visible;
         }
-        public getGraphicalMeasureDurationFromStaffEntries(): Fraction {
-            var duration: Fraction = new Fraction(0, 1);
-            var voices: List<Voice> = new List<Voice>();
-            for (var idx: number = 0, len = this.StaffEntries.Count; idx < len; ++idx) {
-                var graphicalStaffEntry: GraphicalStaffEntry = this.StaffEntries[idx];
-                for (var idx2: number = 0, len2 = graphicalStaffEntry.SourceStaffEntry.VoiceEntries.Count; idx2 < len2; ++idx2) {
-                    var voiceEntry: VoiceEntry = graphicalStaffEntry.SourceStaffEntry.VoiceEntries[idx2];
-                    if (!voices.Contains(voiceEntry.ParentVoice))
-                        voices.Add(voiceEntry.ParentVoice);
+        for (var idx: number = 0, len = voices.Count; idx < len; ++idx) {
+            var voice: Voice = voices[idx];
+            var voiceDuration: Fraction = new Fraction(0, 1);
+            for (var idx2: number = 0, len2 = this.StaffEntries.Count; idx2 < len2; ++idx2) {
+                var graphicalStaffEntry: GraphicalStaffEntry = this.StaffEntries[idx2];
+                for (var idx3: number = 0, len3 = graphicalStaffEntry.Notes.Count; idx3 < len3; ++idx3) {
+                    var graphicalNotes: List<GraphicalNote> = graphicalStaffEntry.Notes[idx3];
+                    if (graphicalNotes.Count > 0 && graphicalNotes[0].SourceNote.ParentVoiceEntry.ParentVoice == voice)
+                        voiceDuration.Add(graphicalNotes[0].GraphicalNoteLength);
                 }
             }
-            for (var idx: number = 0, len = voices.Count; idx < len; ++idx) {
-                var voice: Voice = voices[idx];
-                var voiceDuration: Fraction = new Fraction(0, 1);
-                for (var idx2: number = 0, len2 = this.StaffEntries.Count; idx2 < len2; ++idx2) {
-                    var graphicalStaffEntry: GraphicalStaffEntry = this.StaffEntries[idx2];
-                    for (var idx3: number = 0, len3 = graphicalStaffEntry.Notes.Count; idx3 < len3; ++idx3) {
-                        var graphicalNotes: List<GraphicalNote> = graphicalStaffEntry.Notes[idx3];
-                        if (graphicalNotes.Count > 0 && graphicalNotes[0].SourceNote.ParentVoiceEntry.ParentVoice == voice)
-                            voiceDuration.Add(graphicalNotes[0].GraphicalNoteLength);
-                    }
-                }
-                if (voiceDuration > duration)
-                    duration = new Fraction(voiceDuration);
-            }
-            return duration;
+            if (voiceDuration > duration)
+                duration = new Fraction(voiceDuration);
         }
-        public addGraphicalStaffEntry(graphicalStaffEntry: GraphicalStaffEntry): void {
-            this.StaffEntries.Add(graphicalStaffEntry);
-            PositionAndShape.ChildElements.Add(graphicalStaffEntry.PositionAndShape);
-        }
-        public addGraphicalStaffEntryAtTimestamp(staffEntry: GraphicalStaffEntry): void {
-            if (staffEntry != null) {
-                if (this.StaffEntries.Count == 0 || this.StaffEntries[this.StaffEntries.Count - 1].RelInMeasureTimestamp < staffEntry.RelInMeasureTimestamp)
-                    this.StaffEntries.Add(staffEntry);
-                else {
-                    for (var i: number = this.StaffEntries.Count - 1; i >= 0; i--) {
-                        if (this.StaffEntries[i].RelInMeasureTimestamp < staffEntry.RelInMeasureTimestamp) {
-                            this.StaffEntries.Insert(i + 1, staffEntry);
-                            break;
-                        }
-                        if (i == 0)
-                            this.StaffEntries.Insert(i, staffEntry);
+        return duration;
+    }
+    public addGraphicalStaffEntry(graphicalStaffEntry: GraphicalStaffEntry): void {
+        this.StaffEntries.Add(graphicalStaffEntry);
+        this.PositionAndShape.ChildElements.Add(graphicalStaffEntry.PositionAndShape);
+    }
+    public addGraphicalStaffEntryAtTimestamp(staffEntry: GraphicalStaffEntry): void {
+        if (staffEntry != null) {
+            if (this.StaffEntries.Count == 0 || this.StaffEntries[this.StaffEntries.Count - 1].RelInMeasureTimestamp < staffEntry.RelInMeasureTimestamp)
+                this.StaffEntries.Add(staffEntry);
+            else {
+                for (var i: number = this.StaffEntries.Count - 1; i >= 0; i--) {
+                    if (this.StaffEntries[i].RelInMeasureTimestamp < staffEntry.RelInMeasureTimestamp) {
+                        this.StaffEntries.Insert(i + 1, staffEntry);
+                        break;
                     }
+                    if (i == 0)
+                        this.StaffEntries.Insert(i, staffEntry);
                 }
-                PositionAndShape.ChildElements.Add(staffEntry.PositionAndShape);
             }
+            this.PositionAndShape.ChildElements.Add(staffEntry.PositionAndShape);
         }
-        public beginsWithLineRepetition(): boolean {
-            var sourceMeasure: SourceMeasure = this.ParentSourceMeasure;
-            if (sourceMeasure == null)
-                return false;
-            return sourceMeasure.beginsWithLineRepetition();
-        }
-        public endsWithLineRepetition(): boolean {
-            var sourceMeasure: SourceMeasure = this.ParentSourceMeasure;
-            if (sourceMeasure == null)
-                return false;
-            return sourceMeasure.endsWithLineRepetition();
-        }
-        public beginsWithWordRepetition(): boolean {
-            var sourceMeasure: SourceMeasure = this.ParentSourceMeasure;
-            if (sourceMeasure == null)
-                return false;
-            return sourceMeasure.beginsWithWordRepetition();
-        }
-        public endsWithWordRepetition(): boolean {
-            var sourceMeasure: SourceMeasure = this.ParentSourceMeasure;
-            if (sourceMeasure == null)
-                return false;
-            return sourceMeasure.endsWithWordRepetition();
-        }
+    }
+    public beginsWithLineRepetition(): boolean {
+        var sourceMeasure: SourceMeasure = this.ParentSourceMeasure;
+        if (sourceMeasure == null)
+            return false;
+        return sourceMeasure.beginsWithLineRepetition();
+    }
+    public endsWithLineRepetition(): boolean {
+        var sourceMeasure: SourceMeasure = this.ParentSourceMeasure;
+        if (sourceMeasure == null)
+            return false;
+        return sourceMeasure.endsWithLineRepetition();
+    }
+    public beginsWithWordRepetition(): boolean {
+        var sourceMeasure: SourceMeasure = this.ParentSourceMeasure;
+        if (sourceMeasure == null)
+            return false;
+        return sourceMeasure.beginsWithWordRepetition();
+    }
+    public endsWithWordRepetition(): boolean {
+        var sourceMeasure: SourceMeasure = this.ParentSourceMeasure;
+        if (sourceMeasure == null)
+            return false;
+        return sourceMeasure.endsWithWordRepetition();
     }
 }

+ 1 - 0
src/MusicalScore/Graphical/VerticalGraphicalStaffEntryContainer.ts

@@ -1,4 +1,5 @@
 import {Fraction} from "../../Common/DataObjects/fraction";
+import {GraphicalStaffEntry} from "./GraphicalStaffEntry";
 export class VerticalGraphicalStaffEntryContainer {
     private index: number;
     private absoluteTimestamp: Fraction;