Internal: Removed unused fields from ImGuiMenuColumns.

This commit is contained in:
omar 2019-03-11 20:14:56 +01:00
parent 6767b0a1b0
commit 65c2220049
2 changed files with 6 additions and 8 deletions

View File

@ -568,10 +568,9 @@ struct ImGuiGroupData
// Simple column measurement, currently used for MenuItem() only.. This is very short-sighted/throw-away code and NOT a generic helper.
struct IMGUI_API ImGuiMenuColumns
{
int Count;
float Spacing;
float Width, NextWidth;
float Pos[4], NextWidths[4];
float Pos[3], NextWidths[3];
ImGuiMenuColumns();
void Update(int count, float spacing, bool clear);

View File

@ -5674,7 +5674,6 @@ void ImGui::Value(const char* prefix, float v, const char* float_format)
// Helpers for internal use
ImGuiMenuColumns::ImGuiMenuColumns()
{
Count = 0;
Spacing = Width = NextWidth = 0.0f;
memset(Pos, 0, sizeof(Pos));
memset(NextWidths, 0, sizeof(NextWidths));
@ -5682,12 +5681,12 @@ ImGuiMenuColumns::ImGuiMenuColumns()
void ImGuiMenuColumns::Update(int count, float spacing, bool clear)
{
IM_ASSERT(Count <= IM_ARRAYSIZE(Pos));
Count = count;
IM_ASSERT(count == IM_ARRAYSIZE(Pos));
Width = NextWidth = 0.0f;
Spacing = spacing;
if (clear) memset(NextWidths, 0, sizeof(NextWidths));
for (int i = 0; i < Count; i++)
if (clear)
memset(NextWidths, 0, sizeof(NextWidths));
for (int i = 0; i < IM_ARRAYSIZE(Pos); i++)
{
if (i > 0 && NextWidths[i] > 0.0f)
Width += Spacing;
@ -5703,7 +5702,7 @@ float ImGuiMenuColumns::DeclColumns(float w0, float w1, float w2) // not using v
NextWidths[0] = ImMax(NextWidths[0], w0);
NextWidths[1] = ImMax(NextWidths[1], w1);
NextWidths[2] = ImMax(NextWidths[2], w2);
for (int i = 0; i < 3; i++)
for (int i = 0; i < IM_ARRAYSIZE(Pos); i++)
NextWidth += NextWidths[i] + ((i > 0 && NextWidths[i] > 0.0f) ? Spacing : 0.0f);
return ImMax(Width, NextWidth);
}