comparison src/DML/MainVisBundle/Resources/assets/marionette/App.90-shortcuts-to-states.js @ 0:493bcb69166c

added public content
author Daniel Wolff
date Tue, 09 Feb 2016 20:54:02 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:493bcb69166c
1 "use strict";
2
3 App.addInitializer(function(options){
4
5 var $document = $(document);
6
7
8 var cid = 0;
9 var uniqueClientId = function() {
10 return "custom" + cid++;
11 };
12
13 var nextUniqueClientId = function() {
14 return "custom" + cid;
15 };
16
17 // Resetting a default state
18 $document.bind("keydown", "shift+0", function(event) {
19 App.context.get("state").unserialize(App.contextManager.defaultSerializedAppContexts[""].stateHistory.currentSerializedState);
20 });
21
22 var sharedMusicRecordingConfig = {
23 "viewConfigs": [
24 {clientId: "def4", parameters: {kind: "properties"}},
25 {clientId: "def5", parameters: {kind: "midi-pitch-histogram"}},
26 ],
27 };
28
29 // Moving to a specific state
30 $document.bind("keydown", "shift+1", function(event) {
31 App.context.get("state").unserialize({
32 //"musicRecordingsGridIsShown": App.context.get("state").get("musicRecordingsGridIsShown"),
33 "musicCollectionGrid": {
34 "selectedEntityConfigClientId": nextUniqueClientId(),
35 "entityConfigs": [
36 {clientId: uniqueClientId(), parameters: {library: "bl", composer: "Haydn", performer: "Karajan", year: "1959", title: "Symphonies;104"}},
37 ],
38 "viewConfigs": [
39 {clientId: uniqueClientId(), parameters: {kind: "list"}},
40 {clientId: uniqueClientId(), parameters: {kind: "tuning-stats"}},
41 ],
42 },
43 "musicRecordingGrid": sharedMusicRecordingConfig
44 });
45 });
46
47
48 $document.bind("keydown", "shift+2", function(event) {
49 App.context.get("state").unserialize({
50 "musicCollectionGrid": {
51 "selectedEntityConfigClientId": nextUniqueClientId(),
52 "entityConfigs": [
53 {clientId: uniqueClientId(), parameters: {library: "bl;charm", composer: "Haydn", title: "Symphony"}},
54 ],
55 "viewConfigs": [
56 {clientId: uniqueClientId(), parameters: {kind: "list"}},
57 {clientId: uniqueClientId(), parameters: {kind: "tuning-stats"}},
58 ],
59 },
60 "musicRecordingGrid": sharedMusicRecordingConfig
61 });
62 });
63
64 $document.bind("keydown", "shift+3", function(event) {
65 App.context.get("state").unserialize({
66 "musicCollectionGrid": {
67 "selectedEntityConfigClientId": nextUniqueClientId(),
68 "entityConfigs": [
69 {clientId: uniqueClientId(), parameters: {library: "bl;charm", year: "1940-1979", title: "Symphony"}},
70 {clientId: uniqueClientId(), parameters: {kind: "pair", "comparisonMode": "superposition"}},
71 {clientId: uniqueClientId(), parameters: {library: "bl;charm", year: "1980-2010", title: "Symphony"}},
72 ],
73 "viewConfigs": [
74 {clientId: uniqueClientId(), parameters: {kind: "list"}},
75 {clientId: uniqueClientId(), parameters: {kind: "tuning-stats"}},
76 ],
77 },
78 "musicRecordingGrid": sharedMusicRecordingConfig
79 });
80 });
81
82 $document.bind("keydown", "shift+4", function(event) {
83 App.context.get("state").unserialize({
84 "musicCollectionGrid": {
85 "selectedEntityConfigClientId": nextUniqueClientId(),
86 "entityConfigs": [
87 {clientId: uniqueClientId(), parameters: {library: "bl;charm", composer: "Schoenberg"}},
88 ],
89 "viewConfigs": [
90 {clientId: uniqueClientId(), parameters: {kind: "midi-pitch-histogram"}},
91 ],
92 },
93 "musicRecordingGrid": sharedMusicRecordingConfig
94 });
95 });
96
97
98 $document.bind("keydown", "shift+5", function(event) {
99 App.context.get("state").unserialize({
100 "musicCollectionGrid": {
101 "selectedEntityConfigClientId": nextUniqueClientId(),
102 "entityConfigs": [
103 {clientId: uniqueClientId(), parameters: {library: "bl", collection: "dinka"}},
104 ],
105 "viewConfigs": [
106 {clientId: uniqueClientId(), parameters: {kind: "list"}},
107 {clientId: uniqueClientId(), parameters: {kind: "pitch-histogram"}},
108 {clientId: uniqueClientId(), parameters: {kind: "midi-pitch-histogram"}},
109 ],
110 },
111 "musicRecordingGrid": sharedMusicRecordingConfig
112 });
113 });
114
115 $document.bind("keydown", "shift+6", function(event) {
116 App.context.get("state").unserialize({
117 "musicCollectionGrid": {
118 "selectedEntityConfigClientId": nextUniqueClientId(),
119 "entityConfigs": [
120 {clientId: uniqueClientId(), parameters: {library: "bl;charm", composer: "Chopin", title: "Mazurka;Op.68;no.2"}},
121 ],
122 "viewConfigs": [
123 {clientId: uniqueClientId(), parameters: {kind: "list"}},
124 {clientId: uniqueClientId(), parameters: {kind: "mean-tempo-curve"}},
125 ],
126 },
127 "musicRecordingGrid": sharedMusicRecordingConfig
128 });
129 });
130
131
132
133 $document.bind("keydown", "shift+7", function(event) {
134 App.context.get("state").unserialize({
135 "musicCollectionGrid": {
136 "selectedEntityConfigClientId": nextUniqueClientId(),
137 "entityConfigs": [
138 {clientId: uniqueClientId(), parameters: {library: "bl;charm", composer: "Chopin", title: "Mazurka;Op.68;no.2"}},
139 {clientId: uniqueClientId(), parameters: {library: "bl;charm", composer: "Chopin"}},
140 ],
141 "viewConfigs": [
142 {clientId: uniqueClientId(), parameters: {kind: "list"}},
143 {clientId: uniqueClientId(), parameters: {kind: "mean-tempo-curve"}},
144 ],
145 },
146 "musicRecordingGrid": sharedMusicRecordingConfig
147 });
148 });
149 });