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"
|
||||||
|
|||||||
@@ -19,10 +19,12 @@
|
|||||||
|
|
||||||
import { SyntheticEvent } from 'react';
|
import { SyntheticEvent } from 'react';
|
||||||
import { Theme } from '@mui/material/styles';
|
import { Theme } from '@mui/material/styles';
|
||||||
import WithStyles, {withTheme} from './WithStyles';
|
import WithStyles, { withTheme } from './WithStyles';
|
||||||
import { withStyles } from "tss-react/mui";
|
import { withStyles } from "tss-react/mui";
|
||||||
import IconButtonEx from './IconButtonEx';
|
import IconButtonEx from './IconButtonEx';
|
||||||
import ButtonEx from './ButtonEx';
|
import ButtonEx from './ButtonEx';
|
||||||
|
import ButtonBase from '@mui/material/ButtonBase';
|
||||||
|
import RenameDialog from './RenameDialog';
|
||||||
|
|
||||||
import ToolTipEx from './ToolTipEx';
|
import ToolTipEx from './ToolTipEx';
|
||||||
import { PiPedalModel, PiPedalModelFactory } from './PiPedalModel';
|
import { PiPedalModel, PiPedalModelFactory } from './PiPedalModel';
|
||||||
@@ -69,7 +71,8 @@ const HORIZONTAL_CONTROL_SCROLL_HEIGHT_BREAK = 500;
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
// const HORIZONTAL_LAYOUT_MQ = "@media (max-height: " + HORIZONTAL_CONTROL_SCROLL_HEIGHT_BREAK + "px)";
|
// const HORIZONTAL_LAYOUT_MQ = "@media (max-height: " + HORIZONTAL_CONTROL_SCROLL_HEIGHT_BREAK + "px)";
|
||||||
|
|
||||||
const styles = ({ palette }: Theme) => { return {
|
const styles = ({ palette }: Theme) => {
|
||||||
|
return {
|
||||||
frame: css({
|
frame: css({
|
||||||
position: "absolute", display: "flex", flexDirection: "column", flexWrap: "nowrap",
|
position: "absolute", display: "flex", flexDirection: "column", flexWrap: "nowrap",
|
||||||
justifyContent: "flex-start", left: "0px", top: "0px", bottom: "0px", right: "0px", overflow: "hidden"
|
justifyContent: "flex-start", left: "0px", top: "0px", bottom: "0px", right: "0px", overflow: "hidden"
|
||||||
@@ -99,9 +102,9 @@ const styles = ({ palette }: Theme) => { return {
|
|||||||
controlContentSmall: css({
|
controlContentSmall: css({
|
||||||
flex: "0 0 162px", width: "100%", height: 162, overflowY: "hidden",
|
flex: "0 0 162px", width: "100%", height: 162, overflowY: "hidden",
|
||||||
}),
|
}),
|
||||||
title: css({ fontSize: "1.1em", fontWeight: 700, marginRight: 8, textOverflow: "ellipsis", whiteSpace: "nowrap", opacity: 0.75 }),
|
title: css({ fontSize: "1.1rem", fontWeight: 700, marginRight: 8, textOverflow: "ellipsis", whiteSpace: "nowrap", opacity: 0.75 }),
|
||||||
author: css({ fontWeight: 500, marginRight: 8, textOverflow: "ellipsis", whiteSpace: "nowrap", opacity: 0.75 })
|
author: css({ fontWeight: 500, fontSize: "0.8rem", marginRight: 8, textOverflow: "ellipsis", whiteSpace: "nowrap", opacity: 0.75 })
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -124,6 +127,8 @@ interface MainState {
|
|||||||
horizontalScrollLayout: boolean;
|
horizontalScrollLayout: boolean;
|
||||||
showMidiBindingsDialog: boolean;
|
showMidiBindingsDialog: boolean;
|
||||||
screenHeight: number;
|
screenHeight: number;
|
||||||
|
displayNameDialogOpen: boolean;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,10 +142,8 @@ export const MainPage =
|
|||||||
getSplitToolbar() {
|
getSplitToolbar() {
|
||||||
return this.windowSize.width < SPLIT_CONTROLBAR_THRESHHOLD;
|
return this.windowSize.width < SPLIT_CONTROLBAR_THRESHHOLD;
|
||||||
}
|
}
|
||||||
getDisplayAuthor()
|
getDisplayAuthor() {
|
||||||
{
|
if (this.getSplitToolbar()) {
|
||||||
if (this.getSplitToolbar())
|
|
||||||
{
|
|
||||||
return this.windowSize.width >= DISPLAY_AUTHOR_SPLIT_THRESHOLD;
|
return this.windowSize.width >= DISPLAY_AUTHOR_SPLIT_THRESHOLD;
|
||||||
} else {
|
} else {
|
||||||
return this.windowSize.width >= DISPLAY_AUTHOR_THRESHHOLD;
|
return this.windowSize.width >= DISPLAY_AUTHOR_THRESHHOLD;
|
||||||
@@ -157,6 +160,7 @@ export const MainPage =
|
|||||||
selectedSnapshot: -1,
|
selectedSnapshot: -1,
|
||||||
loadDialogOpen: false,
|
loadDialogOpen: false,
|
||||||
snapshotDialogOpen: false,
|
snapshotDialogOpen: false,
|
||||||
|
displayNameDialogOpen: false,
|
||||||
pedalboard: pedalboard,
|
pedalboard: pedalboard,
|
||||||
addMenuAnchorEl: null,
|
addMenuAnchorEl: null,
|
||||||
splitControlBar: this.getSplitToolbar(),
|
splitControlBar: this.getSplitToolbar(),
|
||||||
@@ -177,6 +181,9 @@ export const MainPage =
|
|||||||
this.handleEnableCurrentItemChanged = this.handleEnableCurrentItemChanged.bind(this);
|
this.handleEnableCurrentItemChanged = this.handleEnableCurrentItemChanged.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleEditPluginDisplayName() {
|
||||||
|
this.setState({ displayNameDialogOpen: true });
|
||||||
|
}
|
||||||
onInsertPedal(instanceId: number) {
|
onInsertPedal(instanceId: number) {
|
||||||
this.setAddMenuAnchorEl(null);
|
this.setAddMenuAnchorEl(null);
|
||||||
let newId = this.model.addPedalboardItem(instanceId, false);
|
let newId = this.model.addPedalboardItem(instanceId, false);
|
||||||
@@ -292,8 +299,7 @@ export const MainPage =
|
|||||||
this.setSelection(selectedId);
|
this.setSelection(selectedId);
|
||||||
let item = this.getPedalboardItem(selectedId);
|
let item = this.getPedalboardItem(selectedId);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
if (item.isStart() || item.isEnd())
|
if (item.isStart() || item.isEnd()) {
|
||||||
{
|
|
||||||
// do nothing.
|
// do nothing.
|
||||||
} else if (item.isSplit()) {
|
} else if (item.isSplit()) {
|
||||||
let split = item as PedalboardSplitItem;
|
let split = item as PedalboardSplitItem;
|
||||||
@@ -375,6 +381,7 @@ export const MainPage =
|
|||||||
let infoPluginUri = "";
|
let infoPluginUri = "";
|
||||||
let presetsUri = "";
|
let presetsUri = "";
|
||||||
let missing = false;
|
let missing = false;
|
||||||
|
let canEditTitle = false;
|
||||||
if (pedalboardItem) {
|
if (pedalboardItem) {
|
||||||
if (pedalboardItem.isEmpty()) {
|
if (pedalboardItem.isEmpty()) {
|
||||||
title = "";
|
title = "";
|
||||||
@@ -391,9 +398,15 @@ export const MainPage =
|
|||||||
if (!uiPlugin) {
|
if (!uiPlugin) {
|
||||||
missing = true;
|
missing = true;
|
||||||
title = pedalboardItem?.pluginName ?? "Missing plugin";
|
title = pedalboardItem?.pluginName ?? "Missing plugin";
|
||||||
|
} else {
|
||||||
|
canEditTitle = this.props.enableStructureEditing;
|
||||||
|
if (pedalboardItem.title !== "") {
|
||||||
|
title = pedalboardItem.title;
|
||||||
|
author = "";
|
||||||
} else {
|
} else {
|
||||||
title = uiPlugin.name;
|
title = uiPlugin.name;
|
||||||
author = uiPlugin.author_name;
|
author = uiPlugin.author_name;
|
||||||
|
}
|
||||||
presetsUri = uiPlugin.uri;
|
presetsUri = uiPlugin.uri;
|
||||||
// if (uiPlugin.description.length > 20) {
|
// if (uiPlugin.description.length > 20) {
|
||||||
// }
|
// }
|
||||||
@@ -420,15 +433,34 @@ export const MainPage =
|
|||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<div style={{
|
<div style={{
|
||||||
flex: "1 1 auto", minWidth: 0, overflow: "hidden", marginRight: 8,
|
flex: "1 1 auto", minWidth: 0, overflow: "hidden",
|
||||||
display: "flex", flexDirection: "row", height: 48, flexWrap: "nowrap",
|
display: "flex", flexDirection: "row", height: 48, flexWrap: "nowrap",
|
||||||
alignItems: "center"
|
alignItems: "center"
|
||||||
}}>
|
}}>
|
||||||
<div style={{ flex: "0 1 auto", minWidth: 0, overflow: "hidden", textOverflow: "ellipsis" }}>
|
<div style={{ position: "relative", flex: "0 1 auto", minWidth: 0, overflow: "hidden", textOverflow: "ellipsis" }}>
|
||||||
|
{canEditTitle ? (
|
||||||
|
<ButtonBase
|
||||||
|
style={{ borderRadius: "6px", width: "100%", paddingLeft: 8, paddingRight: 8, height: 48, textTransform: "none" }}
|
||||||
|
onClick={()=> {
|
||||||
|
this.handleEditPluginDisplayName();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span>
|
||||||
<span className={classes.title}>{title}</span>
|
<span className={classes.title}>{title}</span>
|
||||||
{this.state.displayAuthor&&(
|
{this.state.displayAuthor && (
|
||||||
<span className={classes.author}>{author}</span>
|
<span className={classes.author}>{author}</span>
|
||||||
)}
|
)}
|
||||||
|
</span>
|
||||||
|
</ButtonBase>)
|
||||||
|
: (
|
||||||
|
<div style={{ flex: "0 1 auto", paddingLeft: 8, paddingRight: 8,minWidth: 0, overflow: "hidden", textOverflow: "ellipsis" }}>
|
||||||
|
<span className={classes.title}>{title}</span>
|
||||||
|
{this.state.displayAuthor && (
|
||||||
|
<span className={classes.author}>{author}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div style={{ flex: "0 0 auto", verticalAlign: "center" }}>
|
<div style={{ flex: "0 0 auto", verticalAlign: "center" }}>
|
||||||
<PluginInfoDialog plugin_uri={infoPluginUri} />
|
<PluginInfoDialog plugin_uri={infoPluginUri} />
|
||||||
@@ -528,8 +560,8 @@ export const MainPage =
|
|||||||
display: "flex", flexFlow: "row nowrap", alignItems: "center", justifyContent: "center", minWidth: 0,
|
display: "flex", flexFlow: "row nowrap", alignItems: "center", justifyContent: "center", minWidth: 0,
|
||||||
width: "100%", height: 48, paddingLeft: 16, paddingRight: 16
|
width: "100%", height: 48, paddingLeft: 16, paddingRight: 16
|
||||||
}} >
|
}} >
|
||||||
<div style={{ flex: "0 0 auto", width: this.state.splitControlBar? undefined: 80 }} >
|
<div style={{ flex: "0 0 auto", width: this.state.splitControlBar ? undefined : 60 }} >
|
||||||
<div style={{ display: bypassVisible ? "block" : "none", width: this.state.splitControlBar? undefined: 80 }} >
|
<div style={{ display: bypassVisible ? "block" : "none", width: this.state.splitControlBar ? undefined : 60 }} >
|
||||||
<ToolTipEx title="Bypass"
|
<ToolTipEx title="Bypass"
|
||||||
>
|
>
|
||||||
<Switch color="secondary" checked={bypassChecked} onChange={this.handleEnableCurrentItemChanged} />
|
<Switch color="secondary" checked={bypassChecked} onChange={this.handleEnableCurrentItemChanged} />
|
||||||
@@ -537,13 +569,14 @@ export const MainPage =
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{
|
{
|
||||||
(!this.state.splitControlBar || !this.props.enableStructureEditing) && this.titleBar(pedalboardItem)
|
(!this.state.splitControlBar || !this.props.enableStructureEditing)
|
||||||
|
&& this.titleBar(pedalboardItem)
|
||||||
}
|
}
|
||||||
<div style={{ flex: "1 1 1px" }}>
|
<div style={{ flex: "1 1 1px" }}>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{this.props.enableStructureEditing && (
|
{this.props.enableStructureEditing && (
|
||||||
<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" }}>
|
||||||
<div style={{ flex: "0 0 auto", display: (canInsert || canAppend) ? "block" : "none", paddingRight: 8 }}>
|
<div style={{ flex: "0 0 auto", display: (canInsert || canAppend) ? "block" : "none", paddingRight: 8 }}>
|
||||||
<IconButtonEx tooltip="Add pedal slot" onClick={(e) => { this.onAddClick(e) }} size="large">
|
<IconButtonEx tooltip="Add pedal slot" onClick={(e) => { this.onAddClick(e) }} size="large">
|
||||||
<AddIcon style={{ height: 24, width: 24, fill: this.props.theme.palette.text.primary, opacity: 0.6 }} />
|
<AddIcon style={{ height: 24, width: 24, fill: this.props.theme.palette.text.primary, opacity: 0.6 }} />
|
||||||
@@ -642,6 +675,21 @@ export const MainPage =
|
|||||||
{(this.state.snapshotDialogOpen) && (
|
{(this.state.snapshotDialogOpen) && (
|
||||||
<SnapshotDialog open={this.state.snapshotDialogOpen} onOk={() => this.onSnapshotDialogOk()} />
|
<SnapshotDialog open={this.state.snapshotDialogOpen} onOk={() => this.onSnapshotDialogOk()} />
|
||||||
)}
|
)}
|
||||||
|
{(this.state.displayNameDialogOpen) && (
|
||||||
|
<RenameDialog open={this.state.displayNameDialogOpen}
|
||||||
|
allowEmpty={true}
|
||||||
|
defaultName={pedalboardItem?.title ?? ""}
|
||||||
|
title="Plugin Display Name"
|
||||||
|
acceptActionName="OK"
|
||||||
|
onClose={() => this.setState({ displayNameDialogOpen: false })}
|
||||||
|
onOk={(newName: string) => {
|
||||||
|
if (pedalboardItem) {
|
||||||
|
this.model.setPedalboardItemTitle(pedalboardItem.instanceId, newName);
|
||||||
|
}
|
||||||
|
this.setState({ displayNameDialogOpen: false });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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