| 16 | ".opus"}; |
| 17 | |
| 18 | void CFileBrowser::ShowFileDialog( |
| 19 | int StorageType, EFileType FileType, |
| 20 | const char *pTitle, const char *pButtonText, |
| 21 | const char *pInitialPath, const char *pInitialFilename, |
| 22 | FFileDialogOpenCallback pfnOpenCallback, void *pOpenCallbackUser) |
| 23 | { |
| 24 | m_StorageType = StorageType; |
| 25 | m_FileType = FileType; |
| 26 | if(m_StorageType == IStorage::TYPE_ALL) |
| 27 | { |
| 28 | int NumStoragesWithFolder = 0; |
| 29 | for(int CheckStorageType = IStorage::TYPE_SAVE; CheckStorageType < Storage()->NumPaths(); ++CheckStorageType) |
| 30 | { |
| 31 | if(Storage()->FolderExists(pInitialPath, CheckStorageType)) |
| 32 | { |
| 33 | NumStoragesWithFolder++; |
| 34 | } |
| 35 | } |
| 36 | m_MultipleStorages = NumStoragesWithFolder > 1; |
| 37 | } |
| 38 | else |
| 39 | { |
| 40 | m_MultipleStorages = false; |
| 41 | } |
| 42 | m_SaveAction = m_StorageType == IStorage::TYPE_SAVE; |
| 43 | |
| 44 | Ui()->ClosePopupMenus(); |
| 45 | str_copy(m_aTitle, pTitle); |
| 46 | str_copy(m_aButtonText, pButtonText); |
| 47 | m_pfnOpenCallback = pfnOpenCallback; |
| 48 | m_pOpenCallbackUser = pOpenCallbackUser; |
| 49 | m_ShowingRoot = false; |
| 50 | str_copy(m_aInitialFolder, pInitialPath); |
| 51 | str_copy(m_aCurrentFolder, pInitialPath); |
| 52 | m_aCurrentLink[0] = '\0'; |
| 53 | m_pCurrentPath = m_aCurrentFolder; |
| 54 | m_FilenameInput.Set(pInitialFilename); |
| 55 | m_FilterInput.Clear(); |
| 56 | dbg_assert(m_PreviewState == EPreviewState::UNLOADED, "Preview was not unloaded before showing file dialog"); |
| 57 | m_ListBox.Reset(); |
| 58 | |
| 59 | FilelistPopulate(m_StorageType, false); |
| 60 | |
| 61 | if(m_SaveAction) |
| 62 | { |
| 63 | Ui()->SetActiveItem(&m_FilenameInput); |
| 64 | if(!m_FilenameInput.IsEmpty()) |
| 65 | { |
| 66 | UpdateSelectedIndex(m_FilenameInput.GetString()); |
| 67 | } |
| 68 | } |
| 69 | else |
| 70 | { |
| 71 | Ui()->SetActiveItem(&m_FilterInput); |
| 72 | UpdateFilenameInput(); |
| 73 | } |
| 74 | |
| 75 | Editor()->m_Dialog = DIALOG_FILE; |
no test coverage detected