| 15779 | } |
| 15780 | |
| 15781 | void ImGui::ShowDebugLogWindow(bool* p_open) |
| 15782 | { |
| 15783 | ImGuiContext& g = *GImGui; |
| 15784 | if (!(g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize)) |
| 15785 | SetNextWindowSize(ImVec2(0.0f, GetFontSize() * 12.0f), ImGuiCond_FirstUseEver); |
| 15786 | if (!Begin("Dear ImGui Debug Log", p_open) || GetCurrentWindow()->BeginCount > 1) |
| 15787 | { |
| 15788 | End(); |
| 15789 | return; |
| 15790 | } |
| 15791 | |
| 15792 | ImGuiDebugLogFlags all_enable_flags = ImGuiDebugLogFlags_EventMask_ & ~ImGuiDebugLogFlags_EventInputRouting; |
| 15793 | CheckboxFlags("All", &g.DebugLogFlags, all_enable_flags); |
| 15794 | SetItemTooltip("(except InputRouting which is spammy)"); |
| 15795 | |
| 15796 | ShowDebugLogFlag("ActiveId", ImGuiDebugLogFlags_EventActiveId); |
| 15797 | ShowDebugLogFlag("Clipper", ImGuiDebugLogFlags_EventClipper); |
| 15798 | ShowDebugLogFlag("Focus", ImGuiDebugLogFlags_EventFocus); |
| 15799 | ShowDebugLogFlag("IO", ImGuiDebugLogFlags_EventIO); |
| 15800 | ShowDebugLogFlag("Nav", ImGuiDebugLogFlags_EventNav); |
| 15801 | ShowDebugLogFlag("Popup", ImGuiDebugLogFlags_EventPopup); |
| 15802 | //ShowDebugLogFlag("Selection", ImGuiDebugLogFlags_EventSelection); |
| 15803 | ShowDebugLogFlag("InputRouting", ImGuiDebugLogFlags_EventInputRouting); |
| 15804 | |
| 15805 | if (SmallButton("Clear")) |
| 15806 | { |
| 15807 | g.DebugLogBuf.clear(); |
| 15808 | g.DebugLogIndex.clear(); |
| 15809 | } |
| 15810 | SameLine(); |
| 15811 | if (SmallButton("Copy")) |
| 15812 | SetClipboardText(g.DebugLogBuf.c_str()); |
| 15813 | SameLine(); |
| 15814 | if (SmallButton("Configure Outputs..")) |
| 15815 | OpenPopup("Outputs"); |
| 15816 | if (BeginPopup("Outputs")) |
| 15817 | { |
| 15818 | CheckboxFlags("OutputToTTY", &g.DebugLogFlags, ImGuiDebugLogFlags_OutputToTTY); |
| 15819 | #ifndef IMGUI_ENABLE_TEST_ENGINE |
| 15820 | BeginDisabled(); |
| 15821 | #endif |
| 15822 | CheckboxFlags("OutputToTestEngine", &g.DebugLogFlags, ImGuiDebugLogFlags_OutputToTestEngine); |
| 15823 | #ifndef IMGUI_ENABLE_TEST_ENGINE |
| 15824 | EndDisabled(); |
| 15825 | #endif |
| 15826 | EndPopup(); |
| 15827 | } |
| 15828 | |
| 15829 | BeginChild("##log", ImVec2(0.0f, 0.0f), ImGuiChildFlags_Border, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar); |
| 15830 | |
| 15831 | const ImGuiDebugLogFlags backup_log_flags = g.DebugLogFlags; |
| 15832 | g.DebugLogFlags &= ~ImGuiDebugLogFlags_EventClipper; |
| 15833 | |
| 15834 | ImGuiListClipper clipper; |
| 15835 | clipper.Begin(g.DebugLogIndex.size()); |
| 15836 | while (clipper.Step()) |
| 15837 | for (int line_no = clipper.DisplayStart; line_no < clipper.DisplayEnd; line_no++) |
| 15838 | DebugTextUnformattedWithLocateItem(g.DebugLogIndex.get_line_begin(g.DebugLogBuf.c_str(), line_no), g.DebugLogIndex.get_line_end(g.DebugLogBuf.c_str(), line_no)); |
nothing calls this directly
no test coverage detected