mirror of
https://github.com/ocornut/imgui.git
synced 2025-01-31 03:53:44 +01:00
Debug Tools: Added 'io.ConfigDebugIniSettings' option to save .ini data with extra comments.
Moved from compile-time to runtime flag. Applied docking specific change to this cherry-picked commit. # Conflicts: # docs/CHANGELOG.txt
This commit is contained in:
parent
fa5d2656b0
commit
ef07ddf087
@ -105,6 +105,8 @@ Other changes:
|
|||||||
|
|
||||||
- Tables: Fixed a regression in 1.89.6 leading to the first column of tables with either
|
- Tables: Fixed a regression in 1.89.6 leading to the first column of tables with either
|
||||||
ScrollX or ScrollY flags from being impossible to resize. (#6503)
|
ScrollX or ScrollY flags from being impossible to resize. (#6503)
|
||||||
|
- Debug Tools: Added 'io.ConfigDebugIniSettings' option to save .ini data with extra
|
||||||
|
comments. Currently mainly for inspecting Docking .ini data, but makes saving slower.
|
||||||
|
|
||||||
Docking+Viewports Branch:
|
Docking+Viewports Branch:
|
||||||
|
|
||||||
|
53
imgui.cpp
53
imgui.cpp
@ -991,7 +991,6 @@ CODE
|
|||||||
// Debug options
|
// 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_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_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.
|
// 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
|
static const float NAV_WINDOWING_HIGHLIGHT_DELAY = 0.20f; // Time before the highlight and screen dimming starts fading in
|
||||||
@ -13623,12 +13622,13 @@ ImGuiWindowSettings* ImGui::CreateNewWindowSettings(const char* name)
|
|||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
|
||||||
#if !IMGUI_DEBUG_INI_SETTINGS
|
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 IMGUI_DEBUG_INI_SETTINGS is set to make .ini inspection easier.
|
// Skip to the "###" marker if any. We don't skip past to match the behavior of GetID()
|
||||||
if (const char* p = strstr(name, "###"))
|
// Preserve the full string when ConfigDebugVerboseIniSettings is set to make .ini inspection easier.
|
||||||
name = p;
|
if (const char* p = strstr(name, "###"))
|
||||||
#endif
|
name = p;
|
||||||
|
}
|
||||||
const size_t name_len = strlen(name);
|
const size_t name_len = strlen(name);
|
||||||
|
|
||||||
// Allocate chunk
|
// Allocate chunk
|
||||||
@ -18673,24 +18673,24 @@ static void ImGui::DockSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettings
|
|||||||
if (node_settings->SelectedTabId)
|
if (node_settings->SelectedTabId)
|
||||||
buf->appendf(" Selected=0x%08X", node_settings->SelectedTabId);
|
buf->appendf(" Selected=0x%08X", node_settings->SelectedTabId);
|
||||||
|
|
||||||
#if IMGUI_DEBUG_INI_SETTINGS
|
// [DEBUG] Include comments in the .ini file to ease debugging (this makes saving slower!)
|
||||||
// [DEBUG] Include comments in the .ini file to ease debugging
|
if (g.IO.ConfigDebugIniSettings)
|
||||||
if (ImGuiDockNode* node = DockContextFindNodeByID(ctx, node_settings->ID))
|
if (ImGuiDockNode* node = DockContextFindNodeByID(ctx, node_settings->ID))
|
||||||
{
|
{
|
||||||
buf->appendf("%*s", ImMax(2, (line_start_pos + 92) - buf->size()), ""); // Align everything
|
buf->appendf("%*s", ImMax(2, (line_start_pos + 92) - buf->size()), ""); // Align everything
|
||||||
if (node->IsDockSpace() && node->HostWindow && node->HostWindow->ParentWindow)
|
if (node->IsDockSpace() && node->HostWindow && node->HostWindow->ParentWindow)
|
||||||
buf->appendf(" ; in '%s'", node->HostWindow->ParentWindow->Name);
|
buf->appendf(" ; in '%s'", node->HostWindow->ParentWindow->Name);
|
||||||
// Iterate settings so we can give info about windows that didn't exist during the session.
|
// Iterate settings so we can give info about windows that didn't exist during the session.
|
||||||
int contains_window = 0;
|
int contains_window = 0;
|
||||||
for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings))
|
for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings))
|
||||||
if (settings->DockId == node_settings->ID)
|
if (settings->DockId == node_settings->ID)
|
||||||
{
|
{
|
||||||
if (contains_window++ == 0)
|
if (contains_window++ == 0)
|
||||||
buf->appendf(" ; contains ");
|
buf->appendf(" ; contains ");
|
||||||
buf->appendf("'%s' ", settings->GetName());
|
buf->appendf("'%s' ", settings->GetName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
buf->appendf("\n");
|
buf->appendf("\n");
|
||||||
}
|
}
|
||||||
buf->appendf("\n");
|
buf->appendf("\n");
|
||||||
@ -19421,11 +19421,12 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
Text("\"%s\"", g.IO.IniFilename);
|
Text("\"%s\"", g.IO.IniFilename);
|
||||||
else
|
else
|
||||||
TextUnformatted("<NULL>");
|
TextUnformatted("<NULL>");
|
||||||
|
Checkbox("io.ConfigDebugIniSettings", &io.ConfigDebugIniSettings);
|
||||||
Text("SettingsDirtyTimer %.2f", g.SettingsDirtyTimer);
|
Text("SettingsDirtyTimer %.2f", g.SettingsDirtyTimer);
|
||||||
if (TreeNode("SettingsHandlers", "Settings handlers: (%d)", g.SettingsHandlers.Size))
|
if (TreeNode("SettingsHandlers", "Settings handlers: (%d)", g.SettingsHandlers.Size))
|
||||||
{
|
{
|
||||||
for (int n = 0; n < g.SettingsHandlers.Size; n++)
|
for (int n = 0; n < g.SettingsHandlers.Size; n++)
|
||||||
BulletText("%s", g.SettingsHandlers[n].TypeName);
|
BulletText("\"%s\"", g.SettingsHandlers[n].TypeName);
|
||||||
TreePop();
|
TreePop();
|
||||||
}
|
}
|
||||||
if (TreeNode("SettingsWindows", "Settings packed data: Windows: %d bytes", g.SettingsWindows.size()))
|
if (TreeNode("SettingsWindows", "Settings packed data: Windows: %d bytes", g.SettingsWindows.size()))
|
||||||
|
2
imgui.h
2
imgui.h
@ -2048,6 +2048,8 @@ struct ImGuiIO
|
|||||||
// - backends may have other side-effects on focus loss, so this will reduce side-effects but not necessary remove all of them.
|
// - backends may have other side-effects on focus loss, so this will reduce side-effects but not necessary remove all of them.
|
||||||
// - consider using e.g. Win32's IsDebuggerPresent() as an additional filter (or see ImOsIsDebuggerPresent() in imgui_test_engine/imgui_te_utils.cpp for a Unix compatible version).
|
// - consider using e.g. Win32's IsDebuggerPresent() as an additional filter (or see ImOsIsDebuggerPresent() in imgui_test_engine/imgui_te_utils.cpp for a Unix compatible version).
|
||||||
bool ConfigDebugIgnoreFocusLoss; // = false // Ignore io.AddFocusEvent(false), consequently not calling io.ClearInputKeys() in input processing.
|
bool ConfigDebugIgnoreFocusLoss; // = false // Ignore io.AddFocusEvent(false), consequently not calling io.ClearInputKeys() in input processing.
|
||||||
|
// - tools to audit ini data
|
||||||
|
bool ConfigDebugIniSettings; // = false // Save .ini data with extra comments (particularly helpful for Docking, but makes saving slower)
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Platform Functions
|
// Platform Functions
|
||||||
|
@ -525,6 +525,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::SameLine(); HelpMarker("Some calls to Begin()/BeginChild() will return false.\n\nWill cycle through window depths then repeat. Windows should be flickering while running.");
|
ImGui::SameLine(); HelpMarker("Some calls to Begin()/BeginChild() will return false.\n\nWill cycle through window depths then repeat. Windows should be flickering while running.");
|
||||||
ImGui::Checkbox("io.ConfigDebugIgnoreFocusLoss", &io.ConfigDebugIgnoreFocusLoss);
|
ImGui::Checkbox("io.ConfigDebugIgnoreFocusLoss", &io.ConfigDebugIgnoreFocusLoss);
|
||||||
ImGui::SameLine(); HelpMarker("Option to deactivate io.AddFocusEvent(false) handling. May facilitate interactions with a debugger when focus loss leads to clearing inputs data.");
|
ImGui::SameLine(); HelpMarker("Option to deactivate io.AddFocusEvent(false) handling. May facilitate interactions with a debugger when focus loss leads to clearing inputs data.");
|
||||||
|
ImGui::Checkbox("io.ConfigDebugIniSettings", &io.ConfigDebugIniSettings);
|
||||||
|
ImGui::SameLine(); HelpMarker("Option to save .ini data with extra comments (particularly helpful for Docking, but makes saving slower).");
|
||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user