| 61 | } |
| 62 | |
| 63 | void renderBitContainers(std::vector<std::shared_ptr<satdump::BitContainer>> &all_bit_containers, std::shared_ptr<satdump::BitContainer> ¤t_container) |
| 64 | { |
| 65 | for (int i = 0; i < all_bit_containers.size(); i++) |
| 66 | { |
| 67 | auto &cont = all_bit_containers[i]; |
| 68 | |
| 69 | if (!cont) |
| 70 | continue; |
| 71 | |
| 72 | ImGui::TreeNodeEx(cont->getName().c_str(), ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen | (cont == current_container ? ImGuiTreeNodeFlags_Selected : 0)); |
| 73 | if (ImGui::IsItemClicked()) |
| 74 | { |
| 75 | current_container = cont; |
| 76 | } |
| 77 | ImGui::TreePush(std::string("##BitViewerTree" + cont->getID()).c_str()); |
| 78 | |
| 79 | bool del = false; |
| 80 | { // Closing button |
| 81 | ImGui::SameLine(); |
| 82 | ImGui::Text(" "); |
| 83 | ImGui::SameLine(); |
| 84 | |
| 85 | ImGui::PushStyleColor(ImGuiCol_Text, style::theme.red.Value); |
| 86 | ImGui::PushStyleColor(ImGuiCol_Button, ImVec4()); |
| 87 | ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0); |
| 88 | if (ImGui::SmallButton(std::string(u8"\uf00d##dataset" + cont->getName()).c_str())) |
| 89 | { |
| 90 | logger->info("Closing bit container " + cont->getName()); |
| 91 | del = true; |
| 92 | } |
| 93 | ImGui::PopStyleVar(); |
| 94 | ImGui::PopStyleColor(2); |
| 95 | } |
| 96 | |
| 97 | renderBitContainers(cont->all_bit_containers, current_container); |
| 98 | ImGui::TreePop(); |
| 99 | |
| 100 | if (del) |
| 101 | cont.reset(); |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | void BitViewApplication::drawPanel() |
| 106 | { |
no test coverage detected