Skip to content

Commit a80707b

Browse files
create endings dialog, will remove buttons
1 parent 59eec58 commit a80707b

File tree

17 files changed

+490
-285
lines changed

17 files changed

+490
-285
lines changed

build/styles/dialogs.css

Lines changed: 7 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -225,72 +225,17 @@ button.nav-link {
225225
.attributeModal .buttonContainer .button-right {
226226
margin-left:5px;
227227
}
228-
229-
230-
.attributeModal .buttonContainer button {
231-
border-radius:3px;
232-
padding: 2px 4px;
233-
width:100px;
234-
height:25px;
235-
}
236-
237-
.attributeModal .buttonContainer .ok-button {
238-
border:#9cee9d 1px ridge;
239-
}
240-
241-
.attributeModal .buttonContainer .ok-button:hover {
242-
background:#334488;
243-
color: #fff;
244-
transition-duration: 0.5s;
245-
transition-timing-function:ease;
246-
}
247-
248-
.attributeModal .buttonContainer .cancel-button:hover {
249-
background:#884433;
250-
color: #fff;
251-
transition-duration: 0.5s;
252-
transition-timing-function:ease;
253-
}
254-
255-
.attributeModal .buttonContainer .remove-button:hover {
256-
background:#664433;
257-
color: #ded;
258-
transition-duration: 0.5s;
259-
transition-timing-function:ease;
260-
}
261-
262-
.attributeModal .buttonContainer .remove-button:hover .icon-cancel-circle {
263-
background:#664433;
264-
color: #ded;
265-
}
266-
267-
.attributeModal .buttonContainer .remove-button .icon-cancel-circle {
268-
float:left;
269-
color:#933;
270-
}
271-
272-
.attributeModal .buttonContainer .ok-button:hover {
273-
background:#334488;
274-
color: #fff;
275-
transition-duration: 0.5s;
276-
transition-timing-function:ease;
277-
}
278-
279-
280-
.attributeModal .buttonContainer .cancel-button {
281-
border:#dc8899 1px ridge;
282-
}
283-
284-
.attributeModal .buttonContainer .remove-button {
285-
border:#dc8899 1px ridge;
286-
}
287-
288-
289228
.attributeModal h2 {
290229
text-align:center;
291230
font-size:1.2em;
292231
}
293232

233+
.smoControlContainer .button-array-buttons button.repetext {
234+
font-size: 0.8em;
235+
font-style: italic;
236+
flex: 4 1 220px;
237+
width: 120px;
238+
}
294239
.attributeModal.tempoTextMode #dialog-tempo-duration,
295240
.attributeModal.tempoTextMode #dialog-tempo-bpm ,
296241
.attributeModal.tempoDurationMode #dialog-tempo-tempoText {
@@ -417,7 +362,7 @@ button.nav-link {
417362
.attributeModal .smoControl.buttonArray .button-array-row{
418363
display: flex;
419364
flex-flow: row nowrap;
420-
justify-content:space-between;
365+
justify-content:flex-start;
421366
}
422367
.button-array-buttons {
423368
display: flex;

build/styles/ribbon.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,10 @@ button.addChord .left-text .icon {
381381
left:10px;
382382
}
383383

384+
.controls-top .ribbonButtonContainer .ribbon-button-text.icon-smo.icon {
385+
position: absolute;
386+
left: 12px;
387+
}
384388
.controls-top button.articulation {
385389
width:50px;
386390
}

src/application/exports.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import { SuiInstrumentDialog } from '../ui/dialogs/instrument';
4949
import { SuiTimeSignatureDialog } from '../ui/dialogs/timeSignature';
5050
import { SuiTempoDialog } from '../ui/dialogs/tempo';
5151
import { SuiNoteHeadAdapter, SuiNoteHeadDialog, SuiNoteHeadButtonComponent } from '../ui/dialogs/noteHead';
52+
import { SuiEndingsAdapter, SuiEndingsDialog, SuiEndingsButtonComponent } from '../ui/dialogs/endings';
5253
import { SuiScoreIdentificationDialog } from '../ui/dialogs/scoreId';
5354
import { SuiScorePreferencesDialog } from '../ui/dialogs/preferences';
5455
import { SuiPageLayoutDialog } from '../ui/dialogs/pageLayout';
@@ -199,7 +200,7 @@ export const Smo = {
199200
SuiPartInfoDialog, SuiOrnamentDialog, SuiOrnamentButtonComponent,
200201
SuiArticulationDialog, SuiArticulationButtonComponent, SuiArticulationAdapter,
201202
SuiMicrotoneAdapter, SuiMicrotoneButtonComponent, SuiMicrotoneDialog,
202-
SuiNoteHeadAdapter, SuiNoteHeadDialog,
203+
SuiNoteHeadAdapter, SuiNoteHeadDialog, SuiEndingsAdapter, SuiEndingsDialog, SuiEndingsButtonComponent,
203204
SuiNoteHeadButtonComponent,
204205
/* SuiLoadActionsDialog, SuiSaveActionsDialog, */
205206
SuiPrintFileDialog, SuiSaveFileDialog, SuiSaveXmlDialog, SuiSaveVexDialog,

src/render/sui/scoreView.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,24 @@ export abstract class SuiScoreView {
178178
}
179179
this._renderChangedMeasures(SmoSelection.getMeasureList([selection]));
180180
}
181+
/**
182+
* Modifiy a set of columns, e.g. tempo, time, key. This has different undo behavior, don't
183+
* pend on the result because there may be a combination of operations.
184+
* @param label
185+
* @param selections
186+
* @param actor
187+
*/
188+
modifyColumnsSelectionsNoWait(label: string, selections: SmoSelection[], actor: updateSingleSelectionFunc) {
189+
this.undoColumnRange(label, selections);
190+
selections.forEach((selection) => {
191+
const altSelection = this._getEquivalentSelection(selection);
192+
actor(this.score, selection);
193+
if (altSelection) {
194+
actor(this.storeScore, altSelection);
195+
}
196+
});
197+
this._renderChangedMeasures(selections);
198+
}
181199
/**
182200
* This is used in some Smoosic demos and pens.
183201
* @param action any action, but most usefully a SuiScoreView method
@@ -264,7 +282,15 @@ export abstract class SuiScoreView {
264282
_undoScorePreferences(label: string) {
265283
this.storeUndo.addBuffer(label, UndoBuffer.bufferTypes.SCORE_ATTRIBUTES, SmoSelector.default, this.storeScore, UndoBuffer.bufferSubtypes.NONE);
266284
}
267-
285+
undoColumnRange(label: string, measureSelections: SmoSelection[]) {
286+
const checked: Record<number, boolean> = {};
287+
measureSelections.forEach((measureSelection) => {
288+
if (!checked[measureSelection.selector.measure]) {
289+
checked[measureSelection.selector.measure] = true;
290+
this._undoColumn(label, measureSelection.selector.measure);
291+
}
292+
});
293+
}
268294
undoMeasureRange(label: string, measureSelections: SmoSelection[]) {
269295
measureSelections.forEach((measureSelection) => {
270296
const equiv = this._getEquivalentSelection(measureSelection);

src/render/vex/glyphDimensions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ export class vexGlyph {
1414
static barWidth(b: SmoBarline): number {
1515
const str = SmoBarline.barlineString(b);
1616
const cc = vexGlyph.dimensions[str];
17+
if (typeof(cc) === 'undefined') {
18+
return 0;
19+
}
1720
return cc.width + cc.spacingRight;
1821
}
1922
static accidentalWidth(accidental: string): number {

src/smo/data/measureModifiers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ export class SmoRepeatSymbol extends SmoMeasureModifierBase {
322322
Coda: 1,
323323
Segno: 2,
324324
Dc: 3,
325-
ToCoda: 1,
325+
ToCoda: 10,
326326
DcAlCoda: 4,
327327
DcAlFine: 5,
328328
Ds: 6,

src/smo/data/music.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ export class SmoMusic {
542542
{ letter: 'b', accidental: 'b', role: '6'},
543543
{ letter: 'b', accidental: 'n', role: '7/7'},
544544
{ letter: 'c', accidental: 'b', role: 'b7'},
545-
{ letter: 'b', accidental: '#', role: '7'}
545+
{ letter: 'c', accidental: 'n', role: '7'}
546546
], 'd': [
547547
{ letter: 'd', accidental: 'n', role: 'tonic' },
548548
{ letter: 'd', accidental: '#', role: '7/2' },

src/smo/xform/undo.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ export class UndoBuffer {
153153
*/
154154
addBuffer(title: string, type: number, selector: SmoSelector, obj: any, subtype: number) {
155155
this.checkNull();
156-
let i = 0;
157-
let j = 0;
158156
if (typeof(type) !== 'number' || type < UndoBuffer.bufferTypes.FIRST || type > UndoBuffer.bufferTypes.LAST) {
159157
throw 'Undo failure: illegal buffer type ' + type;
160158
}
@@ -169,8 +167,8 @@ export class UndoBuffer {
169167
// RECTANGLE obj is {score, topLeft, bottomRight}
170168
// where the last 2 are selectors
171169
const measures = [];
172-
for (i = obj.topLeft.staff; i <= obj.bottomRight.staff; ++i) {
173-
for (j = obj.topLeft.measure; j <= obj.bottomRight.measure; ++j) {
170+
for (let i = obj.topLeft.staff; i <= obj.bottomRight.staff; ++i) {
171+
for (let j = obj.topLeft.measure; j <= obj.bottomRight.measure; ++j) {
174172
measures.push(UndoBuffer.serializeMeasure(obj.score.staves[i].measures[j]));
175173
}
176174
}
@@ -295,17 +293,21 @@ export class UndoBuffer {
295293
return [buf.json.startSelector.measure, buf.json.endSelector.measure];
296294
}
297295
if (buf.type === UndoBuffer.bufferTypes.COLUMN) {
298-
min = buf.json.measureIndex;
296+
if (min < 0) {
297+
min = buf.json.measureIndex;
298+
} else {
299+
min = Math.min(min, buf.json.measureIndex);
300+
}
299301
buf.json.measures.forEach((mmjson: SmoMeasureParamsSer) => {
300302
max = Math.max(max, mmjson.measureNumber.measureIndex);
301303
});
302-
return [min, max];
303-
}
304-
if (min < 0) {
305-
min = buf.selector.measure;
304+
} else {
305+
if (min < 0) {
306+
min = buf.selector.measure;
307+
}
308+
max = Math.max(max, buf.selector.measure);
309+
min = Math.min(min, buf.selector.measure);
306310
}
307-
max = Math.max(max, buf.selector.measure);
308-
min = Math.min(min, buf.selector.measure);
309311
}
310312
}
311313
return [Math.max(0, min), max];
@@ -336,8 +338,6 @@ export class UndoBuffer {
336338
* @returns
337339
*/
338340
undo(score: SmoScore, staffMap: Record<number, number>, pop: boolean): SmoScore {
339-
let i = 0;
340-
let j = 0;
341341
let mix = 0;
342342
let bufset: UndoSet | null = this.popUndoSet();
343343
if (!bufset) {
@@ -346,15 +346,15 @@ export class UndoBuffer {
346346
for (let i = 0; i < bufset.buffers.length; ++i) {
347347
const buf = bufset.buffers[bufset.buffers.length - (i + 1)];
348348
if (buf.type === UndoBuffer.bufferTypes.RECTANGLE) {
349-
for (i = buf.json.topLeft.staff; i <= buf.json.bottomRight.staff; ++i) {
350-
for (j = buf.json.topLeft.measure; j <= buf.json.bottomRight.measure; ++j) {
349+
for (let j = buf.json.topLeft.staff; j <= buf.json.bottomRight.staff; ++j) {
350+
for (let k = buf.json.topLeft.measure; k <= buf.json.bottomRight.measure; ++k) {
351351
const measure = SmoMeasure.deserialize(buf.json.measures[mix]);
352352
mix += 1;
353353
const selector = SmoSelector.default;
354-
if (typeof(staffMap[i]) === 'number') {
355-
selector.staff = staffMap[i];
356-
measure.measureNumber.staffId = staffMap[i];
357-
selector.measure = j;
354+
if (typeof(staffMap[j]) === 'number') {
355+
selector.staff = staffMap[j];
356+
measure.measureNumber.staffId = staffMap[j];
357+
selector.measure = k;
358358
score.replaceMeasure(selector, measure);
359359
}
360360
}
@@ -380,12 +380,12 @@ export class UndoBuffer {
380380
} else if (buf.type === UndoBuffer.bufferTypes.SCORE_ATTRIBUTES) {
381381
smoSerialize.serializedMerge(SmoScore.preferences, buf.json, score);
382382
} else if (buf.type === UndoBuffer.bufferTypes.COLUMN) {
383-
for (i = 0; i < score.staves.length; ++i) {
384-
const measure = SmoMeasure.deserialize(buf.json.measures[i]);
383+
for (let j = 0; j < score.staves.length; ++j) {
384+
const measure = SmoMeasure.deserialize(buf.json.measures[j]);
385385
const selector = SmoSelector.default;
386-
if (typeof(staffMap[i]) === 'number') {
387-
selector.staff = staffMap[i];
388-
measure.measureNumber.staffId = staffMap[i];
386+
if (typeof(staffMap[j]) === 'number') {
387+
selector.staff = staffMap[j];
388+
measure.measureNumber.staffId = staffMap[j];
389389
selector.measure = buf.json.measureIndex;
390390
score.replaceMeasure(selector, measure);
391391
}

src/styles/dialogs.css

Lines changed: 7 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -225,72 +225,17 @@ button.nav-link {
225225
.attributeModal .buttonContainer .button-right {
226226
margin-left:5px;
227227
}
228-
229-
230-
.attributeModal .buttonContainer button {
231-
border-radius:3px;
232-
padding: 2px 4px;
233-
width:100px;
234-
height:25px;
235-
}
236-
237-
.attributeModal .buttonContainer .ok-button {
238-
border:#9cee9d 1px ridge;
239-
}
240-
241-
.attributeModal .buttonContainer .ok-button:hover {
242-
background:#334488;
243-
color: #fff;
244-
transition-duration: 0.5s;
245-
transition-timing-function:ease;
246-
}
247-
248-
.attributeModal .buttonContainer .cancel-button:hover {
249-
background:#884433;
250-
color: #fff;
251-
transition-duration: 0.5s;
252-
transition-timing-function:ease;
253-
}
254-
255-
.attributeModal .buttonContainer .remove-button:hover {
256-
background:#664433;
257-
color: #ded;
258-
transition-duration: 0.5s;
259-
transition-timing-function:ease;
260-
}
261-
262-
.attributeModal .buttonContainer .remove-button:hover .icon-cancel-circle {
263-
background:#664433;
264-
color: #ded;
265-
}
266-
267-
.attributeModal .buttonContainer .remove-button .icon-cancel-circle {
268-
float:left;
269-
color:#933;
270-
}
271-
272-
.attributeModal .buttonContainer .ok-button:hover {
273-
background:#334488;
274-
color: #fff;
275-
transition-duration: 0.5s;
276-
transition-timing-function:ease;
277-
}
278-
279-
280-
.attributeModal .buttonContainer .cancel-button {
281-
border:#dc8899 1px ridge;
282-
}
283-
284-
.attributeModal .buttonContainer .remove-button {
285-
border:#dc8899 1px ridge;
286-
}
287-
288-
289228
.attributeModal h2 {
290229
text-align:center;
291230
font-size:1.2em;
292231
}
293232

233+
.smoControlContainer .button-array-buttons button.repetext {
234+
font-size: 0.8em;
235+
font-style: italic;
236+
flex: 4 1 220px;
237+
width: 120px;
238+
}
294239
.attributeModal.tempoTextMode #dialog-tempo-duration,
295240
.attributeModal.tempoTextMode #dialog-tempo-bpm ,
296241
.attributeModal.tempoDurationMode #dialog-tempo-tempoText {
@@ -417,7 +362,7 @@ button.nav-link {
417362
.attributeModal .smoControl.buttonArray .button-array-row{
418363
display: flex;
419364
flex-flow: row nowrap;
420-
justify-content:space-between;
365+
justify-content:flex-start;
421366
}
422367
.button-array-buttons {
423368
display: flex;

src/styles/ribbon.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,10 @@ button.addChord .left-text .icon {
381381
left:10px;
382382
}
383383

384+
.controls-top .ribbonButtonContainer .ribbon-button-text.icon-smo.icon {
385+
position: absolute;
386+
left: 12px;
387+
}
384388
.controls-top button.articulation {
385389
width:50px;
386390
}

0 commit comments

Comments
 (0)