mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 11:57:00 +00:00
Tables: Fix for 64 columns (maximum of 131 temporary draw channels).
This commit is contained in:
parent
e5a5256971
commit
24a7c45b02
@ -1888,7 +1888,7 @@ struct ImGuiTabBar
|
||||
|
||||
#define IM_COL32_DISABLE IM_COL32(0,0,0,1) // Special sentinel code which cannot be used as a regular color.
|
||||
#define IMGUI_TABLE_MAX_COLUMNS 64 // sizeof(ImU64) * 8. This is solely because we frequently encode columns set in a ImU64.
|
||||
#define IMGUI_TABLE_MAX_DRAW_CHANNELS (2 + 64 * 2) // See TableUpdateDrawChannels()
|
||||
#define IMGUI_TABLE_MAX_DRAW_CHANNELS (1 + 2 + 64 * 2) // See TableUpdateDrawChannels()
|
||||
|
||||
// [Internal] sizeof() ~ 100
|
||||
// We use the terminology "Visible" to refer to a column that is not Hidden by user or settings. However it may still be out of view and clipped (see IsClipped).
|
||||
@ -1918,15 +1918,15 @@ struct ImGuiTableColumn
|
||||
ImGuiNavLayer NavLayerCurrent;
|
||||
ImS8 DisplayOrder; // Index within Table's IndexToDisplayOrder[] (column may be reordered by users)
|
||||
ImS8 IndexWithinVisibleSet; // Index within visible set (<= IndexToDisplayOrder)
|
||||
ImS8 DrawChannelCurrent; // Index within DrawSplitter.Channels[]
|
||||
ImS8 DrawChannelFrozen;
|
||||
ImS8 DrawChannelUnfrozen;
|
||||
ImS8 PrevVisibleColumn; // Index of prev visible column within Columns[], -1 if first visible column
|
||||
ImS8 NextVisibleColumn; // Index of next visible column within Columns[], -1 if last visible column
|
||||
ImS8 AutoFitQueue; // Queue of 8 values for the next 8 frames to request auto-fit
|
||||
ImS8 CannotSkipItemsQueue; // Queue of 8 values for the next 8 frames to disable Clipped/SkipItem
|
||||
ImS8 SortOrder; // -1: Not sorting on this column
|
||||
ImS8 SortDirection; // enum ImGuiSortDirection_
|
||||
ImU8 AutoFitQueue; // Queue of 8 values for the next 8 frames to request auto-fit
|
||||
ImU8 CannotSkipItemsQueue; // Queue of 8 values for the next 8 frames to disable Clipped/SkipItem
|
||||
ImU8 DrawChannelCurrent; // Index within DrawSplitter.Channels[]
|
||||
ImU8 DrawChannelFrozen;
|
||||
ImU8 DrawChannelUnfrozen;
|
||||
|
||||
ImGuiTableColumn()
|
||||
{
|
||||
@ -1935,11 +1935,11 @@ struct ImGuiTableColumn
|
||||
NameOffset = -1;
|
||||
IsVisible = IsVisibleNextFrame = true;
|
||||
DisplayOrder = IndexWithinVisibleSet = -1;
|
||||
DrawChannelCurrent = DrawChannelFrozen = DrawChannelUnfrozen = -1;
|
||||
PrevVisibleColumn = NextVisibleColumn = -1;
|
||||
AutoFitQueue = CannotSkipItemsQueue = (1 << 3) - 1; // Skip for three frames
|
||||
SortOrder = -1;
|
||||
SortDirection = ImGuiSortDirection_None;
|
||||
AutoFitQueue = CannotSkipItemsQueue = (1 << 3) - 1; // Skip for three frames
|
||||
DrawChannelCurrent = DrawChannelFrozen = DrawChannelUnfrozen = (ImU8)-1;
|
||||
}
|
||||
};
|
||||
|
||||
@ -2025,13 +2025,13 @@ struct ImGuiTable
|
||||
ImS8 RightMostVisibleColumn; // Index of right-most non-hidden column.
|
||||
ImS8 LeftMostStretchedColumnDisplayOrder; // Display order of left-most stretched column.
|
||||
ImS8 ContextPopupColumn; // Column right-clicked on, of -1 if opening context menu from a neutral/empty spot
|
||||
ImS8 DummyDrawChannel; // Redirect non-visible columns here.
|
||||
ImS8 BgDrawChannelUnfrozen; // Index within DrawSplitter.Channels[]
|
||||
ImS8 FreezeRowsRequest; // Requested frozen rows count
|
||||
ImS8 FreezeRowsCount; // Actual frozen row count (== FreezeRowsRequest, or == 0 when no scrolling offset)
|
||||
ImS8 FreezeColumnsRequest; // Requested frozen columns count
|
||||
ImS8 FreezeColumnsCount; // Actual frozen columns count (== FreezeColumnsRequest, or == 0 when no scrolling offset)
|
||||
ImS8 RowCellDataCurrent; // Index of current RowCellData[] entry in current row
|
||||
ImU8 DummyDrawChannel; // Redirect non-visible columns here.
|
||||
ImU8 BgDrawChannelUnfrozen; // Index within DrawSplitter.Channels[]
|
||||
bool IsLayoutLocked; // Set by TableUpdateLayout() which is called when beginning the first row.
|
||||
bool IsInsideRow; // Set when inside TableBeginRow()/TableEndRow().
|
||||
bool IsInitializing;
|
||||
|
@ -544,7 +544,7 @@ static void TableFixColumnSortDirection(ImGuiTableColumn* column)
|
||||
{
|
||||
// Initial sort state
|
||||
if (column->SortDirection == ImGuiSortDirection_None)
|
||||
column->SortDirection = (column->Flags & ImGuiTableColumnFlags_PreferSortDescending) ? (ImS8)ImGuiSortDirection_Descending : (ImU8)(ImGuiSortDirection_Ascending);
|
||||
column->SortDirection = (column->Flags & ImGuiTableColumnFlags_PreferSortDescending) ? (ImS8)ImGuiSortDirection_Descending : (ImS8)(ImGuiSortDirection_Ascending);
|
||||
|
||||
// Handle NoSortAscending/NoSortDescending
|
||||
if (column->SortDirection == ImGuiSortDirection_Ascending && (column->Flags & ImGuiTableColumnFlags_NoSortAscending))
|
||||
@ -1340,8 +1340,8 @@ void ImGui::TableUpdateDrawChannels(ImGuiTable* table)
|
||||
const int channels_for_dummy = (table->ColumnsVisibleCount < table->ColumnsCount || table->VisibleUnclippedMaskByIndex != table->VisibleMaskByIndex) ? +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->DummyDrawChannel = (channels_for_dummy > 0) ? (ImS8)(channels_total - 1) : -1;
|
||||
table->BgDrawChannelUnfrozen = (ImS8)((table->FreezeRowsCount > 0) ? channels_for_row + 1 : 0);
|
||||
table->DummyDrawChannel = (channels_for_dummy > 0) ? (ImU8)(channels_total - 1) : -1;
|
||||
table->BgDrawChannelUnfrozen = (ImU8)((table->FreezeRowsCount > 0) ? channels_for_row + 1 : 0);
|
||||
|
||||
int draw_channel_current = 1;
|
||||
for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
|
||||
@ -1349,8 +1349,8 @@ void ImGui::TableUpdateDrawChannels(ImGuiTable* table)
|
||||
ImGuiTableColumn* column = &table->Columns[column_n];
|
||||
if (!column->IsClipped)
|
||||
{
|
||||
column->DrawChannelFrozen = (ImS8)(draw_channel_current);
|
||||
column->DrawChannelUnfrozen = (ImS8)(draw_channel_current + (table->FreezeRowsCount > 0 ? channels_for_row + 1 : 0));
|
||||
column->DrawChannelFrozen = (ImU8)(draw_channel_current);
|
||||
column->DrawChannelUnfrozen = (ImU8)(draw_channel_current + (table->FreezeRowsCount > 0 ? channels_for_row + 1 : 0));
|
||||
if (!(table->Flags & ImGuiTableFlags_NoClip))
|
||||
draw_channel_current++;
|
||||
}
|
||||
@ -1456,8 +1456,8 @@ void ImGui::TableReorderDrawChannelsForMerge(ImGuiTable* table)
|
||||
}
|
||||
|
||||
// Invalidate current draw channel
|
||||
// (we don't clear DrawChannelBeforeRowFreeze/DrawChannelAfterRowFreeze solely to facilitate debugging/later inspection of data)
|
||||
column->DrawChannelCurrent = -1;
|
||||
// (we don't clear DrawChannelFrozen/DrawChannelUnfrozen solely to facilitate debugging/later inspection of data)
|
||||
column->DrawChannelCurrent = (ImU8)-1;
|
||||
}
|
||||
|
||||
// [DEBUG] Display merge groups
|
||||
|
Loading…
Reference in New Issue
Block a user