Skip to content

Commit 286aba4

Browse files
committed
Update imgui: 1.91.9b -> 1.92.0 WIP (d896eab @ docking)
Adds dynamic font scaling and built-in MacOS dpi awareness
1 parent 9508f45 commit 286aba4

18 files changed

+5605
-2554
lines changed

source/plate/vendor/imgui/imgui.cpp

Lines changed: 1043 additions & 290 deletions
Large diffs are not rendered by default.

source/plate/vendor/imgui/imgui.h

Lines changed: 530 additions & 185 deletions
Large diffs are not rendered by default.

source/plate/vendor/imgui/imgui_demo.cpp

Lines changed: 372 additions & 270 deletions
Large diffs are not rendered by default.

source/plate/vendor/imgui/imgui_draw.cpp

Lines changed: 2249 additions & 835 deletions
Large diffs are not rendered by default.

source/plate/vendor/imgui/imgui_internal.h

Lines changed: 300 additions & 49 deletions
Large diffs are not rendered by default.

source/plate/vendor/imgui/imgui_tables.cpp

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// dear imgui, v1.91b
1+
// dear imgui, v1.92.0 WIP
22
// (tables and columns code)
33

44
/*
@@ -451,6 +451,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
451451
// But at this point we do NOT have a correct value for .Max.y (unless a height has been explicitly passed in). It will only be updated in EndTable().
452452
table->WorkRect = table->OuterRect = table->InnerRect = outer_rect;
453453
table->HasScrollbarYPrev = table->HasScrollbarYCurr = false;
454+
table->InnerWindow->DC.TreeDepth++; // This is designed to always linking ImGuiTreeNodeFlags_DrawLines linking accross a table
454455
}
455456

456457
// Push a standardized ID for both child-using and not-child-using tables
@@ -1510,6 +1511,7 @@ void ImGui::EndTable()
15101511
}
15111512
else
15121513
{
1514+
table->InnerWindow->DC.TreeDepth--;
15131515
ItemSize(table->OuterRect.GetSize());
15141516
ItemAdd(table->OuterRect, 0);
15151517
}
@@ -1951,7 +1953,10 @@ void ImGui::TableEndRow(ImGuiTable* table)
19511953
IM_ASSERT(table->IsInsideRow);
19521954

19531955
if (table->CurrentColumn != -1)
1956+
{
19541957
TableEndCell(table);
1958+
table->CurrentColumn = -1;
1959+
}
19551960

19561961
// Logging
19571962
if (g.LogEnabled)
@@ -2191,6 +2196,7 @@ void ImGui::TableBeginCell(ImGuiTable* table, int column_n)
21912196
g.LastItemData.StatusFlags = 0;
21922197
}
21932198

2199+
// Also see TablePushColumnChannel()
21942200
if (table->Flags & ImGuiTableFlags_NoClip)
21952201
{
21962202
// FIXME: if we end up drawing all borders/bg in EndTable, could remove this and just assert that channel hasn't changed.
@@ -2464,10 +2470,38 @@ void ImGui::TablePopBackgroundChannel()
24642470
ImGuiContext& g = *GImGui;
24652471
ImGuiWindow* window = g.CurrentWindow;
24662472
ImGuiTable* table = g.CurrentTable;
2467-
ImGuiTableColumn* column = &table->Columns[table->CurrentColumn];
24682473

24692474
// Optimization: avoid PopClipRect() + SetCurrentChannel()
24702475
SetWindowClipRectBeforeSetChannel(window, table->HostBackupInnerClipRect);
2476+
table->DrawSplitter->SetCurrentChannel(window->DrawList, table->Columns[table->CurrentColumn].DrawChannelCurrent);
2477+
}
2478+
2479+
// Also see TableBeginCell()
2480+
void ImGui::TablePushColumnChannel(int column_n)
2481+
{
2482+
ImGuiContext& g = *GImGui;
2483+
ImGuiTable* table = g.CurrentTable;
2484+
2485+
// Optimization: avoid SetCurrentChannel() + PushClipRect()
2486+
if (table->Flags & ImGuiTableFlags_NoClip)
2487+
return;
2488+
ImGuiWindow* window = g.CurrentWindow;
2489+
const ImGuiTableColumn* column = &table->Columns[column_n];
2490+
SetWindowClipRectBeforeSetChannel(window, column->ClipRect);
2491+
table->DrawSplitter->SetCurrentChannel(window->DrawList, column->DrawChannelCurrent);
2492+
}
2493+
2494+
void ImGui::TablePopColumnChannel()
2495+
{
2496+
ImGuiContext& g = *GImGui;
2497+
ImGuiTable* table = g.CurrentTable;
2498+
2499+
// Optimization: avoid PopClipRect() + SetCurrentChannel()
2500+
if ((table->Flags & ImGuiTableFlags_NoClip) || (table->CurrentColumn == -1)) // Calling TreePop() after TableNextRow() is supported.
2501+
return;
2502+
ImGuiWindow* window = g.CurrentWindow;
2503+
const ImGuiTableColumn* column = &table->Columns[table->CurrentColumn];
2504+
SetWindowClipRectBeforeSetChannel(window, column->ClipRect);
24712505
table->DrawSplitter->SetCurrentChannel(window->DrawList, column->DrawChannelCurrent);
24722506
}
24732507

@@ -3244,7 +3278,7 @@ void ImGui::TableHeader(const char* label)
32443278
// Render clipped label. Clipping here ensure that in the majority of situations, all our header cells will
32453279
// be merged into a single draw call.
32463280
//window->DrawList->AddCircleFilled(ImVec2(ellipsis_max, label_pos.y), 40, IM_COL32_WHITE);
3247-
RenderTextEllipsis(window->DrawList, label_pos, ImVec2(ellipsis_max, label_pos.y + label_height + g.Style.FramePadding.y), ellipsis_max, ellipsis_max, label, label_end, &label_size);
3281+
RenderTextEllipsis(window->DrawList, label_pos, ImVec2(ellipsis_max, bb.Max.y), ellipsis_max, label, label_end, &label_size);
32483282

32493283
const bool text_clipped = label_size.x > (ellipsis_max - label_pos.x);
32503284
if (text_clipped && hovered && g.ActiveId == 0)
@@ -3341,7 +3375,7 @@ void ImGui::TableAngledHeadersRowEx(ImGuiID row_id, float angle, float max_label
33413375
ButtonBehavior(row_r, row_id, NULL, NULL);
33423376
KeepAliveID(row_id);
33433377

3344-
const float ascent_scaled = g.Font->Ascent * g.FontScale; // FIXME: Standardize those scaling factors better
3378+
const float ascent_scaled = g.FontBaked->Ascent * g.FontBakedScale; // FIXME: Standardize those scaling factors better
33453379
const float line_off_for_ascent_x = (ImMax((g.FontSize - ascent_scaled) * 0.5f, 0.0f) / -sin_a) * (flip_label ? -1.0f : 1.0f);
33463380
const ImVec2 padding = g.Style.CellPadding; // We will always use swapped component
33473381
const ImVec2 align = g.Style.TableAngledHeadersTextAlign;
@@ -3396,7 +3430,7 @@ void ImGui::TableAngledHeadersRowEx(ImGuiID row_id, float angle, float max_label
33963430
ImRect clip_r(window->ClipRect.Min, window->ClipRect.Min + ImVec2(clip_width, clip_height));
33973431
int vtx_idx_begin = draw_list->_VtxCurrentIdx;
33983432
PushStyleColor(ImGuiCol_Text, request->TextColor);
3399-
RenderTextEllipsis(draw_list, clip_r.Min, clip_r.Max, clip_r.Max.x, clip_r.Max.x, label_name, label_name_eol, &label_size);
3433+
RenderTextEllipsis(draw_list, clip_r.Min, clip_r.Max, clip_r.Max.x, label_name, label_name_eol, &label_size);
34003434
PopStyleColor();
34013435
int vtx_idx_end = draw_list->_VtxCurrentIdx;
34023436

0 commit comments

Comments
 (0)