Skip to content

Commit

Permalink
Annotate changed locations with "MicroStrain" comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
microstrain-sam committed Dec 19, 2023
1 parent 8899e2c commit ccb0927
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 29 deletions.
8 changes: 4 additions & 4 deletions imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -1721,11 +1721,11 @@ enum ImGuiCol_
ImGuiCol_Button,
ImGuiCol_ButtonHovered,
ImGuiCol_ButtonActive,
ImGuiCol_ButtonText,
ImGuiCol_ButtonText, // MicroStrain
ImGuiCol_Header, // Header* colors are used for CollapsingHeader, TreeNode, Selectable, MenuItem
ImGuiCol_HeaderHovered,
ImGuiCol_HeaderActive,
ImGuiCol_HeaderText,
ImGuiCol_HeaderText, // MicroStrain
ImGuiCol_Separator,
ImGuiCol_SeparatorHovered,
ImGuiCol_SeparatorActive,
Expand All @@ -1737,15 +1737,15 @@ enum ImGuiCol_
ImGuiCol_TabActive,
ImGuiCol_TabUnfocused,
ImGuiCol_TabUnfocusedActive,
ImGuiCol_TabText,
ImGuiCol_TabText, // MicroStrain
ImGuiCol_DockingPreview, // Preview overlay color when about to docking something
ImGuiCol_DockingEmptyBg, // Background color for empty node (e.g. CentralNode with no window docked into it)
ImGuiCol_PlotLines,
ImGuiCol_PlotLinesHovered,
ImGuiCol_PlotHistogram,
ImGuiCol_PlotHistogramHovered,
ImGuiCol_TableHeaderBg, // Table header background
ImGuiCol_TableHeaderText,
ImGuiCol_TableHeaderText, // MicroStrain
ImGuiCol_TableBorderStrong, // Table outer and header borders (prefer using Alpha=1.0 here)
ImGuiCol_TableBorderLight, // Table inner borders (prefer using Alpha=1.0 here)
ImGuiCol_TableRowBg, // Table row background (even rows)
Expand Down
24 changes: 12 additions & 12 deletions imgui_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ void ImGui::StyleColorsDark(ImGuiStyle* dst)
ImVec4* colors = style->Colors;

colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImGuiCol_ButtonText] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImGuiCol_HeaderText] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImGuiCol_TabText] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImGuiCol_TableHeaderText] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImGuiCol_ButtonText] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); // MicroStrain
colors[ImGuiCol_HeaderText] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); // MicroStrain
colors[ImGuiCol_TabText] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); // MicroStrain
colors[ImGuiCol_TableHeaderText] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); // MicroStrain
colors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
colors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.06f, 0.06f, 0.94f);
colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
Expand Down Expand Up @@ -243,10 +243,10 @@ void ImGui::StyleColorsClassic(ImGuiStyle* dst)
ImVec4* colors = style->Colors;

colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
colors[ImGuiCol_ButtonText] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
colors[ImGuiCol_HeaderText] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
colors[ImGuiCol_TabText] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
colors[ImGuiCol_TableHeaderText] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
colors[ImGuiCol_ButtonText] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f); // MicroStrain
colors[ImGuiCol_HeaderText] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f); // MicroStrain
colors[ImGuiCol_TabText] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f); // MicroStrain
colors[ImGuiCol_TableHeaderText] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f); // MicroStrain
colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
colors[ImGuiCol_WindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.85f);
colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
Expand Down Expand Up @@ -310,10 +310,10 @@ void ImGui::StyleColorsLight(ImGuiStyle* dst)
ImVec4* colors = style->Colors;

colors[ImGuiCol_Text] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
colors[ImGuiCol_ButtonText] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
colors[ImGuiCol_HeaderText] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
colors[ImGuiCol_TabText] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
colors[ImGuiCol_TableHeaderText] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
colors[ImGuiCol_ButtonText] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f); // MicroStrain
colors[ImGuiCol_HeaderText] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f); // MicroStrain
colors[ImGuiCol_TabText] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f); // MicroStrain
colors[ImGuiCol_TableHeaderText] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f); // MicroStrain
colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
colors[ImGuiCol_WindowBg] = ImVec4(0.94f, 0.94f, 0.94f, 1.00f);
colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
Expand Down
4 changes: 2 additions & 2 deletions imgui_tables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3114,12 +3114,12 @@ void ImGui::TableHeader(const char* label)
float y = label_pos.y;
if (column->SortOrder > 0)
{
PushStyleColor(ImGuiCol_TableHeaderText, GetColorU32(ImGuiCol_TableHeaderText, 0.70f));
PushStyleColor(ImGuiCol_TableHeaderText, GetColorU32(ImGuiCol_TableHeaderText, 0.70f)); // MicroStrain
RenderText(ImVec2(x + g.Style.ItemInnerSpacing.x, y), sort_order_suf);
PopStyleColor();
x += w_sort_text;
}
RenderArrow(window->DrawList, ImVec2(x, y), GetColorU32(ImGuiCol_TableHeaderText), column->SortDirection == ImGuiSortDirection_Ascending ? ImGuiDir_Up : ImGuiDir_Down, ARROW_SCALE);
RenderArrow(window->DrawList, ImVec2(x, y), GetColorU32(ImGuiCol_TableHeaderText), column->SortDirection == ImGuiSortDirection_Ascending ? ImGuiDir_Up : ImGuiDir_Down, ARROW_SCALE); // MicroStrain
}

// Handle clicking on column header to adjust Sort Order
Expand Down
24 changes: 13 additions & 11 deletions imgui_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiBu

