Kaynağa Gözat

Fixed errors in new files.
adapted replacement script.

Matthias 9 yıl önce
ebeveyn
işleme
d265f9f65d

+ 9 - 2
extras/macrogen.py

@@ -20,12 +20,13 @@ replace = (
     ("IEnumerable<([a-zA-Z0-9]+)>", "$1[]"),
 
     ("\\.Count", ".length"),
+    ("\\.Length", ".length"),
     ("\\.Add\(", ".push("),
     ("\\.First\(\)", "[0]"),
 
     ("\\.Insert\((.*), (.*)\)", ".splice($1, 0, $2)"),
     ("\\.RemoveAt\(([a-z|0-9]+)\)", ".splice($1, 1)"),
-    ("\\.Clear\(\);", " = [];"),
+    ("\\.Clear\(\);", ".length = 0;"),
     ("\\.IndexOf", ".indexOf"),
     ("\\.ToArray\\(\\)", ""),
 
@@ -71,7 +72,13 @@ def checkForIssues(filename, content):
 
 def applyAll():
     root = sys.argv[1]
-    filenames = []; recurse(root, filenames)
+    filenames = []
+
+    if os.path.isdir(root):
+        recurse(root, filenames)
+    else:
+        filenames.append(root)
+        
     print("Apply replacements to:")
     for filename in filenames:
         print("  >>> " + os.path.basename(filename))

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

@@ -26,7 +26,7 @@ export class GraphicalNote extends GraphicalObject {
     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);
+            transposedPitch = MusicSheetCalculator.TransposeCalculator.transposePitch(this.SourceNote.Pitch, keyInstruction, halfTones);
         return transposedPitch;
     }
 }

+ 9 - 6
src/MusicalScore/Graphical/MusicSystemBuilder.ts

@@ -16,6 +16,9 @@ import {GraphicalLine} from "./GraphicalLine";
 import {SourceStaffEntry} from "../VoiceData/SourceStaffEntry";
 import {AbstractNotationInstruction} from "../VoiceData/Instructions/AbstractNotationInstruction";
 import {SystemLinesEnum} from "./SystemLinesEnum";
