| 200 | } |
| 201 | |
| 202 | void QuickSpawnMenu::UpdateDisplay() |
| 203 | { |
| 204 | if ((mMenuMode == MenuMode::SingleLetter && mHeldKeys.isEmpty()) || TheSynth->GetMoveModule() != nullptr) |
| 205 | { |
| 206 | Hide(); |
| 207 | } |
| 208 | else |
| 209 | { |
| 210 | if (mMenuMode == MenuMode::ModuleCategories) |
| 211 | { |
| 212 | mElements.clear(); |
| 213 | mCategoryIndices.clear(); |
| 214 | int categoryIndex = 0; |
| 215 | for (auto* dropdown : TheTitleBar->GetSpawnLists()) |
| 216 | { |
| 217 | bool containsValidTarget = false; |
| 218 | if (mFilterForCable == nullptr) |
| 219 | { |
| 220 | containsValidTarget = true; |
| 221 | } |
| 222 | else |
| 223 | { |
| 224 | const auto& spawnables = dropdown->GetElements(); |
| 225 | for (size_t i = 0; i < spawnables.size(); ++i) |
| 226 | { |
| 227 | if (MatchesFilter(spawnables[i])) |
| 228 | containsValidTarget = true; |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | if (containsValidTarget) |
| 233 | { |
| 234 | std::string label = dropdown->GetLabel(); |
| 235 | ofStringReplace(label, ":", ""); |
| 236 | ModuleFactory::Spawnable dummy; |
| 237 | dummy.mLabel = label; |
| 238 | mElements.push_back(dummy); |
| 239 | mCategoryIndices.push_back(categoryIndex); |
| 240 | } |
| 241 | |
| 242 | ++categoryIndex; |
| 243 | } |
| 244 | } |
| 245 | else if (mMenuMode == MenuMode::SingleCategory) |
| 246 | { |
| 247 | mElements.clear(); |
| 248 | const auto& elements = TheTitleBar->GetSpawnLists()[mSelectedCategoryIndex]->GetElements(); |
| 249 | for (size_t i = 0; i < elements.size(); ++i) |
| 250 | { |
| 251 | if (MatchesFilter(elements[i])) |
| 252 | mElements.push_back(elements[i]); |
| 253 | } |
| 254 | } |
| 255 | else if (mMenuMode == MenuMode::Search) |
| 256 | { |
| 257 | mElements.clear(); |
| 258 | const auto& elements = TheSynth->GetModuleFactory()->GetSpawnableModules(mSearchString.toStdString(), true); |
| 259 | int exactMatches = 0; |
nothing calls this directly
no test coverage detected