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

Function TableSettingsHandler_WriteAll

3rdparty/imgui/src/imgui_tables.cpp:3987–4025  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3985}
3986
3987static void TableSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf)
3988{
3989 ImGuiContext& g = *ctx;
3990 for (ImGuiTableSettings* settings = g.SettingsTables.begin(); settings != NULL; settings = g.SettingsTables.next_chunk(settings))
3991 {
3992 if (settings->ID == 0) // Skip ditched settings
3993 continue;
3994
3995 // TableSaveSettings() may clear some of those flags when we establish that the data can be stripped
3996 // (e.g. Order was unchanged)
3997 const bool save_size = (settings->SaveFlags & ImGuiTableFlags_Resizable) != 0;
3998 const bool save_visible = (settings->SaveFlags & ImGuiTableFlags_Hideable) != 0;
3999 const bool save_order = (settings->SaveFlags & ImGuiTableFlags_Reorderable) != 0;
4000 const bool save_sort = (settings->SaveFlags & ImGuiTableFlags_Sortable) != 0;
4001 // We need to save the [Table] entry even if all the bools are false, since this records a table with "default settings".
4002
4003 buf->reserve(buf->size() + 30 + settings->ColumnsCount * 50); // ballpark reserve
4004 buf->appendf("[%s][0x%08X,%d]\n", handler->TypeName, settings->ID, settings->ColumnsCount);
4005 if (settings->RefScale != 0.0f)
4006 buf->appendf("RefScale=%g\n", settings->RefScale);
4007 ImGuiTableColumnSettings* column = settings->GetColumnSettings();
4008 for (int column_n = 0; column_n < settings->ColumnsCount; column_n++, column++)
4009 {
4010 // "Column 0 UserID=0x42AD2D21 Width=100 Visible=1 Order=0 Sort=0v"
4011 bool save_column = column->UserID != 0 || save_size || save_visible || save_order || (save_sort && column->SortOrder != -1);
4012 if (!save_column)
4013 continue;
4014 buf->appendf("Column %-2d", column_n);
4015 if (column->UserID != 0) { buf->appendf(" UserID=%08X", column->UserID); }
4016 if (save_size && column->IsStretch) { buf->appendf(" Weight=%.4f", column->WidthOrWeight); }
4017 if (save_size && !column->IsStretch) { buf->appendf(" Width=%d", (int)column->WidthOrWeight); }
4018 if (save_visible) { buf->appendf(" Visible=%d", column->IsEnabled); }
4019 if (save_order) { buf->appendf(" Order=%d", column->DisplayOrder); }
4020 if (save_sort && column->SortOrder != -1) { buf->appendf(" Sort=%d%c", column->SortOrder, (column->SortDirection == ImGuiSortDirection_Ascending) ? 'v' : '^'); }
4021 buf->append("\n");
4022 }
4023 buf->append("\n");
4024 }
4025}
4026
4027void ImGui::TableSettingsAddSettingsHandler()
4028{

Callers

nothing calls this directly

Calls 7

next_chunkMethod · 0.80
appendfMethod · 0.80
GetColumnSettingsMethod · 0.80
beginMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected