| 16785 | } |
| 16786 | |
| 16787 | void ImGui::DockNodeTreeMerge(ImGuiContext* ctx, ImGuiDockNode* parent_node, ImGuiDockNode* merge_lead_child) |
| 16788 | { |
| 16789 | // When called from DockContextProcessUndockNode() it is possible that one of the child is NULL. |
| 16790 | ImGuiContext& g = *GImGui; |
| 16791 | ImGuiDockNode* child_0 = parent_node->ChildNodes[0]; |
| 16792 | ImGuiDockNode* child_1 = parent_node->ChildNodes[1]; |
| 16793 | IM_ASSERT(child_0 || child_1); |
| 16794 | IM_ASSERT(merge_lead_child == child_0 || merge_lead_child == child_1); |
| 16795 | if ((child_0 && child_0->Windows.Size > 0) || (child_1 && child_1->Windows.Size > 0)) |
| 16796 | { |
| 16797 | IM_ASSERT(parent_node->TabBar == NULL); |
| 16798 | IM_ASSERT(parent_node->Windows.Size == 0); |
| 16799 | } |
| 16800 | 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); |
| 16801 | |
| 16802 | ImVec2 backup_last_explicit_size = parent_node->SizeRef; |
| 16803 | DockNodeMoveChildNodes(parent_node, merge_lead_child); |
| 16804 | if (child_0) |
| 16805 | { |
| 16806 | DockNodeMoveWindows(parent_node, child_0); // Generally only 1 of the 2 child node will have windows |
| 16807 | DockSettingsRenameNodeReferences(child_0->ID, parent_node->ID); |
| 16808 | } |
| 16809 | if (child_1) |
| 16810 | { |
| 16811 | DockNodeMoveWindows(parent_node, child_1); |
| 16812 | DockSettingsRenameNodeReferences(child_1->ID, parent_node->ID); |
| 16813 | } |
| 16814 | DockNodeApplyPosSizeToWindows(parent_node); |
| 16815 | parent_node->AuthorityForPos = parent_node->AuthorityForSize = parent_node->AuthorityForViewport = ImGuiDataAuthority_Auto; |
| 16816 | parent_node->VisibleWindow = merge_lead_child->VisibleWindow; |
| 16817 | parent_node->SizeRef = backup_last_explicit_size; |
| 16818 | |
| 16819 | // Flags transfer |
| 16820 | parent_node->LocalFlags &= ~ImGuiDockNodeFlags_LocalFlagsTransferMask_; // Preserve Dockspace flag |
| 16821 | parent_node->LocalFlags |= (child_0 ? child_0->LocalFlags : 0) & ImGuiDockNodeFlags_LocalFlagsTransferMask_; |
| 16822 | parent_node->LocalFlags |= (child_1 ? child_1->LocalFlags : 0) & ImGuiDockNodeFlags_LocalFlagsTransferMask_; |
| 16823 | 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 |
| 16824 | parent_node->UpdateMergedFlags(); |
| 16825 | |
| 16826 | if (child_0) |
| 16827 | { |
| 16828 | ctx->DockContext.Nodes.SetVoidPtr(child_0->ID, NULL); |
| 16829 | IM_DELETE(child_0); |
| 16830 | } |
| 16831 | if (child_1) |
| 16832 | { |
| 16833 | ctx->DockContext.Nodes.SetVoidPtr(child_1->ID, NULL); |
| 16834 | IM_DELETE(child_1); |
| 16835 | } |
| 16836 | } |
| 16837 | |
| 16838 | // Update Pos/Size for a node hierarchy (don't affect child Windows yet) |
| 16839 | // (Depth-first, Pre-Order) |
nothing calls this directly
no test coverage detected