MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / DockSettingsHandler_ReadLine

Method DockSettingsHandler_ReadLine

imgui_tiny_app/imgui/imgui.cpp:21483–21522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21481}
21482
21483static void ImGui::DockSettingsHandler_ReadLine(ImGuiContext* ctx, ImGuiSettingsHandler*, void*, const char* line)
21484{
21485 char c = 0;
21486 int x = 0, y = 0;
21487 int r = 0;
21488
21489 // Parsing, e.g.
21490 // " DockNode ID=0x00000001 Pos=383,193 Size=201,322 Split=Y,0.506 "
21491 // " DockNode ID=0x00000002 Parent=0x00000001 "
21492 // Important: this code expect currently fields in a fixed order.
21493 ImGuiDockNodeSettings node;
21494 line = ImStrSkipBlank(line);
21495 if (strncmp(line, "DockNode", 8) == 0) { line = ImStrSkipBlank(line + strlen("DockNode")); }
21496 else if (strncmp(line, "DockSpace", 9) == 0) { line = ImStrSkipBlank(line + strlen("DockSpace")); node.Flags |= ImGuiDockNodeFlags_DockSpace; }
21497 else return;
21498 if (sscanf(line, "ID=0x%08X%n", &node.ID, &r) == 1) { line += r; } else return;
21499 if (sscanf(line, " Parent=0x%08X%n", &node.ParentNodeId, &r) == 1) { line += r; if (node.ParentNodeId == 0) return; }
21500 if (sscanf(line, " Window=0x%08X%n", &node.ParentWindowId, &r) ==1) { line += r; if (node.ParentWindowId == 0) return; }
21501 if (node.ParentNodeId == 0)
21502 {
21503 if (sscanf(line, " Pos=%i,%i%n", &x, &y, &r) == 2) { line += r; node.Pos = ImVec2ih((short)x, (short)y); } else return;
21504 if (sscanf(line, " Size=%i,%i%n", &x, &y, &r) == 2) { line += r; node.Size = ImVec2ih((short)x, (short)y); } else return;
21505 }
21506 else
21507 {
21508 if (sscanf(line, " SizeRef=%i,%i%n", &x, &y, &r) == 2) { line += r; node.SizeRef = ImVec2ih((short)x, (short)y); }
21509 }
21510 if (sscanf(line, " Split=%c%n", &c, &r) == 1) { line += r; if (c == 'X') node.SplitAxis = ImGuiAxis_X; else if (c == 'Y') node.SplitAxis = ImGuiAxis_Y; }
21511 if (sscanf(line, " NoResize=%d%n", &x, &r) == 1) { line += r; if (x != 0) node.Flags |= ImGuiDockNodeFlags_NoResize; }
21512 if (sscanf(line, " CentralNode=%d%n", &x, &r) == 1) { line += r; if (x != 0) node.Flags |= ImGuiDockNodeFlags_CentralNode; }
21513 if (sscanf(line, " NoTabBar=%d%n", &x, &r) == 1) { line += r; if (x != 0) node.Flags |= ImGuiDockNodeFlags_NoTabBar; }
21514 if (sscanf(line, " HiddenTabBar=%d%n", &x, &r) == 1) { line += r; if (x != 0) node.Flags |= ImGuiDockNodeFlags_HiddenTabBar; }
21515 if (sscanf(line, " NoWindowMenuButton=%d%n", &x, &r) == 1) { line += r; if (x != 0) node.Flags |= ImGuiDockNodeFlags_NoWindowMenuButton; }
21516 if (sscanf(line, " NoCloseButton=%d%n", &x, &r) == 1) { line += r; if (x != 0) node.Flags |= ImGuiDockNodeFlags_NoCloseButton; }
21517 if (sscanf(line, " Selected=0x%08X%n", &node.SelectedTabId,&r) == 1) { line += r; }
21518 if (node.ParentNodeId != 0)
21519 if (ImGuiDockNodeSettings* parent_settings = DockSettingsFindNodeSettings(ctx, node.ParentNodeId))
21520 node.Depth = parent_settings->Depth + 1;
21521 ctx->DockContext.NodesSettings.push_back(node);
21522}
21523
21524static void DockSettingsHandler_DockNodeToSettings(ImGuiDockContext* dc, ImGuiDockNode* node, int depth)
21525{

Callers

nothing calls this directly

Calls 3

ImStrSkipBlankFunction · 0.85
ImVec2ihClass · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected