| 3391 | } |
| 3392 | |
| 3393 | static void TableSettingsHandler_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, void* entry, const char* line) |
| 3394 | { |
| 3395 | // "Column 0 UserID=0x42AD2D21 Width=100 Visible=1 Order=0 Sort=0v" |
| 3396 | ImGuiTableSettings* settings = (ImGuiTableSettings*)entry; |
| 3397 | float f = 0.0f; |
| 3398 | int column_n = 0, r = 0, n = 0; |
| 3399 | |
| 3400 | if (sscanf(line, "RefScale=%f", &f) == 1) { settings->RefScale = f; return; } |
| 3401 | |
| 3402 | if (sscanf(line, "Column %d%n", &column_n, &r) == 1) |
| 3403 | { |
| 3404 | if (column_n < 0 || column_n >= settings->ColumnsCount) |
| 3405 | return; |
| 3406 | line = ImStrSkipBlank(line + r); |
| 3407 | char c = 0; |
| 3408 | ImGuiTableColumnSettings* column = settings->GetColumnSettings() + column_n; |
| 3409 | column->Index = (ImGuiTableColumnIdx)column_n; |
| 3410 | if (sscanf(line, "UserID=0x%08X%n", (ImU32*)&n, &r)==1) { line = ImStrSkipBlank(line + r); column->UserID = (ImGuiID)n; } |
| 3411 | if (sscanf(line, "Width=%d%n", &n, &r) == 1) { line = ImStrSkipBlank(line + r); column->WidthOrWeight = (float)n; column->IsStretch = 0; settings->SaveFlags |= ImGuiTableFlags_Resizable; } |
| 3412 | if (sscanf(line, "Weight=%f%n", &f, &r) == 1) { line = ImStrSkipBlank(line + r); column->WidthOrWeight = f; column->IsStretch = 1; settings->SaveFlags |= ImGuiTableFlags_Resizable; } |
| 3413 | if (sscanf(line, "Visible=%d%n", &n, &r) == 1) { line = ImStrSkipBlank(line + r); column->IsEnabled = (ImU8)n; settings->SaveFlags |= ImGuiTableFlags_Hideable; } |
| 3414 | if (sscanf(line, "Order=%d%n", &n, &r) == 1) { line = ImStrSkipBlank(line + r); column->DisplayOrder = (ImGuiTableColumnIdx)n; settings->SaveFlags |= ImGuiTableFlags_Reorderable; } |
| 3415 | 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; } |
| 3416 | } |
| 3417 | } |
| 3418 | |
| 3419 | static void TableSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf) |
| 3420 | { |
nothing calls this directly
no test coverage detected