smoosic
Version:
<sub>[Github site](https://github.com/Smoosic/smoosic) | [source documentation](https://smoosic.github.io/Smoosic/release/docs/modules.html) | [change notes](https://aarondavidnewman.github.io/Smoosic/changes.html) | [application](https://smoosic.github.i
84 lines (79 loc) • 2.08 kB
text/typescript
// [Smoosic](https://github.com/AaronDavidNewman/Smoosic)
// Copyright (c) Aaron David Newman 2021.
import { SuiMenuBase, SuiMenuParams, MenuDefinition } from './menu';
import { SmoMeasure } from '../../smo/data/measure';
import { createAndDisplayDialog } from '../dialogs/dialog';
import { SuiTimeSignatureDialog } from '../dialogs/timeSignature';
declare var $: any;
/**
* Not currently used, is a dialog instead
* @category SuiMenu
*/
export class SuiTimeSignatureMenu extends SuiMenuBase {
constructor(params: SuiMenuParams) {
super(params);
}
static defaults: MenuDefinition = {
label: 'Time Sig',
menuItems: [{
icon: 'sixeight',
text: '6/8',
value: '6/8',
}, {
icon: 'fourfour',
text: '4/4',
value: '4/4',
}, {
icon: 'threefour',
text: '3/4',
value: '3/4',
}, {
icon: 'twofour',
text: '2/4',
value: '2/4',
}, {
icon: 'twelveeight',
text: '12/8',
value: '12/8',
}, {
icon: 'seveneight',
text: '7/8',
value: '7/8',
}, {
icon: 'fiveeight',
text: '5/8',
value: '5/8',
}, {
icon: '',
text: 'Other',
value: 'TimeSigOther',
}, {
icon: '',
text: 'Cancel',
value: 'cancel'
}]
};
getDefinition() {
return SuiTimeSignatureMenu.defaults;
}
async selection(ev: any) {
var text = $(ev.currentTarget).attr('data-value');
if (text === 'TimeSigOther') {
createAndDisplayDialog(SuiTimeSignatureDialog, {
completeNotifier: this.completeNotifier!,
view: this.view,
eventSource: this.eventSource,
id: 'staffGroups',
ctor: 'SuiStaffGroupDialog',
tracker: this.view.tracker,
modifier: null,
startPromise: this.closePromise
});
this.complete();
return;
}
await this.view.setTimeSignature(SmoMeasure.convertLegacyTimeSignature(text));
this.complete();
}
keydown() { }
}