Skip to content

Commit

Permalink
imgui 1.81 (britzl#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
dri-richard authored Oct 31, 2023
1 parent f02d243 commit 3f40752
Show file tree
Hide file tree
Showing 9 changed files with 937 additions and 367 deletions.
495 changes: 370 additions & 125 deletions imgui/src/imgui/imgui.cpp

Large diffs are not rendered by default.

116 changes: 88 additions & 28 deletions imgui/src/imgui/imgui.h

Large diffs are not rendered by default.

182 changes: 138 additions & 44 deletions imgui/src/imgui/imgui_demo.cpp

Large diffs are not rendered by default.

161 changes: 115 additions & 46 deletions imgui/src/imgui/imgui_draw.cpp

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions imgui/src/imgui/imgui_impl_opengl3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2021-02-18: OpenGL: Change blending equation to preserve alpha in output buffer.
// 2021-01-03: OpenGL: Backup, setup and restore GL_STENCIL_TEST state.
// 2020-10-23: OpenGL: Backup, setup and restore GL_PRIMITIVE_RESTART state.
// 2020-10-15: OpenGL: Use glGetString(GL_VERSION) instead of glGetIntegerv(GL_MAJOR_VERSION, ...) when the later returns zero (e.g. Desktop GL 2.x)
Expand Down Expand Up @@ -248,7 +247,7 @@ static void ImGui_ImplOpenGL3_SetupRenderState(ImDrawData* draw_data, int fb_wid
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill
glEnable(GL_BLEND);
glBlendEquation(GL_FUNC_ADD);
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
glDisable(GL_STENCIL_TEST);
Expand Down
120 changes: 84 additions & 36 deletions imgui/src/imgui/imgui_internal.h

Large diffs are not rendered by default.

35 changes: 31 additions & 4 deletions imgui/src/imgui/imgui_tables.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// dear imgui, v1.80
// dear imgui, v1.81
// (tables and columns code)

/*
Expand Down Expand Up @@ -126,12 +126,12 @@ Index of this file:
// - with Table policy ImGuiTableFlags_SizingFixedSame --> default Column policy is ImGuiTableColumnFlags_WidthFixed, default Width is max of all contents width
// - with Table policy ImGuiTableFlags_SizingStretchSame --> default Column policy is ImGuiTableColumnFlags_WidthStretch, default Weight is 1.0f
// - with Table policy ImGuiTableFlags_SizingStretchWeight --> default Column policy is ImGuiTableColumnFlags_WidthStretch, default Weight is proportional to contents
// Default Width and default Weight can be overriden when calling TableSetupColumn().
// Default Width and default Weight can be overridden when calling TableSetupColumn().
//-----------------------------------------------------------------------------
// About mixing Fixed/Auto and Stretch columns together:
// - the typical use of mixing sizing policies is: any number of LEADING Fixed columns, followed by one or two TRAILING Stretch columns.
// - using mixed policies with ScrollX does not make much sense, as using Stretch columns with ScrollX does not make much sense in the first place!
// that is, unless 'inner_width' is passed to BeginTable() to explicitely provide a total width to layout columns in.
// that is, unless 'inner_width' is passed to BeginTable() to explicitly provide a total width to layout columns in.
// - when using ImGuiTableFlags_SizingFixedSame with mixed columns, only the Fixed/Auto columns will match their widths to the maximum contents width.
// - when using ImGuiTableFlags_SizingStretchSame with mixed columns, only the Stretch columns will match their weight/widths.
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -1367,7 +1367,7 @@ void ImGui::TableSetupColumn(const char* label, ImGuiTableColumnFlags flags, flo
// Assert when passing a width or weight if policy is entirely left to default, to avoid storing width into weight and vice-versa.
// Give a grace to users of ImGuiTableFlags_ScrollX.
if (table->IsDefaultSizingPolicy && (flags & ImGuiTableColumnFlags_WidthMask_) == 0 && (flags & ImGuiTableFlags_ScrollX) == 0)
IM_ASSERT(init_width_or_weight <= 0.0f && "Can only specify width/weight if sizing policy is set explicitely in either Table or Column.");
IM_ASSERT(init_width_or_weight <= 0.0f && "Can only specify width/weight if sizing policy is set explicitly in either Table or Column.");

// When passing a width automatically enforce WidthFixed policy
// (whereas TableSetupColumnFlags would default to WidthAuto if table is not Resizable)
Expand Down Expand Up @@ -1460,6 +1460,21 @@ const char* ImGui::TableGetColumnName(const ImGuiTable* table, int column_n)
return &table->ColumnsNames.Buf[column->NameOffset];
}

// For the getter you can use (TableGetColumnFlags() & ImGuiTableColumnFlags_IsEnabled)
void ImGui::TableSetColumnEnabled(int column_n, bool enabled)
{
ImGuiContext& g = *GImGui;
ImGuiTable* table = g.CurrentTable;
IM_ASSERT(table != NULL);
if (!table)
return;
if (column_n < 0)
column_n = table->CurrentColumn;
IM_ASSERT(column_n >= 0 && column_n < table->ColumnsCount);
ImGuiTableColumn* column = &table->Columns[column_n];
column->IsEnabledNextFrame = enabled;
}

// We allow querying for an extra column in order to poll the IsHovered state of the right-most section
ImGuiTableColumnFlags ImGui::TableGetColumnFlags(int column_n)
{
Expand Down Expand Up @@ -1639,6 +1654,10 @@ void ImGui::TableEndRow(ImGuiTable* table)
if (table->CurrentColumn != -1)
TableEndCell(table);

// Logging
if (g.LogEnabled)
LogRenderedText(NULL, "|");

// Position cursor at the bottom of our row so it can be used for e.g. clipping calculation. However it is
// likely that the next call to TableBeginCell() will reposition the cursor to take account of vertical padding.
window->DC.CursorPos.y = table->RowPosY2;
Expand Down Expand Up @@ -1875,6 +1894,14 @@ void ImGui::TableBeginCell(ImGuiTable* table, int column_n)
SetWindowClipRectBeforeSetChannel(window, column->ClipRect);
table->DrawSplitter.SetCurrentChannel(window->DrawList, column->DrawChannelCurrent);
}

// Logging
ImGuiContext& g = *GImGui;
if (g.LogEnabled && !column->IsSkipItems)
{
LogRenderedText(&window->DC.CursorPos, "|");
g.LogLinePosY = FLT_MAX;
}
}

// [Internal] Called by TableNextRow()/TableSetColumnIndex()/TableNextColumn()
Expand Down
Loading

0 comments on commit 3f40752

Please sign in to comment.