@ -3934,6 +3934,11 @@ void ImGui::Shutdown(ImGuiContext* context)
g . DrawDataBuilder . ClearFreeMemory ( ) ;
g . DrawDataBuilder . ClearFreeMemory ( ) ;
g . BackgroundDrawList . ClearFreeMemory ( ) ;
g . BackgroundDrawList . ClearFreeMemory ( ) ;
g . ForegroundDrawList . ClearFreeMemory ( ) ;
g . ForegroundDrawList . ClearFreeMemory ( ) ;
g . TabBars . Clear ( ) ;
g . CurrentTabBarStack . clear ( ) ;
g . ShrinkWidthBuffer . clear ( ) ;
g . PrivateClipboard . clear ( ) ;
g . PrivateClipboard . clear ( ) ;
g . InputTextState . ClearFreeMemory ( ) ;
g . InputTextState . ClearFreeMemory ( ) ;
@ -6744,7 +6749,8 @@ void ImGui::SetNextWindowBgAlpha(float alpha)
// FIXME: This is in window space (not screen space!). We should try to obsolete all those functions.
// FIXME: This is in window space (not screen space!). We should try to obsolete all those functions.
ImVec2 ImGui : : GetContentRegionMax ( )
ImVec2 ImGui : : GetContentRegionMax ( )
{
{
ImGuiWindow * window = GImGui - > CurrentWindow ;
ImGuiContext & g = * GImGui ;
ImGuiWindow * window = g . CurrentWindow ;
ImVec2 mx = window - > ContentsRegionRect . Max - window - > Pos ;
ImVec2 mx = window - > ContentsRegionRect . Max - window - > Pos ;
if ( window - > DC . CurrentColumns )
if ( window - > DC . CurrentColumns )
mx . x = window - > WorkRect . Max . x - window - > Pos . x ;
mx . x = window - > WorkRect . Max . x - window - > Pos . x ;
@ -6754,7 +6760,8 @@ ImVec2 ImGui::GetContentRegionMax()
// [Internal] Absolute coordinate. Saner. This is not exposed until we finishing refactoring work rect features.
// [Internal] Absolute coordinate. Saner. This is not exposed until we finishing refactoring work rect features.
ImVec2 ImGui : : GetContentRegionMaxAbs ( )
ImVec2 ImGui : : GetContentRegionMaxAbs ( )
{
{
ImGuiWindow * window = GImGui - > CurrentWindow ;
ImGuiContext & g = * GImGui ;
ImGuiWindow * window = g . CurrentWindow ;
ImVec2 mx = window - > ContentsRegionRect . Max ;
ImVec2 mx = window - > ContentsRegionRect . Max ;
if ( window - > DC . CurrentColumns )
if ( window - > DC . CurrentColumns )
mx . x = window - > WorkRect . Max . x ;
mx . x = window - > WorkRect . Max . x ;
@ -9650,14 +9657,16 @@ void ImGui::ShowMetricsWindow(bool* p_open)
return ;
return ;
}
}
// State
enum { WRT_OuterRect , WRT_OuterRectClipped , WRT_InnerRect , WRT_InnerClipRect , WRT_WorkRect , WRT_Contents , WRT_ContentsRegionRect , WRT_Count } ; // Windows Rect Type
enum { WRT_OuterRect , WRT_OuterRectClipped , WRT_InnerRect , WRT_InnerClipRect , WRT_WorkRect , WRT_Contents , WRT_ContentsRegionRect , WRT_Count } ; // Windows Rect Type
const char * wrt_rects_names [ WRT_Count ] = { " OuterRect " , " OuterRectClipped " , " InnerRect " , " InnerClipRect " , " WorkRect " , " Contents " , " ContentsRegionRect " } ;
const char * wrt_rects_names [ WRT_Count ] = { " OuterRect " , " OuterRectClipped " , " InnerRect " , " InnerClipRect " , " WorkRect " , " Contents " , " ContentsRegionRect " } ;
static bool show_windows_begin_order = false ;
static bool show_windows_rects = false ;
static bool show_windows_rects = false ;
static int show_windows_rect_type = WRT_WorkRect ;
static int show_windows_rect_type = WRT_WorkRect ;
static bool show_windows_begin_order = false ;
static bool show_drawcmd_clip_rects = true ;
static bool show_drawcmd_clip_rects = true ;
// Basic info
ImGuiContext & g = * GImGui ;
ImGuiIO & io = ImGui : : GetIO ( ) ;
ImGuiIO & io = ImGui : : GetIO ( ) ;
ImGui : : Text ( " Dear ImGui %s " , ImGui : : GetVersion ( ) ) ;
ImGui : : Text ( " Dear ImGui %s " , ImGui : : GetVersion ( ) ) ;
ImGui : : Text ( " Application average %.3f ms/frame (%.1f FPS) " , 1000.0f / io . Framerate , io . Framerate ) ;
ImGui : : Text ( " Application average %.3f ms/frame (%.1f FPS) " , 1000.0f / io . Framerate , io . Framerate ) ;
@ -9666,6 +9675,12 @@ void ImGui::ShowMetricsWindow(bool* p_open)
ImGui : : Text ( " %d active allocations " , io . MetricsActiveAllocations ) ;
ImGui : : Text ( " %d active allocations " , io . MetricsActiveAllocations ) ;
ImGui : : Separator ( ) ;
ImGui : : Separator ( ) ;
// Helper functions to display common structures:
// - NodeDrawList
// - NodeColumns
// - NodeWindow
// - NodeWindows
// - NodeTabBar
struct Funcs
struct Funcs
{
{
static ImRect GetWindowRect ( ImGuiWindow * window , int rect_type )
static ImRect GetWindowRect ( ImGuiWindow * window , int rect_type )
@ -9830,8 +9845,6 @@ void ImGui::ShowMetricsWindow(bool* p_open)
}
}
} ;
} ;
// Access private state, we are going to display the draw lists from last frame
ImGuiContext & g = * GImGui ;
Funcs : : NodeWindows ( g . Windows , " Windows " ) ;
Funcs : : NodeWindows ( g . Windows , " Windows " ) ;
if ( ImGui : : TreeNode ( " DrawList " , " Active DrawLists (%d) " , g . DrawDataBuilder . Layers [ 0 ] . Size ) )
if ( ImGui : : TreeNode ( " DrawList " , " Active DrawLists (%d) " , g . DrawDataBuilder . Layers [ 0 ] . Size ) )
{
{
@ -9857,6 +9870,20 @@ void ImGui::ShowMetricsWindow(bool* p_open)
ImGui : : TreePop ( ) ;
ImGui : : TreePop ( ) ;
}
}
#if 0
if ( ImGui : : TreeNode ( " Docking " ) )
{
ImGui : : TreePop ( ) ;
}
# endif
#if 0
if ( ImGui : : TreeNode ( " Tables " , " Tables (%d) " , g . Tables . Data . Size ) )
{
ImGui : : TreePop ( ) ;
}
# endif
if ( ImGui : : TreeNode ( " Internal state " ) )
if ( ImGui : : TreeNode ( " Internal state " ) )
{
{
const char * input_source_names [ ] = { " None " , " Mouse " , " Nav " , " NavKeyboard " , " NavGamepad " } ; IM_ASSERT ( IM_ARRAYSIZE ( input_source_names ) = = ImGuiInputSource_COUNT ) ;
const char * input_source_names [ ] = { " None " , " Mouse " , " Nav " , " NavKeyboard " , " NavGamepad " } ; IM_ASSERT ( IM_ARRAYSIZE ( input_source_names ) = = ImGuiInputSource_COUNT ) ;
@ -9903,6 +9930,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
ImGui : : TreePop ( ) ;
ImGui : : TreePop ( ) ;
}
}
// Tool: Display windows Rectangles and Begin Order
if ( show_windows_rects | | show_windows_begin_order )
if ( show_windows_rects | | show_windows_begin_order )
{
{
for ( int n = 0 ; n < g . Windows . Size ; n + + )
for ( int n = 0 ; n < g . Windows . Size ; n + + )