+import {GraphicalMusicSheet} from "./GraphicalMusicSheet";
+import {IGraphicalSymbolFactory} from "../Interfaces/IGraphicalSymbolFactory";
+import {MusicSheetCalculator} from "./MusicSheetCalculator";
 export class MusicSystemBuilder {
     private measureList: StaffMeasure[][];
     private graphicalMusicSheet: GraphicalMusicSheet;
@@ -36,7 +39,7 @@ export class MusicSystemBuilder {
         numberOfStaffLines: number, symbolFactory: IGraphicalSymbolFactory): void {
         this.leadSheet = graphicalMusicSheet.LeadSheet;
         this.graphicalMusicSheet = graphicalMusicSheet;
-        this.rules = this.graphicalMusicSheet.ParentMusicSheet.Rules;
+        this.rules = this.graphicalMusicSheet.ParentMusicSheet.rules;
         this.measureList = measureList;
         this.symbolFactory = symbolFactory;
         this.currentMusicPage = this.createMusicPage();
@@ -45,7 +48,7 @@ export class MusicSystemBuilder {
         this.activeRhythm = new Array(this.numberOfVisibleStaffLines);
         this.activeKeys = new Array(this.numberOfVisibleStaffLines);
         this.activeClefs = new Array(this.numberOfVisibleStaffLines);
-        initializeActiveInstructions(this.measureList[0]);
+        this.initializeActiveInstructions(this.measureList[0]);
     }
     public buildMusicSystems(): void {
         let previousMeasureEndsSystem: boolean = false;
@@ -70,7 +73,7 @@ export class MusicSystemBuilder {
             let currentMeasureBeginInstructionsWidth: number = this.rules.MeasureLeftMargin;
             let currentMeasureEndInstructionsWidth: number = 0;
             let measureStartLine: SystemLinesEnum = this.getMeasureStartLine();
-            currentMeasureBeginInstructionsWidth += getLineWidth(staffMeasures[0], measureStartLine, isSystemStartMeasure);
+            currentMeasureBeginInstructionsWidth += this.getLineWidth(staffMeasures[0], measureStartLine, isSystemStartMeasure);
             if (!this.leadSheet) {
                 currentMeasureBeginInstructionsWidth += this.addBeginInstructions(staffMeasures, isSystemStartMeasure, isFirstSourceMeasure);
                 currentMeasureEndInstructionsWidth += this.addEndInstructions(staffMeasures);
@@ -79,7 +82,7 @@ export class MusicSystemBuilder {
             for (let i: number = 0; i < this.numberOfVisibleStaffLines; i++)
                 currentMeasureVarWidth = Math.max(currentMeasureVarWidth, staffMeasures[i].MinimumStaffEntriesWidth);
             let measureEndLine: SystemLinesEnum = this.getMeasureEndLine();
-            currentMeasureEndInstructionsWidth += getLineWidth(staffMeasures[0], measureEndLine, isSystemStartMeasure);
+            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];
@@ -99,7 +102,7 @@ export class MusicSystemBuilder {
             }
             previousMeasureEndsSystem = sourceMeasureEndsSystem;
         }
-        finalizeCurrentAndCreateNewSystem(this.measureList[this.measureList.length - 1], true);
+        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) {
@@ -655,7 +658,7 @@ export class MusicSystemBuilder {
         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) {
+            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);
             }

+ 9 - 7
src/MusicalScore/Graphical/StaffMeasure.ts

@@ -12,23 +12,25 @@ import {Voice} from "../VoiceData/Voice";
 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, parentSourceMeasure: SourceMeasure) {
+    constructor(staff: Staff = null, staffLine: StaffLine = null, parentSourceMeasure: SourceMeasure = null) {
         this.staff = staff;
         this.ParentSourceMeasure = parentSourceMeasure;
-        this.StaffEntries = [];
-        if (this.ParentSourceMeasure !== undefined)
-            this.measureNumber = this.ParentSourceMeasure.MeasureNumber;
-    }
-    constructor(staffLine: StaffLine) {
         this.parentStaffLine = staffLine;
-        this.staff = staffLine.ParentStaff;
+        if (staffLine != null)
+            this.staff = staffLine.ParentStaff;
+        if (this.ParentSourceMeasure != null)
+            this.measureNumber = this.ParentSourceMeasure.MeasureNumber;
         this.StaffEntries = [];
+        if (staffLine != null)
+            this.PositionAndShape = new BoundingBox(staffLine.PositionAndShape, this);
+        else this.PositionAndShape = new BoundingBox(this);
     }
     public ParentSourceMeasure: SourceMeasure;
     public StaffEntries: GraphicalStaffEntry[];

+ 122 - 3
src/MusicalScore/Graphical/VexFlow/VexFlowGraphicalSymbolFactory.ts

@@ -1,42 +1,161 @@
-export class VexFlowGraphicalSymbolFactory implements IGraphicalSymbolFactory {
+import {IGraphicalSymbolFactory} from "../../Interfaces/IGraphicalSymbolFactory";
+import {GraphicalMusicPage} from "../GraphicalMusicPage";
+import {MusicSystem} from "../MusicSystem";
+import {VexFlowMusicSystem} from "./VexFlowMusicSystem";
+import {Staff} from "../../VoiceData/Staff";
+import {StaffLine} from "../StaffLine";
+import {VexFlowStaffLine} from "./VexFlowStaffLine";
+import {SourceMeasure} from "../../VoiceData/SourceMeasure";
+import {StaffMeasure} from "../StaffMeasure";
+import {VexFlowMeasure} from "./VexFlowMeasure";
+import {SourceStaffEntry} from "../../VoiceData/SourceStaffEntry";
+import {GraphicalStaffEntry} from "../GraphicalStaffEntry";
+import {VexFlowStaffEntry} from "./VexFlowStaffEntry";
+import {Note} from "../../VoiceData/Note";
+import {ClefInstruction} from "../../VoiceData/Instructions/ClefInstruction";
+import {OctaveEnum} from "../../VoiceData/Expressions/ContinuousExpressions/octaveShift";
+import {GraphicalNote} from "../GraphicalNote";
+import {Pitch} from "../../../Common/DataObjects/pitch";
+import {TechnicalInstruction} from "../../VoiceData/Instructions/TechnicalInstruction";
+export class VexFlowGraphicalSymbolFactory implements IGraphicalSymbolFactory {
+    /**
+     * Create a new music system for the given page.
+     * Currently only one vertically endless page exists where all systems are put to.
+     * @param page
+     * @param systemIndex
+     * @returns {VexFlowMusicSystem}
+     */
     public createMusicSystem(page: GraphicalMusicPage, systemIndex: number): MusicSystem {
         return new VexFlowMusicSystem(page, systemIndex);
     }
+
+    /**
+     * Create a staffline object containing all staff measures belonging to a given system and staff.
+     * @param parentSystem
+     * @param parentStaff
+     * @returns {VexFlowStaffLine}
+     */
     public createStaffLine(parentSystem: MusicSystem, parentStaff: Staff): StaffLine {
         return new VexFlowStaffLine(parentSystem, parentStaff);
     }
+
+    /**
+     * Construct an empty staffMeasure from the given source measure and staff.
+     * @param sourceMeasure
+     * @param staff
+     * @returns {VexFlowMeasure}
+     */
     public createStaffMeasure(sourceMeasure: SourceMeasure, staff: Staff): StaffMeasure {
         var measure: VexFlowMeasure = new VexFlowMeasure(sourceMeasure, staff);
         return measure;
     }
+
+    /**
+     * Create empty measure, which will be used to show key, rhythm changes at the end of the system.
+     * @param staffLine
+     * @returns {VexFlowMeasure}
+     */
     public createExtraStaffMeasure(staffLine: StaffLine): StaffMeasure {
         var measure: VexFlowMeasure = new VexFlowMeasure(staffLine);
         return measure;
     }
+
+    /**
+     * Create a staffEntry in the given measure for a given sourceStaffEntry.
+     * @param sourceStaffEntry
+     * @param measure
+     * @returns {VexFlowStaffEntry}
+     */
     public createStaffEntry(sourceStaffEntry: SourceStaffEntry, measure: StaffMeasure): GraphicalStaffEntry {
         return new VexFlowStaffEntry(<VexFlowMeasure>measure, sourceStaffEntry, null);
     }
+
+    /**
+     * Create an empty staffEntry which will be used for grace notes.
+     * it will be linked to the given staffEntryParent, which is a staffEntry for normal notes.
+     * Grace notes are always given before (rarely also after) normal notes.
+     * @param staffEntryParent
+     * @param measure
+     * @returns {VexFlowStaffEntry}
+     */
     public createGraceStaffEntry(staffEntryParent: GraphicalStaffEntry, measure: StaffMeasure): GraphicalStaffEntry {
         return new VexFlowStaffEntry(<VexFlowMeasure>measure, null, <VexFlowStaffEntry>staffEntryParent);
     }
+
+    /**
+     * Create a Graphical Note for given note and clef and as part of graphicalStaffEntry.
+     * @param note
+     * @param numberOfDots  The number of dots the note has to increase its musical duration.
+     * @param graphicalStaffEntry
+     * @param activeClef    The currently active clef, needed for positioning the note vertically
+     * @param octaveShift   The currently active octave transposition enum, needed for positioning the note vertically
+     * @returns {GraphicalNote}
+     */
     public createNote(note: Note, numberOfDots: number, graphicalStaffEntry: GraphicalStaffEntry, activeClef: ClefInstruction, octaveShift: OctaveEnum = OctaveEnum.NONE): GraphicalNote {
-        throw new NotImplementedException();
+        let gn: GraphicalNote = new GraphicalNote(note, graphicalStaffEntry);
+        return gn;
     }
+
+    /**
+     * Create a Graphical Grace Note (smaller head, stem...) for given note and clef and as part of graphicalStaffEntry.
+     * @param note
+     * @param numberOfDots
+     * @param graphicalStaffEntry
+     * @param activeClef
+     * @param octaveShift
+     * @returns {GraphicalNote}
+     */
     public createGraceNote(note: Note, numberOfDots: number, graphicalStaffEntry: GraphicalStaffEntry, activeClef: ClefInstruction, octaveShift: OctaveEnum = OctaveEnum.NONE): GraphicalNote {
-        throw new NotImplementedException();
+        let gn: GraphicalNote = new GraphicalNote(note, graphicalStaffEntry);
+        return gn;
     }
+
+    /**
+     * Adds an accidental to a graphical note.
+     * @param graphicalNote
+     * @param pitch
+     * @param grace
+     * @param graceScalingFactor
+     */
     public addGraphicalAccidental(graphicalNote: GraphicalNote, pitch: Pitch, grace: boolean, graceScalingFactor: number): void {
 
     }
+
+    /**
+     * Adds a Fermata symbol at the last note of the given tied Note.
+     * The last graphical note of this tied note is located at the given graphicalStaffEntry.
+     * A Fermata has to be located at the last tied note.
+     * @param tiedNote
+     * @param graphicalStaffEntry
+     */
     public addFermataAtTiedEndNote(tiedNote: Note, graphicalStaffEntry: GraphicalStaffEntry): void {
 
     }
+
+    /**
+     * Adds a technical instruction at the given staff entry.
+     * @param technicalInstruction
+     * @param graphicalStaffEntry
+     */
     public createGraphicalTechnicalInstruction(technicalInstruction: TechnicalInstruction, graphicalStaffEntry: GraphicalStaffEntry): void {
 
     }
+
+    /**
+     * Adds a clef change within a measure before the given staff entry.
+     * @param graphicalStaffEntry
+     * @param clefInstruction
+     */
     public createInStaffClef(graphicalStaffEntry: GraphicalStaffEntry, clefInstruction: ClefInstruction): void {
 
     }
+
+    /**
+     * Adds a chord symbol at the given staff entry
+     * @param sourceStaffEntry
+     * @param graphicalStaffEntry
+     * @param transposeHalftones
+     */
     public createChordSymbol(sourceStaffEntry: SourceStaffEntry, graphicalStaffEntry: GraphicalStaffEntry, transposeHalftones: number): void {
 
     }

+ 12 - 16
src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts

@@ -8,39 +8,35 @@ import {ClefInstruction} from "../../VoiceData/Instructions/ClefInstruction";
 import {KeyInstruction} from "../../VoiceData/Instructions/KeyInstruction";
 import {RhythmInstruction} from "../../VoiceData/Instructions/RhythmInstruction";
 export class VexFlowMeasure extends StaffMeasure {
-    constructor(sourceMeasure: SourceMeasure, staff: Staff) {
-        super(staff, sourceMeasure);
-        this.PositionAndShape = new BoundingBox(this);
-    }
-    constructor(staffLine: StaffLine) {
-        super(staffLine);
-        this.PositionAndShape = new BoundingBox(staffLine.PositionAndShape, this);
+    constructor(staff: Staff, staffLine: StaffLine = undefined, sourceMeasure: SourceMeasure = undefined) {
+        super(staff, staffLine, sourceMeasure);
+
     }
     public resetLayout(): void {
-        throw new NotImplementedException();
+
     }
     public getLineWidth(line: SystemLinesEnum): number {
-        throw new NotImplementedException();
+        return SystemLinesEnum.SingleThin;
     }
     public addClefAtBegin(clef: ClefInstruction): void {
-        throw new NotImplementedException();
+
     }
     public addKeyAtBegin(currentKey: KeyInstruction, previousKey: KeyInstruction, currentClef: ClefInstruction): void {
-        throw new NotImplementedException();
+
     }
     public addRhythmAtBegin(rhythm: RhythmInstruction): void {
-        throw new NotImplementedException();
+
     }
     public addClefAtEnd(clef: ClefInstruction): void {
-        throw new NotImplementedException();
+
     }
     public setPositionInStaffline(xPos: number): void {
-        throw new NotImplementedException();
+
     }
     public setWidth(width: number): void {
-        throw new NotImplementedException();
+
     }
     public layoutSymbols(): void {
-        throw new NotImplementedException();
+
     }
 }

+ 58 - 33
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts

@@ -1,53 +1,78 @@
-export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
+import {MusicSheetCalculator} from "../MusicSheetCalculator";
+import {VexFlowGraphicalSymbolFactory} from "./VexFlowGraphicalSymbolFactory";
+import {GraphicalMusicSheet} from "../GraphicalMusicSheet";
+import {StaffMeasure} from "../StaffMeasure";
+import {MusicSystemBuilder} from "../MusicSystemBuilder";
+import {StaffLine} from "../StaffLine";
+import {VoiceEntry} from "../../VoiceData/VoiceEntry";
+import {MusicSystem} from "../MusicSystem";
+import {GraphicalNote} from "../GraphicalNote";
+import {GraphicalStaffEntry} from "../GraphicalStaffEntry";
+import {GraphicalMusicPage} from "../GraphicalMusicPage";
+import {GraphicalTie} from "../GraphicalTie";
+import {Tie} from "../../VoiceData/Tie";
+import {SourceMeasure} from "../../VoiceData/SourceMeasure";
+import {MultiExpression} from "../../VoiceData/Expressions/multiExpression";
+import {RepetitionInstruction} from "../../VoiceData/Instructions/RepetitionInstruction";
+import {Beam} from "../../VoiceData/Beam";
+import {ClefInstruction} from "../../VoiceData/Instructions/ClefInstruction";
+import {OctaveEnum} from "../../VoiceData/Expressions/ContinuousExpressions/octaveShift";
+import {Fraction} from "../../../Common/DataObjects/fraction";
+import {LyricsEntry} from "../../VoiceData/Lyrics/LyricsEntry";
+import {LyricWord} from "../../VoiceData/Lyrics/LyricsWord";
+import {OrnamentContainer} from "../../VoiceData/OrnamentContainer";
+import {ArticulationEnum} from "../../VoiceData/VoiceEntry";
+import {Tuplet} from "../../VoiceData/Tuplet";
+export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
     constructor() {
         super(new VexFlowGraphicalSymbolFactory());
 
     }
     public calculate(): void {
-        clearSystemsAndMeasures();
-        clearRecreatedObjects();
-        calculateXLayout(this.graphicalMusicSheet, maxInstrNameLabelLength());
-        this.graphicalMusicSheet.MusicPages.Clear();
+        this.clearSystemsAndMeasures();
+        this.clearRecreatedObjects();
+        this.calculateXLayout(this.graphicalMusicSheet, this.maxInstrNameLabelLength());
+        this.graphicalMusicSheet.MusicPages.length = 0;
         this.calculateMusicSystems();
         this.graphicalMusicSheet.MusicPages[0].PositionAndShape.BorderMarginBottom += 9;
         GraphicalMusicSheet.transformRelativeToAbsolutePosition(this.graphicalMusicSheet);
     }
-    protected calculateMeasureXLayout(measures: List<StaffMeasure>): number {
+    protected calculateMeasureXLayout(measures: StaffMeasure[]): number {
         throw new NotImplementedException();
     }
     protected calculateMusicSystems(): void {
-        var measureList: List<List<StaffMeasure>> = this.graphicalMusicSheet.MeasureList.Select(ml => ml.Where(m => m.isVisible()).ToList()).ToList();
-        var numberOfStaffLines: number = 0;
-        for (var idx: number = 0, len = measureList.Count; idx < len; ++idx) {
-            var gmlist: List<StaffMeasure> = measureList[idx];
-            numberOfStaffLines = Math.Max(gmlist.Count, numberOfStaffLines);
+        let measureList: StaffMeasure[][] = this.graphicalMusicSheet.MeasureList.Select(ml => ml.Where(m => m.isVisible()).ToList()).ToList();
+        let numberOfStaffLines: number = 0;
+        for (let idx: number = 0, len: number = measureList.length; idx < len; ++idx) {
+            let gmlist: StaffMeasure[] = measureList[idx];
+            numberOfStaffLines = Math.max(gmlist.length, numberOfStaffLines);
             break;
         }
-        if (numberOfStaffLines == 0)
-            return
-        var musicSystemBuilder: MusicSystemBuilder = new MusicSystemBuilder();
+        if (numberOfStaffLines === 0)
+            return;
+        let musicSystemBuilder: MusicSystemBuilder = new MusicSystemBuilder();
         musicSystemBuilder.initialize(this.graphicalMusicSheet, measureList, numberOfStaffLines, this.symbolFactory);
         musicSystemBuilder.buildMusicSystems();
-        checkMeasuresForWholeRestNotes();
+        this.checkMeasuresForWholeRestNotes();
     }
     protected updateStaffLineBorders(staffLine: StaffLine): void {
-        throw new NotImplementedException();
+
     }
     protected calculateMeasureNumberPlacement(musicSystem: MusicSystem): void {
-        throw new NotImplementedException();
+
     }
-    protected layoutVoiceEntry(voiceEntry: VoiceEntry, graphicalNotes: List<GraphicalNote>, graphicalStaffEntry: GraphicalStaffEntry, hasPitchedNote: boolean, isGraceStaffEntry: boolean): void {
+    protected layoutVoiceEntry(voiceEntry: VoiceEntry, graphicalNotes: GraphicalNote[], graphicalStaffEntry: GraphicalStaffEntry, hasPitchedNote: boolean, isGraceStaffEntry: boolean): void {
 
     }
     protected layoutStaffEntry(graphicalStaffEntry: GraphicalStaffEntry): void {
 
     }
     protected calculateSystemYLayout(): void {
-        for (var idx: number = 0, len = this.graphicalMusicSheet.MusicPages.Count; idx < len; ++idx) {
-            var graphicalMusicPage: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
-            if (!leadSheet) {
-                for (var idx2: number = 0, len2 = graphicalMusicPage.MusicSystems.Count; idx2 < len2; ++idx2) {
-                    var musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
+        for (let idx: number = 0, len: number = this.graphicalMusicSheet.MusicPages.length; idx < len; ++idx) {
+            let graphicalMusicPage: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
+            if (!this.leadSheet) {
+                for (let idx2: number = 0, len2: number = graphicalMusicPage.MusicSystems.length; idx2 < len2; ++idx2) {
+                    let musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
                 }
             }
         }
@@ -61,36 +86,36 @@
     protected layoutGraphicalTie(tie: GraphicalTie, tieIsAtSystemBreak: boolean): void {
 
     }
-    protected calculateSingleStaffLineLyricsPosition(staffLine: StaffLine, lyricVersesNumber: List<number>): void {
-        throw new NotImplementedException();
+    protected calculateSingleStaffLineLyricsPosition(staffLine: StaffLine, lyricVersesNumber: number[]): void {
+
     }
     protected calculateSingleOctaveShift(sourceMeasure: SourceMeasure, multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
-        throw new NotImplementedException();
+
     }
     protected calculateWordRepetitionInstruction(repetitionInstruction: RepetitionInstruction, measureIndex: number): void {
-        throw new NotImplementedException();
+
     }
     protected calculateMoodAndUnknownExpression(multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
-        throw new NotImplementedException();
+
     }
-    protected createGraphicalTieNote(beams: List<Beam>, activeClef: ClefInstruction,
+    protected createGraphicalTieNote(beams: Beam[], activeClef: ClefInstruction,
         octaveShiftValue: OctaveEnum, graphicalStaffEntry: GraphicalStaffEntry, duration: Fraction, numberOfDots: number,
         openTie: Tie, isLastTieNote: boolean): void {
 
     }
-    protected handleBeam(graphicalNote: GraphicalNote, beam: Beam, openBeams: List<Beam>): void {
+    protected handleBeam(graphicalNote: GraphicalNote, beam: Beam, openBeams: Beam[]): void {
 
     }
-    protected handleVoiceEntryLyrics(lyricsEntries: Dictionary<number, LyricsEntry>, voiceEntry: VoiceEntry, graphicalStaffEntry: GraphicalStaffEntry, openLyricWords: List<LyricWord>): void {
+    protected handleVoiceEntryLyrics(lyricsEntries: Dictionary<number, LyricsEntry>, voiceEntry: VoiceEntry, graphicalStaffEntry: GraphicalStaffEntry, openLyricWords: LyricWord[]): void {
 
     }
     protected handleVoiceEntryOrnaments(ornamentContainer: OrnamentContainer, voiceEntry: VoiceEntry, graphicalStaffEntry: GraphicalStaffEntry): void {
 
     }
-    protected handleVoiceEntryArticulations(articulations: List<ArticulationEnum>, voiceEntry: VoiceEntry, graphicalStaffEntry: GraphicalStaffEntry): void {
+    protected handleVoiceEntryArticulations(articulations: ArticulationEnum[], voiceEntry: VoiceEntry, graphicalStaffEntry: GraphicalStaffEntry): void {
 
     }
-    protected handleTuplet(graphicalNote: GraphicalNote, tuplet: Tuplet, openTuplets: List<Tuplet>): void {
+    protected handleTuplet(graphicalNote: GraphicalNote, tuplet: Tuplet, openTuplets: Tuplet[]): void {
 
     }
 }

+ 8 - 3
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSystem.ts

@@ -1,4 +1,9 @@
-export class VexFlowMusicSystem extends MusicSystem {
+import {MusicSystem} from "../MusicSystem";
+import {GraphicalMusicPage} from "../GraphicalMusicPage";
+import {SystemLinesEnum} from "../SystemLinesEnum";
+import {EngravingRules} from "../EngravingRules";
+import {PointF2D} from "../../../Common/DataObjects/PointF2D";
+export class VexFlowMusicSystem extends MusicSystem {
     constructor(parent: GraphicalMusicPage, id: number) {
         super(parent, id);
 
@@ -15,10 +20,10 @@
     protected calcInstrumentsBracketsWidth(): number {
         return 0;
     }
-    protected createInstrumentBracket(rightUpper: PointF_2D, rightLower: PointF_2D): void {
+    protected createInstrumentBracket(rightUpper: PointF2D, rightLower: PointF2D): void {
 
     }
-    protected createGroupBracket(rightUpper: PointF_2D, rightLower: PointF_2D, staffHeight: number, recursionDepth: number): void {
+    protected createGroupBracket(rightUpper: PointF2D, rightLower: PointF2D, staffHeight: number, recursionDepth: number): void {
 
     }
 }

+ 4 - 1
src/MusicalScore/Graphical/VexFlow/VexFlowStaffEntry.ts

@@ -1,4 +1,7 @@
-export class VexFlowStaffEntry extends GraphicalStaffEntry {
+import {GraphicalStaffEntry} from "../GraphicalStaffEntry";
+import {VexFlowMeasure} from "./VexFlowMeasure";
+import {SourceStaffEntry} from "../../VoiceData/SourceStaffEntry";
+export class VexFlowStaffEntry extends GraphicalStaffEntry {
     constructor(measure: VexFlowMeasure, sourceStaffEntry: SourceStaffEntry, staffEntryParent: VexFlowStaffEntry) {
         super(measure, sourceStaffEntry, staffEntryParent);
 

+ 4 - 1
src/MusicalScore/Graphical/VexFlow/VexFlowStaffLine.ts

@@ -1,4 +1,7 @@
-export class VexFlowStaffLine extends StaffLine {
+import {StaffLine} from "../StaffLine";
+import {MusicSystem} from "../MusicSystem";
+import {Staff} from "../../VoiceData/Staff";
+export class VexFlowStaffLine extends StaffLine {
     constructor(parentSystem: MusicSystem, parentStaff: Staff) {
         super(parentSystem, parentStaff);
 

+ 72 - 0
src/MusicalScore/VoiceData/SourceMeasure.ts

@@ -8,6 +8,9 @@ import {Voice} from "./Voice";
 import {MusicSheet} from "../MusicSheet";
 import {MultiExpression} from "./Expressions/multiExpression";
 import {MultiTempoExpression} from "./Expressions/multiTempoExpression";
+import {KeyInstruction} from "./Instructions/KeyInstruction";
+import {AbstractNotationInstruction} from "./Instructions/AbstractNotationInstruction";
+import {Repetition} from "../MusicSource/Repetition";
 export class SourceMeasure {
     constructor(completeNumberOfStaves: number) {
         this.completeNumberOfStaves = completeNumberOfStaves;
@@ -281,6 +284,75 @@ export class SourceMeasure {
         }
         return sourceStaffEntries;
     }
+    public hasBeginInstructions(): boolean {
+        for (var staffIndex: number = 0, len = this.FirstInstructionsStaffEntries.length; staffIndex < len; staffIndex++) {
+            var beginInstructionsStaffEntry: SourceStaffEntry = this.FirstInstructionsStaffEntries[staffIndex];
+            if (beginInstructionsStaffEntry != null && beginInstructionsStaffEntry.Instructions.length > 0)
+                return true;
+        }
+        return false;
+    }
+    public beginsWithLineRepetition(): boolean {
+        for (var idx: number = 0, len = this.FirstRepetitionInstructions.length; idx < len; ++idx) {
+            var instr: RepetitionInstruction = this.FirstRepetitionInstructions[idx];
+            if (instr.parentRepetition != null && instr == instr.parentRepetition.startMarker && !instr.parentRepetition.FromWords)
+                return true;
+        }
+        return false;
+    }
+    public endsWithLineRepetition(): boolean {
+        for (var idx: number = 0, len = this.LastRepetitionInstructions.length; idx < len; ++idx) {
+            var instruction: RepetitionInstruction = this.LastRepetitionInstructions[idx];
+            var rep: Repetition = instruction.parentRepetition;
+            if (rep == null)
+                continue;
+            if (rep.FromWords)
+                continue;
+            for (var idx2: number = 0, len2 = rep.BackwardJumpInstructions.length; idx2 < len2; ++idx2) {
+                var backJumpInstruction: RepetitionInstruction = rep.BackwardJumpInstructions[idx2];
+                if (instruction == backJumpInstruction)
+                    return true;
+            }
+        }
+        return false;
+    }
+    public beginsWithWordRepetition(): boolean {
+        for (var idx: number = 0, len = this.FirstRepetitionInstructions.length; idx < len; ++idx) {
+            var instruction: RepetitionInstruction = this.FirstRepetitionInstructions[idx];
+            if (instruction.parentRepetition != null && instruction == instruction.parentRepetition.startMarker && instruction.parentRepetition.FromWords)
+                return true;
+        }
+        return false;
+    }
+    public endsWithWordRepetition(): boolean {
+        for (var idx: number = 0, len = this.LastRepetitionInstructions.length; idx < len; ++idx) {
+            var instruction: RepetitionInstruction = this.LastRepetitionInstructions[idx];
+            var rep: Repetition = instruction.parentRepetition;
+            if (rep == null)
+                continue;
+            if (!rep.FromWords)
+                continue;
+            for (var idx2: number = 0, len2 = rep.BackwardJumpInstructions.length; idx2 < len2; ++idx2) {
+                var backJumpInstruction: RepetitionInstruction = rep.BackwardJumpInstructions[idx2];
+                if (instruction == backJumpInstruction)
+                    return true;
+            }
+            if (instruction == rep.forwardJumpInstruction)
+                return true;
+        }
+        return false;
+    }
+    public getKeyInstruction(staffIndex: number): KeyInstruction {
+        if (this.FirstInstructionsStaffEntries[staffIndex] != null) {
+            var sourceStaffEntry: SourceStaffEntry = this.FirstInstructionsStaffEntries[staffIndex];
+            for (var idx: number = 0, len = sourceStaffEntry.Instructions.length; idx < len; ++idx) {
+                var abstractNotationInstruction: AbstractNotationInstruction = sourceStaffEntry.Instructions[idx];
+                if (abstractNotationInstruction instanceof KeyInstruction)
+                    return <KeyInstruction>abstractNotationInstruction;
+            }
+        }
+        return null;
+    }
     private getLastSourceStaffEntryForInstrument(instrumentIndex: number): SourceStaffEntry {
         for (let i: number = this.verticalSourceStaffEntryContainers.length - 1; i >= 0; i--) {
             if (this.verticalSourceStaffEntryContainers[i][instrumentIndex] !== undefined) {