MCPcopy Create free account
hub / github.com/RenderKit/embree / WindowSettingsHandler_WriteAll

Function WindowSettingsHandler_WriteAll

tutorials/common/imgui/imgui.cpp:12577–12612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12575}
12576
12577static void WindowSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf)
12578{
12579 // Gather data from windows that were active during this session
12580 // (if a window wasn't opened in this session we preserve its settings)
12581 ImGuiContext& g = *ctx;
12582 for (int i = 0; i != g.Windows.Size; i++)
12583 {
12584 ImGuiWindow* window = g.Windows[i];
12585 if (window->Flags & ImGuiWindowFlags_NoSavedSettings)
12586 continue;
12587
12588 ImGuiWindowSettings* settings = (window->SettingsOffset != -1) ? g.SettingsWindows.ptr_from_offset(window->SettingsOffset) : ImGui::FindWindowSettings(window->ID);
12589 if (!settings)
12590 {
12591 settings = ImGui::CreateNewWindowSettings(window->Name);
12592 window->SettingsOffset = g.SettingsWindows.offset_from_ptr(settings);
12593 }
12594 IM_ASSERT(settings->ID == window->ID);
12595 settings->Pos = ImVec2ih(window->Pos);
12596 settings->Size = ImVec2ih(window->SizeFull);
12597
12598 settings->Collapsed = window->Collapsed;
12599 }
12600
12601 // Write to text buffer
12602 buf->reserve(buf->size() + g.SettingsWindows.size() * 6); // ballpark reserve
12603 for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings))
12604 {
12605 const char* settings_name = settings->GetName();
12606 buf->appendf("[%s][%s]\n", handler->TypeName, settings_name);
12607 buf->appendf("Pos=%d,%d\n", settings->Pos.x, settings->Pos.y);
12608 buf->appendf("Size=%d,%d\n", settings->Size.x, settings->Size.y);
12609 buf->appendf("Collapsed=%d\n", settings->Collapsed);
12610 buf->append("\n");
12611 }
12612}
12613
12614
12615//-----------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected