@ -84,6 +84,7 @@ CODE
// [SECTION] DOCKING
// [SECTION] PLATFORM DEPENDENT HELPERS
// [SECTION] METRICS/DEBUGGER WINDOW
// [SECTION] DEBUG LOG WINDOW
// [SECTION] OTHER DEBUG TOOLS (ITEM PICKER, STACK TOOL)
*/
@ -1305,7 +1306,7 @@ void ImGuiIO::ClearInputKeys()
// - float analog_value: 0.0f..1.0f
void ImGuiIO : : AddKeyAnalogEvent ( ImGuiKey key , bool down , float analog_value )
{
//if (e->Down) { IMGUI_DEBUG_LOG("AddKeyEvent() Key='%s' %d, NativeKeycode = %d, NativeScancode = %d\n", ImGui::GetKeyName(e->Key), e->Down, e->NativeKeycode, e->NativeScancode); }
//if (e->Down) { IMGUI_DEBUG_LOG_IO ("AddKeyEvent() Key='%s' %d, NativeKeycode = %d, NativeScancode = %d\n", ImGui::GetKeyName(e->Key), e->Down, e->NativeKeycode, e->NativeScancode); }
if ( key = = ImGuiKey_None | | ! AppAcceptingEvents )
return ;
ImGuiContext & g = * GImGui ;
@ -3446,9 +3447,21 @@ void ImGui::GcAwakeTransientWindowBuffers(ImGuiWindow* window)
void ImGui : : SetActiveID ( ImGuiID id , ImGuiWindow * window )
{
ImGuiContext & g = * GImGui ;
// While most behaved code would make an effort to not steal active id during window move/drag operations,
// we at least need to be resilient to it. Cancelling the move is rather aggressive and users of 'master' branch
// may prefer the weird ill-defined half working situation ('docking' did assert), so may need to rework that.
if ( g . MovingWindow ! = NULL & & g . ActiveId = = g . MovingWindow - > MoveId )
{
IMGUI_DEBUG_LOG_ACTIVEID ( " SetActiveID() cancel MovingWindow \n " ) ;
g . MovingWindow = NULL ;
}
// Set active id
g . ActiveIdIsJustActivated = ( g . ActiveId ! = id ) ;
if ( g . ActiveIdIsJustActivated )
{
IMGUI_DEBUG_LOG_ACTIVEID ( " SetActiveID() old:0x%08X (window \" %s \" ) -> new:0x%08X (window \" %s \" ) \n " , g . ActiveId , g . ActiveIdWindow ? g . ActiveIdWindow - > Name : " " , id , window ? window - > Name : " " ) ;
g . ActiveIdTimer = 0.0f ;
g . ActiveIdHasBeenPressedBefore = false ;
g . ActiveIdHasBeenEditedBefore = false ;
@ -3976,7 +3989,6 @@ void ImGui::UpdateMouseMovingWindowNewFrame()
ImVec2 pos = g . IO . MousePos - g . ActiveIdClickOffset ;
if ( moving_window - > Pos . x ! = pos . x | | moving_window - > Pos . y ! = pos . y )
{
MarkIniSettingsDirty ( moving_window ) ;
SetWindowPos ( moving_window , pos , ImGuiCond_Always ) ;
if ( moving_window - > ViewportOwned ) // Synchronize viewport immediately because some overlays may relies on clipping rectangle before we Begin() into the window.
{
@ -4510,9 +4522,16 @@ void ImGui::NewFrame()
g . HoveredIdUsingMouseWheel = false ;
g . HoveredIdDisabled = false ;
// Update ActiveId data (clear reference to active widget if the widget isn't alive anymore)
if ( g . ActiveIdIsAlive ! = g . ActiveId & & g . ActiveIdPreviousFrame = = g . ActiveId & & g . ActiveId ! = 0 )
// Clear ActiveID if the item is not alive anymore.
// In 1.87, the common most call to KeepAliveID() was moved from GetID() to ItemAdd().
// As a result, custom widget using ButtonBehavior() _without_ ItemAdd() need to call KeepAliveID() themselves.
if ( g . ActiveId ! = 0 & & g . ActiveIdIsAlive ! = g . ActiveId & & g . ActiveIdPreviousFrame = = g . ActiveId )
{
IMGUI_DEBUG_LOG_ACTIVEID ( " NewFrame(): ClearActiveID() because it isn't marked alive anymore! \n " ) ;
ClearActiveID ( ) ;
}
// Update ActiveId data (clear reference to active widget if the widget isn't alive anymore)
if ( g . ActiveId )
g . ActiveIdTimer + = g . IO . DeltaTime ;
g . LastActiveIdTimer + = g . IO . DeltaTime ;
@ -4759,6 +4778,7 @@ void ImGui::Shutdown()
g . LogFile = NULL ;
}
g . LogBuffer . clear ( ) ;
g . DebugLogBuf . clear ( ) ;
g . Initialized = false ;
}
@ -7044,7 +7064,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
{
window - > Viewport - > PlatformRequestClose = false ;
g . NavWindowingToggleLayer = false ; // Assume user mapped PlatformRequestClose on ALT-F4 so we disable ALT for menu toggle. False positive not an issue.
IMGUI_DEBUG_LOG_VIEWPORT ( " Window '%s' PlatformRequestClose \n " , window - > Name ) ;
IMGUI_DEBUG_LOG_VIEWPORT ( " [viewport] Window '%s' PlatformRequestClose\n " , window - > Name ) ;
* p_open = false ;
}
}
@ -7311,16 +7331,13 @@ void ImGui::FocusWindow(ImGuiWindow* window)
if ( g . NavWindow ! = window )
{
g . NavWindow = window ;
SetNavWindow ( window ) ;
if ( window & & g . NavDisableMouseHover )
g . NavMousePosDirty = true ;
g . NavId = window ? window - > NavLastIds [ 0 ] : 0 ; // Restore NavId
g . NavLayer = ImGuiNavLayer_Main ;
g . NavFocusScopeId = 0 ;
g . NavIdIsAlive = false ;
g . NavLayer = ImGuiNavLayer_Main ;
g . NavInitRequest = g . NavMoveSubmitted = g . NavMoveScoringItems = false ;
NavUpdateAnyRequestFlag ( ) ;
//IMGUI_DEBUG_LOG("FocusWindow(\"%s\")\n", window ? window->Name : NULL);
}
// Close popups if any
@ -7690,6 +7707,9 @@ void ImGui::SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond)
const ImVec2 old_pos = window - > Pos ;
window - > Pos = ImFloor ( pos ) ;
ImVec2 offset = window - > Pos - old_pos ;
if ( offset . x = = 0.0f & & offset . y = = 0.0f )
return ;
MarkIniSettingsDirty ( window ) ;
// FIXME: share code with TranslateWindow(), need to confirm whether the 3 rect modified by TranslateWindow() are desirable here.
window - > DC . CursorPos + = offset ; // As we happen to move the window while it is being appended to (which is a bad idea - will smear) let's at least offset the cursor
window - > DC . CursorMaxPos + = offset ; // And more importantly we need to offset CursorMaxPos/CursorStartPos this so ContentSize calculation doesn't get affected.
@ -7725,26 +7745,19 @@ void ImGui::SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond con
window - > SetWindowSizeAllowFlags & = ~ ( ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing ) ;
// Set
if ( size . x > 0.0f )
{
window - > AutoFitFramesX = 0 ;
window - > SizeFull . x = IM_FLOOR ( size . x ) ;
}
else
{
window - > AutoFitFramesX = 2 ;
ImVec2 old_size = window - > SizeFull ;
window - > AutoFitFramesX = ( size . x < = 0.0f ) ? 2 : 0 ;
window - > AutoFitFramesY = ( size . y < = 0.0f ) ? 2 : 0 ;
if ( size . x < = 0.0f )
window - > AutoFitOnlyGrows = false ;
}
if ( size . y > 0.0f )
{
window - > AutoFitFramesY = 0 ;
window - > SizeFull . y = IM_FLOOR ( size . y ) ;
}
else
{
window - > AutoFitFramesY = 2 ;
window - > SizeFull . x = IM_FLOOR ( size . x ) ;
if ( size . y < = 0.0f )
window - > AutoFitOnlyGrows = false ;
}
else
window - > SizeFull . y = IM_FLOOR ( size . y ) ;
if ( old_size . x ! = window - > SizeFull . x | | old_size . y ! = window - > SizeFull . y )
MarkIniSettingsDirty ( window ) ;
}
void ImGui : : SetWindowSize ( const ImVec2 & size , ImGuiCond cond )
@ -7974,14 +7987,25 @@ void ImGui::PopFocusScope()
g . FocusScopeStack . pop_back ( ) ;
}
// Note: this will likely be called ActivateItem() once we rework our Focus/Activation system!
void ImGui : : SetKeyboardFocusHere ( int offset )
{
ImGuiContext & g = * GImGui ;
ImGuiWindow * window = g . CurrentWindow ;
IM_ASSERT ( offset > = - 1 ) ; // -1 is allowed but not below
IMGUI_DEBUG_LOG_ACTIVEID ( " SetKeyboardFocusHere(%d) in window \" %s \" \n " , offset , window - > Name ) ;
g . NavWindow = window ;
g . NavInitRequest = g . NavMoveSubmitted = g . NavMoveScoringItems = false ;
// It makes sense in the vast majority of cases to never interrupt a drag and drop.
// When we refactor this function into ActivateItem() we may want to make this an option.
// MovingWindow is protected from most user inputs using SetActiveIdUsingNavAndKeys(), but
// is also automatically dropped in the event g.ActiveId is stolen.
if ( g . DragDropActive | | g . MovingWindow ! = NULL )
{
IMGUI_DEBUG_LOG_ACTIVEID ( " SetKeyboardFocusHere() ignored while DragDropActive! \n " ) ;
return ;
}
SetNavWindow ( window ) ;
ImGuiScrollFlags scroll_flags = window - > Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY ;
NavMoveRequestSubmit ( ImGuiDir_None , offset < 0 ? ImGuiDir_Up : ImGuiDir_Down , ImGuiNavMoveFlags_Tabbing | ImGuiNavMoveFlags_FocusApi , scroll_flags ) ; // FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable.
@ -8417,21 +8441,23 @@ void ImGui::SetNextFrameWantCaptureMouse(bool want_capture_mouse)
g . WantCaptureMouseNextFrame = want_capture_mouse ? 1 : 0 ;
}
# ifndef IMGUI_DISABLE_METRICS_WINDOW
static const char * GetInputSourceName ( ImGuiInputSource source )
{
const char * input_source_names [ ] = { " None " , " Mouse " , " Keyboard " , " Gamepad " , " Nav " , " Clipboard " } ;
IM_ASSERT ( IM_ARRAYSIZE ( input_source_names ) = = ImGuiInputSource_COUNT & & source > = 0 & & source < ImGuiInputSource_COUNT ) ;
return input_source_names [ source ] ;
}
# endif
/*static void DebugLog InputEvent(const char* prefix, const ImGuiInputEvent* e)
/*static void DebugPrint InputEvent(const char* prefix, const ImGuiInputEvent* e)
{
if ( e - > Type = = ImGuiInputEventType_MousePos ) { IMGUI_DEBUG_LOG ( " %s: MousePos (%.1f %.1f) \n " , prefix , e - > MousePos . PosX , e - > MousePos . PosY ) ; return ; }
if ( e - > Type = = ImGuiInputEventType_MouseButton ) { IMGUI_DEBUG_LOG ( " %s: MouseButton %d %s \n " , prefix , e - > MouseButton . Button , e - > MouseButton . Down ? " Down " : " Up " ) ; return ; }
if ( e - > Type = = ImGuiInputEventType_MouseWheel ) { IMGUI_DEBUG_LOG ( " %s: MouseWheel (%.1f %.1f) \n " , prefix , e - > MouseWheel . WheelX , e - > MouseWheel . WheelY ) ; return ; }
if ( e - > Type = = ImGuiInputEventType_Key ) { IMGUI_DEBUG_LOG ( " %s: Key \" %s \" %s \n " , prefix , ImGui : : GetKeyName ( e - > Key . Key ) , e - > Key . Down ? " Down " : " Up " ) ; return ; }
if ( e - > Type = = ImGuiInputEventType_Text ) { IMGUI_DEBUG_LOG ( " %s: Text: %c (U+%08X) \n " , prefix , e - > Text . Char , e - > Text . Char ) ; return ; }
if ( e - > Type = = ImGuiInputEventType_Focus ) { IMGUI_DEBUG_LOG ( " %s: AppFocused %d \n " , prefix , e - > AppFocused . Focused ) ; return ; }
if ( e - > Type = = ImGuiInputEventType_MousePos ) { IMGUI_DEBUG_LOG_IO ( " %s: MousePos (%.1f %.1f) \n " , prefix , e - > MousePos . PosX , e - > MousePos . PosY ) ; return ; }
if ( e - > Type = = ImGuiInputEventType_MouseButton ) { IMGUI_DEBUG_LOG_IO ( " %s: MouseButton %d %s \n " , prefix , e - > MouseButton . Button , e - > MouseButton . Down ? " Down " : " Up " ) ; return ; }
if ( e - > Type = = ImGuiInputEventType_MouseWheel ) { IMGUI_DEBUG_LOG_IO ( " %s: MouseWheel (%.1f %.1f) \n " , prefix , e - > MouseWheel . WheelX , e - > MouseWheel . WheelY ) ; return ; }
if ( e - > Type = = ImGuiInputEventType_Key ) { IMGUI_DEBUG_LOG_IO ( " %s: Key \" %s \" %s \n " , prefix , ImGui : : GetKeyName ( e - > Key . Key ) , e - > Key . Down ? " Down " : " Up " ) ; return ; }
if ( e - > Type = = ImGuiInputEventType_Text ) { IMGUI_DEBUG_LOG_IO ( " %s: Text: %c (U+%08X) \n " , prefix , e - > Text . Char , e - > Text . Char ) ; return ; }
if ( e - > Type = = ImGuiInputEventType_Focus ) { IMGUI_DEBUG_LOG_IO ( " %s: AppFocused %d \n " , prefix , e - > AppFocused . Focused ) ; return ; }
} */
// Process input queue
@ -8555,14 +8581,14 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs)
}
// Record trail (for domain-specific applications wanting to access a precise trail)
//if (event_n != 0) IMGUI_DEBUG_LOG("Processed: %d / Remaining: %d\n", event_n, g.InputEventsQueue.Size - event_n);
//if (event_n != 0) IMGUI_DEBUG_LOG_IO ("Processed: %d / Remaining: %d\n", event_n, g.InputEventsQueue.Size - event_n);
for ( int n = 0 ; n < event_n ; n + + )
g . InputEventsTrail . push_back ( g . InputEventsQueue [ n ] ) ;
// [DEBUG]
/*if (event_n != 0)
for ( int n = 0 ; n < g . InputEventsQueue . Size ; n + + )
DebugLog InputEvent ( n < event_n ? " Processed " : " Remaining " , & g . InputEventsQueue [ n ] ) ; */
DebugPrint InputEvent ( n < event_n ? " Processed " : " Remaining " , & g . InputEventsQueue [ n ] ) ; */
// Remaining events will be processed on the next frame
if ( event_n = = g . InputEventsQueue . Size )
@ -9722,7 +9748,9 @@ ImGuiWindow* ImGui::GetTopMostAndVisiblePopupModal()
void ImGui : : OpenPopup ( const char * str_id , ImGuiPopupFlags popup_flags )
{
ImGuiContext & g = * GImGui ;
OpenPopupEx ( g . CurrentWindow - > GetID ( str_id ) , popup_flags ) ;
ImGuiID id = g . CurrentWindow - > GetID ( str_id ) ;
IMGUI_DEBUG_LOG_POPUP ( " [popup] OpenPopup( \" %s \" -> 0x%08X \n " , str_id , id ) ;
OpenPopupEx ( id , popup_flags ) ;
}
void ImGui : : OpenPopup ( ImGuiID id , ImGuiPopupFlags popup_flags )
@ -9753,7 +9781,7 @@ void ImGui::OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags)
popup_ref . OpenPopupPos = NavCalcPreferredRefPos ( ) ;
popup_ref . OpenMousePos = IsMousePosValid ( & g . IO . MousePos ) ? g . IO . MousePos : popup_ref . OpenPopupPos ;
IMGUI_DEBUG_LOG_POPUP ( " OpenPopupEx(0x%08X) \n " , id ) ;
IMGUI_DEBUG_LOG_POPUP ( " [popup] OpenPopupEx(0x%08X)\n " , id ) ;
if ( g . OpenPopupStack . Size < current_stack_size + 1 )
{
g . OpenPopupStack . push_back ( popup_ref ) ;
@ -9823,7 +9851,7 @@ void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to
}
if ( popup_count_to_keep < g . OpenPopupStack . Size ) // This test is not required but it allows to set a convenient breakpoint on the statement below
{
IMGUI_DEBUG_LOG_POPUP ( " ClosePopupsOverWindow( \" %s \" ) -> ClosePopupToLevel(%d) \n " , ref_window - > Name , popup_count_to_keep ) ;
IMGUI_DEBUG_LOG_POPUP ( " [popup] ClosePopupsOverWindow(\" %s \" ) \n " , ref_window ? ref_window - > Name : " <NULL> " ) ;
ClosePopupToLevel ( popup_count_to_keep , restore_focus_to_window_under_popup ) ;
}
}
@ -9846,7 +9874,7 @@ void ImGui::ClosePopupsExceptModals()
void ImGui : : ClosePopupToLevel ( int remaining , bool restore_focus_to_window_under_popup )
{
ImGuiContext & g = * GImGui ;
IMGUI_DEBUG_LOG_POPUP ( " ClosePopupToLevel(%d), restore_focus_to_window_under_popup=%d \n " , remaining , restore_focus_to_window_under_popup ) ;
IMGUI_DEBUG_LOG_POPUP ( " [popup] ClosePopupToLevel(%d), restore_focus_to_window_under_popup=%d\n " , remaining , restore_focus_to_window_under_popup ) ;
IM_ASSERT ( remaining > = 0 & & remaining < g . OpenPopupStack . Size ) ;
// Trim open popup stack
@ -9891,7 +9919,7 @@ void ImGui::CloseCurrentPopup()
break ;
popup_idx - - ;
}
IMGUI_DEBUG_LOG_POPUP ( " CloseCurrentPopup %d -> %d \n " , g . BeginPopupStack . Size - 1 , popup_idx ) ;
IMGUI_DEBUG_LOG_POPUP ( " [popup] CloseCurrentPopup %d -> %d\n " , g . BeginPopupStack . Size - 1 , popup_idx ) ;
ClosePopupToLevel ( popup_idx , true ) ;
// A common pattern is to close a popup when selecting a menu item/selectable that will open another window.
@ -10207,8 +10235,22 @@ ImVec2 ImGui::FindBestWindowPosForPopup(ImGuiWindow* window)
// [SECTION] KEYBOARD/GAMEPAD NAVIGATION
//-----------------------------------------------------------------------------
// FIXME-NAV: The existence of SetNavID vs SetFocusID properly needs to be clarified/reworked.
// In our terminology those should be interchangeable. Those two functions are merely a legacy artifact, so at minimum naming should be clarified.
// FIXME-NAV: The existence of SetNavID vs SetFocusID vs FocusWindow() needs to be clarified/reworked.
// In our terminology those should be interchangeable, yet right now this is super confusing.
// Those two functions are merely a legacy artifact, so at minimum naming should be clarified.
void ImGui : : SetNavWindow ( ImGuiWindow * window )
{
ImGuiContext & g = * GImGui ;
if ( g . NavWindow ! = window )
{
IMGUI_DEBUG_LOG_FOCUS ( " [focus] SetNavWindow( \" %s \" ) \n " , window ? window - > Name : " <NULL> " ) ;
g . NavWindow = window ;
}
g . NavInitRequest = g . NavMoveSubmitted = g . NavMoveScoringItems = false ;
NavUpdateAnyRequestFlag ( ) ;
}
void ImGui : : SetNavID ( ImGuiID id , ImGuiNavLayer nav_layer , ImGuiID focus_scope_id , const ImRect & rect_rel )
{
ImGuiContext & g = * GImGui ;
@ -10226,15 +10268,12 @@ void ImGui::SetFocusID(ImGuiID id, ImGuiWindow* window)
ImGuiContext & g = * GImGui ;
IM_ASSERT ( id ! = 0 ) ;
if ( g . NavWindow ! = window )
SetNavWindow ( window ) ;
// Assume that SetFocusID() is called in the context where its window->DC.NavLayerCurrent and window->DC.NavFocusScopeIdCurrent are valid.
// Note that window may be != g.CurrentWindow (e.g. SetFocusID call in InputTextEx for multi-line text)
const ImGuiNavLayer nav_layer = window - > DC . NavLayerCurrent ;
if ( g . NavWindow ! = window )
{
g . NavWindow = window ;
g . NavInitRequest = g . NavMoveSubmitted = g . NavMoveScoringItems = false ;
NavUpdateAnyRequestFlag ( ) ;
}
g . NavId = id ;
g . NavLayer = nav_layer ;
g . NavFocusScopeId = window - > DC . NavFocusScopeIdCurrent ;
@ -10483,11 +10522,7 @@ static void ImGui::NavProcessItem()
if ( g . NavId = = id )
{
if ( g . NavWindow ! = window )
{
g . NavWindow = window ; // Always refresh g.NavWindow, because some operations such as FocusItem() don't have a window.
g . NavInitRequest = g . NavMoveSubmitted = g . NavMoveScoringItems = false ;
NavUpdateAnyRequestFlag ( ) ;
}
SetNavWindow ( window ) ; // Always refresh g.NavWindow, because some operations such as FocusItem() may not have a window.
g . NavLayer = window - > DC . NavLayerCurrent ;
g . NavFocusScopeId = window - > DC . NavFocusScopeIdCurrent ;
g . NavIdIsAlive = true ;
@ -10639,7 +10674,12 @@ void ImGui::NavRestoreLayer(ImGuiNavLayer layer)
{
ImGuiContext & g = * GImGui ;
if ( layer = = ImGuiNavLayer_Main )
{
ImGuiWindow * prev_nav_window = g . NavWindow ;
g . NavWindow = NavRestoreLastChildNavWindow ( g . NavWindow ) ; // FIXME-NAV: Should clear ongoing nav requests?
if ( prev_nav_window )
IMGUI_DEBUG_LOG_FOCUS ( " [focus] NavRestoreLayer: from \" %s \" to SetNavWindow( \" %s \" ) \n " , prev_nav_window - > Name , g . NavWindow - > Name ) ;
}
ImGuiWindow * window = g . NavWindow ;
if ( window - > NavLastIds [ layer ] ! = 0 )
{
@ -10786,7 +10826,7 @@ static void ImGui::NavUpdate()
ImGuiIO & io = g . IO ;
io . WantSetMousePos = false ;
//if (g.NavScoringDebugCount > 0) IMGUI_DEBUG_LOG("NavScoringDebugCount %d for '%s' layer %d (Init:%d, Move:%d)\n", g.NavScoringDebugCount, g.NavWindow ? g.NavWindow->Name : "NULL", g.NavLayer, g.NavInitRequest || g.NavInitResultId != 0, g.NavMoveRequest);
//if (g.NavScoringDebugCount > 0) IMGUI_DEBUG_LOG_NAV ("[nav] NavScoringDebugCount %d for '%s' layer %d (Init:%d, Move:%d)\n", g.NavScoringDebugCount, g.NavWindow ? g.NavWindow->Name : "NULL", g.NavLayer, g.NavInitRequest || g.NavInitResultId != 0, g.NavMoveRequest);
// Update Gamepad->Nav inputs mapping
// Set input source as Gamepad when buttons are pressed (as some features differs when used with Gamepad vs Keyboard)
@ -10960,7 +11000,7 @@ static void ImGui::NavUpdate()
{
io . MousePos = io . MousePosPrev = NavCalcPreferredRefPos ( ) ;
io . WantSetMousePos = true ;
//IMGUI_DEBUG_LOG("SetMousePos: (%.1f,%.1f)\n", io.MousePos.x, io.MousePos.y);
//IMGUI_DEBUG_LOG_IO ("SetMousePos: (%.1f,%.1f)\n", io.MousePos.x, io.MousePos.y);
}
// [DEBUG]
@ -10984,7 +11024,7 @@ void ImGui::NavInitRequestApplyResult()
// Apply result from previous navigation init request (will typically select the first item, unless SetItemDefaultFocus() has been called)
// FIXME-NAV: On _NavFlattened windows, g.NavWindow will only be updated during subsequent frame. Not a problem currently.
IMGUI_DEBUG_LOG_NAV ( " [nav] NavInitRequest: result NavID 0x%08X in Layer %d Window \" %s \" \n " , g . NavInitResultId , g . NavLayer , g . NavWindow - > Name ) ;
IMGUI_DEBUG_LOG_NAV ( " [nav] NavInitRequest: ApplyResult: NavID 0x%08X in Layer %d Window \" %s \" \n " , g . NavInitResultId , g . NavLayer , g . NavWindow - > Name ) ;
SetNavID ( g . NavInitResultId , g . NavLayer , 0 , g . NavInitResultRectRel ) ;
g . NavIdIsAlive = true ; // Mark as alive from previous frame as we got a result
if ( g . NavInitRequestFromMove )
@ -11054,7 +11094,7 @@ void ImGui::NavUpdateCreateMoveRequest()
// Moving with no reference triggers a init request (will be used as a fallback if the direction fails to find a match)
if ( g . NavMoveSubmitted & & g . NavId = = 0 )
{
IMGUI_DEBUG_LOG_NAV ( " [nav] NavInitRequest: from move, window \" %s \" , layer=%d \n " , g . NavW indow- > Name , g . NavLayer ) ;
IMGUI_DEBUG_LOG_NAV ( " [nav] NavInitRequest: from move, window \" %s \" , layer=%d \n " , window ? w indow- > Name : " <NULL> " , g . NavLayer ) ;
g . NavInitRequest = g . NavInitRequestFromMove = true ;
g . NavInitResultId = 0 ;
g . NavDisableHighlight = false ;
@ -11070,7 +11110,7 @@ void ImGui::NavUpdateCreateMoveRequest()
ImRect inner_rect_rel = WindowRectAbsToRel ( window , ImRect ( window - > InnerRect . Min - ImVec2 ( 1 , 1 ) , window - > InnerRect . Max + ImVec2 ( 1 , 1 ) ) ) ;
if ( ( clamp_x | | clamp_y ) & & ! inner_rect_rel . Contains ( window - > NavRectRel [ g . NavLayer ] ) )
{
IMGUI_DEBUG_LOG_NAV ( " [nav] NavMoveRequest: clamp NavRectRel for gamepad move \n " ) ;
//IMGUI_DEBUG_LOG_NAV(" [nav] NavMoveRequest: clamp NavRectRel for gamepad move\n");
float pad_x = ImMin ( inner_rect_rel . GetWidth ( ) , window - > CalcFontSize ( ) * 0.5f ) ;
float pad_y = ImMin ( inner_rect_rel . GetHeight ( ) , window - > CalcFontSize ( ) * 0.5f ) ; // Terrible approximation for the intent of starting navigation from first fully visible item
inner_rect_rel . Min . x = clamp_x ? ( inner_rect_rel . Min . x + pad_x ) : - FLT_MAX ;
@ -11177,7 +11217,11 @@ void ImGui::NavMoveRequestApplyResult()
}
}
if ( g . NavWindow ! = result - > Window )
{
IMGUI_DEBUG_LOG_FOCUS ( " [focus] NavMoveRequest: SetNavWindow( \" %s \" ) \n " , result - > Window - > Name ) ;
g . NavWindow = result - > Window ;
}
if ( g . ActiveId ! = result - > ID )
ClearActiveID ( ) ;
if ( g . NavId ! = result - > ID )
@ -11558,7 +11602,6 @@ static void ImGui::NavUpdateWindowing()
const float move_speed = ImFloor ( NAV_MOVE_SPEED * io . DeltaTime * ImMin ( io . DisplayFramebufferScale . x , io . DisplayFramebufferScale . y ) ) ; // FIXME: Doesn't handle variable framerate very well
ImGuiWindow * moving_window = g . NavWindowingTarget - > RootWindowDockTree ;
SetWindowPos ( moving_window , moving_window - > Pos + move_delta * move_speed , ImGuiCond_Always ) ;
MarkIniSettingsDirty ( moving_window ) ;
g . NavDisableMouseHover = true ;
}
}
@ -11673,6 +11716,12 @@ void ImGui::NavUpdateWindowingOverlay()
// [SECTION] DRAG AND DROP
//-----------------------------------------------------------------------------
bool ImGui : : IsDragDropActive ( )
{
ImGuiContext & g = * GImGui ;
return g . DragDropActive ;
}
void ImGui : : ClearDragDrop ( )
{
ImGuiContext & g = * GImGui ;
@ -12645,7 +12694,7 @@ void ImGui::SetCurrentViewport(ImGuiWindow* current_window, ImGuiViewportP* view
return ;
g . CurrentDpiScale = viewport ? viewport - > DpiScale : 1.0f ;
g . CurrentViewport = viewport ;
//IMGUI_DEBUG_LOG_VIEWPORT("SetCurrentViewport changed '%s' 0x%08X\n", current_window ? current_window->Name : NULL, viewport ? viewport->ID : 0);
//IMGUI_DEBUG_LOG_VIEWPORT("[viewport] SetCurrentViewport changed '%s' 0x%08X\n", current_window ? current_window->Name : NULL, viewport ? viewport->ID : 0);
// Notify platform layer of viewport changes
// FIXME-DPI: This is only currently used for experimenting with handling of multiple DPI
@ -13009,7 +13058,7 @@ ImGuiViewportP* ImGui::AddUpdateViewport(ImGuiWindow* window, ImGuiID id, const
viewport - > Flags = flags ;
UpdateViewportPlatformMonitor ( viewport ) ;
g . Viewports . push_back ( viewport ) ;
IMGUI_DEBUG_LOG_VIEWPORT ( " Add Viewport %08X (%s) \n " , id , window - > Name ) ;
IMGUI_DEBUG_LOG_VIEWPORT ( " [viewport] Add Viewport %08X '%s' \n " , id , window ? window - > Name : " <NULL> " ) ;
// We normally setup for all viewports in NewFrame() but here need to handle the mid-frame creation of a new viewport.
// We need to extend the fullscreen clip rect so the OverlayDrawList clip is correct for that the first frame
@ -13051,7 +13100,7 @@ static void ImGui::DestroyViewport(ImGuiViewportP* viewport)
g . MouseLastHoveredViewport = NULL ;
// Destroy
IMGUI_DEBUG_LOG_VIEWPORT ( " Delete Viewport %08X (%s) \n " , viewport - > ID , viewport - > Window ? viewport - > Window - > Name : " n/a " ) ;
IMGUI_DEBUG_LOG_VIEWPORT ( " [viewport] Delete Viewport %08X '%s' \n " , viewport - > ID , viewport - > Window ? viewport - > Window - > Name : " n/a " ) ;
DestroyPlatformWindow ( viewport ) ; // In most circumstances the platform window will already be destroyed here.
IM_ASSERT ( g . PlatformIO . Viewports . contains ( viewport ) = = false ) ;
IM_ASSERT ( g . Viewports [ viewport - > Idx ] = = viewport ) ;
@ -13167,7 +13216,7 @@ static void ImGui::WindowSelectViewport(ImGuiWindow* window)
if ( ( window - > Flags & ImGuiWindowFlags_DockNodeHost ) & & window - > Viewport - > LastFrameActive < g . FrameCount & & will_be_visible )
{
// Steal/transfer ownership
IMGUI_DEBUG_LOG_VIEWPORT ( " Window '%s' steal Viewport %08X from Window '%s' \n " , window - > Name , window - > Viewport - > ID , window - > Viewport - > Window - > Name ) ;
IMGUI_DEBUG_LOG_VIEWPORT ( " [viewport] Window '%s' steal Viewport %08X from Window '%s'\n " , window - > Name , window - > Viewport - > ID , window - > Viewport - > Window - > Name ) ;
window - > Viewport - > Window = window ;
window - > Viewport - > ID = window - > ID ;
window - > Viewport - > LastNameHash = 0 ;
@ -13317,7 +13366,7 @@ void ImGui::UpdatePlatformWindows()
bool is_new_platform_window = ( viewport - > PlatformWindowCreated = = false ) ;
if ( is_new_platform_window )
{
IMGUI_DEBUG_LOG_VIEWPORT ( " Create Platform Window %08X (%s) \n " , viewport - > ID , viewport - > Window ? viewport - > Window - > Name : " n/a " ) ;
IMGUI_DEBUG_LOG_VIEWPORT ( " [viewport] Create Platform Window %08X '%s' \n " , viewport - > ID , viewport - > Window ? viewport - > Window - > Name : " n/a " ) ;
g . PlatformIO . Platform_CreateWindow ( viewport ) ;
if ( g . PlatformIO . Renderer_CreateWindow ! = NULL )
g . PlatformIO . Renderer_CreateWindow ( viewport ) ;
@ -13806,8 +13855,9 @@ void ImGui::DockContextClearNodes(ImGuiContext* ctx, ImGuiID root_id, bool clear
// (Different from DockSettingsHandler_ClearAll() + DockSettingsHandler_ApplyAll() because this reuses current settings!)
void ImGui : : DockContextRebuildNodes ( ImGuiContext * ctx )
{
IMGUI_DEBUG_LOG_DOCKING ( " DockContextRebuild() \n " ) ;
ImGuiContext & g = * ctx ;
ImGuiDockContext * dc = & ctx - > DockContext ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] DockContextRebuildNodes \n " ) ;
SaveIniSettingsToMemory ( ) ;
ImGuiID root_id = 0 ; // Rebuild all
DockContextClearNodes ( ctx , root_id , false ) ;
@ -13928,13 +13978,14 @@ ImGuiID ImGui::DockContextGenNodeID(ImGuiContext* ctx)
static ImGuiDockNode * ImGui : : DockContextAddNode ( ImGuiContext * ctx , ImGuiID id )
{
// Generate an ID for the new node (the exact ID value doesn't matter as long as it is not already used) and add the first window.
ImGuiContext & g = * ctx ;
if ( id = = 0 )
id = DockContextGenNodeID ( ctx ) ;
else
IM_ASSERT ( DockContextFindNodeByID ( ctx , id ) = = NULL ) ;
// We don't set node->LastFrameAlive on construction. Nodes are always created at all time to reflect .ini settings!
IMGUI_DEBUG_LOG_DOCKING ( " DockContextAddNode 0x%08X \n " , id ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] DockContextAddNode 0x%08X\n " , id ) ;
ImGuiDockNode * node = IM_NEW ( ImGuiDockNode ) ( id ) ;
ctx - > DockContext . Nodes . SetVoidPtr ( node - > ID , node ) ;
return node ;
@ -13945,7 +13996,7 @@ static void ImGui::DockContextRemoveNode(ImGuiContext* ctx, ImGuiDockNode* node,
ImGuiContext & g = * ctx ;
ImGuiDockContext * dc = & ctx - > DockContext ;
IMGUI_DEBUG_LOG_DOCKING ( " DockContextRemoveNode 0x%08X \n " , node - > ID ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] DockContextRemoveNode 0x%08X\n " , node - > ID ) ;
IM_ASSERT ( DockContextFindNodeByID ( ctx , node - > ID ) = = node ) ;
IM_ASSERT ( node - > ChildNodes [ 0 ] = = NULL & & node - > ChildNodes [ 1 ] = = NULL ) ;
IM_ASSERT ( node - > Windows . Size = = 0 ) ;
@ -14044,7 +14095,7 @@ static void ImGui::DockContextPruneUnusedSettingsNodes(ImGuiContext* ctx)
remove | = ( data_root - > CountChildWindows = = 0 ) ;
if ( remove )
{
IMGUI_DEBUG_LOG_DOCKING ( " DockContextPruneUnusedSettingsNodes: Prune 0x%08X \n " , settings - > ID ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] DockContextPruneUnusedSettingsNodes: Prune 0x%08X\n " , settings - > ID ) ;
DockSettingsRemoveNodeReferences ( & settings - > ID , 1 ) ;
settings - > ID = 0 ;
}
@ -14163,9 +14214,9 @@ void ImGui::DockContextProcessDock(ImGuiContext* ctx, ImGuiDockRequest* req)
ImGuiWindow * target_window = req - > DockTargetWindow ;
ImGuiDockNode * node = req - > DockTargetNode ;
if ( payload_window )
IMGUI_DEBUG_LOG_DOCKING ( " DockContextProcessDock node 0x%08X target '%s' dock window '%s', split_dir %d \n " , node ? node - > ID : 0 , target_window ? target_window - > Name : " NULL " , payload_window ? payload_window - > Name : " NULL " , req - > DockSplitDir ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] DockContextProcessDock node 0x%08X target '%s' dock window '%s', split_dir %d\n " , node ? node - > ID : 0 , target_window ? target_window - > Name : " NULL " , payload_window ? payload_window - > Name : " NULL " , req - > DockSplitDir ) ;
else
IMGUI_DEBUG_LOG_DOCKING ( " DockContextProcessDock node 0x%08X, split_dir %d \n " , node ? node - > ID : 0 , req - > DockSplitDir ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] DockContextProcessDock node 0x%08X, split_dir %d\n " , node ? node - > ID : 0 , req - > DockSplitDir ) ;
// Decide which Tab will be selected at the end of the operation
ImGuiID next_selected_id = 0 ;
@ -14314,8 +14365,8 @@ static ImVec2 FixLargeWindowsWhenUndocking(const ImVec2& size, ImGuiViewport* re
void ImGui : : DockContextProcessUndockWindow ( ImGuiContext * ctx , ImGuiWindow * window , bool clear_persistent_docking_ref )
{
IMGUI_DEBUG_LOG_DOCKING ( " DockContextProcessUndockWindow window '%s', clear_persistent_docking_ref = %d \n " , window - > Name , clear_persistent_docking_ref ) ;
IM_UNUSED ( ctx ) ;
ImGuiContext & g = * ctx ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] DockContextProcessUndockWindow window '%s', clear_persistent_docking_ref = %d \n " , window - > Name , clear_persistent_docking_ref ) ;
if ( window - > DockNode )
DockNodeRemoveWindow ( window - > DockNode , window , clear_persistent_docking_ref ? 0 : window - > DockId ) ;
else
@ -14330,7 +14381,8 @@ void ImGui::DockContextProcessUndockWindow(ImGuiContext* ctx, ImGuiWindow* windo
void ImGui : : DockContextProcessUndockNode ( ImGuiContext * ctx , ImGuiDockNode * node )
{
IMGUI_DEBUG_LOG_DOCKING ( " DockContextProcessUndockNode node %08X \n " , node - > ID ) ;
ImGuiContext & g = * ctx ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] DockContextProcessUndockNode node %08X \n " , node - > ID ) ;
IM_ASSERT ( node - > IsLeafNode ( ) ) ;
IM_ASSERT ( node - > Windows . Size > = 1 ) ;
@ -14474,7 +14526,7 @@ static void ImGui::DockNodeAddWindow(ImGuiDockNode* node, ImGuiWindow* window, b
DockNodeRemoveWindow ( window - > DockNode , window , 0 ) ;
}
IM_ASSERT ( window - > DockNode = = NULL | | window - > DockNodeAsHost = = NULL ) ;
IMGUI_DEBUG_LOG_DOCKING ( " DockNodeAddWindow node 0x%08X window '%s' \n " , node - > ID , window - > Name ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] DockNodeAddWindow node 0x%08X window '%s'\n " , node - > ID , window - > Name ) ;
// If more than 2 windows appeared on the same frame leading to the creation of a new hosting window,
// we'll hide windows until the host window is ready. Hide the 1st window after its been output (so it is not visible for one frame).
@ -14530,7 +14582,7 @@ static void ImGui::DockNodeRemoveWindow(ImGuiDockNode* node, ImGuiWindow* window
//IM_ASSERT(window->RootWindowDockTree == node->HostWindow);
//IM_ASSERT(window->LastFrameActive < g.FrameCount); // We may call this from Begin()
IM_ASSERT ( save_dock_id = = 0 | | save_dock_id = = node - > ID ) ;
IMGUI_DEBUG_LOG_DOCKING ( " DockNodeRemoveWindow node 0x%08X window '%s' \n " , node - > ID , window - > Name ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] DockNodeRemoveWindow node 0x%08X window '%s'\n " , node - > ID , window - > Name ) ;
window - > DockNode = NULL ;
window - > DockIsActive = window - > DockTabWantClose = false ;
@ -14577,7 +14629,7 @@ static void ImGui::DockNodeRemoveWindow(ImGuiDockNode* node, ImGuiWindow* window
if ( node - > HostWindow - > ViewportOwned & & node - > IsRootNode ( ) )
{
// Transfer viewport back to the remaining loose window
IMGUI_DEBUG_LOG_VIEWPORT ( " Node %08X transfer Viewport %08X=>%08X for Window '%s' \n " , node - > ID , node - > HostWindow - > Viewport - > ID , remaining_window - > ID , remaining_window - > Name ) ;
IMGUI_DEBUG_LOG_VIEWPORT ( " [viewport] Node %08X transfer Viewport %08X=>%08X for Window '%s'\n " , node - > ID , node - > HostWindow - > Viewport - > ID , remaining_window - > ID , remaining_window - > Name ) ;
IM_ASSERT ( node - > HostWindow - > Viewport - > Window = = node - > HostWindow ) ;
node - > HostWindow - > Viewport - > Window = remaining_window ;
node - > HostWindow - > Viewport - > ID = remaining_window - > ID ;
@ -15359,9 +15411,9 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w
}
if ( tab_bar - > Tabs . Size > tabs_unsorted_start )
{
IMGUI_DEBUG_LOG_DOCKING ( " In node 0x%08X: %d new appearing tabs:%s \n " , node - > ID , tab_bar - > Tabs . Size - tabs_unsorted_start , ( tab_bar - > Tabs . Size > tabs_unsorted_start + 1 ) ? " (will sort) " : " " ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] In node 0x%08X: %d new appearing tabs:%s\n " , node - > ID , tab_bar - > Tabs . Size - tabs_unsorted_start , ( tab_bar - > Tabs . Size > tabs_unsorted_start + 1 ) ? " (will sort) " : " " ) ;
for ( int tab_n = tabs_unsorted_start ; tab_n < tab_bar - > Tabs . Size ; tab_n + + )
IMGUI_DEBUG_LOG_DOCKING ( " - Tab '%s' Order %d \n " , tab_bar - > Tabs [ tab_n ] . Window - > Name , tab_bar - > Tabs [ tab_n ] . Window - > DockOrder ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] - Tab '%s' Order %d\n " , tab_bar - > Tabs [ tab_n ] . Window - > Name , tab_bar - > Tabs [ tab_n ] . Window - > DockOrder ) ;
if ( tab_bar - > Tabs . Size > tabs_unsorted_start + 1 )
ImQsort ( tab_bar - > Tabs . Data + tabs_unsorted_start , tab_bar - > Tabs . Size - tabs_unsorted_start , sizeof ( ImGuiTabItem ) , TabItemComparerByDockOrder ) ;
}
@ -15962,6 +16014,7 @@ void ImGui::DockNodeTreeSplit(ImGuiContext* ctx, ImGuiDockNode* parent_node, ImG
void ImGui : : DockNodeTreeMerge ( ImGuiContext * ctx , ImGuiDockNode * parent_node , ImGuiDockNode * merge_lead_child )
{
// When called from DockContextProcessUndockNode() it is possible that one of the child is NULL.
ImGuiContext & g = * GImGui ;
ImGuiDockNode * child_0 = parent_node - > ChildNodes [ 0 ] ;
ImGuiDockNode * child_1 = parent_node - > ChildNodes [ 1 ] ;
IM_ASSERT ( child_0 | | child_1 ) ;
@ -15971,7 +16024,7 @@ void ImGui::DockNodeTreeMerge(ImGuiContext* ctx, ImGuiDockNode* parent_node, ImG
IM_ASSERT ( parent_node - > TabBar = = NULL ) ;
IM_ASSERT ( parent_node - > Windows . Size = = 0 ) ;
}
IMGUI_DEBUG_LOG_DOCKING ( " DockNodeTreeMerge 0x%08X & 0x%08X back into parent 0x%08X\n " , child_0 ? child_0 - > ID : 0 , child_1 ? child_1 - > ID : 0 , parent_node - > ID ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] DockNodeTreeMerge: 0x%08X + 0x%08X back into parent 0x%08X\n " , child_0 ? child_0 - > ID : 0 , child_1 ? child_1 - > ID : 0 , parent_node - > ID ) ;
ImVec2 backup_last_explicit_size = parent_node - > SizeRef ;
DockNodeMoveChildNodes ( parent_node , merge_lead_child ) ;
@ -16339,12 +16392,12 @@ ImGuiID ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags
ImGuiDockNode * node = DockContextFindNodeByID ( ctx , id ) ;
if ( ! node )
{
IMGUI_DEBUG_LOG_DOCKING ( " DockSpace: dockspace node 0x%08X created \n " , id ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] DockSpace: dockspace node 0x%08X created\n " , id ) ;
node = DockContextAddNode ( ctx , id ) ;
node - > SetLocalFlags ( ImGuiDockNodeFlags_CentralNode ) ;
}
if ( window_class & & window_class - > ClassId ! = node - > WindowClass . ClassId )
IMGUI_DEBUG_LOG_DOCKING ( " DockSpace: dockspace node 0x%08X: setup WindowClass 0x%08X -> 0x%08X \n " , id , node - > WindowClass . ClassId , window_class - > ClassId ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] DockSpace: dockspace node 0x%08X: setup WindowClass 0x%08X -> 0x%08X\n " , id , node - > WindowClass . ClassId , window_class - > ClassId ) ;
node - > SharedFlags = flags ;
node - > WindowClass = window_class ? * window_class : ImGuiWindowClass ( ) ;
@ -16680,11 +16733,11 @@ void ImGui::DockBuilderRemoveNodeDockedWindows(ImGuiID root_id, bool clear_setti
// FIXME-DOCK: We are not exposing nor using split_outer.
ImGuiID ImGui : : DockBuilderSplitNode ( ImGuiID id , ImGuiDir split_dir , float size_ratio_for_node_at_dir , ImGuiID * out_id_at_dir , ImGuiID * out_id_at_opposite_dir )
{
ImGuiContext * ctx = GImGui ;
ImGuiContext & g = * GImGui ;
IM_ASSERT ( split_dir ! = ImGuiDir_None ) ;
IMGUI_DEBUG_LOG_DOCKING ( " DockBuilderSplitNode node 0x%08X, split_dir %d \n " , id , split_dir ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] DockBuilderSplitNode: node 0x%08X, split_dir %d\n " , id , split_dir ) ;
ImGuiDockNode * node = DockContextFindNodeByID ( ctx , id ) ;
ImGuiDockNode * node = DockContextFindNodeByID ( & g , id ) ;
if ( node = = NULL )
{
IM_ASSERT ( node ! = NULL ) ;
@ -16701,7 +16754,7 @@ ImGuiID ImGui::DockBuilderSplitNode(ImGuiID id, ImGuiDir split_dir, float size_r
req . DockSplitDir = split_dir ;
req . DockSplitRatio = ImSaturate ( ( split_dir = = ImGuiDir_Left | | split_dir = = ImGuiDir_Up ) ? size_ratio_for_node_at_dir : 1.0f - size_ratio_for_node_at_dir ) ;
req . DockSplitOuter = false ;
DockContextProcessDock ( ctx , & req ) ;
DockContextProcessDock ( & g , & req ) ;
ImGuiID id_at_dir = node - > ChildNodes [ ( split_dir = = ImGuiDir_Left | | split_dir = = ImGuiDir_Up ) ? 0 : 1 ] - > ID ;
ImGuiID id_at_opposite_dir = node - > ChildNodes [ ( split_dir = = ImGuiDir_Left | | split_dir = = ImGuiDir_Up ) ? 1 : 0 ] - > ID ;
@ -16714,8 +16767,8 @@ ImGuiID ImGui::DockBuilderSplitNode(ImGuiID id, ImGuiDir split_dir, float size_r
static ImGuiDockNode * DockBuilderCopyNodeRec ( ImGuiDockNode * src_node , ImGuiID dst_node_id_if_known , ImVector < ImGuiID > * out_node_remap_pairs )
{
ImGuiContext * ctx = GImGui ;
ImGuiDockNode * dst_node = ImGui : : DockContextAddNode ( ctx , dst_node_id_if_known ) ;
ImGuiContext & g = * GImGui ;
ImGuiDockNode * dst_node = ImGui : : DockContextAddNode ( & g , dst_node_id_if_known ) ;
dst_node - > SharedFlags = src_node - > SharedFlags ;
dst_node - > LocalFlags = src_node - > LocalFlags ;
dst_node - > LocalFlagsInWindows = ImGuiDockNodeFlags_None ;
@ -16735,7 +16788,7 @@ static ImGuiDockNode* DockBuilderCopyNodeRec(ImGuiDockNode* src_node, ImGuiID ds
dst_node - > ChildNodes [ child_n ] - > ParentNode = dst_node ;
}
IMGUI_DEBUG_LOG_DOCKING ( " Fork node %08X -> %08X (%d childs) \n " , src_node - > ID , dst_node - > ID , dst_node - > IsSplitNode ( ) ? 2 : 0 ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] Fork node %08X -> %08X (%d childs)\n " , src_node - > ID , dst_node - > ID , dst_node - > IsSplitNode ( ) ? 2 : 0 ) ;
return dst_node ;
}
@ -16790,6 +16843,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 )
{
ImGuiContext & g = * GImGui ;
IM_ASSERT ( src_dockspace_id ! = 0 ) ;
IM_ASSERT ( dst_dockspace_id ! = 0 ) ;
IM_ASSERT ( in_window_remap_pairs ! = NULL ) ;
@ -16829,14 +16883,14 @@ void ImGui::DockBuilderCopyDockSpace(ImGuiID src_dockspace_id, ImGuiID dst_docks
if ( dst_dock_id ! = 0 )
{
// Docked windows gets redocked into the new node hierarchy.
IMGUI_DEBUG_LOG_DOCKING ( " Remap live window '%s' 0x%08X -> '%s' 0x%08X \n " , src_window_name , src_dock_id , dst_window_name , dst_dock_id ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] Remap live window '%s' 0x%08X -> '%s' 0x%08X\n " , src_window_name , src_dock_id , dst_window_name , dst_dock_id ) ;
DockBuilderDockWindow ( dst_window_name , dst_dock_id ) ;
}
else
{
// Floating windows gets their settings transferred (regardless of whether the new window already exist or not)
// When this is leading to a Copy and not a Move, we would get two overlapping floating windows. Could we possibly dock them together?
IMGUI_DEBUG_LOG_DOCKING ( " Remap window settings '%s' -> '%s' \n " , src_window_name , dst_window_name ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] Remap window settings '%s' -> '%s'\n " , src_window_name , dst_window_name ) ;
DockBuilderCopyWindowSettings ( src_window_name , dst_window_name ) ;
}
}
@ -16855,7 +16909,7 @@ void ImGui::DockBuilderCopyDockSpace(ImGuiID src_dockspace_id, ImGuiID dst_docks
continue ;
// Docked windows gets redocked into the new node hierarchy.
IMGUI_DEBUG_LOG_DOCKING ( " Remap window '%s' %08X -> %08X \n " , window - > Name , src_dock_id , dst_dock_id ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] Remap window '%s' %08X -> %08X\n " , window - > Name , src_dock_id , dst_dock_id ) ;
DockBuilderDockWindow ( window - > Name , dst_dock_id ) ;
}
}
@ -17179,7 +17233,7 @@ void ImGui::BeginDockableDragDropTarget(ImGuiWindow* window)
static void ImGui : : DockSettingsRenameNodeReferences ( ImGuiID old_node_id , ImGuiID new_node_id )
{
ImGuiContext & g = * GImGui ;
IMGUI_DEBUG_LOG_DOCKING ( " DockSettingsRenameNodeReferences: from 0x%08X -> to 0x%08X \n " , old_node_id , new_node_id ) ;
IMGUI_DEBUG_LOG_DOCKING ( " [docking] DockSettingsRenameNodeReferences: from 0x%08X -> to 0x%08X\n " , old_node_id , new_node_id ) ;
for ( int window_n = 0 ; window_n < g . Windows . Size ; window_n + + )
{
ImGuiWindow * window = g . Windows [ window_n ] ;
@ -17801,8 +17855,19 @@ void ImGui::ShowMetricsWindow(bool* p_open)
TreePop ( ) ;
}
// The Item Picker tool is super useful to visually select an item and break into the call-stack of where it was submitted.
if ( Checkbox ( " Show Item Picker " , & g . DebugItemPickerActive ) & & g . DebugItemPickerActive )
DebugStartItemPicker ( ) ;
SameLine ( ) ;
MetricsHelpMarker ( " Will call the IM_DEBUG_BREAK() macro to break in debugger. \n Warning: If you don't have a debugger attached, this will probably crash. " ) ;
// Stack Tool is your best friend!
Checkbox ( " Show Debug Log " , & cfg - > ShowDebugLog ) ;
SameLine ( ) ;
MetricsHelpMarker ( " You can also call ImGui::ShowDebugLogWindow() from your code. " ) ;
// Stack Tool is your best friend!
Checkbox ( " Show stack tool " , & cfg - > ShowStackTool ) ;
Checkbox ( " Show Stack T ool " , & cfg - > ShowStackTool ) ;
SameLine ( ) ;
MetricsHelpMarker ( " You can also call ImGui::ShowStackToolWindow() from your code. " ) ;
@ -17868,12 +17933,6 @@ void ImGui::ShowMetricsWindow(bool* p_open)
}
}
// The Item Picker tool is super useful to visually select an item and break into the call-stack of where it was submitted.
if ( Button ( " Item Picker.. " ) )
DebugStartItemPicker ( ) ;
SameLine ( ) ;
MetricsHelpMarker ( " Will call the IM_DEBUG_BREAK() macro to break in debugger. \n Warning: If you don't have a debugger attached, this will probably crash. " ) ;
TreePop ( ) ;
}
@ -18734,6 +18793,63 @@ void ImGui::DebugNodeWindowsListByBeginStackParent(ImGuiWindow** windows, int wi
}
}
//-----------------------------------------------------------------------------
// [SECTION] DEBUG LOG
//-----------------------------------------------------------------------------
void ImGui : : DebugLog ( const char * fmt , . . . )
{
va_list args ;
va_start ( args , fmt ) ;
DebugLogV ( fmt , args ) ;
va_end ( args ) ;
}
void ImGui : : DebugLogV ( const char * fmt , va_list args )
{
ImGuiContext & g = * GImGui ;
const int old_size = g . DebugLogBuf . size ( ) ;
g . DebugLogBuf . appendf ( " [%05d] " , g . FrameCount ) ;
g . DebugLogBuf . appendfv ( fmt , args ) ;
if ( g . DebugLogFlags & ImGuiDebugLogFlags_OutputToTTY )
IMGUI_DEBUG_PRINTF ( " %s " , g . DebugLogBuf . begin ( ) + old_size ) ;
}
void ImGui : : ShowDebugLogWindow ( bool * p_open )
{
ImGuiContext & g = * GImGui ;
if ( ! ( g . NextWindowData . Flags & ImGuiNextWindowDataFlags_HasSize ) )
SetNextWindowSize ( ImVec2 ( 0.0f , GetFontSize ( ) * 12.0f ) , ImGuiCond_FirstUseEver ) ;
if ( ! Begin ( " Dear ImGui Debug Log " , p_open ) | | GetCurrentWindow ( ) - > BeginCount > 1 )
{
End ( ) ;
return ;
}
AlignTextToFramePadding ( ) ;
Text ( " Log events: " ) ;
SameLine ( ) ; CheckboxFlags ( " All " , & g . DebugLogFlags , ImGuiDebugLogFlags_EventMask_ ) ;
SameLine ( ) ; CheckboxFlags ( " ActiveId " , & g . DebugLogFlags , ImGuiDebugLogFlags_EventActiveId ) ;
SameLine ( ) ; CheckboxFlags ( " Focus " , & g . DebugLogFlags , ImGuiDebugLogFlags_EventFocus ) ;
SameLine ( ) ; CheckboxFlags ( " Popup " , & g . DebugLogFlags , ImGuiDebugLogFlags_EventPopup ) ;
SameLine ( ) ; CheckboxFlags ( " Nav " , & g . DebugLogFlags , ImGuiDebugLogFlags_EventNav ) ;
SameLine ( ) ; CheckboxFlags ( " Docking " , & g . DebugLogFlags , ImGuiDebugLogFlags_EventDocking ) ;
SameLine ( ) ; CheckboxFlags ( " Viewport " , & g . DebugLogFlags , ImGuiDebugLogFlags_EventViewport ) ;
if ( SmallButton ( " Clear " ) )
g . DebugLogBuf . clear ( ) ;
SameLine ( ) ;
if ( SmallButton ( " Copy " ) )
SetClipboardText ( g . DebugLogBuf . c_str ( ) ) ;
BeginChild ( " ##log " , ImVec2 ( 0.0f , 0.0f ) , true , ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar ) ;
TextUnformatted ( g . DebugLogBuf . begin ( ) , g . DebugLogBuf . end ( ) ) ; // FIXME-OPT: Could use a line index, but TextUnformatted() has a semi-decent fast path for large text.
if ( GetScrollY ( ) > = GetScrollMaxY ( ) )
SetScrollHereY ( 1.0f ) ;
EndChild ( ) ;
End ( ) ;
}
//-----------------------------------------------------------------------------
// [SECTION] OTHER DEBUG TOOLS (ITEM PICKER, STACK TOOL)
//-----------------------------------------------------------------------------
@ -18960,6 +19076,9 @@ void ImGui::DebugNodeWindowSettings(ImGuiWindowSettings*) {}
void ImGui : : DebugNodeWindowsList ( ImVector < ImGuiWindow * > * , const char * ) { }
void ImGui : : DebugNodeViewport ( ImGuiViewportP * ) { }
void ImGui : : DebugLog ( const char * , . . . ) { }
void ImGui : : DebugLogV ( const char * , va_list ) { }
void ImGui : : ShowDebugLogWindow ( bool * ) { }
void ImGui : : ShowStackToolWindow ( bool * ) { }
void ImGui : : DebugHookIdInfo ( ImGuiID , ImGuiDataType , const void * , const void * ) { }
void ImGui : : UpdateDebugToolItemPicker ( ) { }