Check tracker improvements (#6000)

This commit is contained in:
Garrett Cox
2025-12-03 09:57:15 -06:00
committed by GitHub
parent 4366da631b
commit a2e4e4d417

View File

@@ -1042,16 +1042,17 @@ void CheckTrackerWindow::DrawElement() {
#else #else
float headerHeight = 20.0f; float headerHeight = 20.0f;
#endif #endif
ImVec2 size = ImGui::GetContentRegionMax(); if (!ImGui::BeginTable("Check Tracker", 1, 0)) {
size.y -= headerHeight;
if (!ImGui::BeginTable("Check Tracker", 1, 0, size)) {
EndFloatWindows(); EndFloatWindows();
return; return;
} }
ImGui::TableNextRow(0, headerHeight); ImGui::SetWindowFontScale(CVarGetFloat(CVAR_TRACKER_CHECK("FontSize"), 1.0f));
ImGui::TableNextRow(0, 0);
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if (UIWidgets::CVarCheckbox( if (CVarGetInteger(CVAR_TRACKER_CHECK("HiddenItemsToggleVisible"), 1) &&
UIWidgets::CVarCheckbox(
"Show Hidden Items", CVAR_TRACKER_CHECK("ShowHidden"), "Show Hidden Items", CVAR_TRACKER_CHECK("ShowHidden"),
UIWidgets::CheckboxOptions( UIWidgets::CheckboxOptions(
{ { .tooltip = "When active, items will show hidden checks by default when updated to this state." } }) { { .tooltip = "When active, items will show hidden checks by default when updated to this state." } })
@@ -1060,7 +1061,7 @@ void CheckTrackerWindow::DrawElement() {
showHidden = CVarGetInteger(CVAR_TRACKER_CHECK("ShowHidden"), 0); showHidden = CVarGetInteger(CVAR_TRACKER_CHECK("ShowHidden"), 0);
RecalculateAllAreaTotals(); RecalculateAllAreaTotals();
} }
if (enableAvailableChecks) { if (enableAvailableChecks && CVarGetInteger(CVAR_TRACKER_CHECK("AvailableChecksToggleVisible"), 1)) {
if (UIWidgets::CVarCheckbox( if (UIWidgets::CVarCheckbox(
"Only Show Available Checks", CVAR_TRACKER_CHECK("OnlyShowAvailable"), "Only Show Available Checks", CVAR_TRACKER_CHECK("OnlyShowAvailable"),
UIWidgets::CheckboxOptions({ { .tooltip = "When active, unavailable checks will be hidden." } }) UIWidgets::CheckboxOptions({ { .tooltip = "When active, unavailable checks will be hidden." } })
@@ -1069,49 +1070,61 @@ void CheckTrackerWindow::DrawElement() {
RecalculateAllAreaTotals(); RecalculateAllAreaTotals();
} }
} }
UIWidgets::PaddedSeparator(); if (CVarGetInteger(CVAR_TRACKER_CHECK("ExpandCollapseButtonsVisible"), 0)) {
if (UIWidgets::Button("Expand All", UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(UIWidgets::Sizes::Inline))) { if (UIWidgets::Button(
optCollapseAll = false; "Expand All",
optExpandAll = true; UIWidgets::ButtonOptions().Color(THEME_COLOR).Size({ ImGui::GetContentRegionAvail().x / 2 - 6, 0 }))) {
doAreaScroll = true; optCollapseAll = false;
} optExpandAll = true;
ImGui::SameLine(); doAreaScroll = true;
if (UIWidgets::Button("Collapse All", }
UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(UIWidgets::Sizes::Inline))) { ImGui::SameLine();
optExpandAll = false; if (UIWidgets::Button(
optCollapseAll = true; "Collapse All",
} UIWidgets::ButtonOptions().Color(THEME_COLOR).Size({ ImGui::GetContentRegionAvail().x - 6, 0 }))) {
ImGui::SameLine(); optExpandAll = false;
if (UIWidgets::Button("Clear", UIWidgets::ButtonOptions({ { .tooltip = "Clear the search field" } }) optCollapseAll = true;
.Color(THEME_COLOR) }
.Size(UIWidgets::Sizes::Inline))) {
checkSearch.Clear();
UpdateFilters();
doAreaScroll = true;
} }
UIWidgets::PushStyleCombobox(THEME_COLOR); UIWidgets::PushStyleCombobox(THEME_COLOR);
if (checkSearch.Draw()) { if (CVarGetInteger(CVAR_TRACKER_CHECK("SearchInputVisible"), 1)) {
UpdateFilters(); if (checkSearch.Draw("", ImGui::GetContentRegionAvail().x - 6)) {
UpdateFilters();
}
std::string checkSearchText = "";
checkSearchText = checkSearch.InputBuf;
checkSearchText.erase(std::remove(checkSearchText.begin(), checkSearchText.end(), ' '), checkSearchText.end());
if (checkSearchText.length() < 1) {
ImGui::SameLine(20.0f);
ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, 0.4f), "Search...");
}
} }
UIWidgets::PopStyleCombobox(); UIWidgets::PopStyleCombobox();
ImGui::Separator(); if (CVarGetInteger(CVAR_TRACKER_CHECK("CheckTotalsVisible"), 1)) {
std::ostringstream totalChecksSS;
std::ostringstream totalChecksSS; totalChecksSS << "";
totalChecksSS << "Total Checks: "; if (enableAvailableChecks) {
if (enableAvailableChecks) { totalChecksSS << totalChecksAvailable << " Available / ";
totalChecksSS << totalChecksAvailable << " Available / "; }
totalChecksSS << totalChecksGotten << " Checked / " << totalChecks << " Total";
ImGui::Text("%s", totalChecksSS.str().c_str());
} }
totalChecksSS << totalChecksGotten << " Checked / " << totalChecks << " Total";
ImGui::Text("%s", totalChecksSS.str().c_str());
UIWidgets::PaddedSeparator(); bool headerPresent =
CVarGetInteger(CVAR_TRACKER_CHECK("HiddenItemsToggleVisible"), 1) ||
(enableAvailableChecks && CVarGetInteger(CVAR_TRACKER_CHECK("AvailableChecksToggleVisible"), 1)) ||
CVarGetInteger(CVAR_TRACKER_CHECK("ExpandCollapseButtonsVisible"), 0) ||
CVarGetInteger(CVAR_TRACKER_CHECK("SearchInputVisible"), 1) ||
CVarGetInteger(CVAR_TRACKER_CHECK("CheckTotalsVisible"), 1);
if (headerPresent) {
ImGui::Separator();
}
// Checks Section Lead-in // Checks Section Lead-in
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
size = ImGui::GetContentRegionAvail(); if (!ImGui::BeginTable("CheckTracker##Checks", 1, ImGuiTableFlags_ScrollY)) {
if (!ImGui::BeginTable("CheckTracker##Checks", 1, ImGuiTableFlags_ScrollY, size)) {
ImGui::EndTable(); ImGui::EndTable();
EndFloatWindows(); EndFloatWindows();
return; return;
@@ -1181,7 +1194,7 @@ void CheckTrackerWindow::DrawElement() {
} else { } else {
ImGui::SetNextItemOpen(!thisAreaFullyChecked, ImGuiCond_Once); ImGui::SetNextItemOpen(!thisAreaFullyChecked, ImGuiCond_Once);
} }
doDraw = ImGui::TreeNode(stemp.c_str()); doDraw = ImGui::TreeNodeEx(stemp.c_str(), ImGuiTreeNodeFlags_NoTreePushOnOpen);
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(extraColor.r / 255.0f, extraColor.g / 255.0f, ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(extraColor.r / 255.0f, extraColor.g / 255.0f,
@@ -1230,10 +1243,6 @@ void CheckTrackerWindow::DrawElement() {
DrawLocation(rc); DrawLocation(rc);
} }
} }
if (doDraw) {
ImGui::TreePop();
}
} }
} }
ImGui::PopStyleVar(); ImGui::PopStyleVar();
@@ -2130,6 +2139,16 @@ void CheckTrackerSettingsWindow::DrawElement() {
SohGui::mSohMenu->MenuDrawItem(windowTypeWidget, ImGui::GetContentRegionAvail().x, THEME_COLOR); SohGui::mSohMenu->MenuDrawItem(windowTypeWidget, ImGui::GetContentRegionAvail().x, THEME_COLOR);
UIWidgets::CVarSliderFloat("Font Size", CVAR_TRACKER_CHECK("FontSize"),
UIWidgets::FloatSliderOptions()
.Tooltip("Sets the font size used in the check tracker.")
.Format("%.1f")
.Step(0.1f)
.Min(0.3f)
.Max(2.0f)
.Color(THEME_COLOR)
.DefaultValue(1.0f));
if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) { if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) {
UIWidgets::CVarCheckbox("Enable Dragging", CVAR_TRACKER_CHECK("Draggable"), UIWidgets::CVarCheckbox("Enable Dragging", CVAR_TRACKER_CHECK("Draggable"),
UIWidgets::CheckboxOptions().Color(THEME_COLOR)); UIWidgets::CheckboxOptions().Color(THEME_COLOR));
@@ -2172,7 +2191,6 @@ void CheckTrackerSettingsWindow::DrawElement() {
ImGui::EndDisabled(); ImGui::EndDisabled();
// Filtering settings // Filtering settings
UIWidgets::PaddedSeparator();
UIWidgets::CVarCheckbox( UIWidgets::CVarCheckbox(
"Filter Empty Areas", CVAR_TRACKER_CHECK("HideFilteredAreas"), "Filter Empty Areas", CVAR_TRACKER_CHECK("HideFilteredAreas"),
UIWidgets::CheckboxOptions() UIWidgets::CheckboxOptions()
@@ -2180,6 +2198,18 @@ void CheckTrackerSettingsWindow::DrawElement() {
.Color(THEME_COLOR) .Color(THEME_COLOR)
.DefaultValue(true)); .DefaultValue(true));
ImGui::SeparatorText("Tracker Header Visibility");
UIWidgets::CVarCheckbox("Hidden Items Toggle", CVAR_TRACKER_CHECK("HiddenItemsToggleVisible"),
UIWidgets::CheckboxOptions().Color(THEME_COLOR).DefaultValue(true));
UIWidgets::CVarCheckbox("Available Checks Toggle", CVAR_TRACKER_CHECK("AvailableChecksToggleVisible"),
UIWidgets::CheckboxOptions().Color(THEME_COLOR).DefaultValue(true));
UIWidgets::CVarCheckbox("Expand/Collapse Buttons", CVAR_TRACKER_CHECK("ExpandCollapseButtonsVisible"),
UIWidgets::CheckboxOptions().Color(THEME_COLOR).DefaultValue(false));
UIWidgets::CVarCheckbox("Search Input", CVAR_TRACKER_CHECK("SearchInputVisible"),
UIWidgets::CheckboxOptions().Color(THEME_COLOR).DefaultValue(true));
UIWidgets::CVarCheckbox("Check Totals", CVAR_TRACKER_CHECK("CheckTotalsVisible"),
UIWidgets::CheckboxOptions().Color(THEME_COLOR).DefaultValue(true));
ImGui::TableNextColumn(); ImGui::TableNextColumn();
CheckTracker::ImGuiDrawTwoColorPickerSection("Area Incomplete", CVAR_TRACKER_CHECK("AreaIncomplete.MainColor"), CheckTracker::ImGuiDrawTwoColorPickerSection("Area Incomplete", CVAR_TRACKER_CHECK("AreaIncomplete.MainColor"),