Add key-check for file deletion in advanced editing.

This commit is contained in:
Ottermandias 2023-06-02 16:06:15 +02:00
parent 768016a897
commit e02de6de5a

View file

@ -287,14 +287,20 @@ public partial class ModEditWindow
ImGui.SameLine(); ImGui.SameLine();
if (ImGui.Button("Delete Selected Files")) var active = _config.DeleteModModifier.IsActive();
var tt =
"Delete all selected files entirely from your filesystem, but not their file associations in the mod.\n!!!This can not be reverted!!!";
if (_selectedFiles.Count == 0)
tt += "\n\nNo files selected.";
else if (!active)
tt += $"\n\nHold {_config.DeleteModModifier.ToString()} to delete.";
if (ImGuiUtil.DrawDisabledButton("Delete Selected Files", Vector2.Zero, tt, _selectedFiles.Count == 0 || !active))
_editor.FileEditor.DeleteFiles(_editor.Mod!, _editor.Option!, _editor.Files.Available.Where(_selectedFiles.Contains)); _editor.FileEditor.DeleteFiles(_editor.Mod!, _editor.Option!, _editor.Files.Available.Where(_selectedFiles.Contains));
ImGuiUtil.HoverTooltip(
"Delete all selected files entirely from your filesystem, but not their file associations in the mod, if there are any.\n!!!This can not be reverted!!!");
ImGui.SameLine(); ImGui.SameLine();
var changes = _editor.FileEditor.Changes; var changes = _editor.FileEditor.Changes;
var tt = changes ? "Apply the current file setup to the currently selected option." : "No changes made."; tt = changes ? "Apply the current file setup to the currently selected option." : "No changes made.";
if (ImGuiUtil.DrawDisabledButton("Apply Changes", Vector2.Zero, tt, !changes)) if (ImGuiUtil.DrawDisabledButton("Apply Changes", Vector2.Zero, tt, !changes))
{ {
var failedFiles = _editor.FileEditor.Apply(_editor.Mod!, (SubMod)_editor.Option!); var failedFiles = _editor.FileEditor.Apply(_editor.Mod!, (SubMod)_editor.Option!);