OSDN Git Service

rev. 8127 was incomplete.
authorsdottaka <sdottaka@users.sourceforge.net>
Sat, 24 Jan 2015 06:14:01 +0000 (15:14 +0900)
committersdottaka <sdottaka@users.sourceforge.net>
Sat, 24 Jan 2015 06:14:01 +0000 (15:14 +0900)
--HG--
branch : stable

Src/DirView.cpp
Src/MainFrm.cpp

index 552ff26..69b69e4 100644 (file)
@@ -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;
index 0529d7c..1474ecd 100644 (file)
@@ -1120,7 +1120,7 @@ BOOL CMainFrame::DoFileOpen(const PathContext * pFiles /*=NULL*/,
                {
                        if (files.GetSize() == 3)
                        {
-                               AfxMessageBox(_T("3\83t\83H\83\8b\83_\94ä\8ar\8b@\94\\82Í\8eÀ\91\95\92\86\82Å\82·"), 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;
        }