mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-06 13:08:47 +02:00
Renamed ImGuiDockFamily to ImGuiWindowClass. Renamed CompatibleWithClassZero to DockingAllowUnclassed. (#2109)
This commit is contained in:
46
imgui.cpp
46
imgui.cpp
@ -5084,7 +5084,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
{
|
||||
window->SizeContentsExplicit = ImVec2(0.0f, 0.0f);
|
||||
}
|
||||
window->DockFamily = g.NextWindowData.DockFamily;
|
||||
window->WindowClass = g.NextWindowData.WindowClass;
|
||||
if (g.NextWindowData.CollapsedCond)
|
||||
SetWindowCollapsed(window, g.NextWindowData.CollapsedVal, g.NextWindowData.CollapsedCond);
|
||||
if (g.NextWindowData.FocusCond)
|
||||
@ -6531,10 +6531,10 @@ void ImGui::SetNextWindowDockId(ImGuiID id, ImGuiCond cond)
|
||||
g.NextWindowData.DockId = id;
|
||||
}
|
||||
|
||||
void ImGui::SetNextWindowDockFamily(const ImGuiDockFamily* family)
|
||||
void ImGui::SetNextWindowClass(const ImGuiWindowClass* window_class)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.NextWindowData.DockFamily = *family;
|
||||
g.NextWindowData.WindowClass = *window_class;
|
||||
}
|
||||
|
||||
// In window space (not screen space!)
|
||||
@ -10679,7 +10679,7 @@ struct ImGuiDockNodeUpdateScanResults
|
||||
ImGuiDockNode* CentralNode;
|
||||
ImGuiDockNode* FirstNodeWithWindows;
|
||||
int CountNodesWithWindows;
|
||||
//ImGuiDockFamily DockFamilyForMerges;
|
||||
//ImGuiWindowClass WindowClassForMerges;
|
||||
|
||||
ImGuiDockNodeUpdateScanResults() { CentralNode = FirstNodeWithWindows = NULL; CountNodesWithWindows = 0; }
|
||||
};
|
||||
@ -10802,16 +10802,16 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node)
|
||||
if (node->LastFocusedNodeID == 0 && results.FirstNodeWithWindows != NULL)
|
||||
node->LastFocusedNodeID = results.FirstNodeWithWindows->ID;
|
||||
|
||||
// Copy the dock family from of our window so it can be used for proper dock filtering.
|
||||
// When node has mixed windows, prioritize the family with the most constraint (CompatibleWithNeutral = false) as the reference to copy.
|
||||
// Copy the window class from of our first window so it can be used for proper dock filtering.
|
||||
// When node has mixed windows, prioritize the class with the most constraint (CompatibleWithClassZero = false) as the reference to copy.
|
||||
// FIXME-DOCK: We don't recurse properly, this code could be reworked to work from DockNodeUpdateScanRec.
|
||||
if (ImGuiDockNode* first_node_with_windows = results.FirstNodeWithWindows)
|
||||
{
|
||||
node->DockFamily = first_node_with_windows->Windows[0]->DockFamily;
|
||||
node->WindowClass = first_node_with_windows->Windows[0]->WindowClass;
|
||||
for (int n = 1; n < first_node_with_windows->Windows.Size; n++)
|
||||
if (first_node_with_windows->Windows[n]->DockFamily.CompatibleWithFamilyZero == false)
|
||||
if (first_node_with_windows->Windows[n]->WindowClass.DockingAllowUnclassed == false)
|
||||
{
|
||||
node->DockFamily = first_node_with_windows->Windows[n]->DockFamily;
|
||||
node->WindowClass = first_node_with_windows->Windows[n]->WindowClass;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -11272,13 +11272,13 @@ static bool DockNodeIsDropAllowedOne(ImGuiWindow* payload, ImGuiWindow* host_win
|
||||
if ((host_window->Flags & ImGuiWindowFlags_DockNodeHost) && host_window->DockNodeAsHost->IsDockSpace && payload->BeginOrderWithinContext < host_window->BeginOrderWithinContext)
|
||||
return false;
|
||||
|
||||
ImGuiDockFamily* host_family = host_window->DockNodeAsHost ? &host_window->DockNodeAsHost->DockFamily : &host_window->DockFamily;
|
||||
ImGuiDockFamily* payload_family = &payload->DockFamily;
|
||||
if (host_family->FamilyId != payload_family->FamilyId)
|
||||
ImGuiWindowClass* host_class = host_window->DockNodeAsHost ? &host_window->DockNodeAsHost->WindowClass : &host_window->WindowClass;
|
||||
ImGuiWindowClass* payload_class = &payload->WindowClass;
|
||||
if (host_class->ClassId != payload_class->ClassId)
|
||||
{
|
||||
if (host_family->FamilyId != 0 && host_family->CompatibleWithFamilyZero && payload_family->FamilyId == 0)
|
||||
if (host_class->ClassId != 0 && host_class->DockingAllowUnclassed && payload_class->ClassId == 0)
|
||||
return true;
|
||||
if (payload_family->FamilyId != 0 && payload_family->CompatibleWithFamilyZero && host_family->FamilyId == 0)
|
||||
if (payload_class->ClassId != 0 && payload_class->DockingAllowUnclassed && host_class->ClassId == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@ -11928,7 +11928,7 @@ void ImGui::SetWindowDock(ImGuiWindow* window, ImGuiID dock_id, ImGuiCond cond)
|
||||
|
||||
// Create an explicit dockspace node within an existing window. Also expose dock node flags and creates a CentralNode by default.
|
||||
// The Central Node is always displayed even when empty and shrink/extend according to the requested size of its neighbors.
|
||||
void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags dockspace_flags, const ImGuiDockFamily* dock_family)
|
||||
void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags dockspace_flags, const ImGuiWindowClass* window_class)
|
||||
{
|
||||
ImGuiContext* ctx = GImGui;
|
||||
ImGuiContext& g = *ctx;
|
||||
@ -11943,7 +11943,7 @@ void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags doc
|
||||
node->IsCentralNode = true;
|
||||
}
|
||||
node->Flags = dockspace_flags;
|
||||
node->DockFamily = dock_family ? *dock_family : ImGuiDockFamily();
|
||||
node->WindowClass = window_class ? *window_class : ImGuiWindowClass();
|
||||
|
||||
// When a Dockspace transitioned form implicit to explicit this may be called a second time
|
||||
// It is possible that the node has already been claimed by a docked window which appeared before the DockSpace() node, so we overwrite IsDockSpace again.
|
||||
@ -12006,7 +12006,7 @@ void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags doc
|
||||
// The limitation with this call is that your window won't have a menu bar.
|
||||
// Even though we could pass window flags, it would also require the user to be able to call BeginMenuBar() somehow meaning we can't Begin/End in a single function.
|
||||
// So if you want a menu bar you need to repeat this code manually ourselves. As with advanced other Docking API, we may change this function signature.
|
||||
ImGuiID ImGui::DockSpaceOverViewport(ImGuiViewport* viewport, ImGuiDockNodeFlags dockspace_flags, const ImGuiDockFamily* dock_family)
|
||||
ImGuiID ImGui::DockSpaceOverViewport(ImGuiViewport* viewport, ImGuiDockNodeFlags dockspace_flags, const ImGuiWindowClass* window_class)
|
||||
{
|
||||
if (viewport == NULL)
|
||||
viewport = GetMainViewport();
|
||||
@ -12031,7 +12031,7 @@ ImGuiID ImGui::DockSpaceOverViewport(ImGuiViewport* viewport, ImGuiDockNodeFlags
|
||||
PopStyleVar(3);
|
||||
|
||||
ImGuiID dockspace_id = GetID("Dockspace");
|
||||
DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags, dock_family);
|
||||
DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags, window_class);
|
||||
End();
|
||||
|
||||
return dockspace_id;
|
||||
@ -12299,7 +12299,7 @@ void ImGui::DockBuilderCopyDockspace(ImGuiID src_dockspace_id, ImGuiID dst_docks
|
||||
IM_ASSERT((in_window_remap_pairs->Size % 2) == 0);
|
||||
|
||||
// Duplicate entire dock
|
||||
// FIXME: When overwriting dst_dockspace_id, windows that aren't part of our dockspace family but that are docked in a same node will be split apart,
|
||||
// FIXME: When overwriting dst_dockspace_id, windows that aren't part of our dockspace window class but that are docked in a same node will be split apart,
|
||||
// whereas we could attempt to at least keep them together in a new, same floating node.
|
||||
ImVector<ImGuiID> node_remap_pairs;
|
||||
DockBuilderCopyNode(src_dockspace_id, dst_dockspace_id, &node_remap_pairs);
|
||||
@ -13126,7 +13126,7 @@ static void SettingsHandlerWindow_ReadLine(ImGuiContext*, ImGuiSettingsHandler*,
|
||||
else if (sscanf(line, "Collapsed=%d", &i) == 1) { settings->Collapsed = (i != 0); }
|
||||
else if (sscanf(line, "DockId=0x%X,%d", &u1, &i) == 2) { settings->DockId = u1; settings->DockOrder = (short)i; }
|
||||
else if (sscanf(line, "DockId=0x%X", &u1) == 1) { settings->DockId = u1; settings->DockOrder = -1; }
|
||||
else if (sscanf(line, "DockFamilyId=0x%X", &u1) == 1) { settings->DockFamilyId = u1; }
|
||||
else if (sscanf(line, "ClassId=0x%X", &u1) == 1) { settings->ClassId = u1; }
|
||||
}
|
||||
|
||||
static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf)
|
||||
@ -13153,7 +13153,7 @@ static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, ImGuiSetting
|
||||
settings->ViewportPos = window->ViewportPos;
|
||||
IM_ASSERT(window->DockNode == NULL || window->DockNode->ID == window->DockId);
|
||||
settings->DockId = window->DockId;
|
||||
settings->DockFamilyId = window->DockFamily.FamilyId;
|
||||
settings->ClassId = window->WindowClass.ClassId;
|
||||
settings->DockOrder = window->DockOrder;
|
||||
settings->Collapsed = window->Collapsed;
|
||||
}
|
||||
@ -13184,8 +13184,8 @@ static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, ImGuiSetting
|
||||
buf->appendf("DockId=0x%08X\n", settings->DockId);
|
||||
else
|
||||
buf->appendf("DockId=0x%08X,%d\n", settings->DockId, settings->DockOrder);
|
||||
if (settings->DockFamilyId != 0)
|
||||
buf->appendf("DockFamilyId=0x%08X\n", settings->DockFamilyId);
|
||||
if (settings->ClassId != 0)
|
||||
buf->appendf("ClassId=0x%08X\n", settings->ClassId);
|
||||
}
|
||||
buf->appendf("\n");
|
||||
}
|
||||
|
Reference in New Issue
Block a user