|
|
|
@ -12908,7 +12908,7 @@ namespace ImGui
|
|
|
|
|
// ImGuiDockNode tree manipulations
|
|
|
|
|
static void DockNodeTreeSplit(ImGuiContext* ctx, ImGuiDockNode* parent_node, ImGuiAxis split_axis, int split_first_child, float split_ratio, ImGuiDockNode* new_node);
|
|
|
|
|
static void DockNodeTreeMerge(ImGuiContext* ctx, ImGuiDockNode* parent_node, ImGuiDockNode* merge_lead_child);
|
|
|
|
|
static void DockNodeTreeUpdatePosSize(ImGuiDockNode* node, ImVec2 pos, ImVec2 size, bool only_write_to_marked_nodes = false);
|
|
|
|
|
static void DockNodeTreeUpdatePosSize(ImGuiDockNode* node, ImVec2 pos, ImVec2 size, ImGuiDockNode* only_write_to_single_node = NULL);
|
|
|
|
|
static void DockNodeTreeUpdateSplitter(ImGuiDockNode* node);
|
|
|
|
|
static ImGuiDockNode* DockNodeTreeFindVisibleNodeByPos(ImGuiDockNode* node, ImVec2 pos);
|
|
|
|
|
static ImGuiDockNode* DockNodeTreeFindFallbackLeafNode(ImGuiDockNode* node);
|
|
|
|
@ -13604,7 +13604,6 @@ ImGuiDockNode::ImGuiDockNode(ImGuiID id)
|
|
|
|
|
IsVisible = true;
|
|
|
|
|
IsFocused = HasCloseButton = HasWindowMenuButton = HasCentralNodeChild = false;
|
|
|
|
|
WantCloseAll = WantLockSizeOnce = WantMouseMove = WantHiddenTabBarUpdate = WantHiddenTabBarToggle = false;
|
|
|
|
|
MarkedForPosSizeWrite = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ImGuiDockNode::~ImGuiDockNode()
|
|
|
|
@ -14045,7 +14044,6 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node)
|
|
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
|
|
IM_ASSERT(node->LastFrameActive != g.FrameCount);
|
|
|
|
|
node->LastFrameAlive = g.FrameCount;
|
|
|
|
|
node->MarkedForPosSizeWrite = false;
|
|
|
|
|
|
|
|
|
|
node->CentralNode = node->OnlyNodeWithWindows = NULL;
|
|
|
|
|
if (node->IsRootNode())
|
|
|
|
@ -15153,11 +15151,11 @@ void ImGui::DockNodeTreeMerge(ImGuiContext* ctx, ImGuiDockNode* parent_node, ImG
|
|
|
|
|
|
|
|
|
|
// Update Pos/Size for a node hierarchy (don't affect child Windows yet)
|
|
|
|
|
// (Depth-first, Pre-Order)
|
|
|
|
|
void ImGui::DockNodeTreeUpdatePosSize(ImGuiDockNode* node, ImVec2 pos, ImVec2 size, bool only_write_to_marked_nodes)
|
|
|
|
|
void ImGui::DockNodeTreeUpdatePosSize(ImGuiDockNode* node, ImVec2 pos, ImVec2 size, ImGuiDockNode* only_write_to_single_node)
|
|
|
|
|
{
|
|
|
|
|
// During the regular dock node update we write to all nodes.
|
|
|
|
|
// 'only_write_to_marked_nodes' is only set when turning a node visible mid-frame and we need its size right-away.
|
|
|
|
|
const bool write_to_node = (only_write_to_marked_nodes == false) || (node->MarkedForPosSizeWrite);
|
|
|
|
|
// 'only_write_to_single_node' is only set when turning a node visible mid-frame and we need its size right-away.
|
|
|
|
|
const bool write_to_node = only_write_to_single_node == NULL || only_write_to_single_node == node;
|
|
|
|
|
if (write_to_node)
|
|
|
|
|
{
|
|
|
|
|
node->Pos = pos;
|
|
|
|
@ -15171,15 +15169,21 @@ void ImGui::DockNodeTreeUpdatePosSize(ImGuiDockNode* node, ImVec2 pos, ImVec2 si
|
|
|
|
|
ImGuiDockNode* child_1 = node->ChildNodes[1];
|
|
|
|
|
ImVec2 child_0_pos = pos, child_1_pos = pos;
|
|
|
|
|
ImVec2 child_0_size = size, child_1_size = size;
|
|
|
|
|
if (child_0->IsVisible && child_1->IsVisible)
|
|
|
|
|
|
|
|
|
|
const bool child_0_is_toward_single_node = (only_write_to_single_node != NULL && DockNodeIsInHierarchyOf(only_write_to_single_node, child_0));
|
|
|
|
|
const bool child_1_is_toward_single_node = (only_write_to_single_node != NULL && DockNodeIsInHierarchyOf(only_write_to_single_node, child_1));
|
|
|
|
|
const bool child_0_is_or_will_be_visible = child_0->IsVisible || child_0_is_toward_single_node;
|
|
|
|
|
const bool child_1_is_or_will_be_visible = child_1->IsVisible || child_1_is_toward_single_node;
|
|
|
|
|
|
|
|
|
|
if (child_0_is_or_will_be_visible && child_1_is_or_will_be_visible)
|
|
|
|
|
{
|
|
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
|
|
const float spacing = DOCKING_SPLITTER_SIZE;
|
|
|
|
|
const ImGuiAxis axis = (ImGuiAxis)node->SplitAxis;
|
|
|
|
|
const float size_avail = ImMax(size[axis] - spacing, 0.0f);
|
|
|
|
|
|
|
|
|
|
// Size allocation policy
|
|
|
|
|
// 1) The first 0..WindowMinSize[axis]*2 are allocated evenly to both windows.
|
|
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
|
|
const float size_min_each = ImFloor(ImMin(size_avail, g.Style.WindowMinSize[axis] * 2.0f) * 0.5f);
|
|
|
|
|
|
|
|
|
|
// FIXME: Blocks 2) and 3) are essentially doing nearly the same thing.
|
|
|
|
@ -15230,11 +15234,15 @@ void ImGui::DockNodeTreeUpdatePosSize(ImGuiDockNode* node, ImVec2 pos, ImVec2 si
|
|
|
|
|
|
|
|
|
|
child_1_pos[axis] += spacing + child_0_size[axis];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (only_write_to_single_node == NULL)
|
|
|
|
|
child_0->WantLockSizeOnce = child_1->WantLockSizeOnce = false;
|
|
|
|
|
|
|
|
|
|
if (child_0->IsVisible)
|
|
|
|
|
const bool child_0_recurse = only_write_to_single_node ? child_0_is_toward_single_node : child_0->IsVisible;
|
|
|
|
|
const bool child_1_recurse = only_write_to_single_node ? child_1_is_toward_single_node : child_1->IsVisible;
|
|
|
|
|
if (child_0_recurse)
|
|
|
|
|
DockNodeTreeUpdatePosSize(child_0, child_0_pos, child_0_size);
|
|
|
|
|
if (child_1->IsVisible)
|
|
|
|
|
if (child_1_recurse)
|
|
|
|
|
DockNodeTreeUpdatePosSize(child_1, child_1_pos, child_1_size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -16048,16 +16056,11 @@ static ImGuiDockNode* ImGui::DockContextBindNodeToWindow(ImGuiContext* ctx, ImGu
|
|
|
|
|
if (!node->IsVisible)
|
|
|
|
|
{
|
|
|
|
|
ImGuiDockNode* ancestor_node = node;
|
|
|
|
|
while (!ancestor_node->IsVisible)
|
|
|
|
|
{
|
|
|
|
|
ancestor_node->IsVisible = true;
|
|
|
|
|
ancestor_node->MarkedForPosSizeWrite = true;
|
|
|
|
|
if (ancestor_node->ParentNode)
|
|
|
|
|
while (!ancestor_node->IsVisible && ancestor_node->ParentNode)
|
|
|
|
|
ancestor_node = ancestor_node->ParentNode;
|
|
|
|
|
}
|
|
|
|
|
IM_ASSERT(ancestor_node->Size.x > 0.0f && ancestor_node->Size.y > 0.0f);
|
|
|
|
|
DockNodeUpdateHasCentralNodeChild(DockNodeGetRootNode(ancestor_node));
|
|
|
|
|
DockNodeTreeUpdatePosSize(ancestor_node, ancestor_node->Pos, ancestor_node->Size, true);
|
|
|
|
|
DockNodeTreeUpdatePosSize(ancestor_node, ancestor_node->Pos, ancestor_node->Size, node);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add window to node
|
|
|
|
|