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
float headerHeight = 20.0f;
#endif
ImVec2 size = ImGui::GetContentRegionMax();
size.y -= headerHeight;
if (!ImGui::BeginTable("Check Tracker", 1, 0, size)) {
if (!ImGui::BeginTable("Check Tracker", 1, 0)) {
EndFloatWindows();
return;
}
ImGui::TableNextRow(0, headerHeight);
ImGui::SetWindowFontScale(CVarGetFloat(CVAR_TRACKER_CHECK("FontSize"), 1.0f));
ImGui::TableNextRow(0, 0);
ImGui::TableNextColumn();
if (UIWidgets::CVarCheckbox(
if (CVarGetInteger(CVAR_TRACKER_CHECK("HiddenItemsToggleVisible"), 1) &&
UIWidgets::CVarCheckbox(
"Show Hidden Items", CVAR_TRACKER_CHECK("ShowHidden"),
UIWidgets::CheckboxOptions(
{ { .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);
RecalculateAllAreaTotals();
}
if (enableAvailableChecks) {
if (enableAvailableChecks && CVarGetInteger(CVAR_TRACKER_CHECK("AvailableChecksToggleVisible"), 1)) {
if (UIWidgets::CVarCheckbox(
"Only Show Available Checks", CVAR_TRACKER_CHECK("OnlyShowAvailable"),
UIWidgets::CheckboxOptions({ { .tooltip = "When active, unavailable checks will be hidden." } })
@@ -1069,49 +1070,61 @@ void CheckTrackerWindow::DrawElement() {
RecalculateAllAreaTotals();
}
}
UIWidgets::PaddedSeparator();
if (UIWidgets::Button("Expand All", UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(UIWidgets::Sizes::Inline))) {
optCollapseAll = false;
optExpandAll = true;
doAreaScroll = true;
}
ImGui::SameLine();
if (UIWidgets::Button("Collapse All",
UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(UIWidgets::Sizes::Inline))) {
optExpandAll = false;
optCollapseAll = true;
}
ImGui::SameLine();
if (UIWidgets::Button("Clear", UIWidgets::ButtonOptions({ { .tooltip = "Clear the search field" } })
.Color(THEME_COLOR)
.Size(UIWidgets::Sizes::Inline))) {
checkSearch.Clear();
UpdateFilters();
doAreaScroll = true;
if (CVarGetInteger(CVAR_TRACKER_CHECK("ExpandCollapseButtonsVisible"), 0)) {
if (UIWidgets::Button(
"Expand All",
UIWidgets::ButtonOptions().Color(THEME_COLOR).Size({ ImGui::GetContentRegionAvail().x / 2 - 6, 0 }))) {
optCollapseAll = false;
optExpandAll = true;
doAreaScroll = true;
}
ImGui::SameLine();
if (UIWidgets::Button(
"Collapse All",
UIWidgets::ButtonOptions().Color(THEME_COLOR).Size({ ImGui::GetContentRegionAvail().x - 6, 0 }))) {
optExpandAll = false;
optCollapseAll = true;
}
}
UIWidgets::PushStyleCombobox(THEME_COLOR);
if (checkSearch.Draw()) {
UpdateFilters();
if (CVarGetInteger(CVAR_TRACKER_CHECK("SearchInputVisible"), 1)) {
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();
ImGui::Separator();
std::ostringstream totalChecksSS;
totalChecksSS << "Total Checks: ";
if (enableAvailableChecks) {
totalChecksSS << totalChecksAvailable << " Available / ";
if (CVarGetInteger(CVAR_TRACKER_CHECK("CheckTotalsVisible"), 1)) {
std::ostringstream totalChecksSS;
totalChecksSS << "";
if (enableAvailableChecks) {
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
ImGui::TableNextRow();
ImGui::TableNextColumn();
size = ImGui::GetContentRegionAvail();
if (!ImGui::BeginTable("CheckTracker##Checks", 1, ImGuiTableFlags_ScrollY, size)) {
if (!ImGui::BeginTable("CheckTracker##Checks", 1, ImGuiTableFlags_ScrollY)) {
ImGui::EndTable();
EndFloatWindows();
return;
@@ -1181,7 +1194,7 @@ void CheckTrackerWindow::DrawElement() {
} else {
ImGui::SetNextItemOpen(!thisAreaFullyChecked, ImGuiCond_Once);
}
doDraw = ImGui::TreeNode(stemp.c_str());
doDraw = ImGui::TreeNodeEx(stemp.c_str(), ImGuiTreeNodeFlags_NoTreePushOnOpen);
ImGui::PopStyleColor();
ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(extraColor.r / 255.0f, extraColor.g / 255.0f,
@@ -1230,10 +1243,6 @@ void CheckTrackerWindow::DrawElement() {
DrawLocation(rc);
}
}
if (doDraw) {
ImGui::TreePop();
}
}
}
ImGui::PopStyleVar();
@@ -2130,6 +2139,16 @@ void CheckTrackerSettingsWindow::DrawElement() {
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) {
UIWidgets::CVarCheckbox("Enable Dragging", CVAR_TRACKER_CHECK("Draggable"),
UIWidgets::CheckboxOptions().Color(THEME_COLOR));
@@ -2172,7 +2191,6 @@ void CheckTrackerSettingsWindow::DrawElement() {
ImGui::EndDisabled();
// Filtering settings
UIWidgets::PaddedSeparator();
UIWidgets::CVarCheckbox(
"Filter Empty Areas", CVAR_TRACKER_CHECK("HideFilteredAreas"),
UIWidgets::CheckboxOptions()
@@ -2180,6 +2198,18 @@ void CheckTrackerSettingsWindow::DrawElement() {
.Color(THEME_COLOR)
.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();
CheckTracker::ImGuiDrawTwoColorPickerSection("Area Incomplete", CVAR_TRACKER_CHECK("AreaIncomplete.MainColor"),