From c21278eeae8586f6e2921da4fa1c70c233f4a52d Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 27 Sep 2023 19:49:12 +0200 Subject: [PATCH] Debug Tools: Rename ShowIdStackToolWindow() -> ShowIDStackToolWindow(). (#4631) Amend 8175a47 --- docs/CHANGELOG.txt | 2 +- docs/FAQ.md | 2 +- imconfig.h | 2 +- imgui.cpp | 22 +++++++++++----------- imgui.h | 4 ++-- imgui_demo.cpp | 2 +- imgui_internal.h | 8 ++++---- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 64a7003fc..28aad3d22 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -42,7 +42,7 @@ HOW TO UPDATE? Breaking changes: - - Debug Tools: Renamed ShowStackToolWindow() ("Stack Tool") to ShowIdStackToolWindow() ("ID Stack Tool"), + - Debug Tools: Renamed ShowStackToolWindow() ("Stack Tool") to ShowIDStackToolWindow() ("ID Stack Tool"), as earlier name was misleading. Kept inline redirection function. (#4631) - IO: Removed io.MetricsActiveAllocations introduced in 1.63, was displayed in Metrics and unlikely to be accessed by end-user. Value still visible in the UI and easily to recompute from a delta. diff --git a/docs/FAQ.md b/docs/FAQ.md index 04078db2f..8172f59cf 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -217,7 +217,7 @@ Interactive widgets (such as calls to Button buttons) need a unique ID. **Unique IDs are used internally to track active widgets and occasionally associate state to widgets.
Unique IDs are implicitly built from the hash of multiple elements that identify the "path" to the UI element.** -Since Dear ImGui 1.85, you can use `Demo>Tools>Stack Tool` or call `ImGui::ShowIdStackToolWindow()`. The tool display intermediate values leading to the creation of a unique ID, making things easier to debug and understand. +Since Dear ImGui 1.85, you can use `Demo>Tools>ID Stack Tool` or call `ImGui::ShowIDStackToolWindow()`. The tool display intermediate values leading to the creation of a unique ID, making things easier to debug and understand. ![Stack tool](https://user-images.githubusercontent.com/8225057/136235657-a0ea5665-dcd1-423f-9be6-dc3f8ced8f12.png) diff --git a/imconfig.h b/imconfig.h index 3c6e198ab..bac7661f0 100644 --- a/imconfig.h +++ b/imconfig.h @@ -34,7 +34,7 @@ // It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp. //#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty. //#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. -//#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowIdStackToolWindow() will be empty. +//#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowIDStackToolWindow() will be empty. //---- Don't implement some functions to reduce linkage requirements. //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a) diff --git a/imgui.cpp b/imgui.cpp index 7e13fef98..2e9dd97d6 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -425,7 +425,7 @@ CODE You can read releases logs https://github.com/ocornut/imgui/releases for more details. - 2023/09/27 (1.90.0) - io: removed io.MetricsActiveAllocations introduced in 1.63. Same as 'g.DebugMemAllocCount - g.DebugMemFreeCount' (still displayed in Metrics, unlikely to be accessed by end-user). - - 2023/09/26 (1.90.0) - debug tools: Renamed ShowStackToolWindow() ("Stack Tool") to ShowIdStackToolWindow() ("ID Stack Tool"), as earlier name was misleading. Kept inline redirection function. (#4631) + - 2023/09/26 (1.90.0) - debug tools: Renamed ShowStackToolWindow() ("Stack Tool") to ShowIDStackToolWindow() ("ID Stack Tool"), as earlier name was misleading. Kept inline redirection function. (#4631) - 2023/09/15 (1.90.0) - ListBox, Combo: changed signature of "name getter" callback in old one-liner ListBox()/Combo() apis. kept inline redirection function (will obsolete). - old: bool Combo(const char* label, int* current_item, bool (*getter)(void* user_data, int idx, const char** out_text), ...) - new: bool Combo(const char* label, int* current_item, const char* (*getter)(void* user_data, int idx), ...); @@ -13732,8 +13732,8 @@ void ImGui::ShowMetricsWindow(bool* p_open) ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig; if (cfg->ShowDebugLog) ShowDebugLogWindow(&cfg->ShowDebugLog); - if (cfg->ShowIdStackTool) - ShowIdStackToolWindow(&cfg->ShowIdStackTool); + if (cfg->ShowIDStackTool) + ShowIDStackToolWindow(&cfg->ShowIDStackTool); if (!Begin("Dear ImGui Metrics/Debugger", p_open) || GetCurrentWindow()->BeginCount > 1) { @@ -13823,9 +13823,9 @@ void ImGui::ShowMetricsWindow(bool* p_open) SameLine(); MetricsHelpMarker("You can also call ImGui::ShowDebugLogWindow() from your code."); - Checkbox("Show ID Stack Tool", &cfg->ShowIdStackTool); + Checkbox("Show ID Stack Tool", &cfg->ShowIDStackTool); SameLine(); - MetricsHelpMarker("You can also call ImGui::ShowIdStackToolWindow() from your code."); + MetricsHelpMarker("You can also call ImGui::ShowIDStackToolWindow() from your code."); Checkbox("Show windows begin order", &cfg->ShowWindowsBeginOrder); Checkbox("Show windows rectangles", &cfg->ShowWindowsRects); @@ -14867,7 +14867,7 @@ void ImGui::UpdateDebugToolItemPicker() void ImGui::UpdateDebugToolStackQueries() { ImGuiContext& g = *GImGui; - ImGuiIdStackTool* tool = &g.DebugIdStackTool; + ImGuiIDStackTool* tool = &g.DebugIDStackTool; // Clear hook when id stack tool is not visible g.DebugHookIdInfo = 0; @@ -14908,7 +14908,7 @@ void ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* dat { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; - ImGuiIdStackTool* tool = &g.DebugIdStackTool; + ImGuiIDStackTool* tool = &g.DebugIDStackTool; // Step 0: stack query // This assumes that the ID was computed with the current ID stack, which tends to be the case for our widget. @@ -14951,7 +14951,7 @@ void ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* dat info->DataType = data_type; } -static int StackToolFormatLevelInfo(ImGuiIdStackTool* tool, int n, bool format_for_ui, char* buf, size_t buf_size) +static int StackToolFormatLevelInfo(ImGuiIDStackTool* tool, int n, bool format_for_ui, char* buf, size_t buf_size) { ImGuiStackLevelInfo* info = &tool->Results[n]; ImGuiWindow* window = (info->Desc[0] == 0 && n == 0) ? ImGui::FindWindowByID(info->ID) : NULL; @@ -14969,7 +14969,7 @@ static int StackToolFormatLevelInfo(ImGuiIdStackTool* tool, int n, bool format_f } // ID Stack Tool: Display UI -void ImGui::ShowIdStackToolWindow(bool* p_open) +void ImGui::ShowIDStackToolWindow(bool* p_open) { ImGuiContext& g = *GImGui; if (!(g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize)) @@ -14981,7 +14981,7 @@ void ImGui::ShowIdStackToolWindow(bool* p_open) } // Display hovered/active status - ImGuiIdStackTool* tool = &g.DebugIdStackTool; + ImGuiIDStackTool* tool = &g.DebugIDStackTool; const ImGuiID hovered_id = g.HoveredIdPreviousFrame; const ImGuiID active_id = g.ActiveId; #ifdef IMGUI_ENABLE_TEST_ENGINE @@ -15063,7 +15063,7 @@ void ImGui::DebugNodeViewport(ImGuiViewportP*) {} void ImGui::DebugLog(const char*, ...) {} void ImGui::DebugLogV(const char*, va_list) {} void ImGui::ShowDebugLogWindow(bool*) {} -void ImGui::ShowIdStackToolWindow(bool*) {} +void ImGui::ShowIDStackToolWindow(bool*) {} void ImGui::DebugHookIdInfo(ImGuiID, ImGuiDataType, const void*, const void*) {} void ImGui::UpdateDebugToolItemPicker() {} void ImGui::UpdateDebugToolStackQueries() {} diff --git a/imgui.h b/imgui.h index 788231fff..02f2dfc57 100644 --- a/imgui.h +++ b/imgui.h @@ -307,7 +307,7 @@ namespace ImGui IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create Demo window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application! IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create Metrics/Debugger window. display Dear ImGui internals: windows, draw commands, various internal state, etc. IMGUI_API void ShowDebugLogWindow(bool* p_open = NULL); // create Debug Log window. display a simplified log of important dear imgui events. - IMGUI_API void ShowIdStackToolWindow(bool* p_open = NULL); // create Stack Tool window. hover items with mouse to query information about the source of their unique ID. + IMGUI_API void ShowIDStackToolWindow(bool* p_open = NULL); // create Stack Tool window. hover items with mouse to query information about the source of their unique ID. IMGUI_API void ShowAboutWindow(bool* p_open = NULL); // create About window. display Dear ImGui version, credits and build/system information. IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style) IMGUI_API bool ShowStyleSelector(const char* label); // add style selector block (not a window), essentially a combo listing the default styles. @@ -3099,7 +3099,7 @@ namespace ImGui namespace ImGui { // OBSOLETED in 1.90.0 (from September 2023) - static inline void ShowStackToolWindow(bool* p_open = NULL) { ShowIdStackToolWindow(p_open); } + static inline void ShowStackToolWindow(bool* p_open = NULL) { ShowIDStackToolWindow(p_open); } IMGUI_API bool ListBox(const char* label, int* current_item, bool (*old_callback)(void* user_data, int idx, const char** out_text), void* user_data, int items_count, int height_in_items = -1); IMGUI_API bool Combo(const char* label, int* current_item, bool (*old_callback)(void* user_data, int idx, const char** out_text), void* user_data, int items_count, int popup_max_height_in_items = -1); // OBSOLETED in 1.89.7 (from June 2023) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index bf0201108..84bdca2f3 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -299,7 +299,7 @@ void ImGui::ShowDemoWindow(bool* p_open) if (show_tool_debug_log) ImGui::ShowDebugLogWindow(&show_tool_debug_log); if (show_tool_id_stack_tool) - ImGui::ShowIdStackToolWindow(&show_tool_id_stack_tool); + ImGui::ShowIDStackToolWindow(&show_tool_id_stack_tool); if (show_tool_style_editor) { ImGui::Begin("Dear ImGui Style Editor", &show_tool_style_editor); diff --git a/imgui_internal.h b/imgui_internal.h index 148093f01..ed9365b99 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1803,7 +1803,7 @@ struct ImGuiDebugAllocInfo struct ImGuiMetricsConfig { bool ShowDebugLog = false; - bool ShowIdStackTool = false; + bool ShowIDStackTool = false; bool ShowWindowsRects = false; bool ShowWindowsBeginOrder = false; bool ShowTablesRects = false; @@ -1826,7 +1826,7 @@ struct ImGuiStackLevelInfo }; // State for ID Stack tool queries -struct ImGuiIdStackTool +struct ImGuiIDStackTool { int LastActiveFrame; int StackLevel; // -1: query stack and resize Results, >= 0: individual stack level @@ -1835,7 +1835,7 @@ struct ImGuiIdStackTool bool CopyToClipboardOnCtrlC; float CopyToClipboardLastTime; - ImGuiIdStackTool() { memset(this, 0, sizeof(*this)); CopyToClipboardLastTime = -FLT_MAX; } + ImGuiIDStackTool() { memset(this, 0, sizeof(*this)); CopyToClipboardLastTime = -FLT_MAX; } }; //----------------------------------------------------------------------------- @@ -2149,7 +2149,7 @@ struct ImGuiContext ImU8 DebugItemPickerMouseButton; ImGuiID DebugItemPickerBreakId; // Will call IM_DEBUG_BREAK() when encountering this ID ImGuiMetricsConfig DebugMetricsConfig; - ImGuiIdStackTool DebugIdStackTool; + ImGuiIDStackTool DebugIdStackTool; ImGuiDebugAllocInfo DebugAllocInfo; // Misc