MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / ShowDebugLogWindow

Method ShowDebugLogWindow

KBotExt/imgui/imgui.cpp:14584–14642  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14582}
14583
14584void ImGui::ShowDebugLogWindow(bool* p_open)
14585{
14586 ImGuiContext& g = *GImGui;
14587 if (!(g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize))
14588 SetNextWindowSize(ImVec2(0.0f, GetFontSize() * 12.0f), ImGuiCond_FirstUseEver);
14589 if (!Begin("Dear ImGui Debug Log", p_open) || GetCurrentWindow()->BeginCount > 1)
14590 {
14591 End();
14592 return;
14593 }
14594
14595 CheckboxFlags("All", &g.DebugLogFlags, ImGuiDebugLogFlags_EventMask_);
14596 SameLine(); CheckboxFlags("ActiveId", &g.DebugLogFlags, ImGuiDebugLogFlags_EventActiveId);
14597 SameLine(); CheckboxFlags("Focus", &g.DebugLogFlags, ImGuiDebugLogFlags_EventFocus);
14598 SameLine(); CheckboxFlags("Popup", &g.DebugLogFlags, ImGuiDebugLogFlags_EventPopup);
14599 SameLine(); CheckboxFlags("Nav", &g.DebugLogFlags, ImGuiDebugLogFlags_EventNav);
14600 SameLine(); if (CheckboxFlags("Clipper", &g.DebugLogFlags, ImGuiDebugLogFlags_EventClipper)) { g.DebugLogClipperAutoDisableFrames = 2; } if (IsItemHovered()) SetTooltip("Clipper log auto-disabled after 2 frames");
14601 //SameLine(); CheckboxFlags("Selection", &g.DebugLogFlags, ImGuiDebugLogFlags_EventSelection);
14602 SameLine(); CheckboxFlags("IO", &g.DebugLogFlags, ImGuiDebugLogFlags_EventIO);
14603
14604 if (SmallButton("Clear"))
14605 {
14606 g.DebugLogBuf.clear();
14607 g.DebugLogIndex.clear();
14608 }
14609 SameLine();
14610 if (SmallButton("Copy"))
14611 SetClipboardText(g.DebugLogBuf.c_str());
14612 BeginChild("##log", ImVec2(0.0f, 0.0f), true, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar);
14613
14614 ImGuiListClipper clipper;
14615 clipper.Begin(g.DebugLogIndex.size());
14616 while (clipper.Step())
14617 for (int line_no = clipper.DisplayStart; line_no < clipper.DisplayEnd; line_no++)
14618 {
14619 const char* line_begin = g.DebugLogIndex.get_line_begin(g.DebugLogBuf.c_str(), line_no);
14620 const char* line_end = g.DebugLogIndex.get_line_end(g.DebugLogBuf.c_str(), line_no);
14621 TextUnformatted(line_begin, line_end);
14622 ImRect text_rect = g.LastItemData.Rect;
14623 if (IsItemHovered())
14624 for (const char* p = line_begin; p <= line_end - 10; p++)
14625 {
14626 ImGuiID id = 0;
14627 if (p[0] != '0' || (p[1] != 'x' && p[1] != 'X') || sscanf(p + 2, "%X", &id) != 1)
14628 continue;
14629 ImVec2 p0 = CalcTextSize(line_begin, p);
14630 ImVec2 p1 = CalcTextSize(p, p + 10);
14631 g.LastItemData.Rect = ImRect(text_rect.Min + ImVec2(p0.x, 0.0f), text_rect.Min + ImVec2(p0.x + p1.x, p1.y));
14632 if (IsMouseHoveringRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, true))
14633 DebugLocateItemOnHover(id);
14634 p += 10;
14635 }
14636 }
14637 if (GetScrollY() >= GetScrollMaxY())
14638 SetScrollHereY(1.0f);
14639 EndChild();
14640
14641 End();

Callers

nothing calls this directly

Calls 10

ImVec2Function · 0.85
GetCurrentWindowFunction · 0.85
c_strMethod · 0.80
BeginMethod · 0.80
StepMethod · 0.80
get_line_beginMethod · 0.80
get_line_endMethod · 0.80
ImRectFunction · 0.70
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected