MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / m_LocateItem_Loop

Method m_LocateItem_Loop

external/ImGuiFileDialog/ImGuiFileDialog.cpp:3434–3474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3432
3433#ifdef USE_EXPLORATION_BY_KEYS
3434bool IGFD::KeyExplorerFeature::m_LocateItem_Loop(FileDialogInternal& vFileDialogInternal, ImWchar vC) {
3435 bool found = false;
3436
3437 auto& fdi = vFileDialogInternal.fileManager;
3438 if (!fdi.IsFilteredListEmpty()) {
3439 auto countFiles = fdi.GetFilteredListSize();
3440 for (size_t i = m_LocateFileByInputChar_lastFileIdx; i < countFiles; i++) {
3441 auto nfo = fdi.GetFilteredFileAt(i);
3442 if (nfo.use_count()) {
3443 if (nfo->fileNameExt_optimized[0] == vC || // lower case search //-V522
3444 nfo->fileNameExt[0] == vC) // maybe upper case search
3445 {
3446 // float p = ((float)i) * ImGui::GetTextLineHeightWithSpacing();
3447 float p = (float)((double)i / (double)countFiles) * ImGui::GetScrollMaxY();
3448 ImGui::SetScrollY(p);
3449 m_LocateFileByInputChar_lastFound = true;
3450 m_LocateFileByInputChar_lastFileIdx = i;
3451 m_StartFlashItem(m_LocateFileByInputChar_lastFileIdx);
3452
3453 auto pInfos = fdi.GetFilteredFileAt(m_LocateFileByInputChar_lastFileIdx);
3454 if (pInfos.use_count()) {
3455 if (pInfos->fileType.isDir()) //-V522
3456 {
3457 if (fdi.dLGDirectoryMode) // directory chooser
3458 {
3459 fdi.SelectFileName(pInfos);
3460 }
3461 } else {
3462 fdi.SelectFileName(pInfos);
3463 }
3464
3465 found = true;
3466 break;
3467 }
3468 }
3469 }
3470 }
3471 }
3472
3473 return found;
3474}
3475
3476void IGFD::KeyExplorerFeature::m_LocateByInputKey(FileDialogInternal& vFileDialogInternal) {
3477 ImGuiContext& g = *GImGui;

Callers

nothing calls this directly

Calls 5

IsFilteredListEmptyMethod · 0.80
GetFilteredListSizeMethod · 0.80
GetFilteredFileAtMethod · 0.80
isDirMethod · 0.80
SelectFileNameMethod · 0.80

Tested by

no test coverage detected