|
@@ -9,6 +9,8 @@ import { Dictionary } from "typescript-collections";
|
|
import { FontStyles } from "../../Common/Enums";
|
|
import { FontStyles } from "../../Common/Enums";
|
|
import { NoteEnum } from "../../Common/DataObjects/Pitch";
|
|
import { NoteEnum } from "../../Common/DataObjects/Pitch";
|
|
import { ChordSymbolEnum, CustomChord, DegreesInfo } from "../../MusicalScore/VoiceData/ChordSymbolContainer";
|
|
import { ChordSymbolEnum, CustomChord, DegreesInfo } from "../../MusicalScore/VoiceData/ChordSymbolContainer";
|
|
|
|
+import { GraphicalNote } from "./GraphicalNote";
|
|
|
|
+import { Note } from "../VoiceData/Note";
|
|
|
|
|
|
export class EngravingRules {
|
|
export class EngravingRules {
|
|
/** A unit of distance. 1.0 is the distance between lines of a stave for OSMD, which is 10 pixels in Vexflow. */
|
|
/** A unit of distance. 1.0 is the distance between lines of a stave for OSMD, which is 10 pixels in Vexflow. */
|
|
@@ -270,6 +272,10 @@ export class EngravingRules {
|
|
public StretchLastSystemLine: boolean;
|
|
public StretchLastSystemLine: boolean;
|
|
public SpacingBetweenTextLines: number;
|
|
public SpacingBetweenTextLines: number;
|
|
|
|
|
|
|
|
+ public NoteToGraphicalNoteMap: Dictionary<number, GraphicalNote>;
|
|
|
|
+ // this is basically a WeakMap, except we save the id in the Note instead of using a WeakMap.
|
|
|
|
+ public NoteToGraphicalNoteMapObjectCount: number = 0;
|
|
|
|
+
|
|
public static FixStafflineBoundingBox: boolean; // TODO temporary workaround
|
|
public static FixStafflineBoundingBox: boolean; // TODO temporary workaround
|
|
|
|
|
|
constructor() {
|
|
constructor() {
|
|
@@ -558,6 +564,8 @@ export class EngravingRules {
|
|
this.RenderSingleHorizontalStaffline = false;
|
|
this.RenderSingleHorizontalStaffline = false;
|
|
this.SpacingBetweenTextLines = 0;
|
|
this.SpacingBetweenTextLines = 0;
|
|
|
|
|
|
|
|
+ this.NoteToGraphicalNoteMap = new Dictionary<number, GraphicalNote>();
|
|
|
|
+
|
|
// this.populateDictionaries(); // these values aren't used currently
|
|
// this.populateDictionaries(); // these values aren't used currently
|
|
try {
|
|
try {
|
|
this.MaxInstructionsConstValue = this.ClefLeftMargin + this.ClefRightMargin + this.KeyRightMargin + this.RhythmRightMargin + 11;
|
|
this.MaxInstructionsConstValue = this.ClefLeftMargin + this.ClefRightMargin + this.KeyRightMargin + this.RhythmRightMargin + 11;
|
|
@@ -571,6 +579,16 @@ export class EngravingRules {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public addGraphicalNoteToNoteMap(note: Note, graphicalNote: GraphicalNote): void {
|
|
|
|
+ note.NoteToGraphicalNoteObjectId = this.NoteToGraphicalNoteMapObjectCount;
|
|
|
|
+ this.NoteToGraphicalNoteMap.setValue(note.NoteToGraphicalNoteObjectId, graphicalNote);
|
|
|
|
+ this.NoteToGraphicalNoteMapObjectCount++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public clearObjects(): void {
|
|
|
|
+ this.NoteToGraphicalNoteMap = new Dictionary<number, GraphicalNote>();
|
|
|
|
+ }
|
|
|
|
+
|
|
public setChordSymbolLabelText(key: ChordSymbolEnum, value: string): void {
|
|
public setChordSymbolLabelText(key: ChordSymbolEnum, value: string): void {
|
|
this.ChordSymbolLabelTexts.setValue(key, value);
|
|
this.ChordSymbolLabelTexts.setValue(key, value);
|
|
}
|
|
}
|