From 32cea853317c6ee1dbfb4f08925b410956366ed7 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 13 Jan 2025 15:51:39 +0100 Subject: [PATCH] Debug Tools: Item Picker: Always available in menu. Tweak Demo Debug Options. (#2673, #1651) --- docs/CHANGELOG.txt | 3 +++ imgui_demo.cpp | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 5753d10db..8d3ced68e 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -56,6 +56,7 @@ Other changes: a child window, and from nested child windows. (#1651) - Error Handling: Turned common EndTable() and other TableXXX functions fail cases into a recoverable error. (#1651, #8314) +- Error Handling: Exposed some options in Demo->Tools->Debug Options. (#1651) - InputText: Fixed a bug where character replacements performed from a callback were not applied when pasting from clipbard. (#8229) - InputText: Fixed issue when activating a ReadOnly field when the underlying @@ -76,6 +77,8 @@ Other changes: windows with the ImGuiWindowFlags_NoNavInputs flag. (#8231) - Debug Tools: Debug Log: hovering 0xXXXXXXXX values in log is allowed even if a popup is blocking mouse access to the debug log window. (#5855) +- Debug Tools: Item Picker: Always available regardless of value of + io.ConfigDebugIsDebuggerPresent. (#2673) - Fonts: Fixed miscalculation of Ellipsis ("...") character width when automatically created from a single comma character, affecting some fonts/settings (not all). - Demo: Added label edition to Property Editor demo + fix an ID issue. (#8266) [@moritz-h] diff --git a/imgui_demo.cpp b/imgui_demo.cpp index c9a21759d..7bb15d737 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -743,19 +743,27 @@ static void ShowDemoWindowMenuBar(ImGuiDemoWindowData* demo_data) #else const bool has_debug_tools = false; #endif + if (ImGui::BeginMenu("Debug Options")) + { + ImGui::BeginDisabled(!has_debug_tools); + ImGui::Checkbox("Highlight ID Conflicts", &io.ConfigDebugHighlightIdConflicts); + ImGui::EndDisabled(); + ImGui::Checkbox("Assert on error recovery", &io.ConfigErrorRecoveryEnableAssert); + ImGui::TextDisabled("(see Demo->Configuration for details & more)"); + ImGui::EndMenu(); + } + ImGui::MenuItem("Metrics/Debugger", NULL, &demo_data->ShowMetrics, has_debug_tools); ImGui::MenuItem("Debug Log", NULL, &demo_data->ShowDebugLog, has_debug_tools); ImGui::MenuItem("ID Stack Tool", NULL, &demo_data->ShowIDStackTool, has_debug_tools); bool is_debugger_present = io.ConfigDebugIsDebuggerPresent; - if (ImGui::MenuItem("Item Picker", NULL, false, has_debug_tools && is_debugger_present)) + if (ImGui::MenuItem("Item Picker", NULL, false, has_debug_tools))// && is_debugger_present)) ImGui::DebugStartItemPicker(); if (!is_debugger_present) - ImGui::SetItemTooltip("Requires io.ConfigDebugIsDebuggerPresent=true to be set.\n\nWe otherwise disable the menu option to avoid casual users crashing the application.\n\nYou can however always access the Item Picker in Metrics->Tools."); + ImGui::SetItemTooltip("Requires io.ConfigDebugIsDebuggerPresent=true to be set.\n\nWe otherwise disable some extra features to avoid casual users crashing the application."); ImGui::MenuItem("Style Editor", NULL, &demo_data->ShowStyleEditor); ImGui::MenuItem("About Dear ImGui", NULL, &demo_data->ShowAbout); - ImGui::SeparatorText("Debug Options"); - ImGui::MenuItem("Highlight ID Conflicts", NULL, &io.ConfigDebugHighlightIdConflicts, has_debug_tools); ImGui::EndMenu(); } ImGui::EndMenuBar();