Refactor editor UI architecture
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "Actions/EditorActions.h"
|
||||
#include "ConsolePanel.h"
|
||||
#include "Core/EditorConsoleSink.h"
|
||||
#include "UI/Core.h"
|
||||
#include "UI/PanelChrome.h"
|
||||
#include "UI/UI.h"
|
||||
#include <XCEngine/Debug/LogCategory.h>
|
||||
#include <XCEngine/Debug/Logger.h>
|
||||
#include <imgui.h>
|
||||
@@ -9,12 +9,6 @@
|
||||
namespace XCEngine {
|
||||
namespace Editor {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr float kConsoleToolbarHeight = 34.0f;
|
||||
|
||||
} // namespace
|
||||
|
||||
ConsolePanel::ConsolePanel() : Panel("Console") {
|
||||
}
|
||||
|
||||
@@ -27,26 +21,20 @@ void ConsolePanel::Render() {
|
||||
auto* sink = Debug::EditorConsoleSink::GetInstance();
|
||||
|
||||
{
|
||||
UI::PanelToolbarScope toolbar("ConsoleToolbar", kConsoleToolbarHeight);
|
||||
UI::PanelToolbarScope toolbar("ConsoleToolbar", UI::StandardPanelToolbarHeight());
|
||||
if (toolbar.IsOpen()) {
|
||||
if (UI::ToolbarButton("Clear")) {
|
||||
if (Actions::DrawToolbarAction(Actions::MakeClearConsoleAction())) {
|
||||
sink->Clear();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::TextDisabled("Filter");
|
||||
UI::DrawToolbarLabel("Filter");
|
||||
ImGui::SameLine();
|
||||
if (UI::ToolbarButton("Info", m_showInfo)) {
|
||||
m_showInfo = !m_showInfo;
|
||||
}
|
||||
Actions::DrawToolbarToggleAction(Actions::MakeConsoleInfoFilterAction(m_showInfo), m_showInfo);
|
||||
ImGui::SameLine();
|
||||
if (UI::ToolbarButton("Warn", m_showWarning)) {
|
||||
m_showWarning = !m_showWarning;
|
||||
}
|
||||
Actions::DrawToolbarToggleAction(Actions::MakeConsoleWarningFilterAction(m_showWarning), m_showWarning);
|
||||
ImGui::SameLine();
|
||||
if (UI::ToolbarButton("Error", m_showError)) {
|
||||
m_showError = !m_showError;
|
||||
}
|
||||
Actions::DrawToolbarToggleAction(Actions::MakeConsoleErrorFilterAction(m_showError), m_showError);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,9 +87,7 @@ void ConsolePanel::Render() {
|
||||
|
||||
const char* category = ::XCEngine::Debug::LogCategoryToString(log.category);
|
||||
std::string fullMessage = std::string(prefix) + "[" + category + "] " + log.message.CStr();
|
||||
ImGui::TextUnformatted(fullMessage.c_str());
|
||||
|
||||
if (ImGui::IsItemClicked()) {
|
||||
if (UI::DrawConsoleLogRow(fullMessage.c_str())) {
|
||||
ImGui::SetClipboardText(fullMessage.c_str());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user