| 3959 | } |
| 3960 | |
| 3961 | static void TableSettingsHandler_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, void* entry, const char* line) |
| 3962 | { |
| 3963 | // "Column 0 UserID=0x42AD2D21 Width=100 Visible=1 Order=0 Sort=0v" |
| 3964 | ImGuiTableSettings* settings = (ImGuiTableSettings*)entry; |
| 3965 | float f = 0.0f; |
| 3966 | int column_n = 0, r = 0, n = 0; |
| 3967 | |
| 3968 | if (sscanf(line, "RefScale=%f", &f) == 1) { settings->RefScale = f; return; } |
| 3969 | |
| 3970 | if (sscanf(line, "Column %d%n", &column_n, &r) == 1) |
| 3971 | { |
| 3972 | if (column_n < 0 || column_n >= settings->ColumnsCount) |
| 3973 | return; |
| 3974 | line = ImStrSkipBlank(line + r); |
| 3975 | char c = 0; |
| 3976 | ImGuiTableColumnSettings* column = settings->GetColumnSettings() + column_n; |
| 3977 | column->Index = (ImGuiTableColumnIdx)column_n; |
| 3978 | if (sscanf(line, "UserID=0x%08X%n", (ImU32*)&n, &r)==1) { line = ImStrSkipBlank(line + r); column->UserID = (ImGuiID)n; } |
| 3979 | if (sscanf(line, "Width=%d%n", &n, &r) == 1) { line = ImStrSkipBlank(line + r); column->WidthOrWeight = (float)n; column->IsStretch = 0; settings->SaveFlags |= ImGuiTableFlags_Resizable; } |
| 3980 | if (sscanf(line, "Weight=%f%n", &f, &r) == 1) { line = ImStrSkipBlank(line + r); column->WidthOrWeight = f; column->IsStretch = 1; settings->SaveFlags |= ImGuiTableFlags_Resizable; } |
| 3981 | if (sscanf(line, "Visible=%d%n", &n, &r) == 1) { line = ImStrSkipBlank(line + r); column->IsEnabled = (ImU8)n; settings->SaveFlags |= ImGuiTableFlags_Hideable; } |
| 3982 | if (sscanf(line, "Order=%d%n", &n, &r) == 1) { line = ImStrSkipBlank(line + r); column->DisplayOrder = (ImGuiTableColumnIdx)n; settings->SaveFlags |= ImGuiTableFlags_Reorderable; } |
| 3983 | if (sscanf(line, "Sort=%d%c%n", &n, &c, &r) == 2) { line = ImStrSkipBlank(line + r); column->SortOrder = (ImGuiTableColumnIdx)n; column->SortDirection = (c == '^') ? ImGuiSortDirection_Descending : ImGuiSortDirection_Ascending; settings->SaveFlags |= ImGuiTableFlags_Sortable; } |
| 3984 | } |
| 3985 | } |
| 3986 | |
| 3987 | static void TableSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf) |
| 3988 | { |
nothing calls this directly
no test coverage detected