@ -390,7 +390,7 @@
- 2016 / 05 / 07 ( 1.49 ) - removed confusing set of GetInternalState ( ) , GetInternalStateSize ( ) , SetInternalState ( ) functions . Now using CreateContext ( ) , DestroyContext ( ) , GetCurrentContext ( ) , SetCurrentContext ( ) .
- 2016 / 05 / 07 ( 1.49 ) - removed confusing set of GetInternalState ( ) , GetInternalStateSize ( ) , SetInternalState ( ) functions . Now using CreateContext ( ) , DestroyContext ( ) , GetCurrentContext ( ) , SetCurrentContext ( ) .
- 2016 / 05 / 02 ( 1.49 ) - renamed SetNextTreeNodeOpened ( ) to SetNextTreeNodeOpen ( ) , no redirection .
- 2016 / 05 / 02 ( 1.49 ) - renamed SetNextTreeNodeOpened ( ) to SetNextTreeNodeOpen ( ) , no redirection .
- 2016 / 05 / 01 ( 1.49 ) - obsoleted old signature of CollapsingHeader ( const char * label , const char * str_id = NULL , bool display_frame = true , bool default_open = false ) as extra parameters were badly designed and rarely used . You can replace the " default_open = true " flag in new API with CollapsingHeader ( label , ImGuiTreeNodeFlags_DefaultOpen ) .
- 2016 / 05 / 01 ( 1.49 ) - obsoleted old signature of CollapsingHeader ( const char * label , const char * str_id = NULL , bool display_frame = true , bool default_open = false ) as extra parameters were badly designed and rarely used . You can replace the " default_open = true " flag in new API with CollapsingHeader ( label , ImGuiTreeNodeFlags_DefaultOpen ) .
- 2016 / 04 / 26 ( 1.49 ) - changed ImDrawList : : PushClipRect ( ImVec4 rect ) to ImDraw : : PushClipRect ( Imvec2 min , ImVec2 max , bool intersect_with_current_clip_rect = false ) . Note that higher - level ImGui : : PushClipRect ( ) is preferable because it will clip at logic / widget level , whereas ImDrawList : : PushClipRect ( ) only affect your renderer .
- 2016 / 04 / 26 ( 1.49 ) - changed ImDrawList : : PushClipRect ( ImVec4 rect ) to ImDraw List : : PushClipRect ( Imvec2 min , ImVec2 max , bool intersect_with_current_clip_rect = false ) . Note that higher - level ImGui : : PushClipRect ( ) is preferable because it will clip at logic / widget level , whereas ImDrawList : : PushClipRect ( ) only affect your renderer .
- 2016 / 04 / 03 ( 1.48 ) - removed style . WindowFillAlphaDefault setting which was redundant . Bake default BG alpha inside style . Colors [ ImGuiCol_WindowBg ] and all other Bg color values . ( ref github issue # 337 ) .
- 2016 / 04 / 03 ( 1.48 ) - removed style . WindowFillAlphaDefault setting which was redundant . Bake default BG alpha inside style . Colors [ ImGuiCol_WindowBg ] and all other Bg color values . ( ref github issue # 337 ) .
- 2016 / 04 / 03 ( 1.48 ) - renamed ImGuiCol_TooltipBg to ImGuiCol_PopupBg , used by popups / menus and tooltips . popups / menus were previously using ImGuiCol_WindowBg . ( ref github issue # 337 )
- 2016 / 04 / 03 ( 1.48 ) - renamed ImGuiCol_TooltipBg to ImGuiCol_PopupBg , used by popups / menus and tooltips . popups / menus were previously using ImGuiCol_WindowBg . ( ref github issue # 337 )
- 2016 / 03 / 21 ( 1.48 ) - renamed GetWindowFont ( ) to GetFont ( ) , GetWindowFontSize ( ) to GetFontSize ( ) . Kept inline redirection function ( will obsolete ) .
- 2016 / 03 / 21 ( 1.48 ) - renamed GetWindowFont ( ) to GetFont ( ) , GetWindowFontSize ( ) to GetFontSize ( ) . Kept inline redirection function ( will obsolete ) .
@ -861,7 +861,7 @@ static void SetWindowScrollY(ImGuiWindow* window, float new_scroll_y
static void SetWindowPos ( ImGuiWindow * window , const ImVec2 & pos , ImGuiCond cond ) ;
static void SetWindowPos ( ImGuiWindow * window , const ImVec2 & pos , ImGuiCond cond ) ;
static void SetWindowSize ( ImGuiWindow * window , const ImVec2 & size , ImGuiCond cond ) ;
static void SetWindowSize ( ImGuiWindow * window , const ImVec2 & size , ImGuiCond cond ) ;
static void SetWindowCollapsed ( ImGuiWindow * window , bool collapsed , ImGuiCond cond ) ;
static void SetWindowCollapsed ( ImGuiWindow * window , bool collapsed , ImGuiCond cond ) ;
static ImGuiWindow * FindHoveredWindow ( ) ;
static void FindHoveredWindow ( ) ;
static ImGuiWindow * CreateNewWindow ( const char * name , ImVec2 size , ImGuiWindowFlags flags ) ;
static ImGuiWindow * CreateNewWindow ( const char * name , ImVec2 size , ImGuiWindowFlags flags ) ;
static void CheckStacksSize ( ImGuiWindow * window , bool write ) ;
static void CheckStacksSize ( ImGuiWindow * window , bool write ) ;
static ImVec2 CalcNextScrollFromScrollTargetAndClamp ( ImGuiWindow * window , bool snap_on_edges ) ;
static ImVec2 CalcNextScrollFromScrollTargetAndClamp ( ImGuiWindow * window , bool snap_on_edges ) ;
@ -3159,9 +3159,11 @@ static void ImGui::NavUpdateWindowing()
// Apply menu/layer toggle
// Apply menu/layer toggle
if ( apply_toggle_layer & & g . NavWindow )
if ( apply_toggle_layer & & g . NavWindow )
{
{
// Move to parent menu if necessary
ImGuiWindow * new_nav_window = g . NavWindow ;
ImGuiWindow * new_nav_window = g . NavWindow ;
while ( ( new_nav_window - > DC . NavLayerActiveMask & ( 1 < < 1 ) ) = = 0 & & ( new_nav_window - > Flags & ImGuiWindowFlags_ChildWindow ) ! = 0 & & ( new_nav_window - > Flags & ( ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu ) ) = = 0 )
while ( ( new_nav_window - > DC . NavLayerActiveMask & ( 1 < < 1 ) ) = = 0 & & ( new_nav_window - > Flags & ImGuiWindowFlags_ChildWindow ) ! = 0 & & ( new_nav_window - > Flags & ( ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu ) ) = = 0 )
new_nav_window = new_nav_window - > ParentWindow ;
new_nav_window = new_nav_window - > ParentWindow ;
if ( new_nav_window ! = g . NavWindow )
if ( new_nav_window ! = g . NavWindow )
{
{
ImGuiWindow * old_nav_window = g . NavWindow ;
ImGuiWindow * old_nav_window = g . NavWindow ;
@ -3690,8 +3692,7 @@ void ImGui::UpdateHoveredWindowAndCaptureFlags()
// - Child windows can extend beyond the limit of their parent so we need to derive HoveredRootWindow from HoveredWindow.
// - Child windows can extend beyond the limit of their parent so we need to derive HoveredRootWindow from HoveredWindow.
// - When moving a window we can skip the search, which also conveniently bypasses the fact that window->WindowRectClipped is lagging as this point of the frame.
// - When moving a window we can skip the search, which also conveniently bypasses the fact that window->WindowRectClipped is lagging as this point of the frame.
// - We also support the moved window toggling the NoInputs flag after moving has started in order to be able to detect windows below it, which is useful for e.g. docking mechanisms.
// - We also support the moved window toggling the NoInputs flag after moving has started in order to be able to detect windows below it, which is useful for e.g. docking mechanisms.
g . HoveredWindow = ( g . MovingWindow & & ! ( g . MovingWindow - > Flags & ImGuiWindowFlags_NoInputs ) ) ? g . MovingWindow : FindHoveredWindow ( ) ;
FindHoveredWindow ( ) ;
g . HoveredRootWindow = g . HoveredWindow ? g . HoveredWindow - > RootWindow : NULL ;
// Modal windows prevents cursor from hovering behind them.
// Modal windows prevents cursor from hovering behind them.
ImGuiWindow * modal_window = GetFrontMostPopupModal ( ) ;
ImGuiWindow * modal_window = GetFrontMostPopupModal ( ) ;
@ -4863,10 +4864,15 @@ void ImGui::CalcListClipping(int items_count, float items_height, int* out_items
// Find window given position, search front-to-back
// Find window given position, search front-to-back
// FIXME: Note that we have a lag here because WindowRectClipped is updated in Begin() so windows moved by user via SetWindowPos() and not SetNextWindowPos() will have that rectangle lagging by a frame at the time FindHoveredWindow() is called, aka before the next Begin(). Moving window thankfully isn't affected.
// FIXME: Note that we have a lag here because WindowRectClipped is updated in Begin() so windows moved by user via SetWindowPos() and not SetNextWindowPos() will have that rectangle lagging by a frame at the time FindHoveredWindow() is called, aka before the next Begin(). Moving window thankfully isn't affected.
static ImGuiWindow * FindHoveredWindow ( )
static void FindHoveredWindow ( )
{
{
ImGuiContext & g = * GImGui ;
ImGuiContext & g = * GImGui ;
for ( int i = g . Windows . Size - 1 ; i > = 0 ; i - - )
ImGuiWindow * hovered_window = NULL ;
if ( g . MovingWindow & & ! ( g . MovingWindow - > Flags & ImGuiWindowFlags_NoInputs ) )
hovered_window = g . MovingWindow ;
for ( int i = g . Windows . Size - 1 ; i > = 0 & & hovered_window = = NULL ; i - - )
{
{
ImGuiWindow * window = g . Windows [ i ] ;
ImGuiWindow * window = g . Windows [ i ] ;
if ( ! window - > Active )
if ( ! window - > Active )
@ -4877,9 +4883,17 @@ static ImGuiWindow* FindHoveredWindow()
// Using the clipped AABB, a child window will typically be clipped by its parent (not always)
// Using the clipped AABB, a child window will typically be clipped by its parent (not always)
ImRect bb ( window - > OuterRectClipped . Min - g . Style . TouchExtraPadding , window - > OuterRectClipped . Max + g . Style . TouchExtraPadding ) ;
ImRect bb ( window - > OuterRectClipped . Min - g . Style . TouchExtraPadding , window - > OuterRectClipped . Max + g . Style . TouchExtraPadding ) ;
if ( bb . Contains ( g . IO . MousePos ) )
if ( bb . Contains ( g . IO . MousePos ) )
return window ;
{
if ( hovered_window = = NULL )
hovered_window = window ;
if ( hovered_window )
break ;
}
}
}
return NULL ;
g . HoveredWindow = hovered_window ;
g . HoveredRootWindow = g . HoveredWindow ? g . HoveredWindow - > RootWindow : NULL ;
}
}
// Test if mouse cursor is hovering given rectangle
// Test if mouse cursor is hovering given rectangle
@ -5816,10 +5830,9 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFl
// User can disable loading and saving of settings. Tooltip and child windows also don't store settings.
// User can disable loading and saving of settings. Tooltip and child windows also don't store settings.
if ( ! ( flags & ImGuiWindowFlags_NoSavedSettings ) )
if ( ! ( flags & ImGuiWindowFlags_NoSavedSettings ) )
{
// Retrieve settings from .ini file
if ( ImGuiWindowSettings * settings = ImGui : : FindWindowSettings ( window - > ID ) )
if ( ImGuiWindowSettings * settings = ImGui : : FindWindowSettings ( window - > ID ) )
{
{
// Retrieve settings from .ini file
window - > SettingsIdx = g . SettingsWindows . index_from_pointer ( settings ) ;
window - > SettingsIdx = g . SettingsWindows . index_from_pointer ( settings ) ;
SetWindowConditionAllowFlags ( window , ImGuiCond_FirstUseEver , false ) ;
SetWindowConditionAllowFlags ( window , ImGuiCond_FirstUseEver , false ) ;
window - > Pos = ImFloor ( settings - > Pos ) ;
window - > Pos = ImFloor ( settings - > Pos ) ;
@ -5827,7 +5840,6 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFl
if ( ImLengthSqr ( settings - > Size ) > 0.00001f )
if ( ImLengthSqr ( settings - > Size ) > 0.00001f )
size = ImFloor ( settings - > Size ) ;
size = ImFloor ( settings - > Size ) ;
}
}
}
window - > Size = window - > SizeFull = window - > SizeFullAtLastBegin = size ;
window - > Size = window - > SizeFull = window - > SizeFullAtLastBegin = size ;
if ( ( flags & ImGuiWindowFlags_AlwaysAutoResize ) ! = 0 )
if ( ( flags & ImGuiWindowFlags_AlwaysAutoResize ) ! = 0 )
@ -6150,6 +6162,12 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
else
else
flags = window - > Flags ;
flags = window - > Flags ;
// Parent window is latched only on the first call to Begin() of the frame, so further append-calls can be done from a different window stack
ImGuiWindow * parent_window_in_stack = g . CurrentWindowStack . empty ( ) ? NULL : g . CurrentWindowStack . back ( ) ;
ImGuiWindow * parent_window = first_begin_of_the_frame ? ( ( flags & ( ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup ) ) ? parent_window_in_stack : NULL ) : window - > ParentWindow ;
IM_ASSERT ( parent_window ! = NULL | | ! ( flags & ImGuiWindowFlags_ChildWindow ) ) ;
window - > HasCloseButton = ( p_open ! = NULL ) ;
// Update the Appearing flag
// Update the Appearing flag
bool window_just_activated_by_user = ( window - > LastFrameActive < current_frame - 1 ) ; // Not using !WasActive because the implicit "Debug" window would always toggle off->on
bool window_just_activated_by_user = ( window - > LastFrameActive < current_frame - 1 ) ; // Not using !WasActive because the implicit "Debug" window would always toggle off->on
const bool window_just_appearing_after_hidden_for_resize = ( window - > HiddenFrames > 0 ) ;
const bool window_just_appearing_after_hidden_for_resize = ( window - > HiddenFrames > 0 ) ;
@ -6160,15 +6178,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window_just_activated_by_user | = ( window ! = popup_ref . Window ) ;
window_just_activated_by_user | = ( window ! = popup_ref . Window ) ;
}
}
window - > Appearing = ( window_just_activated_by_user | | window_just_appearing_after_hidden_for_resize ) ;
window - > Appearing = ( window_just_activated_by_user | | window_just_appearing_after_hidden_for_resize ) ;
window - > HasCloseButton = ( p_open ! = NULL ) ;
if ( window - > Appearing )
if ( window - > Appearing )
SetWindowConditionAllowFlags ( window , ImGuiCond_Appearing , true ) ;
SetWindowConditionAllowFlags ( window , ImGuiCond_Appearing , true ) ;
// Parent window is latched only on the first call to Begin() of the frame, so further append-calls can be done from a different window stack
ImGuiWindow * parent_window_in_stack = g . CurrentWindowStack . empty ( ) ? NULL : g . CurrentWindowStack . back ( ) ;
ImGuiWindow * parent_window = first_begin_of_the_frame ? ( ( flags & ( ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup ) ) ? parent_window_in_stack : NULL ) : window - > ParentWindow ;
IM_ASSERT ( parent_window ! = NULL | | ! ( flags & ImGuiWindowFlags_ChildWindow ) ) ;
// Add to stack
// Add to stack
g . CurrentWindowStack . push_back ( window ) ;
g . CurrentWindowStack . push_back ( window ) ;
SetCurrentWindow ( window ) ;
SetCurrentWindow ( window ) ;
@ -6395,7 +6407,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// Lock window rounding for the frame (so that altering them doesn't cause inconsistencies)
// Lock window rounding for the frame (so that altering them doesn't cause inconsistencies)
window - > WindowRounding = ( flags & ImGuiWindowFlags_ChildWindow ) ? style . ChildRounding : ( ( flags & ImGuiWindowFlags_Popup ) & & ! ( flags & ImGuiWindowFlags_Modal ) ) ? style . PopupRounding : style . WindowRounding ;
window - > WindowRounding = ( flags & ImGuiWindowFlags_ChildWindow ) ? style . ChildRounding : ( ( flags & ImGuiWindowFlags_Popup ) & & ! ( flags & ImGuiWindowFlags_Modal ) ) ? style . PopupRounding : style . WindowRounding ;
// Prepare for focus requests
// Prepare for item focus requests
window - > FocusIdxAllRequestCurrent = ( window - > FocusIdxAllRequestNext = = INT_MAX | | window - > FocusIdxAllCounter = = - 1 ) ? INT_MAX : ( window - > FocusIdxAllRequestNext + ( window - > FocusIdxAllCounter + 1 ) ) % ( window - > FocusIdxAllCounter + 1 ) ;
window - > FocusIdxAllRequestCurrent = ( window - > FocusIdxAllRequestNext = = INT_MAX | | window - > FocusIdxAllCounter = = - 1 ) ? INT_MAX : ( window - > FocusIdxAllRequestNext + ( window - > FocusIdxAllCounter + 1 ) ) % ( window - > FocusIdxAllCounter + 1 ) ;
window - > FocusIdxTabRequestCurrent = ( window - > FocusIdxTabRequestNext = = INT_MAX | | window - > FocusIdxTabCounter = = - 1 ) ? INT_MAX : ( window - > FocusIdxTabRequestNext + ( window - > FocusIdxTabCounter + 1 ) ) % ( window - > FocusIdxTabCounter + 1 ) ;
window - > FocusIdxTabRequestCurrent = ( window - > FocusIdxTabRequestNext = = INT_MAX | | window - > FocusIdxTabCounter = = - 1 ) ? INT_MAX : ( window - > FocusIdxTabRequestNext + ( window - > FocusIdxTabCounter + 1 ) ) % ( window - > FocusIdxTabCounter + 1 ) ;
window - > FocusIdxAllCounter = window - > FocusIdxTabCounter = - 1 ;
window - > FocusIdxAllCounter = window - > FocusIdxTabCounter = - 1 ;
@ -6405,7 +6417,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window - > Scroll = CalcNextScrollFromScrollTargetAndClamp ( window , true ) ;
window - > Scroll = CalcNextScrollFromScrollTargetAndClamp ( window , true ) ;
window - > ScrollTarget = ImVec2 ( FLT_MAX , FLT_MAX ) ;
window - > ScrollTarget = ImVec2 ( FLT_MAX , FLT_MAX ) ;
// Apply focus, new windows appears in front
// Apply window focus (new and reactivated windows are moved to front)
bool want_focus = false ;
bool want_focus = false ;
if ( window_just_activated_by_user & & ! ( flags & ImGuiWindowFlags_NoFocusOnAppearing ) )
if ( window_just_activated_by_user & & ! ( flags & ImGuiWindowFlags_NoFocusOnAppearing ) )
if ( ! ( flags & ( ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Tooltip ) ) | | ( flags & ImGuiWindowFlags_Popup ) )
if ( ! ( flags & ( ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Tooltip ) ) | | ( flags & ImGuiWindowFlags_Popup ) )
@ -6479,7 +6491,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
bg_col = ( bg_col & ~ IM_COL32_A_MASK ) | ( IM_F32_TO_INT8_SAT ( g . NextWindowData . BgAlphaVal ) < < IM_COL32_A_SHIFT ) ;
bg_col = ( bg_col & ~ IM_COL32_A_MASK ) | ( IM_F32_TO_INT8_SAT ( g . NextWindowData . BgAlphaVal ) < < IM_COL32_A_SHIFT ) ;
g . NextWindowData . BgAlphaCond = 0 ;
g . NextWindowData . BgAlphaCond = 0 ;
}
}
window - > DrawList - > AddRectFilled ( window - > Pos + ImVec2 ( 0 , window - > TitleBarHeight ( ) ) , window - > Pos + window - > Size , bg_col , window_rounding , ( flags & ImGuiWindowFlags_NoTitleBar ) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot ) ;
window - > DrawList - > AddRectFilled ( window - > Pos + ImVec2 ( 0 , window - > TitleBarHeight ( ) ) , window - > Pos + window - > Size , bg_col , window_rounding , ( flags & ImGuiWindowFlags_NoTitleBar ) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot ) ;
// Title bar
// Title bar
ImU32 title_bar_col = GetColorU32 ( window - > Collapsed ? ImGuiCol_TitleBgCollapsed : title_bar_is_highlight ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg ) ;
ImU32 title_bar_col = GetColorU32 ( window - > Collapsed ? ImGuiCol_TitleBgCollapsed : title_bar_is_highlight ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg ) ;
@ -6525,7 +6537,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window - > DrawList - > AddLine ( border . Min , border . Max , GetColorU32 ( ImGuiCol_SeparatorActive ) , ImMax ( 1.0f , window_border_size ) ) ;
window - > DrawList - > AddLine ( border . Min , border . Max , GetColorU32 ( ImGuiCol_SeparatorActive ) , ImMax ( 1.0f , window_border_size ) ) ;
}
}
if ( style . FrameBorderSize > 0 & & ! ( flags & ImGuiWindowFlags_NoTitleBar ) )
if ( style . FrameBorderSize > 0 & & ! ( flags & ImGuiWindowFlags_NoTitleBar ) )
window - > DrawList - > AddLine ( title_bar_rect . GetBL ( ) + ImVec2 ( style . WindowBorderSize , - 1 ) , title_bar_rect . GetBR ( ) + ImVec2 ( - style . WindowBorderSize , - 1 ) , GetColorU32 ( ImGuiCol_Border ) , style . FrameBorderSize ) ;
window - > DrawList - > AddLine ( title_bar_rect . GetBL ( ) + ImVec2 ( style . WindowBorderSize , - 1 ) , title_bar_rect . GetBR ( ) + ImVec2 ( - style . WindowBorderSize , - 1 ) , GetColorU32 ( ImGuiCol_Border ) , style . FrameBorderSize ) ;
}
}
// Draw navigation selection/windowing rectangle border
// Draw navigation selection/windowing rectangle border
@ -6695,10 +6707,11 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window - > BeginCount + + ;
window - > BeginCount + + ;
g . NextWindowData . Clear ( ) ;
g . NextWindowData . Clear ( ) ;
// Child window can be out of sight and have "negative" clip windows.
// Mark them as collapsed so commands are skipped earlier (we can't manually collapse them because they have no title bar).
if ( flags & ImGuiWindowFlags_ChildWindow )
if ( flags & ImGuiWindowFlags_ChildWindow )
{
{
// Child window can be out of sight and have "negative" clip windows.
// Mark them as collapsed so commands are skipped earlier (we can't manually collapse them because they have no title bar).
IM_ASSERT ( ( flags & ImGuiWindowFlags_NoTitleBar ) ! = 0 ) ;
IM_ASSERT ( ( flags & ImGuiWindowFlags_NoTitleBar ) ! = 0 ) ;
window - > Collapsed = parent_window & & parent_window - > Collapsed ;
window - > Collapsed = parent_window & & parent_window - > Collapsed ;
@ -6710,6 +6723,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
if ( window - > Collapsed )
if ( window - > Collapsed )
window - > Active = false ;
window - > Active = false ;
}
}
// Don't render if style alpha is 0.0 at the time of Begin(). This is arbitrary and inconsistent but has been there for a long while (may remove at some point)
if ( style . Alpha < = 0.0f )
if ( style . Alpha < = 0.0f )
window - > Active = false ;
window - > Active = false ;
@ -13911,11 +13926,14 @@ void ImGui::ShowMetricsWindow(bool* p_open)
if ( ImGui : : Begin ( " ImGui Metrics " , p_open ) )
if ( ImGui : : Begin ( " ImGui Metrics " , p_open ) )
{
{
static bool show_draw_cmd_clip_rects = true ;
static bool show_draw_cmd_clip_rects = true ;
static bool show_window_begin_order = false ;
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 / ImGui : : GetIO ( ) . Framerate , ImGui : : GetIO ( ) . Framerate ) ;
ImGui : : Text ( " Application average %.3f ms/frame (%.1f FPS) " , 1000.0f / ImGui : : GetIO ( ) . Framerate , ImGui : : GetIO ( ) . Framerate ) ;
ImGui : : Text ( " %d vertices, %d indices (%d triangles) " , ImGui : : GetIO ( ) . MetricsRenderVertices , ImGui : : GetIO ( ) . MetricsRenderIndices , ImGui : : GetIO ( ) . MetricsRenderIndices / 3 ) ;
ImGui : : Text ( " %d vertices, %d indices (%d triangles) " , ImGui : : GetIO ( ) . MetricsRenderVertices , ImGui : : GetIO ( ) . MetricsRenderIndices , ImGui : : GetIO ( ) . MetricsRenderIndices / 3 ) ;
ImGui : : Text ( " %d allocations " , ( int ) GImAllocatorActiveAllocationsCount ) ;
ImGui : : Text ( " %d allocations " , ( int ) GImAllocatorActiveAllocationsCount ) ;
ImGui : : Checkbox ( " Show clipping rectangles when hovering draw commands " , & show_draw_cmd_clip_rects ) ;
ImGui : : Checkbox ( " Show clipping rectangles when hovering draw commands " , & show_draw_cmd_clip_rects ) ;
ImGui : : Checkbox ( " Ctrl shows window begin order " , & show_window_begin_order ) ;
ImGui : : Separator ( ) ;
ImGui : : Separator ( ) ;
struct Funcs
struct Funcs
@ -14005,12 +14023,12 @@ void ImGui::ShowMetricsWindow(bool* p_open)
ImGuiWindowFlags flags = window - > Flags ;
ImGuiWindowFlags flags = window - > Flags ;
NodeDrawList ( window , window - > DrawList , " DrawList " ) ;
NodeDrawList ( window , window - > DrawList , " DrawList " ) ;
ImGui : : BulletText ( " Pos: (%.1f,%.1f), Size: (%.1f,%.1f), SizeContents (%.1f,%.1f) " , window - > Pos . x , window - > Pos . y , window - > Size . x , window - > Size . y , window - > SizeContents . x , window - > SizeContents . y ) ;
ImGui : : BulletText ( " Pos: (%.1f,%.1f), Size: (%.1f,%.1f), SizeContents (%.1f,%.1f) " , window - > Pos . x , window - > Pos . y , window - > Size . x , window - > Size . y , window - > SizeContents . x , window - > SizeContents . y ) ;
ImGui : : BulletText ( " Flags: 0x%08X (%s%s%s%s%s%s%s ..)" , flags ,
ImGui : : BulletText ( " Flags: 0x%08X (%s%s%s%s%s%s%s %s ..)" , flags ,
( flags & ImGuiWindowFlags_ChildWindow ) ? " Child " : " " , ( flags & ImGuiWindowFlags_Tooltip ) ? " Tooltip " : " " , ( flags & ImGuiWindowFlags_Popup ) ? " Popup " : " " ,
( flags & ImGuiWindowFlags_ChildWindow ) ? " Child " : " " , ( flags & ImGuiWindowFlags_Tooltip ) ? " Tooltip " : " " , ( flags & ImGuiWindowFlags_Popup ) ? " Popup " : " " ,
( flags & ImGuiWindowFlags_Modal ) ? " Modal " : " " , ( flags & ImGuiWindowFlags_ChildMenu ) ? " ChildMenu " : " " , ( flags & ImGuiWindowFlags_NoSavedSettings ) ? " NoSavedSettings " : " " ,
( flags & ImGuiWindowFlags_Modal ) ? " Modal " : " " , ( flags & ImGuiWindowFlags_ChildMenu ) ? " ChildMenu " : " " , ( flags & ImGuiWindowFlags_NoSavedSettings ) ? " NoSavedSettings " : " " ,
( flags & ImGuiWindowFlags_ AlwaysAutoResize) ? " AlwaysAutoResize " : " " ) ;
( flags & ImGuiWindowFlags_ NoInputs) ? " NoInputs " : " " , ( flags & ImGuiWindowFlags_ AlwaysAutoResize) ? " AlwaysAutoResize " : " " ) ;
ImGui : : BulletText ( " Scroll: (%.2f/%.2f,%.2f/%.2f) " , window - > Scroll . x , GetScrollMaxX ( window ) , window - > Scroll . y , GetScrollMaxY ( window ) ) ;
ImGui : : BulletText ( " Scroll: (%.2f/%.2f,%.2f/%.2f) " , window - > Scroll . x , GetScrollMaxX ( window ) , window - > Scroll . y , GetScrollMaxY ( window ) ) ;
ImGui : : BulletText ( " Active: %d , WriteAccessed: %d" , window - > Active | | window - > WasActive , window - > WriteAccessed ) ;
ImGui : : BulletText ( " Active: %d /%d , WriteAccessed: %d, BeginOrderWithinContext: %d " , window - > Active , window - > WasActive , window - > WriteAccessed , ( window - > Active | | window - > WasActive ) ? window - > BeginOrderWithinContext : - 1 ) ;
ImGui : : BulletText ( " NavLastIds: 0x%08X,0x%08X, NavLayerActiveMask: %X " , window - > NavLastIds [ 0 ] , window - > NavLastIds [ 1 ] , window - > DC . NavLayerActiveMask ) ;
ImGui : : BulletText ( " NavLastIds: 0x%08X,0x%08X, NavLayerActiveMask: %X " , window - > NavLastIds [ 0 ] , window - > NavLastIds [ 1 ] , window - > DC . NavLayerActiveMask ) ;
ImGui : : BulletText ( " NavLastChildNavWindow: %s " , window - > NavLastChildNavWindow ? window - > NavLastChildNavWindow - > Name : " NULL " ) ;
ImGui : : BulletText ( " NavLastChildNavWindow: %s " , window - > NavLastChildNavWindow ? window - > NavLastChildNavWindow - > Name : " NULL " ) ;
if ( ! window - > NavRectRel [ 0 ] . IsInverted ( ) )
if ( ! window - > NavRectRel [ 0 ] . IsInverted ( ) )
@ -14049,7 +14067,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
Funcs : : NodeDrawList ( NULL , g . DrawDataBuilder . Layers [ 0 ] [ i ] , " DrawList " ) ;
Funcs : : NodeDrawList ( NULL , g . DrawDataBuilder . Layers [ 0 ] [ i ] , " DrawList " ) ;
ImGui : : TreePop ( ) ;
ImGui : : TreePop ( ) ;
}
}
if ( ImGui : : TreeNode ( " Popups " , " Open Popups Stack (%d)" , g . OpenPopupStack . Size ) )
if ( ImGui : : TreeNode ( " Popups " , " Popups (%d)" , g . OpenPopupStack . Size ) )
{
{
for ( int i = 0 ; i < g . OpenPopupStack . Size ; i + + )
for ( int i = 0 ; i < g . OpenPopupStack . Size ; i + + )
{
{
@ -14073,9 +14091,27 @@ void ImGui::ShowMetricsWindow(bool* p_open)
ImGui : : Text ( " NavActive: %d, NavVisible: %d " , g . IO . NavActive , g . IO . NavVisible ) ;
ImGui : : Text ( " NavActive: %d, NavVisible: %d " , g . IO . NavActive , g . IO . NavVisible ) ;
ImGui : : Text ( " NavActivateId: 0x%08X, NavInputId: 0x%08X " , g . NavActivateId , g . NavInputId ) ;
ImGui : : Text ( " NavActivateId: 0x%08X, NavInputId: 0x%08X " , g . NavActivateId , g . NavInputId ) ;
ImGui : : Text ( " NavDisableHighlight: %d, NavDisableMouseHover: %d " , g . NavDisableHighlight , g . NavDisableMouseHover ) ;
ImGui : : Text ( " NavDisableHighlight: %d, NavDisableMouseHover: %d " , g . NavDisableHighlight , g . NavDisableMouseHover ) ;
ImGui : : Text ( " NavWindowingTarget: '%s' " , g . NavWindowingTarget ? g . NavWindowingTarget - > Name : " NULL " ) ;
ImGui : : Text ( " DragDrop: %d, SourceId = 0x%08X, Payload \" %s \" (%d bytes) " , g . DragDropActive , g . DragDropPayload . SourceId , g . DragDropPayload . DataType , g . DragDropPayload . DataSize ) ;
ImGui : : Text ( " DragDrop: %d, SourceId = 0x%08X, Payload \" %s \" (%d bytes) " , g . DragDropActive , g . DragDropPayload . SourceId , g . DragDropPayload . DataType , g . DragDropPayload . DataSize ) ;
ImGui : : TreePop ( ) ;
ImGui : : TreePop ( ) ;
}
}
if ( g . IO . KeyCtrl & & show_window_begin_order )
{
for ( int n = 0 ; n < g . Windows . Size ; n + + )
{
ImGuiWindow * window = g . Windows [ n ] ;
if ( ( window - > Flags & ImGuiWindowFlags_ChildWindow ) | | ! window - > WasActive )
continue ;
char buf [ 32 ] ;
ImFormatString ( buf , IM_ARRAYSIZE ( buf ) , " %d " , window - > BeginOrderWithinContext ) ;
float font_size = ImGui : : GetFontSize ( ) * 2 ;
ImDrawList * overlay_draw_list = GetOverlayDrawList ( ) ;
overlay_draw_list - > AddRectFilled ( window - > Pos , window - > Pos + ImVec2 ( font_size , font_size ) , IM_COL32 ( 200 , 100 , 100 , 255 ) ) ;
overlay_draw_list - > AddText ( NULL , font_size , window - > Pos , IM_COL32 ( 255 , 255 , 255 , 255 ) , buf ) ;
}
}
}
}
ImGui : : End ( ) ;
ImGui : : End ( ) ;
}
}