mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-23 00:07:53 +01:00
Add rename mod field.
This commit is contained in:
parent
e94cdaec46
commit
21a55b95d9
4 changed files with 117 additions and 12 deletions
|
|
@ -66,7 +66,7 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
|
|||
SubscribeRightClickMain(() => ClearQuickMove(1, _config.QuickMoveFolder2, () => {_config.QuickMoveFolder2 = string.Empty; _config.Save();}), 120);
|
||||
SubscribeRightClickMain(() => ClearQuickMove(2, _config.QuickMoveFolder3, () => {_config.QuickMoveFolder3 = string.Empty; _config.Save();}), 130);
|
||||
UnsubscribeRightClickLeaf(RenameLeaf);
|
||||
SubscribeRightClickLeaf(RenameLeafMod, 1000);
|
||||
SetRenameSearchPath(_config.ShowRename);
|
||||
AddButton(AddNewModButton, 0);
|
||||
AddButton(AddImportModButton, 1);
|
||||
AddButton(AddHelpButton, 2);
|
||||
|
|
@ -92,6 +92,37 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
|
|||
OnCollectionChange(CollectionType.Current, null, _collectionManager.Active.Current, "");
|
||||
}
|
||||
|
||||
public void SetRenameSearchPath(RenameField value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case RenameField.RenameSearchPath:
|
||||
SubscribeRightClickLeaf(RenameLeafMod, 1000);
|
||||
UnsubscribeRightClickLeaf(RenameMod);
|
||||
break;
|
||||
case RenameField.RenameData:
|
||||
UnsubscribeRightClickLeaf(RenameLeafMod);
|
||||
SubscribeRightClickLeaf(RenameMod, 1000);
|
||||
break;
|
||||
case RenameField.BothSearchPathPrio:
|
||||
UnsubscribeRightClickLeaf(RenameLeafMod);
|
||||
UnsubscribeRightClickLeaf(RenameMod);
|
||||
SubscribeRightClickLeaf(RenameLeafMod, 1001);
|
||||
SubscribeRightClickLeaf(RenameMod, 1000);
|
||||
break;
|
||||
case RenameField.BothDataPrio:
|
||||
UnsubscribeRightClickLeaf(RenameLeafMod);
|
||||
UnsubscribeRightClickLeaf(RenameMod);
|
||||
SubscribeRightClickLeaf(RenameLeafMod, 1000);
|
||||
SubscribeRightClickLeaf(RenameMod, 1001);
|
||||
break;
|
||||
default:
|
||||
UnsubscribeRightClickLeaf(RenameLeafMod);
|
||||
UnsubscribeRightClickLeaf(RenameMod);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly string[] ValidModExtensions =
|
||||
[
|
||||
".ttmp",
|
||||
|
|
@ -302,6 +333,22 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
|
|||
RenameLeaf(leaf);
|
||||
}
|
||||
|
||||
private void RenameMod(ModFileSystem.Leaf leaf)
|
||||
{
|
||||
ImGui.Separator();
|
||||
var currentName = leaf.Value.Name.Text;
|
||||
if (ImGui.IsWindowAppearing())
|
||||
ImGui.SetKeyboardFocusHere(0);
|
||||
ImGui.TextUnformatted("Rename Mod:");
|
||||
if (ImGui.InputText("##RenameMod", ref currentName, 256, ImGuiInputTextFlags.EnterReturnsTrue))
|
||||
{
|
||||
_modManager.DataEditor.ChangeModName(leaf.Value, currentName);
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
|
||||
ImGuiUtil.HoverTooltip("Enter a new name here to rename the changed mod.");
|
||||
}
|
||||
|
||||
private void DeleteModButton(Vector2 size)
|
||||
=> DeleteSelectionButton(size, _config.DeleteModModifier, "mod", "mods", _modManager.DeleteMod);
|
||||
|
||||
|
|
|
|||
26
Penumbra/UI/ModsTab/RenameField.cs
Normal file
26
Penumbra/UI/ModsTab/RenameField.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
namespace Penumbra.UI.ModsTab;
|
||||
|
||||
public enum RenameField
|
||||
{
|
||||
None,
|
||||
RenameSearchPath,
|
||||
RenameData,
|
||||
BothSearchPathPrio,
|
||||
BothDataPrio,
|
||||
}
|
||||
|
||||
public static class RenameFieldExtensions
|
||||
{
|
||||
public static (string Name, string Desc) GetData(this RenameField value)
|
||||
=> value switch
|
||||
{
|
||||
RenameField.None => ("None", "Show no rename fields in the context menu for mods."),
|
||||
RenameField.RenameSearchPath => ("Search Path", "Show only the search path / move field in the context menu for mods."),
|
||||
RenameField.RenameData => ("Mod Name", "Show only the mod name field in the context menu for mods."),
|
||||
RenameField.BothSearchPathPrio => ("Both (Focus Search Path)",
|
||||
"Show both rename fields in the context menu for mods, but put the keyboard cursor on the search path field."),
|
||||
RenameField.BothDataPrio => ("Both (Focus Mod Name)",
|
||||
"Show both rename fields in the context menu for mods, but put the keyboard cursor on the mod name field"),
|
||||
_ => (string.Empty, string.Empty),
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue