mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-13 16:29:54 +02:00
Merge branch 'master' into docking
# Conflicts: # backends/imgui_impl_opengl3.cpp # imgui.cpp # imgui.h # imgui_demo.cpp
This commit is contained in:
@ -2608,8 +2608,7 @@ ImGuiTableSortSpecs* ImGui::TableGetSortSpecs()
|
||||
if (!table->IsLayoutLocked)
|
||||
TableUpdateLayout(table);
|
||||
|
||||
if (table->IsSortSpecsDirty)
|
||||
TableSortSpecsBuild(table);
|
||||
TableSortSpecsBuild(table);
|
||||
|
||||
return &table->SortSpecs;
|
||||
}
|
||||
@ -2748,14 +2747,18 @@ void ImGui::TableSortSpecsSanitize(ImGuiTable* table)
|
||||
|
||||
void ImGui::TableSortSpecsBuild(ImGuiTable* table)
|
||||
{
|
||||
IM_ASSERT(table->IsSortSpecsDirty);
|
||||
TableSortSpecsSanitize(table);
|
||||
bool dirty = table->IsSortSpecsDirty;
|
||||
if (dirty)
|
||||
{
|
||||
TableSortSpecsSanitize(table);
|
||||
table->SortSpecsMulti.resize(table->SortSpecsCount <= 1 ? 0 : table->SortSpecsCount);
|
||||
table->SortSpecs.SpecsDirty = true; // Mark as dirty for user
|
||||
table->IsSortSpecsDirty = false; // Mark as not dirty for us
|
||||
}
|
||||
|
||||
// Write output
|
||||
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)
|
||||
ImGuiTableColumnSortSpecs* sort_specs = (table->SortSpecsCount == 0) ? NULL : (table->SortSpecsCount == 1) ? &table->SortSpecsSingle : table->SortSpecsMulti.Data;
|
||||
if (dirty && sort_specs != NULL)
|
||||
for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
|
||||
{
|
||||
ImGuiTableColumn* column = &table->Columns[column_n];
|
||||
@ -2768,10 +2771,9 @@ void ImGui::TableSortSpecsBuild(ImGuiTable* table)
|
||||
sort_spec->SortOrder = (ImGuiTableColumnIdx)column->SortOrder;
|
||||
sort_spec->SortDirection = column->SortDirection;
|
||||
}
|
||||
|
||||
table->SortSpecs.Specs = sort_specs;
|
||||
table->SortSpecs.SpecsCount = table->SortSpecsCount;
|
||||
table->SortSpecs.SpecsDirty = true; // Mark as dirty for user
|
||||
table->IsSortSpecsDirty = false; // Mark as not dirty for us
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@ -2914,7 +2916,6 @@ void ImGui::TableHeader(const char* label)
|
||||
const ImU32 col = GetColorU32(held ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
|
||||
//RenderFrame(bb.Min, bb.Max, col, false, 0.0f);
|
||||
TableSetBgColor(ImGuiTableBgTarget_CellBg, col, table->CurrentColumn);
|
||||
RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2922,6 +2923,7 @@ void ImGui::TableHeader(const char* label)
|
||||
if ((table->RowFlags & ImGuiTableRowFlags_Headers) == 0)
|
||||
TableSetBgColor(ImGuiTableBgTarget_CellBg, GetColorU32(ImGuiCol_TableHeaderBg), table->CurrentColumn);
|
||||
}
|
||||
RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding);
|
||||
if (held)
|
||||
table->HeldHeaderColumn = (ImGuiTableColumnIdx)column_n;
|
||||
window->DC.CursorPos.y -= g.Style.ItemSpacing.y * 0.5f;
|
||||
@ -3460,7 +3462,8 @@ void ImGui::TableGcCompactTransientBuffers(ImGuiTable* table)
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(table->MemoryCompacted == false);
|
||||
table->SortSpecs.Specs = NULL;
|
||||
table->IsSortSpecsDirty = true;
|
||||
table->SortSpecsMulti.clear();
|
||||
table->IsSortSpecsDirty = true; // FIXME: shouldn't have to leak into user performing a sort
|
||||
table->ColumnsNames.clear();
|
||||
table->MemoryCompacted = true;
|
||||
for (int n = 0; n < table->ColumnsCount; n++)
|
||||
@ -3471,7 +3474,6 @@ void ImGui::TableGcCompactTransientBuffers(ImGuiTable* table)
|
||||
void ImGui::TableGcCompactTransientBuffers(ImGuiTableTempData* temp_data)
|
||||
{
|
||||
temp_data->DrawSplitter.ClearFreeMemory();
|
||||
temp_data->SortSpecsMulti.clear();
|
||||
temp_data->LastTimeActive = -1.0f;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user