@ -11073,15 +11073,15 @@ struct ImGuiDockPreviewData
struct ImGuiDockNodeSettings
{
ImGuiID ID ;
ImGuiID Parent ID;
ImGuiID Selected Tab ID;
ImGuiID Parent Node ID;
ImGuiID Selected Window ID;
signed char SplitAxis ;
char Depth ;
ImGuiDockNodeFlags Flags ; // NB: We save individual flags one by one in ascii format (ImGuiDockNodeFlags_SavedFlagsMask_)
ImVec2ih Pos ;
ImVec2ih Size ;
ImVec2ih SizeRef ;
ImGuiDockNodeSettings ( ) { ID = Parent ID = SelectedTab ID = 0 ; SplitAxis = ImGuiAxis_None ; Depth = 0 ; Flags = ImGuiDockNodeFlags_None ; }
ImGuiDockNodeSettings ( ) { ID = Parent NodeID = SelectedWindow ID = 0 ; SplitAxis = ImGuiAxis_None ; Depth = 0 ; Flags = ImGuiDockNodeFlags_None ; }
} ;
struct ImGuiDockContext
@ -11374,10 +11374,10 @@ static void ImGui::DockContextPruneUnusedSettingsNodes(ImGuiContext* ctx)
for ( int settings_n = 0 ; settings_n < dc - > SettingsNodes . Size ; settings_n + + )
{
ImGuiDockNodeSettings * settings = & dc - > SettingsNodes [ settings_n ] ;
ImGuiDockContextPruneNodeData * parent_data = settings - > Parent ID ? pool . GetByKey ( settings - > Parent ID) : 0 ;
ImGuiDockContextPruneNodeData * parent_data = settings - > Parent Node ID ? pool . GetByKey ( settings - > Parent Node ID) : 0 ;
pool . GetOrAddByKey ( settings - > ID ) - > RootID = parent_data ? parent_data - > RootID : settings - > ID ;
if ( settings - > Parent ID)
pool . GetOrAddByKey ( settings - > Parent ID) - > CountChildNodes + + ;
if ( settings - > Parent Node ID)
pool . GetOrAddByKey ( settings - > Parent Node ID) - > CountChildNodes + + ;
}
// Count reference to dock ids from window settings
@ -11400,8 +11400,8 @@ static void ImGui::DockContextPruneUnusedSettingsNodes(ImGuiContext* ctx)
ImGuiDockContextPruneNodeData * data_root = ( data - > RootID = = settings - > ID ) ? data : pool . GetByKey ( data - > RootID ) ;
bool remove = false ;
remove | = ( data - > CountWindows = = 1 & & settings - > Parent ID = = 0 & & data - > CountChildNodes = = 0 & & ! ( settings - > Flags & ImGuiDockNodeFlags_CentralNode ) ) ; // Floating root node with only 1 window
remove | = ( data - > CountWindows = = 0 & & settings - > Parent ID = = 0 & & data - > CountChildNodes = = 0 ) ; // Leaf nodes with 0 window
remove | = ( data - > CountWindows = = 1 & & settings - > Parent Node ID = = 0 & & data - > CountChildNodes = = 0 & & ! ( settings - > Flags & ImGuiDockNodeFlags_CentralNode ) ) ; // Floating root node with only 1 window
remove | = ( data - > CountWindows = = 0 & & settings - > Parent Node ID = = 0 & & data - > CountChildNodes = = 0 ) ; // Leaf nodes with 0 window
remove | = ( data_root - > CountChildWindows = = 0 ) ;
if ( remove )
{
@ -11421,7 +11421,7 @@ static void ImGui::DockContextBuildNodesFromSettings(ImGuiContext* ctx, ImGuiDoc
if ( settings - > ID = = 0 )
continue ;
ImGuiDockNode * node = DockContextAddNode ( ctx , settings - > ID ) ;
node - > ParentNode = settings - > Parent ID ? DockContextFindNodeByID ( ctx , settings - > Parent ID) : NULL ;
node - > ParentNode = settings - > Parent Node ID ? DockContextFindNodeByID ( ctx , settings - > Parent Node ID) : NULL ;
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 ) ;
@ -11430,7 +11430,7 @@ static void ImGui::DockContextBuildNodesFromSettings(ImGuiContext* ctx, ImGuiDoc
node - > ParentNode - > ChildNodes [ 0 ] = node ;
else if ( node - > ParentNode & & node - > ParentNode - > ChildNodes [ 1 ] = = NULL )
node - > ParentNode - > ChildNodes [ 1 ] = node ;
node - > SelectedTabID = settings - > Selected Tab ID;
node - > SelectedTabID = settings - > Selected Window ID;
node - > SplitAxis = settings - > SplitAxis ;
node - > LocalFlags | = ( settings - > Flags & ImGuiDockNodeFlags_SavedFlagsMask_ ) ;
@ -14164,9 +14164,9 @@ static void ImGui::DockSettingsHandler_ReadLine(ImGuiContext* ctx, ImGuiSettings
if ( strncmp ( line , " DockNode " , 8 ) = = 0 ) { line = ImStrSkipBlank ( line + strlen ( " DockNode " ) ) ; }
else if ( strncmp ( line , " DockSpace " , 9 ) = = 0 ) { line = ImStrSkipBlank ( line + strlen ( " DockSpace " ) ) ; node . Flags | = ImGuiDockNodeFlags_DockSpace ; }
else return ;
if ( sscanf ( line , " ID=0x%08X%n " , & node . ID , & r ) = = 1 ) { line + = r ; } else return ;
if ( sscanf ( line , " Parent=0x%08X%n " , & node . Parent ID, & r ) = = 1 ) { line + = r ; if ( node . Parent ID = = 0 ) return ; }
if ( node . Parent ID = = 0 )
if ( sscanf ( line , " ID=0x%08X%n " , & node . ID , & r ) = = 1 ) { line + = r ; } else return ;
if ( sscanf ( line , " Parent=0x%08X%n " , & node . Parent Node ID, & r ) = = 1 ) { line + = r ; if ( node . Parent Node ID = = 0 ) return ; }
if ( node . Parent Node ID = = 0 )
{
if ( sscanf ( line , " Pos=%i,%i%n " , & x , & y , & r ) = = 2 ) { line + = r ; node . Pos = ImVec2ih ( ( short ) x , ( short ) y ) ; } else return ;
if ( sscanf ( line , " Size=%i,%i%n " , & x , & y , & r ) = = 2 ) { line + = r ; node . Size = ImVec2ih ( ( short ) x , ( short ) y ) ; } else return ;
@ -14182,10 +14182,10 @@ static void ImGui::DockSettingsHandler_ReadLine(ImGuiContext* ctx, ImGuiSettings
if ( sscanf ( line , " HiddenTabBar=%d%n " , & x , & r ) = = 1 ) { line + = r ; if ( x ! = 0 ) node . Flags | = ImGuiDockNodeFlags_HiddenTabBar ; }
if ( sscanf ( line , " NoWindowMenuButton=%d%n " , & x , & r ) = = 1 ) { line + = r ; if ( x ! = 0 ) node . Flags | = ImGuiDockNodeFlags_NoWindowMenuButton ; }
if ( sscanf ( line , " NoCloseButton=%d%n " , & x , & r ) = = 1 ) { line + = r ; if ( x ! = 0 ) node . Flags | = ImGuiDockNodeFlags_NoCloseButton ; }
if ( sscanf ( line , " Selected Tab =0x%08X%n" , & node . Selected Tab ID, & r ) = = 1 ) { line + = r ; }
if ( sscanf ( line , " Selected =0x%08X%n" , & node . Selected Window ID, & r ) = = 1 ) { line + = r ; }
ImGuiDockContext * dc = ctx - > DockContext ;
if ( node . Parent ID ! = 0 )
if ( ImGuiDockNodeSettings * parent_settings = DockSettingsFindNodeSettings ( ctx , node . Parent ID) )
if ( node . Parent Node ID ! = 0 )
if ( ImGuiDockNodeSettings * parent_settings = DockSettingsFindNodeSettings ( ctx , node . Parent Node ID) )
node . Depth = parent_settings - > Depth + 1 ;
dc - > SettingsNodes . push_back ( node ) ;
}
@ -14195,8 +14195,8 @@ static void DockSettingsHandler_DockNodeToSettings(ImGuiDockContext* dc, ImGuiDo
ImGuiDockNodeSettings node_settings ;
IM_ASSERT ( depth < ( 1 < < ( sizeof ( node_settings . Depth ) < < 3 ) ) ) ;
node_settings . ID = node - > ID ;
node_settings . Parent ID = node - > ParentNode ? node - > ParentNode - > ID : 0 ;
node_settings . Selected Tab ID = node - > SelectedTabID ;
node_settings . Parent Node ID = node - > ParentNode ? node - > ParentNode - > ID : 0 ;
node_settings . Selected Window ID = node - > SelectedTabID ;
node_settings . SplitAxis = node - > IsSplitNode ( ) ? ( char ) node - > SplitAxis : ImGuiAxis_None ;
node_settings . Depth = ( char ) depth ;
node_settings . Flags = ( node - > LocalFlags & ImGuiDockNodeFlags_SavedFlagsMask_ ) ;
@ -14238,8 +14238,8 @@ static void ImGui::DockSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettings
const ImGuiDockNodeSettings * node_settings = & dc - > SettingsNodes [ node_n ] ;
buf - > appendf ( " %*s%s%*s " , node_settings - > Depth * 2 , " " , ( node_settings - > Flags & ImGuiDockNodeFlags_DockSpace ) ? " 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 ) ;
if ( node_settings - > Parent ID)
buf - > appendf ( " Parent=0x%08X SizeRef=%d,%d " , node_settings - > Parent ID, node_settings - > SizeRef . x , node_settings - > SizeRef . y ) ;
if ( node_settings - > Parent Node ID)
buf - > appendf ( " Parent=0x%08X SizeRef=%d,%d " , node_settings - > Parent Node ID, node_settings - > SizeRef . x , node_settings - > SizeRef . y ) ;
else
buf - > appendf ( " Pos=%d,%d Size=%d,%d " , node_settings - > Pos . x , node_settings - > Pos . y , node_settings - > Size . x , node_settings - > Size . y ) ;
if ( node_settings - > SplitAxis ! = ImGuiAxis_None )
@ -14256,8 +14256,8 @@ static void ImGui::DockSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettings
buf - > appendf ( " NoWindowMenuButton=1 " ) ;
if ( node_settings - > Flags & ImGuiDockNodeFlags_NoCloseButton )
buf - > appendf ( " NoCloseButton=1 " ) ;
if ( node_settings - > Selected Tab ID)
buf - > appendf ( " Selected Tab =0x%08X" , node_settings - > Selected Tab ID) ;
if ( node_settings - > Selected Window ID)
buf - > appendf ( " Selected =0x%08X" , node_settings - > Selected Window ID) ;
# if IMGUI_DEBUG_INI_SETTINGS
// [DEBUG] Include comments in the .ini file to ease debugging
@ -14844,14 +14844,14 @@ void ImGui::ShowMetricsWindow(bool* p_open)
{
ImGuiDockNodeSettings * settings = & dc - > SettingsNodes [ n ] ;
const char * selected_tab_name = NULL ;
if ( settings - > Selected Tab ID)
if ( settings - > Selected Window ID)
{
if ( ImGuiWindow * window = FindWindowByID ( settings - > Selected Tab ID) )
if ( ImGuiWindow * window = FindWindowByID ( settings - > Selected Window ID) )
selected_tab_name = window - > Name ;
else if ( ImGuiWindowSettings * window_settings = FindWindowSettings ( settings - > Selected Tab ID) )
else if ( ImGuiWindowSettings * window_settings = FindWindowSettings ( settings - > Selected Window ID) )
selected_tab_name = window_settings - > Name ;
}
ImGui : : BulletText ( " Node %08X, Parent %08X, SelectedTab %08X ('%s') " , settings - > ID , settings - > Parent ID, settings - > Selected Tab ID, selected_tab_name ? selected_tab_name : settings - > Selected Tab ID ? " N/A " : " " ) ;
ImGui : : BulletText ( " Node %08X, Parent %08X, SelectedTab %08X ('%s') " , settings - > ID , settings - > Parent Node ID, settings - > Selected Window ID, selected_tab_name ? selected_tab_name : settings - > Selected Window ID ? " N/A " : " " ) ;
}
ImGui : : TreePop ( ) ;
}