From: <sv...@op...> - 2025-03-15 19:12:52
|
Author: sagamusix Date: Sat Mar 15 20:12:40 2025 New Revision: 23039 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=23039 Log: [Imp] Missing Sample Dialog: When browsing for a folder (and modern file browsing dialog is available), add the folder containing the module to the Places list. Relates to https://bugs.openmpt.org/view.php?id=1864 Modified: trunk/OpenMPT/mptrack/ExternalSamples.cpp trunk/OpenMPT/mptrack/FileDialog.cpp trunk/OpenMPT/mptrack/FileDialog.h Modified: trunk/OpenMPT/mptrack/ExternalSamples.cpp ============================================================================== --- trunk/OpenMPT/mptrack/ExternalSamples.cpp Sat Mar 15 20:12:32 2025 (r23038) +++ trunk/OpenMPT/mptrack/ExternalSamples.cpp Sat Mar 15 20:12:40 2025 (r23039) @@ -124,6 +124,7 @@ } BrowseForFolder dlg(TrackerSettings::Instance().PathSamples.GetWorkingDir(), _T("Select a folder to search for missing samples...")); + dlg.AddPlace(m_modDoc.GetPathNameMpt().GetDirectoryWithDrive()); if(dlg.Show()) { TrackerSettings::Instance().PathSamples.SetWorkingDir(dlg.GetDirectory()); Modified: trunk/OpenMPT/mptrack/FileDialog.cpp ============================================================================== --- trunk/OpenMPT/mptrack/FileDialog.cpp Sat Mar 15 20:12:32 2025 (r23038) +++ trunk/OpenMPT/mptrack/FileDialog.cpp Sat Mar 15 20:12:40 2025 (r23039) @@ -239,6 +239,12 @@ { CFileDialogEx dlg{FileDialogType::BrowseForFolder, nullptr, m_workingDirectory.AsNative().c_str(), 0, nullptr, parent, 0, TRUE, false}; dlg.m_ofn.lpstrTitle = m_caption; +#if MPT_WINNT_AT_LEAST(MPT_WIN_VISTA) + for(const auto &place : m_places) + { + dlg.AddPlace(place); + } +#endif if(dlg.DoModal() != IDOK) return false; m_workingDirectory = mpt::PathString::FromCString(dlg.GetPathName()); Modified: trunk/OpenMPT/mptrack/FileDialog.h ============================================================================== --- trunk/OpenMPT/mptrack/FileDialog.h Sat Mar 15 20:12:32 2025 (r23038) +++ trunk/OpenMPT/mptrack/FileDialog.h Sat Mar 15 20:12:40 2025 (r23039) @@ -117,11 +117,15 @@ { protected: mpt::PathString m_workingDirectory; + std::vector<mpt::PathString> m_places; CString m_caption; public: BrowseForFolder(const mpt::PathString &dir, const CString &caption) : m_workingDirectory(dir), m_caption(caption) { } + // Add a directory to the application-specific quick-access directories in the file dialog + BrowseForFolder &AddPlace(mpt::PathString path) { m_places.push_back(std::move(path)); return *this; } + // Show the folder selection dialog. bool Show(CWnd *parent = nullptr); |