OSDN Git Service

Fix bitbucket-jp issue #15:Generating HTML Folder Compare report including File Compa...
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Thu, 11 Jul 2019 12:57:09 +0000 (21:57 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Thu, 11 Jul 2019 12:57:09 +0000 (21:57 +0900)
Src/DiffThread.cpp
Src/DirScan.cpp
Src/DirView.cpp

index 97d130e..f74b9aa 100644 (file)
@@ -29,6 +29,7 @@
 #include "UnicodeString.h"
 #include "CompareStats.h"
 #include "IAbortable.h"
+#include "Plugins.h"
 #include "DebugNew.h"
 
 using Poco::Thread;
@@ -143,6 +144,7 @@ static void DiffThreadCollect(void *pParam)
 static void DiffThreadCompare(void *pParam)
 {
        DiffFuncStruct *myStruct = static_cast<DiffFuncStruct *>(pParam);
+       CAssureScriptsForThread scriptsForRescan;
 
        // Stash abortable interface into context
        myStruct->context->SetAbortable(myStruct->m_pAbortgate);
index bebb7a9..951b12f 100644 (file)
@@ -676,7 +676,6 @@ static int CompareRequestedItems(DiffFuncStruct *myStruct, DIFFITEM *parentdiffp
 
 int DirScan_CompareRequestedItems(DiffFuncStruct *myStruct, DIFFITEM *parentdiffpos)
 {
-       CAssureScriptsForThread scriptsForRescan;
        return CompareRequestedItems(myStruct, parentdiffpos);
 }
 
index 932fa8e..12f6a24 100644 (file)
@@ -2563,9 +2563,23 @@ struct FileCmpReport: public IFileCmpReport
                strutils::replace(sLinkPath, _T("\\"), _T("_"));
                sLinkPath += _T(".html");
                String sReportPath = paths::ConcatPath(sDestDir, sLinkPath);
+               bool completed = false;
 
                m_pDirView->MoveFocus(m_pDirView->GetFirstSelectedInd(), nIndex, m_pDirView->GetSelectedCount());
-               m_pDirView->SendMessage(MSG_GENERATE_FLIE_COMPARE_REPORT, reinterpret_cast<WPARAM>(sReportPath.c_str()), 0);
+               m_pDirView->PostMessage(MSG_GENERATE_FLIE_COMPARE_REPORT,
+                       reinterpret_cast<WPARAM>(sReportPath.c_str()), 
+                       reinterpret_cast<LPARAM>(&completed));
+
+               while (!completed)
+               {
+                       MSG msg;
+                       while (::PeekMessage(&msg, nullptr, NULL, NULL, PM_NOREMOVE))
+                       {
+                               if (!AfxGetApp()->PumpMessage())
+                                       break;
+                       }
+                       Sleep(5);
+               }
 
                return true;
        }
@@ -2582,9 +2596,11 @@ LRESULT CDirView::OnGenerateFileCmpReport(WPARAM wParam, LPARAM lParam)
        if (pMergeDoc == nullptr)
                pMergeDoc = dynamic_cast<IMergeDoc *>(pFrame);
 
+       auto *pReportFileName = reinterpret_cast<const TCHAR *>(wParam);
+       bool *pCompleted = reinterpret_cast<bool *>(lParam);
        if (pMergeDoc != nullptr)
        {
-               pMergeDoc->GenerateReport(reinterpret_cast<TCHAR *>(wParam));
+               pMergeDoc->GenerateReport(pReportFileName);
                pMergeDoc->CloseNow();
        }
        MSG msg;
@@ -2592,6 +2608,7 @@ LRESULT CDirView::OnGenerateFileCmpReport(WPARAM wParam, LPARAM lParam)
                if (!AfxGetApp()->PumpMessage())
                        break;
        GetMainFrame()->OnUpdateFrameTitle(FALSE);
+       *pCompleted = true;
        return 0;
 }