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

Method ShowStackToolWindow

KBotExt/imgui/imgui.cpp:14852–14926  ·  view source on GitHub ↗

Stack Tool: Display UI

Source from the content-addressed store, hash-verified

14850
14851// Stack Tool: Display UI
14852void ImGui::ShowStackToolWindow(bool* p_open)
14853{
14854 ImGuiContext& g = *GImGui;
14855 if (!(g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize))
14856 SetNextWindowSize(ImVec2(0.0f, GetFontSize() * 8.0f), ImGuiCond_FirstUseEver);
14857 if (!Begin("Dear ImGui Stack Tool", p_open) || GetCurrentWindow()->BeginCount > 1)
14858 {
14859 End();
14860 return;
14861 }
14862
14863 // Display hovered/active status
14864 ImGuiStackTool* tool = &g.DebugStackTool;
14865 const ImGuiID hovered_id = g.HoveredIdPreviousFrame;
14866 const ImGuiID active_id = g.ActiveId;
14867#ifdef IMGUI_ENABLE_TEST_ENGINE
14868 Text("HoveredId: 0x%08X (\"%s\"), ActiveId: 0x%08X (\"%s\")", hovered_id, hovered_id ? ImGuiTestEngine_FindItemDebugLabel(&g, hovered_id) : "", active_id, active_id ? ImGuiTestEngine_FindItemDebugLabel(&g, active_id) : "");
14869#else
14870 Text("HoveredId: 0x%08X, ActiveId: 0x%08X", hovered_id, active_id);
14871#endif
14872 SameLine();
14873 MetricsHelpMarker("Hover an item with the mouse to display elements of the ID Stack leading to the item's final ID.\nEach level of the stack correspond to a PushID() call.\nAll levels of the stack are hashed together to make the final ID of a widget (ID displayed at the bottom level of the stack).\nRead FAQ entry about the ID stack for details.");
14874
14875 // CTRL+C to copy path
14876 const float time_since_copy = (float)g.Time - tool->CopyToClipboardLastTime;
14877 Checkbox("Ctrl+C: copy path to clipboard", &tool->CopyToClipboardOnCtrlC);
14878 SameLine();
14879 TextColored((time_since_copy >= 0.0f && time_since_copy < 0.75f && ImFmod(time_since_copy, 0.25f) < 0.25f * 0.5f) ? ImVec4(1.f, 1.f, 0.3f, 1.f) : ImVec4(), "*COPIED*");
14880 if (tool->CopyToClipboardOnCtrlC && IsKeyDown(ImGuiMod_Ctrl) && IsKeyPressed(ImGuiKey_C))
14881 {
14882 tool->CopyToClipboardLastTime = (float)g.Time;
14883 char* p = g.TempBuffer.Data;
14884 char* p_end = p + g.TempBuffer.Size;
14885 for (int stack_n = 0; stack_n < tool->Results.Size && p + 3 < p_end; stack_n++)
14886 {
14887 *p++ = '/';
14888 char level_desc[256];
14889 StackToolFormatLevelInfo(tool, stack_n, false, level_desc, IM_ARRAYSIZE(level_desc));
14890 for (int n = 0; level_desc[n] && p + 2 < p_end; n++)
14891 {
14892 if (level_desc[n] == '/')
14893 *p++ = '\\';
14894 *p++ = level_desc[n];
14895 }
14896 }
14897 *p = '\0';
14898 SetClipboardText(g.TempBuffer.Data);
14899 }
14900
14901 // Display decorated stack
14902 tool->LastActiveFrame = g.FrameCount;
14903 if (tool->Results.Size > 0 && BeginTable("##table", 3, ImGuiTableFlags_Borders))
14904 {
14905 const float id_width = CalcTextSize("0xDDDDDDDD").x;
14906 TableSetupColumn("Seed", ImGuiTableColumnFlags_WidthFixed, id_width);
14907 TableSetupColumn("PushID", ImGuiTableColumnFlags_WidthStretch);
14908 TableSetupColumn("Result", ImGuiTableColumnFlags_WidthFixed, id_width);
14909 TableHeadersRow();

Callers

nothing calls this directly

Calls 5

ImVec2Function · 0.85
GetCurrentWindowFunction · 0.85
MetricsHelpMarkerFunction · 0.85
ImVec4Class · 0.85
StackToolFormatLevelInfoFunction · 0.85

Tested by

no test coverage detected