Skip to content

Commit 1401fcf

Browse files
committed
Hold shift (or long press on touch screen) and drag in pattern editor to select part of it. Pattern selection can be dragged, copied, and pasted.
1 parent f784eda commit 1401fcf

16 files changed

+696
-228
lines changed

editor/BeatsPerBarPrompt.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import {Config} from "../synth/SynthConfig";
44
import {HTML} from "imperative-html/dist/esm/elements-strict";
5-
import {SongDocument, StateChangeType} from "./SongDocument";
5+
import {SongDocument} from "./SongDocument";
66
import {Prompt} from "./Prompt";
77
import {ChangeBeatsPerBar} from "./changes";
88
import {ColorConfig} from "./ColorConfig";
@@ -98,7 +98,7 @@ import {ColorConfig} from "./ColorConfig";
9898
private _saveChanges = (): void => {
9999
window.localStorage.setItem("beatCountStrategy", this._conversionStrategySelect.value);
100100
this._doc.prompt = null;
101-
this._doc.record(new ChangeBeatsPerBar(this._doc, BeatsPerBarPrompt._validate(this._beatsStepper), this._conversionStrategySelect.value), StateChangeType.replace);
101+
this._doc.record(new ChangeBeatsPerBar(this._doc, BeatsPerBarPrompt._validate(this._beatsStepper), this._conversionStrategySelect.value), true);
102102
}
103103
}
104104
//}

editor/ChannelSettingsPrompt.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import {Config} from "../synth/SynthConfig";
44
import {HTML} from "imperative-html/dist/esm/elements-strict";
5-
import {SongDocument, StateChangeType} from "./SongDocument";
5+
import {SongDocument} from "./SongDocument";
66
import {Prompt} from "./Prompt";
77
import {ChangeGroup} from "./Change";
88
import {ChangePatternsPerChannel, ChangeInstrumentsPerChannel, ChangeChannelCount} from "./changes";
@@ -123,7 +123,7 @@ import {ChangePatternsPerChannel, ChangeInstrumentsPerChannel, ChangeChannelCoun
123123
group.append(new ChangeInstrumentsPerChannel(this._doc, ChannelSettingsPrompt._validate(this._instrumentsStepper)));
124124
group.append(new ChangeChannelCount(this._doc, ChannelSettingsPrompt._validate(this._pitchChannelStepper), ChannelSettingsPrompt._validate(this._drumChannelStepper)));
125125
this._doc.prompt = null;
126-
this._doc.record(group, StateChangeType.replace);
126+
this._doc.record(group, true);
127127
}
128128
}
129129
//}

editor/EditorConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {DictionaryArray, BeepBoxOption, InstrumentType, toNameMap} from "../synt
2323
}
2424

2525
export class EditorConfig {
26-
public static readonly version: string = "3.0.12";
26+
public static readonly version: string = "3.0.13";
2727

2828
public static readonly versionDisplayName: string = "BeepBox " + EditorConfig.version;
2929
public static readonly presetCategories: DictionaryArray<PresetCategory> = toNameMap([

editor/ImportPrompt.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import {InstrumentType, Config} from "../synth/SynthConfig";
44
import {NotePin, Note, makeNotePin, Pattern, Instrument, Channel, Song, Synth} from "../synth/synth";
55
import {Preset, EditorConfig} from "./EditorConfig";
6-
import {SongDocument, StateChangeType} from "./SongDocument";
6+
import {SongDocument} from "./SongDocument";
77
import {Prompt} from "./Prompt";
88
import {HTML} from "imperative-html/dist/esm/elements-strict";
99
import {ChangeGroup} from "./Change";
@@ -57,7 +57,7 @@ import {ArrayBufferReader} from "./ArrayBufferReader";
5757
reader.addEventListener("load", (event: Event): void => {
5858
this._doc.prompt = null;
5959
this._doc.goBackToStart();
60-
this._doc.record(new ChangeSong(this._doc, <string>reader.result), StateChangeType.replace, true);
60+
this._doc.record(new ChangeSong(this._doc, <string>reader.result), true, true);
6161
});
6262
reader.readAsText(file);
6363
} else if (extension == "midi" || extension == "mid") {
@@ -860,7 +860,7 @@ import {ArrayBufferReader} from "./ArrayBufferReader";
860860
this._doc.goBackToStart();
861861
for (const channel of this._doc.song.channels) channel.muted = false;
862862
this._doc.prompt = null;
863-
this._doc.record(new ChangeImportMidi(this._doc), StateChangeType.replace, true);
863+
this._doc.record(new ChangeImportMidi(this._doc), true, true);
864864
}
865865
}
866866
//}

editor/MoveNotesSidewaysPrompt.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import {Config} from "../synth/SynthConfig";
44
import {HTML} from "imperative-html/dist/esm/elements-strict";
5-
import {SongDocument, StateChangeType} from "./SongDocument";
5+
import {SongDocument} from "./SongDocument";
66
import {Prompt} from "./Prompt";
77
import {ChangeMoveNotesSideways} from "./changes";
88
import {ColorConfig} from "./ColorConfig";
@@ -84,7 +84,7 @@ import {ColorConfig} from "./ColorConfig";
8484
private _saveChanges = (): void => {
8585
window.localStorage.setItem("moveNotesSidewaysStrategy", this._conversionStrategySelect.value);
8686
this._doc.prompt = null;
87-
this._doc.record(new ChangeMoveNotesSideways(this._doc, +this._beatsStepper.value, this._conversionStrategySelect.value), StateChangeType.replace);
87+
this._doc.record(new ChangeMoveNotesSideways(this._doc, +this._beatsStepper.value, this._conversionStrategySelect.value), true);
8888
}
8989
}
9090
//}

editor/OctaveScrollBar.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (C) 2020 John Nesky, distributed under the MIT license.
22

33
import {Config} from "../synth/SynthConfig";
4-
import {SongDocument, StateChangeType} from "./SongDocument";
4+
import {SongDocument} from "./SongDocument";
55
import {HTML, SVG} from "imperative-html/dist/esm/elements-strict";
66
import {ChangeOctave} from "./changes";
77
import {ColorConfig} from "./ColorConfig";
@@ -175,12 +175,12 @@ import {ColorConfig} from "./ColorConfig";
175175
if (this._mouseY < this._barBottom - this._barHeight * 0.5) {
176176
if (currentOctave < Config.scrollableOctaves) {
177177
this._change = new ChangeOctave(this._doc, oldValue, currentOctave + 1);
178-
this._doc.record(this._change, canReplaceLastChange ? StateChangeType.replace : StateChangeType.push);
178+
this._doc.record(this._change, canReplaceLastChange);
179179
}
180180
} else {
181181
if (currentOctave > 0) {
182182
this._change = new ChangeOctave(this._doc, oldValue, currentOctave - 1);
183-
this._doc.record(this._change, canReplaceLastChange ? StateChangeType.replace : StateChangeType.push);
183+
this._doc.record(this._change, canReplaceLastChange);
184184
}
185185
}
186186
}

0 commit comments

Comments
 (0)