// Render
const ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
const ImU32 text_col = GetColorU32(ImGuiCol_ButtonText);
const ImU32 text_col = GetColorU32(ImGuiCol_ButtonText); // MicroStrain
RenderNavHighlight(bb, id);
RenderFrame(bb.Min, bb.Max, bg_col, true, g.Style.FrameRounding);
RenderArrow(window->DrawList, bb.Min + ImVec2(ImMax(0.0f, (size.x - g.FontSize) * 0.5f), ImMax(0.0f, (size.y - g.FontSize) * 0.5f)), text_col, dir);
Expand Down Expand Up @@ -6541,7 +6541,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_ToggledSelection;

// Render
const ImU32 text_col = GetColorU32(ImGuiCol_HeaderText);
const ImU32 text_col = GetColorU32(ImGuiCol_HeaderText); // MicroStrain
ImGuiNavHighlightFlags nav_highlight_flags = ImGuiNavHighlightFlags_TypeThin;
if (display_frame)
{
Expand Down Expand Up @@ -6581,15 +6581,15 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
if (span_all_columns)
TablePopBackgroundChannel();

PushStyleColor(ImGuiCol_Text, text_col);
PushStyleColor(ImGuiCol_Text, text_col); // MicroStrain

// Label
if (display_frame)
RenderTextClipped(text_pos, frame_bb.Max, label, label_end, &label_size);
else
RenderText(text_pos, label, label_end, false);

PopStyleColor();
PopStyleColor(); // MicroStrain

if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))
TreePushOverrideID(id);
Expand Down Expand Up @@ -6859,13 +6859,15 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
PopColumnsBackground();
}

// MicroStrain
if(hovered || selected)
ImGui::PushStyleColor(ImGuiCol_Text, GetColorU32(ImGuiCol_HeaderText));
else if(disabled_item || disabled_global)
ImGui::PushStyleColor(ImGuiCol_Text, GetColorU32(ImGuiCol_TextDisabled));

RenderTextClipped(text_min, text_max, label, NULL, &label_size, style.SelectableTextAlign, &bb);

// MicroStrain
if(hovered || selected || disabled_item || disabled_global)
ImGui::PopStyleColor();

Expand Down Expand Up @@ -8687,10 +8689,10 @@ static ImGuiTabItem* ImGui::TabBarScrollingButtons(ImGuiTabBar* tab_bar)
//window->DrawList->AddRect(ImVec2(tab_bar->BarRect.Max.x - scrolling_buttons_width, tab_bar->BarRect.Min.y), ImVec2(tab_bar->BarRect.Max.x, tab_bar->BarRect.Max.y), IM_COL32(255,0,0,255));

int select_dir = 0;
ImVec4 arrow_col = g.Style.Colors[ImGuiCol_TabText];
ImVec4 arrow_col = g.Style.Colors[ImGuiCol_TabText]; // MicroStrain
arrow_col.w *= 0.5f;

PushStyleColor(ImGuiCol_TabText, arrow_col);
PushStyleColor(ImGuiCol_TabText, arrow_col); // MicroStrain
PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
const float backup_repeat_delay = g.IO.KeyRepeatDelay;
const float backup_repeat_rate = g.IO.KeyRepeatRate;
Expand Down Expand Up @@ -8747,9 +8749,9 @@ static ImGuiTabItem* ImGui::TabBarTabListPopupButton(ImGuiTabBar* tab_bar)
window->DC.CursorPos = ImVec2(tab_bar->BarRect.Min.x - g.Style.FramePadding.y, tab_bar->BarRect.Min.y);
tab_bar->BarRect.Min.x += tab_list_popup_button_width;

ImVec4 arrow_col = g.Style.Colors[ImGuiCol_TabText];
ImVec4 arrow_col = g.Style.Colors[ImGuiCol_TabText]; // MicroStrain
arrow_col.w *= 0.5f;
PushStyleColor(ImGuiCol_TabText, arrow_col);
PushStyleColor(ImGuiCol_TabText, arrow_col); // MicroStrain
PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
bool open = BeginCombo("##v", NULL, ImGuiComboFlags_NoPreview | ImGuiComboFlags_HeightLargest);
PopStyleColor(2);
Expand Down Expand Up @@ -9260,7 +9262,7 @@ void ImGui::TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb,
else if (unsaved_marker_visible)
{
const ImRect bullet_bb(button_pos, button_pos + ImVec2(button_sz, button_sz));
RenderBullet(draw_list, bullet_bb.GetCenter(), GetColorU32(ImGuiCol_TabText));
RenderBullet(draw_list, bullet_bb.GetCenter(), GetColorU32(ImGuiCol_TabText)); // MicroStrain
}

// This is all rather complicated
Expand All @@ -9274,9 +9276,9 @@ void ImGui::TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb,
ellipsis_max_x = text_pixel_clip_bb.Max.x;
}

PushStyleColor(ImGuiCol_Text, GetColorU32(ImGuiCol_TabText));
PushStyleColor(ImGuiCol_Text, GetColorU32(ImGuiCol_TabText)); // MicroStrain
RenderTextEllipsis(draw_list, text_ellipsis_clip_bb.Min, text_ellipsis_clip_bb.Max, text_pixel_clip_bb.Max.x, ellipsis_max_x, label, NULL, &label_size);
PopStyleColor();
PopStyleColor(); // MicroStrain

#if 0
if (!is_contents_visible)
Expand Down

0 comments on commit ccb0927

Please sign in to comment.