@ -10204,6 +10204,7 @@ namespace ImGui
static void DockNodeUpdate ( ImGuiDockNode * node ) ;
static void DockNodeUpdateVisibleFlagAndInactiveChilds ( ImGuiDockNode * node ) ;
static void DockNodeUpdateTabBar ( ImGuiDockNode * node , ImGuiWindow * host_window ) ;
static ImGuiID DockNodeUpdateTabListMenu ( ImGuiDockNode * node , ImGuiTabBar * tab_bar ) ;
static void DockNodeUpdateVisibleFlag ( ImGuiDockNode * node ) ;
static void DockNodeStartMouseMovingWindow ( ImGuiDockNode * node , ImGuiWindow * window ) ;
static bool DockNodeIsDropAllowed ( ImGuiWindow * host_window , ImGuiWindow * payload_window ) ;
@ -11370,6 +11371,36 @@ static int IMGUI_CDECL TabItemComparerByDockOrder(const void* lhs, const void* r
return ( a - > BeginOrderWithinContext - b - > BeginOrderWithinContext ) ;
}
static ImGuiID ImGui : : DockNodeUpdateTabListMenu ( ImGuiDockNode * node , ImGuiTabBar * tab_bar )
{
// Try to position the menu so it is more likely to stays within the same viewport
ImGuiID ret_tab_id = 0 ;
SetNextWindowPos ( ImVec2 ( node - > Pos . x , node - > Pos . y + GetFrameHeight ( ) ) ) ;
if ( BeginPopup ( " #TabListMenu " ) )
{
node - > IsFocused = true ;
if ( tab_bar - > Tabs . Size = = 1 )
{
if ( MenuItem ( " Hide tab bar " , NULL , node - > IsHiddenTabBar ) )
node - > WantHiddenTabBarToggle = true ;
}
else
{
for ( int tab_n = 0 ; tab_n < tab_bar - > Tabs . Size ; tab_n + + )
{
ImGuiTabItem * tab = & tab_bar - > Tabs [ tab_n ] ;
IM_ASSERT ( tab - > Window ! = NULL ) ;
if ( Selectable ( tab - > Window - > Name , tab - > ID = = tab_bar - > SelectedTabId ) )
ret_tab_id = tab - > ID ;
SameLine ( ) ;
Text ( " " ) ;
}
}
EndPopup ( ) ;
}
return ret_tab_id ;
}
static void ImGui : : DockNodeUpdateTabBar ( ImGuiDockNode * node , ImGuiWindow * host_window )
{
ImGuiContext & g = * GImGui ;
@ -11423,38 +11454,17 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w
tab_bar = node - > TabBar = IM_NEW ( ImGuiTabBar ) ( ) ;
ImGuiID focus_tab_id = 0 ;
node - > IsFocused = is_focused ;
// Collapse button changes shape and display a list
if ( IsPopupOpen ( " #TabListMenu " ) )
{
// Try to position the menu so it is more likely to stays within the same viewport
SetNextWindowPos ( ImVec2 ( node - > Pos . x , node - > Pos . y + GetFrameHeight ( ) ) ) ;
if ( BeginPopup ( " #TabListMenu " ) )
{
is_focused = true ;
if ( tab_bar - > Tabs . Size = = 1 )
{
if ( MenuItem ( " Hide tab bar " , NULL , node - > IsHiddenTabBar ) )
node - > WantHiddenTabBarToggle = true ;
}
else
{
for ( int tab_n = 0 ; tab_n < tab_bar - > Tabs . Size ; tab_n + + )
{
ImGuiTabItem * tab = & tab_bar - > Tabs [ tab_n ] ;
IM_ASSERT ( tab - > Window ! = NULL ) ;
if ( Selectable ( tab - > Window - > Name , tab - > ID = = tab_bar - > SelectedTabId ) )
focus_tab_id = tab_bar - > NextSelectedTabId = tab - > ID ;
SameLine ( ) ;
Text ( " " ) ;
}
}
EndPopup ( ) ;
}
if ( ImGuiID tab_id = DockNodeUpdateTabListMenu ( node , tab_bar ) )
focus_tab_id = tab_bar - > NextSelectedTabId = tab_id ;
is_focused | = node - > IsFocused ;
}
// Title bar
node - > IsFocused = is_focused ;
if ( is_focused )
node - > LastFrameFocused = g . FrameCount ;
ImRect title_bar_rect = ImRect ( node - > Pos , node - > Pos + ImVec2 ( node - > Size . x , g . FontSize + style . FramePadding . y * 2.0f ) ) ;
@ -12134,10 +12144,10 @@ void ImGui::DockNodeTreeUpdateSplitter(ImGuiDockNode* node)
// [DEBUG] Render limits
ImDrawList * draw_list = node - > HostWindow ? GetOverlayDrawList ( node - > HostWindow ) : GetOverlayDrawList ( ( ImGuiViewportP * ) GetMainViewport ( ) ) ;
for ( int n = 0 ; n < 2 ; n + + )
if ( axis = = ImGuiAxis_X )
draw_list - > AddLine ( ImVec2 ( resize_limits [ n ] , node - > ChildNodes [ n ] - > Pos . y ) , ImVec2 ( resize_limits [ n ] , node - > ChildNodes [ n ] - > Pos . y + node - > ChildNodes [ n ] - > Size . y ) , IM_COL32 ( 255 , 0 , 255 , 255 ) , 3.0f ) ;
else
draw_list - > AddLine ( ImVec2 ( node - > ChildNodes [ n ] - > Pos . x , resize_limits [ n ] ) , ImVec2 ( node - > ChildNodes [ n ] - > Pos . x + node - > ChildNodes [ n ] - > Size . x , resize_limits [ n ] ) , IM_COL32 ( 255 , 0 , 255 , 255 ) , 3.0f ) ;
if ( axis = = ImGuiAxis_X )
draw_list - > AddLine ( ImVec2 ( resize_limits [ n ] , node - > ChildNodes [ n ] - > Pos . y ) , ImVec2 ( resize_limits [ n ] , node - > ChildNodes [ n ] - > Pos . y + node - > ChildNodes [ n ] - > Size . y ) , IM_COL32 ( 255 , 0 , 255 , 255 ) , 3.0f ) ;
else
draw_list - > AddLine ( ImVec2 ( node - > ChildNodes [ n ] - > Pos . x , resize_limits [ n ] ) , ImVec2 ( node - > ChildNodes [ n ] - > Pos . x + node - > ChildNodes [ n ] - > Size . x , resize_limits [ n ] ) , IM_COL32 ( 255 , 0 , 255 , 255 ) , 3.0f ) ;
*/
}
@ -12156,7 +12166,6 @@ void ImGui::DockNodeTreeUpdateSplitter(ImGuiDockNode* node)
// Lock the size of every node that is a sibling of the node we are touching
// This might be less desirable if we can merge sibling of a same axis into the same parental level.
# if 1
for ( int side_n = 0 ; side_n < 2 ; side_n + + )
for ( int touching_node_n = 0 ; touching_node_n < touching_nodes [ side_n ] . Size ; touching_node_n + + )
{
@ -12176,7 +12185,6 @@ void ImGui::DockNodeTreeUpdateSplitter(ImGuiDockNode* node)
touching_node = touching_node - > ParentNode ;
}
}
# endif
DockNodeTreeUpdatePosSize ( child_0 , child_0 - > Pos , child_0 - > Size ) ;
DockNodeTreeUpdatePosSize ( child_1 , child_1 - > Pos , child_1 - > Size ) ;
@ -12767,7 +12775,6 @@ void ImGui::BeginDocked(ImGuiWindow* window, bool* p_open)
ImGuiContext & g = * ctx ;
const bool auto_dock_node = ( g . IO . ConfigDockingTabBarOnSingleWindows ) & & ! ( window - > Flags & ( ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoDocking ) ) ;
if ( auto_dock_node )
{
if ( window - > DockId = = 0 )
@ -12861,7 +12868,6 @@ void ImGui::BeginDocked(ImGuiWindow* window, bool* p_open)
window - > DockTabIsVisible = false ;
return ;
}
IM_ASSERT ( node - > HostWindow ) ;
IM_ASSERT ( node - > IsLeafNode ( ) ) ;
@ -12869,7 +12875,6 @@ void ImGui::BeginDocked(ImGuiWindow* window, bool* p_open)
SetNextWindowPos ( node - > Pos ) ;
SetNextWindowSize ( node - > Size ) ;
g . NextWindowData . PosUndock = false ; // Cancel implicit undocking of SetNextWindowPos()
window - > DockIsActive = true ;
window - > DockTabIsVisible = false ;
if ( node - > Flags & ImGuiDockNodeFlags_KeepAliveOnly )
@ -12931,7 +12936,6 @@ void ImGui::BeginAsDockableDragDropTarget(ImGuiWindow* window)
IM_ASSERT ( ( window - > Flags & ImGuiWindowFlags_NoDocking ) = = 0 ) ;
if ( ! g . DragDropActive )
return ;
if ( ! BeginDragDropTargetCustom ( window - > Rect ( ) , window - > ID ) )
return ;
@ -13027,7 +13031,7 @@ static void ImGui::DockSettingsRemoveNodeReferences(ImGuiID* node_ids, int node_
}
}
static ImGuiDockNodeSettings * ImGui : : DockSettingsFindNodeSettings ( ImGuiContext * ctx , ImGuiID id )
static ImGuiDockNodeSettings * ImGui : : DockSettingsFindNodeSettings ( ImGuiContext * ctx , ImGuiID id )
{
// FIXME-OPT
ImGuiDockContext * dc = ctx - > DockContext ;
@ -13126,9 +13130,7 @@ static void ImGui::DockSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettings
buf - > appendf ( " [%s][Data] \n " , handler - > TypeName ) ;
for ( int node_n = 0 ; node_n < dc - > SettingsNodes . Size ; node_n + + )
{
# if IMGUI_DEBUG_DOCKING_INI
const int line_start_pos = buf - > size ( ) ;
# endif
const int line_start_pos = buf - > size ( ) ; ( void ) line_start_pos ;
const ImGuiDockNodeSettings * node_settings = & dc - > SettingsNodes [ node_n ] ;
buf - > appendf ( " %*s%s%*s " , node_settings - > Depth * 2 , " " , node_settings - > IsDockSpace ? " DockSpace " : " DockNode " , ( max_depth - node_settings - > Depth ) * 2 , " " ) ; // Text align nodes to facilitate looking at .ini file
buf - > appendf ( " ID=0x%08X " , node_settings - > ID ) ;