MCPcopy Create free account
hub / github.com/RenderKit/embree / ShowDebugLogWindow

Method ShowDebugLogWindow

tutorials/common/imgui/imgui.cpp:13892–13951  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13890}
13891
13892void ImGui::ShowDebugLogWindow(bool* p_open)
13893{
13894 ImGuiContext& g = *GImGui;
13895 if (!(g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize))
13896 SetNextWindowSize(ImVec2(0.0f, GetFontSize() * 12.0f), ImGuiCond_FirstUseEver);
13897 if (!Begin("Dear ImGui Debug Log", p_open) || GetCurrentWindow()->BeginCount > 1)
13898 {
13899 End();
13900 return;
13901 }
13902
13903 AlignTextToFramePadding();
13904 Text("Log events:");
13905 SameLine(); CheckboxFlags("All", &g.DebugLogFlags, ImGuiDebugLogFlags_EventMask_);
13906 SameLine(); CheckboxFlags("ActiveId", &g.DebugLogFlags, ImGuiDebugLogFlags_EventActiveId);
13907 SameLine(); CheckboxFlags("Focus", &g.DebugLogFlags, ImGuiDebugLogFlags_EventFocus);
13908 SameLine(); CheckboxFlags("Popup", &g.DebugLogFlags, ImGuiDebugLogFlags_EventPopup);
13909 SameLine(); CheckboxFlags("Nav", &g.DebugLogFlags, ImGuiDebugLogFlags_EventNav);
13910 SameLine(); CheckboxFlags("Clipper", &g.DebugLogFlags, ImGuiDebugLogFlags_EventClipper);
13911 SameLine(); CheckboxFlags("IO", &g.DebugLogFlags, ImGuiDebugLogFlags_EventIO);
13912
13913 if (SmallButton("Clear"))
13914 {
13915 g.DebugLogBuf.clear();
13916 g.DebugLogIndex.clear();
13917 }
13918 SameLine();
13919 if (SmallButton("Copy"))
13920 SetClipboardText(g.DebugLogBuf.c_str());
13921 BeginChild("##log", ImVec2(0.0f, 0.0f), true, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar);
13922
13923 ImGuiListClipper clipper;
13924 clipper.Begin(g.DebugLogIndex.size());
13925 while (clipper.Step())
13926 for (int line_no = clipper.DisplayStart; line_no < clipper.DisplayEnd; line_no++)
13927 {
13928 const char* line_begin = g.DebugLogIndex.get_line_begin(g.DebugLogBuf.c_str(), line_no);
13929 const char* line_end = g.DebugLogIndex.get_line_end(g.DebugLogBuf.c_str(), line_no);
13930 TextUnformatted(line_begin, line_end);
13931 ImRect text_rect = g.LastItemData.Rect;
13932 if (IsItemHovered())
13933 for (const char* p = line_begin; p < line_end - 10; p++)
13934 {
13935 ImGuiID id = 0;
13936 if (p[0] != '0' || (p[1] != 'x' && p[1] != 'X') || sscanf(p + 2, "%X", &id) != 1)
13937 continue;
13938 ImVec2 p0 = CalcTextSize(line_begin, p);
13939 ImVec2 p1 = CalcTextSize(p, p + 10);
13940 g.LastItemData.Rect = ImRect(text_rect.Min + ImVec2(p0.x, 0.0f), text_rect.Min + ImVec2(p0.x + p1.x, p1.y));
13941 if (IsMouseHoveringRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, true))
13942 DebugLocateItemOnHover(id);
13943 p += 10;
13944 }
13945 }
13946 if (GetScrollY() >= GetScrollMaxY())
13947 SetScrollHereY(1.0f);
13948 EndChild();
13949

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected