Extract editor edit action router

This commit is contained in:
2026-03-26 22:31:22 +08:00
parent 8bdb1f34c7
commit f87bc53875
15 changed files with 227 additions and 125 deletions

View File

@@ -1,3 +1,4 @@
#include "Actions/ActionRouting.h"
#include "Actions/EditorActions.h"
#include "ConsolePanel.h"
#include "Core/EditorConsoleSink.h"
@@ -18,6 +19,8 @@ void ConsolePanel::Render() {
return;
}
Actions::ObserveInactiveActionRoute(*m_context);
auto* sink = Debug::EditorConsoleSink::GetInstance();
{
@@ -30,11 +33,11 @@ void ConsolePanel::Render() {
UI::DrawToolbarLabel("Filter");
ImGui::SameLine();
Actions::DrawToolbarToggleAction(Actions::MakeConsoleInfoFilterAction(m_showInfo), m_showInfo);
Actions::DrawToolbarToggleAction(Actions::MakeConsoleInfoFilterAction(m_filterState.ShowInfo()), m_filterState.ShowInfo());
ImGui::SameLine();
Actions::DrawToolbarToggleAction(Actions::MakeConsoleWarningFilterAction(m_showWarning), m_showWarning);
Actions::DrawToolbarToggleAction(Actions::MakeConsoleWarningFilterAction(m_filterState.ShowWarning()), m_filterState.ShowWarning());
ImGui::SameLine();
Actions::DrawToolbarToggleAction(Actions::MakeConsoleErrorFilterAction(m_showError), m_showError);
Actions::DrawToolbarToggleAction(Actions::MakeConsoleErrorFilterAction(m_filterState.ShowError()), m_filterState.ShowError());
}
}
@@ -46,23 +49,7 @@ void ConsolePanel::Render() {
const auto logs = sink->GetLogs();
size_t logIndex = 0;
for (const auto& log : logs) {
bool shouldShow = false;
switch (log.level) {
case ::XCEngine::Debug::LogLevel::Info:
case ::XCEngine::Debug::LogLevel::Verbose:
case ::XCEngine::Debug::LogLevel::Debug:
shouldShow = m_showInfo;
break;
case ::XCEngine::Debug::LogLevel::Warning:
shouldShow = m_showWarning;
break;
case ::XCEngine::Debug::LogLevel::Error:
case ::XCEngine::Debug::LogLevel::Fatal:
shouldShow = m_showError;
break;
}
if (!shouldShow) {
if (!m_filterState.Allows(log.level)) {
continue;
}