MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / WindowSettingsHandler_WriteAll

Function WindowSettingsHandler_WriteAll

3rdparty/imgui/src/imgui.cpp:15783–15829  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15781}
15782
15783static void WindowSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf)
15784{
15785 // Gather data from windows that were active during this session
15786 // (if a window wasn't opened in this session we preserve its settings)
15787 ImGuiContext& g = *ctx;
15788 for (ImGuiWindow* window : g.Windows)
15789 {
15790 if (window->Flags & ImGuiWindowFlags_NoSavedSettings)
15791 continue;
15792
15793 ImGuiWindowSettings* settings = ImGui::FindWindowSettingsByWindow(window);
15794 if (!settings)
15795 {
15796 settings = ImGui::CreateNewWindowSettings(window->Name);
15797 window->SettingsOffset = g.SettingsWindows.offset_from_ptr(settings);
15798 }
15799 IM_ASSERT(settings->ID == window->ID);
15800 settings->Pos = ImVec2ih(window->Pos);
15801 settings->Size = ImVec2ih(window->SizeFull);
15802 settings->IsChild = (window->Flags & ImGuiWindowFlags_ChildWindow) != 0;
15803 settings->Collapsed = window->Collapsed;
15804 settings->WantDelete = false;
15805 }
15806
15807 // Write to text buffer
15808 buf->reserve(buf->size() + g.SettingsWindows.size() * 6); // ballpark reserve
15809 for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings))
15810 {
15811 if (settings->WantDelete)
15812 continue;
15813 const char* settings_name = settings->GetName();
15814 buf->appendf("[%s][%s]\n", handler->TypeName, settings_name);
15815 if (settings->IsChild)
15816 {
15817 buf->appendf("IsChild=1\n");
15818 buf->appendf("Size=%d,%d\n", settings->Size.x, settings->Size.y);
15819 }
15820 else
15821 {
15822 buf->appendf("Pos=%d,%d\n", settings->Pos.x, settings->Pos.y);
15823 buf->appendf("Size=%d,%d\n", settings->Size.x, settings->Size.y);
15824 if (settings->Collapsed)
15825 buf->appendf("Collapsed=1\n");
15826 }
15827 buf->append("\n");
15828 }
15829}
15830
15831//-----------------------------------------------------------------------------
15832// [SECTION] LOCALIZATION

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected