diff --git a/imgui.cpp b/imgui.cpp index 84a5156..960c8c2 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -9857,6 +9857,16 @@ DockContextClearNodes(ctx, 0, true); return; } + if (g.IO.ConfigFlags & ImGuiConfigFlags_DockingNoSplit) + { + for (int n = 0; n < dc->Nodes.Data.Size; n++) + if (ImGuiDockNode* node = (ImGuiDockNode*)dc->Nodes.Data[n].val_p) + if (node->IsRootNode() && node->IsSplitNode()) + { + DockBuilderRemoveNodeChildNodes(node->ID); + //dc->WantFullRebuild = true; + } + } #if 0 if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_C))) @@ -11195,7 +11205,7 @@ data->IsCenterAvailable = false; data->IsSidesAvailable = true; - if (host_node && (host_node->Flags & ImGuiDockNodeFlags_NoSplit)) + if ((host_node && (host_node->Flags & ImGuiDockNodeFlags_NoSplit)) || (g.IO.ConfigFlags & ImGuiConfigFlags_DockingNoSplit)) data->IsSidesAvailable = false; if (!is_outer_docking && host_node && host_node->ParentNode == NULL && host_node->IsCentralNode) data->IsSidesAvailable = false; @@ -11335,7 +11345,7 @@ } // Stop after ImGuiDir_None - if (host_node && (host_node->Flags & ImGuiDockNodeFlags_NoSplit)) + if ((host_node && (host_node->Flags & ImGuiDockNodeFlags_NoSplit)) || (g.IO.ConfigFlags & ImGuiConfigFlags_DockingNoSplit)) return; } } @@ -11833,6 +11843,10 @@ } } + // DockNodeMoveWindows->DockNodeAddWindow will normally set those when reaching two windows (which is only adequate during interactive merge) + // Make sure we don't lose our current pos/size. (FIXME-DOCK: Consider tidying up that code in DockNodeAddWindow instead) + root_node->InitFromFirstWindowPosSize = false; + // Apply to settings for (int settings_n = 0; settings_n < ctx->SettingsWindows.Size; settings_n++) if (ImGuiID window_settings_dock_id = ctx->SettingsWindows[settings_n].DockId) diff --git a/imgui.cpp b/imgui.cpp index 84a5156..960c8c2 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -9857,6 +9857,16 @@ DockContextClearNodes(ctx, 0, true); return; } + if (g.IO.ConfigFlags & ImGuiConfigFlags_DockingNoSplit) + { + for (int n = 0; n < dc->Nodes.Data.Size; n++) + if (ImGuiDockNode* node = (ImGuiDockNode*)dc->Nodes.Data[n].val_p) + if (node->IsRootNode() && node->IsSplitNode()) + { + DockBuilderRemoveNodeChildNodes(node->ID); + //dc->WantFullRebuild = true; + } + } #if 0 if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_C))) @@ -11195,7 +11205,7 @@ data->IsCenterAvailable = false; data->IsSidesAvailable = true; - if (host_node && (host_node->Flags & ImGuiDockNodeFlags_NoSplit)) + if ((host_node && (host_node->Flags & ImGuiDockNodeFlags_NoSplit)) || (g.IO.ConfigFlags & ImGuiConfigFlags_DockingNoSplit)) data->IsSidesAvailable = false; if (!is_outer_docking && host_node && host_node->ParentNode == NULL && host_node->IsCentralNode) data->IsSidesAvailable = false; @@ -11335,7 +11345,7 @@ } // Stop after ImGuiDir_None - if (host_node && (host_node->Flags & ImGuiDockNodeFlags_NoSplit)) + if ((host_node && (host_node->Flags & ImGuiDockNodeFlags_NoSplit)) || (g.IO.ConfigFlags & ImGuiConfigFlags_DockingNoSplit)) return; } } @@ -11833,6 +11843,10 @@ } } + // DockNodeMoveWindows->DockNodeAddWindow will normally set those when reaching two windows (which is only adequate during interactive merge) + // Make sure we don't lose our current pos/size. (FIXME-DOCK: Consider tidying up that code in DockNodeAddWindow instead) + root_node->InitFromFirstWindowPosSize = false; + // Apply to settings for (int settings_n = 0; settings_n < ctx->SettingsWindows.Size; settings_n++) if (ImGuiID window_settings_dock_id = ctx->SettingsWindows[settings_n].DockId) diff --git a/imgui.h b/imgui.h index d3c35c7..6721b0a 100644 --- a/imgui.h +++ b/imgui.h @@ -959,6 +959,7 @@ // [BETA] Docking ImGuiConfigFlags_DockingEnable = 1 << 6, // Docking enable flags. Use SHIFT to dock window into another (or without SHIFT if io.ConfigDockingWithShift = false). + ImGuiConfigFlags_DockingNoSplit = 1 << 7, // Simplified docking mode: disable window splitting, so docking is limited to merging multiple windows together into tab-bars. // [BETA] Viewports ImGuiConfigFlags_ViewportsEnable = 1 << 10, // Viewport enable flags (require both ImGuiConfigFlags_PlatformHasViewports + ImGuiConfigFlags_RendererHasViewports set by the respective back-ends) diff --git a/imgui.cpp b/imgui.cpp index 84a5156..960c8c2 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -9857,6 +9857,16 @@ DockContextClearNodes(ctx, 0, true); return; } + if (g.IO.ConfigFlags & ImGuiConfigFlags_DockingNoSplit) + { + for (int n = 0; n < dc->Nodes.Data.Size; n++) + if (ImGuiDockNode* node = (ImGuiDockNode*)dc->Nodes.Data[n].val_p) + if (node->IsRootNode() && node->IsSplitNode()) + { + DockBuilderRemoveNodeChildNodes(node->ID); + //dc->WantFullRebuild = true; + } + } #if 0 if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_C))) @@ -11195,7 +11205,7 @@ data->IsCenterAvailable = false; data->IsSidesAvailable = true; - if (host_node && (host_node->Flags & ImGuiDockNodeFlags_NoSplit)) + if ((host_node && (host_node->Flags & ImGuiDockNodeFlags_NoSplit)) || (g.IO.ConfigFlags & ImGuiConfigFlags_DockingNoSplit)) data->IsSidesAvailable = false; if (!is_outer_docking && host_node && host_node->ParentNode == NULL && host_node->IsCentralNode) data->IsSidesAvailable = false; @@ -11335,7 +11345,7 @@ } // Stop after ImGuiDir_None - if (host_node && (host_node->Flags & ImGuiDockNodeFlags_NoSplit)) + if ((host_node && (host_node->Flags & ImGuiDockNodeFlags_NoSplit)) || (g.IO.ConfigFlags & ImGuiConfigFlags_DockingNoSplit)) return; } } @@ -11833,6 +11843,10 @@ } } + // DockNodeMoveWindows->DockNodeAddWindow will normally set those when reaching two windows (which is only adequate during interactive merge) + // Make sure we don't lose our current pos/size. (FIXME-DOCK: Consider tidying up that code in DockNodeAddWindow instead) + root_node->InitFromFirstWindowPosSize = false; + // Apply to settings for (int settings_n = 0; settings_n < ctx->SettingsWindows.Size; settings_n++) if (ImGuiID window_settings_dock_id = ctx->SettingsWindows[settings_n].DockId) diff --git a/imgui.h b/imgui.h index d3c35c7..6721b0a 100644 --- a/imgui.h +++ b/imgui.h @@ -959,6 +959,7 @@ // [BETA] Docking ImGuiConfigFlags_DockingEnable = 1 << 6, // Docking enable flags. Use SHIFT to dock window into another (or without SHIFT if io.ConfigDockingWithShift = false). + ImGuiConfigFlags_DockingNoSplit = 1 << 7, // Simplified docking mode: disable window splitting, so docking is limited to merging multiple windows together into tab-bars. // [BETA] Viewports ImGuiConfigFlags_ViewportsEnable = 1 << 10, // Viewport enable flags (require both ImGuiConfigFlags_PlatformHasViewports + ImGuiConfigFlags_RendererHasViewports set by the respective back-ends) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 3b6b2f0..a023367 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -347,6 +347,8 @@ ImGui::CheckboxFlags("io.ConfigFlags: DockingEnable", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_DockingEnable); ImGui::SameLine(); ShowHelpMarker("Use SHIFT to dock window into another (or without SHIFT if io.ConfigDockingWithShift == false)"); + ImGui::CheckboxFlags("io.ConfigFlags: DockingNoSplit", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_DockingNoSplit); + ImGui::SameLine(); ShowHelpMarker("Simplified docking mode: disable window splitting, so docking is limited to merging multiple windows together into tab-bars."); ImGui::CheckboxFlags("io.ConfigFlags: ViewportsEnable", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_ViewportsEnable); ImGui::SameLine(); ShowHelpMarker("Toggling this at runtime is normally unsupported (it will offset your windows).");