smoosic 2.0.2 → 2.0.3
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 +167 -74
- package/package.json +82 -77
- package/release/smoosic.js +171 -78
- package/release/styles/menus.css +26 -0
- package/specs/022-text-reposition-on-resize/spec.md +1 -0
- package/specs/027-fix-bottom-modifier-lookup/checklists/requirements.md +38 -0
- package/specs/027-fix-bottom-modifier-lookup/contracts/division-lookup-contract.md +51 -0
- package/specs/027-fix-bottom-modifier-lookup/data-model.md +43 -0
- package/specs/027-fix-bottom-modifier-lookup/plan.md +77 -0
- package/specs/027-fix-bottom-modifier-lookup/quickstart.md +36 -0
- package/specs/027-fix-bottom-modifier-lookup/research.md +58 -0
- package/specs/027-fix-bottom-modifier-lookup/spec.md +105 -0
- package/specs/027-fix-bottom-modifier-lookup/tasks.md +167 -0
- package/specs/028-unsaved-changes-indicator/checklists/requirements.md +39 -0
- package/specs/028-unsaved-changes-indicator/contracts/score-change-contract.md +44 -0
- package/specs/028-unsaved-changes-indicator/data-model.md +64 -0
- package/specs/028-unsaved-changes-indicator/plan.md +96 -0
- package/specs/028-unsaved-changes-indicator/quickstart.md +54 -0
- package/specs/028-unsaved-changes-indicator/research.md +68 -0
- package/specs/028-unsaved-changes-indicator/spec.md +135 -0
- package/specs/028-unsaved-changes-indicator/tasks.md +173 -0
- package/specs/029-remove-promise-helpers/checklists/requirements.md +39 -0
- package/specs/029-remove-promise-helpers/contracts/public-api-contract.md +32 -0
- package/specs/029-remove-promise-helpers/data-model.md +45 -0
- package/specs/029-remove-promise-helpers/plan.md +86 -0
- package/specs/029-remove-promise-helpers/quickstart.md +53 -0
- package/specs/029-remove-promise-helpers/research.md +71 -0
- package/specs/029-remove-promise-helpers/spec.md +107 -0
- package/specs/029-remove-promise-helpers/tasks.md +164 -0
- package/specs/030-copy-paste-voices/checklists/requirements.md +39 -0
- package/specs/030-copy-paste-voices/contracts/voice-copy-paste-contract.md +47 -0
- package/specs/030-copy-paste-voices/data-model.md +63 -0
- package/specs/030-copy-paste-voices/plan.md +80 -0
- package/specs/030-copy-paste-voices/quickstart.md +50 -0
- package/specs/030-copy-paste-voices/research.md +80 -0
- package/specs/030-copy-paste-voices/spec.md +124 -0
- package/specs/030-copy-paste-voices/tasks.md +183 -0
- package/specs/031-select-voice/checklists/requirements.md +39 -0
- package/specs/031-select-voice/contracts/select-voice-contract.md +43 -0
- package/specs/031-select-voice/data-model.md +47 -0
- package/specs/031-select-voice/plan.md +79 -0
- package/specs/031-select-voice/quickstart.md +43 -0
- package/specs/031-select-voice/research.md +55 -0
- package/specs/031-select-voice/spec.md +113 -0
- package/specs/031-select-voice/tasks.md +171 -0
- package/src/application/application.ts +464 -459
- package/src/common/promiseHelpers.ts +2 -2
- package/src/render/audio/samples.ts +117 -118
- package/src/render/sui/pageDivisions.ts +58 -0
- package/src/render/sui/renderState.ts +469 -464
- package/src/render/sui/scoreChangeState.ts +62 -0
- package/src/render/sui/scoreView.ts +30 -0
- package/src/render/sui/scoreViewOperations.ts +2555 -2380
- package/src/render/sui/svgPageMap.ts +16 -17
- package/src/render/sui/textEdit.ts +310 -311
- package/src/render/sui/tracker.ts +40 -0
- package/src/render/vex/vxNote.ts +3 -1
- package/src/smo/xform/copypaste.ts +304 -4
- package/src/smo/xform/selections.ts +68 -0
- package/src/smo/xform/undo.ts +9 -0
- package/src/styles/menus.css +26 -0
- package/src/ui/buttons/ribbon.ts +3 -1
- package/src/ui/components/buttons/sidebar.vue +15 -6
- package/src/ui/components/dialogs/library.vue +3 -1
- package/src/ui/components/dialogs/unsavedChanges.vue +44 -0
- package/src/ui/dialogs/adapter.ts +181 -183
- package/src/ui/dialogs/addMeasure.ts +97 -97
- package/src/ui/dialogs/annotationVue.ts +56 -56
- package/src/ui/dialogs/audioSettings.ts +121 -123
- package/src/ui/dialogs/chordChangeVue.ts +46 -46
- package/src/ui/dialogs/clefChange.ts +53 -53
- package/src/ui/dialogs/customTuplets.ts +95 -96
- package/src/ui/dialogs/customTupletsVue.ts +47 -47
- package/src/ui/dialogs/dialog.ts +627 -620
- package/src/ui/dialogs/durations.ts +34 -34
- package/src/ui/dialogs/dynamics.ts +140 -142
- package/src/ui/dialogs/factory.ts +198 -198
- package/src/ui/dialogs/fileDialogs.ts +245 -179
- package/src/ui/dialogs/fonts.ts +93 -93
- package/src/ui/dialogs/globalLayout.ts +40 -40
- package/src/ui/dialogs/gracenote.ts +31 -31
- package/src/ui/dialogs/hairpin.ts +108 -110
- package/src/ui/dialogs/hairpinVue.ts +51 -51
- package/src/ui/dialogs/instrument.ts +111 -111
- package/src/ui/dialogs/keySignature.ts +175 -176
- package/src/ui/dialogs/keySignatureVue.ts +47 -47
- package/src/ui/dialogs/library.ts +207 -207
- package/src/ui/dialogs/libraryVue.ts +62 -48
- package/src/ui/dialogs/lyricVue.ts +46 -46
- package/src/ui/dialogs/measureFormat.ts +78 -78
- package/src/ui/dialogs/microtones.ts +147 -147
- package/src/ui/dialogs/noteHead.ts +319 -319
- package/src/ui/dialogs/pageLayout.ts +61 -61
- package/src/ui/dialogs/partInfo.ts +60 -60
- package/src/ui/dialogs/pedalMarking.ts +117 -117
- package/src/ui/dialogs/pedalMarkingVue.ts +73 -73
- package/src/ui/dialogs/pitch.ts +352 -352
- package/src/ui/dialogs/preferences.ts +40 -40
- package/src/ui/dialogs/rehearsalMark.ts +64 -64
- package/src/ui/dialogs/rehearsalMarkVue.ts +57 -57
- package/src/ui/dialogs/scoreId.ts +35 -36
- package/src/ui/dialogs/scoreView.ts +42 -42
- package/src/ui/dialogs/slur.ts +308 -310
- package/src/ui/dialogs/slurVue.ts +91 -91
- package/src/ui/dialogs/staffGroup.ts +112 -112
- package/src/ui/dialogs/tabNote.ts +84 -84
- package/src/ui/dialogs/tabStave.ts +182 -182
- package/src/ui/dialogs/tempo.ts +261 -263
- package/src/ui/dialogs/tempoVue.ts +73 -73
- package/src/ui/dialogs/textBlockVue.ts +127 -127
- package/src/ui/dialogs/textBracket.ts +114 -116
- package/src/ui/dialogs/textBracketVue.ts +56 -56
- package/src/ui/dialogs/tie.ts +140 -142
- package/src/ui/dialogs/timeSignature.ts +65 -66
- package/src/ui/dialogs/transposeScore.ts +39 -39
- package/src/ui/dialogs/unsavedChanges.ts +43 -0
- package/src/ui/dialogs/volta.ts +120 -122
- package/src/ui/dialogs/voltaVue.ts +51 -51
- package/src/ui/fileio/library.ts +110 -111
- package/src/ui/menus/edit.ts +100 -1
- package/src/ui/menus/file.ts +19 -3
- package/tests/pageDivisions.ts +156 -0
- package/tests/promiseHelpersUsage.ts +142 -0
- package/tests/scoreChangeState.ts +102 -0
- package/tests/selectVoice.ts +189 -0
- package/tests/voiceCopyPaste.ts +417 -0
|
@@ -1,199 +1,199 @@
|
|
|
1
|
-
|
|
2
|
-
import { SmoModifier } from '../../smo/data/score';
|
|
3
|
-
import { SuiDialogBase, SuiDialogParams, createAndDisplayDialog, DialogTranslations,
|
|
4
|
-
suiDialogTranslate } from './dialog';
|
|
5
|
-
import { SuiHairpinAttributesDialog } from './hairpin';
|
|
6
|
-
import { SuiSlurAttributesDialog } from './slur';
|
|
7
|
-
import { SuiPedalMarkingDialog } from './pedalMarking';
|
|
8
|
-
import { SuiVoltaAttributeDialog } from './volta';
|
|
9
|
-
import { SuiLyricDialogVue } from './lyricVue';
|
|
10
|
-
import { SuiChordChangeDialogVue } from './chordChangeVue';
|
|
11
|
-
import { SuiTieAttributesDialog } from './tie';
|
|
12
|
-
import { SuiDynamicModifierDialog } from './dynamics';
|
|
13
|
-
import { SuiDialogNotifier, SmoDynamicComponentCtor, SuiBaseComponentParams } from './components/baseComponent';
|
|
14
|
-
import { SuiButtonComponent, SuiButtonComposite, SuiButtonCompositeParams, SuiButtonComponentParams } from './components/button';
|
|
15
|
-
import { CheckboxDropdownComponent, CheckboxDropdownComponentParams } from './components/checkdrop';
|
|
16
|
-
import { SuiDropdownComponent, SuiDropdownComponentParams, SuiDropdownCompositeParams, SuiDropdownComposite } from './components/dropdown';
|
|
17
|
-
import { SuiFileDownloadComponentParams, SuiFileDownloadComponent } from './components/fileDownload';
|
|
18
|
-
import { SuiFontComponent, SuiFontComponentParams } from './components/fontComponent';
|
|
19
|
-
import { SuiPitchComponentParams, SuiPitchComponent, SuiPitchComposite, SuiPitchCompositeParams, SuiPitchArrayComponentTab } from './components/pitch';
|
|
20
|
-
import { SuiRockerComponentParams,SuiRockerComponent, SuiRockerComposite, SuiRockerCompositeParams } from './components/rocker';
|
|
21
|
-
import { StaffAddRemoveComponentParams, StaffAddRemoveComponent, StaffCheckComponentParams, StaffCheckComponent } from './components/staffComponents';
|
|
22
|
-
import { TextCheckComponentParams, TextCheckComponent } from './components/textCheck';
|
|
23
|
-
import { SuiTextInputComponentParams, SuiTextInputComponent,
|
|
24
|
-
SuiTextInputCompositeParams, SuiTextInputComposite, SuiReadOnlyTextComponent } from './components/textInput';
|
|
25
|
-
import { TieMappingComponentParams, TieMappingComponent } from './components/tie';
|
|
26
|
-
import { SuiToggleComponentParams, SuiToggleComponent, SuiToggleCompositeParams, SuiToggleComposite } from './components/toggle';
|
|
27
|
-
import { SuiTreeComponent, SuiTreeComponentParams } from './components/tree';
|
|
28
|
-
import { SmoLyric } from '../../smo/data/noteModifiers';
|
|
29
|
-
import { SuiExceptionHandler } from '../exceptions';
|
|
30
|
-
import { SuiTextBlockDialogVue } from './textBlockVue';
|
|
31
|
-
import { SuiVoltaAttributeDialogVue } from './voltaVue';
|
|
32
|
-
import { SuiRehearsalMarkDialogVue } from './rehearsalMarkVue';
|
|
33
|
-
import { SuiTextBracketDialogVue } from './textBracketVue';
|
|
34
|
-
import { SuiSlurAttributesDialogVue } from './slurVue';
|
|
35
|
-
import { SuiPedalMarkingDialogVue } from './pedalMarkingVue';
|
|
36
|
-
import { SuiHairpinAttributesDialogVue } from './hairpinVue';
|
|
37
|
-
import { SuiDynamicModifierDialogVue } from './dynamicsVue';
|
|
38
|
-
import { SuiAnnotationDialogVue } from './annotationVue';
|
|
39
|
-
|
|
40
|
-
export type ModifiersWithDialogs = 'SmoStaffHairpin' | 'SmoTie' | 'SmoSlur' |
|
|
41
|
-
'SmoDynamicText' | 'SmoVolta' | 'SmoScoreText' | 'SmoLoadScore' | 'SmoLyric' | 'SmoPedalMarking' | 'SmoRehearsalMark';
|
|
42
|
-
export var ModifiersWithDialogNames = ['SmoStaffHairpin', 'SmoTie', 'SmoSlur', 'SmoDynamicText', 'SmoVolta',
|
|
43
|
-
'SmoScoreText', 'SmoLoadScore', 'SmoLyric', 'SmoTextGroup', 'SmoStaffTextBracket', 'SmoPedalMarking', 'SmoRehearsalMark'];
|
|
44
|
-
|
|
45
|
-
export function isModifierWithDialog(modifier: SmoModifier) {
|
|
46
|
-
return ModifiersWithDialogNames.indexOf(modifier.attrs.type) >= 0;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Dialogs bound to hot keys are created here
|
|
50
|
-
* directly from a button/menu option
|
|
51
|
-
* @category SuiDialog
|
|
52
|
-
*/
|
|
53
|
-
export class SuiModifierDialogFactory {
|
|
54
|
-
static createModifierDialog(modifier: SmoModifier, parameters: SuiDialogParams): SuiDialogBase | null {
|
|
55
|
-
if (!isModifierWithDialog(modifier)) {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
const ctor = modifier.attrs.type;
|
|
59
|
-
parameters.modifier = modifier;
|
|
60
|
-
if (ctor === 'SmoStaffHairpin') {
|
|
61
|
-
SuiHairpinAttributesDialogVue(parameters);
|
|
62
|
-
return null;
|
|
63
|
-
} else if (ctor === 'SmoPedalMarking') {
|
|
64
|
-
SuiPedalMarkingDialogVue(parameters);
|
|
65
|
-
return null;
|
|
66
|
-
} else if (ctor === 'SmoTie') {
|
|
67
|
-
return createAndDisplayDialog(SuiTieAttributesDialog, parameters);
|
|
68
|
-
} else if (ctor === 'SmoSlur') {
|
|
69
|
-
SuiSlurAttributesDialogVue(parameters);
|
|
70
|
-
return null;
|
|
71
|
-
} else if (ctor === 'SmoDynamicText') {
|
|
72
|
-
SuiDynamicModifierDialogVue(parameters);
|
|
73
|
-
return null;
|
|
74
|
-
} else if (ctor === 'SmoVolta') {
|
|
75
|
-
SuiVoltaAttributeDialogVue(parameters);
|
|
76
|
-
return null;
|
|
77
|
-
} else if (ctor === 'SmoRehearsalMark') {
|
|
78
|
-
SuiRehearsalMarkDialogVue(parameters);
|
|
79
|
-
return null;
|
|
80
|
-
} else if (ctor === 'SmoTextGroup') {
|
|
81
|
-
SuiTextBlockDialogVue({
|
|
82
|
-
completeNotifier: parameters.completeNotifier,
|
|
83
|
-
view: parameters.view,
|
|
84
|
-
eventSource: parameters.eventSource,
|
|
85
|
-
id: 'textDialog',
|
|
86
|
-
ctor: 'SuiTextBlockDialog',
|
|
87
|
-
tracker: parameters.view.tracker,
|
|
88
|
-
startPromise: parameters.startPromise,
|
|
89
|
-
modifier: parameters.modifier
|
|
90
|
-
});
|
|
91
|
-
return null;
|
|
92
|
-
} else if (ctor === 'SmoStaffTextBracket') {
|
|
93
|
-
SuiTextBracketDialogVue(parameters);
|
|
94
|
-
return null;
|
|
95
|
-
} else {
|
|
96
|
-
if (modifier.ctor !== 'SmoLyric') {
|
|
97
|
-
new SuiExceptionHandler({
|
|
98
|
-
view: parameters.view,
|
|
99
|
-
navigation: parameters.view.renderer.navigation
|
|
100
|
-
}).exceptionHandler(`SuiModifierDialogFactory: unhandled modifier type ${modifier.ctor}`);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const lModifier = (modifier as SmoLyric);
|
|
104
|
-
if (lModifier.parser == SmoLyric.parsers.lyric) {
|
|
105
|
-
SuiLyricDialogVue({
|
|
106
|
-
completeNotifier: parameters.completeNotifier,
|
|
107
|
-
view: parameters.view,
|
|
108
|
-
eventSource: parameters.eventSource,
|
|
109
|
-
id: 'textDialog',
|
|
110
|
-
ctor: 'SuiTextBlockDialog',
|
|
111
|
-
tracker: parameters.view.tracker,
|
|
112
|
-
startPromise: parameters.startPromise,
|
|
113
|
-
modifier: parameters.modifier
|
|
114
|
-
});
|
|
115
|
-
return null;
|
|
116
|
-
} else if (lModifier.parser == SmoLyric.parsers.annotation) {
|
|
117
|
-
SuiAnnotationDialogVue({
|
|
118
|
-
completeNotifier: parameters.completeNotifier,
|
|
119
|
-
view: parameters.view,
|
|
120
|
-
eventSource: parameters.eventSource,
|
|
121
|
-
id: 'annotationDialog',
|
|
122
|
-
ctor: 'SuiAnnotationDialog',
|
|
123
|
-
tracker: parameters.view.tracker,
|
|
124
|
-
startPromise: parameters.startPromise,
|
|
125
|
-
modifier: parameters.modifier
|
|
126
|
-
});
|
|
127
|
-
return null;
|
|
128
|
-
} else {
|
|
129
|
-
SuiChordChangeDialogVue({
|
|
130
|
-
completeNotifier: parameters.completeNotifier,
|
|
131
|
-
view: parameters.view,
|
|
132
|
-
eventSource: parameters.eventSource,
|
|
133
|
-
id: 'textDialog',
|
|
134
|
-
ctor: 'SuiTextBlockDialog',
|
|
135
|
-
tracker: parameters.view.tracker,
|
|
136
|
-
startPromise: parameters.startPromise,
|
|
137
|
-
modifier: parameters.modifier
|
|
138
|
-
});
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export const initDialogTranslationElements = () => {
|
|
146
|
-
DialogTranslations.push(suiDialogTranslate(SuiHairpinAttributesDialog.dialogElements, 'SuiHairpinAttributesDialog'));
|
|
147
|
-
DialogTranslations.push(suiDialogTranslate(SuiPedalMarkingDialog.dialogElements, 'SuiPedalMarkingDialog'));
|
|
148
|
-
DialogTranslations.push(suiDialogTranslate(SuiTieAttributesDialog.dialogElements, 'SuiTieAttributesDialog'));
|
|
149
|
-
DialogTranslations.push(suiDialogTranslate(SuiSlurAttributesDialog.dialogElements, 'SuiSlurAttributesDialog'));
|
|
150
|
-
DialogTranslations.push(suiDialogTranslate(SuiDynamicModifierDialog.dialogElements, 'SuiDynamicModifierDialog'));
|
|
151
|
-
DialogTranslations.push(suiDialogTranslate(SuiVoltaAttributeDialog.dialogElements, 'SuiVoltaAttributeDialog'));
|
|
152
|
-
}
|
|
153
|
-
export const initDialogConstructors = () => {
|
|
154
|
-
SmoDynamicComponentCtor['SuiButtonComponent'] =
|
|
155
|
-
(dialog: SuiDialogNotifier, params: SuiButtonComponentParams) => new SuiButtonComponent(dialog, params);
|
|
156
|
-
SmoDynamicComponentCtor['SuiButtonComposite'] =
|
|
157
|
-
(dialog: SuiDialogNotifier, params: SuiButtonCompositeParams) => new SuiButtonComposite(dialog, params);
|
|
158
|
-
SmoDynamicComponentCtor['CheckboxDropdownComponent'] =
|
|
159
|
-
(dialog: SuiDialogNotifier, params: CheckboxDropdownComponentParams) => new CheckboxDropdownComponent(dialog, params);
|
|
160
|
-
//SuiDropdownComponent, SuiDropdownComponentParams, SuiDropdownCompositeParams, SuiDropdownComposite
|
|
161
|
-
SmoDynamicComponentCtor['SuiDropdownComponent'] =
|
|
162
|
-
(dialog: SuiDialogNotifier, params: SuiDropdownComponentParams) => new SuiDropdownComponent(dialog, params);
|
|
163
|
-
SmoDynamicComponentCtor['SuiDropdownComposite'] =
|
|
164
|
-
(dialog: SuiDialogNotifier, params: SuiDropdownCompositeParams) => new SuiDropdownComposite(dialog, params);
|
|
165
|
-
SmoDynamicComponentCtor['SuiFileDownloadComponent'] =
|
|
166
|
-
(dialog: SuiDialogNotifier, params: SuiFileDownloadComponentParams) => new SuiFileDownloadComponent(dialog, params);
|
|
167
|
-
SmoDynamicComponentCtor['SuiFontComponent'] =
|
|
168
|
-
(dialog: SuiDialogNotifier, params: SuiFontComponentParams) => new SuiFontComponent(dialog, params);
|
|
169
|
-
SmoDynamicComponentCtor['SuiPitchComponent'] =
|
|
170
|
-
(dialog: SuiDialogNotifier, params: SuiPitchComponentParams) => new SuiPitchComponent(dialog, params);
|
|
171
|
-
SmoDynamicComponentCtor['SuiPitchComposite'] =
|
|
172
|
-
(dialog: SuiDialogNotifier, params: SuiPitchCompositeParams) => new SuiPitchComposite(dialog, params);
|
|
173
|
-
SmoDynamicComponentCtor['SuiPitchArrayComponentTab'] =
|
|
174
|
-
(dialog: SuiDialogNotifier, params: SuiPitchCompositeParams) => new SuiPitchArrayComponentTab(dialog, params);
|
|
175
|
-
SmoDynamicComponentCtor['SuiRockerComponent'] =
|
|
176
|
-
(dialog: SuiDialogNotifier, params: SuiRockerComponentParams) => new SuiRockerComponent(dialog, params);
|
|
177
|
-
SmoDynamicComponentCtor['SuiRockerComposite'] =
|
|
178
|
-
(dialog: SuiDialogNotifier, params: SuiRockerCompositeParams) => new SuiRockerComposite(dialog, params);
|
|
179
|
-
SmoDynamicComponentCtor['StaffAddRemoveComponent'] =
|
|
180
|
-
(dialog: SuiDialogNotifier, params: StaffAddRemoveComponentParams) => new StaffAddRemoveComponent(dialog, params);
|
|
181
|
-
SmoDynamicComponentCtor['StaffCheckComponent'] =
|
|
182
|
-
(dialog: SuiDialogNotifier, params: StaffCheckComponentParams) => new StaffCheckComponent(dialog, params);
|
|
183
|
-
SmoDynamicComponentCtor['TextCheckComponent'] =
|
|
184
|
-
(dialog: SuiDialogNotifier, params: TextCheckComponentParams) => new TextCheckComponent(dialog, params);
|
|
185
|
-
SmoDynamicComponentCtor['SuiTextInputComponent'] =
|
|
186
|
-
(dialog: SuiDialogNotifier, params: SuiTextInputComponentParams) => new SuiTextInputComponent(dialog, params);
|
|
187
|
-
SmoDynamicComponentCtor['SuiTextInputComposite'] =
|
|
188
|
-
(dialog: SuiDialogNotifier, params: SuiTextInputCompositeParams) => new SuiTextInputComposite(dialog, params);
|
|
189
|
-
SmoDynamicComponentCtor['SuiReadOnlyTextComponent'] =
|
|
190
|
-
(dialog: SuiDialogNotifier, params: SuiTextInputComponentParams) => new SuiReadOnlyTextComponent(dialog, params);
|
|
191
|
-
SmoDynamicComponentCtor['TieMappingComponent'] =
|
|
192
|
-
(dialog: SuiDialogNotifier, params: TieMappingComponentParams) => new TieMappingComponent(dialog, params);
|
|
193
|
-
SmoDynamicComponentCtor['SuiToggleComponent'] =
|
|
194
|
-
(dialog: SuiDialogNotifier, params: SuiToggleComponentParams) => new SuiToggleComponent(dialog, params);
|
|
195
|
-
SmoDynamicComponentCtor['SuiToggleComposite'] =
|
|
196
|
-
(dialog: SuiDialogNotifier, params: SuiToggleCompositeParams) => new SuiToggleComposite(dialog, params);
|
|
197
|
-
SmoDynamicComponentCtor['SuiTreeComponent'] =
|
|
198
|
-
(dialog: SuiDialogNotifier, params: SuiTreeComponentParams) => new SuiTreeComponent(dialog, params);
|
|
1
|
+
|
|
2
|
+
import { SmoModifier } from '../../smo/data/score';
|
|
3
|
+
import { SuiDialogBase, SuiDialogParams, createAndDisplayDialog, DialogTranslations,
|
|
4
|
+
suiDialogTranslate } from './dialog';
|
|
5
|
+
import { SuiHairpinAttributesDialog } from './hairpin';
|
|
6
|
+
import { SuiSlurAttributesDialog } from './slur';
|
|
7
|
+
import { SuiPedalMarkingDialog } from './pedalMarking';
|
|
8
|
+
import { SuiVoltaAttributeDialog } from './volta';
|
|
9
|
+
import { SuiLyricDialogVue } from './lyricVue';
|
|
10
|
+
import { SuiChordChangeDialogVue } from './chordChangeVue';
|
|
11
|
+
import { SuiTieAttributesDialog } from './tie';
|
|
12
|
+
import { SuiDynamicModifierDialog } from './dynamics';
|
|
13
|
+
import { SuiDialogNotifier, SmoDynamicComponentCtor, SuiBaseComponentParams } from './components/baseComponent';
|
|
14
|
+
import { SuiButtonComponent, SuiButtonComposite, SuiButtonCompositeParams, SuiButtonComponentParams } from './components/button';
|
|
15
|
+
import { CheckboxDropdownComponent, CheckboxDropdownComponentParams } from './components/checkdrop';
|
|
16
|
+
import { SuiDropdownComponent, SuiDropdownComponentParams, SuiDropdownCompositeParams, SuiDropdownComposite } from './components/dropdown';
|
|
17
|
+
import { SuiFileDownloadComponentParams, SuiFileDownloadComponent } from './components/fileDownload';
|
|
18
|
+
import { SuiFontComponent, SuiFontComponentParams } from './components/fontComponent';
|
|
19
|
+
import { SuiPitchComponentParams, SuiPitchComponent, SuiPitchComposite, SuiPitchCompositeParams, SuiPitchArrayComponentTab } from './components/pitch';
|
|
20
|
+
import { SuiRockerComponentParams,SuiRockerComponent, SuiRockerComposite, SuiRockerCompositeParams } from './components/rocker';
|
|
21
|
+
import { StaffAddRemoveComponentParams, StaffAddRemoveComponent, StaffCheckComponentParams, StaffCheckComponent } from './components/staffComponents';
|
|
22
|
+
import { TextCheckComponentParams, TextCheckComponent } from './components/textCheck';
|
|
23
|
+
import { SuiTextInputComponentParams, SuiTextInputComponent,
|
|
24
|
+
SuiTextInputCompositeParams, SuiTextInputComposite, SuiReadOnlyTextComponent } from './components/textInput';
|
|
25
|
+
import { TieMappingComponentParams, TieMappingComponent } from './components/tie';
|
|
26
|
+
import { SuiToggleComponentParams, SuiToggleComponent, SuiToggleCompositeParams, SuiToggleComposite } from './components/toggle';
|
|
27
|
+
import { SuiTreeComponent, SuiTreeComponentParams } from './components/tree';
|
|
28
|
+
import { SmoLyric } from '../../smo/data/noteModifiers';
|
|
29
|
+
import { SuiExceptionHandler } from '../exceptions';
|
|
30
|
+
import { SuiTextBlockDialogVue } from './textBlockVue';
|
|
31
|
+
import { SuiVoltaAttributeDialogVue } from './voltaVue';
|
|
32
|
+
import { SuiRehearsalMarkDialogVue } from './rehearsalMarkVue';
|
|
33
|
+
import { SuiTextBracketDialogVue } from './textBracketVue';
|
|
34
|
+
import { SuiSlurAttributesDialogVue } from './slurVue';
|
|
35
|
+
import { SuiPedalMarkingDialogVue } from './pedalMarkingVue';
|
|
36
|
+
import { SuiHairpinAttributesDialogVue } from './hairpinVue';
|
|
37
|
+
import { SuiDynamicModifierDialogVue } from './dynamicsVue';
|
|
38
|
+
import { SuiAnnotationDialogVue } from './annotationVue';
|
|
39
|
+
|
|
40
|
+
export type ModifiersWithDialogs = 'SmoStaffHairpin' | 'SmoTie' | 'SmoSlur' |
|
|
41
|
+
'SmoDynamicText' | 'SmoVolta' | 'SmoScoreText' | 'SmoLoadScore' | 'SmoLyric' | 'SmoPedalMarking' | 'SmoRehearsalMark';
|
|
42
|
+
export var ModifiersWithDialogNames = ['SmoStaffHairpin', 'SmoTie', 'SmoSlur', 'SmoDynamicText', 'SmoVolta',
|
|
43
|
+
'SmoScoreText', 'SmoLoadScore', 'SmoLyric', 'SmoTextGroup', 'SmoStaffTextBracket', 'SmoPedalMarking', 'SmoRehearsalMark'];
|
|
44
|
+
|
|
45
|
+
export function isModifierWithDialog(modifier: SmoModifier) {
|
|
46
|
+
return ModifiersWithDialogNames.indexOf(modifier.attrs.type) >= 0;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Dialogs bound to hot keys are created here
|
|
50
|
+
* directly from a button/menu option
|
|
51
|
+
* @category SuiDialog
|
|
52
|
+
*/
|
|
53
|
+
export class SuiModifierDialogFactory {
|
|
54
|
+
static createModifierDialog(modifier: SmoModifier, parameters: SuiDialogParams): SuiDialogBase | null {
|
|
55
|
+
if (!isModifierWithDialog(modifier)) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const ctor = modifier.attrs.type;
|
|
59
|
+
parameters.modifier = modifier;
|
|
60
|
+
if (ctor === 'SmoStaffHairpin') {
|
|
61
|
+
SuiHairpinAttributesDialogVue(parameters);
|
|
62
|
+
return null;
|
|
63
|
+
} else if (ctor === 'SmoPedalMarking') {
|
|
64
|
+
SuiPedalMarkingDialogVue(parameters);
|
|
65
|
+
return null;
|
|
66
|
+
} else if (ctor === 'SmoTie') {
|
|
67
|
+
return createAndDisplayDialog(SuiTieAttributesDialog, parameters);
|
|
68
|
+
} else if (ctor === 'SmoSlur') {
|
|
69
|
+
SuiSlurAttributesDialogVue(parameters);
|
|
70
|
+
return null;
|
|
71
|
+
} else if (ctor === 'SmoDynamicText') {
|
|
72
|
+
SuiDynamicModifierDialogVue(parameters);
|
|
73
|
+
return null;
|
|
74
|
+
} else if (ctor === 'SmoVolta') {
|
|
75
|
+
SuiVoltaAttributeDialogVue(parameters);
|
|
76
|
+
return null;
|
|
77
|
+
} else if (ctor === 'SmoRehearsalMark') {
|
|
78
|
+
SuiRehearsalMarkDialogVue(parameters);
|
|
79
|
+
return null;
|
|
80
|
+
} else if (ctor === 'SmoTextGroup') {
|
|
81
|
+
SuiTextBlockDialogVue({
|
|
82
|
+
completeNotifier: parameters.completeNotifier,
|
|
83
|
+
view: parameters.view,
|
|
84
|
+
eventSource: parameters.eventSource,
|
|
85
|
+
id: 'textDialog',
|
|
86
|
+
ctor: 'SuiTextBlockDialog',
|
|
87
|
+
tracker: parameters.view.tracker,
|
|
88
|
+
startPromise: parameters.startPromise,
|
|
89
|
+
modifier: parameters.modifier
|
|
90
|
+
});
|
|
91
|
+
return null;
|
|
92
|
+
} else if (ctor === 'SmoStaffTextBracket') {
|
|
93
|
+
SuiTextBracketDialogVue(parameters);
|
|
94
|
+
return null;
|
|
95
|
+
} else {
|
|
96
|
+
if (modifier.ctor !== 'SmoLyric') {
|
|
97
|
+
new SuiExceptionHandler({
|
|
98
|
+
view: parameters.view,
|
|
99
|
+
navigation: parameters.view.renderer.navigation
|
|
100
|
+
}).exceptionHandler(`SuiModifierDialogFactory: unhandled modifier type ${modifier.ctor}`);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const lModifier = (modifier as SmoLyric);
|
|
104
|
+
if (lModifier.parser == SmoLyric.parsers.lyric) {
|
|
105
|
+
SuiLyricDialogVue({
|
|
106
|
+
completeNotifier: parameters.completeNotifier,
|
|
107
|
+
view: parameters.view,
|
|
108
|
+
eventSource: parameters.eventSource,
|
|
109
|
+
id: 'textDialog',
|
|
110
|
+
ctor: 'SuiTextBlockDialog',
|
|
111
|
+
tracker: parameters.view.tracker,
|
|
112
|
+
startPromise: parameters.startPromise,
|
|
113
|
+
modifier: parameters.modifier
|
|
114
|
+
});
|
|
115
|
+
return null;
|
|
116
|
+
} else if (lModifier.parser == SmoLyric.parsers.annotation) {
|
|
117
|
+
SuiAnnotationDialogVue({
|
|
118
|
+
completeNotifier: parameters.completeNotifier,
|
|
119
|
+
view: parameters.view,
|
|
120
|
+
eventSource: parameters.eventSource,
|
|
121
|
+
id: 'annotationDialog',
|
|
122
|
+
ctor: 'SuiAnnotationDialog',
|
|
123
|
+
tracker: parameters.view.tracker,
|
|
124
|
+
startPromise: parameters.startPromise,
|
|
125
|
+
modifier: parameters.modifier
|
|
126
|
+
});
|
|
127
|
+
return null;
|
|
128
|
+
} else {
|
|
129
|
+
SuiChordChangeDialogVue({
|
|
130
|
+
completeNotifier: parameters.completeNotifier,
|
|
131
|
+
view: parameters.view,
|
|
132
|
+
eventSource: parameters.eventSource,
|
|
133
|
+
id: 'textDialog',
|
|
134
|
+
ctor: 'SuiTextBlockDialog',
|
|
135
|
+
tracker: parameters.view.tracker,
|
|
136
|
+
startPromise: parameters.startPromise,
|
|
137
|
+
modifier: parameters.modifier
|
|
138
|
+
});
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export const initDialogTranslationElements = () => {
|
|
146
|
+
DialogTranslations.push(suiDialogTranslate(SuiHairpinAttributesDialog.dialogElements, 'SuiHairpinAttributesDialog'));
|
|
147
|
+
DialogTranslations.push(suiDialogTranslate(SuiPedalMarkingDialog.dialogElements, 'SuiPedalMarkingDialog'));
|
|
148
|
+
DialogTranslations.push(suiDialogTranslate(SuiTieAttributesDialog.dialogElements, 'SuiTieAttributesDialog'));
|
|
149
|
+
DialogTranslations.push(suiDialogTranslate(SuiSlurAttributesDialog.dialogElements, 'SuiSlurAttributesDialog'));
|
|
150
|
+
DialogTranslations.push(suiDialogTranslate(SuiDynamicModifierDialog.dialogElements, 'SuiDynamicModifierDialog'));
|
|
151
|
+
DialogTranslations.push(suiDialogTranslate(SuiVoltaAttributeDialog.dialogElements, 'SuiVoltaAttributeDialog'));
|
|
152
|
+
}
|
|
153
|
+
export const initDialogConstructors = () => {
|
|
154
|
+
SmoDynamicComponentCtor['SuiButtonComponent'] =
|
|
155
|
+
(dialog: SuiDialogNotifier, params: SuiButtonComponentParams) => new SuiButtonComponent(dialog, params);
|
|
156
|
+
SmoDynamicComponentCtor['SuiButtonComposite'] =
|
|
157
|
+
(dialog: SuiDialogNotifier, params: SuiButtonCompositeParams) => new SuiButtonComposite(dialog, params);
|
|
158
|
+
SmoDynamicComponentCtor['CheckboxDropdownComponent'] =
|
|
159
|
+
(dialog: SuiDialogNotifier, params: CheckboxDropdownComponentParams) => new CheckboxDropdownComponent(dialog, params);
|
|
160
|
+
//SuiDropdownComponent, SuiDropdownComponentParams, SuiDropdownCompositeParams, SuiDropdownComposite
|
|
161
|
+
SmoDynamicComponentCtor['SuiDropdownComponent'] =
|
|
162
|
+
(dialog: SuiDialogNotifier, params: SuiDropdownComponentParams) => new SuiDropdownComponent(dialog, params);
|
|
163
|
+
SmoDynamicComponentCtor['SuiDropdownComposite'] =
|
|
164
|
+
(dialog: SuiDialogNotifier, params: SuiDropdownCompositeParams) => new SuiDropdownComposite(dialog, params);
|
|
165
|
+
SmoDynamicComponentCtor['SuiFileDownloadComponent'] =
|
|
166
|
+
(dialog: SuiDialogNotifier, params: SuiFileDownloadComponentParams) => new SuiFileDownloadComponent(dialog, params);
|
|
167
|
+
SmoDynamicComponentCtor['SuiFontComponent'] =
|
|
168
|
+
(dialog: SuiDialogNotifier, params: SuiFontComponentParams) => new SuiFontComponent(dialog, params);
|
|
169
|
+
SmoDynamicComponentCtor['SuiPitchComponent'] =
|
|
170
|
+
(dialog: SuiDialogNotifier, params: SuiPitchComponentParams) => new SuiPitchComponent(dialog, params);
|
|
171
|
+
SmoDynamicComponentCtor['SuiPitchComposite'] =
|
|
172
|
+
(dialog: SuiDialogNotifier, params: SuiPitchCompositeParams) => new SuiPitchComposite(dialog, params);
|
|
173
|
+
SmoDynamicComponentCtor['SuiPitchArrayComponentTab'] =
|
|
174
|
+
(dialog: SuiDialogNotifier, params: SuiPitchCompositeParams) => new SuiPitchArrayComponentTab(dialog, params);
|
|
175
|
+
SmoDynamicComponentCtor['SuiRockerComponent'] =
|
|
176
|
+
(dialog: SuiDialogNotifier, params: SuiRockerComponentParams) => new SuiRockerComponent(dialog, params);
|
|
177
|
+
SmoDynamicComponentCtor['SuiRockerComposite'] =
|
|
178
|
+
(dialog: SuiDialogNotifier, params: SuiRockerCompositeParams) => new SuiRockerComposite(dialog, params);
|
|
179
|
+
SmoDynamicComponentCtor['StaffAddRemoveComponent'] =
|
|
180
|
+
(dialog: SuiDialogNotifier, params: StaffAddRemoveComponentParams) => new StaffAddRemoveComponent(dialog, params);
|
|
181
|
+
SmoDynamicComponentCtor['StaffCheckComponent'] =
|
|
182
|
+
(dialog: SuiDialogNotifier, params: StaffCheckComponentParams) => new StaffCheckComponent(dialog, params);
|
|
183
|
+
SmoDynamicComponentCtor['TextCheckComponent'] =
|
|
184
|
+
(dialog: SuiDialogNotifier, params: TextCheckComponentParams) => new TextCheckComponent(dialog, params);
|
|
185
|
+
SmoDynamicComponentCtor['SuiTextInputComponent'] =
|
|
186
|
+
(dialog: SuiDialogNotifier, params: SuiTextInputComponentParams) => new SuiTextInputComponent(dialog, params);
|
|
187
|
+
SmoDynamicComponentCtor['SuiTextInputComposite'] =
|
|
188
|
+
(dialog: SuiDialogNotifier, params: SuiTextInputCompositeParams) => new SuiTextInputComposite(dialog, params);
|
|
189
|
+
SmoDynamicComponentCtor['SuiReadOnlyTextComponent'] =
|
|
190
|
+
(dialog: SuiDialogNotifier, params: SuiTextInputComponentParams) => new SuiReadOnlyTextComponent(dialog, params);
|
|
191
|
+
SmoDynamicComponentCtor['TieMappingComponent'] =
|
|
192
|
+
(dialog: SuiDialogNotifier, params: TieMappingComponentParams) => new TieMappingComponent(dialog, params);
|
|
193
|
+
SmoDynamicComponentCtor['SuiToggleComponent'] =
|
|
194
|
+
(dialog: SuiDialogNotifier, params: SuiToggleComponentParams) => new SuiToggleComponent(dialog, params);
|
|
195
|
+
SmoDynamicComponentCtor['SuiToggleComposite'] =
|
|
196
|
+
(dialog: SuiDialogNotifier, params: SuiToggleCompositeParams) => new SuiToggleComposite(dialog, params);
|
|
197
|
+
SmoDynamicComponentCtor['SuiTreeComponent'] =
|
|
198
|
+
(dialog: SuiDialogNotifier, params: SuiTreeComponentParams) => new SuiTreeComponent(dialog, params);
|
|
199
199
|
}
|