Custom plugin display name. Rename dialog cosmetics.
This commit is contained in:
@@ -1031,6 +1031,7 @@ export
|
|||||||
<RenameDialog
|
<RenameDialog
|
||||||
open={this.state.renameBankDialogOpen || this.state.saveBankAsDialogOpen}
|
open={this.state.renameBankDialogOpen || this.state.saveBankAsDialogOpen}
|
||||||
defaultName={this.model_.banks.get().getSelectedEntryName()}
|
defaultName={this.model_.banks.get().getSelectedEntryName()}
|
||||||
|
title="Bank Name"
|
||||||
acceptActionName={this.state.renameBankDialogOpen ? "Rename" : "Save as"}
|
acceptActionName={this.state.renameBankDialogOpen ? "Rename" : "Save as"}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|||||||
@@ -458,7 +458,7 @@ const BankDialog = withStyles(
|
|||||||
|
|
||||||
<div style={{ flex: "0 0 auto", display: "flex", flexFlow: "row nowrap", alignItems: "center" }}>
|
<div style={{ flex: "0 0 auto", display: "flex", flexFlow: "row nowrap", alignItems: "center" }}>
|
||||||
<Button color="inherit" onClick={(e) => this.handleCopy()}>
|
<Button color="inherit" onClick={(e) => this.handleCopy()}>
|
||||||
Copy
|
Save as
|
||||||
</Button>
|
</Button>
|
||||||
<Button color="inherit" onClick={() => this.handleRenameClick()}>
|
<Button color="inherit" onClick={() => this.handleRenameClick()}>
|
||||||
Rename
|
Rename
|
||||||
@@ -466,6 +466,7 @@ const BankDialog = withStyles(
|
|||||||
<RenameDialog
|
<RenameDialog
|
||||||
open={this.state.filenameDialogOpen}
|
open={this.state.filenameDialogOpen}
|
||||||
defaultName={this.getSelectedName()}
|
defaultName={this.getSelectedName()}
|
||||||
|
title={this.state.filenameSaveAs ? "Save Bank As" : "Bank Name"}
|
||||||
acceptActionName={this.state.filenameSaveAs ? "SAVE AS" : "RENAME"}
|
acceptActionName={this.state.filenameSaveAs ? "SAVE AS" : "RENAME"}
|
||||||
onClose={() => { this.setState({ filenameDialogOpen: false }) }}
|
onClose={() => { this.setState({ filenameDialogOpen: false }) }}
|
||||||
onOk={(text: string) => {
|
onOk={(text: string) => {
|
||||||
|
|||||||
@@ -1599,6 +1599,7 @@ export default withStyles(
|
|||||||
<RenameDialog open={this.state.newFolderDialogOpen} defaultName=""
|
<RenameDialog open={this.state.newFolderDialogOpen} defaultName=""
|
||||||
onOk={(newName) => { this.setState({ newFolderDialogOpen: false }); this.onExecuteNewFolder(newName) }}
|
onOk={(newName) => { this.setState({ newFolderDialogOpen: false }); this.onExecuteNewFolder(newName) }}
|
||||||
onClose={() => { this.setState({ newFolderDialogOpen: false }); }}
|
onClose={() => { this.setState({ newFolderDialogOpen: false }); }}
|
||||||
|
title="New folder"
|
||||||
acceptActionName="OK"
|
acceptActionName="OK"
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@@ -1606,6 +1607,7 @@ export default withStyles(
|
|||||||
{
|
{
|
||||||
this.state.renameDialogOpen && (
|
this.state.renameDialogOpen && (
|
||||||
<RenameDialog open={this.state.renameDialogOpen} defaultName={this.renameDefaultName()}
|
<RenameDialog open={this.state.renameDialogOpen} defaultName={this.renameDefaultName()}
|
||||||
|
title="Rename"
|
||||||
onOk={(newName) => { this.setState({ renameDialogOpen: false }); this.onExecuteRename(newName) }}
|
onOk={(newName) => { this.setState({ renameDialogOpen: false }); this.onExecuteRename(newName) }}
|
||||||
onClose={() => { this.setState({ renameDialogOpen: false }); }}
|
onClose={() => { this.setState({ renameDialogOpen: false }); }}
|
||||||
acceptActionName="OK"
|
acceptActionName="OK"
|
||||||
|
|||||||
+583
-535
File diff suppressed because it is too large
Load Diff
@@ -61,6 +61,7 @@ export class ControlValue implements Deserializable<ControlValue> {
|
|||||||
export class PedalboardItem implements Deserializable<PedalboardItem> {
|
export class PedalboardItem implements Deserializable<PedalboardItem> {
|
||||||
deserializePedalboardItem(input: any): PedalboardItem {
|
deserializePedalboardItem(input: any): PedalboardItem {
|
||||||
this.instanceId = input.instanceId ?? -1;
|
this.instanceId = input.instanceId ?? -1;
|
||||||
|
this.title = input.title ?? "";
|
||||||
this.uri = input.uri;
|
this.uri = input.uri;
|
||||||
this.pluginName = input.pluginName;
|
this.pluginName = input.pluginName;
|
||||||
this.isEnabled = input.isEnabled;
|
this.isEnabled = input.isEnabled;
|
||||||
@@ -199,6 +200,7 @@ export class PedalboardItem implements Deserializable<PedalboardItem> {
|
|||||||
static EmptyArray: PedalboardItem[] = [];
|
static EmptyArray: PedalboardItem[] = [];
|
||||||
|
|
||||||
instanceId: number = -1;
|
instanceId: number = -1;
|
||||||
|
title: string = "";
|
||||||
isEnabled: boolean = false;
|
isEnabled: boolean = false;
|
||||||
uri: string = "";
|
uri: string = "";
|
||||||
pluginName?: string;
|
pluginName?: string;
|
||||||
|
|||||||
@@ -329,6 +329,9 @@ class PedalLayout {
|
|||||||
this.pluginType = uiPlugin.plugin_type;
|
this.pluginType = uiPlugin.plugin_type;
|
||||||
this.iconUrl = SelectIconUri(uiPlugin.plugin_type);
|
this.iconUrl = SelectIconUri(uiPlugin.plugin_type);
|
||||||
this.name = uiPlugin.label;
|
this.name = uiPlugin.label;
|
||||||
|
if (pedalItem.title !== "") {
|
||||||
|
this.name = pedalItem.title;
|
||||||
|
}
|
||||||
this.numberOfInputs = Math.min(uiPlugin.audio_inputs, 2);
|
this.numberOfInputs = Math.min(uiPlugin.audio_inputs, 2);
|
||||||
this.numberOfOutputs = Math.min(uiPlugin.audio_outputs, 2);
|
this.numberOfOutputs = Math.min(uiPlugin.audio_outputs, 2);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -3153,7 +3153,22 @@ export class PiPedalModel //implements PiPedalModel
|
|||||||
30 * 1000);
|
30 * 1000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
setPedalboardItemTitle(instanceId: number, title: string): void {
|
||||||
|
let pedalboard = this.pedalboard.get();
|
||||||
|
if (!pedalboard) {
|
||||||
|
throw new PiPedalStateError("Pedalboard not loaded.");
|
||||||
|
}
|
||||||
|
let newPedalboard = pedalboard.clone();
|
||||||
|
this.updateVst3State(newPedalboard);
|
||||||
|
let item = newPedalboard.getItem(instanceId);
|
||||||
|
if (item.title === title) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
item.title = title;
|
||||||
|
this.pedalboard.set(newPedalboard);
|
||||||
|
// notify the server.
|
||||||
|
// xxx;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let instance: PiPedalModel | undefined = undefined;
|
let instance: PiPedalModel | undefined = undefined;
|
||||||
|
|||||||
@@ -335,6 +335,7 @@ const PluginPresetSelector =
|
|||||||
isEditDialog={this.state.showEditPresetsDialog}
|
isEditDialog={this.state.showEditPresetsDialog}
|
||||||
onDialogClose={() => this.handleDialogClose()} />
|
onDialogClose={() => this.handleDialogClose()} />
|
||||||
<RenameDialog open={this.state.renameDialogOpen}
|
<RenameDialog open={this.state.renameDialogOpen}
|
||||||
|
title="Rename"
|
||||||
defaultName={this.state.renameDialogDefaultName}
|
defaultName={this.state.renameDialogDefaultName}
|
||||||
acceptActionName={this.state.renameDialogActionName}
|
acceptActionName={this.state.renameDialogActionName}
|
||||||
onClose={() => this.handleRenameDialogClose()}
|
onClose={() => this.handleRenameDialogClose()}
|
||||||
|
|||||||
@@ -413,6 +413,7 @@ const PluginPresetsDialog = withStyles(
|
|||||||
Rename
|
Rename
|
||||||
</Button>
|
</Button>
|
||||||
<RenameDialog
|
<RenameDialog
|
||||||
|
title="Rename"
|
||||||
open={this.state.renameOpen}
|
open={this.state.renameOpen}
|
||||||
defaultName={this.getSelectedName()}
|
defaultName={this.getSelectedName()}
|
||||||
acceptActionName={"Rename"}
|
acceptActionName={"Rename"}
|
||||||
|
|||||||
@@ -395,6 +395,7 @@ const PresetDialog = withStyles(
|
|||||||
Rename
|
Rename
|
||||||
</Button>
|
</Button>
|
||||||
<RenameDialog
|
<RenameDialog
|
||||||
|
title="Rename"
|
||||||
open={this.state.renameOpen}
|
open={this.state.renameOpen}
|
||||||
defaultName={this.getSelectedName()}
|
defaultName={this.getSelectedName()}
|
||||||
acceptActionName={"Rename"}
|
acceptActionName={"Rename"}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ interface PresetSelectorState {
|
|||||||
presetsMenuAnchorRef: HTMLElement | null;
|
presetsMenuAnchorRef: HTMLElement | null;
|
||||||
|
|
||||||
renameDialogOpen: boolean;
|
renameDialogOpen: boolean;
|
||||||
|
renameDialogTitle: string;
|
||||||
renameDialogDefaultName: string;
|
renameDialogDefaultName: string;
|
||||||
renameDialogActionName: string;
|
renameDialogActionName: string;
|
||||||
renameDialogOnOk?: (name: string) => void;
|
renameDialogOnOk?: (name: string) => void;
|
||||||
@@ -95,6 +96,7 @@ const PresetSelector =
|
|||||||
showEditPresetsDialog: false,
|
showEditPresetsDialog: false,
|
||||||
presetsMenuAnchorRef: null,
|
presetsMenuAnchorRef: null,
|
||||||
renameDialogOpen: false,
|
renameDialogOpen: false,
|
||||||
|
renameDialogTitle: "",
|
||||||
renameDialogDefaultName: "",
|
renameDialogDefaultName: "",
|
||||||
renameDialogActionName: "",
|
renameDialogActionName: "",
|
||||||
renameDialogOnOk: undefined,
|
renameDialogOnOk: undefined,
|
||||||
@@ -144,7 +146,7 @@ const PresetSelector =
|
|||||||
if (item == null) return;
|
if (item == null) return;
|
||||||
let name = item.name;
|
let name = item.name;
|
||||||
|
|
||||||
this.renameDialogOpen(name, "Save As")
|
this.renameDialogOpen(name, "Save Preset As", "OK")
|
||||||
.then((newName) => {
|
.then((newName) => {
|
||||||
return this.model.saveCurrentPresetAs(newName);
|
return this.model.saveCurrentPresetAs(newName);
|
||||||
})
|
})
|
||||||
@@ -167,7 +169,7 @@ const PresetSelector =
|
|||||||
if (item == null) return;
|
if (item == null) return;
|
||||||
let name = item.name;
|
let name = item.name;
|
||||||
|
|
||||||
this.renameDialogOpen(name, "Rename")
|
this.renameDialogOpen(name, "Rename Preset", "OK")
|
||||||
.then((newName) => {
|
.then((newName) => {
|
||||||
if (newName === name) return;
|
if (newName === name) return;
|
||||||
return this.model.renamePresetItem(this.model.presets.get().selectedInstanceId, newName);
|
return this.model.renamePresetItem(this.model.presets.get().selectedInstanceId, newName);
|
||||||
@@ -196,12 +198,13 @@ const PresetSelector =
|
|||||||
showError(error: string) {
|
showError(error: string) {
|
||||||
this.model.showAlert(error);
|
this.model.showAlert(error);
|
||||||
}
|
}
|
||||||
renameDialogOpen(defaultText: string, acceptButtonText: string): Promise<string> {
|
renameDialogOpen(defaultText: string, title: string,acceptButtonText: string): Promise<string> {
|
||||||
let result = new Promise<string>(
|
let result = new Promise<string>(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
this.setState(
|
this.setState(
|
||||||
{
|
{
|
||||||
renameDialogOpen: true,
|
renameDialogOpen: true,
|
||||||
|
renameDialogTitle: title,
|
||||||
renameDialogDefaultName: defaultText,
|
renameDialogDefaultName: defaultText,
|
||||||
renameDialogActionName: acceptButtonText,
|
renameDialogActionName: acceptButtonText,
|
||||||
renameDialogOnOk: (name) => {
|
renameDialogOnOk: (name) => {
|
||||||
@@ -365,6 +368,7 @@ const PresetSelector =
|
|||||||
</div>
|
</div>
|
||||||
<PresetDialog show={this.state.showPresetsDialog} isEditDialog={this.state.showEditPresetsDialog} onDialogClose={() => this.handleDialogClose()} />
|
<PresetDialog show={this.state.showPresetsDialog} isEditDialog={this.state.showEditPresetsDialog} onDialogClose={() => this.handleDialogClose()} />
|
||||||
<RenameDialog open={this.state.renameDialogOpen}
|
<RenameDialog open={this.state.renameDialogOpen}
|
||||||
|
title={this.state.renameDialogTitle}
|
||||||
defaultName={this.state.renameDialogDefaultName}
|
defaultName={this.state.renameDialogDefaultName}
|
||||||
acceptActionName={this.state.renameDialogActionName}
|
acceptActionName={this.state.renameDialogActionName}
|
||||||
onClose={() => this.handleRenameDialogClose()}
|
onClose={() => this.handleRenameDialogClose()}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Button from '@mui/material/Button';
|
import Button from '@mui/material/Button';
|
||||||
import DialogEx from './DialogEx';
|
import DialogEx from './DialogEx';
|
||||||
|
import DialogTitle from '@mui/material/DialogTitle';
|
||||||
import DialogActions from '@mui/material/DialogActions';
|
import DialogActions from '@mui/material/DialogActions';
|
||||||
import DialogContent from '@mui/material/DialogContent';
|
import DialogContent from '@mui/material/DialogContent';
|
||||||
import { nullCast } from './Utility';
|
import { nullCast } from './Utility';
|
||||||
@@ -33,6 +34,9 @@ export interface RenameDialogProps {
|
|||||||
open: boolean,
|
open: boolean,
|
||||||
defaultName: string,
|
defaultName: string,
|
||||||
acceptActionName: string,
|
acceptActionName: string,
|
||||||
|
title: string,
|
||||||
|
allowEmpty?: boolean,
|
||||||
|
label?: string,
|
||||||
onOk: (text: string) => void,
|
onOk: (text: string) => void,
|
||||||
onClose: () => void
|
onClose: () => void
|
||||||
};
|
};
|
||||||
@@ -102,7 +106,7 @@ export default class RenameDialog extends ResizeResponsiveComponent<RenameDialog
|
|||||||
model.showAlert(e.toString());
|
model.showAlert(e.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (text.length === 0) return;
|
if (text.length === 0 && props.allowEmpty !== true) return;
|
||||||
onOk(text);
|
onOk(text);
|
||||||
}
|
}
|
||||||
const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>): void => {
|
const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>): void => {
|
||||||
@@ -119,20 +123,23 @@ export default class RenameDialog extends ResizeResponsiveComponent<RenameDialog
|
|||||||
style={{userSelect: "none"}}
|
style={{userSelect: "none"}}
|
||||||
onEnterKey={()=>{}}
|
onEnterKey={()=>{}}
|
||||||
>
|
>
|
||||||
<DialogContent style={{minHeight: 96}}>
|
<DialogTitle>
|
||||||
|
{props.title ?? "Rename"}
|
||||||
|
</DialogTitle>
|
||||||
|
|
||||||
|
<DialogContent >
|
||||||
<TextField
|
<TextField
|
||||||
|
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
margin="dense"
|
variant="standard"
|
||||||
variant="outlined"
|
|
||||||
slotProps={{
|
slotProps={{
|
||||||
input: {
|
input: {
|
||||||
style: { scrollMargin: 24 }
|
style: { scrollMargin: 24 }
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
id="name"
|
id="name"
|
||||||
label="Name"
|
|
||||||
type="text"
|
type="text"
|
||||||
|
label={props.label ?? "Name"}
|
||||||
fullWidth
|
fullWidth
|
||||||
defaultValue={defaultName}
|
defaultValue={defaultName}
|
||||||
inputRef={this.refText}
|
inputRef={this.refText}
|
||||||
|
|||||||
Reference in New Issue
Block a user