|
@@ -7,7 +7,7 @@ import { Fraction } from "../../Common/DataObjects/Fraction";
|
|
|
import { Note } from "../VoiceData/Note";
|
|
|
import { MusicSheet } from "../MusicSheet";
|
|
|
import { GraphicalMeasure } from "./GraphicalMeasure";
|
|
|
-import { ClefInstruction } from "../VoiceData/Instructions/ClefInstruction";
|
|
|
+import {ClefInstruction, ClefEnum} from "../VoiceData/Instructions/ClefInstruction";
|
|
|
import { LyricWord } from "../VoiceData/Lyrics/LyricsWord";
|
|
|
import { SourceMeasure } from "../VoiceData/SourceMeasure";
|
|
|
import { GraphicalMusicPage } from "./GraphicalMusicPage";
|
|
@@ -85,7 +85,7 @@ export abstract class MusicSheetCalculator {
|
|
|
|
|
|
protected graphicalMusicSheet: GraphicalMusicSheet;
|
|
|
protected rules: EngravingRules;
|
|
|
- //protected symbolFactory: IGraphicalSymbolFactory;
|
|
|
+ protected musicSystems: MusicSystem[];
|
|
|
|
|
|
public static get TextMeasurer(): ITextMeasurer {
|
|
|
return MusicSheetCalculator.textMeasurer;
|
|
@@ -172,6 +172,8 @@ export abstract class MusicSheetCalculator {
|
|
|
* The main method for the Calculator.
|
|
|
*/
|
|
|
public calculate(): void {
|
|
|
+ this.musicSystems = [];
|
|
|
+
|
|
|
this.clearSystemsAndMeasures();
|
|
|
|
|
|
// delete graphicalObjects (currently: ties) that will be recalculated, newly create GraphicalObjects streching over a single StaffEntry
|
|
@@ -190,7 +192,7 @@ export abstract class MusicSheetCalculator {
|
|
|
this.calculateMusicSystems();
|
|
|
|
|
|
// Add some white space at the end of the piece:
|
|
|
- this.graphicalMusicSheet.MusicPages[0].PositionAndShape.BorderMarginBottom += 9;
|
|
|
+ //this.graphicalMusicSheet.MusicPages[0].PositionAndShape.BorderMarginBottom += 9;
|
|
|
|
|
|
// transform Relative to Absolute Positions
|
|
|
GraphicalMusicSheet.transformRelativeToAbsolutePosition(this.graphicalMusicSheet);
|
|
@@ -228,55 +230,6 @@ export abstract class MusicSheetCalculator {
|
|
|
throw new Error("abstract, not implemented");
|
|
|
}
|
|
|
|
|
|
- /** Calculates the relative Positions of all MusicSystems.
|
|
|
- *
|
|
|
- */
|
|
|
- protected calculateMusicSystemsRelativePositions(graphicalMusicPage: GraphicalMusicPage): void {
|
|
|
- // xPosition is always fixed
|
|
|
- let relativePosition: PointF2D = new PointF2D(this.rules.PageLeftMargin + this.rules.SystemLeftMargin, 0);
|
|
|
-
|
|
|
- if (EngravingRules.Rules.CompactMode) {
|
|
|
- relativePosition.y += EngravingRules.Rules.PageTopMarginNarrow;
|
|
|
- } else {
|
|
|
- relativePosition.y += EngravingRules.Rules.PageTopMargin;
|
|
|
- }
|
|
|
-
|
|
|
- // first System is handled extra
|
|
|
- const firstMusicSystem: MusicSystem = graphicalMusicPage.MusicSystems[0];
|
|
|
- if (graphicalMusicPage === graphicalMusicPage.Parent.MusicPages[0]) {
|
|
|
- if (EngravingRules.Rules.RenderTitle) {
|
|
|
- relativePosition.y += this.rules.TitleTopDistance + this.rules.SheetTitleHeight +
|
|
|
- this.rules.TitleBottomDistance;
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (EngravingRules.Rules.RenderTitle) {
|
|
|
- relativePosition.y += this.rules.PageTopMargin + this.rules.TitleTopDistance;
|
|
|
- } else {
|
|
|
- relativePosition.y = this.rules.PageTopMargin;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- firstMusicSystem.PositionAndShape.RelativePosition = relativePosition;
|
|
|
-
|
|
|
- for (let i: number = 1; i < graphicalMusicPage.MusicSystems.length; i++) {
|
|
|
- const musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[i];
|
|
|
- relativePosition = new PointF2D(this.rules.PageLeftMargin + this.rules.SystemLeftMargin, 0);
|
|
|
-
|
|
|
- // find optimum distance between Systems
|
|
|
- const previousSystem: MusicSystem = graphicalMusicPage.MusicSystems[i - 1];
|
|
|
- const lastPreviousStaffLine: StaffLine = previousSystem.StaffLines[previousSystem.StaffLines.length - 1];
|
|
|
- const distance: number = (lastPreviousStaffLine.SkyBottomLineCalculator.getBottomLineMax() - this.rules.StaffHeight) +
|
|
|
- Math.abs(musicSystem.StaffLines[0].SkyBottomLineCalculator.getSkyLineMin()) +
|
|
|
- this.rules.MinimumAllowedDistanceBetweenSystems;
|
|
|
-
|
|
|
- relativePosition.y = previousSystem.PositionAndShape.RelativePosition.y +
|
|
|
- lastPreviousStaffLine.PositionAndShape.RelativePosition.y +
|
|
|
- this.rules.StaffHeight + Math.max(this.rules.SystemDistance, distance);
|
|
|
-
|
|
|
- musicSystem.PositionAndShape.RelativePosition = relativePosition;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 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 the measures.
|
|
@@ -287,47 +240,6 @@ export abstract class MusicSheetCalculator {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * This method checks the distances between two System's StaffLines and if needed, shifts the lower down.
|
|
|
- * @param musicSystem
|
|
|
- */
|
|
|
- protected optimizeDistanceBetweenStaffLines(musicSystem: MusicSystem): void {
|
|
|
- musicSystem.PositionAndShape.calculateAbsolutePositionsRecursive(0, 0);
|
|
|
-
|
|
|
- // don't perform any y-spacing in case of a StaffEntryLink (in both StaffLines)
|
|
|
- if (!musicSystem.checkStaffEntriesForStaffEntryLink()) {
|
|
|
- for (let i: number = 0; i < musicSystem.StaffLines.length - 1; i++) {
|
|
|
- const upperBottomLine: number = musicSystem.StaffLines[i].SkyBottomLineCalculator.getBottomLineMax();
|
|
|
- // TODO: Lower skyline should add to offset when there are items above the line. Currently no test
|
|
|
- // file available
|
|
|
- // const lowerSkyLine: number = Math.min(...musicSystem.StaffLines[i + 1].SkyLine);
|
|
|
- if (Math.abs(upperBottomLine) > this.rules.MinimumStaffLineDistance) {
|
|
|
- // Remove staffheight from offset. As it results in huge distances
|
|
|
- const offset: number = Math.abs(upperBottomLine) + this.rules.MinimumStaffLineDistance - this.rules.StaffHeight;
|
|
|
- this.updateStaffLinesRelativePosition(musicSystem, i + 1, offset);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * This method updates the System's StaffLine's RelativePosition (starting from the given index).
|
|
|
- * @param musicSystem
|
|
|
- * @param index
|
|
|
- * @param value
|
|
|
- */
|
|
|
- protected updateStaffLinesRelativePosition(musicSystem: MusicSystem, index: number, value: number): void {
|
|
|
- for (let i: number = index; i < musicSystem.StaffLines.length; i++) {
|
|
|
- musicSystem.StaffLines[i].PositionAndShape.RelativePosition.y += value;
|
|
|
- }
|
|
|
-
|
|
|
- musicSystem.PositionAndShape.BorderBottom += value;
|
|
|
- }
|
|
|
-
|
|
|
- protected calculateSystemYLayout(): void {
|
|
|
- throw new Error("abstract, not implemented");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* Called for every source measure when generating the list of staff measures for it.
|
|
|
*/
|
|
|
protected initGraphicalMeasuresCreation(): void {
|
|
@@ -456,7 +368,7 @@ export abstract class MusicSheetCalculator {
|
|
|
let end: number = relativeX - graphicalLabel.PositionAndShape.BorderLeft + graphicalLabel.PositionAndShape.BorderMarginRight;
|
|
|
|
|
|
// take into account the InstrumentNameLabel's at the beginning of the first MusicSystem
|
|
|
- if (staffLine === musicSystem.StaffLines[0] && musicSystem === musicSystem.Parent.MusicSystems[0]) {
|
|
|
+ if (staffLine === musicSystem.StaffLines[0] && musicSystem === this.musicSystems[0]) {
|
|
|
start -= staffLine.PositionAndShape.RelativePosition.x;
|
|
|
end -= staffLine.PositionAndShape.RelativePosition.x;
|
|
|
}
|
|
@@ -716,7 +628,7 @@ export abstract class MusicSheetCalculator {
|
|
|
// build the MusicSystems
|
|
|
const musicSystemBuilder: MusicSystemBuilder = new MusicSystemBuilder();
|
|
|
musicSystemBuilder.initialize(this.graphicalMusicSheet, visibleMeasureList, numberOfStaffLines);
|
|
|
- musicSystemBuilder.buildMusicSystems();
|
|
|
+ this.musicSystems = musicSystemBuilder.buildMusicSystems();
|
|
|
|
|
|
this.formatMeasures();
|
|
|
|
|
@@ -724,7 +636,7 @@ export abstract class MusicSheetCalculator {
|
|
|
this.checkMeasuresForWholeRestNotes();
|
|
|
if (!this.leadSheet) {
|
|
|
// calculate Beam Placement
|
|
|
- this.calculateBeams();
|
|
|
+ // this.calculateBeams(); // does nothing for now, because layoutBeams() is an empty method
|
|
|
// possible Displacement of RestNotes
|
|
|
this.optimizeRestPlacement();
|
|
|
// possible Displacement of RestNotes
|
|
@@ -742,12 +654,9 @@ export abstract class MusicSheetCalculator {
|
|
|
|
|
|
// calculate MeasureNumbers
|
|
|
if (EngravingRules.Rules.RenderMeasureNumbers) {
|
|
|
- for (let idx: number = 0, len: number = this.graphicalMusicSheet.MusicPages.length; idx < len; ++idx) {
|
|
|
- const graphicalMusicPage: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
|
|
|
- for (let idx2: number = 0, len2: number = graphicalMusicPage.MusicSystems.length; idx2 < len2; ++idx2) {
|
|
|
- const musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
|
|
|
- this.calculateMeasureNumberPlacement(musicSystem);
|
|
|
- }
|
|
|
+ for (let idx: number = 0, len: number = this.musicSystems.length; idx < len; ++idx) {
|
|
|
+ const musicSystem: MusicSystem = this.musicSystems[idx];
|
|
|
+ this.calculateMeasureNumberPlacement(musicSystem);
|
|
|
}
|
|
|
}
|
|
|
// calculate Slurs
|
|
@@ -785,19 +694,16 @@ export abstract class MusicSheetCalculator {
|
|
|
|
|
|
// update all StaffLine's Borders
|
|
|
// create temporary Object, just to call the methods (in order to avoid declaring them static)
|
|
|
- for (let idx: number = 0, len: number = this.graphicalMusicSheet.MusicPages.length; idx < len; ++idx) {
|
|
|
- const graphicalMusicPage: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
|
|
|
- for (let idx2: number = 0, len2: number = graphicalMusicPage.MusicSystems.length; idx2 < len2; ++idx2) {
|
|
|
- const musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
|
|
|
- for (let idx3: number = 0, len3: number = musicSystem.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
- const staffLine: StaffLine = musicSystem.StaffLines[idx3];
|
|
|
- this.updateStaffLineBorders(staffLine);
|
|
|
- }
|
|
|
+ for (let idx2: number = 0, len2: number = this.musicSystems.length; idx2 < len2; ++idx2) {
|
|
|
+ const musicSystem: MusicSystem = this.musicSystems[idx2];
|
|
|
+ for (let idx3: number = 0, len3: number = musicSystem.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
+ const staffLine: StaffLine = musicSystem.StaffLines[idx3];
|
|
|
+ this.updateStaffLineBorders(staffLine);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // Y-spacing
|
|
|
- this.calculateSystemYLayout();
|
|
|
+ // calculate Y-spacing -> MusicPages are created here
|
|
|
+ musicSystemBuilder.calculateSystemYLayout();
|
|
|
// calculate Comments for each Staffline
|
|
|
this.calculateComments();
|
|
|
// calculate marked Areas for Systems
|
|
@@ -809,16 +715,17 @@ export abstract class MusicSheetCalculator {
|
|
|
for (let idx: number = 0, len: number = this.graphicalMusicSheet.MusicPages.length; idx < len; ++idx) {
|
|
|
const graphicalMusicPage: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
|
|
|
for (let idx2: number = 0, len2: number = graphicalMusicPage.MusicSystems.length; idx2 < len2; ++idx2) {
|
|
|
+ const isFirstSystem: boolean = idx === 0 && idx2 === 0;
|
|
|
const musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
|
|
|
musicSystem.setMusicSystemLabelsYPosition();
|
|
|
if (!this.leadSheet) {
|
|
|
musicSystem.setYPositionsToVerticalLineObjectsAndCreateLines(this.rules);
|
|
|
- musicSystem.createSystemLeftLine(this.rules.SystemThinLineWidth, this.rules.SystemLabelsRightMargin);
|
|
|
+ musicSystem.createSystemLeftLine(this.rules.SystemThinLineWidth, this.rules.SystemLabelsRightMargin, isFirstSystem);
|
|
|
musicSystem.createInstrumentBrackets(this.graphicalMusicSheet.ParentMusicSheet.Instruments, this.rules.StaffHeight);
|
|
|
musicSystem.createGroupBrackets(this.graphicalMusicSheet.ParentMusicSheet.InstrumentalGroups, this.rules.StaffHeight, 0);
|
|
|
musicSystem.alignBeginInstructions();
|
|
|
} else if (musicSystem === musicSystem.Parent.MusicSystems[0]) {
|
|
|
- musicSystem.createSystemLeftLine(this.rules.SystemThinLineWidth, this.rules.SystemLabelsRightMargin);
|
|
|
+ musicSystem.createSystemLeftLine(this.rules.SystemThinLineWidth, this.rules.SystemLabelsRightMargin, isFirstSystem);
|
|
|
}
|
|
|
musicSystem.calculateBorders(this.rules);
|
|
|
}
|
|
@@ -863,22 +770,20 @@ export abstract class MusicSheetCalculator {
|
|
|
}
|
|
|
|
|
|
protected calculateChordSymbols(): void {
|
|
|
- for (const musicPage of this.graphicalMusicSheet.MusicPages) {
|
|
|
- for (const musicSystem of musicPage.MusicSystems) {
|
|
|
- for (const staffLine of musicSystem.StaffLines) {
|
|
|
- const sbc: SkyBottomLineCalculator = staffLine.SkyBottomLineCalculator;
|
|
|
- for (const measure of staffLine.Measures) {
|
|
|
- for (const staffEntry of measure.staffEntries) {
|
|
|
- if (!staffEntry.graphicalChordContainers || staffEntry.graphicalChordContainers.length === 0) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- for (const graphicalChordContainer of staffEntry.graphicalChordContainers) {
|
|
|
- const sps: BoundingBox = staffEntry.PositionAndShape;
|
|
|
- const gps: BoundingBox = graphicalChordContainer.PositionAndShape;
|
|
|
- const start: number = gps.BorderMarginLeft + sps.AbsolutePosition.x;
|
|
|
- const end: number = gps.BorderMarginRight + sps.AbsolutePosition.x;
|
|
|
- sbc.updateSkyLineInRange(start, end, sps.BorderMarginTop);
|
|
|
- }
|
|
|
+ for (const musicSystem of this.musicSystems) {
|
|
|
+ for (const staffLine of musicSystem.StaffLines) {
|
|
|
+ const sbc: SkyBottomLineCalculator = staffLine.SkyBottomLineCalculator;
|
|
|
+ for (const measure of staffLine.Measures) {
|
|
|
+ for (const staffEntry of measure.staffEntries) {
|
|
|
+ if (!staffEntry.graphicalChordContainers || staffEntry.graphicalChordContainers.length === 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ for (const graphicalChordContainer of staffEntry.graphicalChordContainers) {
|
|
|
+ const sps: BoundingBox = staffEntry.PositionAndShape;
|
|
|
+ const gps: BoundingBox = graphicalChordContainer.PositionAndShape;
|
|
|
+ const start: number = gps.BorderMarginLeft + sps.AbsolutePosition.x;
|
|
|
+ const end: number = gps.BorderMarginRight + sps.AbsolutePosition.x;
|
|
|
+ sbc.updateSkyLineInRange(start, end, sps.BorderMarginTop);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1421,7 +1326,7 @@ export abstract class MusicSheetCalculator {
|
|
|
// check if MusicSystem is first MusicSystem
|
|
|
if (staffLine.Measures[0].staffEntries.length > 0 &&
|
|
|
Math.abs(relative.x - staffLine.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x) === 0 &&
|
|
|
- staffLine.ParentMusicSystem === staffLine.ParentMusicSystem.Parent.MusicSystems[0]) {
|
|
|
+ staffLine.ParentMusicSystem === this.musicSystems[0]) {
|
|
|
const firstInstructionEntry: GraphicalStaffEntry = staffLine.Measures[0].FirstInstructionStaffEntry;
|
|
|
if (firstInstructionEntry) {
|
|
|
const lastInstruction: AbstractGraphicalInstruction = firstInstructionEntry.GraphicalInstructions.last();
|
|
@@ -1553,8 +1458,16 @@ export abstract class MusicSheetCalculator {
|
|
|
} else {
|
|
|
this.calculateStemDirectionFromVoices(voiceEntry);
|
|
|
}
|
|
|
+ // if GraphicalStaffEntry has been created earlier (because of Tie), then the GraphicalNotesLists have also been created
|
|
|
const gve: GraphicalVoiceEntry = graphicalStaffEntry.findOrCreateGraphicalVoiceEntry(voiceEntry);
|
|
|
gve.octaveShiftValue = octaveShiftValue;
|
|
|
+ // check for Tabs:
|
|
|
+ const tabStaffEntry: GraphicalStaffEntry = graphicalStaffEntry.tabStaffEntry;
|
|
|
+ let graphicalTabVoiceEntry: GraphicalVoiceEntry;
|
|
|
+ if (tabStaffEntry !== undefined) {
|
|
|
+ graphicalTabVoiceEntry = tabStaffEntry.findOrCreateGraphicalVoiceEntry(voiceEntry);
|
|
|
+ }
|
|
|
+
|
|
|
for (let idx: number = 0, len: number = voiceEntry.Notes.length; idx < len; ++idx) {
|
|
|
const note: Note = voiceEntry.Notes[idx];
|
|
|
if (note === undefined) {
|
|
@@ -1583,6 +1496,24 @@ export abstract class MusicSheetCalculator {
|
|
|
this.handleTuplet(graphicalNote, note.NoteTuplet, openTuplets);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // handle TabNotes:
|
|
|
+ if (graphicalTabVoiceEntry) {
|
|
|
+ // notes should be either TabNotes or RestNotes -> add all:
|
|
|
+ const graphicalTabNote: GraphicalNote = MusicSheetCalculator.symbolFactory.createNote( note,
|
|
|
+ graphicalTabVoiceEntry,
|
|
|
+ activeClef,
|
|
|
+ octaveShiftValue,
|
|
|
+ undefined);
|
|
|
+ tabStaffEntry.addGraphicalNoteToListAtCorrectYPosition(graphicalTabVoiceEntry, graphicalTabNote);
|
|
|
+ graphicalTabNote.PositionAndShape.calculateBoundingBox();
|
|
|
+
|
|
|
+ if (!this.leadSheet) {
|
|
|
+ if (note.NoteTuplet) {
|
|
|
+ this.handleTuplet(graphicalTabNote, note.NoteTuplet, openTuplets);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if (voiceEntry.Articulations.length > 0) {
|
|
|
this.handleVoiceEntryArticulations(voiceEntry.Articulations, voiceEntry, graphicalStaffEntry);
|
|
@@ -1678,21 +1609,18 @@ export abstract class MusicSheetCalculator {
|
|
|
}
|
|
|
|
|
|
protected checkMeasuresForWholeRestNotes(): void {
|
|
|
- for (let idx: number = 0, len: number = this.graphicalMusicSheet.MusicPages.length; idx < len; ++idx) {
|
|
|
- const musicPage: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
|
|
|
- for (let idx2: number = 0, len2: number = musicPage.MusicSystems.length; idx2 < len2; ++idx2) {
|
|
|
- const musicSystem: MusicSystem = musicPage.MusicSystems[idx2];
|
|
|
- for (let idx3: number = 0, len3: number = musicSystem.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
- const staffLine: StaffLine = musicSystem.StaffLines[idx3];
|
|
|
- for (let idx4: number = 0, len4: number = staffLine.Measures.length; idx4 < len4; ++idx4) {
|
|
|
- const measure: GraphicalMeasure = staffLine.Measures[idx4];
|
|
|
- if (measure.staffEntries.length === 1) {
|
|
|
- const gse: GraphicalStaffEntry = measure.staffEntries[0];
|
|
|
- if (gse.graphicalVoiceEntries.length > 0 && gse.graphicalVoiceEntries[0].notes.length === 1) {
|
|
|
- const graphicalNote: GraphicalNote = gse.graphicalVoiceEntries[0].notes[0];
|
|
|
- if (graphicalNote.sourceNote.Pitch === undefined && (new Fraction(1, 2)).lt(graphicalNote.sourceNote.Length)) {
|
|
|
- this.layoutMeasureWithWholeRest(graphicalNote, gse, measure);
|
|
|
- }
|
|
|
+ for (let idx2: number = 0, len2: number = this.musicSystems.length; idx2 < len2; ++idx2) {
|
|
|
+ const musicSystem: MusicSystem = this.musicSystems[idx2];
|
|
|
+ for (let idx3: number = 0, len3: number = musicSystem.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
+ const staffLine: StaffLine = musicSystem.StaffLines[idx3];
|
|
|
+ for (let idx4: number = 0, len4: number = staffLine.Measures.length; idx4 < len4; ++idx4) {
|
|
|
+ const measure: GraphicalMeasure = staffLine.Measures[idx4];
|
|
|
+ if (measure.staffEntries.length === 1) {
|
|
|
+ const gse: GraphicalStaffEntry = measure.staffEntries[0];
|
|
|
+ if (gse.graphicalVoiceEntries.length > 0 && gse.graphicalVoiceEntries[0].notes.length === 1) {
|
|
|
+ const graphicalNote: GraphicalNote = gse.graphicalVoiceEntries[0].notes[0];
|
|
|
+ if (graphicalNote.sourceNote.Pitch === undefined && (new Fraction(1, 2)).lt(graphicalNote.sourceNote.Length)) {
|
|
|
+ this.layoutMeasureWithWholeRest(graphicalNote, gse, measure);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1797,7 +1725,11 @@ export abstract class MusicSheetCalculator {
|
|
|
}
|
|
|
|
|
|
protected calculatePageLabels(page: GraphicalMusicPage): void {
|
|
|
-
|
|
|
+ if (EngravingRules.Rules.RenderSingleHorizontalStaffline) {
|
|
|
+ page.PositionAndShape.BorderRight = page.PositionAndShape.Size.width;
|
|
|
+ page.PositionAndShape.calculateBoundingBox();
|
|
|
+ this.graphicalMusicSheet.ParentMusicSheet.pageWidth = page.PositionAndShape.Size.width;
|
|
|
+ }
|
|
|
// The PositionAndShape child elements of page need to be manually connected to the lyricist, composer, subtitle, etc.
|
|
|
// because the page is only available now
|
|
|
let firstSystemAbsoluteTopMargin: number = 10;
|
|
@@ -1988,8 +1920,15 @@ export abstract class MusicSheetCalculator {
|
|
|
openOctaveShifts: OctaveShiftParams[], openLyricWords: LyricWord[], staffIndex: number,
|
|
|
staffEntryLinks: StaffEntryLink[]): GraphicalMeasure {
|
|
|
const staff: Staff = this.graphicalMusicSheet.ParentMusicSheet.getStaffFromIndex(staffIndex);
|
|
|
- const measure: GraphicalMeasure = MusicSheetCalculator.symbolFactory.createGraphicalMeasure(sourceMeasure, staff);
|
|
|
+ let measure: GraphicalMeasure = undefined;
|
|
|
+ if (activeClefs[staffIndex].ClefType === ClefEnum.TAB) {
|
|
|
+ staff.isTab = true;
|
|
|
+ measure = MusicSheetCalculator.symbolFactory.createTabStaffMeasure(sourceMeasure, staff);
|
|
|
+ } else {
|
|
|
+ measure = MusicSheetCalculator.symbolFactory.createGraphicalMeasure(sourceMeasure, staff);
|
|
|
+ }
|
|
|
measure.hasError = sourceMeasure.getErrorInMeasure(staffIndex);
|
|
|
+ // check for key instruction changes
|
|
|
if (sourceMeasure.FirstInstructionsStaffEntries[staffIndex] !== undefined) {
|
|
|
for (let idx: number = 0, len: number = sourceMeasure.FirstInstructionsStaffEntries[staffIndex].Instructions.length; idx < len; ++idx) {
|
|
|
const instruction: AbstractNotationInstruction = sourceMeasure.FirstInstructionsStaffEntries[staffIndex].Instructions[idx];
|
|
@@ -2006,6 +1945,7 @@ export abstract class MusicSheetCalculator {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ // check for octave shifts
|
|
|
for (let idx: number = 0, len: number = sourceMeasure.StaffLinkedExpressions[staffIndex].length; idx < len; ++idx) {
|
|
|
const multiExpression: MultiExpression = sourceMeasure.StaffLinkedExpressions[staffIndex][idx];
|
|
|
if (multiExpression.OctaveShiftStart !== undefined) {
|
|
@@ -2017,36 +1957,45 @@ export abstract class MusicSheetCalculator {
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
+ // create GraphicalStaffEntries - always check for possible null Entry
|
|
|
for (let entryIndex: number = 0; entryIndex < sourceMeasure.VerticalSourceStaffEntryContainers.length; entryIndex++) {
|
|
|
const sourceStaffEntry: SourceStaffEntry = sourceMeasure.VerticalSourceStaffEntryContainers[entryIndex].StaffEntries[staffIndex];
|
|
|
+ // is there a SourceStaffEntry at this Index
|
|
|
if (sourceStaffEntry !== undefined) {
|
|
|
+ // a SourceStaffEntry exists
|
|
|
+ // is there an inStaff ClefInstruction? -> update activeClef
|
|
|
for (let idx: number = 0, len: number = sourceStaffEntry.Instructions.length; idx < len; ++idx) {
|
|
|
const abstractNotationInstruction: AbstractNotationInstruction = sourceStaffEntry.Instructions[idx];
|
|
|
if (abstractNotationInstruction instanceof ClefInstruction) {
|
|
|
activeClefs[staffIndex] = <ClefInstruction>abstractNotationInstruction;
|
|
|
}
|
|
|
}
|
|
|
+ // create new GraphicalStaffEntry
|
|
|
const graphicalStaffEntry: GraphicalStaffEntry = MusicSheetCalculator.symbolFactory.createStaffEntry(sourceStaffEntry, measure);
|
|
|
- if (measure.staffEntries.length > entryIndex) {
|
|
|
+ if (entryIndex < measure.staffEntries.length) {
|
|
|
+ // a GraphicalStaffEntry has been inserted already at this Index (from Tie)
|
|
|
measure.addGraphicalStaffEntryAtTimestamp(graphicalStaffEntry);
|
|
|
} else {
|
|
|
measure.addGraphicalStaffEntry(graphicalStaffEntry);
|
|
|
}
|
|
|
+
|
|
|
const linkedNotes: Note[] = [];
|
|
|
if (sourceStaffEntry.Link !== undefined) {
|
|
|
sourceStaffEntry.findLinkedNotes(linkedNotes);
|
|
|
this.handleStaffEntryLink(graphicalStaffEntry, staffEntryLinks);
|
|
|
}
|
|
|
+ // check for possible OctaveShift
|
|
|
let octaveShiftValue: OctaveEnum = OctaveEnum.NONE;
|
|
|
if (openOctaveShifts[staffIndex] !== undefined) {
|
|
|
- const octaveShiftParams: OctaveShiftParams = openOctaveShifts[staffIndex];
|
|
|
- if (octaveShiftParams.getAbsoluteStartTimestamp.lte(sourceStaffEntry.AbsoluteTimestamp) &&
|
|
|
- sourceStaffEntry.AbsoluteTimestamp.lte(octaveShiftParams.getAbsoluteEndTimestamp)) {
|
|
|
- octaveShiftValue = octaveShiftParams.getOpenOctaveShift.Type;
|
|
|
+ if (openOctaveShifts[staffIndex].getAbsoluteStartTimestamp.lte(sourceStaffEntry.AbsoluteTimestamp) &&
|
|
|
+ sourceStaffEntry.AbsoluteTimestamp.lte(openOctaveShifts[staffIndex].getAbsoluteEndTimestamp)) {
|
|
|
+ octaveShiftValue = openOctaveShifts[staffIndex].getOpenOctaveShift.Type;
|
|
|
}
|
|
|
}
|
|
|
+ // for each visible Voice create the corresponding GraphicalNotes
|
|
|
for (let idx: number = 0, len: number = sourceStaffEntry.VoiceEntries.length; idx < len; ++idx) {
|
|
|
const voiceEntry: VoiceEntry = sourceStaffEntry.VoiceEntries[idx];
|
|
|
+ // Normal Notes...
|
|
|
octaveShiftValue = this.handleVoiceEntry(
|
|
|
voiceEntry, graphicalStaffEntry,
|
|
|
accidentalCalculator, openLyricWords,
|
|
@@ -2055,6 +2004,7 @@ export abstract class MusicSheetCalculator {
|
|
|
sourceStaffEntry
|
|
|
);
|
|
|
}
|
|
|
+ // SourceStaffEntry has inStaff ClefInstruction -> create graphical clef
|
|
|
if (sourceStaffEntry.Instructions.length > 0) {
|
|
|
const clefInstruction: ClefInstruction = <ClefInstruction>sourceStaffEntry.Instructions[0];
|
|
|
MusicSheetCalculator.symbolFactory.createInStaffClef(graphicalStaffEntry, clefInstruction);
|
|
@@ -2070,6 +2020,7 @@ export abstract class MusicSheetCalculator {
|
|
|
}
|
|
|
|
|
|
accidentalCalculator.doCalculationsAtEndOfMeasure();
|
|
|
+ // update activeClef given at end of measure if needed
|
|
|
if (sourceMeasure.LastInstructionsStaffEntries[staffIndex] !== undefined) {
|
|
|
const lastStaffEntry: SourceStaffEntry = sourceMeasure.LastInstructionsStaffEntries[staffIndex];
|
|
|
for (let idx: number = 0, len: number = lastStaffEntry.Instructions.length; idx < len; ++idx) {
|
|
@@ -2083,7 +2034,7 @@ export abstract class MusicSheetCalculator {
|
|
|
const multiExpression: MultiExpression = sourceMeasure.StaffLinkedExpressions[staffIndex][idx];
|
|
|
if (multiExpression.OctaveShiftEnd !== undefined && openOctaveShifts[staffIndex] !== undefined &&
|
|
|
multiExpression.OctaveShiftEnd === openOctaveShifts[staffIndex].getOpenOctaveShift) {
|
|
|
- openOctaveShifts[staffIndex] = undefined;
|
|
|
+ openOctaveShifts[staffIndex] = undefined;
|
|
|
}
|
|
|
}
|
|
|
// check wantedStemDirections of beam notes at end of measure (e.g. for beam with grace notes)
|
|
@@ -2165,11 +2116,9 @@ export abstract class MusicSheetCalculator {
|
|
|
}
|
|
|
|
|
|
private calculateSkyBottomLines(): void {
|
|
|
- for (const graphicalMusicPage of this.graphicalMusicSheet.MusicPages) {
|
|
|
- for (const musicSystem of graphicalMusicPage.MusicSystems) {
|
|
|
- for (const staffLine of musicSystem.StaffLines) {
|
|
|
- staffLine.SkyBottomLineCalculator.calculateLines();
|
|
|
- }
|
|
|
+ for (const musicSystem of this.musicSystems) {
|
|
|
+ for (const staffLine of musicSystem.StaffLines) {
|
|
|
+ staffLine.SkyBottomLineCalculator.calculateLines();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2181,41 +2130,36 @@ export abstract class MusicSheetCalculator {
|
|
|
// override
|
|
|
}
|
|
|
|
|
|
- private calculateBeams(): void {
|
|
|
- for (let idx: number = 0, len: number = this.graphicalMusicSheet.MusicPages.length; idx < len; ++idx) {
|
|
|
- const musicPage: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
|
|
|
- for (let idx2: number = 0, len2: number = musicPage.MusicSystems.length; idx2 < len2; ++idx2) {
|
|
|
- const musicSystem: MusicSystem = musicPage.MusicSystems[idx2];
|
|
|
- for (let idx3: number = 0, len3: number = musicSystem.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
- const staffLine: StaffLine = musicSystem.StaffLines[idx3];
|
|
|
- for (let idx4: number = 0, len4: number = staffLine.Measures.length; idx4 < len4; ++idx4) {
|
|
|
- const measure: GraphicalMeasure = staffLine.Measures[idx4];
|
|
|
- for (let idx5: number = 0, len5: number = measure.staffEntries.length; idx5 < len5; ++idx5) {
|
|
|
- const staffEntry: GraphicalStaffEntry = measure.staffEntries[idx5];
|
|
|
- this.layoutBeams(staffEntry);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // does nothing for now, because layoutBeams() is an empty method
|
|
|
+ // private calculateBeams(): void {
|
|
|
+ // for (let idx2: number = 0, len2: number = this.musicSystems.length; idx2 < len2; ++idx2) {
|
|
|
+ // const musicSystem: MusicSystem = this.musicSystems[idx2];
|
|
|
+ // for (let idx3: number = 0, len3: number = musicSystem.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
+ // const staffLine: StaffLine = musicSystem.StaffLines[idx3];
|
|
|
+ // for (let idx4: number = 0, len4: number = staffLine.Measures.length; idx4 < len4; ++idx4) {
|
|
|
+ // const measure: GraphicalMeasure = staffLine.Measures[idx4];
|
|
|
+ // for (let idx5: number = 0, len5: number = measure.staffEntries.length; idx5 < len5; ++idx5) {
|
|
|
+ // const staffEntry: GraphicalStaffEntry = measure.staffEntries[idx5];
|
|
|
+ // this.layoutBeams(staffEntry);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
private calculateStaffEntryArticulationMarks(): void {
|
|
|
- for (let idx: number = 0, len: number = this.graphicalMusicSheet.MusicPages.length; idx < len; ++idx) {
|
|
|
- const page: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
|
|
|
- for (let idx2: number = 0, len2: number = page.MusicSystems.length; idx2 < len2; ++idx2) {
|
|
|
- const system: MusicSystem = page.MusicSystems[idx2];
|
|
|
- for (let idx3: number = 0, len3: number = system.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
- const line: StaffLine = system.StaffLines[idx3];
|
|
|
- for (let idx4: number = 0, len4: number = line.Measures.length; idx4 < len4; ++idx4) {
|
|
|
- const measure: GraphicalMeasure = line.Measures[idx4];
|
|
|
- for (let idx5: number = 0, len5: number = measure.staffEntries.length; idx5 < len5; ++idx5) {
|
|
|
- const graphicalStaffEntry: GraphicalStaffEntry = measure.staffEntries[idx5];
|
|
|
- for (let idx6: number = 0, len6: number = graphicalStaffEntry.sourceStaffEntry.VoiceEntries.length; idx6 < len6; ++idx6) {
|
|
|
- const voiceEntry: VoiceEntry = graphicalStaffEntry.sourceStaffEntry.VoiceEntries[idx6];
|
|
|
- if (voiceEntry.Articulations.length > 0) {
|
|
|
- this.layoutArticulationMarks(voiceEntry.Articulations, voiceEntry, graphicalStaffEntry);
|
|
|
- }
|
|
|
+ for (let idx2: number = 0, len2: number = this.musicSystems.length; idx2 < len2; ++idx2) {
|
|
|
+ const system: MusicSystem = this.musicSystems[idx2];
|
|
|
+ for (let idx3: number = 0, len3: number = system.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
+ const line: StaffLine = system.StaffLines[idx3];
|
|
|
+ for (let idx4: number = 0, len4: number = line.Measures.length; idx4 < len4; ++idx4) {
|
|
|
+ const measure: GraphicalMeasure = line.Measures[idx4];
|
|
|
+ for (let idx5: number = 0, len5: number = measure.staffEntries.length; idx5 < len5; ++idx5) {
|
|
|
+ const graphicalStaffEntry: GraphicalStaffEntry = measure.staffEntries[idx5];
|
|
|
+ for (let idx6: number = 0, len6: number = graphicalStaffEntry.sourceStaffEntry.VoiceEntries.length; idx6 < len6; ++idx6) {
|
|
|
+ const voiceEntry: VoiceEntry = graphicalStaffEntry.sourceStaffEntry.VoiceEntries[idx6];
|
|
|
+ if (voiceEntry.Articulations.length > 0) {
|
|
|
+ this.layoutArticulationMarks(voiceEntry.Articulations, voiceEntry, graphicalStaffEntry);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2225,26 +2169,23 @@ export abstract class MusicSheetCalculator {
|
|
|
}
|
|
|
|
|
|
private calculateOrnaments(): void {
|
|
|
- for (let idx: number = 0, len: number = this.graphicalMusicSheet.MusicPages.length; idx < len; ++idx) {
|
|
|
- const page: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
|
|
|
- for (let idx2: number = 0, len2: number = page.MusicSystems.length; idx2 < len2; ++idx2) {
|
|
|
- const system: MusicSystem = page.MusicSystems[idx2];
|
|
|
- for (let idx3: number = 0, len3: number = system.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
- const line: StaffLine = system.StaffLines[idx3];
|
|
|
- for (let idx4: number = 0, len4: number = line.Measures.length; idx4 < len4; ++idx4) {
|
|
|
- const measure: GraphicalMeasure = line.Measures[idx4];
|
|
|
- for (let idx5: number = 0, len5: number = measure.staffEntries.length; idx5 < len5; ++idx5) {
|
|
|
- const graphicalStaffEntry: GraphicalStaffEntry = measure.staffEntries[idx5];
|
|
|
- for (let idx6: number = 0, len6: number = graphicalStaffEntry.sourceStaffEntry.VoiceEntries.length; idx6 < len6; ++idx6) {
|
|
|
- const voiceEntry: VoiceEntry = graphicalStaffEntry.sourceStaffEntry.VoiceEntries[idx6];
|
|
|
- if (voiceEntry.OrnamentContainer !== undefined) {
|
|
|
- if (voiceEntry.hasTie() && !graphicalStaffEntry.relInMeasureTimestamp.Equals(voiceEntry.Timestamp)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- this.layoutOrnament(voiceEntry.OrnamentContainer, voiceEntry, graphicalStaffEntry);
|
|
|
- if (!(this.staffEntriesWithOrnaments.indexOf(graphicalStaffEntry) !== -1)) {
|
|
|
- this.staffEntriesWithOrnaments.push(graphicalStaffEntry);
|
|
|
- }
|
|
|
+ for (let idx2: number = 0, len2: number = this.musicSystems.length; idx2 < len2; ++idx2) {
|
|
|
+ const system: MusicSystem = this.musicSystems[idx2];
|
|
|
+ for (let idx3: number = 0, len3: number = system.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
+ const line: StaffLine = system.StaffLines[idx3];
|
|
|
+ for (let idx4: number = 0, len4: number = line.Measures.length; idx4 < len4; ++idx4) {
|
|
|
+ const measure: GraphicalMeasure = line.Measures[idx4];
|
|
|
+ for (let idx5: number = 0, len5: number = measure.staffEntries.length; idx5 < len5; ++idx5) {
|
|
|
+ const graphicalStaffEntry: GraphicalStaffEntry = measure.staffEntries[idx5];
|
|
|
+ for (let idx6: number = 0, len6: number = graphicalStaffEntry.sourceStaffEntry.VoiceEntries.length; idx6 < len6; ++idx6) {
|
|
|
+ const voiceEntry: VoiceEntry = graphicalStaffEntry.sourceStaffEntry.VoiceEntries[idx6];
|
|
|
+ if (voiceEntry.OrnamentContainer !== undefined) {
|
|
|
+ if (voiceEntry.hasTie() && !graphicalStaffEntry.relInMeasureTimestamp.Equals(voiceEntry.Timestamp)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ this.layoutOrnament(voiceEntry.OrnamentContainer, voiceEntry, graphicalStaffEntry);
|
|
|
+ if (!(this.staffEntriesWithOrnaments.indexOf(graphicalStaffEntry) !== -1)) {
|
|
|
+ this.staffEntriesWithOrnaments.push(graphicalStaffEntry);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2255,18 +2196,15 @@ export abstract class MusicSheetCalculator {
|
|
|
}
|
|
|
|
|
|
private optimizeRestPlacement(): void {
|
|
|
- for (let idx: number = 0, len: number = this.graphicalMusicSheet.MusicPages.length; idx < len; ++idx) {
|
|
|
- const page: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
|
|
|
- for (let idx2: number = 0, len2: number = page.MusicSystems.length; idx2 < len2; ++idx2) {
|
|
|
- const system: MusicSystem = page.MusicSystems[idx2];
|
|
|
- for (let idx3: number = 0, len3: number = system.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
- const line: StaffLine = system.StaffLines[idx3];
|
|
|
- for (let idx4: number = 0, len4: number = line.Measures.length; idx4 < len4; ++idx4) {
|
|
|
- const measure: GraphicalMeasure = line.Measures[idx4];
|
|
|
- for (let idx5: number = 0, len5: number = measure.staffEntries.length; idx5 < len5; ++idx5) {
|
|
|
- const graphicalStaffEntry: GraphicalStaffEntry = measure.staffEntries[idx5];
|
|
|
- this.optimizeRestNotePlacement(graphicalStaffEntry, measure);
|
|
|
- }
|
|
|
+ for (let idx2: number = 0, len2: number = this.musicSystems.length; idx2 < len2; ++idx2) {
|
|
|
+ const system: MusicSystem = this.musicSystems[idx2];
|
|
|
+ for (let idx3: number = 0, len3: number = system.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
+ const line: StaffLine = system.StaffLines[idx3];
|
|
|
+ for (let idx4: number = 0, len4: number = line.Measures.length; idx4 < len4; ++idx4) {
|
|
|
+ const measure: GraphicalMeasure = line.Measures[idx4];
|
|
|
+ for (let idx5: number = 0, len5: number = measure.staffEntries.length; idx5 < len5; ++idx5) {
|
|
|
+ const graphicalStaffEntry: GraphicalStaffEntry = measure.staffEntries[idx5];
|
|
|
+ this.optimizeRestNotePlacement(graphicalStaffEntry, measure);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2333,26 +2271,23 @@ export abstract class MusicSheetCalculator {
|
|
|
}
|
|
|
|
|
|
private calculateTieCurves(): void {
|
|
|
- for (let idx: number = 0, len: number = this.graphicalMusicSheet.MusicPages.length; idx < len; ++idx) {
|
|
|
- const graphicalMusicPage: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
|
|
|
- for (let idx2: number = 0, len2: number = graphicalMusicPage.MusicSystems.length; idx2 < len2; ++idx2) {
|
|
|
- const musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
|
|
|
- for (let idx3: number = 0, len3: number = musicSystem.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
- const staffLine: StaffLine = musicSystem.StaffLines[idx3];
|
|
|
- for (let idx4: number = 0, len5: number = staffLine.Measures.length; idx4 < len5; ++idx4) {
|
|
|
- const measure: GraphicalMeasure = staffLine.Measures[idx4];
|
|
|
- for (let idx6: number = 0, len6: number = measure.staffEntries.length; idx6 < len6; ++idx6) {
|
|
|
- const staffEntry: GraphicalStaffEntry = measure.staffEntries[idx6];
|
|
|
- const graphicalTies: GraphicalTie[] = staffEntry.GraphicalTies;
|
|
|
- for (let idx7: number = 0, len7: number = graphicalTies.length; idx7 < len7; ++idx7) {
|
|
|
- const graphicalTie: GraphicalTie = graphicalTies[idx7];
|
|
|
- if (graphicalTie.StartNote !== undefined && graphicalTie.StartNote.parentVoiceEntry.parentStaffEntry === staffEntry) {
|
|
|
- const tieIsAtSystemBreak: boolean = (
|
|
|
- graphicalTie.StartNote.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentStaffLine !==
|
|
|
- graphicalTie.EndNote.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentStaffLine
|
|
|
- );
|
|
|
- this.layoutGraphicalTie(graphicalTie, tieIsAtSystemBreak);
|
|
|
- }
|
|
|
+ for (let idx2: number = 0, len2: number = this.musicSystems.length; idx2 < len2; ++idx2) {
|
|
|
+ const musicSystem: MusicSystem = this.musicSystems[idx2];
|
|
|
+ for (let idx3: number = 0, len3: number = musicSystem.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
+ const staffLine: StaffLine = musicSystem.StaffLines[idx3];
|
|
|
+ for (let idx4: number = 0, len5: number = staffLine.Measures.length; idx4 < len5; ++idx4) {
|
|
|
+ const measure: GraphicalMeasure = staffLine.Measures[idx4];
|
|
|
+ for (let idx6: number = 0, len6: number = measure.staffEntries.length; idx6 < len6; ++idx6) {
|
|
|
+ const staffEntry: GraphicalStaffEntry = measure.staffEntries[idx6];
|
|
|
+ const graphicalTies: GraphicalTie[] = staffEntry.GraphicalTies;
|
|
|
+ for (let idx7: number = 0, len7: number = graphicalTies.length; idx7 < len7; ++idx7) {
|
|
|
+ const graphicalTie: GraphicalTie = graphicalTies[idx7];
|
|
|
+ if (graphicalTie.StartNote !== undefined && graphicalTie.StartNote.parentVoiceEntry.parentStaffEntry === staffEntry) {
|
|
|
+ const tieIsAtSystemBreak: boolean = (
|
|
|
+ graphicalTie.StartNote.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentStaffLine !==
|
|
|
+ graphicalTie.EndNote.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentStaffLine
|
|
|
+ );
|
|
|
+ this.layoutGraphicalTie(graphicalTie, tieIsAtSystemBreak);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2371,28 +2306,22 @@ export abstract class MusicSheetCalculator {
|
|
|
}
|
|
|
}
|
|
|
// first calc lyrics text positions
|
|
|
- for (let idx: number = 0, len: number = this.graphicalMusicSheet.MusicPages.length; idx < len; ++idx) {
|
|
|
- const graphicalMusicPage: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
|
|
|
- for (let idx2: number = 0, len2: number = graphicalMusicPage.MusicSystems.length; idx2 < len2; ++idx2) {
|
|
|
- const musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
|
|
|
- for (let idx3: number = 0, len3: number = musicSystem.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
- const staffLine: StaffLine = musicSystem.StaffLines[idx3];
|
|
|
- const lyricsStaffEntries: GraphicalStaffEntry[] =
|
|
|
- this.calculateSingleStaffLineLyricsPosition(staffLine, staffLine.ParentStaff.ParentInstrument.LyricVersesNumbers);
|
|
|
- lyricStaffEntriesDict.setValue(staffLine, lyricsStaffEntries);
|
|
|
- this.calculateLyricsExtendsAndDashes(lyricStaffEntriesDict.getValue(staffLine));
|
|
|
- }
|
|
|
+ for (let idx2: number = 0, len2: number = this.musicSystems.length; idx2 < len2; ++idx2) {
|
|
|
+ const musicSystem: MusicSystem = this.musicSystems[idx2];
|
|
|
+ for (let idx3: number = 0, len3: number = musicSystem.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
+ const staffLine: StaffLine = musicSystem.StaffLines[idx3];
|
|
|
+ const lyricsStaffEntries: GraphicalStaffEntry[] =
|
|
|
+ this.calculateSingleStaffLineLyricsPosition(staffLine, staffLine.ParentStaff.ParentInstrument.LyricVersesNumbers);
|
|
|
+ lyricStaffEntriesDict.setValue(staffLine, lyricsStaffEntries);
|
|
|
+ this.calculateLyricsExtendsAndDashes(lyricStaffEntriesDict.getValue(staffLine));
|
|
|
}
|
|
|
}
|
|
|
// then fill in the lyric word dashes and lyrics extends/underscores
|
|
|
- for (let idx: number = 0, len: number = this.graphicalMusicSheet.MusicPages.length; idx < len; ++idx) {
|
|
|
- const graphicalMusicPage: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
|
|
|
- for (let idx2: number = 0, len2: number = graphicalMusicPage.MusicSystems.length; idx2 < len2; ++idx2) {
|
|
|
- const musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
|
|
|
- for (let idx3: number = 0, len3: number = musicSystem.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
- const staffLine: StaffLine = musicSystem.StaffLines[idx3];
|
|
|
- this.calculateLyricsExtendsAndDashes(lyricStaffEntriesDict.getValue(staffLine));
|
|
|
- }
|
|
|
+ for (let idx2: number = 0, len2: number = this.musicSystems.length; idx2 < len2; ++idx2) {
|
|
|
+ const musicSystem: MusicSystem = this.musicSystems[idx2];
|
|
|
+ for (let idx3: number = 0, len3: number = musicSystem.StaffLines.length; idx3 < len3; ++idx3) {
|
|
|
+ const staffLine: StaffLine = musicSystem.StaffLines[idx3];
|
|
|
+ this.calculateLyricsExtendsAndDashes(lyricStaffEntriesDict.getValue(staffLine));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2459,7 +2388,8 @@ export abstract class MusicSheetCalculator {
|
|
|
this.calculateDashes(startStaffLine, startX, endX, y);
|
|
|
|
|
|
// calculate Dashes for the second StaffLine (only if endStaffEntry isn't the first StaffEntry of the StaffLine)
|
|
|
- if (nextStaffLine &&
|
|
|
+ if (nextStaffLine && // check for undefined objects e.g. when drawingRange given
|
|
|
+ nextStaffLine.Measures[0] &&
|
|
|
endStaffentry.parentMeasure.ParentStaffLine &&
|
|
|
!(endStaffentry === endStaffentry.parentMeasure.staffEntries[0] &&
|
|
|
endStaffentry.parentMeasure === endStaffentry.parentMeasure.ParentStaffLine.Measures[0])) {
|