|
@@ -2085,6 +2085,7 @@ ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name)
|
|
|
LastFrameActive = -1;
|
|
|
ItemWidthDefault = 0.0f;
|
|
|
FontWindowScale = 1.0f;
|
|
|
+ SettingsIdx = -1;
|
|
|
|
|
|
DrawList = &DrawListInst;
|
|
|
DrawList->_OwnerName = Name;
|
|
@@ -3876,9 +3877,14 @@ static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, ImGuiSetting
|
|
|
ImGuiWindow* window = g.Windows[i];
|
|
|
if (window->Flags & ImGuiWindowFlags_NoSavedSettings)
|
|
|
continue;
|
|
|
- ImGuiWindowSettings* settings = ImGui::FindWindowSettings(window->ID);
|
|
|
+
|
|
|
+ ImGuiWindowSettings* settings = (window->SettingsIdx != -1) ? &g.SettingsWindows[window->SettingsIdx] : ImGui::FindWindowSettings(window->ID);
|
|
|
if (!settings)
|
|
|
+ {
|
|
|
settings = AddWindowSettings(window->Name);
|
|
|
+ window->SettingsIdx = g.SettingsWindows.index_from_pointer(settings);
|
|
|
+ }
|
|
|
+ IM_ASSERT(settings->ID == window->ID);
|
|
|
settings->Pos = window->Pos;
|
|
|
settings->Size = window->SizeFull;
|
|
|
settings->Collapsed = window->Collapsed;
|
|
@@ -3981,7 +3987,7 @@ ImGuiWindowSettings* ImGui::FindWindowSettings(ImGuiID id)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
for (int i = 0; i != g.SettingsWindows.Size; i++)
|
|
|
- if (g.SettingsWindows[i].Id == id)
|
|
|
+ if (g.SettingsWindows[i].ID == id)
|
|
|
return &g.SettingsWindows[i];
|
|
|
return NULL;
|
|
|
}
|
|
@@ -3992,7 +3998,7 @@ static ImGuiWindowSettings* AddWindowSettings(const char* name)
|
|
|
g.SettingsWindows.push_back(ImGuiWindowSettings());
|
|
|
ImGuiWindowSettings* settings = &g.SettingsWindows.back();
|
|
|
settings->Name = ImStrdup(name);
|
|
|
- settings->Id = ImHash(name, 0);
|
|
|
+ settings->ID = ImHash(name, 0);
|
|
|
return settings;
|
|
|
}
|
|
|
|
|
@@ -5695,6 +5701,7 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFl
|
|
|
// Retrieve settings from .ini file
|
|
|
if (ImGuiWindowSettings* settings = ImGui::FindWindowSettings(window->ID))
|
|
|
{
|
|
|
+ window->SettingsIdx = g.SettingsWindows.index_from_pointer(settings);
|
|
|
SetWindowConditionAllowFlags(window, ImGuiCond_FirstUseEver, false);
|
|
|
window->Pos = ImFloor(settings->Pos);
|
|
|
window->Collapsed = settings->Collapsed;
|