@ -2048,7 +2048,7 @@ static void SetCursorPosYAndSetupDummyPrevLine(float pos_y, float line_height)
ImGui : : SetCursorPosY ( pos_y ) ;
ImGuiWindow * window = ImGui : : GetCurrentWindow ( ) ;
window - > DC . CursorPosPrevLine . y = window - > DC . CursorPos . y - line_height ; // Setting those fields so that SetScrollHere() can properly function after the end of our clipper usage.
window - > DC . PrevLine Height = ( line_height - GImGui - > Style . ItemSpacing . y ) ; // If we end up needing more accurate data (to e.g. use SameLine) we may as well make the clipper have a fourth step to let user process and display the last item in their list.
window - > DC . PrevLine Size. y = ( line_height - GImGui - > Style . ItemSpacing . y ) ; // If we end up needing more accurate data (to e.g. use SameLine) we may as well make the clipper have a fourth step to let user process and display the last item in their list.
if ( window - > DC . ColumnsSet )
window - > DC . ColumnsSet - > LineMinY = window - > DC . CursorPos . y ; // Setting this so that cell Y position are set properly
}
@ -2379,18 +2379,18 @@ void ImGui::ItemSize(const ImVec2& size, float text_offset_y)
return ;
// Always align ourselves on pixel boundaries
const float line_height = ImMax ( window - > DC . CurrentLine Height , size . y ) ;
const float line_height = ImMax ( window - > DC . CurrentLine Size. y , size . y ) ;
const float text_base_offset = ImMax ( window - > DC . CurrentLineTextBaseOffset , text_offset_y ) ;
//if (g.IO.KeyAlt) window->DrawList->AddRect(window->DC.CursorPos, window->DC.CursorPos + ImVec2(size.x, line_height), IM_COL32(255,0,0,200)); // [DEBUG]
window - > DC . CursorPosPrevLine = ImVec2 ( window - > DC . CursorPos . x + size . x , window - > DC . CursorPos . y ) ;
window - > DC . CursorPos = ImVec2 ( ( float ) ( int ) ( window - > Pos . x + window - > DC . Indent X + window - > DC . ColumnsOffsetX ) , ( float ) ( int ) ( window - > DC . CursorPos . y + line_height + g . Style . ItemSpacing . y ) ) ;
window - > DC . CursorPos = ImVec2 ( ( float ) ( int ) ( window - > Pos . x + window - > DC . Indent . x + window - > DC . ColumnsOffset . x ) , ( float ) ( int ) ( window - > DC . CursorPos . y + line_height + g . Style . ItemSpacing . y ) ) ;
window - > DC . CursorMaxPos . x = ImMax ( window - > DC . CursorMaxPos . x , window - > DC . CursorPosPrevLine . x ) ;
window - > DC . CursorMaxPos . y = ImMax ( window - > DC . CursorMaxPos . y , window - > DC . CursorPos . y - g . Style . ItemSpacing . y ) ;
//if (g.IO.KeyAlt) window->DrawList->AddCircle(window->DC.CursorMaxPos, 3.0f, IM_COL32(255,0,0,255), 4); // [DEBUG]
window - > DC . PrevLine Height = line_height ;
window - > DC . PrevLine Size. y = line_height ;
window - > DC . PrevLineTextBaseOffset = text_base_offset ;
window - > DC . CurrentLine Height = window - > DC . CurrentLineTextBaseOffset = 0.0f ;
window - > DC . CurrentLine Size. y = window - > DC . CurrentLineTextBaseOffset = 0.0f ;
// Horizontal layout mode
if ( window - > DC . LayoutType = = ImGuiLayoutType_Horizontal )
@ -6676,14 +6676,14 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// Setup drawing context
// (NB: That term "drawing context / DC" lost its meaning a long time ago. Initially was meant to hold transient data only. Nowadays difference between window-> and window->DC-> is dubious.)
window - > DC . Indent X = 0.0f + window - > WindowPadding . x - window - > Scroll . x ;
window - > DC . GroupOffset X = 0.0f ;
window - > DC . ColumnsOffset X = 0.0f ;
window - > DC . CursorStartPos = window - > Pos + ImVec2 ( window - > DC . Indent X + window - > DC . ColumnsOffsetX , window - > TitleBarHeight ( ) + window - > MenuBarHeight ( ) + window - > WindowPadding . y - window - > Scroll . y ) ;
window - > DC . Indent . x = 0.0f + window - > WindowPadding . x - window - > Scroll . x ;
window - > DC . GroupOffset . x = 0.0f ;
window - > DC . ColumnsOffset . x = 0.0f ;
window - > DC . CursorStartPos = window - > Pos + ImVec2 ( window - > DC . Indent . x + window - > DC . ColumnsOffset . x , window - > TitleBarHeight ( ) + window - > MenuBarHeight ( ) + window - > WindowPadding . y - window - > Scroll . y ) ;
window - > DC . CursorPos = window - > DC . CursorStartPos ;
window - > DC . CursorPosPrevLine = window - > DC . CursorPos ;
window - > DC . CursorMaxPos = window - > DC . CursorStartPos ;
window - > DC . CurrentLine Height = window - > DC . PrevLineHeight = 0.0f ;
window - > DC . CurrentLine Size = window - > DC . PrevLineSize = ImVec2 ( 0.0f , 0.0f ) ;
window - > DC . CurrentLineTextBaseOffset = window - > DC . PrevLineTextBaseOffset = 0.0f ;
window - > DC . NavHideHighlightOneFrame = false ;
window - > DC . NavHasScroll = ( GetScrollMaxY ( ) > 0.0f ) ;
@ -7856,7 +7856,7 @@ void ImGui::SetScrollHere(float center_y_ratio)
{
ImGuiWindow * window = GetCurrentWindow ( ) ;
float target_y = window - > DC . CursorPosPrevLine . y - window - > Pos . y ; // Top of last item, in window space
target_y + = ( window - > DC . PrevLine Height * center_y_ratio ) + ( GImGui - > Style . ItemSpacing . y * ( center_y_ratio - 0.5f ) * 2.0f ) ; // Precisely aim above, in the middle or below the last line.
target_y + = ( window - > DC . PrevLine Size. y * center_y_ratio ) + ( GImGui - > Style . ItemSpacing . y * ( center_y_ratio - 0.5f ) * 2.0f ) ; // Precisely aim above, in the middle or below the last line.
SetScrollFromPosY ( target_y , center_y_ratio ) ;
}
@ -8081,7 +8081,7 @@ void ImGui::AlignTextToFramePadding()
return ;
ImGuiContext & g = * GImGui ;
window - > DC . CurrentLine Height = ImMax ( window - > DC . CurrentLine Height , g . FontSize + g . Style . FramePadding . y * 2 ) ;
window - > DC . CurrentLine Size. y = ImMax ( window - > DC . CurrentLine Size. y , g . FontSize + g . Style . FramePadding . y * 2 ) ;
window - > DC . CurrentLineTextBaseOffset = ImMax ( window - > DC . CurrentLineTextBaseOffset , g . Style . FramePadding . y ) ;
}
@ -8672,7 +8672,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
// We vertically grow up to current line height up the typical widget height.
const float text_base_offset_y = ImMax ( padding . y , window - > DC . CurrentLineTextBaseOffset ) ; // Latch before ItemSize changes it
const float frame_height = ImMax ( ImMin ( window - > DC . CurrentLine Height , g . FontSize + style . FramePadding . y * 2 ) , label_size . y + padding . y * 2 ) ;
const float frame_height = ImMax ( ImMin ( window - > DC . CurrentLine Size. y , g . FontSize + style . FramePadding . y * 2 ) , label_size . y + padding . y * 2 ) ;
ImRect frame_bb = ImRect ( window - > DC . CursorPos , ImVec2 ( window - > Pos . x + GetContentRegionMax ( ) . x , window - > DC . CursorPos . y + frame_height ) ) ;
if ( display_frame )
{
@ -8997,7 +8997,7 @@ void ImGui::Bullet()
ImGuiContext & g = * GImGui ;
const ImGuiStyle & style = g . Style ;
const float line_height = ImMax ( ImMin ( window - > DC . CurrentLine Height , g . FontSize + g . Style . FramePadding . y * 2 ) , g . FontSize ) ;
const float line_height = ImMax ( ImMin ( window - > DC . CurrentLine Size. y , g . FontSize + g . Style . FramePadding . y * 2 ) , g . FontSize ) ;
const ImRect bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( g . FontSize , line_height ) ) ;
ItemSize ( bb ) ;
if ( ! ItemAdd ( bb , 0 ) )
@ -9025,7 +9025,7 @@ void ImGui::BulletTextV(const char* fmt, va_list args)
const char * text_end = text_begin + ImFormatStringV ( g . TempBuffer , IM_ARRAYSIZE ( g . TempBuffer ) , fmt , args ) ;
const ImVec2 label_size = CalcTextSize ( text_begin , text_end , false ) ;
const float text_base_offset_y = ImMax ( 0.0f , window - > DC . CurrentLineTextBaseOffset ) ; // Latch before ItemSize changes it
const float line_height = ImMax ( ImMin ( window - > DC . CurrentLine Height , g . FontSize + g . Style . FramePadding . y * 2 ) , g . FontSize ) ;
const float line_height = ImMax ( ImMin ( window - > DC . CurrentLine Size. y , g . FontSize + g . Style . FramePadding . y * 2 ) , g . FontSize ) ;
const ImRect bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( g . FontSize + ( label_size . x > 0.0f ? ( label_size . x + style . FramePadding . x * 2 ) : 0.0f ) , ImMax ( line_height , label_size . y ) ) ) ; // Empty text doesn't add padding
ItemSize ( bb ) ;
if ( ! ItemAdd ( bb , 0 ) )
@ -13095,7 +13095,7 @@ void ImGui::Separator()
float x1 = window - > Pos . x ;
float x2 = window - > Pos . x + window - > Size . x ;
if ( ! window - > DC . GroupStack . empty ( ) )
x1 + = window - > DC . Indent X ;
x1 + = window - > DC . Indent . x ;
const ImRect bb ( ImVec2 ( x1 , window - > DC . CursorPos . y ) , ImVec2 ( x2 , window - > DC . CursorPos . y + 1.0f ) ) ;
ItemSize ( ImVec2 ( 0.0f , 0.0f ) ) ; // NB: we don't provide our width so that it doesn't get feed back into AutoFit, we don't provide height to not alter layout.
@ -13126,7 +13126,7 @@ void ImGui::VerticalSeparator()
ImGuiContext & g = * GImGui ;
float y1 = window - > DC . CursorPos . y ;
float y2 = window - > DC . CursorPos . y + window - > DC . CurrentLine Height ;
float y2 = window - > DC . CursorPos . y + window - > DC . CurrentLine Size. y ;
const ImRect bb ( ImVec2 ( window - > DC . CursorPos . x , y1 ) , ImVec2 ( window - > DC . CursorPos . x + 1.0f , y2 ) ) ;
ItemSize ( ImVec2 ( bb . GetWidth ( ) , 0.0f ) ) ;
if ( ! ItemAdd ( bb , 0 ) )
@ -13236,19 +13236,19 @@ void ImGui::BeginGroup()
ImGuiGroupData & group_data = window - > DC . GroupStack . back ( ) ;
group_data . BackupCursorPos = window - > DC . CursorPos ;
group_data . BackupCursorMaxPos = window - > DC . CursorMaxPos ;
group_data . BackupIndent X = window - > DC . Indent X ;
group_data . BackupGroupOffset X = window - > DC . GroupOffset X ;
group_data . BackupCurrentLine Height = window - > DC . CurrentLineHeight ;
group_data . BackupIndent = window - > DC . Indent ;
group_data . BackupGroupOffset = window - > DC . GroupOffset ;
group_data . BackupCurrentLine Size = window - > DC . CurrentLineSize ;
group_data . BackupCurrentLineTextBaseOffset = window - > DC . CurrentLineTextBaseOffset ;
group_data . BackupLogLinePosY = window - > DC . LogLinePosY ;
group_data . BackupActiveIdIsAlive = g . ActiveIdIsAlive ;
group_data . BackupActiveIdPreviousFrameIsAlive = g . ActiveIdPreviousFrameIsAlive ;
group_data . AdvanceCursor = true ;
window - > DC . GroupOffset X = window - > DC . CursorPos . x - window - > Pos . x - window - > DC . ColumnsOffset X ;
window - > DC . Indent X = window - > DC . GroupOffset X ;
window - > DC . GroupOffset . x = window - > DC . CursorPos . x - window - > Pos . x - window - > DC . ColumnsOffset . x ;
window - > DC . Indent = window - > DC . GroupOffset ;
window - > DC . CursorMaxPos = window - > DC . CursorPos ;
window - > DC . CurrentLine Height = 0.0f ;
window - > DC . CurrentLine Size = ImVec2 ( 0.0f , 0.0f ) ;
window - > DC . LogLinePosY = window - > DC . CursorPos . y - 9999.0f ; // To enforce Log carriage return
}
@ -13265,9 +13265,9 @@ void ImGui::EndGroup()
window - > DC . CursorPos = group_data . BackupCursorPos ;
window - > DC . CursorMaxPos = ImMax ( group_data . BackupCursorMaxPos , window - > DC . CursorMaxPos ) ;
window - > DC . Indent X = group_data . BackupIndent X ;
window - > DC . GroupOffset X = group_data . BackupGroupOffset X ;
window - > DC . CurrentLine Height = group_data . BackupCurrentLineHeight ;
window - > DC . Indent = group_data . BackupIndent ;
window - > DC . GroupOffset = group_data . BackupGroupOffset ;
window - > DC . CurrentLine Size = group_data . BackupCurrentLineSize ;
window - > DC . CurrentLineTextBaseOffset = group_data . BackupCurrentLineTextBaseOffset ;
window - > DC . LogLinePosY = window - > DC . CursorPos . y - 9999.0f ; // To enforce Log carriage return
@ -13307,7 +13307,7 @@ void ImGui::SameLine(float pos_x, float spacing_w)
if ( pos_x ! = 0.0f )
{
if ( spacing_w < 0.0f ) spacing_w = 0.0f ;
window - > DC . CursorPos . x = window - > Pos . x - window - > Scroll . x + pos_x + spacing_w + window - > DC . GroupOffset X + window - > DC . ColumnsOffsetX ;
window - > DC . CursorPos . x = window - > Pos . x - window - > Scroll . x + pos_x + spacing_w + window - > DC . GroupOffset . x + window - > DC . ColumnsOffset . x ;
window - > DC . CursorPos . y = window - > DC . CursorPosPrevLine . y ;
}
else
@ -13316,7 +13316,7 @@ void ImGui::SameLine(float pos_x, float spacing_w)
window - > DC . CursorPos . x = window - > DC . CursorPosPrevLine . x + spacing_w ;
window - > DC . CursorPos . y = window - > DC . CursorPosPrevLine . y ;
}
window - > DC . CurrentLine Height = window - > DC . PrevLineHeight ;
window - > DC . CurrentLine Size = window - > DC . PrevLineSize ;
window - > DC . CurrentLineTextBaseOffset = window - > DC . PrevLineTextBaseOffset ;
}
@ -13329,7 +13329,7 @@ void ImGui::NewLine()
ImGuiContext & g = * GImGui ;
const ImGuiLayoutType backup_layout_type = window - > DC . LayoutType ;
window - > DC . LayoutType = ImGuiLayoutType_Vertical ;
if ( window - > DC . CurrentLine Height > 0.0f ) // In the event that we are on a line with items that is smaller that FontSize high, we will preserve its height.
if ( window - > DC . CurrentLine Size. y > 0.0f ) // In the event that we are on a line with items that is smaller that FontSize high, we will preserve its height.
ItemSize ( ImVec2 ( 0 , 0 ) ) ;
else
ItemSize ( ImVec2 ( 0.0f , g . FontSize ) ) ;
@ -13351,19 +13351,19 @@ void ImGui::NextColumn()
if ( + + columns - > Current < columns - > Count )
{
// Columns 1+ cancel out IndentX
window - > DC . ColumnsOffset X = GetColumnOffset ( columns - > Current ) - window - > DC . Indent X + g . Style . ItemSpacing . x ;
window - > DC . ColumnsOffset . x = GetColumnOffset ( columns - > Current ) - window - > DC . Indent . x + g . Style . ItemSpacing . x ;
window - > DrawList - > ChannelsSetCurrent ( columns - > Current ) ;
}
else
{
window - > DC . ColumnsOffset X = 0.0f ;
window - > DC . ColumnsOffset . x = 0.0f ;
window - > DrawList - > ChannelsSetCurrent ( 0 ) ;
columns - > Current = 0 ;
columns - > LineMinY = columns - > LineMaxY ;
}
window - > DC . CursorPos . x = ( float ) ( int ) ( window - > Pos . x + window - > DC . Indent X + window - > DC . ColumnsOffsetX ) ;
window - > DC . CursorPos . x = ( float ) ( int ) ( window - > Pos . x + window - > DC . Indent . x + window - > DC . ColumnsOffset . x ) ;
window - > DC . CursorPos . y = columns - > LineMinY ;
window - > DC . CurrentLine Height = 0.0f ;
window - > DC . CurrentLine Size = ImVec2 ( 0.0f , 0.0f ) ;
window - > DC . CurrentLineTextBaseOffset = 0.0f ;
PushColumnClipRect ( ) ;
@ -13529,13 +13529,13 @@ void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiColumnsFlag
// Set state for first column
const float content_region_width = ( window - > SizeContentsExplicit . x ! = 0.0f ) ? ( window - > SizeContentsExplicit . x ) : ( window - > InnerClipRect . Max . x - window - > Pos . x ) ;
columns - > MinX = window - > DC . Indent X - g . Style . ItemSpacing . x ; // Lock our horizontal range
columns - > MinX = window - > DC . Indent . x - g . Style . ItemSpacing . x ; // Lock our horizontal range
columns - > MaxX = ImMax ( content_region_width - window - > Scroll . x , columns - > MinX + 1.0f ) ;
columns - > StartPosY = window - > DC . CursorPos . y ;
columns - > StartMaxPosX = window - > DC . CursorMaxPos . x ;
columns - > LineMinY = columns - > LineMaxY = window - > DC . CursorPos . y ;
window - > DC . ColumnsOffset X = 0.0f ;
window - > DC . CursorPos . x = ( float ) ( int ) ( window - > Pos . x + window - > DC . Indent X + window - > DC . ColumnsOffsetX ) ;
window - > DC . ColumnsOffset . x = 0.0f ;
window - > DC . CursorPos . x = ( float ) ( int ) ( window - > Pos . x + window - > DC . Indent . x + window - > DC . ColumnsOffset . x ) ;
// Clear data if columns count changed
if ( columns - > Columns . Size ! = 0 & & columns - > Columns . Size ! = columns_count + 1 )
@ -13632,8 +13632,8 @@ void ImGui::EndColumns()
columns - > IsBeingResized = is_being_resized ;
window - > DC . ColumnsSet = NULL ;
window - > DC . ColumnsOffset X = 0.0f ;
window - > DC . CursorPos . x = ( float ) ( int ) ( window - > Pos . x + window - > DC . Indent X + window - > DC . ColumnsOffsetX ) ;
window - > DC . ColumnsOffset . x = 0.0f ;
window - > DC . CursorPos . x = ( float ) ( int ) ( window - > Pos . x + window - > DC . Indent . x + window - > DC . ColumnsOffset . x ) ;
}
// [2018-03: This is currently the only public API, while we are working on making BeginColumns/EndColumns user-facing]
@ -13658,16 +13658,16 @@ void ImGui::Indent(float indent_w)
{
ImGuiContext & g = * GImGui ;
ImGuiWindow * window = GetCurrentWindow ( ) ;
window - > DC . Indent X + = ( indent_w ! = 0.0f ) ? indent_w : g . Style . IndentSpacing ;
window - > DC . CursorPos . x = window - > Pos . x + window - > DC . Indent X + window - > DC . ColumnsOffsetX ;
window - > DC . Indent . x + = ( indent_w ! = 0.0f ) ? indent_w : g . Style . IndentSpacing ;
window - > DC . CursorPos . x = window - > Pos . x + window - > DC . Indent . x + window - > DC . ColumnsOffset . x ;
}
void ImGui : : Unindent ( float indent_w )
{
ImGuiContext & g = * GImGui ;
ImGuiWindow * window = GetCurrentWindow ( ) ;
window - > DC . Indent X - = ( indent_w ! = 0.0f ) ? indent_w : g . Style . IndentSpacing ;
window - > DC . CursorPos . x = window - > Pos . x + window - > DC . Indent X + window - > DC . ColumnsOffsetX ;
window - > DC . Indent . x - = ( indent_w ! = 0.0f ) ? indent_w : g . Style . IndentSpacing ;
window - > DC . CursorPos . x = window - > Pos . x + window - > DC . Indent . x + window - > DC . ColumnsOffset . x ;
}
void ImGui : : TreePush ( const char * str_id )