|
@@ -350,6 +350,8 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|
|
g.TablesTempDataStack.resize(g.CurrentTableStackIdx + 1, ImGuiTableTempData());
|
|
|
ImGuiTableTempData* temp_data = table->TempData = &g.TablesTempDataStack[g.CurrentTableStackIdx];
|
|
|
temp_data->TableIndex = table_idx;
|
|
|
+ table->DrawSplitter = &table->TempData->DrawSplitter;
|
|
|
+ table->DrawSplitter->Clear();
|
|
|
|
|
|
// Fix flags
|
|
|
table->IsDefaultSizingPolicy = (flags & ImGuiTableFlags_SizingMask_) == 0;
|
|
@@ -475,6 +477,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|
|
if (table_idx >= g.TablesLastTimeActive.Size)
|
|
|
g.TablesLastTimeActive.resize(table_idx + 1, -1.0f);
|
|
|
g.TablesLastTimeActive[table_idx] = (float)g.Time;
|
|
|
+ temp_data->LastTimeActive = (float)g.Time;
|
|
|
table->MemoryCompacted = false;
|
|
|
|
|
|
// Setup memory buffer (clear data if columns count changed)
|
|
@@ -1123,7 +1126,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
|
|
// Initial state
|
|
|
ImGuiWindow* inner_window = table->InnerWindow;
|
|
|
if (table->Flags & ImGuiTableFlags_NoClip)
|
|
|
- table->DrawSplitter.SetCurrentChannel(inner_window->DrawList, TABLE_DRAW_CHANNEL_NOCLIP);
|
|
|
+ table->DrawSplitter->SetCurrentChannel(inner_window->DrawList, TABLE_DRAW_CHANNEL_NOCLIP);
|
|
|
else
|
|
|
inner_window->DrawList->PushClipRect(inner_window->ClipRect.Min, inner_window->ClipRect.Max, false);
|
|
|
}
|
|
@@ -1273,7 +1276,7 @@ void ImGui::EndTable()
|
|
|
#endif
|
|
|
|
|
|
// Flatten channels and merge draw calls
|
|
|
- ImDrawListSplitter* splitter = &table->DrawSplitter;
|
|
|
+ ImDrawListSplitter* splitter = table->DrawSplitter;
|
|
|
splitter->SetCurrentChannel(inner_window->DrawList, 0);
|
|
|
if ((table->Flags & ImGuiTableFlags_NoClip) == 0)
|
|
|
TableMergeDrawChannels(table);
|
|
@@ -1387,7 +1390,10 @@ void ImGui::EndTable()
|
|
|
temp_data = g.CurrentTableStackIdx >= 0 ? &g.TablesTempDataStack[g.CurrentTableStackIdx] : NULL;
|
|
|
g.CurrentTable = temp_data ? g.Tables.GetByIndex(temp_data->TableIndex) : NULL;
|
|
|
if (g.CurrentTable)
|
|
|
+ {
|
|
|
g.CurrentTable->TempData = temp_data;
|
|
|
+ g.CurrentTable->DrawSplitter = &temp_data->DrawSplitter;
|
|
|
+ }
|
|
|
outer_window->DC.CurrentTableIdx = g.CurrentTable ? g.Tables.GetIndex(g.CurrentTable) : -1;
|
|
|
}
|
|
|
|
|
@@ -1760,7 +1766,7 @@ void ImGui::TableEndRow(ImGuiTable* table)
|
|
|
// always followed by a change of clipping rectangle we perform the smallest overwrite possible here.
|
|
|
if ((table->Flags & ImGuiTableFlags_NoClip) == 0)
|
|
|
window->DrawList->_CmdHeader.ClipRect = table->Bg0ClipRectForDrawCmd.ToVec4();
|
|
|
- table->DrawSplitter.SetCurrentChannel(window->DrawList, TABLE_DRAW_CHANNEL_BG0);
|
|
|
+ table->DrawSplitter->SetCurrentChannel(window->DrawList, TABLE_DRAW_CHANNEL_BG0);
|
|
|
}
|
|
|
|
|
|
// Draw row background
|
|
@@ -1832,7 +1838,7 @@ void ImGui::TableEndRow(ImGuiTable* table)
|
|
|
|
|
|
// Update cliprect ahead of TableBeginCell() so clipper can access to new ClipRect->Min.y
|
|
|
SetWindowClipRectBeforeSetChannel(window, table->Columns[0].ClipRect);
|
|
|
- table->DrawSplitter.SetCurrentChannel(window->DrawList, table->Columns[0].DrawChannelCurrent);
|
|
|
+ table->DrawSplitter->SetCurrentChannel(window->DrawList, table->Columns[0].DrawChannelCurrent);
|
|
|
}
|
|
|
|
|
|
if (!(table->RowFlags & ImGuiTableRowFlags_Headers))
|
|
@@ -1947,14 +1953,14 @@ void ImGui::TableBeginCell(ImGuiTable* table, int column_n)
|
|
|
if (table->Flags & ImGuiTableFlags_NoClip)
|
|
|
{
|
|
|
// FIXME: if we end up drawing all borders/bg in EndTable, could remove this and just assert that channel hasn't changed.
|
|
|
- table->DrawSplitter.SetCurrentChannel(window->DrawList, TABLE_DRAW_CHANNEL_NOCLIP);
|
|
|
+ table->DrawSplitter->SetCurrentChannel(window->DrawList, TABLE_DRAW_CHANNEL_NOCLIP);
|
|
|
//IM_ASSERT(table->DrawSplitter._Current == TABLE_DRAW_CHANNEL_NOCLIP);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
// FIXME-TABLE: Could avoid this if draw channel is dummy channel?
|
|
|
SetWindowClipRectBeforeSetChannel(window, column->ClipRect);
|
|
|
- table->DrawSplitter.SetCurrentChannel(window->DrawList, column->DrawChannelCurrent);
|
|
|
+ table->DrawSplitter->SetCurrentChannel(window->DrawList, column->DrawChannelCurrent);
|
|
|
}
|
|
|
|
|
|
// Logging
|
|
@@ -2202,7 +2208,7 @@ void ImGui::TablePushBackgroundChannel()
|
|
|
// Optimization: avoid SetCurrentChannel() + PushClipRect()
|
|
|
table->HostBackupInnerClipRect = window->ClipRect;
|
|
|
SetWindowClipRectBeforeSetChannel(window, table->Bg2ClipRectForDrawCmd);
|
|
|
- table->DrawSplitter.SetCurrentChannel(window->DrawList, table->Bg2DrawChannelCurrent);
|
|
|
+ table->DrawSplitter->SetCurrentChannel(window->DrawList, table->Bg2DrawChannelCurrent);
|
|
|
}
|
|
|
|
|
|
void ImGui::TablePopBackgroundChannel()
|
|
@@ -2214,7 +2220,7 @@ void ImGui::TablePopBackgroundChannel()
|
|
|
|
|
|
// Optimization: avoid PopClipRect() + SetCurrentChannel()
|
|
|
SetWindowClipRectBeforeSetChannel(window, table->HostBackupInnerClipRect);
|
|
|
- table->DrawSplitter.SetCurrentChannel(window->DrawList, column->DrawChannelCurrent);
|
|
|
+ table->DrawSplitter->SetCurrentChannel(window->DrawList, column->DrawChannelCurrent);
|
|
|
}
|
|
|
|
|
|
// Allocate draw channels. Called by TableUpdateLayout()
|
|
@@ -2240,7 +2246,7 @@ void ImGui::TableSetupDrawChannels(ImGuiTable* table)
|
|
|
const int channels_for_bg = 1 + 1 * freeze_row_multiplier;
|
|
|
const int channels_for_dummy = (table->ColumnsEnabledCount < table->ColumnsCount || table->VisibleMaskByIndex != table->EnabledMaskByIndex) ? +1 : 0;
|
|
|
const int channels_total = channels_for_bg + (channels_for_row * freeze_row_multiplier) + channels_for_dummy;
|
|
|
- table->DrawSplitter.Split(table->InnerWindow->DrawList, channels_total);
|
|
|
+ table->DrawSplitter->Split(table->InnerWindow->DrawList, channels_total);
|
|
|
table->DummyDrawChannel = (ImGuiTableDrawChannelIdx)((channels_for_dummy > 0) ? channels_total - 1 : -1);
|
|
|
table->Bg2DrawChannelCurrent = TABLE_DRAW_CHANNEL_BG2_FROZEN;
|
|
|
table->Bg2DrawChannelUnfrozen = (ImGuiTableDrawChannelIdx)((table->FreezeRowsCount > 0) ? 2 + channels_for_row : TABLE_DRAW_CHANNEL_BG2_FROZEN);
|
|
@@ -2304,7 +2310,7 @@ void ImGui::TableSetupDrawChannels(ImGuiTable* table)
|
|
|
void ImGui::TableMergeDrawChannels(ImGuiTable* table)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
- ImDrawListSplitter* splitter = &table->DrawSplitter;
|
|
|
+ ImDrawListSplitter* splitter = table->DrawSplitter;
|
|
|
const bool has_freeze_v = (table->FreezeRowsCount > 0);
|
|
|
const bool has_freeze_h = (table->FreezeColumnsCount > 0);
|
|
|
IM_ASSERT(splitter->_Current == 0);
|
|
@@ -2475,7 +2481,7 @@ void ImGui::TableDrawBorders(ImGuiTable* table)
|
|
|
return;
|
|
|
|
|
|
ImDrawList* inner_drawlist = inner_window->DrawList;
|
|
|
- table->DrawSplitter.SetCurrentChannel(inner_drawlist, TABLE_DRAW_CHANNEL_BG0);
|
|
|
+ table->DrawSplitter->SetCurrentChannel(inner_drawlist, TABLE_DRAW_CHANNEL_BG0);
|
|
|
inner_drawlist->PushClipRect(table->Bg0ClipRectForDrawCmd.Min, table->Bg0ClipRectForDrawCmd.Max, false);
|
|
|
|
|
|
// Draw inner border and resizing feedback
|
|
@@ -2735,8 +2741,9 @@ void ImGui::TableSortSpecsBuild(ImGuiTable* table)
|
|
|
TableSortSpecsSanitize(table);
|
|
|
|
|
|
// Write output
|
|
|
- table->SortSpecsMulti.resize(table->SortSpecsCount <= 1 ? 0 : table->SortSpecsCount);
|
|
|
- ImGuiTableColumnSortSpecs* sort_specs = (table->SortSpecsCount == 0) ? NULL : (table->SortSpecsCount == 1) ? &table->SortSpecsSingle : table->SortSpecsMulti.Data;
|
|
|
+ ImGuiTableTempData* temp_data = table->TempData;
|
|
|
+ temp_data->SortSpecsMulti.resize(table->SortSpecsCount <= 1 ? 0 : table->SortSpecsCount);
|
|
|
+ ImGuiTableColumnSortSpecs* sort_specs = (table->SortSpecsCount == 0) ? NULL : (table->SortSpecsCount == 1) ? &temp_data->SortSpecsSingle : temp_data->SortSpecsMulti.Data;
|
|
|
if (sort_specs != NULL)
|
|
|
for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
|
|
|
{
|
|
@@ -3434,8 +3441,6 @@ void ImGui::TableGcCompactTransientBuffers(ImGuiTable* table)
|
|
|
//IMGUI_DEBUG_LOG("TableGcCompactTransientBuffers() id=0x%08X\n", table->ID);
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
IM_ASSERT(table->MemoryCompacted == false);
|
|
|
- table->DrawSplitter.ClearFreeMemory();
|
|
|
- table->SortSpecsMulti.clear();
|
|
|
table->SortSpecs.Specs = NULL;
|
|
|
table->IsSortSpecsDirty = true;
|
|
|
table->ColumnsNames.clear();
|
|
@@ -3445,6 +3450,13 @@ void ImGui::TableGcCompactTransientBuffers(ImGuiTable* table)
|
|
|
g.TablesLastTimeActive[g.Tables.GetIndex(table)] = -1.0f;
|
|
|
}
|
|
|
|
|
|
+void ImGui::TableGcCompactTransientBuffers(ImGuiTableTempData* temp_data)
|
|
|
+{
|
|
|
+ temp_data->DrawSplitter.ClearFreeMemory();
|
|
|
+ temp_data->SortSpecsMulti.clear();
|
|
|
+ temp_data->LastTimeActive = -1.0f;
|
|
|
+}
|
|
|
+
|
|
|
// Compact and remove unused settings data (currently only used by TestEngine)
|
|
|
void ImGui::TableGcCompactSettings()
|
|
|
{
|