VexFlowMeasure.d.ts 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import Vex = require("vexflow");
  2. import { StaffMeasure } from "../StaffMeasure";
  3. import { SourceMeasure } from "../../VoiceData/SourceMeasure";
  4. import { Staff } from "../../VoiceData/Staff";
  5. import { StaffLine } from "../StaffLine";
  6. import { SystemLinesEnum } from "../SystemLinesEnum";
  7. import { ClefInstruction } from "../../VoiceData/Instructions/ClefInstruction";
  8. import { KeyInstruction } from "../../VoiceData/Instructions/KeyInstruction";
  9. import { RhythmInstruction } from "../../VoiceData/Instructions/RhythmInstruction";
  10. import { Beam } from "../../VoiceData/Beam";
  11. import { GraphicalNote } from "../GraphicalNote";
  12. import { GraphicalStaffEntry } from "../GraphicalStaffEntry";
  13. export declare class VexFlowMeasure extends StaffMeasure {
  14. constructor(staff: Staff, staffLine?: StaffLine, sourceMeasure?: SourceMeasure);
  15. octaveOffset: number;
  16. vfVoices: {
  17. [voiceID: number]: Vex.Flow.Voice;
  18. };
  19. formatVoices: (width: number) => void;
  20. private stave;
  21. private connectors;
  22. private beams;
  23. private vfbeams;
  24. setAbsoluteCoordinates(x: number, y: number): void;
  25. /**
  26. * Reset all the geometric values and parameters of this measure and put it in an initialized state.
  27. * This is needed to evaluate a measure a second time by system builder.
  28. */
  29. resetLayout(): void;
  30. clean(): void;
  31. /**
  32. * returns the x-width of a given measure line.
  33. * @param line
  34. * @returns {SystemLinesEnum} the x-width
  35. */
  36. getLineWidth(line: SystemLinesEnum): number;
  37. /**
  38. * adds the given clef to the begin of the measure.
  39. * This has to update/increase BeginInstructionsWidth.
  40. * @param clef
  41. */
  42. addClefAtBegin(clef: ClefInstruction): void;
  43. /**
  44. * adds the given key to the begin of the measure.
  45. * This has to update/increase BeginInstructionsWidth.
  46. * @param currentKey the new valid key.
  47. * @param previousKey the old cancelled key. Needed to show which accidentals are not valid any more.
  48. * @param currentClef the valid clef. Needed to put the accidentals on the right y-positions.
  49. */
  50. addKeyAtBegin(currentKey: KeyInstruction, previousKey: KeyInstruction, currentClef: ClefInstruction): void;
  51. /**
  52. * adds the given rhythm to the begin of the measure.
  53. * This has to update/increase BeginInstructionsWidth.
  54. * @param rhythm
  55. */
  56. addRhythmAtBegin(rhythm: RhythmInstruction): void;
  57. /**
  58. * adds the given clef to the end of the measure.
  59. * This has to update/increase EndInstructionsWidth.
  60. * @param clef
  61. */
  62. addClefAtEnd(clef: ClefInstruction): void;
  63. /**
  64. * Sets the overall x-width of the measure.
  65. * @param width
  66. */
  67. setWidth(width: number): void;
  68. /**
  69. * This method is called after the StaffEntriesScaleFactor has been set.
  70. * Here the final x-positions of the staff entries have to be set.
  71. * (multiply the minimal positions with the scaling factor, considering the BeginInstructionsWidth)
  72. */
  73. layoutSymbols(): void;
  74. /**
  75. * Draw this measure on a VexFlow CanvasContext
  76. * @param ctx
  77. */
  78. draw(ctx: Vex.Flow.CanvasContext): void;
  79. /**
  80. * Add a note to a beam
  81. * @param graphicalNote
  82. * @param beam
  83. */
  84. handleBeam(graphicalNote: GraphicalNote, beam: Beam): void;
  85. /**
  86. * Complete the creation of VexFlow Beams in this measure
  87. */
  88. finalizeBeams(): void;
  89. layoutStaffEntry(graphicalStaffEntry: GraphicalStaffEntry): void;
  90. /**
  91. * Creates a line from 'top' to this measure, of type 'lineType'
  92. * @param top
  93. * @param lineType
  94. */
  95. lineTo(top: VexFlowMeasure, lineType: any): void;
  96. getVFStave(): Vex.Flow.Stave;
  97. private updateInstructionWidth();
  98. }