@ -11073,15 +11073,15 @@ struct ImGuiDockPreviewData
struct ImGuiDockNodeSettings
{
ImGuiID ID ;
ImGuiID ParentID ;
ImGuiID SelectedTab ID ;
ImGuiID ParentNode ID ;
ImGuiID SelectedWindow 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 = ParentID = SelectedTab ID = 0 ; SplitAxis = ImGuiAxis_None ; Depth = 0 ; Flags = ImGuiDockNodeFlags_None ; }
ImGuiDockNodeSettings ( ) { ID = ParentNode ID = 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 - > ParentID ? pool . GetByKey ( settings - > ParentID ) : 0 ;
ImGuiDockContextPruneNodeData * parent_data = settings - > ParentNode ID ? pool . GetByKey ( settings - > ParentNode ID ) : 0 ;
pool . GetOrAddByKey ( settings - > ID ) - > RootID = parent_data ? parent_data - > RootID : settings - > ID ;
if ( settings - > ParentID )
pool . GetOrAddByKey ( settings - > ParentID ) - > CountChildNodes + + ;
if ( settings - > ParentNode ID )
pool . GetOrAddByKey ( settings - > ParentNode 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 - > ParentID = = 0 & & data - > CountChildNodes = = 0 & & ! ( settings - > Flags & ImGuiDockNodeFlags_CentralNode ) ) ; // Floating root node with only 1 window
remove | = ( data - > CountWindows = = 0 & & settings - > ParentID = = 0 & & data - > CountChildNodes = = 0 ) ; // Leaf nodes with 0 window
remove | = ( data - > CountWindows = = 1 & & settings - > ParentNode ID = = 0 & & data - > CountChildNodes = = 0 & & ! ( settings - > Flags & ImGuiDockNodeFlags_CentralNode ) ) ; // Floating root node with only 1 window
remove | = ( data - > CountWindows = = 0 & & settings - > ParentNode 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 - > ParentID ? DockContextFindNodeByID ( ctx , settings - > ParentID ) : NULL ;
node - > ParentNode = settings - > ParentNode ID ? DockContextFindNodeByID ( ctx , settings - > ParentNode 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 - > SelectedTab ID ;
node - > SelectedTabID = settings - > SelectedWindow 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 . ParentID , & r ) = = 1 ) { line + = r ; if ( node . ParentID = = 0 ) return ; }
if ( node . ParentID = = 0 )
if ( sscanf ( line , " ID=0x%08X%n " , & node . ID , & r ) = = 1 ) { line + = r ; } else return ;
if ( sscanf ( line , " Parent=0x%08X%n " , & node . ParentNode ID , & r ) = = 1 ) { line + = r ; if ( node . ParentNode ID = = 0 ) return ; }
if ( node . ParentNode 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 , " SelectedTab =0x%08X%n " , & node . SelectedTab ID , & r ) = = 1 ) { line + = r ; }
if ( sscanf ( line , " Selected=0x%08X%n " , & node . SelectedWindow ID , & r ) = = 1 ) { line + = r ; }
ImGuiDockContext * dc = ctx - > DockContext ;
if ( node . ParentID ! = 0 )
if ( ImGuiDockNodeSettings * parent_settings = DockSettingsFindNodeSettings ( ctx , node . ParentID ) )
if ( node . ParentNode ID ! = 0 )
if ( ImGuiDockNodeSettings * parent_settings = DockSettingsFindNodeSettings ( ctx , node . ParentNode 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 . ParentID = node - > ParentNode ? node - > ParentNode - > ID : 0 ;
node_settings . SelectedTab ID = node - > SelectedTabID ;
node_settings . ParentNode ID = node - > ParentNode ? node - > ParentNode - > ID : 0 ;
node_settings . SelectedWindow 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 - > ParentID )
buf - > appendf ( " Parent=0x%08X SizeRef=%d,%d " , node_settings - > ParentID , node_settings - > SizeRef . x , node_settings - > SizeRef . y ) ;
if ( node_settings - > ParentNode ID )
buf - > appendf ( " Parent=0x%08X SizeRef=%d,%d " , node_settings - > ParentNode 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 - > SelectedTab ID )
buf - > appendf ( " SelectedTab =0x%08X " , node_settings - > SelectedTab ID ) ;
if ( node_settings - > SelectedWindow ID )
buf - > appendf ( " Selected=0x%08X " , node_settings - > SelectedWindow 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 - > SelectedTab ID )
if ( settings - > SelectedWindow ID )
{
if ( ImGuiWindow * window = FindWindowByID ( settings - > SelectedTab ID ) )
if ( ImGuiWindow * window = FindWindowByID ( settings - > SelectedWindow ID ) )
selected_tab_name = window - > Name ;
else if ( ImGuiWindowSettings * window_settings = FindWindowSettings ( settings - > SelectedTab ID ) )
else if ( ImGuiWindowSettings * window_settings = FindWindowSettings ( settings - > SelectedWindow ID ) )
selected_tab_name = window_settings - > Name ;
}
ImGui : : BulletText ( " Node %08X, Parent %08X, SelectedTab %08X ('%s') " , settings - > ID , settings - > ParentID , settings - > SelectedTab ID , selected_tab_name ? selected_tab_name : settings - > SelectedTab ID ? " N/A " : " " ) ;
ImGui : : BulletText ( " Node %08X, Parent %08X, SelectedTab %08X ('%s') " , settings - > ID , settings - > ParentNode ID , settings - > SelectedWindow ID , selected_tab_name ? selected_tab_name : settings - > SelectedWindow ID ? " N/A " : " " ) ;
}
ImGui : : TreePop ( ) ;
}