Metrics: Added a "Settings" section with some details about persistent ini settings. InputText: Assert early on null buffer.
diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt
index 96cadc9..116ee15 100644
--- a/docs/CHANGELOG.txt
+++ b/docs/CHANGELOG.txt
@@ -50,12 +50,13 @@
Set to 0.0f (default) to always make a close button appear on hover (same as Chrome, VS).
Set to FLT_MAX to only display a close button when selected (merely hovering is not enough).
Set to an intermediary value to toggle behavior based on width (same as Firefox).
+- Metrics: Added a "Settings" section with some details about persistent ini settings.
- Backends: Win32: Support for #define NOGDI, won't try to call GetDeviceCaps(). (#3137, #2327)
- Backends: Win32: Fix _WIN32_WINNT < 0x0600 (MinGW defaults to 0x502 == Windows 2003). (#3183)
- Backends: OpenGL: Fixed handling of GL 4.5+ glClipControl(GL_UPPER_LEFT) by inverting the
projection matrix top and bottom values. (#3143, #3146) [@u3shit]
- Backends: Vulkan: Fixed error in if initial frame has no vertices. (#3177)
-- Backends: Vulkan: Fixed edge case where render callbacks wouldn't be called if the ImDrawData
+- Backends: Vulkan: Fixed edge case where render callbacks wouldn't be called if the ImDrawData
structure didn't have any vertices. (#2697) [@kudaba]
- Drag and Drop: Fixed unintended fallback "..." tooltip display during drag operation when
drag source uses _SourceNoPreviewTooltip flags. (#3160) [@rokups]
diff --git a/imgui.cpp b/imgui.cpp
index f7f0e1b..38185fa 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -10282,6 +10282,12 @@
ImGui::TreePop();
}
+ static void NodeWindowSettings(ImGuiWindowSettings* settings)
+ {
+ ImGui::Text("0x%08X \"%s\" Pos (%d,%d) Size (%d,%d) Collapsed=%d",
+ settings->ID, settings->GetName(), settings->Pos.x, settings->Pos.y, settings->Size.x, settings->Size.y, settings->Collapsed);
+ }
+
static void NodeTabBar(ImGuiTabBar* tab_bar)
{
// Standalone tab bars (not associated to docking/windows functionality) currently hold no discernible strings.
@@ -10398,6 +10404,38 @@
}
#endif // #define IMGUI_HAS_DOCK
+ // Settings
+ if (ImGui::TreeNode("Settings"))
+ {
+ if (ImGui::SmallButton("Save to disk"))
+ ImGui::SaveIniSettingsToDisk(g.IO.IniFilename);
+ ImGui::SameLine();
+ if (g.IO.IniFilename)
+ ImGui::Text("\"%s\"", g.IO.IniFilename);
+ else
+ ImGui::TextUnformatted("<NULL>");
+ ImGui::Text("SettingsDirtyTimer %.2f", g.SettingsDirtyTimer);
+ if (ImGui::TreeNode("SettingsHandlers", "Settings handlers: (%d)", g.SettingsHandlers.Size))
+ {
+ for (int n = 0; n < g.SettingsHandlers.Size; n++)
+ ImGui::TextUnformatted(g.SettingsHandlers[n].TypeName);
+ ImGui::TreePop();
+ }
+ if (ImGui::TreeNode("SettingsWindows", "Settings packed data: Windows: %d bytes", g.SettingsWindows.size()))
+ {
+ for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings))
+ Funcs::NodeWindowSettings(settings);
+ ImGui::TreePop();
+ }
+ if (ImGui::TreeNode("SettingsIniData", "Settings unpacked data (.ini): %d bytes", g.SettingsIniData.size()))
+ {
+ char* buf = (char*)(void*)(g.SettingsIniData.Buf.Data ? g.SettingsIniData.Buf.Data : "");
+ ImGui::InputTextMultiline("##Ini", buf, g.SettingsIniData.Buf.Size, ImVec2(-FLT_MIN, 0.0f), ImGuiInputTextFlags_ReadOnly);
+ ImGui::TreePop();
+ }
+ ImGui::TreePop();
+ }
+
// Misc Details
if (ImGui::TreeNode("Internal state"))
{
diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp
index d150947..71153c2 100644
--- a/imgui_widgets.cpp
+++ b/imgui_widgets.cpp
@@ -3523,6 +3523,7 @@
if (window->SkipItems)
return false;
+ IM_ASSERT(buf != NULL && buf_size >= 0);
IM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackHistory) && (flags & ImGuiInputTextFlags_Multiline))); // Can't use both together (they both use up/down keys)
IM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackCompletion) && (flags & ImGuiInputTextFlags_AllowTabInput))); // Can't use both together (they both use tab key)