| 2964 | { |
| 2965 | ImGui::DockBuilderRemoveNode(Tool->PrevDockspaceID); |
| 2966 | |
| 2967 | // Relies on window name to ditch the old windows' ini settings forever. |
| 2968 | char windowSuffix[16]; |
| 2969 | ImFormatString(windowSuffix, IM_ARRAYSIZE(windowSuffix), "##%08X", Tool->PrevDockspaceID); |
| 2970 | size_t windowSuffixLength = strlen(windowSuffix); |
| 2971 | ImGuiContext& g = *GImGui; |
| 2972 | for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != nullptr; settings = g.SettingsWindows.next_chunk(settings)) |
| 2973 | { |
| 2974 | if ( settings->ID == 0 ) |
| 2975 | { |
| 2976 | continue; |
| 2977 | } |
| 2978 | |
| 2979 | |
| 2980 | char const* pWindowName = settings->GetName(); |
| 2981 | size_t windowNameLength = strlen(pWindowName); |
| 2982 | if (windowNameLength >= windowSuffixLength) |
| 2983 | { |
| 2984 | if (strcmp(pWindowName + windowNameLength - windowSuffixLength, windowSuffix) == 0) // Compare suffix |
| 2985 | { |
| 2986 | ImGui::ClearWindowSettings(pWindowName); |
| 2987 | } |
| 2988 | } |
| 2989 | } |
| 2990 | } |
| 2991 | } |
| 2992 | else if (ImGui::DockBuilderGetNode(Tool->GetCurrentDockspaceID()) == nullptr) |
| 2993 | { |
| 2994 | ImVec2 dockspaceSize = ImGui::GetContentRegionAvail(); |
| 2995 | dockspaceSize.x = Math::Max(dockspaceSize.x, 1.0f); |
| 2996 | dockspaceSize.y = Math::Max(dockspaceSize.y, 1.0f); |
| 2997 | |
| 2998 | ImGui::DockBuilderAddNode(Tool->GetCurrentDockspaceID(), ImGuiDockNodeFlags_DockSpace); |
| 2999 | ImGui::DockBuilderSetNodeSize(Tool->GetCurrentDockspaceID(), dockspaceSize); |
| 3000 | if (!Tool->IsSingleWindowTool()) |
| 3001 | { |
| 3002 | Tool->InitializeDockingLayout(Tool->GetCurrentDockspaceID(), dockspaceSize); |
nothing calls this directly
no test coverage detected