From 76ff18036731930a4ad6c6db7d9ac12d046dbf4d Mon Sep 17 00:00:00 2001 From: emerycp Date: Sat, 22 Jul 2023 11:40:49 -0400 Subject: [PATCH] NK-136 - Added Disabled Delete Menu Item, Disabled Rename --- Editor/src/Windows/FileSystemUI.cpp | 32 +++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/Editor/src/Windows/FileSystemUI.cpp b/Editor/src/Windows/FileSystemUI.cpp index 9cc69f15..bba1f1c7 100644 --- a/Editor/src/Windows/FileSystemUI.cpp +++ b/Editor/src/Windows/FileSystemUI.cpp @@ -183,19 +183,39 @@ namespace Nuake ImGui::EndPopup(); } - if (ImGui::MenuItem("Delete")) + if (file->GetExtension() != ".project") { - if(FileSystem::RemoveFile(file->GetAbsolutePath()) != 0) + if (ImGui::MenuItem("Delete")) { - Logger::Log("Failed to remove file: " + file->GetRelativePath(), "editor", CRITICAL); - } - RefreshFileBrowser(); - } + if (FileSystem::RemoveFile(file->GetAbsolutePath()) != 0) + { + Logger::Log("Failed to remove file: " + file->GetRelativePath(), "editor", CRITICAL); + } + RefreshFileBrowser(); + } + } + else + { + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1, 1, 1, 0.2f)); + ImGui::MenuItem("Delete"); + ImGui::PopStyleColor(); + if (ImGui::IsItemHovered()) + { + ImGui::BeginTooltip(); + ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f); + ImGui::TextUnformatted("The file you're trying to delete is currently loaded by the game engine."); + ImGui::PopTextWrapPos(); + ImGui::EndTooltip(); + } + } + + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1, 1, 1, 0.2f)); if (ImGui::MenuItem("Rename")) { } + ImGui::PopStyleColor(); ImGui::Separator();