Skip to content

Commit

Permalink
Hold shift (or long press on touch screen) and drag in pattern editor…
Browse files Browse the repository at this point in the history
… to select part of it. Pattern selection can be dragged, copied, and pasted.
  • Loading branch information
johnnesky committed Dec 25, 2020
1 parent f784eda commit 1401fcf
Show file tree
Hide file tree
Showing 16 changed files with 696 additions and 228 deletions.
4 changes: 2 additions & 2 deletions editor/BeatsPerBarPrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import {Config} from "../synth/SynthConfig";
import {HTML} from "imperative-html/dist/esm/elements-strict";
import {SongDocument, StateChangeType} from "./SongDocument";
import {SongDocument} from "./SongDocument";
import {Prompt} from "./Prompt";
import {ChangeBeatsPerBar} from "./changes";
import {ColorConfig} from "./ColorConfig";
Expand Down Expand Up @@ -98,7 +98,7 @@ import {ColorConfig} from "./ColorConfig";
private _saveChanges = (): void => {
window.localStorage.setItem("beatCountStrategy", this._conversionStrategySelect.value);
this._doc.prompt = null;
this._doc.record(new ChangeBeatsPerBar(this._doc, BeatsPerBarPrompt._validate(this._beatsStepper), this._conversionStrategySelect.value), StateChangeType.replace);
this._doc.record(new ChangeBeatsPerBar(this._doc, BeatsPerBarPrompt._validate(this._beatsStepper), this._conversionStrategySelect.value), true);
}
}
//}
4 changes: 2 additions & 2 deletions editor/ChannelSettingsPrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import {Config} from "../synth/SynthConfig";
import {HTML} from "imperative-html/dist/esm/elements-strict";
import {SongDocument, StateChangeType} from "./SongDocument";
import {SongDocument} from "./SongDocument";
import {Prompt} from "./Prompt";
import {ChangeGroup} from "./Change";
import {ChangePatternsPerChannel, ChangeInstrumentsPerChannel, ChangeChannelCount} from "./changes";
Expand Down Expand Up @@ -123,7 +123,7 @@ import {ChangePatternsPerChannel, ChangeInstrumentsPerChannel, ChangeChannelCoun
group.append(new ChangeInstrumentsPerChannel(this._doc, ChannelSettingsPrompt._validate(this._instrumentsStepper)));
group.append(new ChangeChannelCount(this._doc, ChannelSettingsPrompt._validate(this._pitchChannelStepper), ChannelSettingsPrompt._validate(this._drumChannelStepper)));
this._doc.prompt = null;
this._doc.record(group, StateChangeType.replace);
this._doc.record(group, true);
}
}
//}
2 changes: 1 addition & 1 deletion editor/EditorConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {DictionaryArray, BeepBoxOption, InstrumentType, toNameMap} from "../synt
}

export class EditorConfig {
public static readonly version: string = "3.0.12";
public static readonly version: string = "3.0.13";

public static readonly versionDisplayName: string = "BeepBox " + EditorConfig.version;
public static readonly presetCategories: DictionaryArray<PresetCategory> = toNameMap([
Expand Down
6 changes: 3 additions & 3 deletions editor/ImportPrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import {InstrumentType, Config} from "../synth/SynthConfig";
import {NotePin, Note, makeNotePin, Pattern, Instrument, Channel, Song, Synth} from "../synth/synth";
import {Preset, EditorConfig} from "./EditorConfig";
import {SongDocument, StateChangeType} from "./SongDocument";
import {SongDocument} from "./SongDocument";
import {Prompt} from "./Prompt";
import {HTML} from "imperative-html/dist/esm/elements-strict";
import {ChangeGroup} from "./Change";
Expand Down Expand Up @@ -57,7 +57,7 @@ import {ArrayBufferReader} from "./ArrayBufferReader";
reader.addEventListener("load", (event: Event): void => {
this._doc.prompt = null;
this._doc.goBackToStart();
this._doc.record(new ChangeSong(this._doc, <string>reader.result), StateChangeType.replace, true);
this._doc.record(new ChangeSong(this._doc, <string>reader.result), true, true);
});
reader.readAsText(file);
} else if (extension == "midi" || extension == "mid") {
Expand Down Expand Up @@ -860,7 +860,7 @@ import {ArrayBufferReader} from "./ArrayBufferReader";
this._doc.goBackToStart();
for (const channel of this._doc.song.channels) channel.muted = false;
this._doc.prompt = null;
this._doc.record(new ChangeImportMidi(this._doc), StateChangeType.replace, true);
this._doc.record(new ChangeImportMidi(this._doc), true, true);
}
}
//}
4 changes: 2 additions & 2 deletions editor/MoveNotesSidewaysPrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import {Config} from "../synth/SynthConfig";
import {HTML} from "imperative-html/dist/esm/elements-strict";
import {SongDocument, StateChangeType} from "./SongDocument";
import {SongDocument} from "./SongDocument";
import {Prompt} from "./Prompt";
import {ChangeMoveNotesSideways} from "./changes";
import {ColorConfig} from "./ColorConfig";
Expand Down Expand Up @@ -84,7 +84,7 @@ import {ColorConfig} from "./ColorConfig";
private _saveChanges = (): void => {
window.localStorage.setItem("moveNotesSidewaysStrategy", this._conversionStrategySelect.value);
this._doc.prompt = null;
this._doc.record(new ChangeMoveNotesSideways(this._doc, +this._beatsStepper.value, this._conversionStrategySelect.value), StateChangeType.replace);
this._doc.record(new ChangeMoveNotesSideways(this._doc, +this._beatsStepper.value, this._conversionStrategySelect.value), true);
}
}
//}
6 changes: 3 additions & 3 deletions editor/OctaveScrollBar.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2020 John Nesky, distributed under the MIT license.

import {Config} from "../synth/SynthConfig";
import {SongDocument, StateChangeType} from "./SongDocument";
import {SongDocument} from "./SongDocument";
import {HTML, SVG} from "imperative-html/dist/esm/elements-strict";
import {ChangeOctave} from "./changes";
import {ColorConfig} from "./ColorConfig";
Expand Down Expand Up @@ -175,12 +175,12 @@ import {ColorConfig} from "./ColorConfig";
if (this._mouseY < this._barBottom - this._barHeight * 0.5) {
if (currentOctave < Config.scrollableOctaves) {
this._change = new ChangeOctave(this._doc, oldValue, currentOctave + 1);
this._doc.record(this._change, canReplaceLastChange ? StateChangeType.replace : StateChangeType.push);
this._doc.record(this._change, canReplaceLastChange);
}
} else {
if (currentOctave > 0) {
this._change = new ChangeOctave(this._doc, oldValue, currentOctave - 1);
this._doc.record(this._change, canReplaceLastChange ? StateChangeType.replace : StateChangeType.push);
this._doc.record(this._change, canReplaceLastChange);
}
}
}
Expand Down
Loading

0 comments on commit 1401fcf

Please sign in to comment.