| 12994 | } |
| 12995 | |
| 12996 | void ImGui::ShowMetricsWindow(bool* p_open) |
| 12997 | { |
| 12998 | ImGuiContext& g = *GImGui; |
| 12999 | ImGuiIO& io = g.IO; |
| 13000 | ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig; |
| 13001 | if (cfg->ShowDebugLog) |
| 13002 | ShowDebugLogWindow(&cfg->ShowDebugLog); |
| 13003 | if (cfg->ShowStackTool) |
| 13004 | ShowStackToolWindow(&cfg->ShowStackTool); |
| 13005 | |
| 13006 | if (!Begin("Dear ImGui Metrics/Debugger", p_open) || GetCurrentWindow()->BeginCount > 1) |
| 13007 | { |
| 13008 | End(); |
| 13009 | return; |
| 13010 | } |
| 13011 | |
| 13012 | // Basic info |
| 13013 | Text("Dear ImGui %s", GetVersion()); |
| 13014 | Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); |
| 13015 | Text("%d vertices, %d indices (%d triangles)", io.MetricsRenderVertices, io.MetricsRenderIndices, io.MetricsRenderIndices / 3); |
| 13016 | Text("%d visible windows, %d active allocations", io.MetricsRenderWindows, io.MetricsActiveAllocations); |
| 13017 | //SameLine(); if (SmallButton("GC")) { g.GcCompactAll = true; } |
| 13018 | |
| 13019 | Separator(); |
| 13020 | |
| 13021 | // Debugging enums |
| 13022 | enum { WRT_OuterRect, WRT_OuterRectClipped, WRT_InnerRect, WRT_InnerClipRect, WRT_WorkRect, WRT_Content, WRT_ContentIdeal, WRT_ContentRegionRect, WRT_Count }; // Windows Rect Type |
| 13023 | const char* wrt_rects_names[WRT_Count] = { "OuterRect", "OuterRectClipped", "InnerRect", "InnerClipRect", "WorkRect", "Content", "ContentIdeal", "ContentRegionRect" }; |
| 13024 | enum { TRT_OuterRect, TRT_InnerRect, TRT_WorkRect, TRT_HostClipRect, TRT_InnerClipRect, TRT_BackgroundClipRect, TRT_ColumnsRect, TRT_ColumnsWorkRect, TRT_ColumnsClipRect, TRT_ColumnsContentHeadersUsed, TRT_ColumnsContentHeadersIdeal, TRT_ColumnsContentFrozen, TRT_ColumnsContentUnfrozen, TRT_Count }; // Tables Rect Type |
| 13025 | const char* trt_rects_names[TRT_Count] = { "OuterRect", "InnerRect", "WorkRect", "HostClipRect", "InnerClipRect", "BackgroundClipRect", "ColumnsRect", "ColumnsWorkRect", "ColumnsClipRect", "ColumnsContentHeadersUsed", "ColumnsContentHeadersIdeal", "ColumnsContentFrozen", "ColumnsContentUnfrozen" }; |
| 13026 | if (cfg->ShowWindowsRectsType < 0) |
| 13027 | cfg->ShowWindowsRectsType = WRT_WorkRect; |
| 13028 | if (cfg->ShowTablesRectsType < 0) |
| 13029 | cfg->ShowTablesRectsType = TRT_WorkRect; |
| 13030 | |
| 13031 | struct Funcs |
| 13032 | { |
| 13033 | static ImRect GetTableRect(ImGuiTable* table, int rect_type, int n) |
| 13034 | { |
| 13035 | ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); // Always using last submitted instance |
| 13036 | if (rect_type == TRT_OuterRect) { return table->OuterRect; } |
| 13037 | else if (rect_type == TRT_InnerRect) { return table->InnerRect; } |
| 13038 | else if (rect_type == TRT_WorkRect) { return table->WorkRect; } |
| 13039 | else if (rect_type == TRT_HostClipRect) { return table->HostClipRect; } |
| 13040 | else if (rect_type == TRT_InnerClipRect) { return table->InnerClipRect; } |
| 13041 | else if (rect_type == TRT_BackgroundClipRect) { return table->BgClipRect; } |
| 13042 | else if (rect_type == TRT_ColumnsRect) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->MinX, table->InnerClipRect.Min.y, c->MaxX, table->InnerClipRect.Min.y + table_instance->LastOuterHeight); } |
| 13043 | else if (rect_type == TRT_ColumnsWorkRect) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->WorkRect.Min.y, c->WorkMaxX, table->WorkRect.Max.y); } |
| 13044 | else if (rect_type == TRT_ColumnsClipRect) { ImGuiTableColumn* c = &table->Columns[n]; return c->ClipRect; } |
| 13045 | else if (rect_type == TRT_ColumnsContentHeadersUsed){ ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXHeadersUsed, table->InnerClipRect.Min.y + table_instance->LastFirstRowHeight); } // Note: y1/y2 not always accurate |
| 13046 | else if (rect_type == TRT_ColumnsContentHeadersIdeal){ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXHeadersIdeal, table->InnerClipRect.Min.y + table_instance->LastFirstRowHeight); } |
| 13047 | else if (rect_type == TRT_ColumnsContentFrozen) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXFrozen, table->InnerClipRect.Min.y + table_instance->LastFirstRowHeight); } |
| 13048 | else if (rect_type == TRT_ColumnsContentUnfrozen) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y + table_instance->LastFirstRowHeight, c->ContentMaxXUnfrozen, table->InnerClipRect.Max.y); } |
| 13049 | IM_ASSERT(0); |
| 13050 | return ImRect(); |
| 13051 | } |
| 13052 | |
| 13053 | static ImRect GetWindowRect(ImGuiWindow* window, int rect_type) |
nothing calls this directly
no test coverage detected