mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 21:21:06 +01:00 
			
		
		
		
	Docking: Rename typo Autority -> Authority + Rename DockContextNewFrameUpdateDocking -> DockContextUpdateDocking.
This commit is contained in:
		
							
								
								
									
										64
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										64
									
								
								imgui.cpp
									
									
									
									
									
								
							| @@ -3734,7 +3734,7 @@ void ImGui::NewFrame() | ||||
|  | ||||
|     // Undocking | ||||
|     // (needs to be before UpdateMouseMovingWindowNewFrame so the window is already offset and following the mouse on the detaching frame) | ||||
|     DockContextNewFrameUpdateUndocking(&g); | ||||
|     DockContextUpdateUndocking(&g); | ||||
|  | ||||
|     // Find hovered window | ||||
|     // (needs to be before UpdateMouseMovingWindowNewFrame so we fill g.HoveredWindowUnderMovingWindow on the mouse release frame) | ||||
| @@ -3810,7 +3810,7 @@ void ImGui::NewFrame() | ||||
|     ClosePopupsOverWindow(g.NavWindow); | ||||
|  | ||||
|     // Docking | ||||
|     DockContextNewFrameUpdateDocking(&g); | ||||
|     DockContextUpdateDocking(&g); | ||||
|  | ||||
|     // Create implicit/fallback window - which we will only render it if the user has added something to it. | ||||
|     // We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags. | ||||
| @@ -10979,7 +10979,7 @@ void ImGui::DockContextRebuild(ImGuiContext* ctx) | ||||
| } | ||||
|  | ||||
| // Docking context update function, called by NewFrame() | ||||
| void ImGui::DockContextNewFrameUpdateUndocking(ImGuiContext* ctx) | ||||
| void ImGui::DockContextUpdateUndocking(ImGuiContext* ctx) | ||||
| { | ||||
|     ImGuiContext& g = *ctx; | ||||
|     ImGuiDockContext* dc = ctx->DockContext; | ||||
| @@ -11023,7 +11023,7 @@ void ImGui::DockContextNewFrameUpdateUndocking(ImGuiContext* ctx) | ||||
| } | ||||
|  | ||||
| // Docking context update function, called by NewFrame() | ||||
| void ImGui::DockContextNewFrameUpdateDocking(ImGuiContext* ctx) | ||||
| void ImGui::DockContextUpdateDocking(ImGuiContext* ctx) | ||||
| { | ||||
|     ImGuiContext& g = *ctx; | ||||
|     ImGuiDockContext* dc = ctx->DockContext; | ||||
| @@ -11181,7 +11181,7 @@ static void ImGui::DockContextBuildNodesFromSettings(ImGuiContext* ctx, ImGuiDoc | ||||
|         node->Pos = ImVec2(settings->Pos.x, settings->Pos.y); | ||||
|         node->Size = ImVec2(settings->Size.x, settings->Size.y); | ||||
|         node->SizeRef = ImVec2(settings->SizeRef.x, settings->SizeRef.y); | ||||
|         node->AutorityForPos = node->AutorityForSize = node->AutorityForViewport = ImGuiDataAutority_DockNode; | ||||
|         node->AuthorityForPos = node->AuthorityForSize = node->AuthorityForViewport = ImGuiDataAuthority_DockNode; | ||||
|         if (node->ParentNode && node->ParentNode->ChildNodes[0] == NULL) | ||||
|             node->ParentNode->ChildNodes[0] = node; | ||||
|         else if (node->ParentNode && node->ParentNode->ChildNodes[1] == NULL) | ||||
| @@ -11423,9 +11423,9 @@ void ImGui::DockContextProcessUndockNode(ImGuiContext* ctx, ImGuiDockNode* node) | ||||
|         int index_in_parent = (node->ParentNode->ChildNodes[0] == node) ? 0 : 1; | ||||
|         node->ParentNode->ChildNodes[index_in_parent] = NULL; | ||||
|         DockNodeTreeMerge(ctx, node->ParentNode, node->ParentNode->ChildNodes[index_in_parent ^ 1]); | ||||
|         node->ParentNode->AutorityForViewport = ImGuiDataAutority_Window; // The node that stays in place keeps the viewport, so our newly dragged out node will create a new viewport | ||||
|         node->ParentNode->AuthorityForViewport = ImGuiDataAuthority_Window; // The node that stays in place keeps the viewport, so our newly dragged out node will create a new viewport | ||||
|         node->ParentNode = NULL; | ||||
|         node->AutorityForPos = node->AutorityForSize = ImGuiDataAutority_Window; | ||||
|         node->AuthorityForPos = node->AuthorityForSize = ImGuiDataAuthority_Window; | ||||
|         node->WantMouseMove = true; | ||||
|     } | ||||
|     MarkIniSettingsDirty(); | ||||
| @@ -11449,8 +11449,8 @@ ImGuiDockNode::ImGuiDockNode(ImGuiID id) | ||||
|     LastFocusedNodeID = 0; | ||||
|     SelectedTabID = 0; | ||||
|     WantCloseTabID = 0; | ||||
|     AutorityForPos = AutorityForSize = ImGuiDataAutority_DockNode; | ||||
|     AutorityForViewport = ImGuiDataAutority_Auto; | ||||
|     AuthorityForPos = AuthorityForSize = ImGuiDataAuthority_DockNode; | ||||
|     AuthorityForViewport = ImGuiDataAuthority_Auto; | ||||
|     IsVisible = true; | ||||
|     IsFocused = HasCloseButton = HasCollapseButton = false; | ||||
|     WantCloseAll = WantLockSizeOnce = WantMouseMove = WantHiddenTabBarUpdate = WantHiddenTabBarToggle = false; | ||||
| @@ -11502,12 +11502,12 @@ static void ImGui::DockNodeAddWindow(ImGuiDockNode* node, ImGuiWindow* window, b | ||||
|     // In particular it is important we init the viewport from the first window so we don't create two viewports and drop one. | ||||
|     if (node->HostWindow == NULL && !node->IsDockSpace() && node->IsRootNode()) | ||||
|     { | ||||
|         if (node->AutorityForPos == ImGuiDataAutority_Auto) | ||||
|             node->AutorityForPos = ImGuiDataAutority_Window; | ||||
|         if (node->AutorityForSize == ImGuiDataAutority_Auto) | ||||
|             node->AutorityForSize = ImGuiDataAutority_Window; | ||||
|         if (node->AutorityForViewport == ImGuiDataAutority_Auto) | ||||
|             node->AutorityForViewport = ImGuiDataAutority_Window; | ||||
|         if (node->AuthorityForPos == ImGuiDataAuthority_Auto) | ||||
|             node->AuthorityForPos = ImGuiDataAuthority_Window; | ||||
|         if (node->AuthorityForSize == ImGuiDataAuthority_Auto) | ||||
|             node->AuthorityForSize = ImGuiDataAuthority_Window; | ||||
|         if (node->AuthorityForViewport == ImGuiDataAuthority_Auto) | ||||
|             node->AuthorityForViewport = ImGuiDataAuthority_Window; | ||||
|     } | ||||
|  | ||||
|     // Add to tab bar if requested | ||||
| @@ -11847,7 +11847,7 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node) | ||||
|         } | ||||
|  | ||||
|         DockNodeHideHostWindow(node); | ||||
|         node->AutorityForPos = node->AutorityForSize = node->AutorityForViewport = ImGuiDataAutority_Window; | ||||
|         node->AuthorityForPos = node->AuthorityForSize = node->AuthorityForViewport = ImGuiDataAuthority_Window; | ||||
|         node->WantCloseAll = false; | ||||
|         node->WantCloseTabID = 0; | ||||
|         node->HasCloseButton = node->HasCollapseButton = false; | ||||
| @@ -11886,23 +11886,23 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node) | ||||
|             ImGuiWindow* ref_window = (node->Windows.Size > 0) ? node->Windows[0] : NULL; | ||||
|  | ||||
|             // Sync Pos | ||||
|             if (node->AutorityForPos == ImGuiDataAutority_Window && ref_window) | ||||
|             if (node->AuthorityForPos == ImGuiDataAuthority_Window && ref_window) | ||||
|                 SetNextWindowPos(ref_window->Pos); | ||||
|             else if (node->AutorityForPos == ImGuiDataAutority_DockNode) | ||||
|             else if (node->AuthorityForPos == ImGuiDataAuthority_DockNode) | ||||
|                 SetNextWindowPos(node->Pos); | ||||
|  | ||||
|             // Sync Size | ||||
|             if (node->AutorityForSize == ImGuiDataAutority_Window && ref_window) | ||||
|             if (node->AuthorityForSize == ImGuiDataAuthority_Window && ref_window) | ||||
|                 SetNextWindowSize(ref_window->SizeFull); | ||||
|             else if (node->AutorityForSize == ImGuiDataAutority_DockNode) | ||||
|             else if (node->AuthorityForSize == ImGuiDataAuthority_DockNode) | ||||
|                 SetNextWindowSize(node->Size); | ||||
|  | ||||
|             // Sync Collapsed | ||||
|             if (node->AutorityForSize == ImGuiDataAutority_Window && ref_window) | ||||
|             if (node->AuthorityForSize == ImGuiDataAuthority_Window && ref_window) | ||||
|                 SetNextWindowCollapsed(ref_window->Collapsed); | ||||
|  | ||||
|             // Sync Viewport | ||||
|             if (node->AutorityForViewport == ImGuiDataAutority_Window && ref_window) | ||||
|             if (node->AuthorityForViewport == ImGuiDataAuthority_Window && ref_window) | ||||
|                 SetNextWindowViewport(ref_window->ViewportId); | ||||
|  | ||||
|             SetNextWindowClass(&node->WindowClass); | ||||
| @@ -11935,12 +11935,12 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node) | ||||
|             if (node->HostWindow->Appearing) | ||||
|                 BringWindowToDisplayFront(node->HostWindow); | ||||
|  | ||||
|             node->AutorityForPos = node->AutorityForSize = node->AutorityForViewport = ImGuiDataAutority_Auto; | ||||
|             node->AuthorityForPos = node->AuthorityForSize = node->AuthorityForViewport = ImGuiDataAuthority_Auto; | ||||
|         } | ||||
|         else if (node->ParentNode) | ||||
|         { | ||||
|             node->HostWindow = host_window = node->ParentNode->HostWindow; | ||||
|             node->AutorityForPos = node->AutorityForSize = node->AutorityForViewport = ImGuiDataAutority_Auto; | ||||
|             node->AuthorityForPos = node->AuthorityForSize = node->AuthorityForViewport = ImGuiDataAuthority_Auto; | ||||
|         } | ||||
|         if (node->WantMouseMove && node->HostWindow) | ||||
|             DockNodeStartMouseMovingWindow(node, node->HostWindow); | ||||
| @@ -12700,7 +12700,7 @@ void ImGui::DockNodeTreeMerge(ImGuiContext* ctx, ImGuiDockNode* parent_node, ImG | ||||
|         DockSettingsRenameNodeReferences(child_1->ID, parent_node->ID); | ||||
|     } | ||||
|     DockNodeApplyPosSizeToWindows(parent_node); | ||||
|     parent_node->AutorityForPos = parent_node->AutorityForSize = parent_node->AutorityForViewport = ImGuiDataAutority_Auto; | ||||
|     parent_node->AuthorityForPos = parent_node->AuthorityForSize = parent_node->AuthorityForViewport = ImGuiDataAuthority_Auto; | ||||
|     parent_node->VisibleWindow = merge_lead_child->VisibleWindow; | ||||
|     parent_node->SizeRef = backup_last_explicit_size; | ||||
|  | ||||
| @@ -13141,7 +13141,7 @@ void ImGui::DockBuilderSetNodePos(ImGuiID node_id, ImVec2 pos) | ||||
|     if (node == NULL) | ||||
|         return; | ||||
|     node->Pos = pos; | ||||
|     node->AutorityForPos = ImGuiDataAutority_DockNode; | ||||
|     node->AuthorityForPos = ImGuiDataAuthority_DockNode; | ||||
| } | ||||
|  | ||||
| void ImGui::DockBuilderSetNodeSize(ImGuiID node_id, ImVec2 size) | ||||
| @@ -13151,7 +13151,7 @@ void ImGui::DockBuilderSetNodeSize(ImGuiID node_id, ImVec2 size) | ||||
|     if (node == NULL) | ||||
|         return; | ||||
|     node->Size = node->SizeRef = size; | ||||
|     node->AutorityForSize = ImGuiDataAutority_DockNode; | ||||
|     node->AuthorityForSize = ImGuiDataAuthority_DockNode; | ||||
| } | ||||
|  | ||||
| // If you create a regular node, both ref_pos/ref_size will position the window. | ||||
| @@ -13200,8 +13200,8 @@ void ImGui::DockBuilderRemoveNodeChildNodes(ImGuiID root_id) | ||||
|         return; | ||||
|     bool has_central_node = false; | ||||
|  | ||||
|     ImGuiDataAutority backup_root_node_autority_for_pos = root_node ? root_node->AutorityForPos : ImGuiDataAutority_Auto; | ||||
|     ImGuiDataAutority backup_root_node_autority_for_size = root_node ? root_node->AutorityForSize : ImGuiDataAutority_Auto; | ||||
|     ImGuiDataAuthority backup_root_node_authority_for_pos = root_node ? root_node->AuthorityForPos : ImGuiDataAuthority_Auto; | ||||
|     ImGuiDataAuthority backup_root_node_authority_for_size = root_node ? root_node->AuthorityForSize : ImGuiDataAuthority_Auto; | ||||
|  | ||||
|     // Process active windows | ||||
|     ImVector<ImGuiDockNode*> nodes_to_remove; | ||||
| @@ -13225,8 +13225,8 @@ void ImGui::DockBuilderRemoveNodeChildNodes(ImGuiID root_id) | ||||
|     // Make sure we don't lose our current pos/size. (FIXME-DOCK: Consider tidying up that code in DockNodeAddWindow instead) | ||||
|     if (root_node) | ||||
|     { | ||||
|         root_node->AutorityForPos = backup_root_node_autority_for_pos; | ||||
|         root_node->AutorityForSize = backup_root_node_autority_for_size; | ||||
|         root_node->AuthorityForPos = backup_root_node_authority_for_pos; | ||||
|         root_node->AuthorityForSize = backup_root_node_authority_for_size; | ||||
|     } | ||||
|  | ||||
|     // Apply to settings | ||||
| @@ -13527,7 +13527,7 @@ void ImGui::BeginDocked(ImGuiWindow* window, bool* p_open) | ||||
|         if (node == NULL) | ||||
|         { | ||||
|             node = DockContextAddNode(ctx, window->DockId); | ||||
|             node->AutorityForPos = node->AutorityForSize = node->AutorityForViewport = ImGuiDataAutority_Window; | ||||
|             node->AuthorityForPos = node->AuthorityForSize = node->AuthorityForViewport = ImGuiDataAuthority_Window; | ||||
|             if (auto_dock_node) | ||||
|                 node->LastFrameAlive = g.FrameCount; | ||||
|         } | ||||
|   | ||||
| @@ -84,8 +84,8 @@ struct ImGuiWindowTempData;         // Temporary storage for one window (that's | ||||
| struct ImGuiWindowSettings;         // Storage for window settings stored in .ini file (we keep one of those even if the actual window wasn't instanced during this session) | ||||
|  | ||||
| // Use your programming IDE "Go to definition" facility on the names of the center columns to find the actual flags/enum lists. | ||||
| typedef int ImGuiDataAuthority;     // -> enum ImGuiDataAuthority_     // Enum: for storing the source authority (dock node vs window) of a field | ||||
| typedef int ImGuiLayoutType;        // -> enum ImGuiLayoutType_        // Enum: Horizontal or vertical | ||||
| typedef int ImGuiDataAutority;      // -> enum ImGuiDataAutority_      // Enum: for storing the source autority (dock node vs window) of a field | ||||
| typedef int ImGuiButtonFlags;       // -> enum ImGuiButtonFlags_       // Flags: for ButtonEx(), ButtonBehavior() | ||||
| typedef int ImGuiDragFlags;         // -> enum ImGuiDragFlags_         // Flags: for DragBehavior() | ||||
| typedef int ImGuiItemFlags;         // -> enum ImGuiItemFlags_         // Flags: for PushItemFlag() | ||||
| @@ -865,11 +865,12 @@ enum ImGuiDockNodeFlagsPrivate_ | ||||
|     ImGuiDockNodeFlags_LocalFlagsTransferMask_  = ImGuiDockNodeFlags_LocalFlagsMask_ & ~ImGuiDockNodeFlags_DockSpace  // When splitting those flags are moved to the inheriting child, never duplicated | ||||
| }; | ||||
|  | ||||
| enum ImGuiDataAutority_ | ||||
| // Store the source authority (dock node vs window) of a field | ||||
| enum ImGuiDataAuthority_ | ||||
| { | ||||
|     ImGuiDataAutority_Auto, | ||||
|     ImGuiDataAutority_DockNode, | ||||
|     ImGuiDataAutority_Window | ||||
|     ImGuiDataAuthority_Auto, | ||||
|     ImGuiDataAuthority_DockNode, | ||||
|     ImGuiDataAuthority_Window | ||||
| }; | ||||
|  | ||||
| // sizeof() 116~160 | ||||
| @@ -898,9 +899,9 @@ struct ImGuiDockNode | ||||
|     ImGuiID                 LastFocusedNodeID;          // [Root node only] Which of our child docking node (any ancestor in the hierarchy) was last focused. | ||||
|     ImGuiID                 SelectedTabID;              // [Tab node only] Which of our tab is selected. | ||||
|     ImGuiID                 WantCloseTabID;             // [Tab node only] Set when closing a specific tab. | ||||
|     ImGuiDataAutority       AutorityForPos          :3; | ||||
|     ImGuiDataAutority       AutorityForSize         :3; | ||||
|     ImGuiDataAutority       AutorityForViewport     :3; | ||||
|     ImGuiDataAuthority      AuthorityForPos         :3; | ||||
|     ImGuiDataAuthority      AuthorityForSize        :3; | ||||
|     ImGuiDataAuthority      AuthorityForViewport    :3; | ||||
|     bool                    IsVisible               :1; // Set to false when the node is hidden (usually disabled as it has no active window) | ||||
|     bool                    IsFocused               :1; | ||||
|     bool                    HasCloseButton          :1; | ||||
| @@ -1672,8 +1673,8 @@ namespace ImGui | ||||
|     IMGUI_API void          DockContextShutdown(ImGuiContext* ctx); | ||||
|     IMGUI_API void          DockContextOnLoadSettings(ImGuiContext* ctx); | ||||
|     IMGUI_API void          DockContextRebuild(ImGuiContext* ctx); | ||||
|     IMGUI_API void          DockContextNewFrameUpdateUndocking(ImGuiContext* ctx); | ||||
|     IMGUI_API void          DockContextNewFrameUpdateDocking(ImGuiContext* ctx); | ||||
|     IMGUI_API void          DockContextUpdateUndocking(ImGuiContext* ctx); | ||||
|     IMGUI_API void          DockContextUpdateDocking(ImGuiContext* ctx); | ||||
|     IMGUI_API void          DockContextQueueDock(ImGuiContext* ctx, ImGuiWindow* target, ImGuiDockNode* target_node, ImGuiWindow* payload, ImGuiDir split_dir, float split_ratio, bool split_outer); | ||||
|     IMGUI_API void          DockContextQueueUndockWindow(ImGuiContext* ctx, ImGuiWindow* window); | ||||
|     IMGUI_API void          DockContextQueueUndockNode(ImGuiContext* ctx, ImGuiDockNode* node); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user