| 143 | } |
| 144 | |
| 145 | static void DrawSimpleModMenu() { |
| 146 | CategorizedModsList& categmods = GetCachedCategorizedMods(); |
| 147 | CategorizedModsList::iterator modcatit = categmods.begin(); |
| 148 | |
| 149 | for (; modcatit != categmods.end(); modcatit++) { |
| 150 | const std::vector<ModInstance*> mods = modcatit->second; |
| 151 | if (mods.size() > 0 && ImGui::TreeNodeEx(modcatit->first, ImGuiTreeNodeFlags_DefaultOpen)) { |
| 152 | for (auto mod : mods) { |
| 153 | bool active = mod->IsActive(); |
| 154 | ModID sid = mod->GetSid(); |
| 155 | ImGui::PushID(sid.id); |
| 156 | if (CanActivateModInstance(mod)) { |
| 157 | if (ImGui::Checkbox(mod->name, &active)) { |
| 158 | ModLoading::Instance().GetMod(mod->GetSid())->Activate(active); |
| 159 | mod_can_activate_check_cache_map_.clear(); |
| 160 | } |
| 161 | } else { |
| 162 | ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyle().Colors[ImGuiCol_TextDisabled]); |
| 163 | ImGui::Checkbox(mod->name, &active); |
| 164 | ImGui::PopStyleColor(1); |
| 165 | } |
| 166 | ImGui::PopID(); |
| 167 | if (ImGui::IsItemHovered()) { |
| 168 | ImGui::BeginTooltip(); |
| 169 | ImGui::PushTextWrapPos(450.0f); |
| 170 | const int kBufSize = 512; |
| 171 | char buf[kBufSize]; |
| 172 | |
| 173 | if (mod->GetValidityErrors().size() > 0) { |
| 174 | FormatString( |
| 175 | buf, kBufSize, |
| 176 | "%s %s\nWarnings:\n%s", |
| 177 | mod->name.c_str(), mod->version.c_str(), mod->GetValidityErrors().c_str()); |
| 178 | } else { |
| 179 | FormatString( |
| 180 | buf, kBufSize, |
| 181 | "%s %s\n", |
| 182 | mod->name.c_str(), mod->version.c_str()); |
| 183 | } |
| 184 | ImGui::TextUnformatted(buf); |
| 185 | ImGui::PopTextWrapPos(); |
| 186 | ImGui::EndTooltip(); |
| 187 | } |
| 188 | } |
| 189 | ImGui::TreePop(); |
| 190 | } |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | static void ImGuiYesNo(bool v) { |
| 195 | ImGui::Text("%s", v ? "Yes" : "No"); |
no test coverage detected