@ -3180,7 +3180,7 @@ void ImGui::Initialize(ImGuiContext* context)
ini_handler . ReadOpenFn = SettingsHandlerWindow_ReadOpen ;
ini_handler . ReadLineFn = SettingsHandlerWindow_ReadLine ;
ini_handler . WriteAllFn = SettingsHandlerWindow_WriteAll ;
g . SettingsHandlers . push_ front ( ini_handler ) ;
g . SettingsHandlers . push_ back ( ini_handler ) ;
// Create default viewport
ImGuiViewportP * viewport = IM_NEW ( ImGuiViewportP ) ( ) ;
@ -3746,7 +3746,7 @@ void ImGui::RenderBullet(ImVec2 pos)
{
ImGuiContext & g = * GImGui ;
ImGuiWindow * window = g . CurrentWindow ;
window - > DrawList - > AddCircleFilled ( pos , GImGui- > FontSize * 0.20f , GetColorU32 ( ImGuiCol_Text ) , 8 ) ;
window - > DrawList - > AddCircleFilled ( pos , g. FontSize * 0.20f , GetColorU32 ( ImGuiCol_Text ) , 8 ) ;
}
void ImGui : : RenderCheckMark ( ImVec2 pos , ImU32 col , float sz )
@ -4771,8 +4771,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window = CreateNewWindow ( name , size_on_first_use , flags ) ;
}
// Update name when it changes (which can only happen with the "###" operator), but only if it is meant to be displayed to the end user, else there is no point.
if ( ! window_just_created & & window - > Viewport & & window - > Viewport - > Window = = window & & strcmp ( name , window - > Name ) ! = 0 )
// Update stored window name when it changes (which can only happen with the "###" operator).
// Only if it is meant to be displayed to the end user in a different place than the title bar (which already always display the 'name' parameter)
bool window_title_visible_elsewhere = ( window - > Viewport & & window - > Viewport - > Window = = window ) ;
if ( ! window_just_created & & window_title_visible_elsewhere & & strcmp ( name , window - > Name ) ! = 0 )
{
IM_DELETE ( window - > Name ) ;
window - > Name = ImStrdup ( name ) ;
@ -4791,18 +4793,14 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
{
window - > FlagsPreviousFrame = window - > Flags ;
window - > Flags = ( ImGuiWindowFlags ) flags ;
window - > BeginOrderWithinParent = 0 ;
window - > BeginOrderWithinContext = g . WindowsActiveCount + + ;
}
else
{
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
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 - > HiddenFramesForResize > 0 ) ;
@ -4816,6 +4814,11 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
if ( window - > Appearing )
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
// We intentionally set g.CurrentWindow to NULL to prevent usage until when the viewport is set, then will call SetCurrentWindow()
g . CurrentWindowStack . push_back ( window ) ;
@ -4883,8 +4886,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
UpdateWindowParentAndRootLinks ( window , flags , parent_window ) ;
window - > Active = true ;
window - > BeginOrderWithinParent = 0 ;
window - > BeginOrderWithinContext = g . WindowsActiveCount + + ;
window - > HasCloseButton = ( p_open ! = NULL ) ;
window - > ClipRect = ImVec4 ( - FLT_MAX , - FLT_MAX , + FLT_MAX , + FLT_MAX ) ;
window - > LastFrameActive = current_frame ;
window - > IDStack . resize ( 1 ) ;
@ -5393,7 +5395,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window - > InnerClipRect . Max . x = ImFloor ( 0.5f + window - > InnerMainRect . Max . x - ImMax ( 0.0f , ImFloor ( window - > WindowPadding . x * 0.5f - window - > WindowBorderSize ) ) ) ;
window - > InnerClipRect . Max . y = ImFloor ( 0.5f + window - > InnerMainRect . Max . y ) ;
// After Begin() we fill the last item / hovered data based on title bar data. It is a standard behavior (to allow creation of context menus on title bar only, etc.).
// We fill last item data based on Title Bar or Tab, in order for IsItemHovered() and IsItemActive() to be usable after Begin().
// This is useful to allow creating context menus on title bar only, etc.
window - > DC . LastItemId = window - > MoveId ;
window - > DC . LastItemStatusFlags = IsMouseHoveringRect ( title_bar_rect . Min , title_bar_rect . Max , false ) ? ImGuiItemStatusFlags_HoveredRect : 0 ;
window - > DC . LastItemRect = title_bar_rect ;
@ -9668,7 +9671,8 @@ void ImGui::LoadIniSettingsFromMemory(const char* ini_data, size_t ini_size)
while ( line_end < buf_end & & * line_end ! = ' \n ' & & * line_end ! = ' \r ' )
line_end + + ;
line_end [ 0 ] = 0 ;
if ( line [ 0 ] = = ' ; ' )
continue ;
if ( line [ 0 ] = = ' [ ' & & line_end > line & & line_end [ - 1 ] = = ' ] ' )
{
// Parse "[Type][Name]". Note that 'Name' can itself contains [] characters, which is acceptable with the current format and parsing code.
@ -9758,6 +9762,7 @@ static void SettingsHandlerWindow_ReadLine(ImGuiContext*, ImGuiSettingsHandler*,
static void SettingsHandlerWindow_WriteAll ( ImGuiContext * imgui_ctx , ImGuiSettingsHandler * handler , ImGuiTextBuffer * buf )
{
// Gather data from windows that were active during this session
// (if a window wasn't opened in this session we preserve its settings)
ImGuiContext & g = * imgui_ctx ;
for ( int i = 0 ; i ! = g . Windows . Size ; i + + )
{
@ -9779,8 +9784,7 @@ static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, ImGuiSetting
settings - > Collapsed = window - > Collapsed ;
}
// Write a buffer
// If a window wasn't opened in this session we preserve its settings
// Write to text buffer
buf - > reserve ( buf - > size ( ) + g . SettingsWindows . Size * 96 ) ; // ballpark reserve
for ( int i = 0 ; i ! = g . SettingsWindows . Size ; i + + )
{
@ -9914,7 +9918,7 @@ static void RenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewp
ImRect thumb_r = thumb_window - > Rect ( ) ;
ImRect title_r = thumb_window - > TitleBarRect ( ) ;
ImRect thumb_r_scaled = ImRect ( ImFloor ( off + thumb_r . Min * scale ) , ImFloor ( off + thumb_r . Max * scale ) ) ;
ImRect title_r_scaled = ImRect ( ImFloor ( off + title_r . Min * scale ) , ImFloor ( off + ImVec2 ( title_r . Max . x , title_r . Min . y ) * scale ) + ImVec2 ( 0 , 5 ) ) ; // Exag erate title bar height
ImRect title_r_scaled = ImRect ( ImFloor ( off + title_r . Min * scale ) , ImFloor ( off + ImVec2 ( title_r . Max . x , title_r . Min . y ) * scale ) + ImVec2 ( 0 , 5 ) ) ; // Exag g erate title bar height
thumb_r_scaled . ClipWithFull ( bb ) ;
title_r_scaled . ClipWithFull ( bb ) ;
const bool window_is_focused = ( g . NavWindow & & thumb_window - > RootWindowForTitleBarHighlight = = g . NavWindow - > RootWindowForTitleBarHighlight ) ;
@ -9961,7 +9965,6 @@ void ImGui::ShowMetricsWindow(bool* p_open)
ImGui : : Text ( " %d allocations " , io . MetricsActiveAllocations ) ;
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 ( ) ;
struct Funcs
@ -10064,7 +10067,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
ImGui : : BulletText ( " NavRectRel[0]: (%.1f,%.1f)(%.1f,%.1f) " , window - > NavRectRel [ 0 ] . Min . x , window - > NavRectRel [ 0 ] . Min . y , window - > NavRectRel [ 0 ] . Max . x , window - > NavRectRel [ 0 ] . Max . y ) ;
else
ImGui : : BulletText ( " NavRectRel[0]: <None> " ) ;
ImGui : : BulletText ( " Viewport: %d , ViewportId: 0x%08X, ViewportPos: (%.1f,%.1f)" , window - > Viewport ? window - > Viewport - > Idx : - 1 , window - > ViewportId , window - > ViewportPos . x , window - > ViewportPos . y ) ;
ImGui : : BulletText ( " Viewport: %d %s , ViewportId: 0x%08X, ViewportPos: (%.1f,%.1f)" , window - > Viewport ? window - > Viewport - > Idx : - 1 , window - > ViewportOwned ? " (Owned) " : " " , window - > ViewportId , window - > ViewportPos . x , window - > ViewportPos . y ) ;
ImGui : : BulletText ( " ViewportMonitor: %d " , window - > Viewport ? window - > Viewport - > PlatformMonitor : - 1 ) ;
if ( window - > RootWindow ! = window ) NodeWindow ( window - > RootWindow , " RootWindow " ) ;
if ( window - > ParentWindow ! = NULL ) NodeWindow ( window - > ParentWindow , " ParentWindow " ) ;