Revision: 3737
http://svn.sourceforge.net/winmerge/?rev=3737&view=rev
Author: kimmov
Date: 2006-10-30 08:30:00 -0800 (Mon, 30 Oct 2006)
Log Message:
-----------
PATCH: [ 1586869 ] Fix File Select -dialog modality
Modified Paths:
--------------
trunk/Src/Changes.txt
trunk/Src/DirCmpReportDlg.cpp
trunk/Src/FileFiltersDlg.cpp
trunk/Src/MainFrm.cpp
trunk/Src/Merge.cpp
trunk/Src/Merge.h
trunk/Src/MergeDoc.cpp
trunk/Src/PatchDlg.cpp
trunk/Src/ProjectFilePathsDlg.cpp
trunk/Src/PropRegistry.cpp
trunk/Src/PropVss.cpp
Modified: trunk/Src/Changes.txt
===================================================================
--- trunk/Src/Changes.txt 2006-10-29 14:49:14 UTC (rev 3736)
+++ trunk/Src/Changes.txt 2006-10-30 16:30:00 UTC (rev 3737)
@@ -2,6 +2,11 @@
Add new items to top.
(This summarizes all changes to all files under Src, including Src\Languages.)
+2006-10-30 Kimmo
+ PATCH: [ 1586869 ] Fix File Select -dialog modality
+ Src: DirCmpReportDlg.cpp FileFiltersDlg.cpp MainFrm.cpp Merge.cpp Merge.h
+ MergeDoc.cpp PatchDlg.cpp ProjectFilePathsDlg.cpp PropRegistry.cpp PropVss.cpp
+
2006-10-26 Gal
BUG: [ 1418805 ] Menu colors incorrect with non-standard color scheme
Src/: BCMenu.cpp
Modified: trunk/Src/DirCmpReportDlg.cpp
===================================================================
--- trunk/Src/DirCmpReportDlg.cpp 2006-10-29 14:49:14 UTC (rev 3736)
+++ trunk/Src/DirCmpReportDlg.cpp 2006-10-30 16:30:00 UTC (rev 3737)
@@ -118,7 +118,8 @@
int filterid = f_types[m_ctlStyle.GetCurSel()].browseFilter;
CString chosenFilepath;
- if (SelectFile(chosenFilepath, folder, title, filterid, FALSE))
+ if (SelectFile(GetSafeHwnd(), chosenFilepath, folder, title,
+ filterid, FALSE))
{
CString name;
SplitFilename(chosenFilepath, &folder, &name, NULL);
Modified: trunk/Src/FileFiltersDlg.cpp
===================================================================
--- trunk/Src/FileFiltersDlg.cpp 2006-10-29 14:49:14 UTC (rev 3736)
+++ trunk/Src/FileFiltersDlg.cpp 2006-10-30 16:30:00 UTC (rev 3737)
@@ -408,7 +408,8 @@
path += '\\';
CString s;
- if (SelectFile(s, path, title, IDS_FILEFILTER_FILEMASK, FALSE))
+ if (SelectFile(GetSafeHwnd(), s, path, title, IDS_FILEFILTER_FILEMASK,
+ FALSE))
{
// Fix file extension
TCHAR file[_MAX_FNAME] = {0};
@@ -537,7 +538,8 @@
CString userPath = theApp.m_globalFileFilter.GetUserFilterPathWithCreate();
CString title = LoadResString(IDS_FILEFILTER_INSTALL);
- if (SelectFile(s, path, title, IDS_FILEFILTER_FILEMASK, TRUE))
+ if (SelectFile(GetSafeHwnd(), s, path, title, IDS_FILEFILTER_FILEMASK,
+ TRUE))
{
CString filename, ext;
SplitFilename(s, NULL, &filename, &ext);
Modified: trunk/Src/MainFrm.cpp
===================================================================
--- trunk/Src/MainFrm.cpp 2006-10-29 14:49:14 UTC (rev 3736)
+++ trunk/Src/MainFrm.cpp 2006-10-30 16:30:00 UTC (rev 3737)
@@ -895,7 +895,7 @@
if (!bMultiFile)
{
VERIFY(title.LoadString(IDS_SAVE_AS_TITLE));
- if (SelectFile(s, strSavePath, title, NULL, FALSE))
+ if (SelectFile(GetSafeHwnd(), s, strSavePath, title, NULL, FALSE))
{
strSavePath = s;
nRetVal = IDNO;
@@ -2709,7 +2709,8 @@
// get the default projects path
CString strProjectPath = m_options.GetString(OPT_PROJECTS_PATH);
- if (!SelectFile(sFilepath, strProjectPath, title, IDS_PROJECTFILES, TRUE))
+ if (!SelectFile(GetSafeHwnd(), sFilepath, strProjectPath, title, IDS_PROJECTFILES,
+ TRUE))
return;
strProjectPath = paths_GetParentPath(sFilepath);
Modified: trunk/Src/Merge.cpp
===================================================================
--- trunk/Src/Merge.cpp 2006-10-29 14:49:14 UTC (rev 3736)
+++ trunk/Src/Merge.cpp 2006-10-30 16:30:00 UTC (rev 3737)
@@ -364,18 +364,18 @@
/**
* @brief Helper function for selecting dir/file
+ * @param [in] parent Handle to parent window. Can be a NULL, but then
+ * CMainFrame is used which can cause modality problems.
* @param [out] path Selected path is returned in this string
* @param [in] initialPath Initial path (and file) shown when dialog is opened
* @param [in] title Title for path selection dialog
- * @param [in] filterid 0 or STRING ID for filter string - 0 means "All files (*.*)"
+ * @param [in] filterid 0 or STRING ID for filter string
+ * - 0 means "All files (*.*)"
* @param [in] is_open Selects Open/Save -dialog
*/
-BOOL SelectFile(
- CString& path,
- LPCTSTR initialPath /*=NULL*/,
- LPCTSTR title /*= _T("Open")*/,
- UINT filterid /*=0*/,
- BOOL is_open /*=TRUE*/)
+BOOL SelectFile(HWND parent, CString& path, LPCTSTR initialPath /*=NULL*/,
+ LPCTSTR title /*= _T("Open")*/, UINT filterid /*=0*/,
+ BOOL is_open /*=TRUE*/)
{
path.Empty(); // Clear output param
@@ -394,20 +394,24 @@
SplitFilename(initialPath, 0, &sSelectedFile, 0);
}
}
+
+ if (parent == NULL)
+ parent = AfxGetMainWnd()->GetSafeHwnd();
if (!filterid)
filterid = IDS_ALLFILES;
- CString filters;
- VERIFY(filters.LoadString(filterid));
+ CString filters = LoadResString(filterid);
+
// Convert extension mask from MFC style separators ('|')
// to Win32 style separators ('\0')
LPTSTR filtersStr = filters.GetBuffer(0);
ConvertFilter(filtersStr);
+ filters.ReleaseBuffer();
OPENFILENAME ofn;
memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
- ofn.hwndOwner = AfxGetMainWnd()->GetSafeHwnd();
+ ofn.hwndOwner = parent;
ofn.lpstrFilter = filtersStr;
ofn.lpstrCustomFilter = NULL;
ofn.nFilterIndex = 1;
Modified: trunk/Src/Merge.h
===================================================================
--- trunk/Src/Merge.h 2006-10-29 14:49:14 UTC (rev 3736)
+++ trunk/Src/Merge.h 2006-10-30 16:30:00 UTC (rev 3737)
@@ -119,9 +119,8 @@
/////////////////////////////////////////////////////////////////////////////
CMergeDoc *GetDoc();
-BOOL SelectFile(CString& path, LPCTSTR root_path = NULL,
- LPCTSTR title = _T("Open"),
- UINT filterid =0,
+BOOL SelectFile(HWND parent, CString& path, LPCTSTR root_path = NULL,
+ LPCTSTR title = _T("Open"), UINT filterid = 0,
BOOL is_open =TRUE);
BOOL SelectFolder(CString& path, LPCTSTR root_path = NULL,
Modified: trunk/Src/MergeDoc.cpp
===================================================================
--- trunk/Src/MergeDoc.cpp 2006-10-29 14:49:14 UTC (rev 3736)
+++ trunk/Src/MergeDoc.cpp 2006-10-30 16:30:00 UTC (rev 3737)
@@ -978,6 +978,8 @@
CString title;
BOOL result = TRUE;
int answer = IDOK; // Set default we use for scratchpads
+ int nActiveViewIndexType = GetActiveMergeViewIndexType();
+ HWND parent = m_pView[nActiveViewIndexType]->GetSafeHwnd();
// We shouldn't get here if saving is succeed before
ASSERT(nSaveResult != SAVE_DONE);
@@ -1008,7 +1010,7 @@
else
VERIFY(title.LoadString(IDS_SAVE_RIGHT_AS));
- if (SelectFile(s, strPath, title, NULL, FALSE))
+ if (SelectFile(parent, s, strPath, title, NULL, FALSE))
{
CDiffTextBuffer *pBuffer = m_ptBuf[nBuffer];
strSavePath = s;
Modified: trunk/Src/PatchDlg.cpp
===================================================================
--- trunk/Src/PatchDlg.cpp 2006-10-29 14:49:14 UTC (rev 3736)
+++ trunk/Src/PatchDlg.cpp 2006-10-30 16:30:00 UTC (rev 3737)
@@ -257,7 +257,7 @@
VERIFY(title.LoadString(IDS_OPEN_TITLE));
folder = m_file1;
- if (SelectFile(s, folder, title, NULL, TRUE))
+ if (SelectFile(GetSafeHwnd(), s, folder, title, NULL, TRUE))
{
ChangeFile(s, TRUE);
m_ctlFile1.SetWindowText(s);
@@ -276,7 +276,7 @@
VERIFY(title.LoadString(IDS_OPEN_TITLE));
folder = m_file2;
- if (SelectFile(s, folder, title, NULL, TRUE))
+ if (SelectFile(GetSafeHwnd(), s, folder, title, NULL, TRUE))
{
ChangeFile(s, FALSE);
m_ctlFile2.SetWindowText(s);
@@ -334,7 +334,7 @@
VERIFY(title.LoadString(IDS_SAVE_AS_TITLE));
folder = m_fileResult;
- if (SelectFile(s, folder, title, NULL, FALSE))
+ if (SelectFile(GetSafeHwnd(), s, folder, title, NULL, FALSE))
{
SplitFilename(s, &folder, &name, NULL);
m_fileResult = s;
Modified: trunk/Src/ProjectFilePathsDlg.cpp
===================================================================
--- trunk/Src/ProjectFilePathsDlg.cpp 2006-10-29 14:49:14 UTC (rev 3736)
+++ trunk/Src/ProjectFilePathsDlg.cpp 2006-10-30 16:30:00 UTC (rev 3737)
@@ -73,7 +73,8 @@
void ProjectFilePathsDlg::OnBnClickedProjLfileBrowse()
{
UpdateData(TRUE);
- if (::SelectFile(m_sLeftFile, m_sLeftFile, NULL, NULL, TRUE))
+ if (::SelectFile(GetSafeHwnd(), m_sLeftFile, m_sLeftFile, NULL, NULL,
+ TRUE))
UpdateData(FALSE);
}
@@ -83,7 +84,8 @@
void ProjectFilePathsDlg::OnBnClickedProjRfileBrowse()
{
UpdateData(TRUE);
- if (::SelectFile(m_sRightFile, m_sRightFile, NULL, NULL, TRUE))
+ if (::SelectFile(GetSafeHwnd(), m_sRightFile, m_sRightFile, NULL, NULL,
+ TRUE))
UpdateData(FALSE);
}
@@ -227,7 +229,8 @@
CString strProjectFileName;
CString strProjectPath = GetOptionsMgr()->GetString(OPT_PROJECTS_PATH);
- if (!::SelectFile(strProjectFileName, strProjectPath, NULL, IDS_PROJECTFILES, bOpen))
+ if (!::SelectFile(GetSafeHwnd(), strProjectFileName, strProjectPath, NULL,
+ IDS_PROJECTFILES, bOpen))
return _T("");
if (strProjectFileName.IsEmpty())
Modified: trunk/Src/PropRegistry.cpp
===================================================================
--- trunk/Src/PropRegistry.cpp 2006-10-29 14:49:14 UTC (rev 3736)
+++ trunk/Src/PropRegistry.cpp 2006-10-30 16:30:00 UTC (rev 3737)
@@ -237,7 +237,7 @@
CString title;
VERIFY(title.LoadString(IDS_OPEN_TITLE));
- if (SelectFile(path, NULL, title, IDS_PROGRAMFILES, TRUE))
+ if (SelectFile(GetSafeHwnd(), path, NULL, title, IDS_PROGRAMFILES, TRUE))
{
m_strEditorPath = path;
UpdateData(FALSE);
Modified: trunk/Src/PropVss.cpp
===================================================================
--- trunk/Src/PropVss.cpp 2006-10-29 14:49:14 UTC (rev 3736)
+++ trunk/Src/PropVss.cpp 2006-10-30 16:30:00 UTC (rev 3737)
@@ -91,7 +91,7 @@
void CPropVss::OnBrowseButton()
{
CString s;
- if (SelectFile(s))
+ if (SelectFile(GetSafeHwnd(), s))
{
m_strPath = s;
m_ctlPath.SetWindowText(s);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|