Metrics: Added a "Settings" section with some details about persistent ini settings. InputText: Assert early on null buffer.

This commit is contained in:
omar 2020-05-07 18:00:11 +02:00
parent 510f301c9f
commit 9ee442d3f0
3 changed files with 41 additions and 1 deletions

View File

@ -50,12 +50,13 @@ Other Changes:
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]

View File

@ -10282,6 +10282,12 @@ void ImGui::ShowMetricsWindow(bool* p_open)
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 @@ void ImGui::ShowMetricsWindow(bool* p_open)
}
#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"))
{

View File

@ -3523,6 +3523,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
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)