From: <sag...@us...> - 2013-12-01 23:02:27
|
Revision: 3345 http://sourceforge.net/p/modplug/code/3345 Author: saga-games Date: 2013-12-01 23:02:18 +0000 (Sun, 01 Dec 2013) Log Message: ----------- [Imp] Add proper parent window handles to file / folder selection dialogs. Modified Paths: -------------- trunk/OpenMPT/mptrack/AutoSaver.cpp trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/FileDialog.cpp trunk/OpenMPT/mptrack/FileDialog.h trunk/OpenMPT/mptrack/KeyConfigDlg.cpp trunk/OpenMPT/mptrack/Moptions.cpp trunk/OpenMPT/mptrack/SelectPluginDialog.cpp trunk/OpenMPT/mptrack/TuningDialog.cpp Modified: trunk/OpenMPT/mptrack/AutoSaver.cpp =================================================================== --- trunk/OpenMPT/mptrack/AutoSaver.cpp 2013-12-01 21:06:29 UTC (rev 3344) +++ trunk/OpenMPT/mptrack/AutoSaver.cpp 2013-12-01 23:02:18 UTC (rev 3345) @@ -415,7 +415,7 @@ ::GetDlgItemTextW(m_hWnd, IDC_AUTOSAVE_PATH, szPath, CountOf(szPath)); BrowseForFolder dlg(mpt::PathString::FromNative(szPath), TEXT("Select a folder to store autosaved files in...")); - if(dlg.Show()) + if(dlg.Show(this)) { ::SetDlgItemTextW(m_hWnd, IDC_AUTOSAVE_PATH, dlg.GetDirectory().AsNative().c_str()); OnSettingsChanged(); Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2013-12-01 21:06:29 UTC (rev 3344) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2013-12-01 23:02:18 UTC (rev 3345) @@ -1691,7 +1691,7 @@ "All Files (*.*)|*.*||") .WorkingDirectory(TrackerDirectories::Instance().GetWorkingDirectory(DIR_INSTRUMENTS)) .FilterIndex(&nLastIndex); - if(!dlg.Show()) return; + if(!dlg.Show(this)) return; TrackerDirectories::Instance().SetWorkingDirectory(dlg.GetWorkingDirectory(), DIR_INSTRUMENTS, true); @@ -1749,7 +1749,7 @@ "FastTracker II Instruments (*.xi)|*.xi||") .WorkingDirectory(TrackerDirectories::Instance().GetWorkingDirectory(DIR_INSTRUMENTS)) .FilterIndex(&index); - if(!dlg.Show()) return; + if(!dlg.Show(this)) return; BeginWaitCursor(); Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2013-12-01 21:06:29 UTC (rev 3344) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2013-12-01 23:02:18 UTC (rev 3345) @@ -962,7 +962,7 @@ "All Files (*.*)|*.*||") .WorkingDirectory(TrackerDirectories::Instance().GetWorkingDirectory(DIR_SAMPLES)) .FilterIndex(&nLastIndex); - if(!dlg.Show()) return; + if(!dlg.Show(this)) return; TrackerDirectories::Instance().SetWorkingDirectory(dlg.GetWorkingDirectory(), DIR_SAMPLES, true); @@ -1033,7 +1033,7 @@ "RAW Audio (*.raw)|*.raw||") .WorkingDirectory(TrackerDirectories::Instance().GetWorkingDirectory(DIR_SAMPLES)) .FilterIndex(&filter); - if(!dlg.Show()) return; + if(!dlg.Show(this)) return; BeginWaitCursor(); Modified: trunk/OpenMPT/mptrack/FileDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/FileDialog.cpp 2013-12-01 21:06:29 UTC (rev 3344) +++ trunk/OpenMPT/mptrack/FileDialog.cpp 2013-12-01 23:02:18 UTC (rev 3345) @@ -16,8 +16,8 @@ // Display the file dialog. -bool FileDialog::Show() -//--------------------- +bool FileDialog::Show(CWnd *parent) +//--------------------------------- { filenames.clear(); @@ -37,7 +37,7 @@ OPENFILENAMEW ofn; MemsetZero(ofn); ofn.lStructSize = sizeof(OPENFILENAMEW); - ofn.hwndOwner = theApp.m_pMainWnd->GetSafeHwnd(); + ofn.hwndOwner = (parent != nullptr ? parent : theApp.m_pMainWnd)->GetSafeHwnd(); ofn.hInstance = theApp.m_hInstance; ofn.lpstrFilter = extFilter.c_str(); ofn.lpstrCustomFilter = NULL; @@ -122,14 +122,14 @@ // Display the folder dialog. -bool BrowseForFolder::Show() -//-------------------------- +bool BrowseForFolder::Show(CWnd *parent) +//-------------------------------------- { WCHAR path[MAX_PATH]; BROWSEINFOW bi; MemsetZero(bi); - bi.hwndOwner = theApp.m_pMainWnd->GetSafeHwnd(); + bi.hwndOwner = (parent != nullptr ? parent : theApp.m_pMainWnd)->GetSafeHwnd(); bi.lpszTitle = caption.empty() ? NULL : caption.c_str(); bi.pszDisplayName = path; bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_USENEWUI; Modified: trunk/OpenMPT/mptrack/FileDialog.h =================================================================== --- trunk/OpenMPT/mptrack/FileDialog.h 2013-12-01 21:06:29 UTC (rev 3344) +++ trunk/OpenMPT/mptrack/FileDialog.h 2013-12-01 23:02:18 UTC (rev 3345) @@ -52,7 +52,7 @@ FileDialog &FilterIndex(int *index) { filterIndex = index; return *this; } // Show the file selection dialog. - bool Show(); + bool Show(CWnd *parent = nullptr); // Get some selected file. Mostly useful when only one selected file is possible anyway. mpt::PathString GetFirstFile() const @@ -106,7 +106,7 @@ BrowseForFolder(const mpt::PathString &dir, const CString &caption) : workingDirectory(dir), caption(mpt::ToWide(caption)) { } // Show the folder selection dialog. - bool Show(); + bool Show(CWnd *parent = nullptr); // Gets selected directory. mpt::PathString GetDirectory() const { return workingDirectory; } Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2013-12-01 21:06:29 UTC (rev 3344) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2013-12-01 23:02:18 UTC (rev 3345) @@ -842,7 +842,7 @@ .DefaultFilename(m_sFullPathName) .ExtensionFilter("OpenMPT Key Bindings (*.mkb)|*.mkb||") .WorkingDirectory(TrackerSettings::Instance().m_szKbdFile); - if(!dlg.Show()) return; + if(!dlg.Show(this)) return; m_sFullPathName = dlg.GetFirstFile(); plocalCmdSet->LoadFile(m_sFullPathName); @@ -859,7 +859,7 @@ .DefaultFilename(m_sFullPathName) .ExtensionFilter("OpenMPT Key Bindings (*.mkb)|*.mkb||") .WorkingDirectory(TrackerSettings::Instance().m_szKbdFile); - if(!dlg.Show()) return; + if(!dlg.Show(this)) return; m_sFullPathName = dlg.GetFirstFile(); plocalCmdSet->SaveFile(m_sFullPathName); Modified: trunk/OpenMPT/mptrack/Moptions.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moptions.cpp 2013-12-01 21:06:29 UTC (rev 3344) +++ trunk/OpenMPT/mptrack/Moptions.cpp 2013-12-01 23:02:18 UTC (rev 3345) @@ -492,7 +492,7 @@ .DefaultExtension("mptcolor") .ExtensionFilter("OpenMPT Color Schemes|*.mptcolor||") .WorkingDirectory(theApp.GetConfigPath()); - if(!dlg.Show()) return; + if(!dlg.Show(this)) return; // Ensure that all colours are reset (for outdated colour schemes) OnPresetMPT(); @@ -515,7 +515,7 @@ .DefaultExtension("mptcolor") .ExtensionFilter("OpenMPT Color Schemes|*.mptcolor||") .WorkingDirectory(theApp.GetConfigPath()); - if(!dlg.Show()) return; + if(!dlg.Show(this)) return; { IniFileSettingsContainer file(dlg.GetFirstFile()); @@ -669,7 +669,7 @@ ::GetDlgItemTextW(m_hWnd, nID, szPath, CountOf(szPath)); ::BrowseForFolder dlg(mpt::PathString::FromNative(szPath), TEXT("Select a default folder...")); - if(dlg.Show()) + if(dlg.Show(this)) { ::SetDlgItemTextW(m_hWnd, nID, dlg.GetDirectory().AsNative().c_str()); OnSettingsChanged(); Modified: trunk/OpenMPT/mptrack/SelectPluginDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2013-12-01 21:06:29 UTC (rev 3344) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2013-12-01 23:02:18 UTC (rev 3345) @@ -488,7 +488,7 @@ .DefaultExtension("dll") .ExtensionFilter("VST Plugins (*.dll)|*.dll||") .WorkingDirectory(TrackerDirectories::Instance().GetWorkingDirectory(DIR_PLUGINS)); - if(!dlg.Show()) return; + if(!dlg.Show(this)) return; TrackerDirectories::Instance().SetWorkingDirectory(dlg.GetWorkingDirectory(), DIR_PLUGINS, true); Modified: trunk/OpenMPT/mptrack/TuningDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/TuningDialog.cpp 2013-12-01 21:06:29 UTC (rev 3344) +++ trunk/OpenMPT/mptrack/TuningDialog.cpp 2013-12-01 23:02:18 UTC (rev 3345) @@ -637,7 +637,7 @@ .ExtensionFilter(filter) .WorkingDirectory(TrackerDirectories::Instance().GetWorkingDirectory(DIR_TUNING)) .FilterIndex(&filterIndex); - if(!dlg.Show()) return; + if(!dlg.Show(this)) return; BeginWaitCursor(); @@ -677,7 +677,7 @@ .AllowMultiSelect() .ExtensionFilter(sFilter) .WorkingDirectory(TrackerDirectories::Instance().GetWorkingDirectory(DIR_TUNING)); - if(!dlg.Show()) + if(!dlg.Show(this)) return; TrackerDirectories::Instance().SetWorkingDirectory(dlg.GetWorkingDirectory(), DIR_TUNING, true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |