mirror of
https://github.com/ocornut/imgui.git
synced 2026-06-22 11:23:37 +00:00
Tables: tweaked debug tools + minor data packing in in ImGuiTableColumn
This commit is contained in:
@@ -16956,7 +16956,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
if (TreeNode("SettingsTables", "Settings packed data: Tables: %d bytes", g.SettingsTables.size()))
|
||||
{
|
||||
for (ImGuiTableSettings* settings = g.SettingsTables.begin(); settings != NULL; settings = g.SettingsTables.next_chunk(settings))
|
||||
DebugNodeTableSettings(settings);
|
||||
DebugNodeTableSettings(settings, NULL);
|
||||
TreePop();
|
||||
}
|
||||
|
||||
|
||||
@@ -2934,8 +2934,8 @@ struct ImGuiTableColumn
|
||||
bool IsSkipItems; // Do we want item submissions to this column to be completely ignored (no layout will happen).
|
||||
bool IsPreserveWidthAuto;
|
||||
ImS8 NavLayerCurrent; // ImGuiNavLayer in 1 byte
|
||||
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 AutoFitQueue : 4; // Queue of 4 values for the next 4 frames to request auto-fit
|
||||
ImU8 CannotSkipItemsQueue : 4; // Queue of 4 values for the next 4 frames to disable Clipped/SkipItem
|
||||
ImU8 SortDirection : 2; // ImGuiSortDirection_Ascending or ImGuiSortDirection_Descending
|
||||
ImU8 SortDirectionsAvailCount : 2; // Number of available sort directions (0 to 3)
|
||||
ImU8 SortDirectionsAvailMask : 4; // Mask of available sort directions (1-bit each)
|
||||
@@ -3785,7 +3785,7 @@ namespace ImGui
|
||||
IMGUI_API void DebugNodeStorage(ImGuiStorage* storage, const char* label);
|
||||
IMGUI_API void DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label);
|
||||
IMGUI_API void DebugNodeTable(ImGuiTable* table);
|
||||
IMGUI_API void DebugNodeTableSettings(ImGuiTableSettings* settings);
|
||||
IMGUI_API void DebugNodeTableSettings(ImGuiTableSettings* settings, ImGuiTable* table);
|
||||
IMGUI_API void DebugNodeInputTextState(ImGuiInputTextState* state);
|
||||
IMGUI_API void DebugNodeTypingSelectState(ImGuiTypingSelectState* state);
|
||||
IMGUI_API void DebugNodeMultiSelectState(ImGuiMultiSelectState* state);
|
||||
|
||||
@@ -4214,28 +4214,39 @@ void ImGui::DebugNodeTable(ImGuiTable* table)
|
||||
}
|
||||
}
|
||||
if (ImGuiTableSettings* settings = TableGetBoundSettings(table))
|
||||
DebugNodeTableSettings(settings);
|
||||
DebugNodeTableSettings(settings, table);
|
||||
if (clear_settings)
|
||||
table->IsResetAllRequest = true; // Queue a call to TableResetSettings()
|
||||
TreePop();
|
||||
}
|
||||
|
||||
void ImGui::DebugNodeTableSettings(ImGuiTableSettings* settings)
|
||||
void ImGui::DebugNodeTableSettings(ImGuiTableSettings* settings, ImGuiTable* table)
|
||||
{
|
||||
if (!TreeNode((void*)(intptr_t)settings->ID, "Settings 0x%08X (%d columns)", settings->ID, settings->ColumnsCount))
|
||||
return;
|
||||
BulletText("SaveFlags: 0x%08X", settings->SaveFlags);
|
||||
BulletText("ColumnsCount: %d (max %d)", settings->ColumnsCount, settings->ColumnsCountMax);
|
||||
for (int n = 0; n < settings->ColumnsCount; n++)
|
||||
if (settings->ID == 0)
|
||||
PushID(settings);
|
||||
const bool open = TreeNode((void*)(intptr_t)settings->ID, "Settings 0x%08X (%d columns)", settings->ID, settings->ColumnsCount);
|
||||
const bool hovered = IsItemHovered();
|
||||
if (hovered && table == NULL && settings->ID != 0)
|
||||
table = TableFindByID(settings->ID);
|
||||
if (hovered && table != NULL)
|
||||
GetForegroundDrawList(table->OuterWindow)->AddRect(table->OuterRect.Min, table->OuterRect.Max, IM_COL32(255, 255, 0, 255));
|
||||
if (open)
|
||||
{
|
||||
ImGuiTableColumnSettings* column_settings = &settings->GetColumnSettings()[n];
|
||||
ImGuiSortDirection sort_dir = (column_settings->SortOrder != -1) ? (ImGuiSortDirection)column_settings->SortDirection : ImGuiSortDirection_None;
|
||||
BulletText("Column %d Order %d SortOrder %2d %s Vis %d %s %7.3f ID 0x%08X",
|
||||
n, column_settings->DisplayOrder, column_settings->SortOrder,
|
||||
(sort_dir == ImGuiSortDirection_Ascending) ? "Asc" : (sort_dir == ImGuiSortDirection_Descending) ? "Des" : "---",
|
||||
column_settings->IsEnabled, column_settings->IsStretch ? "Weight" : "Width ", column_settings->WidthOrWeight, column_settings->ID);
|
||||
BulletText("SaveFlags: 0x%08X", settings->SaveFlags);
|
||||
BulletText("ColumnsCount: %d (max %d)", settings->ColumnsCount, settings->ColumnsCountMax);
|
||||
for (int n = 0; n < settings->ColumnsCount; n++)
|
||||
{
|
||||
ImGuiTableColumnSettings* column_settings = &settings->GetColumnSettings()[n];
|
||||
ImGuiSortDirection sort_dir = (column_settings->SortOrder != -1) ? (ImGuiSortDirection)column_settings->SortDirection : ImGuiSortDirection_None;
|
||||
BulletText("Column %d Order %d SortOrder %2d %s Vis %d %s %7.3f ID 0x%08X",
|
||||
n, column_settings->DisplayOrder, column_settings->SortOrder,
|
||||
(sort_dir == ImGuiSortDirection_Ascending) ? "Asc" : (sort_dir == ImGuiSortDirection_Descending) ? "Des" : "---",
|
||||
column_settings->IsEnabled, column_settings->IsStretch ? "Weight" : "Width ", column_settings->WidthOrWeight, column_settings->ID);
|
||||
}
|
||||
TreePop();
|
||||
}
|
||||
TreePop();
|
||||
if (settings->ID == 0)
|
||||
PopID();
|
||||
}
|
||||
|
||||
#else // #ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||
|
||||
Reference in New Issue
Block a user