-
Notifications
You must be signed in to change notification settings - Fork 2
/
reamenus.js
103 lines (75 loc) · 2.91 KB
/
reamenus.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
'use strict';
require("babel/register");
// import
const _ = require('lodash');
const fs = require('fs-extra');
const async = require('async');
const MenuSet = require('./models/MenuSet');
// build
function build(menuset) {
// main menus
menuset.menus['Main track'].items = menuset.menus['Track control panel context'].items.slice();
menuset.menus['Main track'].title = '&Track';
menuset.menus['Main item'].items = menuset.menus['Media item context'].items.slice();
menuset.menus['Main item'].title = '&Item';
menuset.menus['Main insert'].items = menuset.menus['Ruler/arrange context'].items.slice();
menuset.menus['Main insert'].title = 'Time&line';
menuset.menus['Main extensions'].title = '&Memory';
// midi menus
menuset.menus['MIDI main navigate'].items = menuset.menus['MIDI piano roll context'].items.slice();
menuset.menus['MIDI main navigate'].title = '&Notes';
let split = undefined;
menuset.menus['MIDI main navigate'].items.some((item, i) => {
if (_.includes(item.name, 'Velocity list')) {
menuset.menus['MIDI main navigate'].items.splice(i, 1);
return true;
}
});
menuset.menus['MIDI main menu context'].items.forEach((item) => {
if (!item.items) {
return;
}
switch (item.name.replace(/&/g, '').trim()) {
case 'File':
return item.items = menuset.menus['MIDI main file'].items.slice();
case 'Edit':
return item.items = menuset.menus['MIDI main edit'].items.slice();
case 'Notes':
return item.items = menuset.menus['MIDI main navigate'].items.slice();
case 'Options':
return item.items = menuset.menus['MIDI main options'].items.slice();
case 'View':
return item.items = menuset.menus['MIDI main view'].items.slice();
case 'Contents':
return item.items = menuset.menus['MIDI main contents'].items.slice();
case 'Actions':
return item.items = menuset.menus['MIDI main actions'].items.slice();
}
});
// envelope menus
menuset.menus['Envelope context'].items.some((envItem, e) => {
if (envItem.constructor.name != 'Separator') {
return;
}
return menuset.menus['Envelope point context'].items.some((pntItem, p) => {
if (pntItem.constructor.name != 'Separator') {
return;
}
return menuset.menus['Envelope point context'].items = menuset.menus['Envelope point context'].items.slice(0, e).concat(menuset.menus['Envelope point context'].items.slice(p));
});
});
// track menus
menuset.menus['Empty TCP context'].items = menuset.menus['Track control panel context'].items.slice();
// toolbars
menuset.menus = _.omit(menuset.menus, (menu, name) => {
return _.includes(name.toLowerCase(), 'toolbar');
});
// wrap up
menuset.style().write();
}
// run
fs.readdir('./input', (err, files) => {
async.each(files, (menuset) => {
build(new MenuSet('./input/' + menuset, './output/' + menuset));
});
});