mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-04 07:01:04 +01:00 
			
		
		
		
	Internals: debug log macros.
This commit is contained in:
		@@ -8204,7 +8204,7 @@ void ImGui::OpenPopupEx(ImGuiID id)
 | 
			
		||||
    popup_ref.OpenPopupPos = NavCalcPreferredRefPos();
 | 
			
		||||
    popup_ref.OpenMousePos = IsMousePosValid(&g.IO.MousePos) ? g.IO.MousePos : popup_ref.OpenPopupPos;
 | 
			
		||||
 | 
			
		||||
    //IMGUI_DEBUG_LOG("OpenPopupEx(0x%08X)\n", g.FrameCount, id);
 | 
			
		||||
    IMGUI_DEBUG_LOG_POPUP("OpenPopupEx(0x%08X)\n", id);
 | 
			
		||||
    if (g.OpenPopupStack.Size < current_stack_size + 1)
 | 
			
		||||
    {
 | 
			
		||||
        g.OpenPopupStack.push_back(popup_ref);
 | 
			
		||||
@@ -8265,7 +8265,7 @@ void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to
 | 
			
		||||
    }
 | 
			
		||||
    if (popup_count_to_keep < g.OpenPopupStack.Size) // This test is not required but it allows to set a convenient breakpoint on the statement below
 | 
			
		||||
    {
 | 
			
		||||
        //IMGUI_DEBUG_LOG("ClosePopupsOverWindow(%s) -> ClosePopupToLevel(%d)\n", ref_window->Name, popup_count_to_keep);
 | 
			
		||||
        IMGUI_DEBUG_LOG_POPUP("ClosePopupsOverWindow(\"%s\") -> ClosePopupToLevel(%d)\n", ref_window->Name, popup_count_to_keep);
 | 
			
		||||
        ClosePopupToLevel(popup_count_to_keep, restore_focus_to_window_under_popup);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -8273,6 +8273,7 @@ void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to
 | 
			
		||||
void ImGui::ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup)
 | 
			
		||||
{
 | 
			
		||||
    ImGuiContext& g = *GImGui;
 | 
			
		||||
    IMGUI_DEBUG_LOG_POPUP("ClosePopupToLevel(%d), restore_focus_to_window_under_popup=%d\n", remaining, restore_focus_to_window_under_popup);
 | 
			
		||||
    IM_ASSERT(remaining >= 0 && remaining < g.OpenPopupStack.Size);
 | 
			
		||||
    ImGuiWindow* focus_window = g.OpenPopupStack[remaining].SourceWindow;
 | 
			
		||||
    ImGuiWindow* popup_window = g.OpenPopupStack[remaining].Window;
 | 
			
		||||
@@ -8315,7 +8316,7 @@ void ImGui::CloseCurrentPopup()
 | 
			
		||||
            break;
 | 
			
		||||
        popup_idx--;
 | 
			
		||||
    }
 | 
			
		||||
    //IMGUI_DEBUG_LOG("CloseCurrentPopup %d -> %d\n", g.BeginPopupStack.Size - 1, popup_idx);
 | 
			
		||||
    IMGUI_DEBUG_LOG_POPUP("CloseCurrentPopup %d -> %d\n", g.BeginPopupStack.Size - 1, popup_idx);
 | 
			
		||||
    ClosePopupToLevel(popup_idx, true);
 | 
			
		||||
 | 
			
		||||
    // A common pattern is to close a popup when selecting a menu item/selectable that will open another window.
 | 
			
		||||
 
 | 
			
		||||
@@ -156,10 +156,11 @@ extern IMGUI_API ImGuiContext* GImGui;  // Current implicit context pointer
 | 
			
		||||
#ifndef IMGUI_DEBUG_LOG
 | 
			
		||||
#define IMGUI_DEBUG_LOG(_FMT,...)       printf("[%05d] " _FMT, GImGui->FrameCount, __VA_ARGS__)
 | 
			
		||||
#endif
 | 
			
		||||
#define IMGUI_DEBUG_LOG_VIEWPORT(...)   ((void)0)       // Disable log
 | 
			
		||||
#define IMGUI_DEBUG_LOG_DOCKING(...)    ((void)0)       // Disable log
 | 
			
		||||
//#define IMGUI_DEBUG_LOG_VIEWPORT      IMGUI_DEBUG_LOG // Enable log
 | 
			
		||||
//#define IMGUI_DEBUG_LOG_DOCKING       IMGUI_DEBUG_LOG // Enable log
 | 
			
		||||
 | 
			
		||||
// Debug Logging for selected systems. Remove the '((void)0) //' to enable.
 | 
			
		||||
#define IMGUI_DEBUG_LOG_POPUP(...)      ((void)0) // IMGUI_DEBUG_LOG(__VA_ARGS__)
 | 
			
		||||
#define IMGUI_DEBUG_LOG_VIEWPORT(...)   ((void)0) // IMGUI_DEBUG_LOG(__VA_ARGS__)
 | 
			
		||||
#define IMGUI_DEBUG_LOG_DOCKING(...)    ((void)0) // IMGUI_DEBUG_LOG(__VA_ARGS__)
 | 
			
		||||
 | 
			
		||||
// Static Asserts
 | 
			
		||||
#if (__cplusplus >= 201100)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user