Debug Tools: Added 'io.ConfigDebugIniSettings' option to save .ini data with extra comments.

Moved from compile-time to runtime flag. Note: commit in master is not particularly useful. Docking version will add stuff.
This commit is contained in:
ocornut
2023-06-13 11:47:22 +02:00
parent 3cc9d2051a
commit 9c16976749
4 changed files with 15 additions and 8 deletions

View File

@ -983,7 +983,6 @@ CODE
// Debug options
#define IMGUI_DEBUG_NAV_SCORING 0 // Display navigation scoring preview when hovering items. Display last moving direction matches when holding CTRL
#define IMGUI_DEBUG_NAV_RECTS 0 // Display the reference navigation rectangle for each window
#define IMGUI_DEBUG_INI_SETTINGS 0 // Save additional comments in .ini file (particularly helps for Docking, but makes saving slower)
// When using CTRL+TAB (or Gamepad Square+L/R) we delay the visual a little in order to reduce visual noise doing a fast switch.
static const float NAV_WINDOWING_HIGHLIGHT_DELAY = 0.20f; // Time before the highlight and screen dimming starts fading in
@ -12947,12 +12946,13 @@ ImGuiWindowSettings* ImGui::CreateNewWindowSettings(const char* name)
{
ImGuiContext& g = *GImGui;
#if !IMGUI_DEBUG_INI_SETTINGS
// Skip to the "###" marker if any. We don't skip past to match the behavior of GetID()
// Preserve the full string when IMGUI_DEBUG_INI_SETTINGS is set to make .ini inspection easier.
if (const char* p = strstr(name, "###"))
name = p;
#endif
if (g.IO.ConfigDebugIniSettings == false)
{
// Skip to the "###" marker if any. We don't skip past to match the behavior of GetID()
// Preserve the full string when ConfigDebugVerboseIniSettings is set to make .ini inspection easier.
if (const char* p = strstr(name, "###"))
name = p;
}
const size_t name_len = strlen(name);
// Allocate chunk
@ -13813,11 +13813,12 @@ void ImGui::ShowMetricsWindow(bool* p_open)
Text("\"%s\"", g.IO.IniFilename);
else
TextUnformatted("<NULL>");
Checkbox("io.ConfigDebugIniSettings", &io.ConfigDebugIniSettings);
Text("SettingsDirtyTimer %.2f", g.SettingsDirtyTimer);
if (TreeNode("SettingsHandlers", "Settings handlers: (%d)", g.SettingsHandlers.Size))
{
for (int n = 0; n < g.SettingsHandlers.Size; n++)
BulletText("%s", g.SettingsHandlers[n].TypeName);
BulletText("\"%s\"", g.SettingsHandlers[n].TypeName);
TreePop();
}
if (TreeNode("SettingsWindows", "Settings packed data: Windows: %d bytes", g.SettingsWindows.size()))