| 13069 | } |
| 13070 | |
| 13071 | ImGuiWindowSettings* ImGui::CreateNewWindowSettings(const char* name) |
| 13072 | { |
| 13073 | ImGuiContext& g = *GImGui; |
| 13074 | |
| 13075 | if (g.IO.ConfigDebugIniSettings == false) |
| 13076 | { |
| 13077 | // Skip to the "###" marker if any. We don't skip past to match the behavior of GetID() |
| 13078 | // Preserve the full string when ConfigDebugVerboseIniSettings is set to make .ini inspection easier. |
| 13079 | if (const char* p = strstr(name, "###")) |
| 13080 | name = p; |
| 13081 | } |
| 13082 | const size_t name_len = strlen(name); |
| 13083 | |
| 13084 | // Allocate chunk |
| 13085 | const size_t chunk_size = sizeof(ImGuiWindowSettings) + name_len + 1; |
| 13086 | ImGuiWindowSettings* settings = g.SettingsWindows.alloc_chunk(chunk_size); |
| 13087 | IM_PLACEMENT_NEW(settings) ImGuiWindowSettings(); |
| 13088 | settings->ID = ImHashStr(name, name_len); |
| 13089 | memcpy(settings->GetName(), name, name_len + 1); // Store with zero terminator |
| 13090 | |
| 13091 | return settings; |
| 13092 | } |
| 13093 | |
| 13094 | // We don't provide a FindWindowSettingsByName() because Docking system doesn't always hold on names. |
| 13095 | // This is called once per window .ini entry + once per newly instantiated window. |
nothing calls this directly
no test coverage detected