From e14559599ad4a7a377e94e71ad128126f987d99a Mon Sep 17 00:00:00 2001 From: sdottaka Date: Sat, 24 Jan 2015 15:14:01 +0900 Subject: [PATCH] rev. 8127 was incomplete. --HG-- branch : stable --- Src/DirView.cpp | 35 ++++++++++++++++++----------------- Src/MainFrm.cpp | 4 ++-- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Src/DirView.cpp b/Src/DirView.cpp index 552ff269d..69b69e477 100644 --- a/Src/DirView.cpp +++ b/Src/DirView.cpp @@ -1522,22 +1522,22 @@ bool CDirView::OpenTwoItems(SELECTIONTYPE selectionType, uintptr_t pos1, uintptr break; } + PathContext files1, files2; + GetItemFileNames(sel1, &files1); + GetItemFileNames(sel2, &files2); + paths.SetLeft(files1[nPane[0]]); + paths.SetRight(files2[nPane[1]]); + if (pdi[0]->diffcode.isDirectory()) { isDir = true; - if (GetPairComparability(PathContext(pathLeft, pathRight)) != IS_EXISTING_DIR) + if (GetPairComparability(paths) != IS_EXISTING_DIR) { LangMessageBox(IDS_INVALID_DIRECTORY, MB_ICONSTOP); return false; } } - PathContext files1, files2; - GetItemFileNames(sel1, &files1); - GetItemFileNames(sel2, &files2); - paths.SetLeft(files1[nPane[0]]); - paths.SetRight(files2[nPane[1]]); - return true; } @@ -1674,19 +1674,20 @@ bool CDirView::OpenThreeItems(uintptr_t pos1, uintptr_t pos2, uintptr_t pos3, DI GetItemFileNames(sel3, &pathsTemp); pathRight = pathsTemp[2]; + paths.SetLeft(pathLeft.c_str()); + paths.SetMiddle(pathMiddle.c_str()); + paths.SetRight(pathRight.c_str()); + if (pdi[0]->diffcode.isDirectory()) { isDir = true; - if (GetPairComparability(PathContext(pathLeft, pathMiddle, pathRight)) != IS_EXISTING_DIR) + if (GetPairComparability(paths) != IS_EXISTING_DIR) { AfxMessageBox(IDS_INVALID_DIRECTORY, MB_ICONSTOP); return false; } } - paths.SetLeft(pathLeft.c_str()); - paths.SetRight(pathRight.c_str()); - return true; } @@ -1740,14 +1741,14 @@ void CDirView::OpenSelection(SELECTIONTYPE selectionType /*= SELECTIONTYPE_NORMA bool bRO[3] = { false, false, false }; int nPane[3]; - if (pDoc->m_nDirs < 3 && pos2) + if (pos2 && !pos3) { bool success = OpenTwoItems(selectionType, pos1, pos2, pdi, paths, sel1, sel2, isdir, nPane); if (!success) return; } - else if (pDoc->m_nDirs == 3 && pos2) + else if (pos2 && pos3) { bool success = OpenThreeItems(pos1, pos2, pos3, pdi, paths, sel1, sel2, sel3, isdir, nPane); @@ -1774,7 +1775,7 @@ void CDirView::OpenSelection(SELECTIONTYPE selectionType /*= SELECTIONTYPE_NORMA // Don't add folders to MRU GetMainFrame()->DoFileOpen(&paths, dwFlags, pDoc->GetRecursive(), (GetAsyncKeyState(VK_CONTROL) & 0x8000) ? NULL : pDoc); } - else if (HasZipSupport() && std::count_if(paths.begin(), paths.end(), ArchiveGuessFormat) == pDoc->m_nDirs) + else if (HasZipSupport() && std::count_if(paths.begin(), paths.end(), ArchiveGuessFormat) == paths.GetSize()) { // Open archives, not adding paths to MRU GetMainFrame()->DoFileOpen(&paths, dwFlags, pDoc->GetRecursive(), NULL, _T(""), infoUnpacker); @@ -1797,7 +1798,7 @@ void CDirView::OpenSelection(SELECTIONTYPE selectionType /*= SELECTIONTYPE_NORMA // Open identical and different files FileLocation fileloc[3]; - if (pDoc->m_nDirs < 3) + if (paths.GetSize() < 3) { theApp.m_strDescriptions[0].erase(); theApp.m_strDescriptions[1].erase(); @@ -1839,7 +1840,7 @@ void CDirView::OpenSelection(SELECTIONTYPE selectionType /*= SELECTIONTYPE_NORMA fileloc[nIndex].setPath(paths[nIndex]); fileloc[nIndex].encoding = pdi[nIndex]->diffFileInfo[nPane[nIndex]].encoding; } - GetMainFrame()->ShowAutoMergeDoc(pDoc, pDoc->m_nDirs, fileloc, + GetMainFrame()->ShowAutoMergeDoc(pDoc, paths.GetSize(), fileloc, dwFlags, infoUnpacker); } } @@ -2317,7 +2318,7 @@ void CDirView::DoUpdateOpen(SELECTIONTYPE selectionType, CCmdUI* pCmdUI) const DIFFITEM& di1 = GetDiffItem(sel1); const DIFFITEM& di2 = GetDiffItem(sel2); const DIFFITEM& di3 = GetDiffItem(sel3); - if (!AreItemsOpenable(di1, di2, di3)) + if (selectionType != SELECTIONTYPE_NORMAL || !AreItemsOpenable(di1, di2, di3)) { pCmdUI->Enable(FALSE); return; diff --git a/Src/MainFrm.cpp b/Src/MainFrm.cpp index 0529d7c16..1474ecde1 100644 --- a/Src/MainFrm.cpp +++ b/Src/MainFrm.cpp @@ -1120,7 +1120,7 @@ BOOL CMainFrame::DoFileOpen(const PathContext * pFiles /*=NULL*/, { if (files.GetSize() == 3) { - AfxMessageBox(_T("3ƒtƒHƒ‹ƒ_”äŠr‹@”\‚ÍŽÀ‘•’†‚Å‚·"), MB_ICONWARNING | MB_DONT_ASK_AGAIN); + AfxMessageBox(_T("3-way folder compare feature is in progress"), MB_ICONWARNING | MB_DONT_ASK_AGAIN); } // Anything that can go wrong inside InitCompare() will yield an // exception. There is no point in checking return value. @@ -1618,6 +1618,7 @@ CHexMergeDoc * CMainFrame::GetHexMergeDocToShow(int nFiles, CDirDoc * pDirDoc) /// Get pointer to a dir doc for displaying a scan CDirDoc * CMainFrame::GetDirDocToShow(int nDirs, BOOL * pNew) { + CDirDoc::m_nDirsTemp = nDirs; if (!m_pMenus[MENU_DIRVIEW]) theApp.m_pDirTemplate->m_hMenuShared = NewDirViewMenu(); CDirDoc * pDirDoc = 0; @@ -1637,7 +1638,6 @@ CDirDoc * CMainFrame::GetDirDocToShow(int nDirs, BOOL * pNew) } if (!pDirDoc) { - CDirDoc::m_nDirsTemp = nDirs; pDirDoc = (CDirDoc*)theApp.m_pDirTemplate->OpenDocumentFile(NULL); *pNew = TRUE; } -- 2.11.0