Refactor main menu action shell

This commit is contained in:
2026-03-27 00:15:38 +08:00
parent 3ebad63874
commit 6ec5f05601
7 changed files with 148 additions and 76 deletions

View File

@@ -0,0 +1,39 @@
#pragma once
#include "PopupState.h"
#include "Widgets.h"
#include "Core/IEditorContext.h"
namespace XCEngine {
namespace Editor {
namespace UI {
inline void DrawEditorAboutDialog(const IEditorContext* context, DeferredPopupState& popupState) {
popupState.ConsumeOpenRequest("About XCEngine Editor");
if (!BeginModalPopup("About XCEngine Editor")) {
return;
}
ImGui::TextUnformatted("XCEngine Editor");
ImGui::Separator();
DrawHintText("Unity-like editor shell built on Dear ImGui.");
ImGui::Spacing();
ImGui::Text("Date: 2026-03-27");
ImGui::Text("UI Refactor: Actions / Commands / Layout in progress");
if (context) {
ImGui::Text("Project: %s", context->GetProjectPath().c_str());
}
ImGui::Spacing();
if (ImGui::Button("Close", DialogActionButtonSize())) {
ImGui::CloseCurrentPopup();
}
EndPopup();
}
} // namespace UI
} // namespace Editor
} // namespace XCEngine

View File

@@ -0,0 +1,46 @@
#pragma once
#include "Widgets.h"
#include "Core/IEditorContext.h"
#include "Core/ISceneManager.h"
#include <filesystem>
#include <string>
namespace XCEngine {
namespace Editor {
namespace UI {
inline void DrawSceneStatusWidget(IEditorContext& context) {
auto& sceneManager = context.GetSceneManager();
std::string sceneLabel = sceneManager.HasActiveScene() ? sceneManager.GetCurrentSceneName() : "No Scene";
if (sceneLabel.empty()) {
sceneLabel = "Untitled Scene";
}
const std::string fileLabel = sceneManager.GetCurrentScenePath().empty()
? "Unsaved.xc"
: std::filesystem::path(sceneManager.GetCurrentScenePath()).filename().string();
const bool dirty = sceneManager.IsSceneDirty();
const std::string statusText = dirty ? (std::string("* ") + fileLabel) : fileLabel;
DrawRightAlignedText(
statusText.c_str(),
dirty ? MenuBarStatusDirtyColor() : MenuBarStatusIdleColor());
if (ImGui::IsItemHovered()) {
BeginTitledTooltip("Scene");
ImGui::Text("Name: %s", sceneLabel.c_str());
ImGui::Text("File: %s", fileLabel.c_str());
ImGui::Text("State: %s", dirty ? "Modified" : "Saved");
ImGui::Text(
"Path: %s",
sceneManager.GetCurrentScenePath().empty() ? "(not saved yet)" : sceneManager.GetCurrentScenePath().c_str());
EndTitledTooltip();
}
}
} // namespace UI
} // namespace Editor
} // namespace XCEngine

View File

@@ -1,5 +1,6 @@
#pragma once
#include "AboutEditorDialog.h"
#include "BaseTheme.h"
#include "ConsoleFilterState.h"
#include "ConsoleLogFormatter.h"
@@ -9,6 +10,7 @@
#include "PopupState.h"
#include "PropertyGrid.h"
#include "ScalarControls.h"
#include "SceneStatusWidget.h"
#include "StyleTokens.h"
#include "VectorControls.h"
#include "Widgets.h"

View File

@@ -1,5 +1,6 @@
#pragma once
#include "Core.h"
#include "StyleTokens.h"
#include <imgui.h>