Forráskód Böngészése

Fixed most of Graphical Objects

Andrea Condoluci 9 éve
szülő
commit
bc41ff371c

+ 1 - 0
extras/macrogen.py

@@ -72,6 +72,7 @@ replace = (
 
     ("\\.IdInMusicSheet", ".idInMusicSheet"),
     ("F_2D", "F2D"),
+    ("List<Tuple<Object\\[\\], Object>>", "[Object[], Object][]")
 )
 
 def checkForIssues(filename, content):

+ 24 - 3
src/MusicalScore/Graphical/FontInfo.ts

@@ -11,12 +11,15 @@ export class FontInfo {
     constructor() {
         this.createSymbols();
     }
+
     public static get Info(): FontInfo {
         return FontInfo.info;
     }
+
     public updateSymbol(symbol: MusicSymbol, newSymbolInfo: SymbolInfo): void {
         this.symbolMapping[symbol] = newSymbolInfo;
     }
+
     public getSymbolInfo(symbol: MusicSymbol): SymbolInfo {
         try {
             return this.symbolMapping[symbol];
@@ -26,6 +29,7 @@ export class FontInfo {
         }
 
     }
+
     public getBoundingBox(symbol: MusicSymbol): SizeF2D {
         try {
             return this.symbolMapping[symbol].boundingBox;
@@ -35,21 +39,25 @@ export class FontInfo {
         }
 
     }
+
     public addBoundingBox(symbol: MusicSymbol, boundingBox: SizeF2D): void {
         let si: SymbolInfo = this.symbolMapping[symbol];
         si.boundingBox = boundingBox;
         this.symbolMapping.Remove(symbol);
         this.symbolMapping.push(symbol, si);
     }
+
     public getCenterDistance(symbol: SymbolInfo): SizeF2D {
         let symbolBox: SizeF2D = symbol.boundingBox;
         let symbolCenter: PointF2D = symbol.center;
         let centerDistance: SizeF2D = new SizeF2D(symbolBox.width * symbolCenter.x, symbolBox.height * symbolCenter.y);
         return centerDistance;
     }
+
     public fillPSI(psi: BoundingBox, symbol: MusicSymbol): void {
         this.fillPSI(psi, symbol, 1.0);
     }
+
     public fillPSI(psi: BoundingBox, symbol: MusicSymbol, scaleFactor: number): void {
         let symbolInfo: SymbolInfo = this.symbolMapping[symbol];
         let symbolBox: SizeF2D = symbolInfo.boundingBox;
@@ -65,6 +73,7 @@ export class FontInfo {
         psi.BorderMarginTop = (-centerDistance.height - symbolBox.height * symbolMargins.top) * scaleFactor;
         psi.BorderMarginBottom = (symbolBox.height - centerDistance.height + symbolBox.height * symbolMargins.bottom) * scaleFactor;
     }
+
     protected getString(symbol: MusicSymbol): string {
         try {
             return this.symbolMapping[symbol].symbol;
@@ -74,6 +83,7 @@ export class FontInfo {
         }
 
     }
+
     protected getScaleFactor(symbol: MusicSymbol): number {
         try {
             return this.symbolMapping[symbol].scaleFactor;
@@ -83,6 +93,7 @@ export class FontInfo {
         }
 
     }
+
     private createSymbols(): void {
         let scaleVector: number[] = [1, 1, 3, 3, 3,
             3, 3, 3, 3,
@@ -111,7 +122,7 @@ export class FontInfo {
             1.2, 1.2, 1.35, 1.2, 1.2,
             1, 1.7, 1.8, 1.09, 0.77, 3.0];
         let centerVector: PointF2D[] = [new PointF2D(0.5, 0.5),
-        new PointF2D(0.5, 0.5),
+            new PointF2D(0.5, 0.5),
             new PointF2D(0.0, 1.0),
             new PointF2D(0.0, 0.0),
             new PointF2D(0.0, 1.0),
@@ -196,7 +207,7 @@ export class FontInfo {
             new PointF2D(0.5, 0.5),
             new PointF2D(0.5, 0.5)];
         let marginVector: SymbolMargins[] = [new SymbolMargins(0.1, 0.1, 0.1, 0.1),
-        new SymbolMargins(0.1, 0.1),
+            new SymbolMargins(0.1, 0.1),
             new SymbolMargins(0.1, 0.1),
             new SymbolMargins(0.1, 0.1),
             new SymbolMargins(0.1, 0.1),
@@ -282,7 +293,7 @@ export class FontInfo {
             new SymbolMargins(0.1, 0.1, 0.1, 0.1)];
         let values: Array = Enum.GetValues(/*typeof*/MusicSymbol);
         let i: number = 0;
-        for (let c: string = <string>0x21; c <<string>0x21 + values.length; c++) {
+        for (let c: string = <string>0x21; c << string > 0x21 + values.length; c++) {
             let si: SymbolInfo = new SymbolInfo(c.ToString(), i, scaleVector[i], centerVector[i], marginVector[i]);
             this.symbolMapping.push(<MusicSymbol>values.GetValue(i), si);
             i++;
@@ -296,6 +307,7 @@ export class SymbolInfo {
     public boundingBox: SizeF2D;
     public center: PointF2D;
     public margins: SymbolMargins;
+
     constructor(symbol: string, id: number, scaleFactor: number, center: PointF2D, margins: SymbolMargins) {
         this.symbol = symbol;
         this.id = id;
@@ -303,27 +315,35 @@ export class SymbolInfo {
         this.center = center;
         this.margins = margins;
     }
+
     public get ScaleFactor(): number {
         return this.scaleFactor;
     }
+
     public set ScaleFactor(value: number) {
         this.scaleFactor = value;
     }
+
     public get BoundingBox(): SizeF2D {
         return this.boundingBox;
     }
+
     public set BoundingBox(value: SizeF2D) {
         this.boundingBox = value;
     }
+
     public get Center(): PointF2D {
         return this.center;
     }
+
     public set Center(value: PointF2D) {
         this.center = value;
     }
+
     public get Margins(): SymbolMargins {
         return this.margins;
     }
+
     public set Margins(value: SymbolMargins) {
         this.margins = value;
     }
@@ -334,6 +354,7 @@ export class SymbolMargins {
     public right: number;
     public top: number;
     public bottom: number;
+
     constructor(left: number, right: number, top: number = 0, bottom: number = 0) {
         this.left = left;
         this.right = right;

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

@@ -5,6 +5,7 @@ import {ChordSymbolContainer} from "../VoiceData/ChordSymbolContainer";
 import {BoundingBox} from "./BoundingBox";
 import {GraphicalObject} from "./GraphicalObject";
 import {PointF2D} from "../../Common/DataObjects/PointF2D";
+
 export class GraphicalChordSymbolContainer extends GraphicalObject {
     private chordSymbolContainer: ChordSymbolContainer;
     private graphicalLabel: GraphicalLabel;

+ 10 - 2
src/MusicalScore/Graphical/GraphicalLabel.ts

@@ -4,29 +4,36 @@ import {Clickable} from "./Clickable";
 import {BoundingBox} from "./BoundingBox";
 import {EngravingRules} from "./EngravingRules";
 import {MusicSheetCalculator} from "./MusicSheetCalculator";
+
 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(""))
+        if (this.Label.Text.trim() === "") {
             return;
+        }
         let labelMarginBorderFactor: number = EngravingRules.Rules.LabelMarginBorderFactor;
 
-        let widthToHeightRatio: number = MusicSheetCalculator.TextMeasurer.computeTextWidthToHeightRatio(this.Label.Text, this.Label.Font, this.Label.FontStyle);
+        let widthToHeightRatio: number =
+            MusicSheetCalculator.TextMeasurer.computeTextWidthToHeightRatio(this.Label.Text, this.Label.Font, this.Label.FontStyle);
         let height: number = this.Label.FontHeight;
         let width: number = height * widthToHeightRatio;
         let psi: BoundingBox = this.PositionAndShape;
@@ -85,6 +92,7 @@ export class GraphicalLabel extends Clickable {
                 psi.BorderBottom = height;
                 psi.BorderRight = 0;
                 break;
+            default:
         }
         psi.BorderMarginTop = psi.BorderTop - height * labelMarginBorderFactor;
         psi.BorderMarginLeft = psi.BorderLeft - height * labelMarginBorderFactor;

+ 8 - 5
src/MusicalScore/Graphical/GraphicalLine.ts

@@ -1,16 +1,19 @@
 import {OutlineAndFillStyleEnum} from "./DrawingEnums";
 import {PointF2D} from "../../Common/DataObjects/PointF2D";
+
 export class GraphicalLine {
-    private start: PointF2D;
-    private end: PointF2D;
-    private width: number;
     constructor(start: PointF2D, end: PointF2D, width: number = 0, styleEnum: OutlineAndFillStyleEnum = OutlineAndFillStyleEnum.BaseWritingColor) {
         this.start = start;
         this.end = end;
         this.width = width;
-        this.StyleId = <number>styleEnum;
+        this.styleId = <number>styleEnum;
     }
-    public StyleId: number;
+    public styleId: number;
+
+    private start: PointF2D;
+    private end: PointF2D;
+    private width: number;
+
     public get Start(): PointF2D {
         return this.start;
     }

+ 9 - 3
src/MusicalScore/Graphical/GraphicalLyricEntry.ts

@@ -5,19 +5,25 @@ import {GraphicalStaffEntry} from "./GraphicalStaffEntry";
 import {Label} from "../Label";
 import {TextAlignment} from "../../Common/Enums/TextAlignment";
 import {PointF2D} from "../../Common/DataObjects/PointF2D";
+
 export class GraphicalLyricEntry {
     private lyricsEntry: LyricsEntry;
     private graphicalLyricWord: GraphicalLyricWord;
     private graphicalLabel: GraphicalLabel;
     private graphicalStaffEntry: GraphicalStaffEntry;
+
     constructor(lyricsEntry: LyricsEntry, graphicalStaffEntry: GraphicalStaffEntry, lyricsHeight: number, staffHeight: number) {
         this.lyricsEntry = lyricsEntry;
         this.graphicalStaffEntry = graphicalStaffEntry;
-        this.graphicalLabel = new GraphicalLabel(new Label(lyricsEntry.Text), lyricsHeight,
+        this.graphicalLabel = new GraphicalLabel(
+            new Label(lyricsEntry.Text),
+            lyricsHeight,
             TextAlignment.CenterBottom,
-            graphicalStaffEntry.PositionAndShape);
+            graphicalStaffEntry.PositionAndShape
+        );
         this.graphicalLabel.PositionAndShape.RelativePosition = new PointF2D(0.0, staffHeight);
     }
+
     public get GetLyricsEntry(): LyricsEntry {
         return this.lyricsEntry;
     }
@@ -39,4 +45,4 @@ export class GraphicalLyricEntry {
     public set StaffEntryParent(value: GraphicalStaffEntry) {
         this.graphicalStaffEntry = value;
     }
-}
+}

+ 4 - 1
src/MusicalScore/Graphical/GraphicalLyricWord.ts

@@ -1,12 +1,15 @@
 import {LyricWord} from "../VoiceData/Lyrics/LyricsWord";
 import {GraphicalLyricEntry} from "./GraphicalLyricEntry";
+
 export class GraphicalLyricWord {
     private lyricWord: LyricWord;
     private graphicalLyricsEntries: GraphicalLyricEntry[] = [];
+
     constructor(lyricWord: LyricWord) {
         this.lyricWord = lyricWord;
         this.initialize();
     }
+
     public get GetLyricWord(): LyricWord {
         return this.lyricWord;
     }
@@ -26,4 +29,4 @@ export class GraphicalLyricWord {
         for (let i: number = 0; i < this.lyricWord.Syllables.length; i++)
             this.graphicalLyricsEntries.push(undefined);
     }
-}
+}

+ 20 - 9
src/MusicalScore/Graphical/GraphicalMusicPage.ts

@@ -5,54 +5,65 @@ import {MusicSystem} from "./MusicSystem";
 import {EngravingRules} from "./EngravingRules";
 import {PointF2D} from "../../Common/DataObjects/PointF2D";
 import {GraphicalMusicSheet} from "./GraphicalMusicSheet";
+
 export class GraphicalMusicPage extends GraphicalObject {
     private musicSystems: MusicSystem[] = [];
     private labels: GraphicalLabel[] = [];
     private parent: GraphicalMusicSheet;
+
     constructor(parent: GraphicalMusicSheet) {
         this.parent = parent;
         this.boundingBox = new BoundingBox(undefined, this);
     }
+
     public get MusicSystems(): MusicSystem[] {
         return this.musicSystems;
     }
+
     public set MusicSystems(value: MusicSystem[]) {
         this.musicSystems = value;
     }
+
     public get Labels(): GraphicalLabel[] {
         return this.labels;
     }
+
     public set Labels(value: 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): PointF2D {
-        if (rules.PagePlacement === PagePlacementEnum.Down)
+        if (rules.PagePlacement === PagePlacementEnum.Down) {
             return new PointF2D(0.0, pageIndex * rules.PageHeight);
-        else if (rules.PagePlacement === PagePlacementEnum.Right)
+        } else if (rules.PagePlacement === PagePlacementEnum.Right) {
             return new PointF2D(pageIndex * this.parent.ParentMusicSheet.pageWidth, 0.0);
-        else {
+        } else {
             if (pageIndex % 2 === 0) {
-                if (pageIndex === 0)
+                if (pageIndex === 0) {
                     return new PointF2D(0.0, pageIndex * rules.PageHeight);
-                else return new PointF2D(0.0, (pageIndex - 1) * rules.PageHeight);
+                } else {
+                    return new PointF2D(0.0, (pageIndex - 1) * rules.PageHeight);
+                }
             } else {
-                if (pageIndex === 1)
+                if (pageIndex === 1) {
                     return new PointF2D(this.parent.ParentMusicSheet.pageWidth, (pageIndex - 1) * rules.PageHeight);
-                else return new PointF2D(this.parent.ParentMusicSheet.pageWidth, (pageIndex - 2) * rules.PageHeight);
+                } else {
+                    return new PointF2D(this.parent.ParentMusicSheet.pageWidth, (pageIndex - 2) * rules.PageHeight);
+                }
             }
         }
     }
 }
 export enum PagePlacementEnum {
     Down,
-
     Right,
-
     RightDown
 }

+ 33 - 33
src/MusicalScore/Graphical/GraphicalMusicSheet.ts

@@ -172,7 +172,7 @@ export class GraphicalMusicSheet {
             let graphicalMusicPage: GraphicalMusicPage = this.musicPages[idx];
             for (let idx2: number = 0, len2: number = graphicalMusicPage.MusicSystems.length; idx2 < len2; ++idx2) {
                 let musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
-                musicSystem.NeedsToBeRedrawn = true;
+                musicSystem.needsToBeRedrawn = true;
             }
         }
     }
@@ -188,9 +188,9 @@ export class GraphicalMusicSheet {
     public findGraphicalStaffEntryFromMeasureList(staffIndex: number, measureIndex: number, sourceStaffEntry: SourceStaffEntry): GraphicalStaffEntry {
         for (let i: number = measureIndex; i < this.measureList.length; i++) {
             let graphicalMeasure: StaffMeasure = this.measureList[i][staffIndex];
-            for (let idx: number = 0, len: number = graphicalMeasure.StaffEntries.length; idx < len; ++idx) {
-                let graphicalStaffEntry: GraphicalStaffEntry = graphicalMeasure.StaffEntries[idx];
-                if (graphicalStaffEntry.SourceStaffEntry === sourceStaffEntry) {
+            for (let idx: number = 0, len: number = graphicalMeasure.staffEntries.length; idx < len; ++idx) {
+                let graphicalStaffEntry: GraphicalStaffEntry = graphicalMeasure.staffEntries[idx];
+                if (graphicalStaffEntry.sourceStaffEntry === sourceStaffEntry) {
                     return graphicalStaffEntry;
                 }
             }
@@ -199,14 +199,14 @@ export class GraphicalMusicSheet {
     }
 
     public findNextGraphicalStaffEntry(staffIndex: number, measureIndex: number, graphicalStaffEntry: GraphicalStaffEntry): GraphicalStaffEntry {
-        let graphicalMeasure: StaffMeasure = graphicalStaffEntry.ParentMeasure;
-        let graphicalStaffEntryIndex: number = graphicalMeasure.StaffEntries.indexOf(graphicalStaffEntry);
-        if (graphicalStaffEntryIndex < graphicalMeasure.StaffEntries.length - 1) {
-            return graphicalMeasure.StaffEntries[graphicalStaffEntryIndex + 1];
+        let graphicalMeasure: StaffMeasure = graphicalStaffEntry.parentMeasure;
+        let graphicalStaffEntryIndex: number = graphicalMeasure.staffEntries.indexOf(graphicalStaffEntry);
+        if (graphicalStaffEntryIndex < graphicalMeasure.staffEntries.length - 1) {
+            return graphicalMeasure.staffEntries[graphicalStaffEntryIndex + 1];
         } else if (measureIndex < this.measureList.length - 1) {
             let nextMeasure: StaffMeasure = this.measureList[measureIndex + 1][staffIndex];
-            if (nextMeasure.StaffEntries.length > 0) {
-                return nextMeasure.StaffEntries[0];
+            if (nextMeasure.staffEntries.length > 0) {
+                return nextMeasure.staffEntries[0];
             }
         }
         return undefined;
@@ -368,12 +368,12 @@ export class GraphicalMusicSheet {
             if (graphicalStaffEntry === undefined) {
                 continue;
             }
-            for (let idx2: number = 0, len2: number = graphicalStaffEntry.Notes.length; idx2 < len2; ++idx2) {
-                let graphicalNotes: GraphicalNote[] = graphicalStaffEntry.Notes[idx2];
+            for (let idx2: number = 0, len2: number = graphicalStaffEntry.notes.length; idx2 < len2; ++idx2) {
+                let graphicalNotes: GraphicalNote[] = graphicalStaffEntry.notes[idx2];
                 for (let idx3: number = 0, len3: number = graphicalNotes.length; idx3 < len3; ++idx3) {
                     let note: GraphicalNote = graphicalNotes[idx3];
-                    if (note.GraphicalNoteLength > maxLength) {
-                        maxLength = note.GraphicalNoteLength;
+                    if (note.graphicalNoteLength > maxLength) {
+                        maxLength = note.graphicalNoteLength;
                     }
                 }
             }
@@ -403,7 +403,7 @@ export class GraphicalMusicSheet {
 
     public getGraphicalMeasureFromSourceMeasureAndIndex(sourceMeasure: SourceMeasure, index: number): StaffMeasure {
         for (let i: number = 0; i < this.measureList.length; i++) {
-            if (this.measureList[i][0].ParentSourceMeasure === sourceMeasure) {
+            if (this.measureList[i][0].parentSourceMeasure === sourceMeasure) {
                 return this.measureList[i][index];
             }
         }
@@ -425,7 +425,7 @@ export class GraphicalMusicSheet {
     }
 
     public getMeasureIndex(entry: GraphicalStaffEntry, measureIndex: number, inListIndex: number): boolean {
-        return this.getMeasureIndex(entry.ParentMeasure, measureIndex, inListIndex);
+        return this.getMeasureIndex(entry.parentMeasure, measureIndex, inListIndex);
     }
 
     public GetNearesNote(clickPosition: PointF2D, maxClickDist: PointF2D): GraphicalNote {
@@ -458,7 +458,7 @@ export class GraphicalMusicSheet {
             if (closest === undefined) {
                 closest = note;
             } else {
-                if (note.ParentStaffEntry.RelInMeasureTimestamp === undefined) {
+                if (note.parentStaffEntry.relInMeasureTimestamp === undefined) {
                     continue;
                 }
                 let deltaNew: number = this.CalculateDistance(note.PositionAndShape.AbsolutePosition, clickPosition);
@@ -525,7 +525,7 @@ export class GraphicalMusicSheet {
             if (closest === undefined) {
                 closest = gse;
             } else {
-                if (gse.RelInMeasureTimestamp === undefined) {
+                if (gse.relInMeasureTimestamp === undefined) {
                     continue;
                 }
                 let deltaNew: number = this.CalculateDistance(gse.PositionAndShape.AbsolutePosition, clickPosition);
@@ -546,7 +546,7 @@ export class GraphicalMusicSheet {
         if (entry === undefined) {
             return undefined;
         }
-        return entry.SourceStaffEntry;
+        return entry.sourceStaffEntry;
     }
 
     public getClickedObjectOfType<T>(positionOnMusicSheet: PointF2D): T {
@@ -609,7 +609,7 @@ export class GraphicalMusicSheet {
         try {
             for (let idx: number = 0, len: number = container.StaffEntries.length; idx < len; ++idx) {
                 let entry: GraphicalStaffEntry = container.StaffEntries[idx];
-                if (entry === undefined || !entry.SourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
+                if (entry === undefined || !entry.sourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
                     continue;
                 }
                 if (staffEntry === undefined) {
@@ -632,7 +632,7 @@ export class GraphicalMusicSheet {
             let entries: GraphicalStaffEntry[] = this.verticalGraphicalStaffEntryContainers[i].StaffEntries;
             for (let idx: number = 0, len: number = entries.length; idx < len; ++idx) {
                 let entry: GraphicalStaffEntry = entries[idx];
-                if (entry !== undefined && entry.SourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
+                if (entry !== undefined && entry.sourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
                     return i;
                 }
             }
@@ -645,7 +645,7 @@ export class GraphicalMusicSheet {
             let entries: GraphicalStaffEntry[] = this.verticalGraphicalStaffEntryContainers[i].StaffEntries;
             for (let idx: number = 0, len: number = entries.length; idx < len; ++idx) {
                 let entry: GraphicalStaffEntry = entries[idx];
-                if (entry !== undefined && entry.SourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
+                if (entry !== undefined && entry.sourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
                     return i;
                 }
             }
@@ -661,7 +661,7 @@ export class GraphicalMusicSheet {
             foundEntry = this.getStaffEntry(i);
             if (foundEntry !== undefined) {
                 if (searchOnlyVisibleEntries) {
-                    if (foundEntry.SourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
+                    if (foundEntry.sourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
                         return foundEntry;
                     }
                 } else {
@@ -679,7 +679,7 @@ export class GraphicalMusicSheet {
             foundEntry = this.getStaffEntry(i);
             if (foundEntry !== undefined) {
                 if (returnOnlyVisibleEntries) {
-                    if (foundEntry.SourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
+                    if (foundEntry.sourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
                         return foundEntry;
                     }
                 } else {
@@ -701,15 +701,15 @@ export class GraphicalMusicSheet {
         }
         let previousStaffEntryMusicSystem: MusicSystem = undefined;
         if (previousStaffEntry !== undefined) {
-            previousStaffEntryMusicSystem = previousStaffEntry.ParentMeasure.ParentStaffLine.ParentMusicSystem;
+            previousStaffEntryMusicSystem = previousStaffEntry.parentMeasure.ParentStaffLine.ParentMusicSystem;
         } else {
-            previousStaffEntryMusicSystem = nextStaffEntry.ParentMeasure.ParentStaffLine.ParentMusicSystem;
+            previousStaffEntryMusicSystem = nextStaffEntry.parentMeasure.ParentStaffLine.ParentMusicSystem;
         }
         let nextStaffEntryMusicSystem: MusicSystem = undefined;
         if (nextStaffEntry !== undefined) {
-            nextStaffEntryMusicSystem = nextStaffEntry.ParentMeasure.ParentStaffLine.ParentMusicSystem;
+            nextStaffEntryMusicSystem = nextStaffEntry.parentMeasure.ParentStaffLine.ParentMusicSystem;
         } else {
-            nextStaffEntryMusicSystem = previousStaffEntry.ParentMeasure.ParentStaffLine.ParentMusicSystem;
+            nextStaffEntryMusicSystem = previousStaffEntry.parentMeasure.ParentStaffLine.ParentMusicSystem;
         }
         if (previousStaffEntryMusicSystem === nextStaffEntryMusicSystem) {
             currentMusicSystem = previousStaffEntryMusicSystem;
@@ -722,7 +722,7 @@ export class GraphicalMusicSheet {
             } else if (nextStaffEntry === undefined) {
                 previousStaffEntryPositionX = previousStaffEntry.PositionAndShape.AbsolutePosition.x;
                 nextStaffEntryPositionX = currentMusicSystem.GetRightBorderAbsoluteXPosition();
-                fraction = (currentTimeStamp - previousStaffEntry.getAbsoluteTimestamp().RealValue) / ((previousStaffEntry.ParentMeasure.ParentSourceMeasure.AbsoluteTimestamp + previousStaffEntry.ParentMeasure.ParentSourceMeasure.Duration).RealValue - previousStaffEntry.getAbsoluteTimestamp().RealValue);
+                fraction = (currentTimeStamp - previousStaffEntry.getAbsoluteTimestamp().RealValue) / ((previousStaffEntry.parentMeasure.parentSourceMeasure.AbsoluteTimestamp + previousStaffEntry.parentMeasure.parentSourceMeasure.Duration).RealValue - previousStaffEntry.getAbsoluteTimestamp().RealValue);
             } else {
                 previousStaffEntryPositionX = previousStaffEntry.PositionAndShape.AbsolutePosition.x;
                 nextStaffEntryPositionX = nextStaffEntry.PositionAndShape.AbsolutePosition.x;
@@ -736,7 +736,7 @@ export class GraphicalMusicSheet {
             let interpolatedXPosition: number = previousStaffEntryPositionX + fraction * (nextStaffEntryPositionX - previousStaffEntryPositionX);
             return interpolatedXPosition;
         } else {
-            let nextSystemLeftBorderTimeStamp: number = nextStaffEntry.ParentMeasure.ParentSourceMeasure.AbsoluteTimestamp.RealValue;
+            let nextSystemLeftBorderTimeStamp: number = nextStaffEntry.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.RealValue;
             let fraction: number;
             let interpolatedXPosition: number;
             if (currentTimeStamp < nextSystemLeftBorderTimeStamp) {
@@ -800,11 +800,11 @@ export class GraphicalMusicSheet {
     }
 
     public GetGraphicalNoteFromSourceNote(note: Note, containingGse: GraphicalStaffEntry): GraphicalNote {
-        for (let idx: number = 0, len: number = containingGse.Notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = containingGse.Notes[idx];
+        for (let idx: number = 0, len: number = containingGse.notes.length; idx < len; ++idx) {
+            let graphicalNotes: GraphicalNote[] = containingGse.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
                 let graphicalNote: GraphicalNote = graphicalNotes[idx2];
-                if (graphicalNote.SourceNote === note) {
+                if (graphicalNote.sourceNote === note) {
                     return graphicalNote;
                 }
             }

+ 17 - 11
src/MusicalScore/Graphical/GraphicalNote.ts

@@ -7,26 +7,32 @@ import {Pitch} from "../../Common/DataObjects/pitch";
 import {GraphicalStaffEntry} from "./GraphicalStaffEntry";
 import {GraphicalObject} from "./GraphicalObject";
 import {MusicSheetCalculator} from "./MusicSheetCalculator";
+
 export class GraphicalNote extends GraphicalObject {
     constructor(note: Note, parent: GraphicalStaffEntry) {
-        this.SourceNote = note;
-        this.ParentStaffEntry = parent;
+        this.sourceNote = note;
+        this.parentStaffEntry = parent;
     }
-    public SourceNote: Note;
-    public GraphicalNoteLength: Fraction;
-    public ParentStaffEntry: GraphicalStaffEntry;
+
+    public sourceNote: Note;
+    public graphicalNoteLength: Fraction;
+    public parentStaffEntry: GraphicalStaffEntry;
+
     public get ParentList(): GraphicalNote[] {
-        for (let idx: number = 0, len: number = this.ParentStaffEntry.Notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.ParentStaffEntry.Notes[idx];
-            if (graphicalNotes.indexOf(this) !== -1)
+        for (let idx: number = 0, len: number = this.parentStaffEntry.notes.length; idx < len; ++idx) {
+            let graphicalNotes: GraphicalNote[] = this.parentStaffEntry.notes[idx];
+            if (graphicalNotes.indexOf(this) !== -1) {
                 return graphicalNotes;
+            }
         }
         return undefined;
     }
+
     public Transpose(keyInstruction: KeyInstruction, activeClef: ClefInstruction, halfTones: number, octaveEnum: OctaveEnum): Pitch {
-        let transposedPitch: Pitch = this.SourceNote.Pitch;
-        if (MusicSheetCalculator.TransposeCalculator !== undefined)
-            transposedPitch = MusicSheetCalculator.TransposeCalculator.transposePitch(this.SourceNote.Pitch, keyInstruction, halfTones);
+        let transposedPitch: Pitch = this.sourceNote.Pitch;
+        if (MusicSheetCalculator.TransposeCalculator !== undefined) {
+            transposedPitch = MusicSheetCalculator.TransposeCalculator.transposePitch(this.sourceNote.Pitch, keyInstruction, halfTones);
+        }
         return transposedPitch;
     }
 }

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

@@ -1,4 +1,5 @@
 import {BoundingBox} from "./BoundingBox";
+
 export class GraphicalObject {
     protected boundingBox: BoundingBox;
     public get PositionAndShape(): BoundingBox {

+ 137 - 92
src/MusicalScore/Graphical/GraphicalStaffEntry.ts

@@ -15,224 +15,269 @@ import {GraphicalChordSymbolContainer} from "./GraphicalChordSymbolContainer";
 import {GraphicalLyricEntry} from "./GraphicalLyricEntry";
 import {AbstractGraphicalInstruction} from "./AbstractGraphicalInstruction";
 import {GraphicalStaffEntryLink} from "./GraphicalStaffEntryLink";
+
 export class GraphicalStaffEntry extends GraphicalObject {
-    private graphicalInstructions: AbstractGraphicalInstruction[] = [];
-    private graphicalTies: GraphicalTie[] = [];
-    private lyricsEntries: GraphicalLyricEntry[] = [];
     constructor(parentMeasure: StaffMeasure, sourceStaffEntry: SourceStaffEntry = undefined, staffEntryParent: GraphicalStaffEntry = undefined) {
-        this.ParentMeasure = parentMeasure;
-        this.Notes = [];
-        this.GraceStaffEntriesBefore = [];
-        this.GraceStaffEntriesAfter = [];
-        this.SourceStaffEntry = sourceStaffEntry;
+        this.parentMeasure = parentMeasure;
+        this.notes = [];
+        this.graceStaffEntriesBefore = [];
+        this.graceStaffEntriesAfter = [];
+        this.sourceStaffEntry = sourceStaffEntry;
         if (staffEntryParent !== undefined) {
-            this.StaffEntryParent = staffEntryParent;
-            this.ParentVerticalContainer = staffEntryParent.ParentVerticalContainer;
+            this.staffEntryParent = staffEntryParent;
+            this.parentVerticalContainer = staffEntryParent.parentVerticalContainer;
             this.PositionAndShape = new BoundingBox(staffEntryParent.PositionAndShape, this);
-        } else this.PositionAndShape = new BoundingBox(parentMeasure.PositionAndShape, this);
-        if (sourceStaffEntry !== undefined)
-            this.RelInMeasureTimestamp = sourceStaffEntry.Timestamp;
-    }
-    public GraphicalChordContainer: GraphicalChordSymbolContainer;
-    public GraphicalLink: GraphicalStaffEntryLink;
-    public RelInMeasureTimestamp: Fraction;
-    public SourceStaffEntry: SourceStaffEntry;
-    public ParentMeasure: StaffMeasure;
-    public Notes: GraphicalNote[][];
-    public GraceStaffEntriesBefore: GraphicalStaffEntry[];
-    public GraceStaffEntriesAfter: GraphicalStaffEntry[];
-    public StaffEntryParent: GraphicalStaffEntry;
-    public ParentVerticalContainer: VerticalGraphicalStaffEntryContainer;
+        } else {
+            this.PositionAndShape = new BoundingBox(parentMeasure.PositionAndShape, this);
+        }
+        if (sourceStaffEntry !== undefined) {
+            this.relInMeasureTimestamp = sourceStaffEntry.Timestamp;
+        }
+    }
+
+    public graphicalChordContainer: GraphicalChordSymbolContainer;
+    public graphicalLink: GraphicalStaffEntryLink;
+    public relInMeasureTimestamp: Fraction;
+    public sourceStaffEntry: SourceStaffEntry;
+    public parentMeasure: StaffMeasure;
+    public notes: GraphicalNote[][];
+    public graceStaffEntriesBefore: GraphicalStaffEntry[];
+    public graceStaffEntriesAfter: GraphicalStaffEntry[];
+    public staffEntryParent: GraphicalStaffEntry;
+    public parentVerticalContainer: VerticalGraphicalStaffEntryContainer;
+
+    private graphicalInstructions: AbstractGraphicalInstruction[] = [];
+    private graphicalTies: GraphicalTie[] = [];
+    private lyricsEntries: GraphicalLyricEntry[] = [];
+
     public get GraphicalInstructions(): AbstractGraphicalInstruction[] {
         return this.graphicalInstructions;
     }
+
     public get GraphicalTies(): GraphicalTie[] {
         return this.graphicalTies;
     }
+
     public get LyricsEntries(): GraphicalLyricEntry[] {
         return this.lyricsEntries;
     }
+
     public getAbsoluteTimestamp(): Fraction {
-        let result: Fraction = Fraction.createFromFraction(this.ParentMeasure.ParentSourceMeasure.AbsoluteTimestamp);
-        if (this.RelInMeasureTimestamp !== undefined)
-            result += this.RelInMeasureTimestamp;
+        let result: Fraction = Fraction.createFromFraction(this.parentMeasure.parentSourceMeasure.AbsoluteTimestamp);
+        if (this.relInMeasureTimestamp !== undefined) {
+            result += this.relInMeasureTimestamp;
+        }
         return result;
     }
+
     public findEndTieGraphicalNoteFromNote(tieNote: Note): GraphicalNote {
-        for (let idx: number = 0, len: number = this.Notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.Notes[idx];
+        for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
+            let graphicalNotes: GraphicalNote[] = this.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
                 let graphicalNote: GraphicalNote = graphicalNotes[idx2];
-                let note: Note = graphicalNote.SourceNote;
-                if (note.Pitch !== undefined && note.Pitch.FundamentalNote === tieNote.Pitch.FundamentalNote && note.Pitch.Octave === tieNote.Pitch.Octave && note.getAbsoluteTimestamp() === tieNote.getAbsoluteTimestamp())
+                let note: Note = graphicalNote.sourceNote;
+                if (
+                    note.Pitch !== undefined && note.Pitch.FundamentalNote === tieNote.Pitch.FundamentalNote
+                    && note.Pitch.Octave === tieNote.Pitch.Octave && note.getAbsoluteTimestamp() === tieNote.getAbsoluteTimestamp()
+                ) {
                     return graphicalNote;
+                }
             }
         }
         return undefined;
     }
+
     public findEndTieGraphicalNoteFromNoteWithStartingSlur(tieNote: Note, slur: Slur): GraphicalNote {
-        for (let idx: number = 0, len: number = this.Notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.Notes[idx];
+        for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
+            let graphicalNotes: GraphicalNote[] = this.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
                 let graphicalNote: GraphicalNote = graphicalNotes[idx2];
-                let note: Note = graphicalNote.SourceNote;
-                if (note.NoteTie !== undefined && note.NoteSlurs.indexOf(slur) !== -1)
+                let note: Note = graphicalNote.sourceNote;
+                if (note.NoteTie !== undefined && note.NoteSlurs.indexOf(slur) !== -1) {
                     return graphicalNote;
+                }
             }
         }
         return undefined;
     }
+
     public findEndTieGraphicalNoteFromNoteWithEndingSlur(tieNote: Note): GraphicalNote {
-        for (let idx: number = 0, len: number = this.Notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.Notes[idx];
+        for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
+            let graphicalNotes: GraphicalNote[] = this.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
                 let graphicalNote: GraphicalNote = graphicalNotes[idx2];
-                let note: Note = graphicalNote.SourceNote;
-                if (note.Pitch !== undefined && note.Pitch.FundamentalNote === tieNote.Pitch.FundamentalNote && note.Pitch.Octave === tieNote.Pitch.Octave && this.getAbsoluteTimestamp() === tieNote.getAbsoluteTimestamp())
+                let note: Note = graphicalNote.sourceNote;
+                if (
+                    note.Pitch !== undefined && note.Pitch.FundamentalNote === tieNote.Pitch.FundamentalNote
+                    && note.Pitch.Octave === tieNote.Pitch.Octave && this.getAbsoluteTimestamp() === tieNote.getAbsoluteTimestamp()
+                ) {
                     return graphicalNote;
+                }
             }
         }
         return undefined;
     }
+
     public findGraphicalNoteFromGraceNote(graceNote: Note): GraphicalNote {
-        for (let idx: number = 0, len: number = this.Notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.Notes[idx];
+        for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
+            let graphicalNotes: GraphicalNote[] = this.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
                 let graphicalNote: GraphicalNote = graphicalNotes[idx2];
-                if (graphicalNote.SourceNote === graceNote)
+                if (graphicalNote.sourceNote === graceNote) {
                     return graphicalNote;
+                }
             }
         }
         return undefined;
     }
+
     public findGraphicalNoteFromNote(baseNote: Note): GraphicalNote {
-        for (let idx: number = 0, len: number = this.Notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.Notes[idx];
+        for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
+            let graphicalNotes: GraphicalNote[] = this.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
                 let graphicalNote: GraphicalNote = graphicalNotes[idx2];
-                if (graphicalNote.SourceNote === baseNote && this.getAbsoluteTimestamp() === baseNote.getAbsoluteTimestamp())
+                if (graphicalNote.sourceNote === baseNote && this.getAbsoluteTimestamp() === baseNote.getAbsoluteTimestamp()) {
                     return graphicalNote;
+                }
             }
         }
         return undefined;
     }
+
     public getGraphicalNoteDurationFromVoice(voice: Voice): Fraction {
-        for (let idx: number = 0, len: number = this.Notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.Notes[idx];
-            if (graphicalNotes[0].SourceNote.ParentVoiceEntry.ParentVoice === voice)
-                return graphicalNotes[0].GraphicalNoteLength;
+        for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
+            let graphicalNotes: GraphicalNote[] = this.notes[idx];
+            if (graphicalNotes[0].sourceNote.ParentVoiceEntry.ParentVoice === voice) {
+                return graphicalNotes[0].graphicalNoteLength;
+            }
         }
         return new Fraction(0, 1);
     }
+
     public findLinkedNotes(notLinkedNotes: GraphicalNote[]): void {
-        if (this.SourceStaffEntry !== undefined && this.SourceStaffEntry.Link !== undefined) {
-            for (let idx: number = 0, len: number = this.Notes.length; idx < len; ++idx) {
-                let graphicalNotes: GraphicalNote[] = this.Notes[idx];
+        if (this.sourceStaffEntry !== undefined && this.sourceStaffEntry.Link !== undefined) {
+            for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
+                let graphicalNotes: GraphicalNote[] = this.notes[idx];
                 for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
                     let graphicalNote: GraphicalNote = graphicalNotes[idx2];
-                    if (graphicalNote.ParentStaffEntry === this)
+                    if (graphicalNote.parentStaffEntry === this) {
                         notLinkedNotes.push(graphicalNote);
+                    }
                 }
             }
         }
     }
+
     public findVoiceEntryGraphicalNotes(voiceEntry: VoiceEntry): GraphicalNote[] {
-        for (let idx: number = 0, len: number = this.Notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.Notes[idx];
+        for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
+            let graphicalNotes: GraphicalNote[] = this.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
                 let graphicalNote: GraphicalNote = graphicalNotes[idx2];
-                if (graphicalNote.SourceNote.ParentVoiceEntry === voiceEntry)
+                if (graphicalNote.sourceNote.ParentVoiceEntry === voiceEntry) {
                     return graphicalNotes;
+                }
             }
         }
         return undefined;
     }
+
     public isVoiceEntryPartOfLinkedVoiceEntry(voiceEntry: VoiceEntry): boolean {
-        if (this.SourceStaffEntry.Link !== undefined) {
-            for (let idx: number = 0, len: number = this.SourceStaffEntry.Link.LinkStaffEntries.length; idx < len; ++idx) {
-                let sEntry: SourceStaffEntry = this.SourceStaffEntry.Link.LinkStaffEntries[idx];
-                if (sEntry.VoiceEntries.indexOf(voiceEntry) !== -1 && sEntry !== this.SourceStaffEntry)
+        if (this.sourceStaffEntry.Link !== undefined) {
+            for (let idx: number = 0, len: number = this.sourceStaffEntry.Link.LinkStaffEntries.length; idx < len; ++idx) {
+                let sEntry: SourceStaffEntry = this.sourceStaffEntry.Link.LinkStaffEntries[idx];
+                if (sEntry.VoiceEntries.indexOf(voiceEntry) !== -1 && sEntry !== this.sourceStaffEntry) {
                     return true;
+                }
             }
         }
         return false;
     }
+
     public getMainVoice(): Voice {
-        for (let idx: number = 0, len: number = this.SourceStaffEntry.VoiceEntries.length; idx < len; ++idx) {
-            let voiceEntry: VoiceEntry = this.SourceStaffEntry.VoiceEntries[idx];
-            if (voiceEntry.ParentVoice.GetType() !== /*typeof*/LinkedVoice)
+        for (let idx: number = 0, len: number = this.sourceStaffEntry.VoiceEntries.length; idx < len; ++idx) {
+            let voiceEntry: VoiceEntry = this.sourceStaffEntry.VoiceEntries[idx];
+            if (voiceEntry.ParentVoice.GetType() !== /*typeof*/LinkedVoice) {
                 return voiceEntry.ParentVoice;
+            }
         }
-        return this.Notes[0][0].SourceNote.ParentVoiceEntry.ParentVoice;
+        return this.notes[0][0].sourceNote.ParentVoiceEntry.ParentVoice;
     }
+
     public findStaffEntryMinNoteLength(): Fraction {
         let minLength: Fraction = new Fraction(Number.MAX_VALUE, 1);
-        for (let idx: number = 0, len: number = this.Notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.Notes[idx];
+        for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
+            let graphicalNotes: GraphicalNote[] = this.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
                 let graphicalNote: GraphicalNote = graphicalNotes[idx2];
-                let calNoteLen: Fraction = graphicalNote.GraphicalNoteLength;
-                if (calNoteLen < minLength && calNoteLen.Numerator > 0)
+                let calNoteLen: Fraction = graphicalNote.graphicalNoteLength;
+                if (calNoteLen < minLength && calNoteLen.Numerator > 0) {
                     minLength = calNoteLen;
+                }
             }
         }
         return minLength;
     }
+
     public findStaffEntryMaxNoteLength(): Fraction {
         let maxLength: Fraction = new Fraction(0, 1);
-        for (let idx: number = 0, len: number = this.Notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.Notes[idx];
+        for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
+            let graphicalNotes: GraphicalNote[] = this.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
                 let graphicalNote: GraphicalNote = graphicalNotes[idx2];
-                let calNoteLen: Fraction = graphicalNote.GraphicalNoteLength;
-                if (calNoteLen > maxLength && calNoteLen.Numerator > 0)
+                let calNoteLen: Fraction = graphicalNote.graphicalNoteLength;
+                if (calNoteLen > maxLength && calNoteLen.Numerator > 0) {
                     maxLength = calNoteLen;
+                }
             }
         }
         return maxLength;
     }
+
     public findOrCreateGraphicalNotesListFromVoiceEntry(voiceEntry: VoiceEntry): GraphicalNote[] {
         let graphicalNotes: GraphicalNote[];
-        if (this.Notes.length === 0) {
+        if (this.notes.length === 0) {
             graphicalNotes = [];
-            this.Notes.push(graphicalNotes);
+            this.notes.push(graphicalNotes);
         } else {
-            for (let i: number = 0; i < this.Notes.length; i++) {
-                if (this.Notes[i][0].SourceNote.ParentVoiceEntry.ParentVoice === voiceEntry.ParentVoice)
-                    return this.Notes[i];
+            for (let i: number = 0; i < this.notes.length; i++) {
+                if (this.notes[i][0].sourceNote.ParentVoiceEntry.ParentVoice === voiceEntry.ParentVoice) {
+                    return this.notes[i];
+                }
             }
             graphicalNotes = [];
-            this.Notes.push(graphicalNotes);
+            this.notes.push(graphicalNotes);
         }
         return graphicalNotes;
     }
+
     public findOrCreateGraphicalNotesListFromGraphicalNote(graphicalNote: GraphicalNote): GraphicalNote[] {
         let graphicalNotes: GraphicalNote[];
-        let tieStartSourceStaffEntry: SourceStaffEntry = graphicalNote.SourceNote.ParentStaffEntry;
-        if (this.SourceStaffEntry !== tieStartSourceStaffEntry)
-            graphicalNotes = this.findOrCreateGraphicalNotesListFromVoiceEntry(graphicalNote.SourceNote.ParentVoiceEntry);
-        else {
-            if (this.Notes.length === 0) {
+        let tieStartSourceStaffEntry: SourceStaffEntry = graphicalNote.sourceNote.ParentStaffEntry;
+        if (this.sourceStaffEntry !== tieStartSourceStaffEntry) {
+            graphicalNotes = this.findOrCreateGraphicalNotesListFromVoiceEntry(graphicalNote.sourceNote.ParentVoiceEntry);
+        } else {
+            if (this.notes.length === 0) {
                 graphicalNotes = [];
-                this.Notes.push(graphicalNotes);
+                this.notes.push(graphicalNotes);
             } else {
-                for (let i: number = 0; i < this.Notes.length; i++) {
-                    if (this.Notes[i][0].SourceNote.ParentVoiceEntry.ParentVoice === graphicalNote.SourceNote.ParentVoiceEntry.ParentVoice) {
-                        return this.Notes[i];
+                for (let i: number = 0; i < this.notes.length; i++) {
+                    if (this.notes[i][0].sourceNote.ParentVoiceEntry.ParentVoice === graphicalNote.sourceNote.ParentVoiceEntry.ParentVoice) {
+                        return this.notes[i];
                     }
                 }
                 graphicalNotes = [];
-                this.Notes.push(graphicalNotes);
+                this.notes.push(graphicalNotes);
             }
         }
         return graphicalNotes;
     }
+
     public addGraphicalNoteToListAtCorrectYPosition(graphicalNotes: GraphicalNote[], graphicalNote: GraphicalNote): void {
-        if (graphicalNotes.length === 0 || graphicalNote.PositionAndShape.RelativePosition.Y < graphicalNotes.Last().PositionAndShape.RelativePosition.Y)
+        if (graphicalNotes.length === 0 || graphicalNote.PositionAndShape.RelativePosition.y < graphicalNotes.Last().PositionAndShape.RelativePosition.Y) {
             graphicalNotes.push(graphicalNote);
-        else {
+        } else {
             for (let i: number = graphicalNotes.length - 1; i >= 0; i--) {
-                if (graphicalNotes[i].PositionAndShape.RelativePosition.Y > graphicalNote.PositionAndShape.RelativePosition.Y) {
+                if (graphicalNotes[i].PositionAndShape.RelativePosition.y > graphicalNote.PositionAndShape.RelativePosition.y) {
                     graphicalNotes.splice(i + 1, 0, graphicalNote);
                     break;
                 }
@@ -243,4 +288,4 @@ export class GraphicalStaffEntry extends GraphicalObject {
             }
         }
     }
-}
+}

+ 7 - 4
src/MusicalScore/Graphical/GraphicalStaffEntryLink.ts

@@ -1,6 +1,7 @@
 import {StaffEntryLink} from "../VoiceData/StaffEntryLink";
 import {GraphicalStaffEntry} from "./GraphicalStaffEntry";
 import {GraphicalNote} from "./GraphicalNote";
+
 export class GraphicalStaffEntryLink {
     private staffEntryLink: StaffEntryLink;
     private graphicalLinkedStaffEntries: GraphicalStaffEntry[] = [];
@@ -29,12 +30,14 @@ export class GraphicalStaffEntryLink {
             let notes: GraphicalNote[] = [];
             for (let idx: number = 0, len: number = this.graphicalLinkedStaffEntries.length; idx < len; ++idx) {
                 let graphicalLinkedStaffEntry: GraphicalStaffEntry = this.graphicalLinkedStaffEntries[idx];
-                for (let idx2: number = 0, len2: number = graphicalLinkedStaffEntry.Notes.length; idx2 < len2; ++idx2) {
-                    let graphicalNotes: GraphicalNote[] = graphicalLinkedStaffEntry.Notes[idx2];
+                for (let idx2: number = 0, len2: number = graphicalLinkedStaffEntry.notes.length; idx2 < len2; ++idx2) {
+                    let graphicalNotes: GraphicalNote[] = graphicalLinkedStaffEntry.notes[idx2];
                     for (let idx3: number = 0, len3: number = graphicalNotes.length; idx3 < len3; ++idx3) {
                         let graphicalNote: GraphicalNote = graphicalNotes[idx3];
-                        if (graphicalNote.SourceNote.ParentStaffEntry.Link !== undefined && graphicalNote.SourceNote.ParentVoiceEntry === this.staffEntryLink.GetVoiceEntry)
+                        if (graphicalNote.sourceNote.ParentStaffEntry.Link !== undefined
+                            && graphicalNote.sourceNote.ParentVoiceEntry === this.staffEntryLink.GetVoiceEntry) {
                             notes.push(graphicalNote);
+                        }
                     }
                 }
             }
@@ -47,4 +50,4 @@ export class GraphicalStaffEntryLink {
             this.graphicalLinkedStaffEntries.push(undefined);
         }
     }
-}
+}

+ 2 - 1
src/MusicalScore/Graphical/GraphicalTie.ts

@@ -1,5 +1,6 @@
 import {Tie} from "../VoiceData/Tie";
 import {GraphicalNote} from "./GraphicalNote";
+
 export class GraphicalTie {
     private tie: Tie;
     private startNote: GraphicalNote;
@@ -24,4 +25,4 @@ export class GraphicalTie {
     public set EndNote(value: GraphicalNote) {
         this.endNote = value;
     }
-}
+}

+ 89 - 89
src/MusicalScore/Graphical/MusicSheetCalculator.ts

@@ -359,12 +359,12 @@ export class MusicSheetCalculator {
                         if (graphicalMeasure.FirstInstructionStaffEntry !== undefined) {
                             graphicalMeasure.PositionAndShape.ChildElements.Remove(graphicalMeasure.FirstInstructionStaffEntry.PositionAndShape);
                             graphicalMeasure.FirstInstructionStaffEntry = undefined;
-                            graphicalMeasure.BeginInstructionsWidth = 0.0;
+                            graphicalMeasure.beginInstructionsWidth = 0.0;
                         }
                         if (graphicalMeasure.LastInstructionStaffEntry !== undefined) {
                             graphicalMeasure.PositionAndShape.ChildElements.Remove(graphicalMeasure.LastInstructionStaffEntry.PositionAndShape);
                             graphicalMeasure.LastInstructionStaffEntry = undefined;
-                            graphicalMeasure.EndInstructionsWidth = 0.0;
+                            graphicalMeasure.endInstructionsWidth = 0.0;
                         }
                     }
                     staffLine.Measures = [];
@@ -431,7 +431,7 @@ export class MusicSheetCalculator {
             for (let idx: number = 0, len: number = graceEntries.length; idx < len; ++idx) {
                 let graceVoiceEntry: VoiceEntry = graceEntries[idx];
                 let graceStaffEntry: GraphicalStaffEntry = this.symbolFactory.createGraceStaffEntry(graphicalStaffEntry,
-                    graphicalStaffEntry.ParentMeasure);
+                    graphicalStaffEntry.parentMeasure);
                 graphicalGraceEntries.push(graceStaffEntry);
                 graphicalStaffEntry.PositionAndShape.ChildElements.push(graceStaffEntry.PositionAndShape);
                 this.handleVoiceEntry(graceVoiceEntry, graceStaffEntry, accidentalCalculator, lyricWords,
@@ -451,12 +451,12 @@ export class MusicSheetCalculator {
             for (; k < tieTimestamps.length; k++) {
                 if (!openTie.NoteHasBeenCreated[k]) {
                     absoluteTimestamp = tieTimestamps[k];
-                    if (absoluteTimestamp >= (measure.ParentSourceMeasure.AbsoluteTimestamp + measure.ParentSourceMeasure.Duration))
+                    if (absoluteTimestamp >= (measure.parentSourceMeasure.AbsoluteTimestamp + measure.parentSourceMeasure.Duration))
                         continue;
                     let graphicalStaffEntry: GraphicalStaffEntry = undefined;
                     if (absoluteTimestamp !== undefined) {
-                        for (let idx: number = 0, len: number = measure.StaffEntries.length; idx < len; ++idx) {
-                            let gse: GraphicalStaffEntry = measure.StaffEntries[idx];
+                        for (let idx: number = 0, len: number = measure.staffEntries.length; idx < len; ++idx) {
+                            let gse: GraphicalStaffEntry = measure.staffEntries[idx];
                             if (gse.getAbsoluteTimestamp() === absoluteTimestamp) {
                                 graphicalStaffEntry = gse;
                                 break;
@@ -469,8 +469,8 @@ export class MusicSheetCalculator {
                     if (graphicalStaffEntry !== undefined) {
                         let octaveShiftValue: OctaveEnum = OctaveEnum.NONE;
                         if (octaveShiftParams !== undefined) {
-                            if (graphicalStaffEntry.getAbsoluteTimestamp() >= octaveShiftParams.GetAbsoluteStartTimestamp && graphicalStaffEntry.getAbsoluteTimestamp() <= octaveShiftParams.GetAbsoluteEndTimestamp) {
-                                octaveShiftValue = octaveShiftParams.GetOpenOctaveShift.Type;
+                            if (graphicalStaffEntry.getAbsoluteTimestamp() >= octaveShiftParams.getAbsoluteStartTimestamp && graphicalStaffEntry.getAbsoluteTimestamp() <= octaveShiftParams.getAbsoluteEndTimestamp) {
+                                octaveShiftValue = octaveShiftParams.getOpenOctaveShift.Type;
                             }
                         }
                         let isLastTieNote: boolean = k === tieTimestamps.length - 1;
@@ -496,15 +496,15 @@ export class MusicSheetCalculator {
     }
     protected layoutVoiceEntries(graphicalStaffEntry: GraphicalStaffEntry): void {
         graphicalStaffEntry.PositionAndShape.RelativePosition = new PointF2D(0.0, 0.0);
-        let isGraceStaffEntry: boolean = graphicalStaffEntry.StaffEntryParent !== undefined;
+        let isGraceStaffEntry: boolean = graphicalStaffEntry.staffEntryParent !== undefined;
         if (!this.leadSheet) {
-            let graphicalStaffEntryNotes: GraphicalNote[][] = graphicalStaffEntry.Notes;
+            let graphicalStaffEntryNotes: GraphicalNote[][] = graphicalStaffEntry.notes;
             for (let idx4: number = 0, len4: number = graphicalStaffEntryNotes.length; idx4 < len4; ++idx4) {
                 let graphicalNotes: GraphicalNote[] = graphicalStaffEntryNotes[idx4];
                 if (graphicalNotes.length === 0)
                     continue;
-                let voiceEntry: VoiceEntry = graphicalNotes[0].SourceNote.ParentVoiceEntry;
-                let hasPitchedNote: boolean = graphicalNotes[0].SourceNote.Pitch !== undefined;
+                let voiceEntry: VoiceEntry = graphicalNotes[0].sourceNote.ParentVoiceEntry;
+                let hasPitchedNote: boolean = graphicalNotes[0].sourceNote.Pitch !== undefined;
                 this.layoutVoiceEntry(voiceEntry, graphicalNotes, graphicalStaffEntry, hasPitchedNote, isGraceStaffEntry);
             }
         }
@@ -552,11 +552,11 @@ export class MusicSheetCalculator {
                     let staffLine: StaffLine = musicSystem.StaffLines[idx3];
                     for (let idx4: number = 0, len4: number = staffLine.Measures.length; idx4 < len4; ++idx4) {
                         let measure: StaffMeasure = staffLine.Measures[idx4];
-                        if (measure.StaffEntries.length === 1) {
-                            let gse: GraphicalStaffEntry = measure.StaffEntries[0];
-                            if (gse.Notes.length > 0 && gse.Notes[0].length > 0) {
-                                let graphicalNote: GraphicalNote = gse.Notes[0][0];
-                                if (graphicalNote.SourceNote.Pitch === undefined && graphicalNote.SourceNote.length >= new Fraction(1, 2)) {
+                        if (measure.staffEntries.length === 1) {
+                            let gse: GraphicalStaffEntry = measure.staffEntries[0];
+                            if (gse.notes.length > 0 && gse.notes[0].length > 0) {
+                                let graphicalNote: GraphicalNote = gse.notes[0][0];
+                                if (graphicalNote.sourceNote.Pitch === undefined && graphicalNote.sourceNote.length >= new Fraction(1, 2)) {
                                     this.layoutMeasureWithWholeRest(graphicalNote, gse, measure);
                                 }
                             }
@@ -567,34 +567,34 @@ export class MusicSheetCalculator {
         }
     }
     protected optimizeRestNotePlacement(graphicalStaffEntry: GraphicalStaffEntry, measure: StaffMeasure): void {
-        if (graphicalStaffEntry.Notes.length === 0)
+        if (graphicalStaffEntry.notes.length === 0)
             return;
-        let voice1Notes: GraphicalNote[] = graphicalStaffEntry.Notes[0];
+        let voice1Notes: GraphicalNote[] = graphicalStaffEntry.notes[0];
         if (voice1Notes.length === 0)
             return;
         let voice1Note1: GraphicalNote = voice1Notes[0];
-        let voice1Note1IsRest: boolean = voice1Note1.SourceNote.Pitch === undefined;
-        if (graphicalStaffEntry.Notes.length === 2) {
+        let voice1Note1IsRest: boolean = voice1Note1.sourceNote.Pitch === undefined;
+        if (graphicalStaffEntry.notes.length === 2) {
             let voice2Note1IsRest: boolean = false;
-            let voice2Notes: GraphicalNote[] = graphicalStaffEntry.Notes[1];
+            let voice2Notes: GraphicalNote[] = graphicalStaffEntry.notes[1];
             if (voice2Notes.length > 0) {
                 let voice2Note1: GraphicalNote = voice1Notes[0];
-                voice2Note1IsRest = voice2Note1.SourceNote.Pitch === undefined;
+                voice2Note1IsRest = voice2Note1.sourceNote.Pitch === undefined;
             }
             if (voice1Note1IsRest && voice2Note1IsRest) {
                 this.calculateTwoRestNotesPlacementWithCollisionDetection(graphicalStaffEntry);
             } else if (voice1Note1IsRest || voice2Note1IsRest) {
                 this.calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote(graphicalStaffEntry);
             }
-        } else if (voice1Note1IsRest && graphicalStaffEntry !== measure.StaffEntries[0] && graphicalStaffEntry !== measure.StaffEntries[measure.StaffEntries.length - 1]) {
-            let staffEntryIndex: number = measure.StaffEntries.indexOf(graphicalStaffEntry);
-            let previousStaffEntry: GraphicalStaffEntry = measure.StaffEntries[staffEntryIndex - 1];
-            let nextStaffEntry: GraphicalStaffEntry = measure.StaffEntries[staffEntryIndex + 1];
-            if (previousStaffEntry.Notes.length === 1) {
-                let previousNote: GraphicalNote = previousStaffEntry.Notes[0][0];
-                if (previousNote.SourceNote.NoteBeam !== undefined && nextStaffEntry.Notes.length === 1) {
-                    let nextNote: GraphicalNote = nextStaffEntry.Notes[0][0];
-                    if (nextNote.SourceNote.NoteBeam !== undefined && previousNote.SourceNote.NoteBeam === nextNote.SourceNote.NoteBeam) {
+        } else if (voice1Note1IsRest && graphicalStaffEntry !== measure.staffEntries[0] && graphicalStaffEntry !== measure.staffEntries[measure.staffEntries.length - 1]) {
+            let staffEntryIndex: number = measure.staffEntries.indexOf(graphicalStaffEntry);
+            let previousStaffEntry: GraphicalStaffEntry = measure.staffEntries[staffEntryIndex - 1];
+            let nextStaffEntry: GraphicalStaffEntry = measure.staffEntries[staffEntryIndex + 1];
+            if (previousStaffEntry.notes.length === 1) {
+                let previousNote: GraphicalNote = previousStaffEntry.notes[0][0];
+                if (previousNote.sourceNote.NoteBeam !== undefined && nextStaffEntry.notes.length === 1) {
+                    let nextNote: GraphicalNote = nextStaffEntry.notes[0][0];
+                    if (nextNote.sourceNote.NoteBeam !== undefined && previousNote.sourceNote.NoteBeam === nextNote.sourceNote.NoteBeam) {
                         this.calculateRestNotePlacementWithinGraphicalBeam(graphicalStaffEntry, voice1Note1,
                             previousNote,
                             nextStaffEntry,
@@ -619,11 +619,11 @@ export class MusicSheetCalculator {
         leftStaffEntry = this.getFirstLeftNotNullStaffEntryFromContainer(leftIndex, verticalIndex, multiStaffInstrument);
         rightStaffEntry = this.getFirstRightNotNullStaffEntryFromContainer(rightIndex, verticalIndex, multiStaffInstrument);
         if (leftStaffEntry !== undefined && rightStaffEntry !== undefined) {
-            let measureRelativeX: number = leftStaffEntry.ParentMeasure.PositionAndShape.RelativePosition.x;
+            let measureRelativeX: number = leftStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x;
             if (firstVisibleMeasureRelativeX > 0)
                 measureRelativeX = firstVisibleMeasureRelativeX;
             let leftX: number = leftStaffEntry.PositionAndShape.RelativePosition.x + measureRelativeX;
-            let rightX: number = rightStaffEntry.PositionAndShape.RelativePosition.x + rightStaffEntry.ParentMeasure.PositionAndShape.RelativePosition.x;
+            let rightX: number = rightStaffEntry.PositionAndShape.RelativePosition.x + rightStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x;
             if (firstVisibleMeasureRelativeX > 0)
                 rightX = rightStaffEntry.PositionAndShape.RelativePosition.x + measureRelativeX;
             let timestampQuotient: number = 0.0;
@@ -633,8 +633,8 @@ export class MusicSheetCalculator {
                 let leftDifference: Fraction = new Fraction(timestamp - leftTimestamp);
                 timestampQuotient = leftDifference.RealValue / (rightTimestamp - leftTimestamp).RealValue;
             }
-            if (leftStaffEntry.ParentMeasure.ParentStaffLine !== rightStaffEntry.ParentMeasure.ParentStaffLine) {
-                if (leftStaffEntry.ParentMeasure.ParentStaffLine === staffLine)
+            if (leftStaffEntry.parentMeasure.ParentStaffLine !== rightStaffEntry.parentMeasure.ParentStaffLine) {
+                if (leftStaffEntry.parentMeasure.ParentStaffLine === staffLine)
                     rightX = staffLine.PositionAndShape.Size.width;
                 else leftX = staffLine.PositionAndShape.RelativePosition.x;
             }
@@ -647,7 +647,7 @@ export class MusicSheetCalculator {
         let index: number = this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(timestamp);
         let discreteIndex: number = <number>Math.max(0, Math.min(Math.round(index), numEntries - 1));
         let gse: GraphicalStaffEntry = this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[discreteIndex].getFirstNonNullStaffEntry();
-        let posX: number = gse.PositionAndShape.RelativePosition.x + gse.ParentMeasure.PositionAndShape.RelativePosition.x;
+        let posX: number = gse.PositionAndShape.RelativePosition.x + gse.parentMeasure.PositionAndShape.RelativePosition.x;
         return posX;
     }
     private createAccidentalCalculators(): AccidentalCalculator[] {
@@ -673,12 +673,12 @@ export class MusicSheetCalculator {
         for (let i: number = 0; i < this.graphicalMusicSheet.MeasureList.length; i++) {
             for (let j: number = 0; j < numberOfEntries; j++) {
                 let measure: StaffMeasure = this.graphicalMusicSheet.MeasureList[i][j];
-                for (let idx: number = 0, len: number = measure.StaffEntries.length; idx < len; ++idx) {
-                    let graphicalStaffEntry: GraphicalStaffEntry = measure.StaffEntries[idx];
+                for (let idx: number = 0, len: number = measure.staffEntries.length; idx < len; ++idx) {
+                    let graphicalStaffEntry: GraphicalStaffEntry = measure.staffEntries[idx];
                     let verticalContainer: VerticalGraphicalStaffEntryContainer = this.graphicalMusicSheet.getOrCreateVerticalContainer(graphicalStaffEntry.getAbsoluteTimestamp());
                     if (verticalContainer !== undefined) {
                         verticalContainer.StaffEntries[j] = graphicalStaffEntry;
-                        graphicalStaffEntry.ParentVerticalContainer = verticalContainer;
+                        graphicalStaffEntry.parentVerticalContainer = verticalContainer;
                     } else {
 
                     }
@@ -741,7 +741,7 @@ export class MusicSheetCalculator {
                         activeClefs[staffIndex] = <ClefInstruction>abstractNotationInstruction;
                 }
                 let graphicalStaffEntry: GraphicalStaffEntry = this.symbolFactory.createStaffEntry(sourceStaffEntry, measure);
-                if (measure.StaffEntries.length > entryIndex) {
+                if (measure.staffEntries.length > entryIndex) {
                     measure.addGraphicalStaffEntryAtTimestamp(graphicalStaffEntry);
                 } else measure.addGraphicalStaffEntry(graphicalStaffEntry);
                 let linkedNotes: Note[] = [];
@@ -752,13 +752,13 @@ export class MusicSheetCalculator {
                 let octaveShiftValue: OctaveEnum = OctaveEnum.NONE;
                 if (openOctaveShifts[staffIndex] !== undefined) {
                     let octaveShiftParams: OctaveShiftParams = openOctaveShifts[staffIndex];
-                    if (sourceStaffEntry.AbsoluteTimestamp >= octaveShiftParams.GetAbsoluteStartTimestamp && sourceStaffEntry.AbsoluteTimestamp <= octaveShiftParams.GetAbsoluteEndTimestamp) {
-                        octaveShiftValue = octaveShiftParams.GetOpenOctaveShift.Type;
+                    if (sourceStaffEntry.AbsoluteTimestamp >= octaveShiftParams.getAbsoluteStartTimestamp && sourceStaffEntry.AbsoluteTimestamp <= octaveShiftParams.getAbsoluteEndTimestamp) {
+                        octaveShiftValue = octaveShiftParams.getOpenOctaveShift.Type;
                     }
                 }
                 for (let idx: number = 0, len: number = sourceStaffEntry.VoiceEntries.length; idx < len; ++idx) {
                     let voiceEntry: VoiceEntry = sourceStaffEntry.VoiceEntries[idx];
-                    this.handleVoiceEntryGraceNotes(voiceEntry.graceVoiceEntriesBefore, graphicalStaffEntry.GraceStaffEntriesBefore, graphicalStaffEntry, accidentalCalculator, activeClefs[staffIndex], octaveShiftValue, openLyricWords,
+                    this.handleVoiceEntryGraceNotes(voiceEntry.graceVoiceEntriesBefore, graphicalStaffEntry.graceStaffEntriesBefore, graphicalStaffEntry, accidentalCalculator, activeClefs[staffIndex], octaveShiftValue, openLyricWords,
                         tieTimestampListDict,
                         openTuplets,
                         openBeams);
@@ -768,7 +768,7 @@ export class MusicSheetCalculator {
                         activeClefs[staffIndex], openTuplets,
                         openBeams, octaveShiftValue, false, linkedNotes,
                         sourceStaffEntry);
-                    this.handleVoiceEntryGraceNotes(voiceEntry.graceVoiceEntriesAfter, graphicalStaffEntry.GraceStaffEntriesAfter, graphicalStaffEntry, accidentalCalculator, activeClefs[staffIndex], octaveShiftValue, openLyricWords,
+                    this.handleVoiceEntryGraceNotes(voiceEntry.graceVoiceEntriesAfter, graphicalStaffEntry.graceStaffEntriesAfter, graphicalStaffEntry, accidentalCalculator, activeClefs[staffIndex], octaveShiftValue, openLyricWords,
                         tieTimestampListDict,
                         openTuplets,
                         openBeams);
@@ -798,18 +798,18 @@ export class MusicSheetCalculator {
         }
         for (let idx: number = 0, len: number = sourceMeasure.StaffLinkedExpressions[staffIndex].length; idx < len; ++idx) {
             let multiExpression: MultiExpression = sourceMeasure.StaffLinkedExpressions[staffIndex][idx];
-            if (multiExpression.OctaveShiftEnd !== undefined && openOctaveShifts[staffIndex] !== undefined && multiExpression.OctaveShiftEnd === openOctaveShifts[staffIndex].GetOpenOctaveShift) {
+            if (multiExpression.OctaveShiftEnd !== undefined && openOctaveShifts[staffIndex] !== undefined && multiExpression.OctaveShiftEnd === openOctaveShifts[staffIndex].getOpenOctaveShift) {
                 openOctaveShifts[staffIndex] = undefined;
             }
         }
-        if (measure.StaffEntries.length === 0) {
+        if (measure.staffEntries.length === 0) {
             let sourceStaffEntry: SourceStaffEntry = new SourceStaffEntry(undefined, staff);
             let note: Note = new Note(undefined, sourceStaffEntry, Fraction.createFromFraction(sourceMeasure.Duration), undefined);
             let graphicalStaffEntry: GraphicalStaffEntry = this.symbolFactory.createStaffEntry(sourceStaffEntry, measure);
             measure.addGraphicalStaffEntry(graphicalStaffEntry);
-            graphicalStaffEntry.RelInMeasureTimestamp = new Fraction(0, 1);
+            graphicalStaffEntry.relInMeasureTimestamp = new Fraction(0, 1);
             let graphicalNotes: GraphicalNote[] = [];
-            graphicalStaffEntry.Notes.push(graphicalNotes);
+            graphicalStaffEntry.notes.push(graphicalNotes);
             let numberOfDots: number = note.calculateNumberOfNeededDots();
             let graphicalNote: GraphicalNote = this.symbolFactory.createNote(note, numberOfDots, graphicalStaffEntry, new ClefInstruction(ClefEnum.G, 0, 2));
             graphicalNotes.push(graphicalNote);
@@ -871,15 +871,15 @@ export class MusicSheetCalculator {
     }
     private checkNoteForAccidental(graphicalNote: GraphicalNote, accidentalCalculator: AccidentalCalculator, activeClef: ClefInstruction,
         octaveEnum: OctaveEnum, grace: boolean = false): void {
-        let pitch: Pitch = graphicalNote.SourceNote.Pitch;
+        let pitch: Pitch = graphicalNote.sourceNote.Pitch;
         let transpose: number = this.graphicalMusicSheet.ParentMusicSheet.Transpose;
-        if (transpose !== 0 && graphicalNote.SourceNote.ParentStaffEntry.ParentStaff.ParentInstrument.MidiInstrumentId !== MidiInstrument.Percussion) {
+        if (transpose !== 0 && graphicalNote.sourceNote.ParentStaffEntry.ParentStaff.ParentInstrument.MidiInstrumentId !== MidiInstrument.Percussion) {
             pitch = graphicalNote.Transpose(accidentalCalculator.ActiveKeyInstruction, activeClef,
                 transpose, octaveEnum);
-            if (graphicalNote.SourceNote.NoteTie !== undefined)
-                graphicalNote.SourceNote.NoteTie.BaseNoteYPosition = graphicalNote.PositionAndShape.RelativePosition.y;
+            if (graphicalNote.sourceNote.NoteTie !== undefined)
+                graphicalNote.sourceNote.NoteTie.BaseNoteYPosition = graphicalNote.PositionAndShape.RelativePosition.y;
         }
-        graphicalNote.SourceNote.halfTone = pitch.getHalfTone();
+        graphicalNote.sourceNote.halfTone = pitch.getHalfTone();
         let scalingFactor: number = 1.0;
         if (grace)
             scalingFactor = this.rules.GraceNoteScalingFactor;
@@ -888,7 +888,7 @@ export class MusicSheetCalculator {
     private createStaffEntryForTieNote(measure: StaffMeasure, absoluteTimestamp: Fraction, openTie: Tie): GraphicalStaffEntry {
         let graphicalStaffEntry: GraphicalStaffEntry;
         graphicalStaffEntry = this.symbolFactory.createStaffEntry(openTie.Start.ParentStaffEntry, measure);
-        graphicalStaffEntry.RelInMeasureTimestamp = new Fraction(absoluteTimestamp - measure.ParentSourceMeasure.AbsoluteTimestamp);
+        graphicalStaffEntry.relInMeasureTimestamp = new Fraction(absoluteTimestamp - measure.parentSourceMeasure.AbsoluteTimestamp);
         this.resetYPositionForLeadSheet(graphicalStaffEntry.PositionAndShape);
         measure.addGraphicalStaffEntry(graphicalStaffEntry);
         return graphicalStaffEntry;
@@ -910,9 +910,9 @@ export class MusicSheetCalculator {
             let measures: StaffMeasure[] = this.graphicalMusicSheet.MeasureList[idx];
             for (let idx2: number = 0, len2: number = measures.length; idx2 < len2; ++idx2) {
                 let measure: StaffMeasure = measures[idx2];
-                for (let idx3: number = 0, len3: number = measure.StaffEntries.length; idx3 < len3; ++idx3) {
-                    let graphicalStaffEntry: GraphicalStaffEntry = measure.StaffEntries[idx3];
-                    if (graphicalStaffEntry.ParentMeasure !== undefined && graphicalStaffEntry.Notes.length > 0 && graphicalStaffEntry.Notes[0].length > 0) {
+                for (let idx3: number = 0, len3: number = measure.staffEntries.length; idx3 < len3; ++idx3) {
+                    let graphicalStaffEntry: GraphicalStaffEntry = measure.staffEntries[idx3];
+                    if (graphicalStaffEntry.parentMeasure !== undefined && graphicalStaffEntry.notes.length > 0 && graphicalStaffEntry.notes[0].length > 0) {
                         this.layoutVoiceEntries(graphicalStaffEntry);
                         this.layoutStaffEntry(graphicalStaffEntry);
                     }
@@ -964,8 +964,8 @@ export class MusicSheetCalculator {
                     let staffLine: StaffLine = musicSystem.StaffLines[idx3];
                     for (let idx4: number = 0, len4: number = staffLine.Measures.length; idx4 < len4; ++idx4) {
                         let measure: StaffMeasure = staffLine.Measures[idx4];
-                        for (let idx5: number = 0, len5: number = measure.StaffEntries.length; idx5 < len5; ++idx5) {
-                            let staffEntry: GraphicalStaffEntry = measure.StaffEntries[idx5];
+                        for (let idx5: number = 0, len5: number = measure.staffEntries.length; idx5 < len5; ++idx5) {
+                            let staffEntry: GraphicalStaffEntry = measure.staffEntries[idx5];
                             this.layoutBeams(staffEntry);
                         }
                     }
@@ -982,10 +982,10 @@ export class MusicSheetCalculator {
                     let line: StaffLine = system.StaffLines[idx3];
                     for (let idx4: number = 0, len4: number = line.Measures.length; idx4 < len4; ++idx4) {
                         let measure: StaffMeasure = line.Measures[idx4];
-                        for (let idx5: number = 0, len5: number = measure.StaffEntries.length; idx5 < len5; ++idx5) {
-                            let graphicalStaffEntry: GraphicalStaffEntry = measure.StaffEntries[idx5];
-                            for (let idx6: number = 0, len6: number = graphicalStaffEntry.SourceStaffEntry.VoiceEntries.length; idx6 < len6; ++idx6) {
-                                let voiceEntry: VoiceEntry = graphicalStaffEntry.SourceStaffEntry.VoiceEntries[idx6];
+                        for (let idx5: number = 0, len5: number = measure.staffEntries.length; idx5 < len5; ++idx5) {
+                            let graphicalStaffEntry: GraphicalStaffEntry = measure.staffEntries[idx5];
+                            for (let idx6: number = 0, len6: number = graphicalStaffEntry.sourceStaffEntry.VoiceEntries.length; idx6 < len6; ++idx6) {
+                                let voiceEntry: VoiceEntry = graphicalStaffEntry.sourceStaffEntry.VoiceEntries[idx6];
                                 if (voiceEntry.Articulations.length > 0)
                                     this.layoutArticulationMarks(voiceEntry.Articulations, voiceEntry, graphicalStaffEntry);
                             }
@@ -1004,12 +1004,12 @@ export class MusicSheetCalculator {
                     let line: StaffLine = system.StaffLines[idx3];
                     for (let idx4: number = 0, len4: number = line.Measures.length; idx4 < len4; ++idx4) {
                         let measure: StaffMeasure = line.Measures[idx4];
-                        for (let idx5: number = 0, len5: number = measure.StaffEntries.length; idx5 < len5; ++idx5) {
-                            let graphicalStaffEntry: GraphicalStaffEntry = measure.StaffEntries[idx5];
-                            for (let idx6: number = 0, len6: number = graphicalStaffEntry.SourceStaffEntry.VoiceEntries.length; idx6 < len6; ++idx6) {
-                                let voiceEntry: VoiceEntry = graphicalStaffEntry.SourceStaffEntry.VoiceEntries[idx6];
+                        for (let idx5: number = 0, len5: number = measure.staffEntries.length; idx5 < len5; ++idx5) {
+                            let graphicalStaffEntry: GraphicalStaffEntry = measure.staffEntries[idx5];
+                            for (let idx6: number = 0, len6: number = graphicalStaffEntry.sourceStaffEntry.VoiceEntries.length; idx6 < len6; ++idx6) {
+                                let voiceEntry: VoiceEntry = graphicalStaffEntry.sourceStaffEntry.VoiceEntries[idx6];
                                 if (voiceEntry.OrnamentContainer !== undefined) {
-                                    if (voiceEntry.hasTie() && graphicalStaffEntry.RelInMeasureTimestamp !== voiceEntry.Timestamp)
+                                    if (voiceEntry.hasTie() && graphicalStaffEntry.relInMeasureTimestamp !== voiceEntry.Timestamp)
                                         continue;
                                     this.layoutOrnament(voiceEntry.OrnamentContainer, voiceEntry, graphicalStaffEntry);
                                     if (!(this.staffEntriesWithOrnaments.indexOf(graphicalStaffEntry) !== -1))
@@ -1031,8 +1031,8 @@ export class MusicSheetCalculator {
                     let line: StaffLine = system.StaffLines[idx3];
                     for (let idx4: number = 0, len4: number = line.Measures.length; idx4 < len4; ++idx4) {
                         let measure: StaffMeasure = line.Measures[idx4];
-                        for (let idx5: number = 0, len5: number = measure.StaffEntries.length; idx5 < len5; ++idx5) {
-                            let graphicalStaffEntry: GraphicalStaffEntry = measure.StaffEntries[idx5];
+                        for (let idx5: number = 0, len5: number = measure.staffEntries.length; idx5 < len5; ++idx5) {
+                            let graphicalStaffEntry: GraphicalStaffEntry = measure.staffEntries[idx5];
                             this.optimizeRestNotePlacement(graphicalStaffEntry, measure);
                         }
                     }
@@ -1041,8 +1041,8 @@ export class MusicSheetCalculator {
         }
     }
     private calculateTwoRestNotesPlacementWithCollisionDetection(graphicalStaffEntry: GraphicalStaffEntry): void {
-        let firstRestNote: GraphicalNote = graphicalStaffEntry.Notes[0][0];
-        let secondRestNote: GraphicalNote = graphicalStaffEntry.Notes[1][0];
+        let firstRestNote: GraphicalNote = graphicalStaffEntry.notes[0][0];
+        let secondRestNote: GraphicalNote = graphicalStaffEntry.notes[1][0];
         secondRestNote.PositionAndShape.RelativePosition = new PointF2D(0.0, 2.5);
         graphicalStaffEntry.PositionAndShape.calculateAbsolutePositionsRecursiveWithoutTopelement();
         firstRestNote.PositionAndShape.computeNonOverlappingPositionWithMargin(graphicalStaffEntry.PositionAndShape, ColDirEnum.Up,
@@ -1055,12 +1055,12 @@ export class MusicSheetCalculator {
     private calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote(graphicalStaffEntry: GraphicalStaffEntry): void {
         let restNote: GraphicalNote;
         let graphicalNotes: GraphicalNote[];
-        if (graphicalStaffEntry.Notes[0][0].SourceNote.Pitch === undefined) {
-            restNote = graphicalStaffEntry.Notes[0][0];
-            graphicalNotes = graphicalStaffEntry.Notes[1];
+        if (graphicalStaffEntry.notes[0][0].sourceNote.Pitch === undefined) {
+            restNote = graphicalStaffEntry.notes[0][0];
+            graphicalNotes = graphicalStaffEntry.notes[1];
         } else {
-            graphicalNotes = graphicalStaffEntry.Notes[0];
-            restNote = graphicalStaffEntry.Notes[1][0];
+            graphicalNotes = graphicalStaffEntry.notes[0];
+            restNote = graphicalStaffEntry.notes[1][0];
         }
         let collision: boolean = false;
         graphicalStaffEntry.PositionAndShape.calculateAbsolutePositionsRecursiveWithoutTopelement();
@@ -1072,13 +1072,13 @@ export class MusicSheetCalculator {
             }
         }
         if (collision) {
-            if (restNote.SourceNote.ParentVoiceEntry.ParentVoice instanceof LinkedVoice) {
+            if (restNote.sourceNote.ParentVoiceEntry.ParentVoice instanceof LinkedVoice) {
                 let bottomBorder: number = graphicalNotes[0].PositionAndShape.BorderMarginBottom + graphicalNotes[0].PositionAndShape.RelativePosition.y;
                 restNote.PositionAndShape.RelativePosition = new PointF2D(0.0, bottomBorder - restNote.PositionAndShape.BorderMarginTop + 0.5);
             } else {
                 let last: GraphicalNote  = graphicalNotes[graphicalNotes.length-1];
                 let topBorder: number = last.PositionAndShape.BorderMarginTop + last.PositionAndShape.RelativePosition.y;
-                if (graphicalNotes[0].SourceNote.ParentVoiceEntry.ParentVoice instanceof LinkedVoice) {
+                if (graphicalNotes[0].sourceNote.ParentVoiceEntry.ParentVoice instanceof LinkedVoice) {
                     restNote.PositionAndShape.RelativePosition = new PointF2D(0.0, topBorder - restNote.PositionAndShape.BorderMarginBottom - 0.5);
                 } else {
                     let bottomBorder: number = graphicalNotes[0].PositionAndShape.BorderMarginBottom + graphicalNotes[0].PositionAndShape.RelativePosition.y;
@@ -1099,13 +1099,13 @@ export class MusicSheetCalculator {
                     let staffLine: StaffLine = musicSystem.StaffLines[idx3];
                     for (let idx4: number = 0, len5: number = staffLine.Measures.length; idx4 < len5; ++idx4) {
                         let measure: StaffMeasure = staffLine.Measures[idx4];
-                        for (let idx6: number = 0, len6: number = measure.StaffEntries.length; idx6 < len6; ++idx6) {
-                            let staffEntry: GraphicalStaffEntry = measure.StaffEntries[idx6];
+                        for (let idx6: number = 0, len6: number = measure.staffEntries.length; idx6 < len6; ++idx6) {
+                            let staffEntry: GraphicalStaffEntry = measure.staffEntries[idx6];
                             let graphicalTies: GraphicalTie[] = staffEntry.GraphicalTies;
                             for (let idx7: number = 0, len7: number = graphicalTies.length; idx7 < len7; ++idx7) {
                                 let graphicalTie: GraphicalTie = graphicalTies[idx7];
-                                if (graphicalTie.StartNote !== undefined && graphicalTie.StartNote.ParentStaffEntry === staffEntry) {
-                                    let tieIsAtSystemBreak: boolean = (graphicalTie.StartNote.ParentStaffEntry.ParentMeasure.ParentStaffLine !== graphicalTie.EndNote.ParentStaffEntry.ParentMeasure.ParentStaffLine);
+                                if (graphicalTie.StartNote !== undefined && graphicalTie.StartNote.parentStaffEntry === staffEntry) {
+                                    let tieIsAtSystemBreak: boolean = (graphicalTie.StartNote.parentStaffEntry.parentMeasure.ParentStaffLine !== graphicalTie.EndNote.parentStaffEntry.parentMeasure.ParentStaffLine);
                                     this.layoutGraphicalTie(graphicalTie, tieIsAtSystemBreak);
                                 }
                             }
@@ -1126,11 +1126,11 @@ export class MusicSheetCalculator {
                     for (let idx4: number = 0, len4: number = staffLine.Measures.length; idx4 < len4; ++idx4) {
                         let measure: StaffMeasure = staffLine.Measures[idx4];
                         let measureRelativePosition: PointF2D = measure.PositionAndShape.RelativePosition;
-                        for (let idx5: number = 0, len5: number = measure.StaffEntries.length; idx5 < len5; ++idx5) {
-                            let staffEntry: GraphicalStaffEntry = measure.StaffEntries[idx5];
+                        for (let idx5: number = 0, len5: number = measure.staffEntries.length; idx5 < len5; ++idx5) {
+                            let staffEntry: GraphicalStaffEntry = measure.staffEntries[idx5];
                             let hasTechnicalInstruction: boolean = false;
-                            for (let idx6: number = 0, len6: number = staffEntry.SourceStaffEntry.VoiceEntries.length; idx6 < len6; ++idx6) {
-                                let ve: VoiceEntry = staffEntry.SourceStaffEntry.VoiceEntries[idx6];
+                            for (let idx6: number = 0, len6: number = staffEntry.sourceStaffEntry.VoiceEntries.length; idx6 < len6; ++idx6) {
+                                let ve: VoiceEntry = staffEntry.sourceStaffEntry.VoiceEntries[idx6];
                                 if (ve.TechnicalInstructions.length > 0) {
                                     hasTechnicalInstruction = true;
                                     break;
@@ -1242,4 +1242,4 @@ export class MusicSheetCalculator {
             }
         }
     }
-}
+}

+ 1 - 85
src/MusicalScore/Graphical/MusicSymbol.ts

@@ -1,171 +1,87 @@
 export enum MusicSymbol {
     Unused_first_Symbol,
-
     BLACK_HEAD,
-
     UPWARDS_TAIL,
-
     DOWNWARDS_TAIL,
-
     UPWARDS_DOUBLE_TAIL,
-
     DOWNWARDS_DOUBLE_TAIL,
-
     UPWARDS_TRIPLE_TAIL,
-
     DOWNWARDS_TRIPLE_TAIL,
-
     UPWARDS_QUAD_TAIL,
-
     DOWNWARDS_QUAD_TAIL,
-
     ROUND_HEAD,
-
     WHITE_HEAD,
-
     G_CLEF,
-
     F_CLEF,
-
     C_CLEF,
-
     BREVE,
-
     BREVE_REST,
-
     COMMON_TIME,
-
     CUT_TIME,
-
     WHOLE_REST,
-
     HALF_REST,
-
     QUARTER_REST,
-
     EIGHTH_REST,
-
     SIXTEENTH_REST,
-
     THIRTYSECOND_REST,
-
     SIXTYFOURTH_REST,
-
     FLAT,
-
     SHARP,
-
     NATURAL,
-
     DOUBLE_FLAT,
-
     DOUBLE_SHARP,
-
     ZERO,
-
     ONE,
-
     TWO,
-
     THREE,
-
     FOUR,
-
     FIVE,
-
     SIX,
-
     SEVEN,
-
     EIGHT,
-
     NINE,
-
     DOT,
-
     FERMATA,
-
     INVERTED_FERMATA,
-
     SPICCATO,
-
     TENUTO,
-
     MARCATO,
-
     MARCATISSIMO,
-
     INVERTED_MARCATISSIMO,
-
     P,
-
     F,
-
     S,
-
     Z,
-
     M,
-
     R,
-
     SEGNO,
-
     CODA,
-
     DRUM_CLEF,
-
     G_CLEF_SUB8,
-
     G_CLEF_SUPER8,
-
     G_CLEF_SUB15,
-
     G_CLEF_SUPER15,
-
     F_CLEF_SUB8,
-
     F_CLEF_SUPER8,
-
     F_CLEF_SUB15,
-
     F_CLEF_SUPER15,
-
     DOWN_BOW,
-
     MORDENT,
-
     INVERTED_MORDENT,
-
     TURN,
-
     INVERTED_TURN,
-
     LEFTHAND_PIZZICATO,
-
     RELEASE_PED,
-
     ENGAGE_PED,
-
     VA8,
-
     VB8,
-
     TRILL,
-
     MA15,
-
     MB15,
-
     HIGH,
-
     PLAY,
-
     MIC,
-
     SNAP_PIZZICATO,
-
     NATURAL_HARMONIC,
-
     EditPen
-}
+}

+ 111 - 47
src/MusicalScore/Graphical/MusicSystem.ts

@@ -12,9 +12,10 @@ import {GraphicalObject} from "./GraphicalObject";
 import {EngravingRules} from "./EngravingRules";
 import {PointF2D} from "../../Common/DataObjects/PointF2D";
 import {GraphicalStaffEntry} from "./GraphicalStaffEntry";
+import {SystemLinesEnum} from "./SystemLinesEnum";
 
 export class MusicSystem extends GraphicalObject {
-    public NeedsToBeRedrawn: boolean = true;
+    public needsToBeRedrawn: boolean = true;
     protected parent: GraphicalMusicPage;
     protected id: number;
     protected staffLines: StaffLine[] = [];
@@ -22,118 +23,160 @@ export class MusicSystem extends GraphicalObject {
     protected labels: Dictionary<GraphicalLabel, Instrument> = new Dictionary<GraphicalLabel, Instrument>();
     protected measureNumberLabels: GraphicalLabel[] = [];
     protected maxLabelLength: number;
-    protected objectsToRedraw: List<Tuple<Object[], Object>> = new List<Tuple<Object[], Object>>();
+    protected objectsToRedraw: [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(): StaffLine[] {
         return this.staffLines;
     }
+
     public get GraphicalMeasures(): StaffMeasure[][] {
         return this.graphicalMeasures;
     }
+
     public get MeasureNumberLabels(): GraphicalLabel[] {
         return this.measureNumberLabels;
     }
+
     public get Labels(): GraphicalLabel[] {
-        return this.labels.Keys.ToList();
+        return this.labels.GetKeys();
     }
-    public get ObjectsToRedraw(): List<Tuple<Object[], Object>> {
+
+    public get ObjectsToRedraw(): [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 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 alignBeginInstructions(): void {
 
+    public setYPositionsToVerticalLineObjectsAndCreateLines(rules: EngravingRules): void {
+        throw new Error("not implemented");
     }
+
+    public calculateBorders(rules: EngravingRules): void {
+        throw new Error("not implemented");
+    }
+
+    public alignBeginInstructions(): void {
+        throw new Error("not implemented");
+    }
+
     public GetLeftBorderAbsoluteXPosition(): number {
-        return this.StaffLines[0].PositionAndShape.AbsolutePosition.x + this.StaffLines[0].Measures[0].BeginInstructionsWidth;
+        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: StaffMeasure[]): void {
         for (let idx: number = 0, len: number = graphicalMeasures.length; idx < len; ++idx) {
             let graphicalMeasure: StaffMeasure = graphicalMeasures[idx];
-            graphicalMeasure.ParentMusicSystem = this;
+            graphicalMeasure.parentMusicSystem = this;
         }
         this.graphicalMeasures.push(graphicalMeasures);
     }
+
     public GetSystemsFirstTimeStamp(): Fraction {
-        return this.graphicalMeasures[0][0].ParentSourceMeasure.AbsoluteTimestamp;
+        return this.graphicalMeasures[0][0].parentSourceMeasure.AbsoluteTimestamp;
     }
+
     public GetSystemsLastTimeStamp(): Fraction {
-        let m: SourceMeasure = this.graphicalMeasures[this.graphicalMeasures.length - 1][0].ParentSourceMeasure;
+        let m: SourceMeasure = this.graphicalMeasures[this.graphicalMeasures.length - 1][0].parentSourceMeasure;
         return m.AbsoluteTimestamp + m.Duration;
     }
+
     public createInstrumentBrackets(instruments: Instrument[], staffHeight: number): void {
         for (let idx: number = 0, len: number = instruments.length; idx < len; ++idx) {
             let instrument: Instrument = instruments[idx];
             if (instrument.Staves.length > 1) {
-                let firstStaffLine: StaffLine = undefined, lastStaffLine = undefined;
+                let firstStaffLine: StaffLine = undefined, lastStaffLine: StaffLine = undefined;
                 for (let idx2: number = 0, len2: number = this.staffLines.length; idx2 < len2; ++idx2) {
                     let staffLine: StaffLine = this.staffLines[idx2];
-                    if (staffLine.ParentStaff === instrument.Staves[0])
+                    if (staffLine.ParentStaff === instrument.Staves[0]) {
                         firstStaffLine = staffLine;
-                    if (staffLine.ParentStaff === instrument.Staves[instrument.Staves.length - 1])
+                    }
+                    if (staffLine.ParentStaff === instrument.Staves[instrument.Staves.length - 1]) {
                         lastStaffLine = staffLine;
+                    }
                 }
                 if (firstStaffLine !== undefined && lastStaffLine !== undefined) {
-                    let rightUpper: PointF2D = new PointF2D(firstStaffLine.PositionAndShape.RelativePosition.x,
-                        firstStaffLine.PositionAndShape.RelativePosition.y);
-                    let rightLower: PointF2D = new PointF2D(lastStaffLine.PositionAndShape.RelativePosition.x,
-                        lastStaffLine.PositionAndShape.RelativePosition.y + staffHeight);
+                    let rightUpper: PointF2D = new PointF2D(
+                        firstStaffLine.PositionAndShape.RelativePosition.x,
+                        firstStaffLine.PositionAndShape.RelativePosition.y
+                    );
+                    let rightLower: PointF2D = new PointF2D(
+                        lastStaffLine.PositionAndShape.RelativePosition.x,
+                        lastStaffLine.PositionAndShape.RelativePosition.y + staffHeight
+                    );
                     this.createInstrumentBracket(rightUpper, rightLower);
                 }
             }
         }
     }
+
     public createGroupBrackets(instrumentGroups: InstrumentalGroup[], staffHeight: number, recursionDepth: number): void {
         for (let idx: number = 0, len: number = instrumentGroups.length; idx < len; ++idx) {
             let instrumentGroup: InstrumentalGroup = instrumentGroups[idx];
-            if (instrumentGroup.InstrumentalGroups.length < 1)
+            if (instrumentGroup.InstrumentalGroups.length < 1) {
                 continue;
+            }
             let instrument1: Instrument = this.findFirstVisibleInstrumentInInstrumentalGroup(instrumentGroup);
             let instrument2: Instrument = this.findLastVisibleInstrumentInInstrumentalGroup(instrumentGroup);
-            if (instrument1 === undefined || instrument2 === undefined)
+            if (instrument1 === undefined || instrument2 === undefined) {
                 continue;
-            let firstStaffLine: StaffLine = undefined, lastStaffLine = undefined;
+            }
+            let firstStaffLine: StaffLine = undefined, lastStaffLine: StaffLine = undefined;
             for (let idx2: number = 0, len2: number = this.staffLines.length; idx2 < len2; ++idx2) {
                 let staffLine: StaffLine = this.staffLines[idx2];
-                if (staffLine.ParentStaff === instrument1.Staves[0])
+                if (staffLine.ParentStaff === instrument1.Staves[0]) {
                     firstStaffLine = staffLine;
-                if (staffLine.ParentStaff === instrument2.Staves.Last())
+                }
+                if (staffLine.ParentStaff === instrument2.Staves.Last()) {
                     lastStaffLine = staffLine;
+                }
             }
             if (firstStaffLine !== undefined && lastStaffLine !== undefined) {
-                let rightUpper: PointF2D = new PointF2D(firstStaffLine.PositionAndShape.RelativePosition.x,
-                    firstStaffLine.PositionAndShape.RelativePosition.y);
-                let rightLower: PointF2D = new PointF2D(lastStaffLine.PositionAndShape.RelativePosition.x,
-                    lastStaffLine.PositionAndShape.RelativePosition.y + staffHeight);
+                let rightUpper: PointF2D = new PointF2D(
+                    firstStaffLine.PositionAndShape.RelativePosition.x,
+                    firstStaffLine.PositionAndShape.RelativePosition.y
+                );
+                let rightLower: PointF2D = new PointF2D(
+                    lastStaffLine.PositionAndShape.RelativePosition.x,
+                    lastStaffLine.PositionAndShape.RelativePosition.y + staffHeight
+                );
                 this.createGroupBracket(rightUpper, rightLower, staffHeight, recursionDepth);
             }
-            if (instrumentGroup.InstrumentalGroups.length < 1)
+            if (instrumentGroup.InstrumentalGroups.length < 1) {
                 continue;
+            }
             this.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]) {
             let instruments: Instrument[] = this.parent.Parent.ParentMusicSheet.Instruments.Where(i => i.Voices.length > 0 && i.Voices[0].Visible);
@@ -149,12 +192,14 @@ export class MusicSystem extends GraphicalObject {
             let labels: GraphicalLabel[] = this.labels.Keys;
             for (let idx: number = 0, len: number = labels.length; idx < len; ++idx) {
                 let label: GraphicalLabel = labels[idx];
-                if (label.PositionAndShape.Size.width > this.maxLabelLength)
+                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]) {
             let labels: KeyValuePair<GraphicalLabel, Instrument>[] = this.labels;
@@ -166,73 +211,92 @@ export class MusicSystem extends GraphicalObject {
                     if (this.staffLines[i].ParentStaff.ParentInstrument === entry.Value) {
                         for (let j: number = i; j < this.staffLines.length; j++) {
                             let staffLine: StaffLine = this.staffLines[j];
-                            if (staffLine.ParentStaff.ParentInstrument !== entry.Value)
+                            if (staffLine.ParentStaff.ParentInstrument !== entry.Value) {
                                 break;
+                            }
                             ypositionSum += staffLine.PositionAndShape.RelativePosition.y;
                             staffCounter++;
                         }
                         break;
                     }
                 }
-                if (staffCounter > 0)
+                if (staffCounter > 0) {
                     entry.Key.PositionAndShape.RelativePosition = new PointF2D(0.0, ypositionSum / staffCounter + 2.0);
+                }
             }
         }
     }
+
     public checkStaffEntriesForStaffEntryLink(): boolean {
         let first: boolean = false;
         let second: boolean = false;
         for (let i: number = 0; i < this.staffLines.length - 1; i++) {
             for (let idx: number = 0, len: number = this.staffLines[i].Measures.length; idx < len; ++idx) {
                 let measure: StaffMeasure = this.staffLines[i].Measures[idx];
-                for (let idx2: number = 0, len2: number = measure.StaffEntries.length; idx2 < len2; ++idx2) {
-                    let staffEntry: GraphicalStaffEntry = measure.StaffEntries[idx2];
-                    if (staffEntry.SourceStaffEntry.Link !== undefined)
+                for (let idx2: number = 0, len2: number = measure.staffEntries.length; idx2 < len2; ++idx2) {
+                    let staffEntry: GraphicalStaffEntry = measure.staffEntries[idx2];
+                    if (staffEntry.sourceStaffEntry.Link !== undefined) {
                         first = true;
+                    }
                 }
             }
             for (let idx: number = 0, len: number = this.staffLines[i + 1].Measures.length; idx < len; ++idx) {
                 let measure: StaffMeasure = this.staffLines[i + 1].Measures[idx];
-                for (let idx2: number = 0, len2: number = measure.StaffEntries.length; idx2 < len2; ++idx2) {
-                    let staffEntry: GraphicalStaffEntry = measure.StaffEntries[idx2];
-                    if (staffEntry.SourceStaffEntry.Link !== undefined)
+                for (let idx2: number = 0, len2: number = measure.staffEntries.length; idx2 < len2; ++idx2) {
+                    let staffEntry: GraphicalStaffEntry = measure.staffEntries[idx2];
+                    if (staffEntry.sourceStaffEntry.Link !== undefined) {
                         second = true;
+                    }
                 }
             }
         }
-        if (first && second)
+        if (first && second) {
             return true;
+        }
         return false;
     }
-    protected calcInstrumentsBracketsWidth(): number { throw new Error('not implemented'); }
-    protected createInstrumentBracket(rightUpper: PointF2D, rightLower: PointF2D): void { throw new Error('not implemented'); }
-    protected createGroupBracket(rightUpper: PointF2D, rightLower: PointF2D, staffHeight: number,
-        recursionDepth: number): void { throw new Error('not implemented'); }
+
+    protected calcInstrumentsBracketsWidth(): number {
+        throw new Error("not implemented");
+    }
+
+    protected createInstrumentBracket(rightUpper: PointF2D, rightLower: PointF2D): void {
+        throw new Error("not implemented");
+    }
+
+    protected createGroupBracket(rightUpper: PointF2D, rightLower: PointF2D, staffHeight: number, recursionDepth: number): void {
+        throw new Error("not implemented");
+    }
+
     private findFirstVisibleInstrumentInInstrumentalGroup(instrumentalGroup: InstrumentalGroup): Instrument {
         for (let idx: number = 0, len: number = instrumentalGroup.InstrumentalGroups.length; idx < len; ++idx) {
             let groupOrInstrument: InstrumentalGroup = instrumentalGroup.InstrumentalGroups[idx];
             if (groupOrInstrument instanceof Instrument) {
-                if ((<Instrument>groupOrInstrument).Visible === true)
+                if ((<Instrument>groupOrInstrument).Visible === true) {
                     return <Instrument>groupOrInstrument;
+                }
                 continue;
             }
             return this.findFirstVisibleInstrumentInInstrumentalGroup(groupOrInstrument);
         }
         return undefined;
     }
+
     private findLastVisibleInstrumentInInstrumentalGroup(instrumentalGroup: InstrumentalGroup): Instrument {
         let groupOrInstrument: InstrumentalGroup;
         for (let i: number = instrumentalGroup.InstrumentalGroups.length - 1; i >= 0; i--) {
             groupOrInstrument = instrumentalGroup.InstrumentalGroups[i];
             if (groupOrInstrument instanceof Instrument) {
-                if ((<Instrument>groupOrInstrument).Visible === true)
+                if ((<Instrument>groupOrInstrument).Visible === true) {
                     return <Instrument>groupOrInstrument;
+                }
                 continue;
             }
             return this.findLastVisibleInstrumentInInstrumentalGroup(groupOrInstrument);
         }
         return undefined;
     }
+
     private updateMusicSystemStaffLineXPosition(systemLabelsRightMargin: number): void {
         for (let idx: number = 0, len: number = this.StaffLines.length; idx < len; ++idx) {
             let staffLine: StaffLine = this.StaffLines[idx];

+ 202 - 99
src/MusicalScore/Graphical/MusicSystemBuilder.ts

@@ -19,6 +19,8 @@ import {SystemLinesEnum} from "./SystemLinesEnum";
 import {GraphicalMusicSheet} from "./GraphicalMusicSheet";
 import {IGraphicalSymbolFactory} from "../Interfaces/IGraphicalSymbolFactory";
 import {MusicSheetCalculator} from "./MusicSheetCalculator";
+import {MidiInstrument} from "../VoiceData/Instructions/ClefInstruction";
+
 export class MusicSystemBuilder {
     private measureList: StaffMeasure[][];
     private graphicalMusicSheet: GraphicalMusicSheet;
@@ -35,8 +37,10 @@ export class MusicSystemBuilder {
     private globalSystemIndex: number = 0;
     private leadSheet: boolean = false;
     private symbolFactory: IGraphicalSymbolFactory;
-    public initialize(graphicalMusicSheet: GraphicalMusicSheet, measureList: StaffMeasure[][],
-        numberOfStaffLines: number, symbolFactory: IGraphicalSymbolFactory): void {
+
+    public initialize(
+        graphicalMusicSheet: GraphicalMusicSheet, measureList: StaffMeasure[][], numberOfStaffLines: number, symbolFactory: IGraphicalSymbolFactory
+    ): void {
         this.leadSheet = graphicalMusicSheet.LeadSheet;
         this.graphicalMusicSheet = graphicalMusicSheet;
         this.rules = this.graphicalMusicSheet.ParentMusicSheet.rules;
@@ -50,6 +54,7 @@ export class MusicSystemBuilder {
         this.activeClefs = new Array(this.numberOfVisibleStaffLines);
         this.initializeActiveInstructions(this.measureList[0]);
     }
+
     public buildMusicSystems(): void {
         let previousMeasureEndsSystem: boolean = false;
         let systemMaxWidth: number = this.getFullPageSystemWidth();
@@ -57,16 +62,19 @@ export class MusicSystemBuilder {
         this.currentSystemParams = new SystemBuildParameters();
         this.currentSystemParams.currentSystem = this.initMusicSystem();
         this.layoutSystemStaves();
-        this.currentSystemParams.currentSystem.createMusicSystemLabel(this.rules.InstrumentLabelTextHeight,
+        this.currentSystemParams.currentSystem.createMusicSystemLabel(
+            this.rules.InstrumentLabelTextHeight,
             this.rules.SystemLabelsRightMargin,
-            this.rules.LabelMarginBorderFactor);
-        this.currentPageHeight += this.currentSystemParams.currentSystem.PositionAndShape.RelativePosition.Y;
+            this.rules.LabelMarginBorderFactor
+        );
+        this.currentPageHeight += this.currentSystemParams.currentSystem.PositionAndShape.RelativePosition.y;
         let numberOfMeasures: number = this.measureList.length(m => m.Any());
         while (this.measureListIndex < numberOfMeasures) {
             let staffMeasures: StaffMeasure[] = this.measureList[this.measureListIndex];
-            for (let idx: number = 0, len: number = staffMeasures.length; idx < len; ++idx)
+            for (let idx: number = 0, len: number = staffMeasures.length; idx < len; ++idx) {
                 staffMeasures[idx].ResetLayout();
-            let sourceMeasure: SourceMeasure = staffMeasures[0].ParentSourceMeasure;
+            }
+            let sourceMeasure: SourceMeasure = staffMeasures[0].parentSourceMeasure;
             let sourceMeasureEndsSystem: boolean = sourceMeasure.BreakSystemAfter;
             let isSystemStartMeasure: boolean = this.currentSystemParams.IsSystemStartMeasure();
             let isFirstSourceMeasure: boolean = sourceMeasure === this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();
@@ -79,14 +87,15 @@ export class MusicSystemBuilder {
                 currentMeasureEndInstructionsWidth += this.addEndInstructions(staffMeasures);
             }
             let currentMeasureVarWidth: number = 0;
-            for (let i: number = 0; i < this.numberOfVisibleStaffLines; i++)
-                currentMeasureVarWidth = Math.max(currentMeasureVarWidth, staffMeasures[i].MinimumStaffEntriesWidth);
+            for (let i: number = 0; i < this.numberOfVisibleStaffLines; i++) {
+                currentMeasureVarWidth = Math.max(currentMeasureVarWidth, staffMeasures[i].minimumStaffEntriesWidth);
+            }
             let measureEndLine: SystemLinesEnum = this.getMeasureEndLine();
             currentMeasureEndInstructionsWidth += this.getLineWidth(staffMeasures[0], measureEndLine, isSystemStartMeasure);
             let nextMeasureBeginInstructionWidth: number = this.rules.MeasureLeftMargin;
             if (this.measureListIndex + 1 < this.measureList.length) {
                 let nextStaffMeasures: StaffMeasure[] = this.measureList[this.measureListIndex + 1];
-                let nextSourceMeasure: SourceMeasure = nextStaffMeasures[0].ParentSourceMeasure;
+                let nextSourceMeasure: SourceMeasure = nextStaffMeasures[0].parentSourceMeasure;
                 if (nextSourceMeasure.hasBeginInstructions()) {
                     nextMeasureBeginInstructionWidth += this.addBeginInstructions(nextStaffMeasures, false, false);
                 }
@@ -94,7 +103,10 @@ export class MusicSystemBuilder {
             let totalMeasureWidth: number = currentMeasureBeginInstructionsWidth + currentMeasureEndInstructionsWidth + currentMeasureVarWidth;
             let measureFitsInSystem: boolean = this.currentSystemParams.currentWidth + totalMeasureWidth + nextMeasureBeginInstructionWidth < systemMaxWidth;
             if (isSystemStartMeasure || measureFitsInSystem) {
-                this.addMeasureToSystem(staffMeasures, measureStartLine, measureEndLine, totalMeasureWidth, currentMeasureBeginInstructionsWidth, currentMeasureVarWidth, currentMeasureEndInstructionsWidth);
+                this.addMeasureToSystem(
+                    staffMeasures, measureStartLine, measureEndLine, totalMeasureWidth,
+                    currentMeasureBeginInstructionsWidth, currentMeasureVarWidth, currentMeasureEndInstructionsWidth
+                );
                 this.updateActiveClefs(sourceMeasure, staffMeasures);
                 this.measureListIndex++;
             } else {
@@ -104,25 +116,32 @@ export class MusicSystemBuilder {
         }
         this.finalizeCurrentAndCreateNewSystem(this.measureList[this.measureList.length - 1], true);
     }
+
     private setMeasureWidth(staffMeasures: StaffMeasure[], width: number, beginInstrWidth: number, endInstrWidth: number): void {
         for (let idx: number = 0, len: number = staffMeasures.length; idx < len; ++idx) {
             let measure: StaffMeasure = staffMeasures[idx];
             measure.SetWidth(width);
-            if (beginInstrWidth > 0)
-                measure.BeginInstructionsWidth = beginInstrWidth;
-            if (endInstrWidth > 0)
-                measure.EndInstructionsWidth = endInstrWidth;
+            if (beginInstrWidth > 0) {
+                measure.beginInstructionsWidth = beginInstrWidth;
+            }
+            if (endInstrWidth > 0) {
+                measure.endInstructionsWidth = endInstrWidth;
+            }
         }
     }
+
     private finalizeCurrentAndCreateNewSystem(measures: StaffMeasure[], isPartEndingSystem: boolean = false): void {
         this.adaptRepetitionLineWithIfNeeded();
         if (!isPartEndingSystem) {
             this.checkAndCreateExtraInstructionMeasure(measures);
         }
         this.stretchMusicSystem(isPartEndingSystem);
-        if (this.currentPageHeight + this.currentSystemParams.currentSystem.PositionAndShape.Size.Height + this.rules.SystemDistance <= this.rules.PageHeight) {
-            this.currentPageHeight += this.currentSystemParams.currentSystem.PositionAndShape.Size.Height + this.rules.SystemDistance;
-            if (this.currentPageHeight + this.currentSystemParams.currentSystem.PositionAndShape.Size.Height + this.rules.SystemDistance >= this.rules.PageHeight) {
+        if (this.currentPageHeight + this.currentSystemParams.currentSystem.PositionAndShape.Size.height + this.rules.SystemDistance <= this.rules.PageHeight) {
+            this.currentPageHeight += this.currentSystemParams.currentSystem.PositionAndShape.Size.height + this.rules.SystemDistance;
+            if (
+                this.currentPageHeight + this.currentSystemParams.currentSystem.PositionAndShape.Size.height
+                + this.rules.SystemDistance >= this.rules.PageHeight
+            ) {
                 this.currentMusicPage = this.createMusicPage();
                 this.currentPageHeight = this.rules.PageTopMargin + this.rules.TitleTopDistance;
             }
@@ -136,10 +155,12 @@ export class MusicSystemBuilder {
             this.layoutSystemStaves();
         }
     }
+
     private adaptRepetitionLineWithIfNeeded(): void {
         let systemMeasures: MeasureBuildParameters[] = this.currentSystemParams.systemMeasures;
         if (systemMeasures.length >= 1) {
-            let measures: StaffMeasure[] = this.currentSystemParams.currentSystem.GraphicalMeasures[this.currentSystemParams.currentSystem.GraphicalMeasures.length - 1];
+            let measures: StaffMeasure[] =
+                this.currentSystemParams.currentSystem.GraphicalMeasures[this.currentSystemParams.currentSystem.GraphicalMeasures.length - 1];
             let measureParams: MeasureBuildParameters = systemMeasures[systemMeasures.length - 1];
             let diff: number = 0.0;
             if (measureParams.endLine === SystemLinesEnum.DotsBoldBoldDots) {
@@ -149,30 +170,37 @@ export class MusicSystemBuilder {
             this.currentSystemParams.currentSystemFixWidth -= diff;
             for (let idx: number = 0, len: number = measures.length; idx < len; ++idx) {
                 let measure: StaffMeasure = measures[idx];
-                measure.EndInstructionsWidth -= diff;
+                measure.endInstructionsWidth -= diff;
             }
         }
     }
-    private addMeasureToSystem(staffMeasures: StaffMeasure[], measureStartLine: SystemLinesEnum, measureEndLine: SystemLinesEnum, totalMeasureWidth: number, currentMeasureBeginInstructionsWidth: number, currentVarWidth: number, currentMeasureEndInstructionsWidth: number): void {
-        this.currentSystemParams.systemMeasures.push(__init(new MeasureBuildParameters(), { beginLine: measureStartLine, endLine: measureEndLine }));
-        this.setMeasureWidth(staffMeasures, totalMeasureWidth, currentMeasureBeginInstructionsWidth,
-            currentMeasureEndInstructionsWidth);
+
+    private addMeasureToSystem(
+        staffMeasures: StaffMeasure[], measureStartLine: SystemLinesEnum, measureEndLine: SystemLinesEnum,
+        totalMeasureWidth: number, currentMeasureBeginInstructionsWidth: number, currentVarWidth: number, currentMeasureEndInstructionsWidth: number
+    ): void {
+        this.currentSystemParams.systemMeasures.push({beginLine: measureStartLine, endLine: measureEndLine});
+        this.setMeasureWidth(
+            staffMeasures, totalMeasureWidth, currentMeasureBeginInstructionsWidth, currentMeasureEndInstructionsWidth
+        );
         this.addStaveMeasuresToSystem(staffMeasures);
         this.currentSystemParams.currentWidth += totalMeasureWidth;
         this.currentSystemParams.currentSystemFixWidth += currentMeasureBeginInstructionsWidth + currentMeasureEndInstructionsWidth;
         this.currentSystemParams.currentSystemVarWidth += currentVarWidth;
         this.currentSystemParams.systemMeasureIndex++;
     }
+
     private createMusicPage(): GraphicalMusicPage {
         let page: GraphicalMusicPage = new GraphicalMusicPage(this.graphicalMusicSheet);
         this.graphicalMusicSheet.MusicPages.push(page);
         page.PositionAndShape.BorderLeft = 0.0;
-        page.PositionAndShape.BorderRight = this.graphicalMusicSheet.ParentMusicSheet.PageWidth;
+        page.PositionAndShape.BorderRight = this.graphicalMusicSheet.ParentMusicSheet.pageWidth;
         page.PositionAndShape.BorderTop = 0.0;
         page.PositionAndShape.BorderBottom = this.rules.PageHeight;
         page.PositionAndShape.RelativePosition = new PointF2D(0.0, 0.0);
         return page;
     }
+
     private initMusicSystem(): MusicSystem {
         let musicSystem: MusicSystem = this.symbolFactory.createMusicSystem(this.currentMusicPage, this.globalSystemIndex++);
         this.currentMusicPage.MusicSystems.push(musicSystem);
@@ -180,9 +208,12 @@ export class MusicSystemBuilder {
         this.currentMusicPage.PositionAndShape.ChildElements.push(boundingBox);
         return musicSystem;
     }
+
     private getFullPageSystemWidth(): number {
-        return this.currentMusicPage.PositionAndShape.Size.Width - this.rules.PageLeftMargin - this.rules.PageRightMargin - this.rules.SystemLeftMargin - this.rules.SystemRightMargin;
+        return this.currentMusicPage.PositionAndShape.Size.width - this.rules.PageLeftMargin
+            - this.rules.PageRightMargin - this.rules.SystemLeftMargin - this.rules.SystemRightMargin;
     }
+
     private layoutSystemStaves(): void {
         let systemWidth: number = this.getFullPageSystemWidth();
         let musicSystem: MusicSystem = this.currentSystemParams.currentSystem;
@@ -219,15 +250,18 @@ export class MusicSystemBuilder {
                 if (this.leadSheet && !multiLyrics) {
                     yOffset = 2.5;
                 } else {
-                    if (staffList[i].ParentInstrument === staffList[i + 1].ParentInstrument)
+                    if (staffList[i].ParentInstrument === staffList[i + 1].ParentInstrument) {
                         yOffset = this.rules.BetweenStaffDistance;
-                    else yOffset = this.rules.StaffDistance;
+                    } else {
+                        yOffset = this.rules.StaffDistance;
+                    }
                 }
                 yOffsetSum += yOffset;
             }
         }
         boundingBox.BorderBottom = yOffsetSum;
     }
+
     private addStaffLineToMusicSystem(musicSystem: MusicSystem, relativeYPosition: number, staff: Staff): void {
         if (musicSystem !== undefined) {
             let staffLine: StaffLine = this.symbolFactory.createStaffLine(musicSystem, staff);
@@ -235,30 +269,36 @@ export class MusicSystemBuilder {
             let boundingBox: BoundingBox = staffLine.PositionAndShape;
             musicSystem.PositionAndShape.ChildElements.push(boundingBox);
             let relativePosition: PointF2D = new PointF2D();
-            if (musicSystem.Parent.MusicSystems[0] === musicSystem && musicSystem.Parent === musicSystem.Parent.Parent.MusicPages[0])
-                relativePosition.X = this.rules.FirstSystemMargin;
-            else relativePosition.X = 0.0;
-            relativePosition.Y = relativeYPosition;
+            if (musicSystem.Parent.MusicSystems[0] === musicSystem && musicSystem.Parent === musicSystem.Parent.Parent.MusicPages[0]) {
+                relativePosition.x = this.rules.FirstSystemMargin;
+            } else {
+                relativePosition.x = 0.0;
+            }
+            relativePosition.y = relativeYPosition;
             boundingBox.RelativePosition = relativePosition;
-            if (musicSystem.Parent.MusicSystems[0] === musicSystem && musicSystem.Parent === musicSystem.Parent.Parent.MusicPages[0])
-                boundingBox.BorderRight = musicSystem.PositionAndShape.Size.Width - this.rules.FirstSystemMargin;
-            else boundingBox.BorderRight = musicSystem.PositionAndShape.Size.Width;
+            if (musicSystem.Parent.MusicSystems[0] === musicSystem && musicSystem.Parent === musicSystem.Parent.Parent.MusicPages[0]) {
+                boundingBox.BorderRight = musicSystem.PositionAndShape.Size.width - this.rules.FirstSystemMargin;
+            } else {
+                boundingBox.BorderRight = musicSystem.PositionAndShape.Size.width;
+            }
             boundingBox.BorderLeft = 0.0;
             boundingBox.BorderTop = 0.0;
             boundingBox.BorderBottom = this.rules.StaffHeight;
             for (let i: number = 0; i < 5; i++) {
                 let start: PointF2D = new PointF2D();
-                start.X = 0.0;
-                start.Y = i * this.rules.StaffHeight / 4;
+                start.x = 0.0;
+                start.y = i * this.rules.StaffHeight / 4;
                 let end: PointF2D = new PointF2D();
-                end.X = staffLine.PositionAndShape.Size.Width;
-                end.Y = i * this.rules.StaffHeight / 4;
-                if (this.leadSheet)
-                    start.Y = end.Y = 0;
+                end.x = staffLine.PositionAndShape.Size.width;
+                end.y = i * this.rules.StaffHeight / 4;
+                if (this.leadSheet) {
+                    start.y = end.y = 0;
+                }
                 staffLine.StaffLines[i] = new GraphicalLine(start, end, this.rules.StaffLineWidth);
             }
         }
     }
+
     private initializeActiveInstructions(measureList: StaffMeasure[]): void {
         let firstSourceMeasure: SourceMeasure = this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();
         if (firstSourceMeasure !== undefined) {
@@ -267,42 +307,57 @@ export class MusicSystemBuilder {
                 let staffIndex: number = this.visibleStaffIndices[i];
                 let graphicalMeasure: StaffMeasure = this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(firstSourceMeasure, staffIndex);
                 this.activeClefs[i] = <ClefInstruction>firstSourceMeasure.FirstInstructionsStaffEntries[staffIndex].Instructions[0];
-                let keyInstruction: KeyInstruction = new KeyInstruction(<KeyInstruction>firstSourceMeasure.FirstInstructionsStaffEntries[staffIndex].Instructions[1]);
+                let keyInstruction: KeyInstruction = new KeyInstruction(
+                    <KeyInstruction>firstSourceMeasure.FirstInstructionsStaffEntries[staffIndex].Instructions[1]
+                );
                 keyInstruction = this.transposeKeyInstruction(keyInstruction, graphicalMeasure);
                 this.activeKeys[i] = keyInstruction;
                 this.activeRhythm[i] = <RhythmInstruction>firstSourceMeasure.FirstInstructionsStaffEntries[staffIndex].Instructions[2];
             }
         }
     }
+
     private transposeKeyInstruction(keyInstruction: KeyInstruction, graphicalMeasure: StaffMeasure): KeyInstruction {
-        if (this.graphicalMusicSheet.ParentMusicSheet.Transpose !== 0 && graphicalMeasure.ParentStaff.ParentInstrument.MidiInstrumentId !== Common.Enums.MidiInstrument.Percussion && MusicSheetCalculator.TransposeCalculator !== undefined)
-            MusicSheetCalculator.TransposeCalculator.TransposeKey(keyInstruction,
-                this.graphicalMusicSheet.ParentMusicSheet.Transpose);
+        if (this.graphicalMusicSheet.ParentMusicSheet.Transpose !== 0
+            && graphicalMeasure.ParentStaff.ParentInstrument.MidiInstrumentId !== MidiInstrument.Percussion
+            && MusicSheetCalculator.TransposeCalculator !== undefined
+        ) {
+            MusicSheetCalculator.TransposeCalculator.transposeKey(
+                keyInstruction,
+                this.graphicalMusicSheet.ParentMusicSheet.Transpose
+            );
+        }
         return keyInstruction;
     }
+
     private addBeginInstructions(measures: StaffMeasure[], isSystemFirstMeasure: boolean, isFirstSourceMeasure: boolean): number {
         let measureCount: number = measures.length;
-        if (measureCount === 0)
+        if (measureCount === 0) {
             return 0;
+        }
         let totalBeginInstructionLengthX: number = 0.0;
-        let sourceMeasure: SourceMeasure = measures[0].ParentSourceMeasure;
+        let sourceMeasure: SourceMeasure = measures[0].parentSourceMeasure;
         for (let idx: number = 0; idx < measureCount; ++idx) {
             let measure: StaffMeasure = measures[idx];
             let staffIndex: number = this.visibleStaffIndices[idx];
             let beginInstructionsStaffEntry: SourceStaffEntry = sourceMeasure.FirstInstructionsStaffEntries[staffIndex];
-            let beginInstructionLengthX: number = this.AddInstructionsAtMeasureBegin(beginInstructionsStaffEntry, measure,
+            let beginInstructionLengthX: number = this.AddInstructionsAtMeasureBegin(
+                beginInstructionsStaffEntry, measure,
                 idx, isFirstSourceMeasure,
-                isSystemFirstMeasure);
+                isSystemFirstMeasure
+            );
             totalBeginInstructionLengthX = Math.max(totalBeginInstructionLengthX, beginInstructionLengthX);
         }
         return totalBeginInstructionLengthX;
     }
+
     private addEndInstructions(measures: StaffMeasure[]): number {
         let measureCount: number = measures.length;
-        if (measureCount === 0)
+        if (measureCount === 0) {
             return 0;
+        }
         let totalEndInstructionLengthX: number = 0.5;
-        let sourceMeasure: SourceMeasure = measures[0].ParentSourceMeasure;
+        let sourceMeasure: SourceMeasure = measures[0].parentSourceMeasure;
         for (let idx: number = 0; idx < measureCount; idx++) {
             let measure: StaffMeasure = measures[idx];
             let staffIndex: number = this.visibleStaffIndices[idx];
@@ -312,8 +367,9 @@ export class MusicSystemBuilder {
         }
         return totalEndInstructionLengthX;
     }
+
     private AddInstructionsAtMeasureBegin(firstEntry: SourceStaffEntry, measure: StaffMeasure,
-        visibleStaffIdx: number, isFirstSourceMeasure: boolean, isSystemStartMeasure: boolean): number {
+                                          visibleStaffIdx: number, isFirstSourceMeasure: boolean, isSystemStartMeasure: boolean): number {
         let instructionsLengthX: number = 0;
         let currentClef: ClefInstruction = undefined;
         let currentKey: KeyInstruction = undefined;
@@ -361,15 +417,18 @@ export class MusicSystemBuilder {
             rhythmAdded = true;
         }
         if (clefAdded || keyAdded || rhythmAdded) {
-            instructionsLengthX += measure.BeginInstructionsWidth;
-            if (rhythmAdded)
+            instructionsLengthX += measure.beginInstructionsWidth;
+            if (rhythmAdded) {
                 instructionsLengthX += this.rules.RhythmRightMargin;
+            }
         }
         return instructionsLengthX;
     }
+
     private addInstructionsAtMeasureEnd(lastEntry: SourceStaffEntry, measure: StaffMeasure): number {
-        if (lastEntry === undefined || lastEntry.Instructions === undefined || lastEntry.Instructions.length === 0)
+        if (lastEntry === undefined || lastEntry.Instructions === undefined || lastEntry.Instructions.length === 0) {
             return 0;
+        }
         for (let idx: number = 0, len: number = lastEntry.Instructions.length; idx < len; ++idx) {
             let abstractNotationInstruction: AbstractNotationInstruction = lastEntry.Instructions[idx];
             if (abstractNotationInstruction instanceof ClefInstruction) {
@@ -377,8 +436,9 @@ export class MusicSystemBuilder {
                 measure.AddClefAtEnd(activeClef);
             }
         }
-        return this.rules.MeasureRightMargin + measure.EndInstructionsWidth;
+        return this.rules.MeasureRightMargin + measure.endInstructionsWidth;
     }
+
     private updateActiveClefs(measure: SourceMeasure, staffMeasures: StaffMeasure[]): void {
         for (let visStaffIdx: number = 0, len: number = staffMeasures.length; visStaffIdx < len; visStaffIdx++) {
             let staffIndex: number = this.visibleStaffIndices[visStaffIdx];
@@ -419,8 +479,9 @@ export class MusicSystemBuilder {
             }
         }
     }
+
     private checkAndCreateExtraInstructionMeasure(measures: StaffMeasure[]): void {
-        let firstStaffEntries: SourceStaffEntry[] = measures[0].ParentSourceMeasure.FirstInstructionsStaffEntries;
+        let firstStaffEntries: SourceStaffEntry[] = measures[0].parentSourceMeasure.FirstInstructionsStaffEntries;
         let visibleInstructionEntries: SourceStaffEntry[] = [];
         for (let idx: number = 0, len: number = measures.length; idx < len; ++idx) {
             let measure: StaffMeasure = measures[idx];
@@ -429,17 +490,20 @@ export class MusicSystemBuilder {
         let maxMeasureWidth: number = 0;
         for (let visStaffIdx: number = 0, len: number = visibleInstructionEntries.length; visStaffIdx < len; ++visStaffIdx) {
             let sse: SourceStaffEntry = visibleInstructionEntries[visStaffIdx];
-            if (sse === undefined)
+            if (sse === undefined) {
                 continue;
+            }
             let instructions: AbstractNotationInstruction[] = sse.Instructions;
             let keyInstruction: KeyInstruction = undefined;
             let rhythmInstruction: RhythmInstruction = undefined;
             for (let idx2: number = 0, len2: number = instructions.length; idx2 < len2; ++idx2) {
                 let instruction: AbstractNotationInstruction = instructions[idx2];
-                if (instruction instanceof KeyInstruction && (<KeyInstruction>instruction).Key !== this.activeKeys[visStaffIdx].Key)
+                if (instruction instanceof KeyInstruction && (<KeyInstruction>instruction).Key !== this.activeKeys[visStaffIdx].Key) {
                     keyInstruction = <KeyInstruction>instruction;
-                if (instruction instanceof RhythmInstruction && (<RhythmInstruction>instruction) !== this.activeRhythm[visStaffIdx])
+                }
+                if (instruction instanceof RhythmInstruction && (<RhythmInstruction>instruction) !== this.activeRhythm[visStaffIdx]) {
                     rhythmInstruction = <RhythmInstruction>instruction;
+                }
             }
             if (keyInstruction !== undefined || rhythmInstruction !== undefined) {
                 let measureWidth: number = this.addExtraInstructionMeasure(visStaffIdx, keyInstruction, rhythmInstruction);
@@ -447,11 +511,15 @@ export class MusicSystemBuilder {
             }
         }
         if (maxMeasureWidth > 0) {
-            this.currentSystemParams.systemMeasures.push(__init(new MeasureBuildParameters(), { beginLine: SystemLinesEnum.None, endLine: SystemLinesEnum.None }));
+            this.currentSystemParams.systemMeasures.push({
+                beginLine: SystemLinesEnum.None,
+                endLine: SystemLinesEnum.None,
+            });
             this.currentSystemParams.currentWidth += maxMeasureWidth;
             this.currentSystemParams.currentSystemFixWidth += maxMeasureWidth;
         }
     }
+
     private addExtraInstructionMeasure(visStaffIdx: number, keyInstruction: KeyInstruction, rhythmInstruction: RhythmInstruction): number {
         let currentSystem: MusicSystem = this.currentSystemParams.currentSystem;
         let measures: StaffMeasure[] = [];
@@ -466,18 +534,20 @@ export class MusicSystemBuilder {
         measure.PositionAndShape.BorderLeft = 0.0;
         measure.PositionAndShape.BorderTop = 0.0;
         measure.PositionAndShape.BorderBottom = this.rules.StaffHeight;
-        let width: number = this.rules.MeasureLeftMargin + measure.BeginInstructionsWidth + this.rules.MeasureRightMargin;
+        let width: number = this.rules.MeasureLeftMargin + measure.beginInstructionsWidth + this.rules.MeasureRightMargin;
         measure.PositionAndShape.BorderRight = width;
         currentSystem.StaffLines[visStaffIdx].Measures.push(measure);
         measure.ParentStaffLine = currentSystem.StaffLines[visStaffIdx];
         currentSystem.StaffLines[visStaffIdx].PositionAndShape.ChildElements.push(measure.PositionAndShape);
         return width;
     }
+
     private addStaveMeasuresToSystem(staffMeasures: StaffMeasure[]): void {
         if (staffMeasures[0] !== undefined) {
             let gmeasures: StaffMeasure[] = [];
-            for (let i: number = 0; i < staffMeasures.length; i++)
+            for (let i: number = 0; i < staffMeasures.length; i++) {
                 gmeasures.push(staffMeasures[i]);
+            }
             let currentSystem: MusicSystem = this.currentSystemParams.currentSystem;
             for (let visStaffIdx: number = 0; visStaffIdx < this.numberOfVisibleStaffLines; visStaffIdx++) {
                 let measure: StaffMeasure = gmeasures[visStaffIdx];
@@ -488,6 +558,7 @@ export class MusicSystemBuilder {
             currentSystem.AddStaffMeasures(gmeasures);
         }
     }
+
     private getMeasureStartLine(): SystemLinesEnum {
         let thisMeasureBeginsLineRep: boolean = this.thisMeasureBeginsLineRepetition();
         if (thisMeasureBeginsLineRep) {
@@ -496,11 +567,13 @@ export class MusicSystemBuilder {
             if (this.previousMeasureEndsLineRepetition() && !isSystemStartMeasure) {
                 return SystemLinesEnum.DotsBoldBoldDots;
             }
-            if (!isGlobalFirstMeasure)
+            if (!isGlobalFirstMeasure) {
                 return SystemLinesEnum.BoldThinDots;
+            }
         }
         return SystemLinesEnum.None;
     }
+
     private getMeasureEndLine(): SystemLinesEnum {
         if (this.nextMeasureBeginsLineRepetition() && this.thisMeasureEndsLineRepetition()) {
             return SystemLinesEnum.DotsBoldBoldDots;
@@ -508,7 +581,7 @@ export class MusicSystemBuilder {
         if (this.thisMeasureEndsLineRepetition()) {
             return SystemLinesEnum.DotsThinBold;
         }
-        if (this.measureListIndex === this.measureList.length - 1 || this.measureList[this.measureListIndex][0].ParentSourceMeasure.EndsPiece) {
+        if (this.measureListIndex === this.measureList.length - 1 || this.measureList[this.measureListIndex][0].parentSourceMeasure.EndsPiece) {
             return SystemLinesEnum.ThinBold;
         }
         if (this.nextMeasureHasKeyInstructionChange() || this.thisMeasureEndsWordRepetition() || this.nextMeasureBeginsWordRepetition()) {
@@ -516,6 +589,7 @@ export class MusicSystemBuilder {
         }
         return SystemLinesEnum.SingleThin;
     }
+
     private getLineWidth(measure: StaffMeasure, systemLineEnum: SystemLinesEnum, isSystemStartMeasure: boolean): number {
         let width: number = measure.GetLineWidth(systemLineEnum);
         if (systemLineEnum === SystemLinesEnum.DotsBoldBoldDots) {
@@ -526,89 +600,113 @@ export class MusicSystemBuilder {
         }
         return width;
     }
+
     private previousMeasureEndsLineRepetition(): boolean {
-        if (this.measureListIndex === 0)
+        if (this.measureListIndex === 0) {
             return false;
+        }
         for (let idx: number = 0, len: number = this.measureList[this.measureListIndex - 1].length; idx < len; ++idx) {
             let measure: StaffMeasure = this.measureList[this.measureListIndex - 1][idx];
-            if (measure.endsWithLineRepetition())
+            if (measure.endsWithLineRepetition()) {
                 return true;
+            }
         }
         return false;
     }
+
     private thisMeasureBeginsLineRepetition(): boolean {
         for (let idx: number = 0, len: number = this.measureList[this.measureListIndex].length; idx < len; ++idx) {
             let measure: StaffMeasure = this.measureList[this.measureListIndex][idx];
-            if (measure.beginsWithLineRepetition())
+            if (measure.beginsWithLineRepetition()) {
                 return true;
+            }
         }
         return false;
     }
+
     private nextMeasureBeginsLineRepetition(): boolean {
         let nextMeasureIndex: number = this.measureListIndex + 1;
-        if (nextMeasureIndex >= this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length)
+        if (nextMeasureIndex >= this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length) {
             return false;
+        }
         for (let idx: number = 0, len: number = this.measureList[nextMeasureIndex].length; idx < len; ++idx) {
             let measure: StaffMeasure = this.measureList[nextMeasureIndex][idx];
-            if (measure.beginsWithLineRepetition())
+            if (measure.beginsWithLineRepetition()) {
                 return true;
+            }
         }
         return false;
     }
+
     private thisMeasureEndsLineRepetition(): boolean {
         for (let idx: number = 0, len: number = this.measureList[this.measureListIndex].length; idx < len; ++idx) {
             let measure: StaffMeasure = this.measureList[this.measureListIndex][idx];
-            if (measure.endsWithLineRepetition())
+            if (measure.endsWithLineRepetition()) {
                 return true;
+            }
         }
         return false;
     }
+
     private nextMeasureBeginsWordRepetition(): boolean {
         let nextMeasureIndex: number = this.measureListIndex + 1;
-        if (nextMeasureIndex >= this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length)
+        if (nextMeasureIndex >= this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length) {
             return false;
+        }
         for (let idx: number = 0, len: number = this.measureList[nextMeasureIndex].length; idx < len; ++idx) {
             let measure: StaffMeasure = this.measureList[nextMeasureIndex][idx];
-            if (measure.beginsWithWordRepetition())
+            if (measure.beginsWithWordRepetition()) {
                 return true;
+            }
         }
         return false;
     }
+
     private thisMeasureEndsWordRepetition(): boolean {
         for (let idx: number = 0, len: number = this.measureList[this.measureListIndex].length; idx < len; ++idx) {
             let measure: StaffMeasure = this.measureList[this.measureListIndex][idx];
-            if (measure.endsWithWordRepetition())
+            if (measure.endsWithWordRepetition()) {
                 return true;
+            }
         }
         return false;
     }
+
     private nextMeasureHasKeyInstructionChange(): boolean {
         return this.getNextMeasureKeyInstruction() !== undefined;
     }
+
     private getNextMeasureKeyInstruction(): KeyInstruction {
         if (this.measureListIndex < this.measureList.length - 1) {
             for (let visIndex: number = 0; visIndex < this.measureList[this.measureListIndex].length; visIndex++) {
-                let sourceMeasure: SourceMeasure = this.measureList[this.measureListIndex + 1][visIndex].ParentSourceMeasure;
-                if (sourceMeasure === undefined)
+                let sourceMeasure: SourceMeasure = this.measureList[this.measureListIndex + 1][visIndex].parentSourceMeasure;
+                if (sourceMeasure === undefined) {
                     return undefined;
+                }
                 return sourceMeasure.getKeyInstruction(this.visibleStaffIndices[visIndex]);
             }
         }
         return undefined;
     }
+
     private calculateXScalingFactor(systemFixWidth: number, systemVarWidth: number): number {
-        if (Math.abs(systemVarWidth - 0) < 0.00001 || Math.abs(systemFixWidth - 0) < 0.00001)
-        return 1.0;
+        if (Math.abs(systemVarWidth - 0) < 0.00001 || Math.abs(systemFixWidth - 0) < 0.00001) {
+            return 1.0;
+        }
         let systemEndX: number;
         let currentSystem: MusicSystem = this.currentSystemParams.currentSystem;
-        systemEndX = currentSystem.StaffLines[0].PositionAndShape.Size.Width;
+        systemEndX = currentSystem.StaffLines[0].PositionAndShape.Size.width;
         let scalingFactor: number = (systemEndX - systemFixWidth) / systemVarWidth;
         return scalingFactor;
     }
+
     private stretchMusicSystem(isPartEndingSystem: boolean): void {
-        let scalingFactor: number = this.calculateXScalingFactor(this.currentSystemParams.currentSystemFixWidth, this.currentSystemParams.currentSystemVarWidth);
-        if (isPartEndingSystem)
+        let scalingFactor: number = this.calculateXScalingFactor(
+            this.currentSystemParams.currentSystemFixWidth, this.currentSystemParams.currentSystemVarWidth
+        );
+        if (isPartEndingSystem) {
             scalingFactor = Math.min(scalingFactor, this.rules.LastSystemMaxScalingFactor);
+        }
         let currentSystem: MusicSystem = this.currentSystemParams.currentSystem;
         for (let visStaffIdx: number = 0, len: number = currentSystem.StaffLines.length; visStaffIdx < len; ++visStaffIdx) {
             let staffLine: StaffLine = currentSystem.StaffLines[visStaffIdx];
@@ -616,54 +714,58 @@ export class MusicSystemBuilder {
             for (let i: number = 0; i < staffLine.Measures.length; i++) {
                 let measure: StaffMeasure = staffLine.Measures[i];
                 measure.SetPositionInStaffline(currentXPosition);
-                measure.SetWidth(measure.BeginInstructionsWidth + measure.MinimumStaffEntriesWidth * scalingFactor + measure.EndInstructionsWidth);
+                measure.SetWidth(measure.beginInstructionsWidth + measure.minimumStaffEntriesWidth * scalingFactor + measure.endInstructionsWidth);
                 if (i < this.currentSystemParams.systemMeasures.length) {
                     let startLine: SystemLinesEnum = this.currentSystemParams.systemMeasures[i].beginLine;
                     let lineWidth: number = measure.GetLineWidth(SystemLinesEnum.BoldThinDots);
                     switch (startLine) {
                         case SystemLinesEnum.BoldThinDots:
-                            {
-                                let xPosition: number = currentXPosition;
-                                if (i === 0) {
-                                    xPosition = currentXPosition + measure.BeginInstructionsWidth - lineWidth;
-                                }
-                                currentSystem.createVerticalLineForMeasure(xPosition, SystemLinesEnum.BoldThinDots, lineWidth, visStaffIdx);
-                                break;
+                            let xPosition: number = currentXPosition;
+                            if (i === 0) {
+                                xPosition = currentXPosition + measure.beginInstructionsWidth - lineWidth;
                             }
+                            currentSystem.createVerticalLineForMeasure(xPosition, SystemLinesEnum.BoldThinDots, lineWidth, visStaffIdx);
+                            break;
+                        default:
                     }
                 }
-                measure.StaffEntriesScaleFactor = scalingFactor;
+                measure.staffEntriesScaleFactor = scalingFactor;
                 measure.LayoutSymbols();
-                let nextMeasureHasRepStartLine: boolean = i + 1 < this.currentSystemParams.systemMeasures.length && this.currentSystemParams.systemMeasures[i + 1].beginLine === SystemLinesEnum.BoldThinDots;
+                let nextMeasureHasRepStartLine: boolean = i + 1 < this.currentSystemParams.systemMeasures.length
+                    && this.currentSystemParams.systemMeasures[i + 1].beginLine === SystemLinesEnum.BoldThinDots;
                 if (!nextMeasureHasRepStartLine) {
                     let endLine: SystemLinesEnum = SystemLinesEnum.SingleThin;
                     if (i < this.currentSystemParams.systemMeasures.length) {
                         endLine = this.currentSystemParams.systemMeasures[i].endLine;
                     }
                     let lineWidth: number = measure.GetLineWidth(endLine);
-                    let xPos: number = measure.PositionAndShape.RelativePosition.X + measure.PositionAndShape.BorderRight - lineWidth;
-                    if (endLine === SystemLinesEnum.DotsBoldBoldDots)
+                    let xPos: number = measure.PositionAndShape.RelativePosition.x + measure.PositionAndShape.BorderRight - lineWidth;
+                    if (endLine === SystemLinesEnum.DotsBoldBoldDots) {
                         xPos -= lineWidth / 2;
+                    }
                     currentSystem.createVerticalLineForMeasure(xPos, endLine, lineWidth, visStaffIdx);
                 }
-                currentXPosition = measure.PositionAndShape.RelativePosition.X + measure.PositionAndShape.BorderRight;
+                currentXPosition = measure.PositionAndShape.RelativePosition.x + measure.PositionAndShape.BorderRight;
             }
         }
-        if (isPartEndingSystem)
+        if (isPartEndingSystem) {
             this.decreaseMusicSystemBorders();
+        }
     }
+
     private decreaseMusicSystemBorders(): void {
         let currentSystem: MusicSystem = this.currentSystemParams.currentSystem;
-        let width: number = currentSystem.StaffLines[0].Measures.Last().PositionAndShape.RelativePosition.X + currentSystem.StaffLines[0].Measures.Last().PositionAndShape.Size.Width;
+        let width: number = currentSystem.StaffLines[0].Measures.Last().PositionAndShape.RelativePosition.x
+            + currentSystem.StaffLines[0].Measures.Last().PositionAndShape.Size.width;
         for (let idx: number = 0, len: number = currentSystem.StaffLines.length; idx < len; ++idx) {
             let staffLine: StaffLine = currentSystem.StaffLines[idx];
             staffLine.PositionAndShape.BorderRight = width;
             for (let idx2: number = 0, len2: number = staffLine.StaffLines.length; idx2 < len2; ++idx2) {
                 let graphicalLine: GraphicalLine = staffLine.StaffLines[idx2];
-                graphicalLine.End = new PointF2D(width, graphicalLine.End.Y);
+                graphicalLine.End = new PointF2D(width, graphicalLine.End.y);
             }
         }
-        currentSystem.PositionAndShape.BorderRight = width + this.currentSystemParams.MaxLabelLength + this.rules.SystemLabelsRightMargin;
+        currentSystem.PositionAndShape.BorderRight = width + this.currentSystemParams.maxLabelLength + this.rules.SystemLabelsRightMargin;
     }
 }
 export class SystemBuildParameters {
@@ -673,7 +775,8 @@ export class SystemBuildParameters {
     public currentWidth: number = 0;
     public currentSystemFixWidth: number = 0;
     public currentSystemVarWidth: number = 0;
-    public MaxLabelLength: number = 0;
+    public maxLabelLength: number = 0;
+
     public IsSystemStartMeasure(): boolean {
         return this.systemMeasureIndex === 0;
     }

+ 8 - 7
src/MusicalScore/Graphical/OctaveShiftParams.ts

@@ -1,12 +1,13 @@
 import {Fraction} from "../../Common/DataObjects/fraction";
 import {OctaveShift} from "../VoiceData/Expressions/ContinuousExpressions/octaveShift";
+
 export class OctaveShiftParams {
     constructor(openOctaveShift: OctaveShift, absoluteStartTimestamp: Fraction, absoluteEndTimestamp: Fraction) {
-        this.GetOpenOctaveShift = openOctaveShift;
-        this.GetAbsoluteStartTimestamp = absoluteStartTimestamp;
-        this.GetAbsoluteEndTimestamp = absoluteEndTimestamp;
+        this.getOpenOctaveShift = openOctaveShift;
+        this.getAbsoluteStartTimestamp = absoluteStartTimestamp;
+        this.getAbsoluteEndTimestamp = absoluteEndTimestamp;
     }
-    public GetOpenOctaveShift: OctaveShift;
-    public GetAbsoluteStartTimestamp: Fraction;
-    public GetAbsoluteEndTimestamp: Fraction;
-}
+    public getOpenOctaveShift: OctaveShift;
+    public getAbsoluteStartTimestamp: Fraction;
+    public getAbsoluteEndTimestamp: Fraction;
+}

+ 26 - 6
src/MusicalScore/Graphical/StaffLine.ts

@@ -6,6 +6,7 @@ import {GraphicalStaffEntry} from "./GraphicalStaffEntry";
 import {GraphicalObject} from "./GraphicalObject";
 import {StaffMeasure} from "./StaffMeasure";
 import {MusicSystem} from "./MusicSystem";
+
 export class StaffLine extends GraphicalObject {
     protected measures: StaffMeasure[] = [];
     protected staffLines: GraphicalLine[] = new Array(5);
@@ -13,63 +14,82 @@ export class StaffLine extends GraphicalObject {
     protected parentStaff: Staff;
     protected skyLine: number[];
     protected bottomLine: number[];
+
     constructor(parentSystem: MusicSystem, parentStaff: Staff) {
         this.parentMusicSystem = parentSystem;
         this.parentStaff = parentStaff;
         this.boundingBox = new BoundingBox(parentSystem.PositionAndShape, this);
     }
+
     public get Measures(): StaffMeasure[] {
         return this.measures;
     }
+
     public set Measures(value: StaffMeasure[]) {
         this.measures = value;
     }
+
     public get StaffLines(): GraphicalLine[] {
         return this.staffLines;
     }
+
     public set StaffLines(value: GraphicalLine[]) {
         this.staffLines = value;
     }
+
     public get ParentMusicSystem(): MusicSystem {
         return this.parentMusicSystem;
     }
+
     public set ParentMusicSystem(value: MusicSystem) {
         this.parentMusicSystem = value;
     }
+
     public get ParentStaff(): Staff {
         return this.parentStaff;
     }
+
     public set ParentStaff(value: Staff) {
         this.parentStaff = value;
     }
+
     public get SkyLine(): number[] {
         return this.skyLine;
     }
+
     public set SkyLine(value: number[]) {
         this.skyLine = value;
     }
+
     public get BottomLine(): number[] {
         return this.bottomLine;
     }
+
     public set BottomLine(value: number[]) {
         this.bottomLine = value;
     }
+
     public isPartOfMultiStaffInstrument(): boolean {
         let instrument: Instrument = this.parentStaff.ParentInstrument;
-        if (instrument.Staves.length > 1)
+        if (instrument.Staves.length > 1) {
             return true;
+        }
         return false;
     }
+
     public findClosestStaffEntry(xPosition: number): GraphicalStaffEntry {
         let closestStaffentry: GraphicalStaffEntry = undefined;
         let difference: number = Number.MAX_VALUE;
         for (let idx: number = 0, len: number = this.Measures.length; idx < len; ++idx) {
             let graphicalMeasure: StaffMeasure = this.Measures[idx];
-            for (let idx2: number = 0, len2: number = graphicalMeasure.StaffEntries.length; idx2 < len2; ++idx2) {
-                let graphicalStaffEntry: GraphicalStaffEntry = graphicalMeasure.StaffEntries[idx2];
-                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);
+            for (let idx2: number = 0, len2: number = graphicalMeasure.staffEntries.length; idx2 < len2; ++idx2) {
+                let graphicalStaffEntry: GraphicalStaffEntry = graphicalMeasure.staffEntries[idx2];
+                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;
                 }
             }

+ 149 - 80
src/MusicalScore/Graphical/StaffMeasure.ts

@@ -1,4 +1,4 @@
-import {MusicSystem} from "./MusicSystem";
+import {MusicSystem} from "./MusicSystem";
 import {GraphicalStaffEntry} from "./GraphicalStaffEntry";
 import {SourceMeasure} from "../VoiceData/SourceMeasure";
 import {StaffLine} from "./StaffLine";
@@ -13,181 +13,250 @@ import {VoiceEntry} from "../VoiceData/VoiceEntry";
 import {GraphicalNote} from "./GraphicalNote";
 import {SystemLinesEnum} from "./SystemLinesEnum";
 import {BoundingBox} from "./BoundingBox";
+
 export class StaffMeasure extends GraphicalObject {
     protected firstInstructionStaffEntry: GraphicalStaffEntry;
     protected lastInstructionStaffEntry: GraphicalStaffEntry;
-    private staff: Staff;
-    private measureNumber: number = -1;
-    private parentStaffLine: StaffLine;
-    constructor(staff: Staff = undefined, staffLine: StaffLine = undefined, parentSourceMeasure: SourceMeasure = undefined) {
-        this.staff = staff;
-        this.ParentSourceMeasure = parentSourceMeasure;
+
+    constructor(staff: Staff = undefined, parentSourceMeasure: SourceMeasure = undefined, staffLine: StaffLine = undefined) {
+        this.parentStaff = staff;
+        this.parentSourceMeasure = parentSourceMeasure;
         this.parentStaffLine = staffLine;
-        if (staffLine !== undefined)
-            this.staff = staffLine.ParentStaff;
-        if (this.ParentSourceMeasure !== undefined)
-            this.measureNumber = this.ParentSourceMeasure.MeasureNumber;
-        this.StaffEntries = [];
-        if (staffLine !== undefined)
+        if (staffLine !== undefined) {
+            this.parentStaff = staffLine.ParentStaff;
             this.PositionAndShape = new BoundingBox(staffLine.PositionAndShape, this);
-        else this.PositionAndShape = new BoundingBox(this);
-    }
-    public ParentSourceMeasure: SourceMeasure;
-    public StaffEntries: GraphicalStaffEntry[];
-    public ParentMusicSystem: MusicSystem;
-    public BeginInstructionsWidth: number;
-    public MinimumStaffEntriesWidth: number;
-    public StaffEntriesScaleFactor: number;
-    public EndInstructionsWidth: number;
+        } else {
+            this.PositionAndShape = new BoundingBox(this);
+        }
+        this.PositionAndShape.BorderBottom = 4;
+        if (this.parentSourceMeasure !== undefined) {
+            this.measureNumber = this.parentSourceMeasure.MeasureNumber;
+        }
+
+        this.staffEntries = [];
+    }
+
+    public parentSourceMeasure: SourceMeasure;
+    public staffEntries: GraphicalStaffEntry[];
+    public parentMusicSystem: MusicSystem;
+    public beginInstructionsWidth: number;
+    public minimumStaffEntriesWidth: number;
+    public staffEntriesScaleFactor: number;
+    public endInstructionsWidth: number;
     public hasError: boolean;
+
+    private parentStaff: Staff;
+    private measureNumber: number = -1;
+    private parentStaffLine: StaffLine;
+
     public get ParentStaff(): Staff {
-        return this.staff;
+        return this.parentStaff;
     }
+
     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 !== undefined)
+        if (this.parentStaffLine !== undefined) {
             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 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 SetWidth(width: number): void {
+        throw new Error("not implemented");
+    }
+
+    public LayoutSymbols(): void {
+        throw new Error("not implemented");
+    }
+
     public findGraphicalStaffEntryFromTimestamp(relativeTimestamp: Fraction): GraphicalStaffEntry {
-        for (let idx: number = 0, len: number = this.StaffEntries.length; idx < len; ++idx) {
-            let graphicalStaffEntry: GraphicalStaffEntry = this.StaffEntries[idx];
-            if (graphicalStaffEntry.RelInMeasureTimestamp === relativeTimestamp)
+        for (let idx: number = 0, len: number = this.staffEntries.length; idx < len; ++idx) {
+            let graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx];
+            if (graphicalStaffEntry.relInMeasureTimestamp === relativeTimestamp) {
                 return graphicalStaffEntry;
+            }
         }
         return undefined;
     }
+
     public findGraphicalStaffEntryFromVerticalContainerTimestamp(absoluteTimestamp: Fraction): GraphicalStaffEntry {
-        for (let idx: number = 0, len: number = this.StaffEntries.length; idx < len; ++idx) {
-            let graphicalStaffEntry: GraphicalStaffEntry = this.StaffEntries[idx];
-            if (graphicalStaffEntry.SourceStaffEntry.VerticalContainerParent.getAbsoluteTimestamp() === absoluteTimestamp)
+        for (let idx: number = 0, len: number = this.staffEntries.length; idx < len; ++idx) {
+            let graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx];
+            if (graphicalStaffEntry.sourceStaffEntry.VerticalContainerParent.getAbsoluteTimestamp() === absoluteTimestamp) {
                 return graphicalStaffEntry;
+            }
         }
         return undefined;
     }
+
     public hasSameDurationWithSourceMeasureParent(): boolean {
         let duration: Fraction = new Fraction(0, 1);
-        for (let idx: number = 0, len: number = this.StaffEntries.length; idx < len; ++idx) {
-            let graphicalStaffEntry: GraphicalStaffEntry = this.StaffEntries[idx];
-            duration.push(graphicalStaffEntry.findStaffEntryMinNoteLength());
+        for (let idx: number = 0, len: number = this.staffEntries.length; idx < len; ++idx) {
+            let graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx];
+            duration.Add(graphicalStaffEntry.findStaffEntryMinNoteLength());
         }
-        return duration === this.ParentSourceMeasure.Duration;
+        return duration === this.parentSourceMeasure.Duration;
     }
+
     public hasMultipleVoices(): boolean {
-        if (this.StaffEntries.length === 0)
+        if (this.staffEntries.length === 0) {
             return false;
+        }
         let voices: Voice[] = [];
-        for (let idx: number = 0, len: number = this.StaffEntries.length; idx < len; ++idx) {
-            let staffEntry: GraphicalStaffEntry = this.StaffEntries[idx];
-            for (let idx2: number = 0, len2: number = staffEntry.SourceStaffEntry.VoiceEntries.length; idx2 < len2; ++idx2) {
-                let voiceEntry: VoiceEntry = staffEntry.SourceStaffEntry.VoiceEntries[idx2];
-                if (voices.indexOf(voiceEntry.ParentVoice) < 0)
+        for (let idx: number = 0, len: number = this.staffEntries.length; idx < len; ++idx) {
+            let staffEntry: GraphicalStaffEntry = this.staffEntries[idx];
+            for (let idx2: number = 0, len2: number = staffEntry.sourceStaffEntry.VoiceEntries.length; idx2 < len2; ++idx2) {
+                let voiceEntry: VoiceEntry = staffEntry.sourceStaffEntry.VoiceEntries[idx2];
+                if (voices.indexOf(voiceEntry.ParentVoice) < 0) {
                     voices.push(voiceEntry.ParentVoice);
+                }
             }
         }
-        if (voices.length > 1)
+        if (voices.length > 1) {
             return true;
+        }
         return false;
     }
+
     public isVisible(): boolean {
         return this.ParentStaff.ParentInstrument.Visible;
     }
+
     public getGraphicalMeasureDurationFromStaffEntries(): Fraction {
         let duration: Fraction = new Fraction(0, 1);
         let voices: Voice[] = [];
-        for (let idx: number = 0, len: number = this.StaffEntries.length; idx < len; ++idx) {
-            let graphicalStaffEntry: GraphicalStaffEntry = this.StaffEntries[idx];
-            for (let idx2: number = 0, len2: number = graphicalStaffEntry.SourceStaffEntry.VoiceEntries.length; idx2 < len2; ++idx2) {
-                let voiceEntry: VoiceEntry = graphicalStaffEntry.SourceStaffEntry.VoiceEntries[idx2];
-                if (voices.indexOf(voiceEntry.ParentVoice) < 0)
+        for (let idx: number = 0, len: number = this.staffEntries.length; idx < len; ++idx) {
+            let graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx];
+            for (let idx2: number = 0, len2: number = graphicalStaffEntry.sourceStaffEntry.VoiceEntries.length; idx2 < len2; ++idx2) {
+                let voiceEntry: VoiceEntry = graphicalStaffEntry.sourceStaffEntry.VoiceEntries[idx2];
+                if (voices.indexOf(voiceEntry.ParentVoice) < 0) {
                     voices.push(voiceEntry.ParentVoice);
+                }
             }
         }
         for (let idx: number = 0, len: number = voices.length; idx < len; ++idx) {
             let voice: Voice = voices[idx];
             let voiceDuration: Fraction = new Fraction(0, 1);
-            for (let idx2: number = 0, len2: number = this.StaffEntries.length; idx2 < len2; ++idx2) {
-                let graphicalStaffEntry: GraphicalStaffEntry = this.StaffEntries[idx2];
-                for (let idx3: number = 0, len3: number = graphicalStaffEntry.Notes.length; idx3 < len3; ++idx3) {
-                    let graphicalNotes: GraphicalNote[] = graphicalStaffEntry.Notes[idx3];
-                    if (graphicalNotes.length > 0 && graphicalNotes[0].SourceNote.ParentVoiceEntry.ParentVoice === voice)
-                        voiceDuration.push(graphicalNotes[0].GraphicalNoteLength);
+            for (let idx2: number = 0, len2: number = this.staffEntries.length; idx2 < len2; ++idx2) {
+                let graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx2];
+                for (let idx3: number = 0, len3: number = graphicalStaffEntry.notes.length; idx3 < len3; ++idx3) {
+                    let graphicalNotes: GraphicalNote[] = graphicalStaffEntry.notes[idx3];
+                    if (graphicalNotes.length > 0 && graphicalNotes[0].sourceNote.ParentVoiceEntry.ParentVoice === voice) {
+                        voiceDuration.Add(graphicalNotes[0].graphicalNoteLength);
+                    }
                 }
             }
-            if (voiceDuration > duration)
+            if (voiceDuration > duration) {
                 duration = Fraction.createFromFraction(voiceDuration);
+            }
         }
         return duration;
     }
+
     public addGraphicalStaffEntry(graphicalStaffEntry: GraphicalStaffEntry): void {
-        this.StaffEntries.push(graphicalStaffEntry);
+        this.staffEntries.push(graphicalStaffEntry);
         this.PositionAndShape.ChildElements.push(graphicalStaffEntry.PositionAndShape);
     }
+
     public addGraphicalStaffEntryAtTimestamp(staffEntry: GraphicalStaffEntry): void {
         if (staffEntry !== undefined) {
-            if (this.StaffEntries.length === 0 || this.StaffEntries[this.StaffEntries.length - 1].RelInMeasureTimestamp < staffEntry.RelInMeasureTimestamp)
-                this.StaffEntries.push(staffEntry);
-            else {
-                for (let i: number = this.StaffEntries.length - 1; i >= 0; i--) {
-                    if (this.StaffEntries[i].RelInMeasureTimestamp < staffEntry.RelInMeasureTimestamp) {
-                        this.StaffEntries.splice(i + 1, 0, staffEntry);
+            if (this.staffEntries.length === 0 || this.staffEntries[this.staffEntries.length - 1].relInMeasureTimestamp < staffEntry.relInMeasureTimestamp) {
+                this.staffEntries.push(staffEntry);
+            } else {
+                for (let i: number = this.staffEntries.length - 1; i >= 0; i--) {
+                    if (this.staffEntries[i].relInMeasureTimestamp < staffEntry.relInMeasureTimestamp) {
+                        this.staffEntries.splice(i + 1, 0, staffEntry);
                         break;
                     }
-                    if (i === 0)
-                        this.StaffEntries.splice(i, 0, staffEntry);
+                    if (i === 0) {
+                        this.staffEntries.splice(i, 0, staffEntry);
+                    }
                 }
             }
             this.PositionAndShape.ChildElements.push(staffEntry.PositionAndShape);
         }
     }
+
     public beginsWithLineRepetition(): boolean {
-        let sourceMeasure: SourceMeasure = this.ParentSourceMeasure;
-        if (sourceMeasure === undefined)
+        let sourceMeasure: SourceMeasure = this.parentSourceMeasure;
+        if (sourceMeasure === undefined) {
             return false;
+        }
         return sourceMeasure.beginsWithLineRepetition();
     }
+
     public endsWithLineRepetition(): boolean {
-        let sourceMeasure: SourceMeasure = this.ParentSourceMeasure;
-        if (sourceMeasure === undefined)
+        let sourceMeasure: SourceMeasure = this.parentSourceMeasure;
+        if (sourceMeasure === undefined) {
             return false;
+        }
         return sourceMeasure.endsWithLineRepetition();
     }
+
     public beginsWithWordRepetition(): boolean {
-        let sourceMeasure: SourceMeasure = this.ParentSourceMeasure;
-        if (sourceMeasure === undefined)
+        let sourceMeasure: SourceMeasure = this.parentSourceMeasure;
+        if (sourceMeasure === undefined) {
             return false;
+        }
         return sourceMeasure.beginsWithWordRepetition();
     }
+
     public endsWithWordRepetition(): boolean {
-        let sourceMeasure: SourceMeasure = this.ParentSourceMeasure;
-        if (sourceMeasure === undefined)
+        let sourceMeasure: SourceMeasure = this.parentSourceMeasure;
+        if (sourceMeasure === undefined) {
             return false;
+        }
         return sourceMeasure.endsWithWordRepetition();
     }
-}
+}

+ 1 - 7
src/MusicalScore/Graphical/SystemLinesEnum.ts

@@ -1,15 +1,9 @@
 export enum SystemLinesEnum {
     SingleThin = 0,
-
     DoubleThin = 1,
-
     ThinBold = 2,
-
     BoldThinDots = 3,
-
     DotsThinBold = 4,
-
     DotsBoldBoldDots = 5,
-
     None = 6
-}
+}

+ 21 - 12
src/MusicalScore/Graphical/VerticalGraphicalStaffEntryContainer.ts

@@ -1,47 +1,56 @@
 import {Fraction} from "../../Common/DataObjects/fraction";
 import {GraphicalStaffEntry} from "./GraphicalStaffEntry";
+
 export class VerticalGraphicalStaffEntryContainer {
-    private index: number;
-    private absoluteTimestamp: Fraction;
-    private staffEntries: GraphicalStaffEntry[] = [];
     constructor(numberOfEntries: number, absoluteTimestamp: Fraction) {
         this.absoluteTimestamp = absoluteTimestamp;
-        for (let i: number = 0; i < numberOfEntries; i++)
+        for (let i: number = 0; i < numberOfEntries; i++) {
             this.staffEntries.push(undefined);
+        }
     }
-    public RelativeInMeasureTimestamp: Fraction;
+
+    public relativeInMeasureTimestamp: Fraction;
+    private index: number;
+    private absoluteTimestamp: Fraction;
+    private staffEntries: GraphicalStaffEntry[] = [];
+
     public get Index(): number {
         return this.index;
     }
+
     public set Index(value: number) {
         this.index = value;
     }
+
     public get AbsoluteTimestamp(): Fraction {
         return this.absoluteTimestamp;
     }
+
     public set AbsoluteTimestamp(value: Fraction) {
         this.absoluteTimestamp = value;
     }
+
     public get StaffEntries(): GraphicalStaffEntry[] {
         return this.staffEntries;
     }
+
     public set StaffEntries(value: GraphicalStaffEntry[]) {
         this.staffEntries = value;
     }
+
     public getFirstNonNullStaffEntry(): GraphicalStaffEntry {
         for (let idx: number = 0, len: number = this.staffEntries.length; idx < len; ++idx) {
             let graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx];
-            if (graphicalStaffEntry !== undefined)
+            if (graphicalStaffEntry !== undefined) {
                 return graphicalStaffEntry;
+            }
         }
         return undefined;
     }
 }
-export module VerticalGraphicalStaffEntryContainer {
-    export class VgseContainerTimestampComparer implements IComparer<VerticalGraphicalStaffEntryContainer>
-    {
-        public Compare(x: VerticalGraphicalStaffEntryContainer, y: VerticalGraphicalStaffEntryContainer): number {
-            return Comparer.Default.Compare(x.AbsoluteTimestamp.RealValue, y.AbsoluteTimestamp.RealValue);
-        }
+
+export class VgseContainerTimestampComparer implements IComparer<VerticalGraphicalStaffEntryContainer> {
+    public Compare(x: VerticalGraphicalStaffEntryContainer, y: VerticalGraphicalStaffEntryContainer): number {
+        return Comparer.Default.Compare(x.AbsoluteTimestamp.RealValue, y.AbsoluteTimestamp.RealValue);
     }
 }

+ 2 - 2
src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts

@@ -18,7 +18,7 @@ export class VexFlowMeasure extends StaffMeasure {
      * This is needed to evaluate a measure a second time by system builder.
      */
     public resetLayout(): void {
-        this.BeginInstructionsWidth = 0;
+        this.beginInstructionsWidth = 0;
 
     }
 
@@ -38,7 +38,7 @@ export class VexFlowMeasure extends StaffMeasure {
      * @param clef
      */
     public addClefAtBegin(clef: ClefInstruction): void {
-        this.BeginInstructionsWidth += 20;
+        this.beginInstructionsWidth += 20;
     }
 
     /**

+ 18 - 1
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts

@@ -23,6 +23,7 @@ import {LyricWord} from "../../VoiceData/Lyrics/LyricsWord";
 import {OrnamentContainer} from "../../VoiceData/OrnamentContainer";
 import {ArticulationEnum} from "../../VoiceData/VoiceEntry";
 import {Tuplet} from "../../VoiceData/Tuplet";
+import {VexFlowMeasure} from "./VexFlowMeasure";
 export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
     constructor() {
         super(new VexFlowGraphicalSymbolFactory());
@@ -41,8 +42,24 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
         this.graphicalMusicSheet.MusicPages[0].PositionAndShape.BorderMarginBottom += 9;
         GraphicalMusicSheet.transformRelativeToAbsolutePosition(this.graphicalMusicSheet);
     }
+
+    /**
+     * Calculates the x layout of the staff entries within the staff measures belonging to one source measure.
+     * All staff entries are x-aligned throughout all vertically aligned staff measures.
+     * This method is called within calculateXLayout.
+     * The staff entries are aligned with minimum needed x distances.
+     * The MinimumStaffEntriesWidth of every measure will be set - needed for system building.
+     * @param measures
+     */
     protected calculateMeasureXLayout(measures: StaffMeasure[]): number {
-        throw new NotImplementedException();
+        // set measure length and Borders
+        for (let idx: number = 0, len: number = measures.length; idx < len; ++idx) {
+            let measure: VexFlowMeasure  = <VexFlowMeasure>measures[idx];
+            // set Measure StaffEntriesLength (needed later to calculate the whole Measure Width)
+            //measure.MinimumStaffEntriesWidth = measureLength;
+
+
+        }
     }
 
     /**