Unify inspector and console panel actions
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
#include "Actions/ConsoleActionRouter.h"
|
||||
#include "Actions/ActionRouting.h"
|
||||
#include "Actions/EditorActions.h"
|
||||
#include "ConsolePanel.h"
|
||||
#include "Core/EditorConsoleSink.h"
|
||||
#include "UI/UI.h"
|
||||
#include <XCEngine/Debug/LogCategory.h>
|
||||
#include <XCEngine/Debug/Logger.h>
|
||||
#include <imgui.h>
|
||||
|
||||
namespace XCEngine {
|
||||
@@ -26,18 +24,7 @@ void ConsolePanel::Render() {
|
||||
{
|
||||
UI::PanelToolbarScope toolbar("ConsoleToolbar", UI::StandardPanelToolbarHeight());
|
||||
if (toolbar.IsOpen()) {
|
||||
if (Actions::DrawToolbarAction(Actions::MakeClearConsoleAction())) {
|
||||
sink->Clear();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
|
||||
UI::DrawToolbarLabel("Filter");
|
||||
ImGui::SameLine();
|
||||
Actions::DrawToolbarToggleAction(Actions::MakeConsoleInfoFilterAction(m_filterState.ShowInfo()), m_filterState.ShowInfo());
|
||||
ImGui::SameLine();
|
||||
Actions::DrawToolbarToggleAction(Actions::MakeConsoleWarningFilterAction(m_filterState.ShowWarning()), m_filterState.ShowWarning());
|
||||
ImGui::SameLine();
|
||||
Actions::DrawToolbarToggleAction(Actions::MakeConsoleErrorFilterAction(m_filterState.ShowError()), m_filterState.ShowError());
|
||||
Actions::DrawConsoleToolbarActions(*sink, m_filterState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,28 +39,10 @@ void ConsolePanel::Render() {
|
||||
if (!m_filterState.Allows(log.level)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const char* prefix;
|
||||
|
||||
switch (log.level) {
|
||||
case ::XCEngine::Debug::LogLevel::Verbose:
|
||||
case ::XCEngine::Debug::LogLevel::Debug:
|
||||
case ::XCEngine::Debug::LogLevel::Info:
|
||||
prefix = "[INFO] ";
|
||||
break;
|
||||
case ::XCEngine::Debug::LogLevel::Warning:
|
||||
prefix = "[WARN] ";
|
||||
break;
|
||||
case ::XCEngine::Debug::LogLevel::Error:
|
||||
case ::XCEngine::Debug::LogLevel::Fatal:
|
||||
prefix = "[ERROR] ";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
ImGui::PushID(static_cast<int>(logIndex));
|
||||
|
||||
const char* category = ::XCEngine::Debug::LogCategoryToString(log.category);
|
||||
std::string fullMessage = std::string(prefix) + "[" + category + "] " + log.message.CStr();
|
||||
const std::string fullMessage = UI::BuildConsoleLogText(log);
|
||||
if (UI::DrawConsoleLogRow(fullMessage.c_str())) {
|
||||
ImGui::SetClipboardText(fullMessage.c_str());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user