MCPcopy Create free account
hub / github.com/cinder/Cinder / TableSettingsHandler_WriteAll

Function TableSettingsHandler_WriteAll

src/imgui/imgui_tables.cpp:3885–3923  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3883}
3884
3885static void TableSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf)
3886{
3887 ImGuiContext& g = *ctx;
3888 for (ImGuiTableSettings* settings = g.SettingsTables.begin(); settings != NULL; settings = g.SettingsTables.next_chunk(settings))
3889 {
3890 if (settings->ID == 0) // Skip ditched settings
3891 continue;
3892
3893 // TableSaveSettings() may clear some of those flags when we establish that the data can be stripped
3894 // (e.g. Order was unchanged)
3895 const bool save_size = (settings->SaveFlags & ImGuiTableFlags_Resizable) != 0;
3896 const bool save_visible = (settings->SaveFlags & ImGuiTableFlags_Hideable) != 0;
3897 const bool save_order = (settings->SaveFlags & ImGuiTableFlags_Reorderable) != 0;
3898 const bool save_sort = (settings->SaveFlags & ImGuiTableFlags_Sortable) != 0;
3899 // We need to save the [Table] entry even if all the bools are false, since this records a table with "default settings".
3900
3901 buf->reserve(buf->size() + 30 + settings->ColumnsCount * 50); // ballpark reserve
3902 buf->appendf("[%s][0x%08X,%d]\n", handler->TypeName, settings->ID, settings->ColumnsCount);
3903 if (settings->RefScale != 0.0f)
3904 buf->appendf("RefScale=%g\n", settings->RefScale);
3905 ImGuiTableColumnSettings* column = settings->GetColumnSettings();
3906 for (int column_n = 0; column_n < settings->ColumnsCount; column_n++, column++)
3907 {
3908 // "Column 0 UserID=0x42AD2D21 Width=100 Visible=1 Order=0 Sort=0v"
3909 bool save_column = column->UserID != 0 || save_size || save_visible || save_order || (save_sort && column->SortOrder != -1);
3910 if (!save_column)
3911 continue;
3912 buf->appendf("Column %-2d", column_n);
3913 if (column->UserID != 0) { buf->appendf(" UserID=%08X", column->UserID); }
3914 if (save_size && column->IsStretch) { buf->appendf(" Weight=%.4f", column->WidthOrWeight); }
3915 if (save_size && !column->IsStretch) { buf->appendf(" Width=%d", (int)column->WidthOrWeight); }
3916 if (save_visible) { buf->appendf(" Visible=%d", column->IsEnabled); }
3917 if (save_order) { buf->appendf(" Order=%d", column->DisplayOrder); }
3918 if (save_sort && column->SortOrder != -1) { buf->appendf(" Sort=%d%c", column->SortOrder, (column->SortDirection == ImGuiSortDirection_Ascending) ? 'v' : '^'); }
3919 buf->append("\n");
3920 }
3921 buf->append("\n");
3922 }
3923}
3924
3925void ImGui::TableSettingsAddSettingsHandler()
3926{

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