Renamed ImGuiDockNodeFlags_Dockspace to ImGuiDockNodeFlags_DockSpace for consistency. DockBuilderCopyDockspace() to DockBuilderCopyDockSpace(). Made casing consistent elsewhere. (#2109)

This commit is contained in:
omar 2019-03-27 17:25:39 +01:00
parent 04a9ce3a18
commit 8d4b5fef1d
3 changed files with 21 additions and 24 deletions

View File

@ -11097,7 +11097,7 @@ static void ImGui::DockContextBuildNodesFromSettings(ImGuiContext* ctx, ImGuiDoc
node->SelectedTabID = settings->SelectedTabID;
node->SplitAxis = settings->SplitAxis;
if (settings->IsDockSpace)
node->Flags |= ImGuiDockNodeFlags_Dockspace;
node->Flags |= ImGuiDockNodeFlags_DockSpace;
node->IsCentralNode = settings->IsCentralNode != 0;
node->IsHiddenTabBar = settings->IsHiddenTabBar != 0;
@ -11613,7 +11613,7 @@ static void ImGui::DockNodeUpdateVisibleFlagAndInactiveChilds(ImGuiDockNode* nod
IM_ASSERT(node->ParentNode == NULL || node->ParentNode->ChildNodes[0] == node || node->ParentNode->ChildNodes[1] == node);
// Inherit most flags
ImGuiDockNodeFlags flags_to_inherit = ~ImGuiDockNodeFlags_Dockspace;
ImGuiDockNodeFlags flags_to_inherit = ~ImGuiDockNodeFlags_DockSpace;
if (node->ParentNode)
node->Flags = node->ParentNode->Flags & flags_to_inherit;
@ -12897,7 +12897,7 @@ void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags fla
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_DockingEnable))
return;
IM_ASSERT((flags & ImGuiDockNodeFlags_Dockspace) == 0);
IM_ASSERT((flags & ImGuiDockNodeFlags_DockSpace) == 0);
ImGuiDockNode* node = DockContextFindNodeByID(ctx, id);
if (!node)
{
@ -12907,15 +12907,15 @@ void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags fla
node->Flags = flags;
node->WindowClass = window_class ? *window_class : ImGuiWindowClass();
// When a Dockspace transitioned form implicit to explicit this may be called a second time
// 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.
if (node->LastFrameActive == g.FrameCount && !(flags & ImGuiDockNodeFlags_KeepAliveOnly))
{
IM_ASSERT(node->IsDockSpace() == false && "Cannot call DockSpace() twice a frame with the same ID");
node->Flags |= ImGuiDockNodeFlags_Dockspace;
node->Flags |= ImGuiDockNodeFlags_DockSpace;
return;
}
node->Flags |= ImGuiDockNodeFlags_Dockspace;
node->Flags |= ImGuiDockNodeFlags_DockSpace;
// Keep alive mode, this is allow windows docked into this node so stay docked even if they are not visible
if (flags & ImGuiDockNodeFlags_KeepAliveOnly)
@ -12984,7 +12984,7 @@ ImGuiID ImGui::DockSpaceOverViewport(ImGuiViewport* viewport, ImGuiDockNodeFlags
host_window_flags |= ImGuiWindowFlags_NoBackground;
char label[32];
ImFormatString(label, IM_ARRAYSIZE(label), "DockspaceViewport_%08X", viewport->ID);
ImFormatString(label, IM_ARRAYSIZE(label), "DockSpaceViewport_%08X", viewport->ID);
PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
@ -12992,7 +12992,7 @@ ImGuiID ImGui::DockSpaceOverViewport(ImGuiViewport* viewport, ImGuiDockNodeFlags
Begin(label, NULL, host_window_flags);
PopStyleVar(3);
ImGuiID dockspace_id = GetID("Dockspace");
ImGuiID dockspace_id = GetID("DockSpace");
DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags, window_class);
End();
@ -13059,7 +13059,7 @@ ImGuiID ImGui::DockBuilderAddNode(ImGuiID id, ImGuiDockNodeFlags flags)
{
ImGuiContext* ctx = GImGui;
ImGuiDockNode* node = NULL;
if (flags & ImGuiDockNodeFlags_Dockspace)
if (flags & ImGuiDockNodeFlags_DockSpace)
{
DockSpace(id, ImVec2(0, 0), flags | ImGuiDockNodeFlags_KeepAliveOnly);
node = DockContextFindNodeByID(ctx, id);
@ -13294,7 +13294,7 @@ void ImGui::DockBuilderCopyWindowSettings(const char* src_name, const char* dst_
}
// FIXME: Will probably want to change this signature, in particular how the window remapping pairs are passed.
void ImGui::DockBuilderCopyDockspace(ImGuiID src_dockspace_id, ImGuiID dst_dockspace_id, ImVector<const char*>* in_window_remap_pairs)
void ImGui::DockBuilderCopyDockSpace(ImGuiID src_dockspace_id, ImGuiID dst_dockspace_id, ImVector<const char*>* in_window_remap_pairs)
{
IM_ASSERT(src_dockspace_id != 0);
IM_ASSERT(dst_dockspace_id != 0);

View File

@ -4270,11 +4270,11 @@ void ShowExampleAppDockSpace(bool* p_open)
if (opt_fullscreen)
ImGui::PopStyleVar(2);
// Dockspace
// DockSpace
ImGuiIO& io = ImGui::GetIO();
if (io.ConfigFlags & ImGuiConfigFlags_DockingEnable)
{
ImGuiID dockspace_id = ImGui::GetID("MyDockspace");
ImGuiID dockspace_id = ImGui::GetID("MyDockSpace");
ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags);
}
else
@ -4420,13 +4420,13 @@ void ShowExampleAppDocuments(bool* p_open)
{
Target_None,
Target_Tab, // Create documents as local tab into a local tab bar
Target_DockspaceAndWindow // Create documents as regular windows, and create an embedded dockspace
Target_DockSpaceAndWindow // Create documents as regular windows, and create an embedded dockspace
};
static Target opt_target = Target_Tab;
static bool opt_reorderable = true;
static ImGuiTabBarFlags opt_fitting_flags = ImGuiTabBarFlags_FittingPolicyDefault_;
// When (opt_target == Target_DockspaceAndWindow) there is the possibily that one of our child Document window (e.g. "Eggplant")
// When (opt_target == Target_DockSpaceAndWindow) there is the possibily that one of our child Document window (e.g. "Eggplant")
// that we emit gets docked into the same spot as the parent window ("Example: Documents").
// This would create a problematic feedback loop because selecting the "Eggplant" tab would make the "Example: Documents" tab
// not visible, which in turn would stop submitting the "Eggplant" window.
@ -4434,7 +4434,7 @@ void ShowExampleAppDocuments(bool* p_open)
// Another solution may be to make the "Example: Documents" window use the ImGuiWindowFlags_NoDocking.
bool window_contents_visible = ImGui::Begin("Example: Documents", p_open, ImGuiWindowFlags_MenuBar);
if (!window_contents_visible && opt_target != Target_DockspaceAndWindow)
if (!window_contents_visible && opt_target != Target_DockSpaceAndWindow)
{
ImGui::End();
return;
@ -4486,7 +4486,7 @@ void ShowExampleAppDocuments(bool* p_open)
ImGui::PopItemWidth();
bool redock_all = false;
if (opt_target == Target_Tab) { ImGui::SameLine(); ImGui::Checkbox("Reorderable Tabs", &opt_reorderable); }
if (opt_target == Target_DockspaceAndWindow) { ImGui::SameLine(); redock_all = ImGui::Button("Redock all"); }
if (opt_target == Target_DockSpaceAndWindow) { ImGui::SameLine(); redock_all = ImGui::Button("Redock all"); }
ImGui::Separator();
@ -4531,7 +4531,7 @@ void ShowExampleAppDocuments(bool* p_open)
ImGui::EndTabBar();
}
}
else if (opt_target == Target_DockspaceAndWindow)
else if (opt_target == Target_DockSpaceAndWindow)
{
if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_DockingEnable)
{
@ -4548,9 +4548,6 @@ void ShowExampleAppDocuments(bool* p_open)
if (!doc->Open)
continue;
// FIXME-DOCK: SetNextWindowDock()
//ImGuiID default_dock_id = GetDockspaceRootDocumentDockID();
//ImGuiID default_dock_id = GetDockspacePreferedDocumentDockID();
ImGui::SetNextWindowDockID(dockspace_id, redock_all ? ImGuiCond_Always : ImGuiCond_FirstUseEver);
ImGuiWindowFlags window_flags = (doc->Dirty ? ImGuiWindowFlags_UnsavedDocument : 0);
bool visible = ImGui::Begin(doc->Name, &doc->Open, window_flags);

View File

@ -851,7 +851,7 @@ struct ImGuiTabBarRef
enum ImGuiDockNodeFlagsPrivate_
{
ImGuiDockNodeFlags_Dockspace = 1 << 10
ImGuiDockNodeFlags_DockSpace = 1 << 10
};
enum ImGuiDataAutority_
@ -904,7 +904,7 @@ struct ImGuiDockNode
ImGuiDockNode(ImGuiID id);
~ImGuiDockNode();
bool IsRootNode() const { return ParentNode == NULL; }
bool IsDockSpace() const { return (Flags & ImGuiDockNodeFlags_Dockspace) != 0; }
bool IsDockSpace() const { return (Flags & ImGuiDockNodeFlags_DockSpace) != 0; }
bool IsSplitNode() const { return ChildNodes[0] != NULL; }
bool IsLeafNode() const { return ChildNodes[0] == NULL; }
bool IsEmpty() const { return ChildNodes[0] == NULL && Windows.Size == 0; }
@ -1671,14 +1671,14 @@ namespace ImGui
IMGUI_API void DockBuilderDockWindow(const char* window_name, ImGuiID node_id);
IMGUI_API ImGuiDockNode*DockBuilderGetNode(ImGuiID node_id); // Warning: DO NOT HOLD ON ImGuiDockNode* pointer, will be invalided by any split/merge/remove operation.
inline ImGuiDockNode* DockBuilderGetCentralNode(ImGuiID node_id) { ImGuiDockNode* node = DockBuilderGetNode(node_id); if (!node) return NULL; return DockNodeGetRootNode(node)->CentralNode; }
IMGUI_API ImGuiID DockBuilderAddNode(ImGuiID node_id, ImGuiDockNodeFlags flags = 0); // Use (flags == ImGuiDockNodeFlags_Dockspace) to create a dockspace, otherwise it'll create a floating node.
IMGUI_API ImGuiID DockBuilderAddNode(ImGuiID node_id, ImGuiDockNodeFlags flags = 0); // Use (flags == ImGuiDockNodeFlags_DockSpace) to create a dockspace, otherwise it'll create a floating node.
IMGUI_API void DockBuilderRemoveNode(ImGuiID node_id); // Remove node and all its child, undock all windows
IMGUI_API void DockBuilderRemoveNodeDockedWindows(ImGuiID node_id, bool clear_persistent_docking_references = true);
IMGUI_API void DockBuilderRemoveNodeChildNodes(ImGuiID node_id); // Remove all split/hierarchy. All remaining docked windows will be re-docked to the root.
IMGUI_API void DockBuilderSetNodePos(ImGuiID node_id, ImVec2 pos);
IMGUI_API void DockBuilderSetNodeSize(ImGuiID node_id, ImVec2 size);
IMGUI_API ImGuiID DockBuilderSplitNode(ImGuiID node_id, ImGuiDir split_dir, float size_ratio_for_node_at_dir, ImGuiID* out_id_dir, ImGuiID* out_id_other);
IMGUI_API void DockBuilderCopyDockspace(ImGuiID src_dockspace_id, ImGuiID dst_dockspace_id, ImVector<const char*>* in_window_remap_pairs);
IMGUI_API void DockBuilderCopyDockSpace(ImGuiID src_dockspace_id, ImGuiID dst_dockspace_id, ImVector<const char*>* in_window_remap_pairs);
IMGUI_API void DockBuilderCopyNode(ImGuiID src_node_id, ImGuiID dst_node_id, ImVector<ImGuiID>* out_node_remap_pairs);
IMGUI_API void DockBuilderCopyWindowSettings(const char* src_name, const char* dst_name);
IMGUI_API void DockBuilderFinish(ImGuiID node_id);