mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Added file content preview for csharp files
This commit is contained in:
@@ -209,6 +209,11 @@ void EditorSelectionPanel::DrawFile(Ref<Nuake::File> file)
|
||||
DrawWrenScriptPanel(CreateRef<WrenScript>(file, true));
|
||||
break;
|
||||
}
|
||||
case FileType::NetScript:
|
||||
{
|
||||
DrawNetScriptPanel(file);
|
||||
break;
|
||||
}
|
||||
case FileType::Prefab:
|
||||
{
|
||||
//Ref<Prefab> prefab = CreateRef<Prefab>(file->GetRelativePath());
|
||||
@@ -486,3 +491,23 @@ void EditorSelectionPanel::DrawWrenScriptPanel(Ref<Nuake::WrenScript> wrenFile)
|
||||
ImGui::PopTextWrapPos();
|
||||
}
|
||||
|
||||
void EditorSelectionPanel::DrawNetScriptPanel(Ref<Nuake::File> file)
|
||||
{
|
||||
auto filePath = file->GetRelativePath();
|
||||
std::string fileContent = Nuake::FileSystem::ReadFile(filePath);
|
||||
|
||||
ImGui::Text("Content");
|
||||
ImGui::SameLine(ImGui::GetWindowWidth() - 90);
|
||||
if (ImGui::Button("Open..."))
|
||||
{
|
||||
Nuake::OS::OpenIn(file->GetAbsolutePath());
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetWindowWidth());
|
||||
ImGui::Text(fileContent.c_str(), ImGui::GetWindowWidth());
|
||||
|
||||
ImGui::PopTextWrapPos();
|
||||
}
|
||||
|
||||
|
||||
@@ -70,4 +70,5 @@ private:
|
||||
void DrawMaterialPanel(Ref<Nuake::Material> material);
|
||||
void DrawProjectPanel(Ref<Nuake::Project> project);
|
||||
void DrawWrenScriptPanel(Ref<Nuake::WrenScript> wrenFile);
|
||||
void DrawNetScriptPanel(Ref<Nuake::File> file);
|
||||
};
|
||||
Reference in New Issue
Block a user