smoosic 1.0.40 → 1.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/smoosic.js +3 -3
- package/package.json +1 -1
- package/release/smoosic.js +3 -3
- package/src/smo/data/scoreModifiers.ts +2 -2
- package/src/ui/components/dialogs/timeSignature.vue +25 -4
- package/types/src/application/application.d.ts +103 -102
- package/types/src/application/common.d.ts +6 -0
- package/types/src/application/configuration.d.ts +75 -75
- package/types/src/application/dynamicInit.d.ts +6 -6
- package/types/src/application/eventHandler.d.ts +87 -81
- package/types/src/application/exports.d.ts +482 -485
- package/types/src/render/audio/oscillator.d.ts +99 -99
- package/types/src/render/audio/player.d.ts +143 -143
- package/types/src/render/audio/samples.d.ts +56 -56
- package/types/src/render/sui/NoteEntryCaret.d.ts +107 -0
- package/types/src/render/sui/NoteEntryMediator.d.ts +24 -0
- package/types/src/render/sui/configuration.d.ts +53 -49
- package/types/src/render/sui/formatter.d.ts +163 -161
- package/types/src/render/sui/layoutDebug.d.ts +46 -46
- package/types/src/render/sui/mapper.d.ts +138 -135
- package/types/src/render/sui/renderState.d.ts +92 -90
- package/types/src/render/sui/scoreRender.d.ts +97 -96
- package/types/src/render/sui/scoreView.d.ts +280 -279
- package/types/src/render/sui/scoreViewOperations.d.ts +604 -594
- package/types/src/render/sui/scroller.d.ts +41 -41
- package/types/src/render/sui/svgPageMap.d.ts +344 -344
- package/types/src/render/sui/textEdit.d.ts +316 -316
- package/types/src/render/sui/tracker.d.ts +10 -4
- package/types/src/render/vex/vxMeasure.d.ts +97 -97
- package/types/src/smo/data/common.d.ts +220 -220
- package/types/src/smo/data/measure.d.ts +511 -511
- package/types/src/smo/data/measureModifiers.d.ts +509 -508
- package/types/src/smo/data/music.d.ts +2 -1
- package/types/src/smo/data/note.d.ts +2 -0
- package/types/src/smo/data/noteModifiers.d.ts +2 -0
- package/types/src/smo/data/score.d.ts +7 -5
- package/types/src/smo/data/scoreModifiers.d.ts +441 -440
- package/types/src/smo/data/systemStaff.d.ts +2 -2
- package/types/src/smo/data/tuplet.d.ts +7 -0
- package/types/src/smo/midi/midiToSmo.d.ts +12 -12
- package/types/src/smo/midi/smoToMidi.d.ts +3 -3
- package/types/src/smo/mxml/smoToXml.d.ts +4 -4
- package/types/src/smo/mxml/xmlState.d.ts +3 -3
- package/types/src/smo/mxml/xmlToSmo.d.ts +2 -2
- package/types/src/smo/xform/operations.d.ts +3 -3
- package/types/src/smo/xform/selections.d.ts +154 -154
- package/types/src/ui/buttons/display.d.ts +1 -0
- package/types/src/ui/common.d.ts +69 -67
- package/types/src/ui/composable/draggable.d.ts +1 -1
- package/types/src/ui/configuration.d.ts +30 -30
- package/types/src/ui/dialogs/chordChange.d.ts +35 -35
- package/types/src/ui/dialogs/components/baseComponent.d.ts +158 -158
- package/types/src/ui/dialogs/components/button.d.ts +54 -54
- package/types/src/ui/dialogs/components/dropdown.d.ts +78 -78
- package/types/src/ui/dialogs/components/pitch.d.ts +95 -95
- package/types/src/ui/dialogs/components/rocker.d.ts +66 -66
- package/types/src/ui/dialogs/components/textInPlace.d.ts +90 -90
- package/types/src/ui/dialogs/components/textInput.d.ts +58 -58
- package/types/src/ui/dialogs/components/toggle.d.ts +53 -53
- package/types/src/ui/dialogs/dialog.d.ts +203 -203
- package/types/src/ui/dialogs/endings.d.ts +2 -2
- package/types/src/ui/dialogs/lyric.d.ts +39 -39
- package/types/src/ui/dialogs/measureFormat.d.ts +2 -2
- package/types/src/ui/dialogs/tempo.d.ts +3 -3
- package/types/src/ui/dialogs/textBlock.d.ts +55 -61
- package/types/src/ui/dialogs/timeSignature.d.ts +2 -34
- package/types/src/ui/exceptions.d.ts +15 -15
- package/types/src/ui/help.d.ts +6 -1
- package/types/src/ui/menus/manager.d.ts +59 -59
- package/types/src/ui/navigation.d.ts +44 -37
- package/types/typedoc.d.ts +157 -157
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { SvgBox, Ticks, Transposable } from "../../smo/data/common";
|
|
2
|
+
import { SuiTracker } from "./tracker";
|
|
3
|
+
import { SmoSelection } from "../../smo/xform/selections";
|
|
4
|
+
import { SvgPage } from "./svgPageMap";
|
|
5
|
+
import { SmoNote } from "../../smo/data/note";
|
|
6
|
+
import { SuiScoreViewOperations } from "./scoreViewOperations";
|
|
7
|
+
import { SmoGraceNote } from "../../smo/data/noteModifiers";
|
|
8
|
+
import { CaretDelegate } from "./NoteEntryMediator";
|
|
9
|
+
type PitchHighlightType = 'selection' | 'drag-init';
|
|
10
|
+
export declare class NoteEntryCaret {
|
|
11
|
+
static readonly STAFF_LINE_HEIGHT = 10;
|
|
12
|
+
static readonly STAFF_LINE_COUNT = 5;
|
|
13
|
+
static readonly STAFF_HEIGHT: number;
|
|
14
|
+
static readonly LEDGER_POSITIONS_ABOVE = 6;
|
|
15
|
+
static readonly LEDGER_POSITIONS_BELOW = 6;
|
|
16
|
+
static readonly CARET_HEIGHT: number;
|
|
17
|
+
static readonly PITCH_SELECTION_COLOR = "#933";
|
|
18
|
+
static readonly PITCH_DRAG_ORIGINAL_COLOR = "#aaaaaa7f";
|
|
19
|
+
static readonly VOICE_1_NOTEHEAD_COLOR = "#000000";
|
|
20
|
+
static readonly VOICE_2_NOTEHEAD_COLOR = "#115511";
|
|
21
|
+
static readonly VOICE_3_NOTEHEAD_COLOR = "#555511";
|
|
22
|
+
static readonly VOICE_4_NOTEHEAD_COLOR = "#883344";
|
|
23
|
+
static readonly VOICE_1_PREVIEW_NOTEHEAD_COLOR = "#808080";
|
|
24
|
+
static readonly VOICE_2_PREVIEW_NOTEHEAD_COLOR = "#88aa88";
|
|
25
|
+
static readonly VOICE_3_PREVIEW_NOTEHEAD_COLOR = "#aaaa88";
|
|
26
|
+
static readonly VOICE_4_PREVIEW_NOTEHEAD_COLOR = "#c499a2";
|
|
27
|
+
static readonly VOICE_1_CURSOR_RECTANGLE_COLOR = "#99aadd";
|
|
28
|
+
static readonly VOICE_2_CURSOR_RECTANGLE_COLOR = "#99dd99";
|
|
29
|
+
static readonly VOICE_3_CURSOR_RECTANGLE_COLOR = "#dddd99";
|
|
30
|
+
static readonly VOICE_4_CURSOR_RECTANGLE_COLOR = "#dd99aa";
|
|
31
|
+
static readonly DEFAULT_NOTE_DURATION: Ticks;
|
|
32
|
+
static readonly DEFAULT_NOTE_MODE: 'note' | 'rest';
|
|
33
|
+
caretBoundaryBox: SvgBox;
|
|
34
|
+
tracker: SuiTracker;
|
|
35
|
+
view: SuiScoreViewOperations;
|
|
36
|
+
selection: SmoSelection | null;
|
|
37
|
+
pageDimensions: SvgBox;
|
|
38
|
+
note: SmoNote | null;
|
|
39
|
+
graceNote: SmoGraceNote | null;
|
|
40
|
+
activeNote: Transposable | null;
|
|
41
|
+
voice: number;
|
|
42
|
+
vexNoteAbsoluteX: number;
|
|
43
|
+
vexNoteLeftDisplacedHeadPx: number;
|
|
44
|
+
vexNoteRightDisplacedHeadPx: number;
|
|
45
|
+
vexNoteHeadWidth: number;
|
|
46
|
+
vexNoteXShift: number;
|
|
47
|
+
context: SvgPage | undefined;
|
|
48
|
+
mode: 'note' | 'rest';
|
|
49
|
+
duration: Ticks;
|
|
50
|
+
cursorRectangleElement: SVGRectElement | null;
|
|
51
|
+
pitchPreviewElement: SVGTextElement | null;
|
|
52
|
+
pitchPreviewLedgerElements: SVGLineElement[];
|
|
53
|
+
pitchSelectionElementId: string | null;
|
|
54
|
+
pitchDragInitElementId: string | null;
|
|
55
|
+
currentStaffLine: number | null;
|
|
56
|
+
occupiedStaffLines: number[];
|
|
57
|
+
staffLineOnMouseUp: number | null;
|
|
58
|
+
staffLineOnMouseDown: number | null;
|
|
59
|
+
delegate: CaretDelegate | null;
|
|
60
|
+
constructor(view: SuiScoreViewOperations, tracker: SuiTracker);
|
|
61
|
+
setSelection(selection: SmoSelection, graceNote?: SmoGraceNote | null): void;
|
|
62
|
+
handleMouseDown(ev: any): void;
|
|
63
|
+
handleMouseMove(ev: any): void;
|
|
64
|
+
handleMouseUp(ev: any): void;
|
|
65
|
+
handleMouseClick(ev: any): void;
|
|
66
|
+
private _calculateDisplacedHeadPosition;
|
|
67
|
+
private _unsetPreviousSelection;
|
|
68
|
+
render(): void;
|
|
69
|
+
private _calculateCaretBoundaryBoxCoordinates;
|
|
70
|
+
private _fillOccupiedStaffLines;
|
|
71
|
+
private _addOccupiedStaffLine;
|
|
72
|
+
private _removeOccupiedStaffLine;
|
|
73
|
+
private _getPitchesFromOccupiedStaffLines;
|
|
74
|
+
private _renderCursorRectangleElement;
|
|
75
|
+
private _getCursorRectangleElement;
|
|
76
|
+
containsPoint(ev: any): boolean;
|
|
77
|
+
private _renderPitchPreview;
|
|
78
|
+
private _unrenderPitchPreview;
|
|
79
|
+
renderPitchHighlight(pitchIndex: number, highlightType?: PitchHighlightType): void;
|
|
80
|
+
private _highlightNoteHead;
|
|
81
|
+
/**
|
|
82
|
+
* Unrenders both pitch selection and drag-init highlights
|
|
83
|
+
*/
|
|
84
|
+
private _unrenderPitchHighlight;
|
|
85
|
+
/**
|
|
86
|
+
* Unrenders only the pitch selection highlight (persistent red highlight)
|
|
87
|
+
*/
|
|
88
|
+
private _unrenderPitchSelectionHighlight;
|
|
89
|
+
/**
|
|
90
|
+
* Unrenders only the drag-init highlight (temporary highlight during drag)
|
|
91
|
+
*/
|
|
92
|
+
private _unrenderPitchDragInitHighlight;
|
|
93
|
+
private _getPitchPreviewElement;
|
|
94
|
+
private _getVoiceNoteheadColor;
|
|
95
|
+
private _getVoicePreviewColor;
|
|
96
|
+
private _getVoiceCursorRectangleColor;
|
|
97
|
+
private _getLedgerLinePositions;
|
|
98
|
+
private _createLedgerLineElement;
|
|
99
|
+
private _calculateStaffLineFromY;
|
|
100
|
+
private _calculateYFromStaffLine;
|
|
101
|
+
private _unrender;
|
|
102
|
+
resetInteraction(): void;
|
|
103
|
+
private _getActiveVexNote;
|
|
104
|
+
private static _hasMultipleNoteHeadsOnSameLine;
|
|
105
|
+
private _findPitchIndexForStaffLineAndMouseX;
|
|
106
|
+
}
|
|
107
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SmoSelection } from "../../smo/xform/selections";
|
|
2
|
+
import { SmoGraceNote } from "../../smo/data/noteModifiers";
|
|
3
|
+
import { Pitch } from "../../smo/data/common";
|
|
4
|
+
import { SuiTracker } from "./tracker";
|
|
5
|
+
import { NoteEntryCaret } from "./NoteEntryCaret";
|
|
6
|
+
import { SuiScoreViewOperations } from "./scoreViewOperations";
|
|
7
|
+
export interface TrackerDelegate {
|
|
8
|
+
onPitchIndexChanged(pitchIndex: number): void;
|
|
9
|
+
onSingleNoteHighlighted(selection: SmoSelection, graceNote: SmoGraceNote | null): void;
|
|
10
|
+
}
|
|
11
|
+
export interface CaretDelegate {
|
|
12
|
+
onPitchClicked(pitchIndex: number): void;
|
|
13
|
+
onPitchesChanged(newPitches: Pitch[]): void;
|
|
14
|
+
}
|
|
15
|
+
export declare class NoteEntryMediator implements TrackerDelegate, CaretDelegate {
|
|
16
|
+
private tracker;
|
|
17
|
+
private caret;
|
|
18
|
+
private view;
|
|
19
|
+
constructor(tracker: SuiTracker, caret: NoteEntryCaret, view: SuiScoreViewOperations);
|
|
20
|
+
onPitchIndexChanged(pitchIndex: number): void;
|
|
21
|
+
onSingleNoteHighlighted(selection: SmoSelection, graceNote: SmoGraceNote | null): void;
|
|
22
|
+
onPitchClicked(pitchIndex: number): void;
|
|
23
|
+
onPitchesChanged(newPitches: Pitch[]): void;
|
|
24
|
+
}
|
|
@@ -1,49 +1,53 @@
|
|
|
1
|
-
import { SuiAudioAnimationParams } from '../audio/musicCursor';
|
|
2
|
-
/**
|
|
3
|
-
* An application can use attach the scroll container to the scroll handler to get scroll events.
|
|
4
|
-
*/
|
|
5
|
-
export type scrollHandler = (ev: any) => void;
|
|
6
|
-
export type debugFlag = 'mouse' | 'drag' | 'scroll';
|
|
7
|
-
export type debugFlags = ['mouse', 'drag', 'scroll'];
|
|
8
|
-
/**
|
|
9
|
-
* Base class for score DOM navigation.
|
|
10
|
-
*
|
|
11
|
-
* - scrollContainer is the container that scrolls and contains the score
|
|
12
|
-
* - outerContainer is the container for the entire UI, including menus, controls, and the scroll container.
|
|
13
|
-
* in library mode, outerContainer is just the container for the score.
|
|
14
|
-
* - scoreContainer is inside the scrollContainer. It contains the container div and svg for the score pages
|
|
15
|
-
* - displayMode is a string that can be used to switch between different display modes (e.g. vertical, horizontal)
|
|
16
|
-
* - initialize is called by the application to create the DOM
|
|
17
|
-
* - isInitialized is a sanity check, if you try to use the DOM and it is not initialized it will throw an error
|
|
18
|
-
* - pushScrollHandler and popScrollHandler are used to manage scroll handlers for the scroll container. The most recently added handler will be called on scroll events.
|
|
19
|
-
* - showSplashModal and hideSplashModal are used to show and hide the 'about' dialog
|
|
20
|
-
* - showDialogModal and hideDialogModal do you you'd expect, they are called as part of the dialog management functions
|
|
21
|
-
* - showDebugString is used to set and display debug flags. Calling with an empty string hides the debug region.
|
|
22
|
-
* @category SuiRender
|
|
23
|
-
*/
|
|
24
|
-
export interface SuiNavigation {
|
|
25
|
-
scrollContainer: HTMLElement;
|
|
26
|
-
outerContainer: string | HTMLElement | undefined;
|
|
27
|
-
scoreContainer: HTMLElement;
|
|
28
|
-
displayMode: string;
|
|
29
|
-
initialize: () => void;
|
|
30
|
-
isInitialized: () => boolean;
|
|
31
|
-
pushScrollHandler: (handler: scrollHandler) => void;
|
|
32
|
-
popScrollHandler: () => scrollHandler | undefined;
|
|
33
|
-
showSplashModal: (timer: number) => void;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
1
|
+
import { SuiAudioAnimationParams } from '../audio/musicCursor';
|
|
2
|
+
/**
|
|
3
|
+
* An application can use attach the scroll container to the scroll handler to get scroll events.
|
|
4
|
+
*/
|
|
5
|
+
export type scrollHandler = (ev: any) => void;
|
|
6
|
+
export type debugFlag = 'mouse' | 'drag' | 'scroll';
|
|
7
|
+
export type debugFlags = ['mouse', 'drag', 'scroll'];
|
|
8
|
+
/**
|
|
9
|
+
* Base class for score DOM navigation.
|
|
10
|
+
*
|
|
11
|
+
* - scrollContainer is the container that scrolls and contains the score
|
|
12
|
+
* - outerContainer is the container for the entire UI, including menus, controls, and the scroll container.
|
|
13
|
+
* in library mode, outerContainer is just the container for the score.
|
|
14
|
+
* - scoreContainer is inside the scrollContainer. It contains the container div and svg for the score pages
|
|
15
|
+
* - displayMode is a string that can be used to switch between different display modes (e.g. vertical, horizontal)
|
|
16
|
+
* - initialize is called by the application to create the DOM
|
|
17
|
+
* - isInitialized is a sanity check, if you try to use the DOM and it is not initialized it will throw an error
|
|
18
|
+
* - pushScrollHandler and popScrollHandler are used to manage scroll handlers for the scroll container. The most recently added handler will be called on scroll events.
|
|
19
|
+
* - showSplashModal and hideSplashModal are used to show and hide the 'about' dialog
|
|
20
|
+
* - showDialogModal and hideDialogModal do you you'd expect, they are called as part of the dialog management functions
|
|
21
|
+
* - showDebugString is used to set and display debug flags. Calling with an empty string hides the debug region.
|
|
22
|
+
* @category SuiRender
|
|
23
|
+
*/
|
|
24
|
+
export interface SuiNavigation {
|
|
25
|
+
scrollContainer: HTMLElement;
|
|
26
|
+
outerContainer: string | HTMLElement | undefined;
|
|
27
|
+
scoreContainer: HTMLElement;
|
|
28
|
+
displayMode: string;
|
|
29
|
+
initialize: () => void;
|
|
30
|
+
isInitialized: () => boolean;
|
|
31
|
+
pushScrollHandler: (handler: scrollHandler) => void;
|
|
32
|
+
popScrollHandler: () => scrollHandler | undefined;
|
|
33
|
+
showSplashModal: (timer: number) => void;
|
|
34
|
+
showProgressModal: (label: string) => void;
|
|
35
|
+
showHelpModal: () => void;
|
|
36
|
+
setProgress: (percent: number) => void;
|
|
37
|
+
hideProgressModal: () => void;
|
|
38
|
+
showDialogModal: () => void;
|
|
39
|
+
hideDialogModal: () => void;
|
|
40
|
+
displayExceptionDialog: (message: string) => void;
|
|
41
|
+
showDebugString: (flag: debugFlag, htmlString: string) => void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Define configurable rendering options
|
|
45
|
+
* @category SuiRender
|
|
46
|
+
* @module /render/sui/configuration
|
|
47
|
+
*/
|
|
48
|
+
export interface SmoRenderConfiguration {
|
|
49
|
+
demonPollTime: number;
|
|
50
|
+
idleRedrawTime: number;
|
|
51
|
+
audioAnimation: SuiAudioAnimationParams;
|
|
52
|
+
navigation: SuiNavigation;
|
|
53
|
+
}
|
|
@@ -1,161 +1,163 @@
|
|
|
1
|
-
import { SmoLyric } from '../../smo/data/noteModifiers';
|
|
2
|
-
import { SmoNote } from '../../smo/data/note';
|
|
3
|
-
import { SmoScore } from '../../smo/data/score';
|
|
4
|
-
import { layoutDebug } from './layoutDebug';
|
|
5
|
-
import { ScaledPageLayout } from '../../smo/data/scoreModifiers';
|
|
6
|
-
import { SmoMeasure, ISmoBeamGroup } from '../../smo/data/measure';
|
|
7
|
-
import {
|
|
8
|
-
import { SvgPageMap } from './svgPageMap';
|
|
9
|
-
import { TextFormatter } from '../../common/textformatter';
|
|
10
|
-
export interface SuiFormatterParameters {
|
|
11
|
-
score: SmoScore;
|
|
12
|
-
svg: SvgPageMap;
|
|
13
|
-
renderedPages: Record<number, RenderedPage | null>;
|
|
14
|
-
debug: layoutDebug;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* @category SuiRender
|
|
18
|
-
*/
|
|
19
|
-
export interface SuiTickContext {
|
|
20
|
-
widths: number[];
|
|
21
|
-
tickCounts: number[];
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Estimated x, y position of the measure
|
|
25
|
-
* @category SuiRender
|
|
26
|
-
*/
|
|
27
|
-
export interface MeasureEstimate {
|
|
28
|
-
measures: SmoMeasure[];
|
|
29
|
-
x: number;
|
|
30
|
-
y: number;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* @category SuiRender
|
|
34
|
-
*/
|
|
35
|
-
export interface LineRender {
|
|
36
|
-
systems: Record<number, SmoMeasure[]>;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Keep track of start/end measures on a page. If the page
|
|
40
|
-
* content doesn't change, and the measures don't change, we don't
|
|
41
|
-
* need to re-render the content
|
|
42
|
-
* @category SuiRender
|
|
43
|
-
*/
|
|
44
|
-
export interface RenderedPage {
|
|
45
|
-
startMeasure: number;
|
|
46
|
-
endMeasure: number;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Utilities for estimating measure/system/page width and height
|
|
50
|
-
* @category SuiRender
|
|
51
|
-
*/
|
|
52
|
-
export declare class SuiLayoutFormatter {
|
|
53
|
-
score: SmoScore;
|
|
54
|
-
systems: Record<number, LineRender>;
|
|
55
|
-
columnMeasureMap: Record<number, SmoMeasure[]>;
|
|
56
|
-
currentPage: number;
|
|
57
|
-
svg: SvgPageMap;
|
|
58
|
-
renderedPages: Record<number, RenderedPage | null>;
|
|
59
|
-
lines: number[];
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* @param
|
|
69
|
-
* @param
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* @param
|
|
78
|
-
* @param
|
|
79
|
-
* @
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
*
|
|
87
|
-
* @param
|
|
88
|
-
* @param
|
|
89
|
-
* @param
|
|
90
|
-
* @param
|
|
91
|
-
* @param
|
|
92
|
-
* @
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
*
|
|
98
|
-
* @
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
*
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
static
|
|
108
|
-
static
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* @param
|
|
120
|
-
* @param
|
|
121
|
-
* @param
|
|
122
|
-
* @param
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
*
|
|
129
|
-
* @
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* @param
|
|
142
|
-
* @param
|
|
143
|
-
* @param
|
|
144
|
-
* @param
|
|
145
|
-
* @param
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
1
|
+
import { SmoLyric } from '../../smo/data/noteModifiers';
|
|
2
|
+
import { SmoNote } from '../../smo/data/note';
|
|
3
|
+
import { SmoScore } from '../../smo/data/score';
|
|
4
|
+
import { layoutDebug } from './layoutDebug';
|
|
5
|
+
import { ScaledPageLayout } from '../../smo/data/scoreModifiers';
|
|
6
|
+
import { SmoMeasure, ISmoBeamGroup } from '../../smo/data/measure';
|
|
7
|
+
import { SmoTimeSignature, SmoTempo } from '../../smo/data//measureModifiers';
|
|
8
|
+
import { SvgPageMap } from './svgPageMap';
|
|
9
|
+
import { TextFormatter } from '../../common/textformatter';
|
|
10
|
+
export interface SuiFormatterParameters {
|
|
11
|
+
score: SmoScore;
|
|
12
|
+
svg: SvgPageMap;
|
|
13
|
+
renderedPages: Record<number, RenderedPage | null>;
|
|
14
|
+
debug: layoutDebug;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @category SuiRender
|
|
18
|
+
*/
|
|
19
|
+
export interface SuiTickContext {
|
|
20
|
+
widths: number[];
|
|
21
|
+
tickCounts: number[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Estimated x, y position of the measure
|
|
25
|
+
* @category SuiRender
|
|
26
|
+
*/
|
|
27
|
+
export interface MeasureEstimate {
|
|
28
|
+
measures: SmoMeasure[];
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @category SuiRender
|
|
34
|
+
*/
|
|
35
|
+
export interface LineRender {
|
|
36
|
+
systems: Record<number, SmoMeasure[]>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Keep track of start/end measures on a page. If the page
|
|
40
|
+
* content doesn't change, and the measures don't change, we don't
|
|
41
|
+
* need to re-render the content
|
|
42
|
+
* @category SuiRender
|
|
43
|
+
*/
|
|
44
|
+
export interface RenderedPage {
|
|
45
|
+
startMeasure: number;
|
|
46
|
+
endMeasure: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Utilities for estimating measure/system/page width and height
|
|
50
|
+
* @category SuiRender
|
|
51
|
+
*/
|
|
52
|
+
export declare class SuiLayoutFormatter {
|
|
53
|
+
score: SmoScore;
|
|
54
|
+
systems: Record<number, LineRender>;
|
|
55
|
+
columnMeasureMap: Record<number, SmoMeasure[]>;
|
|
56
|
+
currentPage: number;
|
|
57
|
+
svg: SvgPageMap;
|
|
58
|
+
renderedPages: Record<number, RenderedPage | null>;
|
|
59
|
+
lines: number[];
|
|
60
|
+
horizontalGaps: Record<number, number>;
|
|
61
|
+
debug: layoutDebug;
|
|
62
|
+
measuresRenderedThisPage: number;
|
|
63
|
+
constructor(params: SuiFormatterParameters);
|
|
64
|
+
get horizontal(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Once we know which line a measure is going on, make a map for it for easy
|
|
67
|
+
* looking during rendering
|
|
68
|
+
* @param measures
|
|
69
|
+
* @param lineIndex
|
|
70
|
+
* @param systemIndex
|
|
71
|
+
*/
|
|
72
|
+
updateSystemMap(measures: SmoMeasure[], lineIndex: number, systemIndex: number): void;
|
|
73
|
+
trimPages(startPageCount: number): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* see if page breaks this boundary. If it does, bump the current page and move the system down
|
|
76
|
+
* to the new page
|
|
77
|
+
* @param scoreLayout
|
|
78
|
+
* @param currentLine
|
|
79
|
+
* @param bottomMeasure
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
82
|
+
checkPageBreak(scoreLayout: ScaledPageLayout, currentLine: SmoMeasure[], bottomMeasure: SmoMeasure): ScaledPageLayout;
|
|
83
|
+
measureToLeft(measure: SmoMeasure): SmoMeasure;
|
|
84
|
+
measureAbove(measure: SmoMeasure): SmoMeasure;
|
|
85
|
+
/**
|
|
86
|
+
* Estimate the dimensions of a column when it's rendered.
|
|
87
|
+
* @param scoreLayout
|
|
88
|
+
* @param measureIx
|
|
89
|
+
* @param systemIndex
|
|
90
|
+
* @param lineIndex
|
|
91
|
+
* @param x
|
|
92
|
+
* @param y
|
|
93
|
+
* @returns { MeasureEstimate } - the measures in the column and the x, y location
|
|
94
|
+
*/
|
|
95
|
+
estimateColumn(scoreLayout: ScaledPageLayout, measureIx: number, systemIndex: number, lineIndex: number, x: number, y: number): MeasureEstimate;
|
|
96
|
+
/**
|
|
97
|
+
* return true if this is the last measure, taking into account multimeasure rest
|
|
98
|
+
* @param measureIx
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
isLastVisibleMeasure(measureIx: number): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Calculate the geometry for the entire score, based on estimated measure width and height.
|
|
104
|
+
* @returns
|
|
105
|
+
*/
|
|
106
|
+
layout(): void;
|
|
107
|
+
static estimateMusicWidth(smoMeasure: SmoMeasure, tickContexts: Record<number, SuiTickContext>): number;
|
|
108
|
+
static estimateStartSymbolWidth(smoMeasure: SmoMeasure): number;
|
|
109
|
+
static estimateEndSymbolWidth(smoMeasure: SmoMeasure): number;
|
|
110
|
+
estimateMeasureWidth(measure: SmoMeasure, scoreLayout: ScaledPageLayout, tickContexts: Record<number, SuiTickContext>): void;
|
|
111
|
+
static _beamGroupForNote(measure: SmoMeasure, note: SmoNote): ISmoBeamGroup | null;
|
|
112
|
+
/**
|
|
113
|
+
* Format a full system:
|
|
114
|
+
* 1. Lop the last measure off the end and move it to the first measure of the
|
|
115
|
+
* next system, if it doesn't fit
|
|
116
|
+
* 2. Justify the measures vertically
|
|
117
|
+
* 3. Justify the columns horizontally
|
|
118
|
+
* 4. Hide lines if they don't contain music
|
|
119
|
+
* @param scoreLayout
|
|
120
|
+
* @param measureEstimate
|
|
121
|
+
* @param currentLine
|
|
122
|
+
* @param columnCount
|
|
123
|
+
* @param lastSystem
|
|
124
|
+
* @param pageLeftMargin - if horizontal layout, the start x of the page
|
|
125
|
+
*/
|
|
126
|
+
justifyY(scoreLayout: ScaledPageLayout, rowCount: number, currentLine: SmoMeasure[], lastSystem: boolean, pageLeftMargin: number): void;
|
|
127
|
+
/**
|
|
128
|
+
* highest value is actually the one lowest on the page
|
|
129
|
+
* @param measure
|
|
130
|
+
* @param note
|
|
131
|
+
* @returns
|
|
132
|
+
*/
|
|
133
|
+
static _highestLowestHead(measure: SmoMeasure, note: SmoNote): {
|
|
134
|
+
hi: number;
|
|
135
|
+
lo: number;
|
|
136
|
+
};
|
|
137
|
+
static textFont(lyric: SmoLyric): TextFormatter;
|
|
138
|
+
/**
|
|
139
|
+
* Calculate the dimensions of symbols based on where in a system we are, like whether we need to show
|
|
140
|
+
* the key signature, clef etc.
|
|
141
|
+
* @param systemIndex
|
|
142
|
+
* @param measure
|
|
143
|
+
* @param clefLast
|
|
144
|
+
* @param keySigLast
|
|
145
|
+
* @param timeSigLast
|
|
146
|
+
* @param tempoLast
|
|
147
|
+
* @param score
|
|
148
|
+
*/
|
|
149
|
+
calculateBeginningSymbols(systemIndex: number, measure: SmoMeasure, clefLast: string, keySigLast: string, timeSigLast: SmoTimeSignature, tempoLast: SmoTempo): void;
|
|
150
|
+
/**
|
|
151
|
+
* The baseline is the top line of the staff. aboveBaseline is a negative number
|
|
152
|
+
* that indicates how high above the baseline the measure goes. belowBaseline
|
|
153
|
+
* is a positive number that indicates how far below the baseline the measure goes.
|
|
154
|
+
* the height of the measure is below-above. Vex always renders a staff such that
|
|
155
|
+
* the y coordinate passed in for the stave is on the baseline.
|
|
156
|
+
*
|
|
157
|
+
* Note to past self: this was a really useful comment. Thank you.
|
|
158
|
+
* **/
|
|
159
|
+
estimateMeasureHeight(measure: SmoMeasure): {
|
|
160
|
+
aboveBaseline: number;
|
|
161
|
+
belowBaseline: number;
|
|
162
|
+
};
|
|
163
|
+
}
|