| 16 | } |
| 17 | |
| 18 | void AbstractSectorView::drawContent() |
| 19 | { |
| 20 | auto disk = Datastore::getDisk(); |
| 21 | auto diskLayout = Datastore::getDiskLayout(); |
| 22 | if (!disk || !diskLayout) |
| 23 | return; |
| 24 | auto& image = disk->image; |
| 25 | if (!image) |
| 26 | return; |
| 27 | |
| 28 | auto [minCylinder, maxCylinder, minHead, maxHead] = getBounds(); |
| 29 | |
| 30 | unsigned minSector = UINT_MAX; |
| 31 | unsigned maxSector = 0; |
| 32 | for (auto& [chs, ltl] : diskLayout->layoutByLogicalLocation) |
| 33 | { |
| 34 | minSector = std::min( |
| 35 | minSector, *std::ranges::min_element(ltl->filesystemSectorOrder)); |
| 36 | maxSector = std::max( |
| 37 | maxSector, *std::ranges::max_element(ltl->filesystemSectorOrder)); |
| 38 | } |
| 39 | unsigned sectorCount = maxSector - minSector + 1; |
| 40 | |
| 41 | auto backgroundColour = ImGui::GetColorU32(ImGuiCol_WindowBg); |
| 42 | ImGui::PushStyleColor(ImGuiCol_TableBorderLight, backgroundColour); |
| 43 | ON_SCOPE_EXIT |
| 44 | { |
| 45 | ImGui::PopStyleColor(); |
| 46 | }; |
| 47 | |
| 48 | ImGui::PushStyleColor(ImGuiCol_TableBorderStrong, backgroundColour); |
| 49 | ON_SCOPE_EXIT |
| 50 | { |
| 51 | ImGui::PopStyleColor(); |
| 52 | }; |
| 53 | |
| 54 | if (ImGui::BeginTable("diskSummary", |
| 55 | sectorCount + 2, |
| 56 | ImGuiTableFlags_NoSavedSettings | |
| 57 | ImGuiTableFlags_HighlightHoveredColumn | |
| 58 | ImGuiTableFlags_NoClip | ImGuiTableFlags_NoPadInnerX | |
| 59 | ImGuiTableFlags_NoPadOuterX | ImGuiTableFlags_Borders)) |
| 60 | { |
| 61 | ON_SCOPE_EXIT |
| 62 | { |
| 63 | ImGui::EndTable(); |
| 64 | }; |
| 65 | |
| 66 | ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, {1, 1}); |
| 67 | ON_SCOPE_EXIT |
| 68 | { |
| 69 | ImGui::PopStyleVar(); |
| 70 | }; |
| 71 | |
| 72 | auto originalFontSize = ImGui::GetFontSize(); |
| 73 | ImGui::PushFont(NULL, originalFontSize * 0.6); |
| 74 | ON_SCOPE_EXIT |
| 75 | { |
nothing calls this directly
no test coverage detected