mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-22 15:46:35 +00:00
Docking, Viewports: Moving code.
Moved NewFrame() sanity checks in NewFrameSanityChecks(). Moved some of DockNodeUpdate() into DockNodeUpdateForRootNode().
This commit is contained in:
parent
71a58261f6
commit
4dff49b2f1
52
imgui.cpp
52
imgui.cpp
@ -3693,22 +3693,8 @@ static void NewFrameSanityChecks()
|
|||||||
// Perform simple check: the beta io.ConfigWindowsResizeFromEdges option requires back-end to honor mouse cursor changes and set the ImGuiBackendFlags_HasMouseCursors flag accordingly.
|
// Perform simple check: the beta io.ConfigWindowsResizeFromEdges option requires back-end to honor mouse cursor changes and set the ImGuiBackendFlags_HasMouseCursors flag accordingly.
|
||||||
if (g.IO.ConfigWindowsResizeFromEdges && !(g.IO.BackendFlags & ImGuiBackendFlags_HasMouseCursors))
|
if (g.IO.ConfigWindowsResizeFromEdges && !(g.IO.BackendFlags & ImGuiBackendFlags_HasMouseCursors))
|
||||||
g.IO.ConfigWindowsResizeFromEdges = false;
|
g.IO.ConfigWindowsResizeFromEdges = false;
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui::NewFrame()
|
|
||||||
{
|
|
||||||
IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?");
|
|
||||||
ImGuiContext& g = *GImGui;
|
|
||||||
|
|
||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
|
||||||
ImGuiTestEngineHook_PreNewFrame(&g);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Check and assert for various common IO and Configuration mistakes
|
|
||||||
NewFrameSanityChecks();
|
|
||||||
|
|
||||||
// Perform simple check: error if Docking or Viewport are enabled _exactly_ on frame 1 (instead of frame 0 or later), which is a common error leading to loss of .ini data.
|
// Perform simple check: error if Docking or Viewport are enabled _exactly_ on frame 1 (instead of frame 0 or later), which is a common error leading to loss of .ini data.
|
||||||
g.ConfigFlagsLastFrame = g.ConfigFlagsCurrFrame;
|
|
||||||
if (g.FrameCount == 1 && (g.IO.ConfigFlags & ImGuiConfigFlags_DockingEnable) && (g.ConfigFlagsLastFrame & ImGuiConfigFlags_DockingEnable) == 0)
|
if (g.FrameCount == 1 && (g.IO.ConfigFlags & ImGuiConfigFlags_DockingEnable) && (g.ConfigFlagsLastFrame & ImGuiConfigFlags_DockingEnable) == 0)
|
||||||
IM_ASSERT(0 && "Please set DockingEnable before the first call to NewFrame()! Otherwise you will lose your .ini settings!");
|
IM_ASSERT(0 && "Please set DockingEnable before the first call to NewFrame()! Otherwise you will lose your .ini settings!");
|
||||||
if (g.FrameCount == 1 && (g.IO.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) && (g.ConfigFlagsLastFrame & ImGuiConfigFlags_ViewportsEnable) == 0)
|
if (g.FrameCount == 1 && (g.IO.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) && (g.ConfigFlagsLastFrame & ImGuiConfigFlags_ViewportsEnable) == 0)
|
||||||
@ -3750,6 +3736,20 @@ void ImGui::NewFrame()
|
|||||||
IM_ASSERT(mon.DpiScale != 0.0f);
|
IM_ASSERT(mon.DpiScale != 0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui::NewFrame()
|
||||||
|
{
|
||||||
|
IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?");
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
|
||||||
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
|
ImGuiTestEngineHook_PreNewFrame(&g);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Check and assert for various common IO and Configuration mistakes
|
||||||
|
g.ConfigFlagsLastFrame = g.ConfigFlagsCurrFrame;
|
||||||
|
NewFrameSanityChecks();
|
||||||
g.ConfigFlagsCurrFrame = g.IO.ConfigFlags;
|
g.ConfigFlagsCurrFrame = g.IO.ConfigFlags;
|
||||||
|
|
||||||
// Load settings on first frame (if not explicitly loaded manually before)
|
// Load settings on first frame (if not explicitly loaded manually before)
|
||||||
@ -11232,6 +11232,7 @@ namespace ImGui
|
|||||||
static void DockNodeRemoveWindow(ImGuiDockNode* node, ImGuiWindow* window, ImGuiID save_dock_id);
|
static void DockNodeRemoveWindow(ImGuiDockNode* node, ImGuiWindow* window, ImGuiID save_dock_id);
|
||||||
static void DockNodeHideHostWindow(ImGuiDockNode* node);
|
static void DockNodeHideHostWindow(ImGuiDockNode* node);
|
||||||
static void DockNodeUpdate(ImGuiDockNode* node);
|
static void DockNodeUpdate(ImGuiDockNode* node);
|
||||||
|
static void DockNodeUpdateForRootNode(ImGuiDockNode* node);
|
||||||
static void DockNodeUpdateVisibleFlagAndInactiveChilds(ImGuiDockNode* node);
|
static void DockNodeUpdateVisibleFlagAndInactiveChilds(ImGuiDockNode* node);
|
||||||
static void DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_window);
|
static void DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_window);
|
||||||
static void DockNodeAddTabBar(ImGuiDockNode* node);
|
static void DockNodeAddTabBar(ImGuiDockNode* node);
|
||||||
@ -12168,7 +12169,6 @@ static ImGuiWindow* ImGui::DockNodeFindWindowByID(ImGuiDockNode* node, ImGuiID i
|
|||||||
static void ImGui::DockNodeUpdateVisibleFlagAndInactiveChilds(ImGuiDockNode* node)
|
static void ImGui::DockNodeUpdateVisibleFlagAndInactiveChilds(ImGuiDockNode* node)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
|
||||||
IM_ASSERT(node->ParentNode == NULL || node->ParentNode->ChildNodes[0] == node || node->ParentNode->ChildNodes[1] == node);
|
IM_ASSERT(node->ParentNode == NULL || node->ParentNode->ChildNodes[0] == node || node->ParentNode->ChildNodes[1] == node);
|
||||||
|
|
||||||
// Inherit most flags
|
// Inherit most flags
|
||||||
@ -12247,15 +12247,8 @@ static void ImGui::DockNodeStartMouseMovingWindow(ImGuiDockNode* node, ImGuiWind
|
|||||||
g.ActiveIdClickOffset = backup_active_click_offset;
|
g.ActiveIdClickOffset = backup_active_click_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ImGui::DockNodeUpdate(ImGuiDockNode* node)
|
// Update CentralNode, OnlyNodeWithWindows, LastFocusedNodeID. Copy window class.
|
||||||
{
|
static void ImGui::DockNodeUpdateForRootNode(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())
|
|
||||||
{
|
{
|
||||||
DockNodeUpdateVisibleFlagAndInactiveChilds(node);
|
DockNodeUpdateVisibleFlagAndInactiveChilds(node);
|
||||||
|
|
||||||
@ -12284,6 +12277,17 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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())
|
||||||
|
DockNodeUpdateForRootNode(node);
|
||||||
|
|
||||||
// Remove tab bar if not needed
|
// Remove tab bar if not needed
|
||||||
if (node->TabBar && node->IsNoTabBar())
|
if (node->TabBar && node->IsNoTabBar())
|
||||||
DockNodeRemoveTabBar(node);
|
DockNodeRemoveTabBar(node);
|
||||||
|
Loading…
Reference in New Issue
Block a user