MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / WindowSettingsHandler_WriteAll

Function WindowSettingsHandler_WriteAll

KBotExt/imgui/imgui.cpp:13172–13209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13170}
13171
13172static void WindowSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf)
13173{
13174 // Gather data from windows that were active during this session
13175 // (if a window wasn't opened in this session we preserve its settings)
13176 ImGuiContext& g = *ctx;
13177 for (ImGuiWindow* window : g.Windows)
13178 {
13179 if (window->Flags & ImGuiWindowFlags_NoSavedSettings)
13180 continue;
13181
13182 ImGuiWindowSettings* settings = ImGui::FindWindowSettingsByWindow(window);
13183 if (!settings)
13184 {
13185 settings = ImGui::CreateNewWindowSettings(window->Name);
13186 window->SettingsOffset = g.SettingsWindows.offset_from_ptr(settings);
13187 }
13188 IM_ASSERT(settings->ID == window->ID);
13189 settings->Pos = ImVec2ih(window->Pos);
13190 settings->Size = ImVec2ih(window->SizeFull);
13191
13192 settings->Collapsed = window->Collapsed;
13193 settings->WantDelete = false;
13194 }
13195
13196 // Write to text buffer
13197 buf->reserve(buf->size() + g.SettingsWindows.size() * 6); // ballpark reserve
13198 for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings))
13199 {
13200 if (settings->WantDelete)
13201 continue;
13202 const char* settings_name = settings->GetName();
13203 buf->appendf("[%s][%s]\n", handler->TypeName, settings_name);
13204 buf->appendf("Pos=%d,%d\n", settings->Pos.x, settings->Pos.y);
13205 buf->appendf("Size=%d,%d\n", settings->Size.x, settings->Size.y);
13206 buf->appendf("Collapsed=%d\n", settings->Collapsed);
13207 buf->append("\n");
13208 }
13209}
13210
13211//-----------------------------------------------------------------------------
13212// [SECTION] LOCALIZATION

Callers

nothing calls this directly

Calls 9

ImVec2ihClass · 0.85
offset_from_ptrMethod · 0.80
reserveMethod · 0.80
next_chunkMethod · 0.80
GetNameMethod · 0.80
appendfMethod · 0.80
appendMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected