| 20144 | } |
| 20145 | |
| 20146 | void ImGui::DockNodeTreeMerge(ImGuiContext* ctx, ImGuiDockNode* parent_node, ImGuiDockNode* merge_lead_child) |
| 20147 | { |
| 20148 | // When called from DockContextProcessUndockNode() it is possible that one of the child is NULL. |
| 20149 | ImGuiContext& g = *GImGui; |
| 20150 | ImGuiDockNode* child_0 = parent_node->ChildNodes[0]; |
| 20151 | ImGuiDockNode* child_1 = parent_node->ChildNodes[1]; |
| 20152 | IM_ASSERT(child_0 || child_1); |
| 20153 | IM_ASSERT(merge_lead_child == child_0 || merge_lead_child == child_1); |
| 20154 | if ((child_0 && child_0->Windows.Size > 0) || (child_1 && child_1->Windows.Size > 0)) |
| 20155 | { |
| 20156 | IM_ASSERT(parent_node->TabBar == NULL); |
| 20157 | IM_ASSERT(parent_node->Windows.Size == 0); |
| 20158 | } |
| 20159 | IMGUI_DEBUG_LOG_DOCKING("[docking] DockNodeTreeMerge: 0x%08X + 0x%08X back into parent 0x%08X\n", child_0 ? child_0->ID : 0, child_1 ? child_1->ID : 0, parent_node->ID); |
| 20160 | |
| 20161 | ImVec2 backup_last_explicit_size = parent_node->SizeRef; |
| 20162 | DockNodeMoveChildNodes(parent_node, merge_lead_child); |
| 20163 | if (child_0) |
| 20164 | { |
| 20165 | DockNodeMoveWindows(parent_node, child_0); // Generally only 1 of the 2 child node will have windows |
| 20166 | DockSettingsRenameNodeReferences(child_0->ID, parent_node->ID); |
| 20167 | } |
| 20168 | if (child_1) |
| 20169 | { |
| 20170 | DockNodeMoveWindows(parent_node, child_1); |
| 20171 | DockSettingsRenameNodeReferences(child_1->ID, parent_node->ID); |
| 20172 | } |
| 20173 | DockNodeApplyPosSizeToWindows(parent_node); |
| 20174 | parent_node->AuthorityForPos = parent_node->AuthorityForSize = parent_node->AuthorityForViewport = ImGuiDataAuthority_Auto; |
| 20175 | parent_node->VisibleWindow = merge_lead_child->VisibleWindow; |
| 20176 | parent_node->SizeRef = backup_last_explicit_size; |
| 20177 | |
| 20178 | // Flags transfer |
| 20179 | parent_node->LocalFlags &= ~ImGuiDockNodeFlags_LocalFlagsTransferMask_; // Preserve Dockspace flag |
| 20180 | parent_node->LocalFlags |= (child_0 ? child_0->LocalFlags : 0) & ImGuiDockNodeFlags_LocalFlagsTransferMask_; |
| 20181 | parent_node->LocalFlags |= (child_1 ? child_1->LocalFlags : 0) & ImGuiDockNodeFlags_LocalFlagsTransferMask_; |
| 20182 | parent_node->LocalFlagsInWindows = (child_0 ? child_0->LocalFlagsInWindows : 0) | (child_1 ? child_1->LocalFlagsInWindows : 0); // FIXME: Would be more consistent to update from actual windows |
| 20183 | parent_node->UpdateMergedFlags(); |
| 20184 | |
| 20185 | if (child_0) |
| 20186 | DockContextDeleteNode(ctx, child_0); |
| 20187 | if (child_1) |
| 20188 | DockContextDeleteNode(ctx, child_1); |
| 20189 | } |
| 20190 | |
| 20191 | // Update Pos/Size for a node hierarchy (don't affect child Windows yet) |
| 20192 | // (Depth-first, Pre-Order) |
nothing calls this directly
no outgoing calls
no test coverage detected